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/KanBanManagerentDAL.cs |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
index 892f3c3..aadb785 100644
--- a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
+++ b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -57,7 +57,7 @@
                 if (shopcode != null || shopcode != "") //浜х嚎缂栫爜涓嶄负绌�
                 {
                     string[] selects = Array.ConvertAll<string, string>(shopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[] 
-                    //鏌ヨ浜х嚎涓嬪凡寮�宸ョ殑鍔犲伐鍗曚俊鎭�
+                    //鏌ヨ浜х嚎涓嬪凡寮�宸ョ殑鍔犲伐鍗曚俊鎭�(褰撳勾)
                     sql = @"select *  from ( 
                                     select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname,S.good_qty,S.ng_qty,S.bad_qty   from TK_Wrk_Record A
                                     inner join TK_Wrk_Man P on A.wo_code=P.wo_code
@@ -67,8 +67,8 @@
                                     left join (
                                       select wo_code,sum(good_qty) as good_qty,sum(ng_qty) as ng_qty,sum(bad_qty) as bad_qty  from TK_Wrk_Step where isend='Y' group by wo_code
                                     ) S on P.wo_code=S.wo_code
-                                    where P.status<>'CLOSED' and P.status<>'NEW' and P.wkshp_code in @shopcode and A.style='S' and A.step_seq='1'
-                                    ) as AA where AA.plan_qty>(AA.good_qty+aa.bad_qty+AA.ng_qty)";
+                                    where P.status<>'CLOSED' and P.status<>'NEW' and P.wkshp_code in @shopcode and A.style='S' and A.step_seq='1' and year(P.lm_date) = YEAR(GETDATE())
+                                    ) as AA where AA.plan_qty>=(AA.good_qty+aa.bad_qty+AA.ng_qty)";
                     var data0 = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
 
                     if (data0.Rows.Count > 0)
@@ -93,7 +93,7 @@
                             lineone.children = new List<TreeTwo>();
 
                             //鏌ユ柊宸ュ崟涓嬪伐搴忎俊鎭�
-                            sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.good_qty,A.ng_qty,A.status  
+                            sql = @"select A.seq,T.stepcode,T.stepname,A.plan_qty,A.start_qty,A.good_qty,A.ng_qty,A.status  
                                             from TK_Wrk_Step A
                                             left join TStep T on A.step_code=T.stepcode
                                             where A.wo_code=@wo_code";
@@ -105,6 +105,7 @@
                                 string stepcode = data1.Rows[k]["STEPCODE"].ToString();//宸ュ簭缂栫爜
                                 string stepname = data1.Rows[k]["STEPNAME"].ToString();//宸ュ簭鍚嶇О
                                 string planqty = data1.Rows[k]["PLAN_QTY"].ToString();//浠诲姟鏁伴噺
+                                string startqty = data1.Rows[k]["START_QTY"].ToString();//寮�宸ユ暟閲�
                                 string good_qty = data1.Rows[k]["GOOD_QTY"].ToString();//鎶ュ伐鏁伴噺
                                 string ng_qty = data1.Rows[k]["NG_QTY"].ToString();//涓嶈壇鏁伴噺
                                 string status = data1.Rows[k]["STATUS"].ToString();//鐘舵��
@@ -113,6 +114,7 @@
                                 linetwo.stepcode = stepcode;
                                 linetwo.stepname = stepname;
                                 linetwo.planqty = planqty;
+                                linetwo.startqty = startqty;
                                 linetwo.goodqty = good_qty;
                                 linetwo.ngqty = ng_qty;
                                 linetwo.status = status;
@@ -157,7 +159,7 @@
             string[] selects = Array.ConvertAll<string, string>(shopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[] 
             try
             {
-                //鑾峰彇浠诲姟鍒楄〃淇℃伅
+                //鑾峰彇浠诲姟鍒楄〃淇℃伅(褰撳勾)
                 sql = @"select A.*,ROW_NUMBER() OVER(ORDER BY (case when A.warning<=2 then A.planenddate end) asc ,A.planstartdate asc) AS RowNum from(
                          select  A.status,A.lm_date,E.saleOrderCode,A.wo_code,M.partcode,M.partname,M.partspec,U.name,
                          A.plan_qty,B.good_qty,B.ng_qty,E.planstartdate,E.planenddate, datediff(day,getdate(),E.planenddate) warning
@@ -167,7 +169,7 @@
                          left  join TMateriel_Info M on A.materiel_code=M.partcode
                          left  join TUom U on M.uom_code=U.code
                          where A.status<>'CLOSED' and A.wkshp_code in @shopcode and A.is_delete<>'1' and B.isend='Y'
-                         and A.plan_qty>(B.good_qty+B.ng_qty+B.bad_qty)
+                         and A.plan_qty>=(B.good_qty+B.ng_qty+B.bad_qty) and year(A.lm_date) = YEAR(GETDATE())
                          )as A ";
                 var data = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
                 mes.code = "200";

--
Gitblit v1.9.3