From 2264c47cff7ab5ce52d7c158ac0eb941e7b46506 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 31 八月 2022 23:50:53 +0800
Subject: [PATCH] 大岛测试bug修改

---
 VueWebApi/DLL/DAL/KanBanManagerentDAL.cs |  214 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 195 insertions(+), 19 deletions(-)

diff --git a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
index f964aaf..80932cc 100644
--- a/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
+++ b/VueWebApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -71,10 +71,11 @@
                         line.linename = json[i].name;
                         //鑾峰彇浜х嚎涓嬪紑宸ユ�诲崟閲�
                         sql = @"select COUNT(*) cont  from(
-                                select distinct B.rout_code,M.wo_code  from TFlw_Rteqp  A
-                                inner join TFlw_Rtdt B on A.step_code=B.step_code
-                                inner join TK_Wrk_Man M on B.rout_code=M.route_code
-                                where M.status<>'CLOSED'  and M.is_delete<>'1' and A.eqp_code=@linecode) as A";
+                                 select distinct B.rout_code,M.wo_code from TK_Wrk_Man M
+                                 left join TFlw_Rtdt B  on M.route_code=B.rout_code
+                                 left join TFlw_Rteqp R on B.step_code=R.step_code
+                                 where M.status<>'CLOSED'  and M.is_delete<>'1'
+                                 and R.eqp_code=@linecode) as A";
                         dynamicParams.Add("@linecode", json[i].code);
                         var data = DapperHelper.selectdata(sql, dynamicParams);
                         if (data.Rows.Count > 0 && decimal.Parse(data.Rows[0]["CONT"].ToString())>0)
@@ -86,7 +87,7 @@
                                     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
+                                    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 A.eqp_code=@linecode and A.style='S' and A.step_seq='1'";
                             dynamicParams.Add("@linecode", json[i].code);
                             var data0 = DapperHelper.selectdata(sql, dynamicParams);
@@ -194,7 +195,7 @@
                          A.plan_qty,B.good_qty,B.ng_qty,E.planstartdate,E.planenddate, datediff(day,getdate(),E.planenddate) warning
                          from TK_Wrk_Man A 
                          inner join TK_Wrk_Step B on A.wo_code=B.wo_code
-                         inner join TKimp_Ewo E on A.m_po=E.wo
+                         inner join TKimp_Ewo E on A.m_po=E.wo and A.sourceid=E.id
                          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.is_delete<>'1' and B.isend='Y'
@@ -223,17 +224,20 @@
             try
             {
                 //鑾峰彇浜у搧鎶ュ伐top5淇℃伅
-                sql = @"select top 5 A.partname,isnull(sum(A.good_qty),0) as good_qty from(
-                           select M.partname,A.good_qty  from TK_Wrk_Record A
-                           inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
-                           inner join TMateriel_Info M on A.materiel_code=M.partcode
-                           where A.style='B' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
-                           union all
-                           select M.partname,A.sqty as good_qty  from TK_Wrk_OutRecord A
-                           inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
-                           inner join TMateriel_Info M on A.materiel_code=M.partcode
-                           where A.style='S' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
-                           ) as A group by A.partname order by good_qty desc";
+                sql = @"select top 5 A.org_name as wkshname,A.name as linename,A.partname,isnull(sum(A.good_qty),0) as good_qty from(
+                        select W.org_name,E.name,M.partname,A.good_qty  from TK_Wrk_Record A
+                        inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+                        inner join TMateriel_Info M on A.materiel_code=M.partcode
+                        inner  join TEqpInfo E on A.eqp_code=E.code
+                        inner  join TOrganization W on E.wksp_code=W.org_code and W.description='W'
+                        where A.style='B' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
+                        union all
+                        select C.name as linename,'' as wkshname,M.partname,A.sqty as good_qty  from TK_Wrk_OutRecord A
+                        inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+                        inner join TMateriel_Info M on A.materiel_code=M.partcode
+                        inner  join TCustomer C on A.wx_code=C.code and C.btype='WX'
+                        where A.style='S' and S.isend='Y' and datediff(day,GETDATE(),A.lm_date)=0
+                        ) as A group by A.org_name,A.name,A.partname order by good_qty desc";
                 var data = DapperHelper.selecttable(sql);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -258,8 +262,180 @@
             try
             {
                 //鑾峰彇鎶ュ伐涓嶈壇top5淇℃伅
-                sql = @"select isnull(COUNT(checkitem_name),0) cont,checkitem_name  from TStepCheckRecordSub where DateDiff(dd,lm_date,getdate())<=7
-                        group by checkitem_name order by cont desc";
+                sql = @"select isnull(COUNT(B.name),0) cont,B.name   
+                        from CSR_WorkRecord_Defect A
+                        inner join TDefect B on A.defect_code=B.code
+                        where DateDiff(dd,A.lm_date,getdate())<=7
+                        group by B.name order by cont desc";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+
+        #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,宸︿笂鏈湀閲囪喘璁㈠崟鏁般�佹湰鏈堥噰璐繘璐у崟鏁般�佹湰鏈堥噰璐叆搴撳崟鏁癩
+        public static ToMessage PurchaseLeftTop()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇鏈湀閲囪喘璁㈠崟鏁般�佹湰鏈堥噰璐繘璐у崟鏁般�佹湰鏈堥噰璐叆搴撳崟鏁�
+                sql = @"select * from h_v_DDKanBan_PurchaseLeftTop ";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,宸︿笅閲囪喘璁㈠崟璺熻釜鍒楄〃]
+        public static ToMessage PurchaseLeftBottom()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇閲囪喘璁㈠崟璺熻釜鍒楄〃
+                sql = @"select * from h_v_DDKanBan_PurchaseLeftBottom ";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[閲囪喘璁㈠崟璺熻釜绠$悊鐪嬫澘,鍙充晶Top]
+        public static ToMessage PurchaseRight()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇閲囪喘璁㈠崟璺熻釜鍒楄〃
+                sql = @"select * from h_v_DDKanBan_PurchaseRight ";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+
+
+        #region[澶у矝浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛╙
+        public static ToMessage WareHouseTopLeftData()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+                sql = @"select * from h_v_DDKanBan_WareHouseTopLeft";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[澶у矝浠撳簱鐪嬫澘,宸︿笅浜у搧寰呭彂璐у垪琛╙
+        public static ToMessage WareHouseTopBottomData()
+        {
+            string sql = "";
+            try
+            {
+                //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+                sql = @"select * from h_v_DDKanBan_WareHouseTopBottom";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[澶у矝浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕]
+        public static ToMessage WareHouseRightTopData()
+        {
+            string sql = "";
+            try
+            {
+                sql = @"select * from h_v_DDKanBan_WareHouseRightTop";
+                var data = DapperHelper.selecttable(sql);
+                mes.code = "200";
+                mes.Message = "鏌ヨ鎴愬姛!";
+                mes.data = data;
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[澶у矝浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕]
+        public static ToMessage WareHouseRightBottomData()
+        {
+            string sql = "";
+            try
+            {
+                sql = @"select * from h_v_DDKanBan_WareHouseRightBottom";
                 var data = DapperHelper.selecttable(sql);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";

--
Gitblit v1.9.3