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/SCGL/Sc_MESTransFerWorkBillController.cs |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
index 1eba259..055cb7f 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -907,6 +907,7 @@
                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                     oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                     oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    oItem.HBarCode = DBUtility.ClsPub.isStrNull(oItem.HBarCode);
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                     {
                         objJsonResult.code = "0";
@@ -7409,7 +7410,6 @@
                 }
                 if (bResult)
                 {
-
                     objJsonResult.code = "0";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
@@ -7464,6 +7464,7 @@
                 {
                     string sql1 = "select * from h_v_OA_WorkLinkBillAllList where 1 = 1 ";
                     string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+
                     ds = oCN.RunProcReturn(sql, "h_v_OA_WorkLinkBillAllList");
                 }
 
@@ -8694,10 +8695,23 @@
         {
             try
             {
+                string sql = "";
                 List<object> columnNameList = new List<object>();
 
-                string sql = "select a.HSourceBillNo 娴佽浆鍗″彿,a.HSourceBillType 娴佽浆鍗$被鍨�,a.HSourceInterID 娴佽浆鍗′富鍐呯爜,a.HSourceEntryID 娴佽浆鍗″瓙鍐呯爜,b.HNumber 鐗╂枡浠g爜,b.HName 鐗╂枡鍚嶇О,b.HModel 瑙勬牸鍨嬪彿,a.HDatePlanQty 璁″垝鏁伴噺,a.HSourceID,c.HName 鐢熶骇璧勬簮 from Sc_ICMOBillStatus_Tmp a " +
+                if (!string.IsNullOrEmpty(HSourceBill) && HSourceBill.Substring(0, 6) == "GXCZHB")
+                {
+                    HSourceBill = HSourceBill.Split('-')[0];
+                    //鍗庤垷鍋氭湯浠跺彂璧峰畨鐏殑鏃跺�� 浼犺繃鏉ョ殑鏄嚭绔欏崟鐨勫崟鎹彿
+                    sql = @"select a.HProcExchInterID 娴佽浆鍗′富鍐呯爜,a.HProcExchEntryID 娴佽浆鍗″瓙鍐呯爜,a.HProcExchBillNo 娴佽浆鍗″彿,a.HSourceID,b.HName 鐢熶骇璧勬簮, c.HNumber 鐗╂枡浠g爜, c.HName 鐗╂枡鍚嶇О, c.HModel 瑙勬牸鍨嬪彿, a.HPlanQty 璁″垝鏁伴噺
+                            from Sc_StationOutBillMain a  left  join Gy_Source b on a.HSourceID = b.HItemID  left  join Gy_Material c on a.HMaterID = c.HItemID  where a.HBillNo = '" + HSourceBill + "'";
+                }
+                else
+                {
+                    //鎶ュ伐鍙颁紶杩囨潵鐨勬槸娴佽浆鍗$殑
+                    sql = "select a.HSourceBillNo 娴佽浆鍗″彿,a.HSourceBillType 娴佽浆鍗$被鍨�,a.HSourceInterID 娴佽浆鍗′富鍐呯爜,a.HSourceEntryID 娴佽浆鍗″瓙鍐呯爜,b.HNumber 鐗╂枡浠g爜,b.HName 鐗╂枡鍚嶇О,b.HModel 瑙勬牸鍨嬪彿,a.HDatePlanQty 璁″垝鏁伴噺,a.HSourceID,c.HName 鐢熶骇璧勬簮 from Sc_ICMOBillStatus_Tmp a " +
                     "left join Gy_Material b on a.HMaterID=b.HItemID  left join Gy_Source c on a.HSourceID=c.HItemID where HSourceBillNo='" + HSourceBill + "' and a.HICMOStatus=1";
+                }
+                 
                 ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp");
                 if (ds.Tables[0].Rows.Count == 0)
                 {

--
Gitblit v1.9.1