liding
2026-05-20 4d99e718536ac77dff26dde8da7a59cdc9b52de8
src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -19,9 +19,13 @@
        u.nick_name as nickName,
        p.product_name as productName,
        pp.name as process,
        pp.qualified_rate as processQualifiedRate,
        pm.model as productModelName,
        pm.material_code as materialCode,
        ppo.quantity,
        ppo.scrap_qty,
        (ppo.quantity - ppo.scrap_qty) as qualifiedQty,
        case when ppo.quantity > 0 then round((ppo.quantity - ppo.scrap_qty) / ppo.quantity * 100, 2) else 0 end as actualQualifiedRate,
        ppo.other_data,
        pm.unit,
        sl.sales_contract_no salesContractNo
@@ -64,7 +68,6 @@
        ppo.quantity,
        ppo.scrap_qty,
        ppo.other_data,
        (ppo.quantity - ppo.scrap_qty) as qualifiedQty,
        pm.unit
        from
        production_product_main ppm
@@ -97,6 +100,7 @@
        p.product_name,
        pm.model as product_model_name,
        pm.unit,
        pm.material_code as materialCode,
        slpa.process,
        ppo.quantity,
        slpa.work_hours,
@@ -147,4 +151,16 @@
            #{id}
        </foreach>
    </delete>
    <select id="checkPreviousProcessReported" resultType="java.lang.Boolean">
        SELECT CASE WHEN COUNT(*) > 0 THEN TRUE ELSE FALSE END
        FROM product_work_order current_pwo
        JOIN product_process_route_item current_ppri ON current_pwo.product_process_route_item_id = current_ppri.id
        JOIN product_work_order previous_pwo ON previous_pwo.product_order_id = current_pwo.product_order_id
        JOIN product_process_route_item previous_ppri ON previous_pwo.product_process_route_item_id = previous_ppri.id
        JOIN production_product_main ppm ON ppm.work_order_id = previous_pwo.id
        WHERE current_pwo.id = #{workOrderId}
        AND previous_ppri.product_route_id = current_ppri.product_route_id
        AND previous_ppri.drag_sort = #{currentDragSort} - 1
    </select>
</mapper>