From b065299c6d8c27f80da9e9451878650b05feb0cb Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 04 七月 2024 15:53:20 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs | 1531 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 1,076 insertions(+), 455 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index b5e0283..25453d9 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -22,6 +22,7 @@
         public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
         public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill();   //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫�
@@ -6979,7 +6980,208 @@
         }
         #endregion
 
-        #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫
+        #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫    20240702浣滃簾
+        /// <summary>
+        /// 淇濆瓨妯″叿鎶ュ簾鍏ュ簱鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        //[Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList")]
+        //[HttpPost]
+        //public object SaveGetMouldScrapInHouseBillList([FromBody] JObject msg)
+        //{
+        //    var _value = msg["msg"].ToString();
+        //    string msg1 = _value.ToString();
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    string msg2 = sArray[0].ToString();
+        //    string msg3 = sArray[1].ToString();
+        //    string refSav = sArray[2].ToString();
+        //    string msg4 = sArray[3].ToString();
+
+        //    string UserName = "";
+        //    string s = "";
+        //    ListModels oListModels = new ListModels();
+        //    try
+        //    {
+        //        //缂栬緫鏉冮檺
+        //        if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+
+        //        DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill();
+        //        List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>();
+        //        msg2 = msg2.Replace("\\", "");
+        //        msg2 = msg2.Replace("\n", "");  //\n
+        //        lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2);
+        //        foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain)
+        //        {
+        //            if (refSav == "Add")
+        //            {
+        //                //鍗曟嵁鍙锋槸鍚﹂噸澶�
+        //                if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID))
+        //                {
+        //                    objJsonResult.code = "0";
+        //                    objJsonResult.count = 0;
+        //                    objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+        //                    objJsonResult.data = 1;
+        //                    return objJsonResult;
+        //                }
+        //            }
+        //            if (refSav == "Update")
+        //            {
+        //                if (BillOld0.ShowBill(oItem.HInterID, ref s) == false)
+        //                {
+        //                    objJsonResult.code = "0";
+        //                    objJsonResult.count = 0;
+        //                    objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+        //                    objJsonResult.data = 1;
+        //                    return objJsonResult;
+        //                }
+        //                //鍒ゆ柇鏄惁鍙紪杈�
+        //                if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null)
+        //                {
+        //                    objJsonResult.code = "0";
+        //                    objJsonResult.count = 0;
+        //                    objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+        //                    objJsonResult.data = 1;
+        //                    return objJsonResult;
+        //                }
+        //                if (BillOld0.omodel.HBillStatus > 1)
+        //                {
+        //                    objJsonResult.code = "0";
+        //                    objJsonResult.count = 0;
+        //                    objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+        //                    objJsonResult.data = 1;
+        //                    return objJsonResult;
+        //                }
+        //                if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s))
+        //                {
+        //                    objJsonResult.code = "0";
+        //                    objJsonResult.count = 0;
+        //                    objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+        //                    objJsonResult.data = 1;
+        //                    return objJsonResult;
+        //                }
+        //            }
+        //            //oItem.HMaker = "";
+        //            UserName = oItem.HMaker;  //鍒跺崟浜�
+        //            oItem.HBillType = "3831";
+        //            oItem.HBillSubType = "3831";
+        //            //oItem.HBillNo = "";    //鍗曟嵁鍙�
+        //            //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+        //            //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
+        //            oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+        //            oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+        //            //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
+        //            //oItem.HPeriod = 0;
+        //            //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
+        //            //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
+        //            //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
+        //            //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
+        //            //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
+        //            //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
+        //            //oItem.HRemark = "";       //澶囨敞
+
+        //            //oItem.HMainSourceInterID = oItem.HInterID;
+
+        //            //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+        //            if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+        //            {
+        //                objJsonResult.code = "0";
+        //                objJsonResult.count = 0;
+        //                objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+        //                objJsonResult.data = 1;
+        //                return objJsonResult;
+        //            }
+        //            oBill.omodel = oItem;
+        //        }
+        //        //琛ㄤ綋鏁版嵁
+        //        //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+        //        msg3 = msg3.Substring(1, msg3.Length - 2);
+        //        msg3 = msg3.Replace("\\", "");
+        //        msg3 = msg3.Replace("\n", "");  //\n
+        //        //msg2 = msg2.Replace("'", "鈥�");
+        //        List<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>();
+        //        ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3);
+        //        int i = 0;
+        //        foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls)
+        //        {
+
+        //            i++;
+        //            oItemSub.HEntryID = i;
+
+        //            //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
+        //            //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
+        //            //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+        //            //oItemSub.HCloseMan = "";       //琛屽叧闂�
+        //            oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+        //            oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+        //            //oItemSub.HRemark = "";         //澶囨敞
+        //            oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+        //            oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+        //            //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+        //            //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+        //            //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+        //            //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
+        //            //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+        //            //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+        //            //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+        //            oBill.DetailColl.Add(oItemSub);
+
+        //        }
+        //        //淇濆瓨
+        //        //淇濆瓨瀹屾瘯鍚庡鐞�
+        //        bool bResult;
+        //        if (oBill.omodel.HInterID == 0)
+        //        {
+        //            // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        else
+        //        {
+        //            bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+        //            //淇敼鎴愬姛
+        //            //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        if (bResult)
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 1;
+        //            objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+        //            //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //        else
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = 1;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+
+        #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫    20240702
         /// <summary>
         /// 淇濆瓨妯″叿鎶ュ簾鍏ュ簱鍗�
         /// </summary>
