From 387e98df63a7fbcea59773c5cf03000efedb68a5 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期三, 24 四月 2024 14:24:34 +0800
Subject: [PATCH] 报工相关程序
---
north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml | 64 +++++++++++++++++++++-----------
1 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index 2e3409b..26ccb10 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -126,8 +126,8 @@
ogd.child_width,
ogd.child_height,
od.shape,
- fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
- fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity,
+ fc.quantity -odpd.reporting_work_num -odpd.broken_num as quantity,
+ fc.quantity -odpd.reporting_work_num -odpd.broken_num as completedQuantity,
odpd.reporting_work_num as completed,
odpd.broken_num as onceBroken,
if(fc.quantity -odpd.reporting_work_num = 0 ,true,false) as saveFlag -- 鍒ゆ柇鏄惁宸茬粡瀹屾垚锛屽凡缁忓畬鎴愪笉搴忓彿鍜屽悓搴忓彿鏁伴噺鐩稿悓鎵嶈兘鎻愪氦
@@ -146,13 +146,6 @@
AND odpd.order_number = fc.order_number
AND odpd.technology_number = fc.technology_number
and odpd.process_id = fc.process_id
- left join
- (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
- from patch_log
- group by reporting_work_id,order_sort,technology_number) as c
- on c.process_id = fc.process_id
- and c.order_sort = fc.order_number
- and c.technology_number = fc.technology_number
WHERE
fc.process_id = #{processIdStr}
AND fc.technology_number = #{technologyStr}
@@ -171,8 +164,12 @@
ogd.child_width,
ogd.child_height,
od.shape,
- odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
- odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as completedQuantity,
+ if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num ) < 0,
+ 0,
+ odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as quantity,
+ if((odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) < 0,
+ 0,
+ odpds.reporting_work_num_count + ifnull(c.patchNumSum,0) -odpd.reporting_work_num_count -odpd.broken_num) as completedQuantity,
odpd.reporting_work_num as completed,
odpd.broken_num as onceBroken,
ogd.`group`,
@@ -206,12 +203,23 @@
left join sd.order_process_detail as odpds
ON odpds.id = odpd.id-1
left join
- (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
- from patch_log
- group by reporting_work_id,order_sort,technology_number) as c
+ (SELECT
+ sum(rw.rework_num) as 'patchNumSum',
+ rw.process_id,rw.order_sort,rw.technology_number,
+ rwk.this_process
+ from
+ rework as rw
+ LEFT JOIN
+ reporting_work as rwk
+ on rw.reporting_work_id =rwk.reporting_work_id
+ where rwk.this_process=#{process}
+ and rw.review_status=1
+ and rw.process_id = #{processIdStr}
+ GROUP BY rw.process_id,rw.order_sort,rw.technology_number) as c
on c.process_id = fc.process_id
and c.order_sort = fc.order_number
and c.technology_number = fc.technology_number
+
WHERE
fc.process_id = #{processIdStr}
<if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰'">
@@ -302,7 +310,10 @@
</select>
<select id="selectGlassProcessNum" resultType="java.lang.Integer">
select
- d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0)
+ if((d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)< 0,
+ 0,
+ (d.reporting_work_num_count+ifnull(c.reworkNumSum,0)-b.reporting_work_num_count-b.broken_num)
+ )
from flow_card as a
left join sd.order_process_detail as b
on
@@ -313,13 +324,22 @@
and b.process_id = a.process_id
left join sd.order_process_detail as d
on d.id=b.id-1
- left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
- from patch_log
- group by reporting_work_id,order_sort,technology_number) as c
- on
- c.process_id = a.process_id
- and c.order_sort = a.order_number
- and c.technology_number = a.technology_number
+ left join (SELECT
+ sum(rw.rework_num) as 'reworkNumSum',
+ rw.process_id,rw.order_sort,rw.technology_number,
+ rwk.this_process
+ from
+ rework as rw
+ LEFT JOIN
+ reporting_work as rwk
+ on rw.reporting_work_id =rwk.reporting_work_id
+ where rwk.this_process=#{thisProcess}
+ and rw.review_status=1
+ and rw.process_id = SUBSTR(#{processId} from 1 for 14)
+ GROUP BY rw.process_id,rw.order_sort,rw.technology_number) as c
+ on c.process_id = a.process_id
+ and c.order_sort = a.order_number
+ and c.technology_number = a.technology_number
where
a.process_id=SUBSTR(#{processId} from 1 for 14)
--
Gitblit v1.8.0