From 9c634fd767aec36ef97c3a814bf7a29c67d20ee1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期五, 29 三月 2024 10:57:35 +0800
Subject: [PATCH] 修改单据重复显示问题,增加工单源单id关联

---
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index cb55a30..6e4e477 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -579,7 +579,7 @@
                 var sql = @"select A.id, A.status,A.wotype,A.printcount,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
                             A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date
                             from TK_Wrk_Man A
-                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                             left join TMateriel_Info B on A.materiel_code=B.partcode
                             left join TOrganization C on A.wkshp_code=C.org_code
                             left join T_Sec_Stck D on A.stck_code=D.code 
@@ -662,7 +662,7 @@
                 var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
                             A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,W.saleOrderCode,U.username as lm_user,A.lm_date,S.bad_qty
                             from TK_Wrk_Man A
-                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                             left join (select wo_code,sum(bad_qty) as bad_qty from  TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
                             left join TMateriel_Info B on A.materiel_code=B.partcode
                             left join TOrganization C on A.wkshp_code=C.org_code
@@ -1686,7 +1686,7 @@
                         B.m_po,W.saleOrderCode
                         from TK_Wrk_Step A
                         left join TK_Wrk_Man B on A.wo_code=B.wo_code
-                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                         left join TMateriel_Info M on B.materiel_code=M.partcode
                         left join TStep S on A.step_code=S.stepcode
                         left join TOrganization F on B.wkshp_code=F.org_code
@@ -1809,7 +1809,7 @@
                             B.m_po,W.saleOrderCode
                             from TK_Wrk_Step A
                             left join TK_Wrk_Man B on A.wo_code=B.wo_code
-                            left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+                            left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                             left join TMateriel_Info M on B.materiel_code=M.partcode
                             left join TStep S on A.step_code=S.stepcode
                             left join TOrganization F on B.wkshp_code=F.org_code
@@ -1922,7 +1922,7 @@
                         B.m_po,W.saleOrderCode
                         from TK_Wrk_Step A
                         left join TK_Wrk_Man B on A.wo_code=B.wo_code
-                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code
+                        left join TKimp_Ewo W on B.m_po=W.wo and B.materiel_code=W.materiel_code and B.sourceid=W.id
                         left join TMateriel_Info M on B.materiel_code=M.partcode
                         left join TStep S on A.step_code=S.stepcode
                         left join TOrganization F on B.wkshp_code=F.org_code
@@ -1995,7 +1995,7 @@
                         from TK_Wrk_Step A
                         left join  TStep T on A.step_code=T.stepcode
                         left join  TK_Wrk_Man M on A.wo_code=M.wo_code
-                        left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code
+                        left join TKimp_Ewo W on M.m_po=W.wo and M.materiel_code=W.materiel_code and M.sourceid=W.id
                         left join  TMateriel_Info P on M.materiel_code=P.partcode
                         where A.wo_code=@ordercode and A.step_code=@stepcode";
                 dynamicParams.Add("@ordercode", ordercode);
@@ -3537,7 +3537,7 @@
                             ,(select sum(S.ng_qty)  from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as ng_qty
                             ,(select sum(S.bad_qty)  from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as bad_qty
                             from TK_Wrk_Man A
-                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+                            left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sourceid=W.id
                             left join TMateriel_Info B on A.materiel_code=B.partcode
                             left join TOrganization C on A.wkshp_code=C.org_code
                             left join T_Sec_Stck D on A.stck_code=D.code 
@@ -5143,7 +5143,7 @@
                             inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
                             inner join TK_Wrk_Man M on S.wo_code=M.wo_code
                             inner join TMateriel_Info P on M.materiel_code=P.partcode
-                            left join TKimp_Ewo E on M.sourceid=E.id
+                            left join TKimp_Ewo E on M.sourceid=E.id 
                             left join T_Sec_Stck K on E.stck_code=K.code
                             where A.style='B' and S.isend='Y' and A.good_qty>0
                             union all

--
Gitblit v1.9.3