| | |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | od.shape, |
| | | fc.quantity -odpd.reporting_work_num as quantity, |
| | | fc.quantity -odpd.reporting_work_num + ifnull(c.patchNumSum,0) as quantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken |
| | | FROM |
| | |
| | | ON odpd.order_id = fc.order_id |
| | | AND odpd.order_number = fc.order_number |
| | | AND odpd.technology_number = fc.technology_number |
| | | and odpd.process_id = fc.process_id |
| | | left join |
| | | (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id |
| | | from patch_log |
| | | group by reporting_work_id,order_sort,technology_number) as c |
| | | on c.process_id = fc.process_id |
| | | and c.order_sort = fc.order_number |
| | | and c.technology_number = fc.technology_number |
| | | WHERE |
| | | fc.process_id = #{processIdStr} |
| | | AND fc.technology_number = #{technologyStr} |
| | |
| | | |
| | | <!-- 非第一道工序报工明细查询--> |
| | | <select id="SelectReworlDetailMp"> |
| | | SELECT fc.order_number, |
| | | ogd.glass_child, |
| | | ogd.technology_number, |
| | | ogd.glass_address, |
| | | fc.quantity as quantity_card, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | od.shape, |
| | | reporting_work_num -IFNULL(rwd.completed_quantity,0)-IFNULL(rwd.breakage_quantity,0)-IFNULL((rwd.wait_rework_quantity),0) as quantity |
| | | FROM sd.order_detail as od |
| | | left join sd.order_glass_detail as ogd |
| | | on od.order_id = ogd.order_id and od.order_number = ogd.order_number |
| | | left join sd.order_process_detail as opd |
| | | on opd.order_id = ogd.order_id and opd.order_number = ogd.order_number and |
| | | opd.technology_number = ogd.technology_number |
| | | |
| | | left join flow_card as fc on opd.order_id = fc.order_id and opd.order_number = fc.order_number and |
| | | opd.technology_number = fc.technology_number |
| | | left join reporting_work as rw on rw.order_id=fc.order_id and |
| | | rw.production_id=fc.production_id and rw.process_id=fc.process_id and rw.this_process = #{previousProcess} |
| | | left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id and |
| | | rwd.order_number=fc.order_number and rwd.technology_number=fc.technology_number |
| | | where fc.process_id = #{processIdStr} |
| | | and opd.process = #{previousProcess} |
| | | and position(ogd.technology_number in #{technologyStr}) |
| | | |
| | | SELECT |
| | | fc.order_number, |
| | | ogd.glass_child, |
| | | ogd.technology_number, |
| | | ogd.glass_address, |
| | | fc.quantity AS quantity_card, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | od.shape, |
| | | odpds.reporting_work_num -odpd.reporting_work_num + ifnull(c.patchNumSum,0) as quantity, |
| | | odpd.reporting_work_num_count as completed, |
| | | odpd.broken_num as onceBroken |
| | | FROM |
| | | sd.order_detail AS od |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | LEFT JOIN flow_card AS fc |
| | | ON fc.order_id = ogd.order_id |
| | | and fc.production_id=ogd.production_id |
| | | AND fc.order_number = ogd.order_number |
| | | AND fc.technology_number = ogd.technology_number |
| | | left join sd.order_process_detail as odpd |
| | | ON odpd.order_id = fc.order_id |
| | | AND odpd.order_number = fc.order_number |
| | | AND odpd.technology_number = fc.technology_number |
| | | and odpd.process_id = fc.process_id |
| | | left join sd.order_process_detail as odpds |
| | | ON odpds.id = odpd.id-1 |
| | | left join |
| | | (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id |
| | | from patch_log |
| | | group by reporting_work_id,order_sort,technology_number) as c |
| | | on c.process_id = fc.process_id |
| | | and c.order_sort = fc.order_number |
| | | and c.technology_number = fc.technology_number |
| | | WHERE |
| | | fc.process_id = #{processIdStr} |
| | | AND fc.technology_number = #{technologyStr} |
| | | AND odpd.process = #{process} |
| | | order by fc.order_number |
| | | </select> |
| | | |
| | |
| | | order by id desc,reporting_work_id desc limit 1 |
| | | </select> |
| | | |
| | | <!-- 查询流程卡工序报工可报数量--> |
| | | <select id="selectReportingWorkNum"> |
| | | |
| | | </select> |
| | | <select id="selectGlassProcessNum" resultType="java.lang.Integer"> |
| | | select |
| | | d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0) |
| | | from flow_card as a |
| | | left join sd.order_process_detail as b |
| | | on |
| | | b.order_number = a.order_number |
| | | and b.technology_number = a.technology_number |
| | | and b.order_id = SUBSTR(#{processId} from 1 for 10) |
| | | and b.process = #{thisProcess} |
| | | and b.process_id = a.process_id |
| | | left join sd.order_process_detail as d |
| | | on d.id=b.id-1 |
| | | left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id |
| | | from patch_log |
| | | group by reporting_work_id,order_sort,technology_number) as c |
| | | on |
| | | c.process_id = a.process_id |
| | | and c.order_sort = a.order_number |
| | | and c.technology_number = a.technology_number |
| | | |
| | | where |
| | | a.process_id=SUBSTR(#{processId} from 1 for 13) |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | | <select id="selectFlowCardNum" resultType="java.lang.Integer"> |
| | | select |
| | | a.quantity-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0) |
| | | from flow_card as a |
| | | left join sd.order_process_detail as b |
| | | on |
| | | b.order_number = a.order_number |
| | | and b.technology_number = a.technology_number |
| | | and b.order_id = SUBSTR(#{processId} from 1 for 10) |
| | | and b.process = #{thisProcess} |
| | | and b.process_id = a.process_id |
| | | left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id |
| | | from patch_log |
| | | group by reporting_work_id,order_sort,technology_number) as c |
| | | on |
| | | c.process_id = a.process_id |
| | | and c.order_sort = a.order_number |
| | | and c.technology_number = a.technology_number |
| | | |
| | | where |
| | | a.process_id=SUBSTR(#{processId} from 1 for 13) |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | | </mapper> |