From 4f86b3b78b5b638b486b497221a2f1c8fbab3ef6 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期二, 25 十月 2022 21:01:25 +0800
Subject: [PATCH] 大岛仓库看板接口修改

---
 VueWebApi/DLL/DAL/KanBanManagerentDAL.cs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
index 55a48fa..e403543 100644
--- a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
+++ b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -58,12 +58,17 @@
                 {
                     string[] selects = Array.ConvertAll<string, string>(shopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[] 
                     //鏌ヨ浜х嚎涓嬪凡寮�宸ョ殑鍔犲伐鍗曚俊鎭�
-                    sql = @"select distinct E.saleOrderCode,A.wo_code,P.plan_qty,M.partcode,M.partname,M.partspec,T.name as uomname   from TK_Wrk_Record A
+                    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
                                     left join TMateriel_Info M on P.materiel_code=M.partcode
                                     left join TUom T on M.uom_code=T.code 
                                     left join TKimp_Ewo E on P.m_po=E.wo and P.sourceid=E.id
-                                    where P.status<>'CLOSED' and P.status<>'NEW' and P.wkshp_code in @shopcode and A.style='S' and A.step_seq='1'";
+                                    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)";
                     var data0 = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
                 
                     if (data0.Rows.Count > 0)
@@ -162,6 +167,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)
                          )as A ";
                 var data = DapperHelper.selectlist(sql, new { shopcode = selects.ToArray() });
                 mes.code = "200";
@@ -331,7 +337,7 @@
             try
             {
                 //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
-                sql = @"select * from h_v_DDKanBan_WareHouseTopLeft";
+                sql = @"select * from h_v_DDKanBan_WareHouseTopLeft order by voucherdate";
                 var data = DapperHelper.selecttable(sql);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -355,7 +361,7 @@
             try
             {
                 //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
-                sql = @"select * from h_v_DDKanBan_WareHouseTopBottom";
+                sql = @"select * from h_v_DDKanBan_WareHouseTopBottom order by voucherdate";
                 var data = DapperHelper.selecttable(sql);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -446,4 +452,5 @@
         }
         #endregion
     }
-}
\ No newline at end of file
+}
+

--
Gitblit v1.9.3