chenlu
2024-03-15 e7b89d449afc3912c21a64d59bafd7737f7376fd
north-glass-erp/src/main/resources/mapper/sd/OrderProcessDetail.xml
@@ -26,5 +26,47 @@
    </insert>
    <update id="updateQuantity">
        update sd.order_process_detail as a
        inner join
        (select
             rwd.completed_quantity,
             rwd.breakage_quantity,
             rw.process_id,
             rwd.order_number,
             rwd.technology_number
              from pp.reporting_work_detail as rwd
            left join pp.reporting_work as rw
                on rwd.reporting_work_id =  rw.reporting_work_id
            where rwd.reporting_work_id =#{reportingWorkId} )  as b
        on a.process_id = b.process_id
        and a.order_number = b.order_number
        and a.technology_number = b.technology_number
        <if test="type == 'delete'">
            set a.reporting_work_num_count
                = a.reporting_work_num_count-b.completed_quantity,
            a.reporting_work_num
                = a.reporting_work_num-b.completed_quantity,
            a.broken_num
                = a.broken_num-b.breakage_quantity
        </if>
        <if test="type == 'add'">
            set a.reporting_work_num_count
            = a.reporting_work_num_count+b.completed_quantity,
            a.reporting_work_num
            = a.reporting_work_num+b.completed_quantity,
            a.broken_num
            = a.broken_num+b.breakage_quantity
        </if>
        where a.process = #{process}
    </update>
</mapper>