@@ -6989,175 +7191,137 @@
         [HttpPost]
         public object SaveGetMouldScrapInHouseBillList([FromBody] JObject msg)
         {
+            DAL.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill();
+
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
-            string refSav = sArray[2].ToString();
-            string msg4 = sArray[3].ToString();
-
-            string UserName = "";
-            string s = "";
-            ListModels oListModels = new ListModels();
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string OperationType = sArray[2].ToString();    //鎿嶄綔绫诲瀷锛圓dd鏂板銆乁pdate缂栬緫锛�
+            string HMaker = sArray[3].ToString();           //鍒跺崟浜�
             try
             {
-                //缂栬緫鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, msg4))
+                //鍒ゆ柇鏉冮檺
+                if (OperationType == "Add")
+                {
+                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    //鍒ゆ柇鏂板鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill", 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+                    //鍒ゆ柇缂栬緫鏉冮檺
+                    if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapRequestBill_Edit", 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                //琛ㄥご璧嬪��
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr);
+                foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain)
+                {
+                    //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oItem.HYear = sYear;
+                    oItem.HPeriod = sPeriod;
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋璧嬪��
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                sSubStr = "[" + sSubStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr);
+                int i = 0;
+                foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oBill.DetailColl.Add(oItemSub);
+                }
+
+                string sErrMsg = "";
+                bool bResult;
+                //鑾峰彇绯荤粺鍙傛暟
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+                {
+                    //淇濆瓨
+                    if (OperationType == "Add")   //鏂板淇濆瓨
+                    {
+                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                    else                        //缂栬緫淇濆瓨
+                    {
+                        bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                }
+                else
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill();
-                List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>();
-                msg2 = msg2.Replace("\\", "");
-                msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2);
-                foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain)
-                {
-                    if (refSav == "Add")
-                    {
-                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
-                        if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                    }
-                    if (refSav == "Update")
-                    {
-                        if (BillOld0.ShowBill(oItem.HInterID, ref s) == false)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                        //鍒ゆ柇鏄惁鍙紪杈�
-                        if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                        if (BillOld0.omodel.HBillStatus > 1)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s))
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
-                            objJsonResult.data = 1;
-                            return objJsonResult;
-                        }
-                    }
-                    //oItem.HMaker = "";
-                    UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "3831";
-                    oItem.HBillSubType = "3831";
-                    //oItem.HBillNo = "";    //鍗曟嵁鍙�
-                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
-                    //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-                    //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
-                    //oItem.HPeriod = 0;
-                    //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
-                    //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
-                    //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
-                    //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
-                    //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
-                    //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
-                    //oItem.HRemark = "";       //澶囨敞
-
-                    //oItem.HMainSourceInterID = oItem.HInterID;
-
-                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
-                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
-                    oBill.omodel = oItem;
-                }
-                //琛ㄤ綋鏁版嵁
-                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg3 = msg3.Substring(1, msg3.Length - 2);
-                msg3 = msg3.Replace("\\", "");
-                msg3 = msg3.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>();
-                ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3);
-                int i = 0;
-                foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls)
-                {
-
-                    i++;
-                    oItemSub.HEntryID = i;
-
-                    //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
-                    //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
-                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
-                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
-                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
-                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
-                    oBill.DetailColl.Add(oItemSub);
-
-                }
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
-                bool bResult;
-                if (oBill.omodel.HInterID == 0)
-                {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
-                    oCn.RunProc(sql);
-                }
-                else
-                {
-                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                    //淇敼鎴愬姛
-                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
-                    oCn.RunProc(sql);
-                }
                 if (bResult)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
