From c464f72ac383e8dbc98d8a43f05098fbaff64a19 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 19 八月 2025 11:05:40 +0800
Subject: [PATCH] 工序委外发出单获取工序信息添加序列号

---
 WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs |   47 +++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs b/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
index d3136fe..fc5ec30 100644
--- a/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
+++ b/WebAPI/Controllers/CJGL/Gy_MaterPreventErrMouldBillController.cs
@@ -20,6 +20,7 @@
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
+        public DataSet ds1 = new DataSet();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         public DAL.ClsGy_MaterPreventErrMouldBillMain OBill = new DAL.ClsGy_MaterPreventErrMouldBillMain();
         public DAL.ClsGy_MaterPreventErrMouldBillMain BillOld = new DAL.ClsGy_MaterPreventErrMouldBillMain();
@@ -472,7 +473,6 @@
                 if (Type == 1)
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -511,8 +511,8 @@
                         }
                         //瀹℃牳鍓嶆帶鍒�=========================================      
                         string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
-                        ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeCheckCtrl");
-                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeCheckCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -522,11 +522,11 @@
                             return objJsonResult;
                         }
 
-                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
                             objJsonResult.data = null;
                             oCN.RollBack();
                             return objJsonResult;
@@ -547,7 +547,6 @@
                 else
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -578,8 +577,8 @@
                         }
                         //鍙嶅鏍稿墠鎺у埗=========================================        
                         string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeUnCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
-                        ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnCheckCtrl");
-                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnCheckCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -588,11 +587,11 @@
                             return objJsonResult;
 
                         }
-                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
@@ -810,7 +809,6 @@
                 if (Type == 1)
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -841,8 +839,8 @@
                         }
                         //浣滃簾鍓嶆帶鍒�=========================================      
                         string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
-                        ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeDropCtrl");
-                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeDropCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -852,11 +850,11 @@
                             return objJsonResult;
                         }
 
-                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
                             objJsonResult.data = null;
                             oCN.RollBack();
                             return objJsonResult;
@@ -876,7 +874,6 @@
                 else
                 {
                     //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
-                    DataSet ds;
                     string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
                     ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
                     if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
@@ -899,8 +896,8 @@
                         }
                         //鍙嶄綔搴熷墠鎺у埗=========================================      
                         string sql1 = "exec h_p_Gy_MaterPreventErrMouldBill_BeforeUnDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'";
-                        ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnDropCtrl");
-                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                        ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPreventErrMouldBill_BeforeUnDropCtrl");
+                        if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
@@ -910,11 +907,11 @@
                             return objJsonResult;
                         }
 
-                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                        if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ;
                             objJsonResult.data = null;
                             oCN.RollBack();
                             return objJsonResult;
@@ -1041,6 +1038,9 @@
 
                 if (!tb2.Columns.Contains("澶辨晥楠岃瘉鏂规硶"))
                     error += "娌℃湁鎵惧埌銆愬け鏁堥獙璇佹柟娉曘�戠殑鏍囬,";
+
+                if (!tb2.Columns.Contains("闃查敊缁撴灉"))
+                    error += "娌℃湁鎵惧埌銆愰槻閿欑粨鏋溿�戠殑鏍囬,";
 
                 if (!tb2.Columns.Contains("琛ㄤ綋澶囨敞"))
                     error += "娌℃湁鎵惧埌銆愯〃浣撳娉ㄣ�戠殑鏍囬,";
@@ -1270,6 +1270,7 @@
                     string HPreventErrNote = item["闃查敊鍔熻兘"].ToString();
                     string HLoseMode = item["澶辨晥妯″紡"].ToString();
                     string HLoseCheck = item["澶辨晥楠岃瘉鏂规硶"].ToString();
+                    string HPreventErrResult = item["闃查敊缁撴灉"].ToString();
 
                     ds = oCN.RunProcReturn("select * from Gy_MaterPreventErrMouldBillMain where HBillNo='" + HBillNo + "'", "Gy_MaterPreventErrMouldBillMain");
 
@@ -1297,7 +1298,7 @@
                         //鎻掑叆瀛愯〃
                         oCN.RunProc("insert into Gy_MaterPreventErrMouldBillSub " +
                         "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
-                        ",HPreventErrMouldID,HPreventErrNote,HLoseMode,HLoseCheck) " +
+                        ",HPreventErrMouldID,HPreventErrNote,HLoseMode,HLoseCheck,HPreventErrResult) " +
                         " values(" +
                         "" + HInterID.ToString() +
                         "," + 1 +
@@ -1310,6 +1311,7 @@
                         "','" + HPreventErrNote +
                         "','" + HLoseMode +
                         "','" + HLoseCheck +
+                        "','" + HPreventErrResult +
                         "')");
                     }
                     else
@@ -1325,7 +1327,7 @@
                         //鎻掑叆瀛愯〃
                         oCN.RunProc("insert into Gy_MaterPreventErrMouldBillSub " +
                         "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
-                        ",HPreventErrMouldID,HPreventErrNote,HLoseMode,HLoseCheck) " +
+                        ",HPreventErrMouldID,HPreventErrNote,HLoseMode,HLoseCheck,HPreventErrResult) " +
                         " values(" +
                         "" + HInterID.ToString() +
                         "," + HEntryID +
@@ -1338,6 +1340,7 @@
                         "','" + HPreventErrNote +
                         "','" + HLoseMode +
                         "','" + HLoseCheck +
+                        "','" + HPreventErrResult +
                         "')");
                     }
 

--
Gitblit v1.9.1