From 981ea6f779477b4b729c6796cfc42ee933c781b0 Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期二, 17 三月 2026 18:43:09 +0800
Subject: [PATCH] 优化自动产生工作联系单方法

---
 WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldProdOutBillController.cs
index 9e86f3a..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")]
@@ -355,26 +356,7 @@
                     return new { code = "0", count = 0, Message = "鎵樻暟蹇呴』澶т簬0锛�" };
 
 
-                string checkAuditSql = $@"
-                    SELECT HBillStatus 
-                    FROM Sc_MouldStockBillMain
-                    WHERE HInterID = {hmainid}";
-
-                DataSet dsAudit = oCn.RunProcReturn(checkAuditSql, "CheckAudit");
-
-                if (dsAudit != null && dsAudit.Tables[0].Rows.Count > 0)
-                {
-                    int hBillStatus = Convert.ToInt32(dsAudit.Tables[0].Rows[0]["HBillStatus"]);
-              
-                    if (hBillStatus == 2)
-                    {
-                        return new { code = "0", count = 0, Message = "鍗曟嵁宸插鏍革紝涓嶈兘淇敼鎵樻暟锛�" };
-                    }
-                }
-                else
-                {
-                    return new { code = "0", count = 0, Message = "鍗曟嵁涓嶅瓨鍦紒" };
-                }
+     
 
                 // 鐩存帴鏇存柊鎵樻暟
                 string updateSql = $@"
@@ -832,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