| | |
| | | pb.bom_no AS bomNo, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | pms.model, |
| | | pms.material_code AS materialCode |
| | | pms.material_code AS materialCode, |
| | | pms.id AS productId |
| | | FROM product_order po |
| | | LEFT JOIN process_route pr ON po.route_id = pr.id |
| | | LEFT JOIN product_bom pb ON pr.bom_id = pb.id |
| | | LEFT JOIN ( |
| | | SELECT product_order_id, MIN(production_plan_id) AS production_plan_id |
| | | FROM product_order_plan |
| | | GROUP BY product_order_id |
| | | ) pop ON po.id = pop.product_order_id |
| | | LEFT JOIN production_plan pp ON pop.production_plan_id = pp.id |
| | | LEFT JOIN product_material_sku pms ON pms.id = pp.product_material_sku_id |
| | | LEFT JOIN product_material_sku pms ON pms.id = po.product_material_sku_id |
| | | LEFT JOIN product_material pm ON pm.id = pms.product_id |
| | | <where> |
| | | <if test="c.npsNo != null and c.npsNo != ''"> |
| | |
| | | <if test="c.startTime != null and c.endTime != null"> |
| | | AND po.create_time BETWEEN #{c.startTime} AND #{c.endTime} |
| | | </if> |
| | | <if test="c.status != null"> |
| | | AND po.status = #{c.status} |
| | | </if> |
| | | <if test="c.productName != null and c.productName != ''"> |
| | | AND pm.product_name LIKE CONCAT('%', #{c.productName}, '%') |
| | | </if> |
| | | <if test="c.materialCode != null and c.materialCode != ''"> |
| | | AND pms.material_code LIKE CONCAT('%', #{c.materialCode}, '%') |
| | | </if> |
| | | <if test="c.model != null and c.model != ''"> |
| | | AND pms.model LIKE CONCAT('%', #{c.model}, '%') |
| | | </if> |
| | | <if test="c.strength != null and c.strength != ''"> |
| | | AND po.strength = #{c.strength} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute"> |
| | | select pr.* |
| | | from process_route pr |
| | |
| | | ORDER BY pp.apply_no |
| | | |
| | | </select> |
| | | <select id="finishedPage" resultType="com.ruoyi.quality.dto.FinishedPageDto"> |
| | | select * from |
| | | (select po.id productOrderId, |
| | | po.status, |
| | | po.nps_no, |
| | | sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | po.strength, |
| | | po.quantity needQuantity, |
| | | sum(ppo.quantity) qualifiedQuantity, |
| | | sum(ppo.scrap_qty) unqualifiedQuantity, |
| | | sum(ppo.quantity+ppo.scrap_qty) quantity |
| | | from product_order po |
| | | LEFT JOIN product_material_sku sku ON po.product_material_sku_id = sku.id |
| | | LEFT JOIN product_material pm ON sku.product_id = pm.id |
| | | LEFT JOIN production_product_main ppm ON ppm.product_order_id = po.id |
| | | LEFT JOIN production_product_output ppo ON ppo.product_main_id = ppm.id |
| | | group by po.id , |
| | | po.status, |
| | | po.nps_no, |
| | | sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | po.strength, |
| | | po.quantity |
| | | order by po.id desc )A |
| | | <where> |
| | | <if test="c.npsNo != null and c.npsNo != ''"> |
| | | AND A.nps_no LIKE CONCAT('%', #{c.npsNo}, '%') |
| | | </if> |
| | | <if test="c.productName != null and c.productName != ''"> |
| | | AND A.product_name LIKE CONCAT('%', #{c.productName}, '%') |
| | | </if> |
| | | <if test="c.materialCode != null and c.materialCode != ''"> |
| | | AND A.material_code LIKE CONCAT('%', #{c.materialCode}, '%') |
| | | </if> |
| | | <if test="c.model != null and c.model != ''"> |
| | | AND A.model LIKE CONCAT('%', #{c.model}, '%') |
| | | </if> |
| | | <if test="c.strength != null and c.strength != ''"> |
| | | AND A.strength = #{c.strength} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="finishedRatio" resultType="com.ruoyi.quality.dto.FinishedRatioDto"> |
| | | select A.material_code, |
| | | product_name, |
| | | model, |
| | | unit, |
| | | actualInputQuantity, |
| | | actualOutputQuantity, |
| | | actualInputQuantity / actualOutputQuantity actualInputOutputRatio, |
| | | unit_quantity standardInputOutputRatio, |
| | | (actualInputQuantity / actualOutputQuantity - unit_quantity)/unit_quantity deviationRate |
| | | from (select |
| | | sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | pprip.unit, |
| | | pos.unit_quantity, |
| | | sum(pprip.product_value) actualInputQuantity, |
| | | sum(ppo.quantity+ppo.scrap_qty) actualOutputQuantity |
| | | from production_product_route_item_param pprip |
| | | left join production_product_route_item ppri on ppri.id=pprip.production_product_route_item_id |
| | | left join production_product_main ppm on ppm.id=ppri.product_main_id |
| | | left join production_product_output ppo on ppm.id=ppo.product_main_id |
| | | left join product_material_sku sku ON pprip.product_id = sku.id |
| | | left join product_material pm ON sku.product_id = pm.id |
| | | left join production_order_structure pos ON pos.product_model_id = pprip.product_id |
| | | where ppm.product_order_id = #{productOrderId} |
| | | and pos.order_id = #{productOrderId} |
| | | and pprip.order_item_param_id is null |
| | | group by sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | pos.unit_quantity, |
| | | pprip.unit)A |
| | | |
| | | </select> |
| | | </mapper> |