From 83ce7da7a744897443a0a6cb860a9a89e4c970ee Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 30 十二月 2025 10:31:07 +0800
Subject: [PATCH] 修复报废单生成其他出库单

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   41 ++++++++++++++++++++++++++++++++---------
 1 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index e7966a9..08cb6d2 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -10651,6 +10651,7 @@
         [HttpPost]
         public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg)
         {
+            oCN.BeginTran();
             DAL.ClsSc_MouldScrapOutBill oBill = new DAL.ClsSc_MouldScrapOutBill();
 
             var _value = msg["msg"].ToString();
@@ -10769,24 +10770,28 @@
                 {
                     if (oSystemParameter.omodel.WMS_CampanyName == "娴峰煄")
                     {
-                        if (setOutBill(msg))
+
+                        if (setOutBill(msg, ref DBUtility.ClsPub.sErrInfo))
                         {
-                            objJsonResult.code = "0";
+                            oCN.Commit();
+                            objJsonResult.code = "1";
                             objJsonResult.count = 1;
-                            objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                            objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
                         else
                         {
+                            oCN.RollBack();
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "閲戣澏鍗曟嵁淇濆瓨澶辫触锛�";
+                            objJsonResult.Message = "閲戣澏鍗曟嵁淇濆瓨澶辫触锛�"+ DBUtility.ClsPub.sErrInfo;
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
                     }
-                    objJsonResult.code = "0";
+                    oCN.Commit();
+                    objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
                     objJsonResult.data = null;
@@ -10796,6 +10801,7 @@
                 }
                 else
                 {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
@@ -10805,6 +10811,7 @@
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
@@ -10813,7 +10820,7 @@
             }
         }
 
-        public bool setOutBill([FromBody] JObject msg)
+        public bool setOutBill([FromBody] JObject msg, ref string sErrInfo)
         {
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
@@ -10821,6 +10828,8 @@
             string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
             string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
             string HMaker = sArray[2].ToString();           //鍒跺崟浜�
+            long id;
+            DataSet ds = oCn.RunProcReturn("select max(HInterID) HInterID from Sc_MouldStockBillMain ", "Sc_MouldStockBillMain");
             try
             {
                 //List<Model.ClsKf_OtherOutBillMain> lsmain = new List<Model.ClsKf_OtherOutBillMain>();
@@ -10833,9 +10842,13 @@
                 //lsmain[0].HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                 //lsmain[0].HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
                 string sSourceBillType = "3832";
-
+                if(lsmain[0].HInterID==0)
+                {
+                    
+                    id = Convert.ToInt64(ds.Tables[0].Rows[0]["HInterID"]);
+                
                 WebAPI.WebS.ClsKf_OtherOutBillMain websLsmain = new WebS.ClsKf_OtherOutBillMain();
-                websLsmain.HInterID = lsmain[0].HInterID;
+                websLsmain.HInterID = id;
                 websLsmain.HDate = lsmain[0].HDate;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HSupID = lsmain[0].HSupID;
@@ -10862,16 +10875,26 @@
                 }
                 else
                 {
+
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
                     objJsonResult.data = null;
                     return false;
                 }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇蜂粠鏂板鐣岄潰鐢熸垚閲戣澏鍗曟嵁" +DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                    objJsonResult.data = null;
+                    return false;
+                }
+
             }
             catch (Exception e)
             {
-
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "涓婁紶澶辫触锛�" + e.ToString();

--
Gitblit v1.9.1