| | |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |
| | | |
| | | <!-- 领料详情:一条领料流水一行,展示每次实际领取(含补料)的数量,而不是主单汇总 --> |
| | | <select id="listPickedDetailByOrderId" resultType="com.ruoyi.production.bean.vo.ProductionOrderPickVo"> |
| | | select popr.*, |
| | | poro.operation_name as operationName, |
| | | select popr.pick_id as id, |
| | | popr.id as recordId, |
| | | popr.pick_id as pickId, |
| | | popr.production_order_id as productionOrderId, |
| | | popr.production_operation_task_id as productionOperationTaskId, |
| | | pop.technology_operation_id as technologyOperationId, |
| | | pop.operation_name as operationName, |
| | | popr.product_model_id as productModelId, |
| | | popr.batch_no as batchNo, |
| | | popr.before_quantity as beforeQuantity, |
| | | popr.after_quantity as afterQuantity, |
| | | popr.pick_type as pickType, |
| | | popr.remark, |
| | | popr.create_time as createTime, |
| | | popr.update_time as updateTime, |
| | | popr.create_user as createUser, |
| | | popr.dept_id as deptId, |
| | | case |
| | | when popr.pick_type = 2 then 0 |
| | | else round(pop.demanded_quantity * popr.pick_quantity / nullif(pop.quantity, 0), 2) |
| | | end as demandedQuantity, |
| | | case |
| | | when popr.pick_type = 2 then popr.pick_quantity |
| | | else 0 |
| | | end as feedingQty, |
| | | case |
| | | when popr.pick_type = 2 then 0 |
| | | else popr.pick_quantity |
| | | end as pickQuantity, |
| | | pop.return_qty as returnQty, |
| | | pop.is_returned as returned, |
| | | pop.is_bom as bom, |
| | | p.product_name as productName, |
| | | pm.model as model, |
| | | pm.unit as unit |
| | | from production_order_pick_record popr |
| | | left join production_operation_task pot on popr.production_operation_task_id = pot.id |
| | | left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id |
| | | join production_order_pick pop on pop.id = popr.pick_id |
| | | left join product_model pm on popr.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where popr.production_order_id = #{productionOrderId} |
| | | order by popr.create_time desc, popr.id desc |
| | | order by popr.create_time, popr.id |
| | | </select> |
| | | |
| | | <select id="listFeedingRecord" resultType="com.ruoyi.production.bean.vo.ProductionOrderPickRecordVo"> |