| | |
| | | |
| | | </resultMap> |
| | | |
| | | <resultMap id="damageDetailsTableMap" type="com.example.erp.entity.pp.DamageDetails"> |
| | | <resultMap id="damageDetailsTableMap" type="com.example.erp.dto.pp.CrossProcessBreakingDTO"> |
| | | <result column="responsible_process" property="responsibleProcess"/> |
| | | <result column="responsible_team" property="responsibleTeam"/> |
| | | <result column="breakage_type" property="breakageType"/> |
| | | <result column="breakage_reason" property="breakageReason"/> |
| | | <result column="breakage_quantity" property="breakageQuantity"/> |
| | | <result column="area" property="area"/> |
| | | <result column="reporting_work_id" property="reportingWork.reportingWorkId"/> |
| | | <result column="reporting_work_time" property="reportingWork.reportingWorkTime"/> |
| | | <result column="this_process" property="reportingWork.thisProcess"/> |
| | | <result column="project" property="order.project"/> |
| | | <result column="order_id" property="order.orderId"/> |
| | | <result column="glass_child" property="orderGlassDetail.glassChild"/> |
| | | <result column="reporting_work_time" property="reportingWorkTime"/> |
| | | <result column="this_process" property="thisProcess"/> |
| | | <result column="project" property="project"/> |
| | | <result column="order_id" property="orderId"/> |
| | | <result column="glass_child" property="glassChild"/> |
| | | <result column="process_id" property="processId"/> |
| | | <result column="code" property="code"/> |
| | | </resultMap> |
| | | |
| | | |
| | |
| | | <result column="breakage_reason" property="breakageReason"/> |
| | | <result column="personnel" property="personnel"/> |
| | | <result column="glass_child" property="glassChild"/> |
| | | <result column="glassNumber" property="glassNumber"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="teamOutputMap" type="com.example.erp.dto.pp.TeamOutputDTO"> |
| | |
| | | <result column="plan_end_time" property="planEndTime"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="workInProgressMap" type="com.example.erp.dto.pp.WorkInProgressDTO"> |
| | | <result column="thisProcess" property="thisProcess"/> |
| | | <result column="order_id" property="orderId"/> |
| | | <result column="process_id" property="processId"/> |
| | | <result column="customer_name" property="customerName"/> |
| | | <result column="project" property="project"/> |
| | | <result column="batch" property="batch"/> |
| | | <result column="order_number" property="orderNumber"/> |
| | | <result column="technology_number" property="technologyNumber"/> |
| | | <result column="shape" property="shape"/> |
| | | <result column="process" property="process"/> |
| | | <result column="quantity" property="quantity"/> |
| | | <result column="child_width" property="childWidth"/> |
| | | <result column="child_height" property="childHeight"/> |
| | | <result column="stockNum" property="stockNum"/> |
| | | <result column="stockArea" property="stockArea"/> |
| | | <result column="product_name" property="productName"/> |
| | | <result column="bend_radius" property="bendRadius"/> |
| | | </resultMap> |
| | | |
| | | <!-- 流程卡进度--> |
| | | <select id="processCardProgressMp"> |
| | |
| | | e.broken_num, |
| | | ifnull(f.inventory, 0) as inventory, |
| | | round(ifnull(f.inventory, 0) * a.area, 2) as inventoryArea, |
| | | ifnull(dd.quantity, 0) as shippedQuantity |
| | | ifnull(dd.quantity, 0) as shippedQuantity, |
| | | JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')) AS glassNumber |
| | | from flow_card as c |
| | | left join |
| | | sd.order_detail as a |
| | |
| | | o.project, |
| | | o.order_id, |
| | | ogd.glass_child, |
| | | rw.this_process |
| | | from damage_details as dd |
| | | left join reporting_work as rw |
| | | on rw.reporting_work_id = dd.reporting_work_id |
| | | left join sd.order as o |
| | | on rw.order_id = o.order_id |
| | | left join sd.order_glass_detail as ogd |
| | | on ogd.order_id = o.order_id and ogd.order_number = dd.order_number |
| | | and ogd.technology_number and dd.technology_number |
| | | rw.this_process, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code, |
| | | CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct dd.technology_number SEPARATOR '')) as process_id |
| | | from |
| | | sd.`order` as o left join sd.order_detail as od on o.order_id=od.order_id |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=od.order_id and ogd.order_number=od.order_number |
| | | left join reporting_work as rw on rw.order_id=o.order_id |
| | | left join damage_details as dd on dd.reporting_work_id=rw.reporting_work_id and dd.order_number=ogd.order_number |
| | | and dd.technology_number=ogd.technology_number |
| | | where date(rw.reporting_work_time) >= #{startDate} |
| | | and date(rw.reporting_work_time) <= #{endDate} |
| | | and rw.this_worn_quantity > 0 |
| | | and dd.available = 0 |
| | | and reviewed_state != 2 |
| | | and rw.this_process != dd.responsible_process |
| | | <if test="crossProcessBreakingDTO.code != null and crossProcessBreakingDTO.code != ''"> |
| | | and JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) regexp #{crossProcessBreakingDTO.code} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.processId != null and crossProcessBreakingDTO.processId != ''"> |
| | | and rw.process_id regexp #{crossProcessBreakingDTO.processId} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.thisProcess != null and crossProcessBreakingDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{crossProcessBreakingDTO.thisProcess} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.responsibleProcess != null and crossProcessBreakingDTO.responsibleProcess != ''"> |
| | | and dd.responsible_process regexp #{crossProcessBreakingDTO.responsibleProcess} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.responsibleTeam != null and crossProcessBreakingDTO.responsibleTeam != ''"> |
| | | and dd.responsible_team regexp #{crossProcessBreakingDTO.responsibleTeam} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.glassChild != null and crossProcessBreakingDTO.glassChild != ''"> |
| | | and ogd.glass_child regexp #{crossProcessBreakingDTO.glassChild} |
| | | </if> |
| | | <if test="crossProcessBreakingDTO.breakageType != null and crossProcessBreakingDTO.breakageType != ''"> |
| | | and dd.breakage_type regexp #{crossProcessBreakingDTO.breakageType} |
| | | </if> |
| | | GROUP BY dd.id |
| | | order by dd.id desc |
| | | limit #{offset},#{pageSize} |
| | |
| | | order by dd.id desc |
| | | </select> |
| | | |
| | | <select id="workInProgressMp"> |
| | | select #{selectProcesses} as thisProcess, |
| | | fc.process_id, |
| | | o.customer_name, |
| | | o.project, |
| | | o.order_id, |
| | | o.batch, |
| | | if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape, |
| | | ogd.order_number, |
| | | ogd.technology_number, |
| | | ogd.process, |
| | | od.quantity, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num as stockNum, |
| | | 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, |
| | | od.bend_radius |
| | | <select id="workInProgressMp" resultMap="workInProgressMap"> |
| | | select #{selectProcesses} as thisProcess, |
| | | fc.process_id, |
| | | o.customer_name, |
| | | o.project, |
| | | o.order_id, |
| | | o.batch, |
| | | if(od.shape = 1, '普形', if(od.shape = 2, '异形', '')) as shape, |
| | | ogd.order_number, |
| | | ogd.technology_number, |
| | | ogd.process, |
| | | od.quantity, |
| | | ogd.child_width, |
| | | ogd.child_height, |
| | | odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num as stockNum, |
| | | 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, |
| | | od.bend_radius |
| | | |
| | | 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 |
| | | 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 >= 0 |
| | | 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) |
| | | |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 |
| | | and odpd.process = #{selectProcesses} |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | <if test="workInProgressDTO.orderNumber != null and workInProgressDTO.orderNumber != ''"> |
| | | and ogd.order_number regexp #{workInProgressDTO.orderNumber} |
| | | </if> |
| | | <if test="workInProgressDTO.technologyNumber != null and workInProgressDTO.technologyNumber != ''"> |
| | | and ogd.technology_number regexp #{workInProgressDTO.technologyNumber} |
| | | </if> |
| | | group by fc.process_id, fc.order_number, fc.technology_number |
| | | order by fc.process_id, fc.order_number, fc.technology_number |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <!-- |
| | | <if test="Report.processId != null and Report.processId != ''"> |
| | | and fc.process_id regexp #{Report.processId} |
| | | </if> |
| | | <if test="Report.customerName != null and Report.customerName != ''"> |
| | | and o.customer_name regexp #{Report.customerName} |
| | | </if> |
| | | <if test="Report.project != null and Report.project != ''"> |
| | | and o.project regexp #{Report.project} |
| | | </if> |
| | | <if test="Report.batch != null and Report.batch != ''"> |
| | | and o.batch regexp #{Report.batch} |
| | | </if> |
| | | <if test="Report.shape != null and Report.shape != ''"> |
| | | and od.shape regexp #{Report.shape} |
| | | </if> |
| | | --> |
| | | <select id="workInProgressTotal"> |
| | | select CEILING(count(fc.id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct fc.id) as 'total' |
| | | |
| | | <!-- <select id="getWorkInProgressTotal">--> |
| | | <!-- select CEILING(count(fc.id) / #{pageSize}) as 'pageTotal',--> |
| | | <!-- count(distinct fc.id) as 'total'--> |
| | | |
| | | <!-- 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 fc.process_id, fc.order_number, fc.technology_number--> |
| | | <!-- order by fc.process_id, fc.order_number, fc.technology_number--> |
| | | <!-- limit #{offset},#{pageSize};--> |
| | | <!-- </select>--> |
| | | 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 >= 0 |
| | | 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 position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | <if test="workInProgressDTO.orderNumber != null and workInProgressDTO.orderNumber != ''"> |
| | | and ogd.order_number regexp #{workInProgressDTO.orderNumber} |
| | | </if> |
| | | <if test="workInProgressDTO.technologyNumber != null and workInProgressDTO.technologyNumber != ''"> |
| | | and ogd.technology_number regexp #{workInProgressDTO.technologyNumber} |
| | | </if> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="processToBeCompletedMp"> |
| | | select DATE(o.create_time) as create_time, |
| | |
| | | order by fc.process_id, fc.order_number, fc.technology_number |
| | | </select> |
| | | |
| | | <select id="selectDamageReportMp" resultMap="damageReportMap"> |
| | | <select id="selectDamageReportMp" resultMap="damageReportMap"> |
| | | SELECT |
| | | o.order_id, |
| | | o.project, |
| | | rw.process_id, |
| | | dd.order_number, |
| | | dd.technology_number, |
| | | date(rw.reporting_work_time) as reporting_work_time, |
| | | rw.reporting_work_time as reporting_work_time, |
| | | dd.responsible_process, |
| | | dd.responsible_team, |
| | | dd.responsible_equipment, |
| | |
| | | dd.breakage_quantity, |
| | | round( ogd.child_width * ogd.child_height * dd.breakage_quantity / 1000000, 2 ) as area, |
| | | IFNULL(dd.responsible_personnel,'') as personnel, |
| | | ogd.glass_child |
| | | ogd.glass_child, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber |
| | | FROM |
| | | sd.ORDER AS o |
| | | LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = o.order_id |
| | |
| | | LEFT JOIN damage_details AS dd ON dd.reporting_work_id = rw.reporting_work_id |
| | | AND dd.order_number = ogd.order_number |
| | | AND dd.technology_number = ogd.technology_number |
| | | left join sd.order_detail as od on o.order_id = od.order_id and od.order_number=ogd.order_number |
| | | WHERE |
| | | rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | AND dd.available = 0 |
| | |
| | | </if> |
| | | <if test="damageReportDTO.breakageReason != null and damageReportDTO.breakageReason != ''"> |
| | | and dd.breakage_reason regexp #{damageReportDTO.breakageReason} |
| | | </if> |
| | | <if test="damageReportDTO.glassChild != null and damageReportDTO.glassChild != ''"> |
| | | and ogd.glass_child regexp #{damageReportDTO.glassChild} |
| | | </if> |
| | | GROUP BY |
| | | dd.id |
| | |
| | | <if test="damageReportDTO.breakageReason != null and damageReportDTO.breakageReason != ''"> |
| | | and dd.breakage_reason regexp #{damageReportDTO.breakageReason} |
| | | </if> |
| | | |
| | | <if test="damageReportDTO.glassChild != null and damageReportDTO.glassChild != ''"> |
| | | and ogd.glass_child regexp #{damageReportDTO.glassChild} |
| | | </if> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | |
| | | ifnull(f.inventory, 0) as inventoryNum, |
| | | round(ifnull(f.inventory, 0) * a.area, 2) as inventoryArea, |
| | | ifnull(dd.quantity, 0) as shippedQuantity, |
| | | ifnull(dd.area, 0) as area |
| | | ifnull(dd.area, 0) as area, |
| | | JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')) AS glassNumber |
| | | |
| | | from flow_card as c |
| | | left join |
| | |
| | | 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, |
| | | order_number, |
| | | technology_number, |
| | | sum(a.broken_num) as broken_num, |
| | | concat('{', |
| | |
| | | '}' |
| | | ) as reportWorkQuantity, |
| | | concat('{', |
| | | GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num, "\"")), |
| | | GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num_count, "\"")), |
| | | '}' |
| | | ) as reportWorkQuantityCount |
| | | FROM sd.order_process_detail as a |
| | | where a.order_id = #{orderId} |
| | | GROUP BY process_id, a.technology_number) as e |
| | | GROUP BY process_id, a.order_number,a.technology_number) as e |
| | | on e.process_id = c.process_id |
| | | and e.order_number=c.order_number |
| | | 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 a.order_id = #{orderId} |
| | | group by c.order_number,c.technology_number |
| | | ORDER BY a.order_number |
| | | </select> |
| | | |
| | |
| | | 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.review_status >= 0 |
| | | 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 |
| | |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | fc.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, |
| | | rwd.completed_quantity as completed_quantity, |
| | | ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area, |
| | | od.product_name, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code |
| | | 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} |
| | | reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id |
| | | left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number |
| | | left join sd.order_detail as od on od.order_id=ogd.order_id and od.order_number=ogd.order_number |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and position(#{selectProcesses} in rw.this_process) |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{teamOutputDTO.thisProcess} |
| | | </if> |
| | |
| | | </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.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rw.process_id, |
| | | rw.reporting_work_id |
| | | rwd.order_number |
| | | ORDER BY |
| | | rw.this_process, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rw.reporting_work_time, |
| | | rw.teams_groups_name, |
| | | rw.process_id |
| | | rw.teams_groups_name |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="exportTeamOutputMp"> |
| | | SELECT |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX( ogd.child_width ) as width, |
| | | MAX( ogd.child_height ) as height, |
| | | od.edging_type, |
| | | rwd.completed_quantity as completed_quantity, |
| | | ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area, |
| | | od.product_name, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code |
| | | FROM |
| | | reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id |
| | | left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number |
| | | left join sd.order_detail as od on od.order_id=ogd.order_id and od.order_number=ogd.order_number |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 |
| | | and date(rw.reporting_work_time) >= #{date[0]} |
| | | and date(rw.reporting_work_time) <= #{date[1]} |
| | | and position(#{process} in rw.this_process) |
| | | GROUP BY |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | ORDER BY |
| | | rw.this_process, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rw.reporting_work_time, |
| | | rw.teams_groups_name |
| | | </select> |
| | | |
| | | <select id="teamOutputPageTotal"> |
| | | SELECT |
| | | CEILING(count(rw.reporting_work_id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct rw.reporting_work_id) as 'total' |
| | | CEILING(count(*)/#{pageSize}) as 'pageTotal', |
| | | count(*) 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 |
| | | rw.reporting_work_time, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | o.project, |
| | | rw.process_id, |
| | | fc.order_number, |
| | | MAX( ogd.child_width ) as width, |
| | | MAX( ogd.child_height ) as height, |
| | | od.edging_type, |
| | | rwd.completed_quantity as completed_quantity, |
| | | ROUND(MAX( ogd.child_width )*MAX( ogd.child_height )*rwd.completed_quantity/1000000,2) as area, |
| | | od.product_name, |
| | | JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS code |
| | | 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} |
| | | reporting_work as rw left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id |
| | | left join flow_card as fc on fc.order_id=rw.order_id and fc.process_id=rw.process_id and fc.order_number=rwd.order_number and fc.technology_number=rwd.technology_number |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=fc.order_id and ogd.order_number=fc.order_number and ogd.technology_number=fc.technology_number |
| | | left join sd.order_detail as od on od.order_id=ogd.order_id and od.order_number=ogd.order_number |
| | | left join sd.`order` as o on o.order_id=od.order_id |
| | | where o.create_order>0 and rw.reviewed_state>=0 and rwd.completed_quantity>0 and rw.reporting_work_time between #{selectTime1} and #{selectTime2} |
| | | and position(#{selectProcesses} in rw.this_process) |
| | | <if test="teamOutputDTO.thisProcess != null and teamOutputDTO.thisProcess != ''"> |
| | | and rw.this_process regexp #{teamOutputDTO.thisProcess} |
| | | </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 |
| | | rw.reporting_work_id, |
| | | rw.process_id, |
| | | rw.this_process, |
| | | rw.teams_groups_name, |
| | | rwd.order_number |
| | | ORDER BY |
| | | rw.this_process, |
| | | rw.process_id, |
| | | rwd.order_number, |
| | | rw.reporting_work_time, |
| | | rw.teams_groups_name |
| | | ) as page_toal |
| | | limit #{offset},#{pageSize} |
| | | </select> |
| | | |
| | | <select id="workInProgressOrderMp" resultMap="workInProgressMap"> |
| | | 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 >= 0 |
| | | 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 position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | group by o.order_id |
| | | order by o.order_id |
| | | 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 |
| | | <select id="workInProgressOrderTotal"> |
| | | select CEILING(count(o.order_id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct o.order_id) as 'total' |
| | | |
| | | 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 |
| | | 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 >= 0 |
| | | 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 |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 |
| | | and odpd.process = #{selectProcesses} |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | limit #{offset},#{pageSize}; |
| | | </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 |
| | | <select id="workInProgressProcessMp" resultMap="workInProgressMap"> |
| | | 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 |
| | | 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 >= 0 |
| | | 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) |
| | | |
| | | and odpds.reporting_work_num_count + ifnull(c.patchNumSum, 0) - odpd.reporting_work_num_count - |
| | | odpd.broken_num != 0 |
| | | and odpd.process = #{selectProcesses} |
| | | and position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | group by o.order_id, fc.process_id |
| | | order by o.order_id, fc.process_id |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="workInProgressProcessTotal"> |
| | | select CEILING(count(fc.process_id)/#{pageSize}) as 'pageTotal', |
| | | count(distinct fc.process_id) as 'total' |
| | | |
| | | 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 >= 0 |
| | | 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 position(#{orderId} in od.order_id) |
| | | and position(#{inputProject} in o.project) |
| | | <if test="workInProgressDTO.customerName != null and workInProgressDTO.customerName != ''"> |
| | | and o.customer_name regexp #{workInProgressDTO.customerName} |
| | | </if> |
| | | <if test="workInProgressDTO.project != null and workInProgressDTO.project != ''"> |
| | | and o.project regexp #{workInProgressDTO.project} |
| | | </if> |
| | | <if test="workInProgressDTO.orderId != null and workInProgressDTO.orderId != ''"> |
| | | and o.order_id regexp #{workInProgressDTO.orderId} |
| | | </if> |
| | | <if test="workInProgressDTO.batch != null and workInProgressDTO.batch != ''"> |
| | | and o.batch regexp #{workInProgressDTO.batch} |
| | | </if> |
| | | <if test="workInProgressDTO.processId != null and workInProgressDTO.processId != ''"> |
| | | and fc.process_id regexp #{workInProgressDTO.processId} |
| | | </if> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="scheduleProductionScheduleMp" resultMap="scheduleProductionScheduleMap"> |
| | | select ps.order_id, |
| | | o.project, |
| | | ps.processes, |
| | | sum(ps.scheduling_quantity) as scheduling_quantity, |
| | | notes, |
| | | date(ps.scheduled_start_time) as scheduled_start_time, |
| | | date(ps.plan_end_time) as plan_end_time |
| | | o.project, |
| | | ps.processes, |
| | | sum(ps.scheduling_quantity) as scheduling_quantity, |
| | | notes, |
| | | date(ps.scheduled_start_time) as scheduled_start_time, |
| | | date(ps.plan_end_time) as plan_end_time |
| | | from (select order_id, order_number, processes, scheduling_quantity, scheduled_start_time, plan_end_time, notes |
| | | from production_scheduling |
| | | where processes = #{processes} |
| | | GROUP BY order_id, order_number) as ps |
| | | left join sd.`order` as o on o.order_id = ps.order_id |
| | | from production_scheduling |
| | | where processes = #{processes} |
| | | GROUP BY order_id, order_number) as ps |
| | | left join sd.`order` as o on o.order_id = ps.order_id |
| | | where ps.processes = #{processes} |
| | | and ps.scheduled_start_time between #{selectTime1} and #{selectTime2} |
| | | and ps.scheduled_start_time between #{selectTime1} and #{selectTime2} |
| | | <if test="scheduleProductionScheduleDTO.orderId != null and scheduleProductionScheduleDTO.orderId != ''"> |
| | | and ps.order_id regexp #{scheduleProductionScheduleDTO.orderId} |
| | | </if> |
| | |
| | | |
| | | <select id="exportScheduleReportMp"> |
| | | select ps.order_id, |
| | | o.project, |
| | | ps.processes, |
| | | sum(ps.scheduling_quantity) as scheduling_quantity, |
| | | notes, |
| | | date(ps.scheduled_start_time) as scheduled_start_time, |
| | | date(ps.plan_end_time) as plan_end_time |
| | | o.project, |
| | | ps.processes, |
| | | sum(ps.scheduling_quantity) as scheduling_quantity, |
| | | notes, |
| | | date(ps.scheduled_start_time) as scheduled_start_time, |
| | | date(ps.plan_end_time) as plan_end_time |
| | | from (select order_id, order_number, processes, scheduling_quantity, scheduled_start_time, plan_end_time, notes |
| | | from production_scheduling |
| | | where processes = #{process} |
| | | GROUP BY order_id, order_number) as ps |
| | | left join sd.`order` as o on o.order_id = ps.order_id |
| | | from production_scheduling |
| | | where processes = #{process} |
| | | GROUP BY order_id, order_number) as ps |
| | | left join sd.`order` as o on o.order_id = ps.order_id |
| | | where ps.processes = #{process} |
| | | and date(scheduled_start_time) >= #{date[0]} |
| | | and date(scheduled_start_time) <= #{date[1]} |