-                    objJsonResult.data = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
@@ -7165,7 +7329,7 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = 1;
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
             }
@@ -7173,8 +7337,8 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-                objJsonResult.data = 1;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+                objJsonResult.data = null;
                 return objJsonResult;
             }
         }
@@ -7443,7 +7607,158 @@
         }
         #endregion
 
-        #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫
+        #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫    20240702浣滃簾
+        /// <summary>
+        /// 淇濆瓨妯″叿澶勭悊鍑哄簱鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        //[Route("Sc_MouldScrapOutHouseBill/SaveGetMouldScrapOutHouseBillList")]
+        //[HttpPost]
+        //public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg)
+        //{
+        //    var _value = msg["msg"].ToString();
+        //    string msg1 = _value.ToString();
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    string msg2 = sArray[0].ToString();
+        //    string msg3 = sArray[1].ToString();
+        //    string msg4 = sArray[2].ToString();
+
+        //    string UserName = "";
+        //    ListModels oListModels = new ListModels();
+        //    try
+        //    {
+        //        //缂栬緫鏉冮檺
+        //        if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, msg4))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+
+        //        DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill();
+        //        List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>();
+        //        msg2 = msg2.Replace("\\", "");
+        //        msg2 = msg2.Replace("\n", "");  //\n
+        //        lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2);
+        //        foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain)
+        //        {
+        //            //oItem.HMaker = "";
+        //            UserName = oItem.HMaker;  //鍒跺崟浜�
+        //            oItem.HBillType = "3832";
+        //            oItem.HBillSubType = "3832";
+        //            //oItem.HBillNo = "";    //鍗曟嵁鍙�
+        //            //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+        //            //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
+        //            oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+        //            oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+        //            //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
+        //            //oItem.HPeriod = 0;
+        //            //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
+        //            //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
+        //            //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
+        //            //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
+        //            //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
+        //            //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
+        //            //oItem.HRemark = "";       //澶囨敞
+
+        //            //oItem.HMainSourceInterID = oItem.HInterID;
+
+        //            //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+        //            if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+        //            {
+        //                objJsonResult.code = "0";
+        //                objJsonResult.count = 0;
+        //                objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+        //                objJsonResult.data = 1;
+        //                return objJsonResult;
+        //            }
+        //            oBill.omodel = oItem;
+        //        }
+        //        //琛ㄤ綋鏁版嵁
+        //        //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+        //        msg3 = msg3.Substring(1, msg3.Length - 2);
+        //        msg3 = msg3.Replace("\\", "");
+        //        msg3 = msg3.Replace("\n", "");  //\n
+        //        //msg2 = msg2.Replace("'", "鈥�");
+        //        List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>();
+        //        ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3);
+        //        int i = 0;
+        //        foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+        //        {
+
+        //            i++;
+        //            oItemSub.HEntryID = i;
+
+        //            //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
+        //            //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
+        //            //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+        //            //oItemSub.HCloseMan = "";       //琛屽叧闂�
+        //            oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+        //            oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+        //            //oItemSub.HRemark = "";         //澶囨敞
+        //            oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+        //            oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+        //            //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+        //            //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+        //            //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+        //            //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
+        //            //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+        //            //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+        //            //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+        //            oBill.DetailColl.Add(oItemSub);
+
+        //        }
+        //        //淇濆瓨
+        //        //淇濆瓨瀹屾瘯鍚庡鐞�
+        //        bool bResult;
+        //        if (oBill.omodel.HInterID == 0)
+        //        {
+        //            // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        else
+        //        {
+        //            bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+        //            //淇敼鎴愬姛
+        //            //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        if (bResult)
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 1;
+        //            objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+        //            //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //        else
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = 1;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+
+        #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫    20240702
         /// <summary>
         /// 淇濆瓨妯″叿澶勭悊鍑哄簱鍗�
         /// </summary>
