| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.example.erp.mapper.sd.OrderProcessDetailMapper"> |
| | | |
| | | <insert id="insertOrderProcessDetail" > |
| | | insert into |
| | | order_process_detail( |
| | | order_id, |
| | | order_number, |
| | | technology_number, |
| | | process, |
| | | process_id |
| | | ) |
| | | values |
| | | <foreach collection ="processDetailList" item="processDetail" separator =","> |
| | | ( |
| | | #{processDetail.orderId}, |
| | | #{processDetail.orderNumber}, |
| | | #{processDetail.technologyNumber}, |
| | | #{processDetail.process}, |
| | | #{processDetail.processId} |
| | | ) |
| | | </foreach> |
| | | |
| | | |
| | | </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> |
| | | |
| | | <!--查询筛选后唯一的流程卡号--> |
| | | <select id="filterOrderProcess"> |
| | | select id,process,order_number,technology_number |
| | | from order_process_detail |
| | | where order_id = #{orderId} |
| | | group by process |
| | | order by id |
| | | |
| | | </select> |
| | | |
| | | <select id="filterLastProcess"> |
| | | select id,process,order_number,technology_number |
| | | from order_process_detail |
| | | where order_id = #{orderId} |
| | | and order_number = #{orderNumber} |
| | | and technology_number = #{technologyNumber} |
| | | and id > #{id} |
| | | group by process |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getGlassLRow"> |
| | | select |
| | | max(a.technology_number) as rowCount, |
| | | RowNum |
| | | from order_process_detail as a |
| | | left join |
| | | (select min((@i:=@i+1)) AS RowNum,c.* |
| | | from sd.order_glass_detail as c, |
| | | (SELECT @i:=-1) as d |
| | | where order_id = #{orderId} |
| | | GROUP BY order_number |
| | | ) as b |
| | | on b.order_number = a.order_number |
| | | where a.order_id = #{orderId} |
| | | group by a.order_number |
| | | |
| | | </select> |
| | | <update id="insertByReportingWorkDetail"> |
| | | update sd.order_process_detail as a |
| | | set |
| | | a.reporting_work_num_count= |
| | | a.reporting_work_num_count+#{reportingWorkDetail.completedQuantity}, |
| | | a.reporting_work_num =a.reporting_work_num +#{reportingWorkDetail.completedQuantity}, |
| | | a.broken_num =a.broken_num +#{reportingWorkDetail.breakageQuantity} |
| | | |
| | | where |
| | | a.process_id = #{processId} |
| | | and a.order_number= #{reportingWorkDetail.orderNumber} |
| | | and a.technology_number= #{reportingWorkDetail.technologyNumber} |
| | | and a.process=#{thisProcess} |
| | | |
| | | </update> |
| | | |
| | | <select id="filterOrderProcessCollect"> |
| | | select a.id,process,order_number,technology_number,a.order_id |
| | | from order_process_detail as a |
| | | left join `order` as b on a.order_id=b.order_id |
| | | where b.create_time BETWEEN #{selectTime1} and #{selectTime2} |
| | | group by process |
| | | |
| | | </select> |
| | | |
| | | <select id="getGlassLRowCollect"> |
| | | select |
| | | max(a.technology_number) as rowCount, |
| | | RowNum |
| | | from order_process_detail as a |
| | | left join |
| | | (select min((@i:=@i+1)) AS RowNum,c.* |
| | | from sd.order_glass_detail as c |
| | | left join sd.`order` o2 on c.order_id = o2.order_id, |
| | | (SELECT @i:=-1) as d |
| | | where o2.create_time BETWEEN #{selectTime1} and #{selectTime2} |
| | | GROUP BY order_number |
| | | ) as b |
| | | on b.order_number = a.order_number |
| | | left join sd.`order` o on a.order_id = o.order_id |
| | | where o.create_time BETWEEN #{selectTime1} and #{selectTime2} |
| | | group by a.order_number |
| | | </select> |
| | | |
| | | <select id="selectNextProcess"> |
| | | select a.process from sd.order_process_detail as a, |
| | | (select id,process from sd.order_process_detail |
| | | where process_id=#{processId} |
| | | and technology_number=#{technologyNumber} |
| | | and process=#{thisProcess} |
| | | group by process) as b |
| | | where a.id = b.id + 1 |
| | | and a.process_id=#{processId} |
| | | and a.technology_number=#{technologyNumber} |
| | | |
| | | </select> |
| | | </mapper> |