From c31694b857f388ed6fd973d9e5146fb4c803ef38 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 09 三月 2026 01:44:59 +0800
Subject: [PATCH] 投料防错

---
 WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs |   84 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 77 insertions(+), 7 deletions(-)

diff --git a/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs
index bbe2115..b1bec67 100644
--- a/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs
+++ b/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs
@@ -29,7 +29,8 @@
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
         public DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill();
-
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         #region 鍣ㄥ叿棰嗙敤鍑哄簱鍗曞垎椤靛垪琛�
         [Route("Sc_MouldProdOutBillController/page")]
@@ -335,6 +336,55 @@
         }
         #endregion
 
+
+        #region 鍣ㄥ叿棰嗙敤鍑哄簱鍗� - 鎵樻暟鍙樻洿鍔熻兘
+        [Route("Sc_MouldProdOutBill/UpdatePallet")]
+        [HttpPost]
+    
+        public object UpdatePallet([FromBody] JObject data)
+        {
+            try
+            {
+                long hmainid = data["hmainid"]?.ToObject<long>() ?? 0;
+                int newPallet = data["newPallet"]?.ToObject<int>() ?? 0;
+                string operatorName = data["operator"]?.ToString() ?? "";
+
+                if (hmainid <= 0)
+                    return new { code = "0", count = 0, Message = "鍗曟嵁ID涓嶈兘涓虹┖锛�" };
+
+                if (newPallet <= 0)
+                    return new { code = "0", count = 0, Message = "鎵樻暟蹇呴』澶т簬0锛�" };
+
+
+     
+
+                // 鐩存帴鏇存柊鎵樻暟
+                string updateSql = $@"
+                    UPDATE Sc_MouldStockBillMain 
+                    SET HPackQtys = {newPallet} 
+                    WHERE HInterID = {hmainid}";
+
+                oCn.RunProc(updateSql);
+
+                return new
+                {
+                    code = "1",
+                    count = 1,
+                    Message = "鎵樻暟淇敼鎴愬姛锛�"
+                };
+            }
+            catch (Exception e)
+            {
+                return new
+                {
+                    code = "0",
+                    count = 0,
+                    Message = "淇敼澶辫触锛�" + e.Message
+                };
+            }
+        }
+        #endregion
+
         #region 鍣ㄥ叿棰嗙敤鍑哄簱鍗� 鎵归噺瀹℃牳
         /// <summary>
         /// 鎵归噺瀹℃牳/鍙嶅鏍稿櫒鍏烽鐢ㄥ嚭搴撳崟
@@ -604,14 +654,14 @@
         }
         #endregion
 
-        #region 鍣ㄥ叿棰嗙敤鍑哄簱鍗曟ā鍧�   浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
+        #region 鍣ㄥ叿鍑哄叆搴撳崟妯″潡   浠庡垪琛ㄩ�変腑鎵撳紑鍗曟嵁锛岃繑鍥炲崟鎹俊鎭椂璋冪敤
         /// <summary>
-        /// 鍣ㄥ叿棰嗙敤鍑哄簱鍗曠紪杈戞椂锛屾牴鎹崟鎹甀D鑾峰彇鍗曟嵁淇℃伅
+        ///鍣ㄥ叿鍑哄叆搴撳崟缂栬緫鏃讹紝鏍规嵁鍗曟嵁ID鑾峰彇鍗曟嵁淇℃伅
         /// </summary>
         /// <returns></returns>
-        [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Json")]
+        [Route("Sc_MouldStockBillController/GetSc_MouldStockBill_Json")]
         [HttpGet]
-        public object GetSc_MouldProdOutBill_Json(Int64 HInterID, string HMaker)
+        public object GetSc_MouldStockBill_Json(Int64 HInterID, string HMaker)
         {
             List<object> list = new List<object>();
             try
@@ -632,7 +682,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ櫒鍏烽鐢ㄥ嚭搴撳崟锛岃鍒锋柊鏁版嵁鍚庨噸鏂伴�夋嫨锛�";
+                    objJsonResult.Message = "鏈煡璇㈠埌璇ュ櫒鍏峰嚭鍏ュ簱鍗曪紝璇峰埛鏂版暟鎹悗閲嶆柊閫夋嫨锛�";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
@@ -651,7 +701,7 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "杩斿洖鍣ㄥ叿棰嗙敤鍑哄簱鍗曚俊鎭け璐ワ紒" + e.ToString();
+                objJsonResult.Message = "杩斿洖鍣ㄥ叿鍑哄叆搴撳崟淇℃伅澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -764,6 +814,26 @@
 
                 if (bResult)
                 {
+                    string sReturn = "";
+                    // 鍗庤垷 淇濆瓨鎴愬姛鍚庝笅鎺ㄥ伐浣滆仈绯诲崟 
+                    if (oSystemParameter.ShowBill(ref sReturn) == true)
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鍗庤垷")
+                        {
+                            //鑷姩鐢熸垚宸ヤ綔鑱旂郴鍗�
+                            var ds2 = oCn.RunProcReturn("exec h_p_OA_WorkLinkBill_Create " + oBill.omodel.HInterID + "," + 3802, "h_p_OA_WorkLinkBill_Create");
+
+                            if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
+                            {
+                                int HInterID = int.Parse(ds2.Tables[0].Rows[0]["NewHInterID"].ToString());
+                                LogService.Write("鎵ц娑堟伅鎺ㄩ��..." + HInterID);
+
+                                // 瑙﹀彂娑堟伅鎺ㄩ��
+                                Service.GeTuiService.PubishSingle(HInterID);
+                            }
+                        }
+                    }
+
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //鎴愬姛锛�

--
Gitblit v1.9.1