@@ -7453,125 +7768,126 @@
         [HttpPost]
         public object SaveGetMouldScrapOutHouseBillList([FromBody] JObject msg)
         {
+            DAL.ClsSc_MouldScrapOutBill oBill = new DAL.ClsSc_MouldScrapOutBill();
+
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
-            string msg4 = sArray[2].ToString();
-
-            string UserName = "";
-            ListModels oListModels = new ListModels();
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string HMaker = sArray[2].ToString();           //鍒跺崟浜�
             try
             {
                 //缂栬緫鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, msg4))
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //琛ㄥご璧嬪��
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr);
+                foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain)
+                {
+                    if (oItem.HInterID == 0)
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    }
+                    else
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+                    }
+                    //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oItem.HYear = sYear;
+                    oItem.HPeriod = sPeriod;
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋璧嬪��
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                sSubStr = "[" + sSubStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr);
+                int i = 0;
+                foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oBill.DetailColl.Add(oItemSub);
+                }
+
+                string sErrMsg = "";
+                bool bResult;
+                //鑾峰彇绯荤粺鍙傛暟
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+                {
+                    //淇濆瓨
+                    if (oBill.omodel.HInterID == 0)   //鏂板淇濆瓨
+                    {
+                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                    else                        //缂栬緫淇濆瓨
+                    {
+                        bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill();
-                List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>();
-                msg2 = msg2.Replace("\\", "");
-                msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2);
-                foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain)
-                {
-                    //oItem.HMaker = "";
-                    UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "3832";
-                    oItem.HBillSubType = "3832";
-                    //oItem.HBillNo = "";    //鍗曟嵁鍙�
-                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
-                    //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-                    //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
-                    //oItem.HPeriod = 0;
-                    //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
-                    //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
-                    //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
-                    //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
-                    //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
-                    //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
-                    //oItem.HRemark = "";       //澶囨敞
-
-                    //oItem.HMainSourceInterID = oItem.HInterID;
-
-                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
-                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
-                    oBill.omodel = oItem;
-                }
-                //琛ㄤ綋鏁版嵁
-                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg3 = msg3.Substring(1, msg3.Length - 2);
-                msg3 = msg3.Replace("\\", "");
-                msg3 = msg3.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>();
-                ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3);
-                int i = 0;
-                foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
-                {
-
-                    i++;
-                    oItemSub.HEntryID = i;
-
-                    //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
-                    //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
-                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
-                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
-                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
-                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
-                    oBill.DetailColl.Add(oItemSub);
-
-                }
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
-                bool bResult;
-                if (oBill.omodel.HInterID == 0)
-                {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
-                    oCn.RunProc(sql);
-                }
-                else
-                {
-                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                    //淇敼鎴愬姛
-                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
-                    oCn.RunProc(sql);
-                }
                 if (bResult)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
-                    objJsonResult.data = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
@@ -7579,7 +7895,7 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = 1;
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
             }
@@ -7587,8 +7903,8 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-                objJsonResult.data = 1;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+                objJsonResult.data = null;
                 return objJsonResult;
             }
         }
@@ -8035,7 +8351,159 @@
         }
         #endregion
 
