From 2d142a18b9bd53cd399f3610d71e2105779dceea Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期一, 12 一月 2026 15:28:45 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |  135 ++++++++++++++++++++++++++++++++------------
 1 files changed, 98 insertions(+), 37 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 457663d..8786be2 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -10652,7 +10652,7 @@
         public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg)
         {
             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);
@@ -10664,6 +10664,7 @@
                 //缂栬緫鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker))
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
@@ -10688,6 +10689,7 @@
                     //鍗曟嵁鍙锋槸鍚﹂噸澶�
                     if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
                     {
+                        oCn.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
@@ -10700,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;
@@ -10735,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 == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                         {
@@ -10758,6 +10785,7 @@
                 }
                 else
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
@@ -10767,26 +10795,18 @@
 
                 if (bResult)
                 {
-                    if(setOutBill(msg))
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 1;
-                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
-                        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;
@@ -10796,6 +10816,7 @@
             }
             catch (Exception e)
             {
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
@@ -10804,10 +10825,8 @@
             }
         }
 
-        public bool setOutBill([FromBody] JObject msg)
+        public bool setOutBill([FromBody] JObject msg,long HInterID,ref string sErrInfo)
         {
-
-
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -10826,9 +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";
-
+                
                 WebAPI.WebS.ClsKf_OtherOutBillMain websLsmain = new WebS.ClsKf_OtherOutBillMain();
-                websLsmain.HInterID = lsmain[0].HInterID;
+                websLsmain.HInterID = HInterID;
                 websLsmain.HDate = lsmain[0].HDate;
                 websLsmain.HBillNo = lsmain[0].HBillNo;
                 websLsmain.HSupID = lsmain[0].HSupID;
@@ -10847,31 +10866,19 @@
                 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;
                 }
+
             }
             catch (Exception e)
             {
-
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "涓婁紶澶辫触锛�" + e.ToString();
-                objJsonResult.data = null;
+                DBUtility.ClsPub.sErrInfo = "涓婁紶澶辫触锛�" + e.ToString();
                 return false;
             }
-            return true;
         }
 
         #endregion
@@ -15950,6 +15957,60 @@
 
         #endregion
 
+        #region 鍣ㄥ叿澶勭悊鍑哄簱鍗� 杩斿洖婧愬崟鏁版嵁
+        /// <summary>
+        /// 杩斿洖婧愬崟鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_MouldScrapOutHouseBill/GetSourceBill_MouldScrapOutHouse_Json")]
+        [HttpGet]
+        public object GetSourceBill_MouldScrapOutHouse_Json(Int64 HInterID, Int64 HEntryID, string HBillType)
+        {
+            try
+            {
+                string sViewName = "";
+                //鍣ㄥ叿棰嗙敤鐢宠鍗�
+                if (HBillType == "3823")
+                {
+                    sViewName = "h_v_Sc_MouldScrapRequestBillList";
+                }
 
+                if (sViewName == "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "涓嶆敮鎸佽婧愬崟绫诲瀷锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCn.RunProcReturn("select * from h_v_Sc_MouldScrapRequestBillList where hmainid="+ HInterID.ToString()+ "and hsubid="+ HEntryID, "h_v_Sc_MouldScrapRequestBillList");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏈煡璇㈠埌婧愬崟淇℃伅锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇婧愬崟淇℃伅澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1