| | |
| | | select pot.*, |
| | | po.nps_no as npsNo, |
| | | po.is_end_order as endOrder, |
| | | po.team_leader_user_id as leaderUserId, |
| | | u.nick_name as leaderName, |
| | | teamUser.nick_name as teamUserName, |
| | | p.product_name as productName, |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | poro.operation_name as operationName, |
| | | poro.type as type, |
| | | IFNULL(scrapStat.scrapQty, 0) AS scrapQty, |
| | | ROUND(IFNULL(pot.complete_quantity, 0) / NULLIF(pot.plan_quantity, 0) * 100, 2) AS completionStatus, |
| | | CASE |
| | |
| | | left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id |
| | | left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id) |
| | | left join product p on pm.product_id = p.id |
| | | left join sys_user u on po.team_leader_user_id = u.user_id |
| | | left join sys_user teamUser on pot.team_user_id = teamUser.user_id |
| | | left join ( |
| | | select ppm.production_operation_task_id as taskId, |
| | | sum(ifnull(ppo.scrap_qty, 0)) as scrapQty |
| | |
| | | <if test="c != null and c.workOrderNo != null and c.workOrderNo != ''"> |
| | | and pot.work_order_no like concat('%', #{c.workOrderNo}, '%') |
| | | </if> |
| | | <!-- 班组长可以看到所有关联订单的数据,成员只能看到自己的报工 --> |
| | | <if test="c != null and currentUserId != null"> |
| | | and ( |
| | | po.team_leader_user_id = #{currentUserId} |
| | | or pot.team_user_id = #{currentUserId} |
| | | ) |
| | | </if> |
| | | </where> |
| | | order by pot.id desc |
| | | </select> |