-        #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫
+        #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫    20240702浣滃簾
+        /// <summary>
+        /// 淇濆瓨妯″叿閫�搴撳崟
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        //[Route("Sc_MouldProdBackBill/SaveGetMouldProdBackBillList")]
+        //[HttpPost]
+        //public object SaveGetMouldProdBackBillList([FromBody] JObject msg)
+        //{
+        //    var _value = msg["msg"].ToString();
+        //    string msg1 = _value.ToString();
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    string msg2 = sArray[0].ToString();
+        //    string msg3 = sArray[1].ToString();
+        //    string msg4 = sArray[2].ToString();
+
+        //    string UserName = "";
+        //    ListModels oListModels = new ListModels();
+        //    try
+        //    {
+        //        if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, msg4))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+
+        //        DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill();
+        //        List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>();
+        //        msg2 = msg2.Replace("\\", "");
+        //        msg2 = msg2.Replace("\n", "");  //\n
+        //        lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2);
+        //        foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain)
+        //        {
+        //             //oItem.HMaker = "";
+        //            UserName = oItem.HMaker;  //鍒跺崟浜�
+        //            oItem.HBillType = "3803";
+        //            oItem.HBillSubType = "3803";
+        //            //oItem.HBillNo = "";    //鍗曟嵁鍙�
+        //            //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+        //            //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
+        //            oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+        //            oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+        //            //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
+        //            //oItem.HPeriod = 0;
+        //            //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
+        //            //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
+        //            //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
+        //            //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
+        //            //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
+        //            //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
+        //            //oItem.HRemark = "";       //澶囨敞
+
+        //            //oItem.HMainSourceInterID = oItem.HInterID;
+
+        //            //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+        //            if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+        //            {
+        //                objJsonResult.code = "0";
+        //                objJsonResult.count = 0;
+        //                objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+        //                objJsonResult.data = 1;
+        //                return objJsonResult;
+        //            }
+        //            oBill.omodel = oItem;
+        //        }
+        //        //琛ㄤ綋鏁版嵁
+        //        //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+        //        msg3 = msg3.Substring(1, msg3.Length - 2);
+        //        msg3 = msg3.Replace("\\", "");
+        //        msg3 = msg3.Replace("\n", "");  //\n
+        //        //msg2 = msg2.Replace("'", "鈥�");
+        //        List<Model.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>();
+        //        ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3);
+        //        int i = 0;
+        //        foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls)
+        //        {
+
+        //            i++;
+        //            oItemSub.HEntryID = i;
+
+        //            //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
+        //            //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
+        //            //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+        //            //oItemSub.HCloseMan = "";       //琛屽叧闂�
+        //            oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+        //            oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+        //            //oItemSub.HRemark = "";         //澶囨敞
+        //            oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+        //            oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+        //            //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+        //            //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+        //            //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+        //            //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
+        //            //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+        //            //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+        //            //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+        //            oBill.DetailColl.Add(oItemSub);
+
+        //        }
+        //        //淇濆瓨
+        //        //淇濆瓨瀹屾瘯鍚庡鐞�
+        //        bool bResult;
+        //        if (oBill.omodel.HInterID == 0)
+        //        {
+        //            // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
+        //            oCn.RunProc(sql1);
+        //        }
+        //        else
+        //        {
+        //            bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+        //            //淇敼鎴愬姛
+        //            //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        if (bResult)
+        //        {
+        //            string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ;
+        //            oCn.RunProc(sql);
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 1;
+        //            objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+        //            //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //        else
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = 1;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+
+        #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫    20240702
         /// <summary>
         /// 淇濆瓨妯″叿閫�搴撳崟
         /// </summary>
