From 53ea41f6eee11cb042222cf3e1943af8909894be Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 30 十二月 2025 10:31:50 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   76 ++++++++++++++++++++++++++-----------
 1 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 62052b9..08cb6d2 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -10381,13 +10381,14 @@
                     return objJsonResult;
                 }
 
-                sWhere = sWhere.Replace("'", "''");
+                
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldScrapOutHouseBillList " + page + "," + size + ",''", "h_p_Sc_MouldScrapOutHouseBillList");
                 }
                 else
-                {
+                {   
+                    sWhere = sWhere.Replace("'", "''");
                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldScrapOutHouseBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldScrapOutHouseBillList");
                 }
 
@@ -10650,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();
@@ -10766,26 +10768,40 @@
 
                 if (bResult)
                 {
-                    if(setOutBill(msg))
+                    if (oSystemParameter.omodel.WMS_CampanyName == "娴峰煄")
                     {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
-                        objJsonResult.data = null;
-                        return objJsonResult;
+
+                        if (setOutBill(msg, ref DBUtility.ClsPub.sErrInfo))
+                        {
+                            oCN.Commit();
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            oCN.RollBack();
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "閲戣澏鍗曟嵁淇濆瓨澶辫触锛�"+ DBUtility.ClsPub.sErrInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
-                    else
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
-                        objJsonResult.data = null;
-                        return objJsonResult;
-                    }
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                    
                    
                 }
                 else
                 {
+                    oCN.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
@@ -10795,6 +10811,7 @@
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
@@ -10803,16 +10820,16 @@
             }
         }
 
-        public bool setOutBill([FromBody] JObject msg)
+        public bool setOutBill([FromBody] JObject msg, ref string sErrInfo)
         {
-
-
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             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>();
@@ -10825,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;
@@ -10854,23 +10875,32 @@
                 }
                 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();
                 objJsonResult.data = null;
                 return false;
             }
-            return true;
         }
 
         #endregion

--
Gitblit v1.9.1