From fe98bca6b01e6c50551158644a6d564aed783ff8 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期六, 12 十一月 2022 16:10:20 +0800
Subject: [PATCH] 修改报工审核接口开发

---
 VueWebApi/Controllers/ProductionManagementController.cs |   14 +++++++
 .vs/VueWebApi/v16/.suo                                  |    0 
 VueWebApi/DLL/BLL/ProductionManagementBLL.cs            |    9 ++++
 VueWebApi/DLL/DAL/ProductionManagementDAL.cs            |   96 ++++++++++++++++++++++++++++++++++++++++++++---
 4 files changed, 111 insertions(+), 8 deletions(-)

diff --git a/.vs/VueWebApi/v16/.suo b/.vs/VueWebApi/v16/.suo
index 868d2e0..ab7e13d 100644
--- a/.vs/VueWebApi/v16/.suo
+++ b/.vs/VueWebApi/v16/.suo
Binary files differ
diff --git a/VueWebApi/Controllers/ProductionManagementController.cs b/VueWebApi/Controllers/ProductionManagementController.cs
index 2cf346d..bfef773 100644
--- a/VueWebApi/Controllers/ProductionManagementController.cs
+++ b/VueWebApi/Controllers/ProductionManagementController.cs
@@ -683,6 +683,17 @@
         /// </summary>
         /// <param name="json"></param>
         /// <returns></returns>
+        [Route(template: "MesOrderStepUpdateSeave")]
+        [HttpPost]
+        public HttpResponseMessage MesOrderStepUpdateSeave(List<UpdateProductReport> json)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = ProductionManagementBLL.MesOrderStepUpdateSeave(username, json);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[鐢熶骇绠$悊,淇敼鎶ュ伐瀹℃牳鎻愪氦]
         [Route(template: "MesOrderStepVerifySeave")]
         [HttpPost]
         public HttpResponseMessage MesOrderStepVerifySeave(List<UpdateProductReport> json)
@@ -694,6 +705,9 @@
         #endregion
 
 
+
+
+
         #region[MES宸ュ崟鎵归噺鍏抽棴鏌ヨ]
         /// <summary>
         /// MES宸ュ崟鏌ヨ
diff --git a/VueWebApi/DLL/BLL/ProductionManagementBLL.cs b/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
index 3c56a76..5d90d0e 100644
--- a/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
+++ b/VueWebApi/DLL/BLL/ProductionManagementBLL.cs
@@ -243,9 +243,16 @@
         #endregion
 
         #region[鐢熶骇绠$悊,淇敼鎶ュ伐鏁版嵁鎻愪氦]
+        public static ToMessage MesOrderStepUpdateSeave(string username, List<UpdateProductReport> json)
+        {
+            return ProductionManagementDAL.MesOrderStepUpdateSeave(username, json);
+        }
+        #endregion
+
+        #region[鐢熶骇绠$悊,淇敼鎶ュ伐瀹℃牳鎻愪氦]
         public static ToMessage MesOrderStepVerifySeave(string username, List<UpdateProductReport> json)
         {
-            return ProductionManagementDAL.MesOrderStepVerifySeave(username, json);
+            return ProductionManagementDAL.MesOrderStepVerifySeave(username,json);
         }
         #endregion
 
diff --git a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
index a890be7..0e422ac 100644
--- a/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
+++ b/VueWebApi/DLL/DAL/ProductionManagementDAL.cs
@@ -2410,7 +2410,7 @@
                 // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
                 var sql = @"select *  from(
-                            select A.id,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,G.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+                            select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,A.task_qty,M.wkshp_code,G.org_name as wkshp_name,A.eqp_code,E.name as eqp_name,
                             M.route_code,R.name as route_name,A.step_code,S.stepname,S.flwtype,D.first_choke,D.last_choke,T.unprice,B.usergroup_code,O.group_name as usergroup_name,B.report_person as usercode,U.username,
                             B.report_date,B.report_qty,B.ng_qty,B.bad_qty   
                             from TK_Wrk_Record A