@@ -8045,126 +8513,127 @@
         [HttpPost]
         public object SaveGetMouldProdBackBillList([FromBody] JObject msg)
         {
+            DAL.ClsSc_MouldProdBackBill oBill = new DAL.ClsSc_MouldProdBackBill();
+
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
-            string msg4 = sArray[2].ToString();
-
-            string UserName = "";
-            ListModels oListModels = new ListModels();
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string HMaker = sArray[2].ToString();           //鍒跺崟浜�
             try
             {
-                if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, msg4))
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Edit", 1, false, HMaker))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺";
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //琛ㄥご璧嬪��
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                List<Model.ClsSc_MouldProdBackBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillMain>>(sMainStr);
+                foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain)
+                {
+                    if (oItem.HInterID == 0)
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    }
+                    else
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+                    }
+                    //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oItem.HYear = sYear;
+                    oItem.HPeriod = sPeriod;
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
+                    oBill.omodel = oItem;
+                }
+                //琛ㄤ綋璧嬪��
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                sSubStr = "[" + sSubStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr);
+                int i = 0;
+                foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+                    oBill.DetailColl.Add(oItemSub);
+                }
+
+                string sErrMsg = "";
+                bool bResult;
+                //鑾峰彇绯荤粺鍙傛暟
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
+                {
+                    //淇濆瓨
+                    if (oBill.omodel.HInterID == 0)   //鏂板淇濆瓨
+                    {
+                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
+                            oCn.RunProc(sql1);
+                        }
+                    }
+                    else                        //缂栬緫淇濆瓨
+                    {
+                        bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill();
-                List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>();
-                msg2 = msg2.Replace("\\", "");
-                msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2);
-                foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain)
-                {
-                     //oItem.HMaker = "";
-                    UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "3803";
-                    oItem.HBillSubType = "3803";
-                    //oItem.HBillNo = "";    //鍗曟嵁鍙�
-                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
-                    //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-                    //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
-                    //oItem.HPeriod = 0;
-                    //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
-                    //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
-                    //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
-                    //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
-                    //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
-                    //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
-                    //oItem.HRemark = "";       //澶囨敞
-
-                    //oItem.HMainSourceInterID = oItem.HInterID;
-
-                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
-                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
-                    {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
-                        objJsonResult.data = 1;
-                        return objJsonResult;
-                    }
-                    oBill.omodel = oItem;
-                }
-                //琛ㄤ綋鏁版嵁
-                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg3 = msg3.Substring(1, msg3.Length - 2);
-                msg3 = msg3.Replace("\\", "");
-                msg3 = msg3.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>();
-                ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3);
-                int i = 0;
-                foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls)
-                {
-
-                    i++;
-                    oItemSub.HEntryID = i;
-
-                    //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
-                    //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
-                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
-                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
-                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
-                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
-                    oBill.DetailColl.Add(oItemSub);
-
-                }
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
-                bool bResult;
-                if (oBill.omodel.HInterID == 0)
-                {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'in','{oBill.omodel.HInterID.ToString()}' ");
-                    oCn.RunProc(sql1);
-                }
-                else
-                {
-                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                    //淇敼鎴愬姛
-                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
-                    oCn.RunProc(sql);
-                }
                 if (bResult)
                 {
-                    string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ;
-                    oCn.RunProc(sql);
+                    string sql = string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ");
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
-                    objJsonResult.data = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
@@ -8172,7 +8641,7 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = 1;
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
             }
@@ -8180,8 +8649,8 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-                objJsonResult.data = 1;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+                objJsonResult.data = null;
                 return objJsonResult;
             }
         }
@@ -8488,7 +8957,158 @@
         }
         #endregion
 
-        #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫
+        #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫    20240702浣滃簾
+        /// <summary>
+        /// 淇濆瓨妯″叿棰嗙敤鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        //[Route("Sc_MouldProdOutBill/SaveGetMouldProdOutBillList")]
+        //[HttpPost]
+        //public object SaveGetMouldProdOutBillList([FromBody] JObject msg)
+        //{
+        //    var _value = msg["msg"].ToString();
+        //    string msg1 = _value.ToString();
+        //    string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+        //    string msg2 = sArray[0].ToString();
+        //    string msg3 = sArray[1].ToString();
+        //    string msg4 = sArray[2].ToString();
+
+
+        //    string UserName = "";
+        //    ListModels oListModels = new ListModels();
+        //    try
+        //    {
+        //        //妯″潡鍚嶏紝鍐欏叆鏃ュ織锛屾姤閿欐锛岀敤鎴峰悕
+        //        if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, msg4))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+        //        DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill();
+        //        List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>();
+        //        msg2 = msg2.Replace("\\", "");
+        //        msg2 = msg2.Replace("\n", "");  //\n
+        //        lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2);
+        //        foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain)
+        //        {
+        //            //oItem.HMaker = "";
+        //            UserName = oItem.HMaker;  //鍒跺崟浜�
+        //            oItem.HBillType = "3802";
+        //            oItem.HBillSubType = "3802";
+        //            //oItem.HBillNo = "";    //鍗曟嵁鍙�
+        //            //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
+        //            //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
+        //            oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+        //            oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+        //            //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
+        //            //oItem.HPeriod = 0;
+        //            //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
+        //            //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
+        //            //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
+        //            //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
+        //            //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
+        //            //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
+        //            //oItem.HRemark = "";       //澶囨敞
+
+        //            //oItem.HMainSourceInterID = oItem.HInterID;
+
+        //            //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
+        //            if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+        //            {
+        //                objJsonResult.code = "0";
+        //                objJsonResult.count = 0;
+        //                objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+        //                objJsonResult.data = 1;
+        //                return objJsonResult;
+        //            }
+        //            oBill.omodel = oItem;
+        //        }
+        //        //琛ㄤ綋鏁版嵁
+        //        //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+        //        msg3 = msg3.Substring(1, msg3.Length - 2);
+        //        msg3 = msg3.Replace("\\", "");
+        //        msg3 = msg3.Replace("\n", "");  //\n
+        //        //msg2 = msg2.Replace("'", "鈥�");
+        //        List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>();
+        //        ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3);
+        //        int i = 0;
+        //        foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
+        //        {
+
+        //            i++;
+        //            oItemSub.HEntryID = i;
+
+        //            //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
+        //            //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
+        //            //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
+        //            //oItemSub.HCloseMan = "";       //琛屽叧闂�
+        //            oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+        //            oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+        //            //oItemSub.HRemark = "";         //澶囨敞
+        //            oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
+        //            oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
+        //            //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
+        //            //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+        //            //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
+        //            //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
+        //            //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
+        //            //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
+        //            //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
+        //            oBill.DetailColl.Add(oItemSub);
+
+        //        }
+        //        //淇濆瓨
+        //        //淇濆瓨瀹屾瘯鍚庡鐞�
+        //        bool bResult;
+        //        if (oBill.omodel.HInterID == 0)
+        //        {
+        //            // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        else
+        //        {
+        //            bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+        //            //淇敼鎴愬姛
+        //            //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
+        //            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+        //            oCn.RunProc(sql);
+        //        }
+        //        if (bResult)
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 1;
+        //            objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+        //            //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //        else
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+        //            objJsonResult.data = 1;
+        //            return objJsonResult;
+        //        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = 1;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+
+        #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫    20240702
         /// <summary>
         /// 淇濆瓨妯″叿棰嗙敤鍗�
         /// </summary>
