From e1ef8b7895ff3d5b0f36c7678fbe529a569fa4ac Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 30 十二月 2025 16:02:00 +0800
Subject: [PATCH] 海诚钉钉接口调整

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |   94 ++++++++++++++++++-----------------------------
 1 files changed, 36 insertions(+), 58 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 08cb6d2..7ecb3d4 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -10651,9 +10651,8 @@
         [HttpPost]
         public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg)
         {
-            oCN.BeginTran();
             DAL.ClsSc_MouldScrapOutBill oBill = new DAL.ClsSc_MouldScrapOutBill();
-
+            oCn.BeginTran();
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -10665,6 +10664,7 @@
                 //缂栬緫鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker))
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
@@ -10689,6 +10689,7 @@
                     //鍗曟嵁鍙锋槸鍚﹂噸澶�
                     if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
                     {
+                        oCn.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
@@ -10701,6 +10702,7 @@
                     int sPeriod = 0;
                     if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
                     {
+                        oCn.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = s;
@@ -10736,7 +10738,31 @@
                     //淇濆瓨
                     if (oBill.omodel.HInterID == 0)   //鏂板淇濆瓨
                     {
-                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "娴疯瘹")
+                        {
+
+                            bResult = oBill.AddBillWithWebs(ref DBUtility.ClsPub.sExeReturnInfo, oCn);
+
+                            if (bResult)
+                            {
+                                if (!setOutBill(msg,oBill.omodel.HInterID, ref DBUtility.ClsPub.sErrInfo))
+                                {
+                                    oCn.RollBack();
+                                    objJsonResult.code = "0";
+                                    objJsonResult.count = 0;
+                                    objJsonResult.Message = "閲戣澏鍗曟嵁淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sErrInfo;
+                                    objJsonResult.data = null;
+                                    return objJsonResult;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                        }
+
+
 
                         if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                         {
@@ -10759,6 +10785,7 @@
                 }
                 else
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
@@ -10768,29 +10795,7 @@
 
                 if (bResult)
                 {
-                    if (oSystemParameter.omodel.WMS_CampanyName == "娴峰煄")
-                    {
-
-                        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;
-                        }
-                    }
-                    oCN.Commit();
+                    oCn.Commit();
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
@@ -10801,7 +10806,7 @@
                 }
                 else
                 {
-                    oCN.RollBack();
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
@@ -10811,7 +10816,7 @@
             }
             catch (Exception e)
             {
-                oCN.RollBack();
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
@@ -10820,7 +10825,7 @@
             }
         }
 
-        public bool setOutBill([FromBody] JObject msg, ref string sErrInfo)
+        public bool setOutBill([FromBody] JObject msg,long HInterID,ref string sErrInfo)
         {
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
@@ -10828,8 +10833,6 @@
             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>();
@@ -10842,13 +10845,9 @@
                 //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 = id;
+                websLsmain.HInterID = HInterID;
                 websLsmain.HDate = lsmain[0].HDate;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HSupID = lsmain[0].HSupID;
@@ -10867,38 +10866,17 @@
                 WebS.ClsXt_SystemParameterMain oSystemParameterMain = new WebS.ClsXt_SystemParameterMain();
                 if (oWebs.set_SaveOtherOutBill_New_haicheng(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo))
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //鎴愬姛锛�
-                    objJsonResult.data = null;
                     return true;
                 }
                 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;
+                DBUtility.ClsPub.sErrInfo = "涓婁紶澶辫触锛�" + e.ToString();
                 return false;
             }
         }

--
Gitblit v1.9.1