@@ -2461,7 +2461,7 @@
         #endregion
 
         #region[鐢熶骇绠$悊,淇敼鎶ュ伐鏁版嵁鎻愪氦]
-        public static ToMessage MesOrderStepVerifySeave(string username, List<UpdateProductReport> json)
+        public static ToMessage MesOrderStepUpdateSeave(string username, List<UpdateProductReport> json)
         {
             var sql = "";
             string[] arra1 = new string[] { };
@@ -2528,7 +2528,7 @@
                                     return mes;
                                 }
                             }
-                            
+
                         }
                         //鏄惁鏈亾
                         if (json[i].last_choke == "Y")
@@ -2638,7 +2638,8 @@
                         ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
 
                         //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
-                        sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty+@ng_qty,bad_qty=bad_qty+@bad_qty
+                        sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty+@ng_qty,bad_qty=bad_qty+@bad_qty,
+                                updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
                                 where  m_id=@m_id and id=@id and style='B'";
                         list.Add(new
                         {
@@ -2649,7 +2650,9 @@
                                 id = int.Parse(json[i].sbid),
                                 repair_qty = decimal.Parse(json[i].report_qty),
                                 ng_qty = decimal.Parse(json[i].ng_qty),
-                                bad_qty = decimal.Parse(json[i].bad_qty)
+                                bad_qty = decimal.Parse(json[i].bad_qty),
+                                updatereportuser = username,
+                                updatereportdate = date
                             }
                         });
                         //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
@@ -2669,7 +2672,7 @@
                             }
                         });
                         //鍥炲啓涓嶈壇
-                        sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty
+                        sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty,updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
                                     where wo_code=@wo_code and step_code=@step_code and record_id=@id and style='B'";
                         list.Add(new
                         {
@@ -2679,7 +2682,9 @@
                                 ng_qty = decimal.Parse(json[i].ng_qty),
                                 wo_code = json[i].wo_code,
                                 step_code = json[i].step_code,
-                                id = int.Parse(json[i].id)
+                                id = int.Parse(json[i].id),
+                                updatereportuser = username,
+                                updatereportdate = date
                             }
                         });
                     }
@@ -2717,6 +2722,83 @@
         }
         #endregion
 
+        #region[鐢熶骇绠$悊,淇敼鎶ュ伐瀹℃牳鎻愪氦]
+        public static ToMessage MesOrderStepVerifySeave(string username, List<UpdateProductReport> json)
+        {
+            var sql = "";
+            List<object> list = new List<object>();
+            try
+            {
+                string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+                list.Clear();
+
+                //寰幆json鏁版嵁
+                for (int i = 0; i < json.Count; i++)
+                {
+
+                    ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+                    //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ鏍哥姸鎬併�佸鏍镐汉銆佸鏍告椂闂�
+                    sql = @"update TK_Wrk_RecordSub set verify=@verify,verifyuser=@verifyuser,verifydate=@verifydate
+                                where  m_id=@m_id and id=@id and style='B'";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            m_id = int.Parse(json[i].id),
+                            id = int.Parse(json[i].sbid),
+                            verify="Y",
+                            verifyuser = username,
+                            verifydate = date
+                        }
+                    });
+                    //鍥炲啓涓嶈壇
+                    sql = @"update CSR_WorkRecord_Defect set verify=verify,verifyuser=@verifyuser,verifydate=@verifydate
+                                    where wo_code=@wo_code and step_code=@step_code and record_id=@id and style='B'";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            wo_code = json[i].wo_code,
+                            step_code = json[i].step_code,
+                            id = int.Parse(json[i].id),
+                            verify="Y",
+                            verifyuser = username,
+                            verifydate = date
+                        }
+                    });
+
+                }
+
+                bool aa = DapperHelper.DoTransaction(list);
+                if (aa)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "瀹℃牳鎶ュ伐鎴愬姛!";
+                    mes.data = null;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "瀹℃牳鎶ュ伐澶辫触!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
 
 
         #region[MES宸ュ崟鎵归噺鍏抽棴鏌ヨ]

--
Gitblit v1.9.3