@@ -8498,125 +9118,126 @@
         [HttpPost]
         public object SaveGetMouldProdOutBillList([FromBody] JObject msg)
         {
+            DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill();
+
             var _value = msg["msg"].ToString();
             string msg1 = _value.ToString();
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
-            string msg2 = sArray[0].ToString();
-            string msg3 = sArray[1].ToString();
-            string msg4 = sArray[2].ToString();
-
-
-            string UserName = "";
-            ListModels oListModels = new ListModels();
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string HMaker = sArray[2].ToString();           //鍒跺崟浜�
             try
             {
                 //妯″潡鍚嶏紝鍐欏叆鏃ュ織锛屾姤閿欐锛岀敤鎴峰悕
-                if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, msg4))
+                if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBill_Edit", 1, false, HMaker))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺";
+                    objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill();
-                List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>();
-                msg2 = msg2.Replace("\\", "");
-                msg2 = msg2.Replace("\n", "");  //\n
-                lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2);
+                //琛ㄥご璧嬪��
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                List<Model.ClsSc_MouldProdOutBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(sMainStr);
                 foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain)
                 {
-                    //oItem.HMaker = "";
-                    UserName = oItem.HMaker;  //鍒跺崟浜�
-                    oItem.HBillType = "3802";
-                    oItem.HBillSubType = "3802";
-                    //oItem.HBillNo = "";    //鍗曟嵁鍙�
-                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --鏃ユ湡
-                    //oItem.HInnerBillNo = "";  //  --鍐呴儴鍗曟嵁鍙�
-                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
-                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
-                    //oItem.HEquipID = 0;    //璁惧ID(Gy_EquipMent)
-                    //oItem.HPeriod = 0;
-                    //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));  //  --缁翠慨鏃ユ湡
-                    //oItem.HCheckResult = "";     //楠屾敹缁撹--(姝e父锛屽紓甯�)
-                    //oItem.HEmpID = 0;           //楠屾敹浜�(Gy_Employee)
-                    //oItem.HManagerID = 0;      //璐熻矗浜�(Gy_Employee)
-                    //oItem.HDeptID = 0;        //楠屾敹閮ㄩ棬(Gy_Department)
-                    //oItem.HExplanation = "";  //鎽樿(鏁呴殰鎻忚堪)  
-                    //oItem.HRemark = "";       //澶囨敞
-
-                    //oItem.HMainSourceInterID = oItem.HInterID;
-
-                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
-                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    if (oItem.HInterID == 0)
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    }
+                    else
+                    {
+                        BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
+                    }
+                    //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                    if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
-                        objJsonResult.data = 1;
+                        objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                        objJsonResult.data = null;
                         return objJsonResult;
                     }
