| | |
| | | <result column="glass_child" property="glassChild"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="teamOutputMap" type="com.example.erp.dto.pp.TeamOutputDTO"> |
| | | <result column="reporting_work_time" property="reportingWorkTime"/> |
| | | <result column="this_process" property="thisProcess"/> |
| | | <result column="teams_groups_name" property="teamsGroupsName"/> |
| | | <result column="project" property="project"/> |
| | | <result column="process_id" property="processId"/> |
| | | <result column="order_number" property="orderNumber"/> |
| | | <result column="width" property="width"/> |
| | | <result column="height" property="height"/> |
| | | <result column="shape" property="shape"/> |
| | | <result column="thickness" property="thickness"/> |
| | | <result column="edging_type" property="edgingType"/> |
| | | <result column="completed_quantity" property="completedQuantity"/> |
| | | <result column="area" property="area"/> |
| | | <result column="product_name" property="productName"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <!-- 流程卡进度--> |
| | | <select id="processCardProgressMp"> |
| | |
| | | select rw.reporting_work_id,rw.reporting_work_time,dd.responsible_process,dd.responsible_team, |
| | | dd.breakage_type,dd.breakage_reason,ROUND((dd.breakage_quantity)) as breakage_quantity, |
| | | round(ogd.child_width*ogd.child_height*(dd.breakage_quantity)/1000000,2) as area,rw.this_process, |
| | | o.project,o.order_id,ogd.glass_child |
| | | o.project,o.order_id,ogd.glass_child,rw.this_process |
| | | from |
| | | damage_details as dd |
| | | left join reporting_work as rw |
| | |
| | | o.project, |
| | | o.order_id, |
| | | o.batch, |
| | | od.shape, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | ogd.order_number, |
| | | ogd.technology_number, |
| | | ogd.process, |
| | |
| | | ogd.child_height as childHeight, |
| | | fc.quantity, |
| | | round( ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2 ) as area, |
| | | od.shape, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | od.remarks |
| | | FROM |
| | | sd.ORDER AS o |
| | |
| | | fc.technology_number, |
| | | od.product_name, |
| | | od.quantity, |
| | | MAX(opd.reporting_work_num_count) as quantityMax, |
| | | ifnull(MAX(opd.reporting_work_num_count),0) as quantityMax, |
| | | IFNULL(SUM(distinct dd.breakage_quantity), 0) as breakage_quantity, |
| | | IFNULL(sum(distinct pl.patch_num), 0) as patch_num, |
| | | fc.received_quantity, |
| | | ifnull(fc.received_quantity,0) as received_quantity, |
| | | CONCAT(ROUND(ROUND(od.quantity / MAX(opd.reporting_work_num_count), 2) * 100), '%') as finished |
| | | FROM sd.`order` AS o |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id |
| | |
| | | <select id="productionScheduleMp"> |
| | | select |
| | | a.order_number, |
| | | a.shape, |
| | | if(a.shape=1,'普形',if(a.shape=2,'异形','')) as shape, |
| | | a.product_name, |
| | | b.child_width, |
| | | b.child_height, |
| | |
| | | o.area, |
| | | date(fc.create_time) as create_time, |
| | | date(orw.startTime) as startTime, |
| | | oopd.completionsNum, |
| | | ifnull(oopd.completionsNum,0) as completionsNum, |
| | | sum( DISTINCT fc.received_quantity ) AS received_quantity, |
| | | sum( DISTINCT fc.quantity - fc.received_quantity ) AS receivedNo, |
| | | o.quantity-sum( DISTINCT fc.received_quantity ) AS receivedNo, |
| | | IF(fc.quantity=fc.received_quantity,'已清单','') as accomplish, |
| | | DATEDIFF( |
| | | MAX( rw.reporting_work_time ), |
| | |
| | | o.project, |
| | | o.order_id, |
| | | o.batch, |
| | | od.shape, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | ogd.order_number, |
| | | ogd.technology_number, |
| | | ogd.process, |
| | |
| | | order by fc.process_id, fc.order_number, fc.technology_number |
| | | </select> |
| | | |
| | | <select id="exportTaskCompletionStatusMp"> |
| | | select d.customer_name as customerName, |
| | | d.project, |
| | | d.batch, |
| | | c.order_id as orderId, |
| | | d.quantity, |
| | | d.area, |
| | | dd.quantity as shippedQuantity, |
| | | dd.area as shippedArea, |
| | | e.reportWorkQuantity, |
| | | e.reportWorkQuantityCount |
| | | |
| | | from sd.`order` as d |
| | | left join flow_card as c on c.order_id = d.order_id |
| | | left join |
| | | sd.order_detail as a |
| | | on c.order_id = a.order_id |
| | | and c.order_number = a.order_number |
| | | left join sd.order_glass_detail as b |
| | | on c.order_id = b.order_id |
| | | and b.order_number = c.order_number |
| | | and c.technology_number = b.technology_number |
| | | left join mm.finished_goods_inventory as f |
| | | on c.order_id = f.order_id and f.order_number = c.order_number |
| | | left join (SELECT process_id, |
| | | technology_number, |
| | | sum(a.broken_num) as broken_num, |
| | | concat('{', |
| | | GROUP_CONCAT(concat("\"", process, "\":\"", ifnull(reporting_work_num,0), "\"")), |
| | | '}' |
| | | ) as reportWorkQuantity, |
| | | concat('{', |
| | | GROUP_CONCAT(concat("\"", process, "\":\"", ifnull(reporting_work_num,0), "\"")), |
| | | '}' |
| | | ) as reportWorkQuantityCount |
| | | FROM sd.order_process_detail as a |
| | | left join sd.`order` as o on o.order_id = a.order_id |
| | | where date(o.create_time) >= #{date[0]} |
| | | and date(o.create_time) <= #{date[1]} |
| | | GROUP BY process_id,a.technology_number |
| | | ) as e |
| | | on e.process_id = c.process_id |
| | | and e.technology_number = c.technology_number |
| | | left join sd.delivery_detail as dd on dd.order_id = a.order_id and dd.order_number = a.order_number |
| | | where d.create_time and date(o.create_time) >= #{dates[0]} |
| | | and date(o.create_time) <= #{dates[1]} and reportWorkQuantity is not null |
| | | GROUP BY a.order_id |
| | | ORDER BY a.order_id |
| | | </select> |
| | | |
| | | <select id="exportRawMaterialRequisitionMp"> |
| | | SELECT fc.project_no, |
| | | modl.material_name, |
| | | modl.producer, |
| | | ou.width, |
| | | ou.height, |
| | | modl.date_of_manufacture, |
| | | SUM(distinct modl.outbound_quantity) as quantity, |
| | | ROUND(SUM(modl.outbound_quantity) * SUM(modl.single_piece_area), 2) as area, |
| | | date(mo.material_requisition_date) as date |
| | | FROM mm.material_outbound_detail AS modl |
| | | left join mm.material_outbound as mo on mo.material_outbound_id = modl.material_outbound_id |
| | | LEFT JOIN optimize_use AS ou ON modl.use_id = ou.id and ou.raw_stock_code = modl.inventory_id |
| | | LEFT JOIN flow_card AS fc ON ou.project_no = fc.project_no |
| | | where modl.use_id IS NOT NULL |
| | | and |
| | | date(mo.material_requisition_date) >= #{dates[0]} |
| | | and date(mo.material_requisition_date) <= #{dates[1]} |
| | | GROUP BY ou.width, ou.height, material_code |
| | | </select> |
| | | |
| | | <select id="exportQualityReportSv"> |
| | | SELECT o.order_id, |
| | | o.customer_name, |
| | | o.project, |
| | | fc.order_number, |
| | | fc.technology_number, |
| | | od.product_name, |
| | | od.quantity, |
| | | MAX(opd.reporting_work_num_count) as quantityMax, |
| | | IFNULL(SUM(distinct dd.breakage_quantity), 0) as breakage_quantity, |
| | | IFNULL(sum(distinct pl.patch_num), 0) as patch_num, |
| | | fc.received_quantity, |
| | | CONCAT(ROUND(ROUND(od.quantity / MAX(opd.reporting_work_num_count), 2) * 100), '%') as finished |
| | | FROM sd.`order` AS o |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id |
| | | |
| | | LEFT JOIN flow_card AS fc ON o.order_id = fc.order_id |
| | | AND fc.order_number = od.order_number |
| | | |
| | | LEFT JOIN damage_details AS dd ON dd.process_id = fc.process_id |
| | | AND dd.order_number = fc.order_number |
| | | AND dd.technology_number = fc.technology_number |
| | | and dd.available != 1 |
| | | |
| | | LEFT JOIN patch_log AS pl ON pl.order_id = fc.order_id |
| | | AND pl.process_id = fc.process_id |
| | | AND pl.order_sort = fc.order_number |
| | | AND pl.technology_number = fc.technology_number |
| | | |
| | | LEFT JOIN sd.order_process_detail AS opd ON opd.order_id = fc.order_id |
| | | AND opd.order_number = fc.order_number |
| | | AND opd.technology_number = fc.technology_number |
| | | |
| | | WHERE |
| | | date(o.create_time) >= #{dates[0]} |
| | | and date(o.create_time) <= #{dates[1]} |
| | | GROUP BY o.order_id, |
| | | fc.order_number, |
| | | fc.technology_number |
| | | ORDER BY fc.order_number |
| | | </select> |
| | | |
| | | <select id="exportYieldMp"> |
| | | SELECT opd.process, |
| | | o.order_id, |
| | | o.customer_name, |
| | | o.project, |
| | | od.product_name, |
| | | ROUND(SUM(distinct opd.reporting_work_num) * od.area, 2) as finishedArea |
| | | , |
| | | ROUND(SUM(distinct opd.broken_num) * od.area, 2) as brokenArea, |
| | | (ROUND(SUM(distinct opd.reporting_work_num) * od.area, 2) + |
| | | ROUND(SUM(distinct opd.broken_num) * od.area, 2)) as area, |
| | | CONCAT(ROUND(ROUND(ROUND(SUM(distinct opd.reporting_work_num) * od.area, 2) / |
| | | (ROUND(SUM(distinct opd.reporting_work_num) * od.area, 2) + |
| | | ROUND(SUM(distinct opd.broken_num) * od.area, 2)), 2) * 100), '%') as finished |
| | | FROM sd.`order` AS o |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id |
| | | LEFT JOIN flow_card AS fc ON fc.order_id = od.order_id |
| | | AND fc.order_number = fc.order_number |
| | | LEFT JOIN sd.order_process_detail AS opd ON opd.order_id = fc.order_id |
| | | AND opd.process_id = fc.process_id |
| | | AND opd.order_number = fc.order_number |
| | | AND opd.technology_number = fc.technology_number |
| | | WHERE opd.reporting_work_num > 0 |
| | | and date(o.create_time) >= #{date[0]} |
| | | and date(o.create_time) <= #{date[1]} |
| | | AND position(#{process} IN opd.process) |
| | | GROUP BY opd.process, o.order_id |
| | | </select> |
| | | |
| | | <select id="teamOutputMp" resultMap="teamOutputMap"> |
| | | SELECT |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | MAX( ogd.child_width ) as width, |
| | | MAX( ogd.child_height ) as height, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | sum( pd.thickness ) as thickness, |
| | | od.edging_type, |
| | | rwd.completed_quantity, |
| | | ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area, |
| | | od.product_name |
| | | FROM |
| | | reporting_work AS rw |
| | | LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id |
| | | LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id |
| | | AND od.order_number = rwd.order_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id |
| | | AND ogd.order_number = rwd.order_number |
| | | AND ogd.technology_number = rwd.technology_number |
| | | AND ogd.order_number = od.order_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | prod_id, |
| | | glass_sort, |
| | | REPLACE ( JSON_UNQUOTE( JSON_EXTRACT( separation, '$.thickness' )), 'mm', '' ) AS thickness |
| | | FROM |
| | | sd.product_detail |
| | | WHERE |
| | | detail_type = "glass" |
| | | ) AS pd ON pd.prod_id = od.product_id |
| | | AND pd.glass_sort = rwd.technology_number |
| | | where rw.reviewed_state=1 and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and rw.this_process=#{selectProcesses} |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{teamOutputDTO.thisProcess} |
| | | </if> |
| | | <if test="teamOutputDTO.teamsGroupsName != null and teamOutputDTO.teamsGroupsName != ''"> |
| | | and rw.teams_groups_name regexp #{teamOutputDTO.teamsGroupsName} |
| | | </if> |
| | | <if test="teamOutputDTO.project != null and teamOutputDTO.project != ''"> |
| | | and o.project regexp #{teamOutputDTO.project} |
| | | </if> |
| | | <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''"> |
| | | and rw.process_id regexp #{teamOutputDTO.processId} |
| | | </if> |
| | | <if test="teamOutputDTO.thickness != null and teamOutputDTO.thickness != ''"> |
| | | and thickness regexp #{teamOutputDTO.thickness} |
| | | </if> |
| | | <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''"> |
| | | and od.edging_type regexp #{teamOutputDTO.edgingType} |
| | | </if> |
| | | |
| | | GROUP BY |
| | | rwd.order_number, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rw.process_id, |
| | | rw.reporting_work_id |
| | | ORDER BY |
| | | rw.this_process, |
| | | rw.reporting_work_time, |
| | | rw.teams_groups_name, |
| | | rw.process_id |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="teamOutputPageTotal"> |
| | | SELECT |
| | | CEILING(count(rw.reporting_work_id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct rw.reporting_work_id) as 'total' |
| | | FROM |
| | | reporting_work AS rw |
| | | LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id |
| | | LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id |
| | | LEFT JOIN sd.order_detail AS od ON od.order_id = o.order_id |
| | | AND od.order_number = rwd.order_number |
| | | LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id |
| | | AND ogd.order_number = rwd.order_number |
| | | AND ogd.technology_number = rwd.technology_number |
| | | AND ogd.order_number = od.order_number |
| | | LEFT JOIN ( |
| | | SELECT |
| | | prod_id, |
| | | glass_sort, |
| | | REPLACE ( JSON_UNQUOTE( JSON_EXTRACT( separation, '$.thickness' )), 'mm', '' ) AS thickness |
| | | FROM |
| | | sd.product_detail |
| | | WHERE |
| | | detail_type = "glass" |
| | | ) AS pd ON pd.prod_id = od.product_id |
| | | AND pd.glass_sort = rwd.technology_number |
| | | where rw.reviewed_state=1 and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and rw.this_process=#{selectProcesses} |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{teamOutputDTO.thisProcess} |
| | | </if> |
| | | <if test="teamOutputDTO.teamsGroupsName != null and teamOutputDTO.teamsGroupsName != ''"> |
| | | and rw.teams_groups_name regexp #{teamOutputDTO.teamsGroupsName} |
| | | </if> |
| | | <if test="teamOutputDTO.project != null and teamOutputDTO.project != ''"> |
| | | and o.project regexp #{teamOutputDTO.project} |
| | | </if> |
| | | <if test="teamOutputDTO.processId != null and teamOutputDTO.processId != ''"> |
| | | and rw.process_id regexp #{teamOutputDTO.processId} |
| | | </if> |
| | | <if test="teamOutputDTO.thickness != null and teamOutputDTO.thickness != ''"> |
| | | and thickness regexp #{teamOutputDTO.thickness} |
| | | </if> |
| | | <if test="teamOutputDTO.edgingType != null and teamOutputDTO.edgingType != ''"> |
| | | and od.edging_type regexp #{teamOutputDTO.edgingType} |
| | | </if> |
| | | |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="workInProgressOrderMp"> |
| | | select #{selectProcesses} as thisProcess, |
| | | o.customer_name, |
| | | o.project, |
| | | o.order_id, |
| | | o.batch, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | sum(od.quantity) as quantity, |
| | | sum(odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num )as stockNum, |
| | | sum(ROUND(ogd.child_width * ogd.child_height * |
| | | (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num) / 1000000, 2)) as stockArea, |
| | | od.product_name |
| | | |
| | | 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(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 = #{selectProcesses} |
| | | and rw.review_status = 1 |
| | | 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 sd.`order` as o |
| | | on o.order_id = od.order_id |
| | | where LENGTH(fc.process_id) = 14 |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 |
| | | and odpd.process = #{selectProcesses} and o.create_time between #{selectTime1} and #{selectTime2} |
| | | and position(#{orderId} in od.order_id) and position(#{inputProject} in o.project) |
| | | |
| | | group by o.order_id |
| | | order by o.order_id |
| | | </select> |
| | | |
| | | <select id="workInProgressProcessMp"> |
| | | select #{selectProcesses} as thisProcess, |
| | | o.customer_name, |
| | | o.project, |
| | | o.order_id, |
| | | fc.process_id, |
| | | o.batch, |
| | | if(od.shape=1,'普形',if(od.shape=2,'异形','')) as shape, |
| | | sum(od.quantity) as quantity, |
| | | sum(odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num )as stockNum, |
| | | sum(ROUND(ogd.child_width * ogd.child_height * |
| | | (odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num) / 1000000, 2)) as stockArea, |
| | | od.product_name |
| | | |
| | | 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(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 = #{selectProcesses} |
| | | and rw.review_status = 1 |
| | | 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 sd.`order` as o |
| | | on o.order_id = od.order_id |
| | | where LENGTH(fc.process_id) = 14 |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 |
| | | and odpd.process = #{selectProcesses} and o.create_time between #{selectTime1} and #{selectTime2} |
| | | and position(#{orderId} in od.order_id) and position(#{inputProject} in o.project) |
| | | |
| | | group by o.order_id,fc.process_id |
| | | order by o.order_id,fc.process_id |
| | | </select> |
| | | </mapper> |