From a9ffa322f0cf794a7da8182e1be4ca34f5ea19b6 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 25 七月 2025 13:34:36 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/src/main/resources/mapper/pp/Report.xml | 330 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 319 insertions(+), 11 deletions(-)
diff --git a/north-glass-erp/src/main/resources/mapper/pp/Report.xml b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
index df58f7d..36d8203 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/Report.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/Report.xml
@@ -128,6 +128,7 @@
<result column="examine_time" property="examineTime"/>
<result column="workProcessName" property="workProcessName"/>
<result column="device_name" property="deviceName"/>
+ <result column="order_type" property="orderType"/>
</resultMap>
<resultMap id="scheduleProductionScheduleMap" type="com.example.erp.dto.pp.ScheduleProductionScheduleDTO">
@@ -168,21 +169,35 @@
b.glass_child,
d.order_type,
concat(c.process_id, '/', c.technology_number) as process_id,
+ c.order_id,
c.order_number,
c.technology_number,
b.child_width,
b.child_height,
- c.quantity,
+ if(c.technology_number=1,c.quantity,0) as quantity,
+# c.quantity,
+ c.quantity as thisQuantity,/*鐢ㄤ簬鍒ゆ柇鏄惁鏀瑰彉棰滆壊*/
e.reportWorkQuantity,
e.reportWorkQuantityCount,
e.reportWorkTime,
e.broken_num,
- c.quantity*a.area as gross_area,
- ifnull(f.inventory, 0) as inventory,
- round(ifnull(f.inventory, 0) * a.area, 2) as inventoryArea,
- ifnull(dd.quantity, 0) as shippedQuantity,
- ifnull(JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')),'') AS glassNumber
- from flow_card as c
+ c.quantity as glassQuantity,
+
+# c.quantity*a.area as gross_area,
+# ifnull(f.inventory, 0) as inventory,
+# round(ifnull(f.inventory, 0) * a.area, 2) as inventoryArea,
+# ifnull(dd.quantity, 0) as shippedQuantity,
+
+ if(c.technology_number=1,c.quantity*a.area,0) as gross_area,
+ if(c.technology_number=1,ifnull(f.inventory, 0) ,0) as inventory,
+ if(c.technology_number=1,round(ifnull(f.inventory, 0) * a.area, 2),0) as inventoryArea,
+ if(c.technology_number=1,ifnull(dd.quantity, 0) ,0) as shippedQuantity,
+
+
+ ifnull(JSON_UNQUOTE(JSON_EXTRACT(a.other_columns, '$.S01')),'') AS glassNumber,
+ b.`group`
+
+ from pp.flow_card as c
left join
sd.order_detail as a
on c.order_id = a.order_id
@@ -201,7 +216,7 @@
technology_number,
sum(a.broken_num) as broken_num,
concat('{',
- GROUP_CONCAT(concat("\"", process, "\":\"", reporting_work_num, "\"")),
+ GROUP_CONCAT(concat("\"", process, "\":\"", if(technology_number!=1 and (bd.nickname='stepD' || bd.nickname='stepB' ) ,0,reporting_work_num), "\"")),
'}'
) as reportWorkQuantity,
concat('{',
@@ -213,8 +228,13 @@
'}'
) as reportWorkTime
FROM sd.order_process_detail as a
+ left join (SELECT DISTINCT basic_name,nickname from sd.basic_data as bd where bd.basic_category = 'process') as bd
+ on a.process = bd.basic_name
where a.order_id = #{orderId}
- GROUP BY process_id, a.order_number, 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.technology_number = c.technology_number
and e.order_number = c.order_number
@@ -879,12 +899,14 @@
left join sd.`order` as o on o.order_id = a.order_id
where o.create_time >= #{selectTime1}
AND o.create_time < #{selectTime2}
+ and position(#{orderId} in o.order_id)
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 >= #{selectTime1}
AND d.create_time < #{selectTime2}
+ and position(#{orderId} in a.order_id)
and d.create_order>0
and reportWorkQuantity is not null
GROUP BY a.order_id
@@ -1351,6 +1373,7 @@
rw.reviewed,
rw.examine_time,
rw.device_name,
+ o.order_type,
-- GROUP_CONCAT(ogd.glass_child SEPARATOR '+') as workProcessName
CASE
WHEN LOCATE('step',#{laminating})>0 THEN GROUP_CONCAT(ogd.glass_child SEPARATOR '+')
@@ -2024,6 +2047,15 @@
<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>
+ <if test="workInProgressDTO.glassNumber != null and workInProgressDTO.glassNumber != ''">
+ and ifnull(JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')),'') regexp #{workInProgressDTO.glassNumber}
+ </if>
group by fc.process_id, fc.order_number, fc.technology_number,d.process
) as aa
@@ -2059,8 +2091,8 @@
and odpd.process = #{selectProcesses}
and o.create_time >= #{selectTime1}
AND o.create_time < #{selectTime2}
- AND POSITION('' IN od.order_id)
- AND POSITION('' IN o.project)
+ and position(#{orderId} in od.order_id)
+ and position(#{inputProject} in o.project)
AND fc.quantity - odpd.reporting_work_num > 0;
</select>
@@ -2630,4 +2662,280 @@
group by d.process
) as aa
</select>
+
+ <select id="selectProcess">
+ SELECT basic_name
+ FROM sd.basic_data as bd
+ where bd.basic_category = 'process'
+ and bd.basic_type = 'product'
+ and basic_name!='鍒囧壊'
+ </select>
+
+ <select id="getWorkInProgressCombination">
+ select
+ #{process} as thisProcess,
+ if(#{optionVal} = 1,'',h.project) as project,
+ SUM(h.quantity) as stockNum,
+ SUM(h.glassArea) as stockArea,
+ if(#{optionVal} = 1,'',h.childName) as glassName
+
+ from (
+
+ SELECT g.*
+ ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName
+ from( SELECT f.*,
+ e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity,
+ (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea
+ from (SELECT a.order_id,
+ if(a.batch!="",CONCAT(a.project,'(',a.batch,')'),a.project) as project,
+ C.product_id,
+ b.order_number,
+ b.process_id,
+ b.technology_number,
+ b.reporting_work_num_count,
+ d.`group` ,
+ b.broken_num,
+ b.id,
+ c.area,
+ d.glass_child,
+ ifnull(cb.patchNumSum,0) as patchNumSum
+
+ FROM sd.`order` as a
+ LEFT JOIN sd.order_process_detail as b
+ on b.process = #{process} and a.order_id =b.order_id
+ LEFT JOIN sd.order_detail as c
+ on a.order_id = c.order_id and b.order_number =c.order_number
+ left join sd.order_glass_detail as d
+ on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number
+ LEFT JOIN (
+ SELECT
+ IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum',
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number,
+ rwk.this_process
+ FROM
+ pp.rework AS rw
+ LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id
+ WHERE
+ position( #{process} IN rwk.this_process )
+ AND rw.review_status >= 0
+ GROUP BY
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number
+ ) AS cb ON cb.process_id = b.process_id
+ AND cb.order_sort = b.order_number
+ AND cb.technology_number = b.technology_number
+ where a.processing_card>0
+ and a.warehousing!=2
+ and (c.quantity-b.reporting_work_num_count)>0
+ GROUP BY b.process_id, b.order_number,
+ b.technology_number) as f
+ LEFT JOIN sd.order_process_detail as e
+ on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number
+ where
+ e.id is not null
+ and (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)>0 ) as g
+ <choose>
+ <when test="laminating == 'stepC' and process == '棰勫帇'">
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </when>
+ <when test="laminating == 'stepC'">
+ GROUP BY g.process_id, g.order_number, g.`group`
+ </when>
+ <when test="laminating == 'stepD'">
+ GROUP BY g.process_id, g.order_number
+ </when>
+ <otherwise>
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </otherwise>
+ </choose>
+
+
+ ) as h
+ <choose>
+ <when test="optionVal == 1">
+ GROUP BY thisProcess
+ </when>
+ <otherwise>
+ GROUP BY h.project,h.childName
+ </otherwise>
+ </choose>
+
+ </select>
+
+ <select id="getWorkInProgressCombinationFootSum">
+ select
+ SUM(h.quantity) as stockNum,
+ SUM(h.glassArea) as stockArea
+ from (
+ SELECT g.*
+ ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName
+ from( SELECT f.*,
+ e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity,
+ (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea
+ from (SELECT a.order_id,
+ a.project,
+ C.product_id,
+ b.order_number,
+ b.process_id,
+ b.technology_number,
+ b.reporting_work_num_count,
+ d.`group` ,
+ b.broken_num,
+ b.id,
+ c.area,
+ d.glass_child,
+ ifnull(cb.patchNumSum,0) as patchNumSum
+
+ FROM sd.`order` as a
+ LEFT JOIN sd.order_process_detail as b
+ on b.process = #{process} and a.order_id =b.order_id
+ LEFT JOIN sd.order_detail as c
+ on a.order_id = c.order_id and b.order_number =c.order_number
+ left join sd.order_glass_detail as d
+ on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number
+ LEFT JOIN (
+ SELECT
+ IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum',
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number,
+ rwk.this_process
+ FROM
+ pp.rework AS rw
+ LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id
+ WHERE
+ position( #{process} IN rwk.this_process )
+ AND rw.review_status >= 0
+ GROUP BY
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number
+ ) AS cb ON cb.process_id = b.process_id
+ AND cb.order_sort = b.order_number
+ AND cb.technology_number = b.technology_number
+ where a.processing_card>0
+ and a.warehousing!=2
+ and (c.quantity-b.reporting_work_num_count)>0
+ GROUP BY b.process_id, b.order_number,
+ b.technology_number) as f
+ LEFT JOIN sd.order_process_detail as e
+ on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number
+ where
+ e.id is not null
+ and e.reporting_work_num_count-f.reporting_work_num_count>0 ) as g
+ <choose>
+ <when test="laminating == 'stepC' and process == '棰勫帇'">
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </when>
+ <when test="laminating == 'stepC'">
+ GROUP BY g.process_id, g.order_number, g.`group`
+ </when>
+ <when test="laminating == 'stepD'">
+ GROUP BY g.process_id, g.order_number
+ </when>
+ <otherwise>
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </otherwise>
+ </choose>
+
+
+ ) as h
+
+ </select>
+
+ <select id="exportWorkInProgressCombination">
+ select
+ #{process} as thisProcess,
+ if(#{inputVal} = 1,'',h.project) as project,
+ SUM(h.quantity) as stockNum,
+ SUM(h.glassArea) as stockArea,
+ if(#{inputVal} = 1,'',h.childName) as glassName
+
+ from (
+
+ SELECT g.*
+ ,GROUP_CONCAT(g.glass_child SEPARATOR '+') as childName
+ from( SELECT f.*,
+ e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num as quantity,
+ (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)*f.area as glassArea
+ from (SELECT a.order_id,
+ a.project,
+ C.product_id,
+ b.order_number,
+ b.process_id,
+ b.technology_number,
+ b.reporting_work_num_count,
+ d.`group` ,
+ b.broken_num,
+ b.id,
+ c.area,
+ d.glass_child,
+ ifnull(cb.patchNumSum,0) as patchNumSum
+
+ FROM sd.`order` as a
+ LEFT JOIN sd.order_process_detail as b
+ on b.process = #{process} and a.order_id =b.order_id
+ LEFT JOIN sd.order_detail as c
+ on a.order_id = c.order_id and b.order_number =c.order_number
+ left join sd.order_glass_detail as d
+ on d.order_id =a.order_id and d.order_number = b.order_number and d.technology_number = b.technology_number
+ LEFT JOIN (
+ SELECT
+ IFNULL(sum( rw.rework_num ),0) AS 'patchNumSum',
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number,
+ rwk.this_process
+ FROM
+ pp.rework AS rw
+ LEFT JOIN pp.reporting_work AS rwk ON rw.reporting_work_id = rwk.reporting_work_id
+ WHERE
+ position( #{process} IN rwk.this_process )
+ AND rw.review_status >= 0
+ GROUP BY
+ rw.process_id,
+ rw.order_sort,
+ rw.technology_number
+ ) AS cb ON cb.process_id = b.process_id
+ AND cb.order_sort = b.order_number
+ AND cb.technology_number = b.technology_number
+ where a.processing_card>0
+ and a.warehousing!=2
+ and (c.quantity-b.reporting_work_num_count)>0
+ GROUP BY b.process_id, b.order_number,
+ b.technology_number) as f
+ LEFT JOIN sd.order_process_detail as e
+ on e.id=(f.id-1) and e.process_id = f.process_id and e.order_number = f.order_number and e.technology_number =f.technology_number
+ where
+ e.id is not null
+ and (e.reporting_work_num_count+f.patchNumSum-f.reporting_work_num_count-f.broken_num)>0 ) as g
+ <choose>
+ <when test="laminating == 'stepC' and process == '棰勫帇'">
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </when>
+ <when test="laminating == 'stepC'">
+ GROUP BY g.process_id, g.order_number, g.`group`
+ </when>
+ <when test="laminating == 'stepD'">
+ GROUP BY g.process_id, g.order_number
+ </when>
+ <otherwise>
+ GROUP BY g.process_id, g.order_number, g.technology_number
+ </otherwise>
+ </choose>
+
+
+ ) as h
+ <choose>
+ <when test="inputVal == 1">
+ GROUP BY thisProcess
+ </when>
+ <otherwise>
+ GROUP BY h.project,h.childName
+ </otherwise>
+ </choose>
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0