+                    //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                    string s = "";
+                    int sYear = 0;
+                    int sPeriod = 0;
+                    if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = s;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    oItem.HYear = sYear;
+                    oItem.HPeriod = sPeriod;
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
                     oBill.omodel = oItem;
                 }
-                //琛ㄤ綋鏁版嵁
+                //琛ㄤ綋璧嬪��
                 //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-                msg3 = msg3.Substring(1, msg3.Length - 2);
-                msg3 = msg3.Replace("\\", "");
-                msg3 = msg3.Replace("\n", "");  //\n
-                //msg2 = msg2.Replace("'", "鈥�");
-                List<Model.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>();
-                ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3);
+                sSubStr = sSubStr.Substring(1, sSubStr.Length - 2);
+                sSubStr = sSubStr.Replace("\\", "");
+                sSubStr = sSubStr.Replace("\n", "");
+                sSubStr = "[" + sSubStr.ToString() + "]";
+                List<Model.ClsSc_MouldStockBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(sSubStr);
                 int i = 0;
                 foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls)
                 {
-
                     i++;
                     oItemSub.HEntryID = i;
-
-                    //oItemSub.HRepairCheckID = 0;   //楠屾敹椤圭洰ID
-                    //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭
-                    //oItemSub.HManagerID = 0;   //璐熻矗浜篒D
-                    //oItemSub.HCloseMan = "";       //琛屽叧闂�
-                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
-                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
-                    //oItemSub.HRemark = "";         //澶囨敞
-                    oItemSub.HSourceInterID = 0;     // 婧愬崟涓诲唴鐮�
-                    oItemSub.HSourceEntryID = 0;   //婧愬崟瀛愬唴鐮�
-                    //oItemSub.HSourceBillNo = "";  //婧愬崟鍗曞彿
-                    //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
-                    //oItemSub.HRelationQty = 0;     //鍏宠仈鏁伴噺
-                    //oItemSub.HRelationMoney = 0;   //鍏宠仈閲戦 
-                    //oItemSub.HRepairID = 0;       //缁翠慨椤圭洰
-                    //oItemSub.HRepairExplanation ="";   //缁翠慨瑕佹眰
-                    //oItemSub.HMoney = 0;        //缁翠慨璐圭敤
                     oBill.DetailColl.Add(oItemSub);
-
                 }
-                //淇濆瓨
-                //淇濆瓨瀹屾瘯鍚庡鐞�
+
+                string sErrMsg = "";
                 bool bResult;
-                if (oBill.omodel.HInterID == 0)
+                //鑾峰彇绯荤粺鍙傛暟
+                if (oSystemParameter.ShowBill(ref sErrMsg) == true)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
-                    oCn.RunProc(sql);
+                    //淇濆瓨
+                    if (oBill.omodel.HInterID == 0)   //鏂板淇濆瓨
+                    {
+                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus  'out','{oBill.omodel.HInterID.ToString()}' ");
+                            oCn.RunProc(sql);
+                        }
+                    }
+                    else                        //缂栬緫淇濆瓨
+                    {
+                        bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
+                        {
+                            //淇敼鍣ㄥ叿妗f浣嶇疆
+                            string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
+                            oCn.RunProc(sql);
+                        }
+                    }
                 }
                 else
                 {
-                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
-                    //淇敼鎴愬姛
-                    //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID  1,{oBill.omodel.HInterID.ToString()},' ' ");
-                    string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID ");
-                    oCn.RunProc(sql);
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                    objJsonResult.data = null;
+                    return objJsonResult;
                 }
+
                 if (bResult)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
-                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
-                    objJsonResult.data = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
                 else
@@ -8624,7 +9245,7 @@
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = 1;
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
             }
@@ -8632,8 +9253,8 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
-                objJsonResult.data = 1;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
+                objJsonResult.data = null;
                 return objJsonResult;
             }
         }

--
Gitblit v1.9.1