| | |
| | | |
| | | </resultMap> |
| | | |
| | | <!-- 查询当前工序的表头数据--> |
| | | <select id="AddSelectLastWorkMp" resultMap="reportingWorkMap"> |
| | | select o.order_id, |
| | | fc.production_id, |
| | |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | od.shape, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num as quantity, |
| | | fc.quantity -odpd.reporting_work_num -odpd.broken_num as completedQuantity, |
| | | odpd.reporting_work_num as completed, |
| | | odpd.broken_num as onceBroken, |
| | | if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag -- 判断是否已经完成,已经完成不序号和同序号数量相同才能提交 |
| | |
| | | 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} |
| | |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | od.shape, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity, |
| | | odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity, |
| | | if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num ) < 0, |
| | | 0, |
| | | odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as quantity, |
| | | if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) < 0, |
| | | 0, |
| | | odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as completedQuantity, |
| | | odpd.reporting_work_num as completed, |
| | | odpd.broken_num as onceBroken, |
| | | ogd.`group`, |
| | |
| | | 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 |
| | | (SELECT |
| | | sum(rw.rework_num) as 'patchNumSum', |
| | | rw.process_id,rw.order_sort,rw.technology_number, |
| | | rwk.this_process |
| | | from |
| | | rework as rw |
| | | LEFT JOIN |
| | | reporting_work as rwk |
| | | on rw.reporting_work_id =rwk.reporting_work_id |
| | | where rwk.this_process=#{process} |
| | | and rw.review_status=1 |
| | | and rw.process_id = #{processIdStr} |
| | | GROUP BY rw.process_id,rw.order_sort,rw.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} |
| | | <if test="process != '中空' and process != '夹胶' and process != '包装'"> |
| | |
| | | </select> |
| | | <select id="selectGlassProcessNum" resultType="java.lang.Integer"> |
| | | select |
| | | d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0) |
| | | if((d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)< 0, |
| | | 0, |
| | | (d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num) |
| | | ) |
| | | from flow_card as a |
| | | left join sd.order_process_detail as b |
| | | on |
| | |
| | | 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 |
| | | left join (SELECT |
| | | sum(rw.rework_num) as 'reworkNumSum', |
| | | rw.process_id,rw.order_sort,rw.technology_number, |
| | | rwk.this_process |
| | | from |
| | | rework as rw |
| | | LEFT JOIN |
| | | reporting_work as rwk |
| | | on rw.reporting_work_id =rwk.reporting_work_id |
| | | where rwk.this_process=#{thisProcess} |
| | | and rw.review_status=1 |
| | | and rw.process_id = SUBSTR(#{processId} from 1 for 14) |
| | | GROUP BY rw.process_id,rw.order_sort,rw.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) |
| | | a.process_id=SUBSTR(#{processId} from 1 for 14) |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | |
| | | 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 |
| | | group by 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) |
| | | a.process_id=SUBSTR(#{processId} from 1 for 14) |
| | | and a.order_number = #{orderNumber} |
| | | and a.technology_number = #{technologyNumber} |
| | | </select> |
| | |
| | | d.child_width, |
| | | d.child_height, |
| | | e.shape, |
| | | a.completed_quantity+a.breakage_quantity as 'quantity', -- 可报工数 |
| | | a.completed_quantity as 'completedQuantity', -- 完工数 |
| | | a.breakage_quantity as 'breakageQuantity', -- 破损数 |
| | | f.completed_quantity as thisQuantitySum ,-- 本工序完工和 |
| | | if(ifnull(a.completed_quantity+a.breakage_quantity,0)=0, |
| | | c.quantity-ifnull(a.completed_quantity+a.breakage_quantity,0), |
| | | ifnull(a.completed_quantity+a.breakage_quantity,0)) as 'quantity', -- 可报工数 |
| | | ifnull(a.completed_quantity,0) as 'completedQuantity', -- 完工数 |
| | | ifnull(a.breakage_quantity,0) as 'breakageQuantity', -- 破损数 |
| | | ifnull(f.completed_quantity,0) as thisQuantitySum ,-- 本工序完工和 |
| | | if(c.quantity-f.completed_quantity = 0 ,true,false) as saveFlag, |
| | | <if test="nextProcess != null and nextProcess != ''"> -- 非最后一道工序 |
| | | ifnull(g.completed_quantity,0) as nextQuantitySum, -- 后工序已完成 |
| | |
| | | as minQuantity -- 修改最小数 |
| | | </if> |
| | | -- e.thisQuantitySum |
| | | from |
| | | reporting_work_detail as a |
| | | left join reporting_work as b |
| | | on a.reporting_work_id = b.reporting_work_id |
| | | left join flow_card as c |
| | | on c.process_id = b.process_id |
| | | and c.technology_number = a.technology_number |
| | | from reporting_work as b |
| | | |
| | | right join flow_card as c |
| | | on c.process_id = b.process_id |
| | | |
| | | left join reporting_work_detail as a |
| | | on a.reporting_work_id = b.reporting_work_id |
| | | and c.order_number=a.order_number |
| | | and c.technology_number = a.technology_number |
| | | |
| | | left join sd.order_glass_detail as d |
| | | on d.order_id = c.order_id |
| | | and c.order_number = d.order_number |
| | |
| | | and g.order_number = a.order_number |
| | | and g.technology_number = a.technology_number |
| | | </if> |
| | | where a.reporting_work_id = #{reportingWorkId} |
| | | where b.reporting_work_id = #{reportingWorkId} |
| | | GROUP BY c.order_number,c.technology_number |
| | | </select> |
| | | <select id="selectReportingWorkMp" resultMap="reportingWorkMap"> |
| | | select rw.reporting_work_id, |
| | |
| | | o.batch, |
| | | rw.this_process, |
| | | rw.this_completed_quantity, |
| | | (ogd.area * rw.this_completed_quantity) as completedArea, |
| | | round(ogd.area * rw.this_completed_quantity,2) as completedArea, |
| | | rw.this_worn_quantity, |
| | | (ogd.area * rw.this_worn_quantity) as wornArea, |
| | | round(ogd.area * rw.this_worn_quantity,2) as wornArea, |
| | | rw.device_name, |
| | | rw.teams_groups_name, |
| | | rw.reviewed_state |
| | |
| | | select process |
| | | from sd.order_process_detail |
| | | where process_id = #{processId} |
| | | and order_number = 1 |
| | | and technology_number = 1 |
| | | order by id desc |
| | | LIMIT 1 |