| | |
| | | where fc.process_id = #{processIdStr} |
| | | and POSITION(fc.technology_number in #{technologyStr}) |
| | | and if(#{reportType}=1,o.order_type!='样品订单',o.order_id!='') |
| | | and o.create_order>0 |
| | | GROUP BY fc.process_id |
| | | </select> |
| | | |
| | |
| | | select ifnull((select ogd.process |
| | | from sd.order_glass_detail as ogd |
| | | left join sd.`order` as o on o.order_id=ogd.order_id |
| | | where ogd.production_id = LEFT(#{processIdStr}, 11) |
| | | left join flow_card as fc on fc.order_id=o.order_id and fc.order_number=ogd.order_number and fc.technology_number=ogd.technology_number |
| | | where fc.process_id = #{processIdStr} |
| | | and o.create_order>0 |
| | | and POSITION(ogd.technology_number in #{technologyStr}) |
| | | and POSITION(fc.technology_number in #{technologyStr}) |
| | | limit 1),'') as process |
| | | |
| | | </select> |
| | |
| | | AND POSITION(fc.technology_number in #{technologyStr}) |
| | | AND odpd.process = #{process} |
| | | and if(#{reportType}=1,o.order_type!='样品订单',o.order_id!='') |
| | | and o.create_order>0 |
| | | group by fc.order_number, |
| | | ogd.technology_number |
| | | order by fc.order_number |
| | |
| | | LEFT JOIN sd.order_glass_detail AS ogd |
| | | ON od.order_id = ogd.order_id |
| | | AND od.order_number = ogd.order_number |
| | | <if test="process == '夹胶' or (process == '打胶和粘框' and previousProcess=='夹胶')"> |
| | | <if test="process == '夹胶' or (process == '打胶和粘框')"> |
| | | AND ogd.`group` = (select `group` |
| | | from sd.order_glass_detail |
| | | where order_id = ogd.order_id |
| | |
| | | |
| | | WHERE |
| | | fc.process_id = #{processIdStr} |
| | | <if test="process != '中空' and process != '夹胶' and process != '包装' and process != '打胶和粘框' "> |
| | | <if test="laminating != 'laminating'"> |
| | | AND POSITION(fc.technology_number in #{technologyStr}) |
| | | </if> |
| | | AND odpd.process = #{process} |
| | |
| | | </select> |
| | | <select id="selectGlassProcessNum" resultType="java.lang.Integer"> |
| | | select |
| | | if((d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)< 0, |
| | | ifnull(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) |
| | | ) |
| | | ),0) |
| | | from flow_card as a |
| | | left join sd.order_process_detail as b |
| | | on |
| | |
| | | ifnull(f.completed_quantity,0) as thisQuantitySum ,-- 本工序完工和 |
| | | if(c.quantity-f.completed_quantity = 0 ,true,false) as saveFlag, |
| | | e.other_columns, |
| | | IF(count(pl.id)>0,'已补片','') as patchStatusOther, |
| | | |
| | | <if test="nextProcess != null and nextProcess != ''"> -- 非最后一道工序 |
| | | ifnull(g.completed_quantity,0) as nextQuantitySum, -- 后工序已完成 |
| | | if((f.completed_quantity |
| | | -ifnull(g.completed_quantity,0)) |
| | | >= |
| | | > |
| | | a.completed_quantity, |
| | | 0, |
| | | (a.completed_quantity-f.completed_quantity |
| | | +ifnull(g.completed_quantity,0)) |
| | | (f.completed_quantity |
| | | -ifnull(g.completed_quantity,0)) |
| | | ) as minQuantity -- 修改最小数 |
| | | </if> |
| | | <if test="nextProcess == null or nextProcess == ''"> -- 最后一道工序 |
| | |
| | | and d.technology_number = c.technology_number |
| | | left join sd.order_detail as e |
| | | on e.order_id = d.order_id and e.order_number = d.order_number |
| | | left join patch_log as pl on pl.reporting_work_id=b.reporting_work_id |
| | | and pl.order_sort=a.order_number and pl.technology_number=a.technology_number |
| | | |
| | | left join (select sum(completed_quantity) as completed_quantity , |
| | | rw.process_id, |
| | |
| | | o.batch, |
| | | rw.this_process, |
| | | rw.this_completed_quantity, |
| | | round(ogd.area * rw.this_completed_quantity,2) as completedArea, |
| | | round(ogd.child_width*ogd.child_height * rw.this_completed_quantity/1000000,2) as completedArea, |
| | | rw.this_worn_quantity, |
| | | round(ogd.area * rw.this_worn_quantity,2) as wornArea, |
| | | round(ogd.child_width*ogd.child_height * rw.this_worn_quantity/1000000,2) as wornArea, |
| | | rw.device_name, |
| | | rw.teams_groups_name, |
| | | rw.reviewed_state, |
| | |
| | | on rwd.reporting_work_id = rw.reporting_work_id and rwd.order_number = ogd.order_number and |
| | | rwd.technology_number = ogd.technology_number |
| | | where rw.reviewed_state != 2 |
| | | and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | and position(#{orderId} in rw.order_id) |
| | | and rw.reviewed_state!=-1 |
| | | and o.create_order>0 |
| | |
| | | on rwd.reporting_work_id = rw.reporting_work_id and rwd.order_number = ogd.order_number and |
| | | rwd.technology_number = ogd.technology_number |
| | | where rw.reviewed_state != 2 |
| | | and rw.reporting_work_time between #{selectTime1} and #{selectTime2} and position(#{orderId} in rw.order_id) |
| | | and rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} and position(#{orderId} in rw.order_id) |
| | | and rw.reviewed_state!=-1 |
| | | and o.create_order>0 |
| | | <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''"> |
| | |
| | | |
| | | left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id |
| | | where rw.reviewed_state != 2 |
| | | and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2} |
| | | and position(#{processId} in rw.process_id) |
| | | and position(#{state} in dd.quality_ins_status) |
| | | and rw.reviewed_state!=-1 |
| | |
| | | |
| | | left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id |
| | | where rw.reviewed_state != 2 |
| | | and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and DATE_FORMAT((rw.reporting_work_time), '%Y-%m-%d') between #{selectTime1} and #{selectTime2} |
| | | and position(#{processId} in rw.process_id) |
| | | and position(#{state} in dd.quality_ins_status) |
| | | and rw.reviewed_state!=-1 |
| | |
| | | where reporting_work_id=#{reportingWorkId} and order_number = #{orderSort} |
| | | and technology_number = #{technologyNumber} |
| | | </update> |
| | | |
| | | <select id="selectUserProcess"> |
| | | select address from erp_user_info.user where login_name=#{userId} |
| | | </select> |
| | | |
| | | <select id="getSelectProcessJiajiao"> |
| | | SELECT * FROM ( |
| | | SELECT * FROM sd.basic_data |
| | | WHERE basic_type='product' AND basic_category='process' AND basic_name='夹胶' |
| | | |
| | | UNION |
| | | |
| | | SELECT * FROM sd.basic_data |
| | | WHERE basic_type='product' AND basic_category='process' AND basic_name='均质' |
| | | ) AS combined_results; |
| | | </select> |
| | | |
| | | <select id="getSelectProcessDuoqu"> |
| | | SELECT * FROM ( |
| | | SELECT * FROM sd.basic_data |
| | | WHERE basic_type='product' AND basic_category='process' AND basic_name='技术部多曲' |
| | | |
| | | UNION |
| | | |
| | | SELECT * FROM sd.basic_data |
| | | WHERE basic_type='product' AND basic_category='process' AND basic_name='钢化' |
| | | ) AS combined_results; |
| | | </select> |
| | | |
| | | <select id="SelectReworlDetailMpReview"> |
| | | SELECT |
| | | fc.order_number, |
| | | ogd.glass_child, |
| | | ogd.technology_number, |
| | | ogd.glass_address, |
| | | fc.quantity AS quantity_card, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | 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`, |
| | | if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag, -- 判断是否已经完成,已经完成不序号和同序号数量相同才能提交 |
| | | od.other_columns, |
| | | ogd.id as 'glassId' |
| | | ,rws.reviewed_state |
| | | 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 |
| | | <if test="process == '夹胶' or (process == '打胶和粘框')"> |
| | | AND ogd.`group` = (select `group` |
| | | from sd.order_glass_detail |
| | | where order_id = ogd.order_id |
| | | and order_number = ogd.order_number |
| | | and POSITION(technology_number in #{technologyStr}) |
| | | limit 1) |
| | | </if> |
| | | |
| | | |
| | | 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(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=0 |
| | | 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 |
| | | left join (select reviewed_state as reviewed_state , |
| | | process_id,a.reporting_work_id,b.technology_number,b.order_number |
| | | from reporting_work as a |
| | | left join reporting_work_detail as b on a.reporting_work_id = b.reporting_work_id |
| | | where this_process=#{previousProcess} and reviewed_state=0 and process_id= #{processIdStr} |
| | | |
| | | GROUP BY a.reporting_work_id,b.order_number,b.technology_number |
| | | ) as rws |
| | | on rws.process_id = fc.process_id and rws.order_number=fc.order_number and rws.technology_number=fc.technology_number |
| | | WHERE |
| | | fc.process_id = #{processIdStr} |
| | | <if test="laminating != 'laminating' "> |
| | | AND POSITION(fc.technology_number in #{technologyStr}) |
| | | </if> |
| | | AND odpd.process = #{process} |
| | | and rws.reviewed_state=0 |
| | | order by fc.order_number |
| | | </select> |
| | | |
| | | <select id="getProcessLaminating"> |
| | | select IFNULL(nickname,'') from sd.basic_data where basic_category='process' and basic_name=#{process} |
| | | </select> |
| | | |
| | | <select id="selectOrderid"> |
| | | select order_id from pp.flow_card where process_id=#{processIdStr} group by order_id |
| | | </select> |
| | | </mapper> |