From f5fc1dfd2ba1ea9d9ad30854e1a526401d0b8e0e Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 13 一月 2026 09:39:52 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/Sc_MouldRepairInBillListController.cs |  155 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 142 insertions(+), 13 deletions(-)

diff --git a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
index 871fe78..7ecb3d4 100644
--- a/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
+++ b/WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -10381,13 +10381,14 @@
                     return objJsonResult;
                 }
 
-                sWhere = sWhere.Replace("'", "''");
+                
                 if (sWhere == null || sWhere.Equals(""))
                 {
                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldScrapOutHouseBillList " + page + "," + size + ",''", "h_p_Sc_MouldScrapOutHouseBillList");
                 }
                 else
-                {
+                {   
+                    sWhere = sWhere.Replace("'", "''");
                     ds = oCN.RunProcReturn("exec h_p_Sc_MouldScrapOutHouseBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldScrapOutHouseBillList");
                 }
 
@@ -10651,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);
@@ -10663,6 +10664,7 @@
                 //缂栬緫鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Edit", 1, false, HMaker))
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏂板/缂栬緫鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒";
@@ -10687,6 +10689,7 @@
                     //鍗曟嵁鍙锋槸鍚﹂噸澶�
                     if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID))
                     {
+                        oCn.RollBack();
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
                         objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
@@ -10699,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;
@@ -10734,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 == "鍥涚淮灏�") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�     绌虹櫧涓洪�氱敤
                         {
@@ -10757,6 +10785,7 @@
                 }
                 else
                 {
+                    oCn.RollBack();
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
                     objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
@@ -10766,14 +10795,18 @@
 
                 if (bResult)
                 {
-                    objJsonResult.code = "0";
+                    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;
@@ -10783,6 +10816,7 @@
             }
             catch (Exception e)
             {
+                oCn.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.Message;
@@ -10790,6 +10824,63 @@
                 return objJsonResult;
             }
         }
+
+        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);
+            string sMainStr = sArray[0].ToString();         //涓昏〃鏁版嵁
+            string sSubStr = sArray[1].ToString();          //瀛愯〃鏁版嵁
+            string HMaker = sArray[2].ToString();           //鍒跺崟浜�
+            try
+            {
+                //List<Model.ClsKf_OtherOutBillMain> lsmain = new List<Model.ClsKf_OtherOutBillMain>();
+                ListModels oListModels = new ListModels();
+                sMainStr = sMainStr.Replace("\\", "");
+                sMainStr = sMainStr.Replace("\n", "");
+                sMainStr = "[" + sMainStr.ToString() + "]";
+                //lsmain = oListModels.getOtherOutBillMainByJson(sMainStr);
+                List<Model.ClsSc_MouldStockBillMain> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(sMainStr);
+                //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 = HInterID;
+                websLsmain.HDate = lsmain[0].HDate;
+                websLsmain.HBillNo = lsmain[0].HBillNo;
+                websLsmain.HSupID = lsmain[0].HSupID;
+                websLsmain.HDeptID = lsmain[0].HDeptID;
+                websLsmain.HEmpID = lsmain[0].HKeeperID;
+                websLsmain.HKeeperID = lsmain[0].HKeeperID;
+                websLsmain.HSecManagerID = lsmain[0].HSecManagerID;
+                websLsmain.HRemark = lsmain[0].HRemark??"test";
+                websLsmain.HMaker = lsmain[0].HMaker;
+                websLsmain.HBillerID = 0;
+                websLsmain.HSTOCKORGID = 100038;
+                websLsmain.HOWNERID = 100038;
+                websLsmain.HBillType = "1206";//鍥哄畾鍊�
+                websLsmain.HBillSubType = "test";
+                WebS.WebService1 oWebs = new WebS.WebService1();
+                WebS.ClsXt_SystemParameterMain oSystemParameterMain = new WebS.ClsXt_SystemParameterMain();
+                if (oWebs.set_SaveOtherOutBill_New_haicheng(websLsmain, sSourceBillType, ref DBUtility.ClsPub.sErrInfo))
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+
+            }
+            catch (Exception e)
+            {
+                DBUtility.ClsPub.sErrInfo = "涓婁紶澶辫触锛�" + e.ToString();
+                return false;
+            }
+        }
+
         #endregion
 
         #region [妯″叿澶勭悊鍑哄簱鍗曞垹闄ゅ姛鑳絔
@@ -15653,12 +15744,23 @@
         [HttpPost]
         public object UploadFile_Gy_QCVerification()
         {
-
+            string path = "";
             string HBillNo = HttpContext.Current.Request.Params["HBillNo"];  //鍗曟嵁鍙�
             string HRemark = HttpContext.Current.Request.Params["HRemark"];  //澶囨敞
             string HUserName = HttpContext.Current.Request.Params["HUserName"];  //鍒涘缓浜�
-            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
-            string path = HttpContext.Current.Server.MapPath("~/../Files/Gy_QCVerification/" + HBillNo);
+            HttpPostedFile files = HttpContext.Current.Request.Files["file"];            
+            string Ret = "";
+            if (oSystemParameter.ShowBill(ref Ret))
+            {
+                if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒")
+                {
+                    path = "D:/缃戠珯鍙戝竷/LAYUI/Files/Gy_QCVerification/" + HBillNo;
+                }
+                else
+                {
+                    path = HttpContext.Current.Server.MapPath("~/../Files/Gy_QCVerification/" + HBillNo);
+                }
+            }
             dynamic dyResult = UploadFile_Gy_QCVerification(files, path, HBillNo, HRemark, HUserName);
             if (dyResult != null && dyResult.result == 1)
             {
@@ -15713,7 +15815,20 @@
                 {
                     File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
                     files.SaveAs(fileurl);
-                    string StrPath = "/files/Gy_QCVerification/" + HBillNo + "/" + filename;
+                    string StrPath = "";
+
+                    string Ret = "";
+                    if (oSystemParameter.ShowBill(ref Ret))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒")
+                        {
+                            StrPath = "D:/缃戠珯鍙戝竷/LAYUI/Files/Gy_QCVerification/" + HBillNo + "/" + filename;
+                        }
+                        else
+                        {
+                            StrPath = "/files/Gy_QCVerification/" + HBillNo + "/" + filename;
+                        }
+                    }
                     if (File.Exists(fileurl))
                     {
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -15773,8 +15888,19 @@
         [HttpGet]
         public object Gy_QCVerification_Filelist(string HBillNo)
         {
-            var url = fileip + "/Files/Gy_QCVerification/" + HBillNo + "/";
-
+            string Ret = "";
+            var url = "";
+            if (oSystemParameter.ShowBill(ref Ret))
+            {
+                if (oSystemParameter.omodel.WMS_CampanyName == "鍑礉濂堢壒")
+                {
+                    url = "D:/缃戠珯鍙戝竷/LAYUI/Files/Gy_QCVerification/" + HBillNo + "/";
+                }
+                else
+                {
+                    url = fileip + "/Files/Gy_QCVerification/" + HBillNo + "/";
+                }
+            }
             try
             {
                 ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url  from MES_AccessoriesList where HSourceBillNo='" + HBillNo + "'", "MES_AccessoriesList");
@@ -15808,8 +15934,7 @@
             {
 
                 oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
-                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Gy_QCVerification/" + HSourceBillNo), HFileName);
-                File.Delete(fileurl);      //鍒犻櫎鎸囧畾鏂囦欢
+       
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
@@ -15825,7 +15950,11 @@
                 return objJsonResult;
             }
         }
+
+
         #endregion
+
+
         #endregion
 
 

--
Gitblit v1.9.1