From 7bd73b5076dd3256e7c28187016e4b5c73d08e2c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期二, 21 十月 2025 09:31:02 +0800
Subject: [PATCH] excel导入送货信息;条码保存时生产日期、有效期调整

---
 WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
index e75a97c..ec627f1 100644
--- a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
+++ b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -97,6 +97,7 @@
             string UserName = sArray[2].ToString();
             string OrganizationID = sArray[3].ToString();
             ListModels oListModels = new ListModels();
+            string error = "";
             try
             {
                 #region 鑾峰彇鐢ㄦ埛浠ュ強鐩稿叧鍙傛暟
@@ -226,7 +227,7 @@
                             TM = $"{oItemSub.HSupName}@{oItemSub.HMaterNumber}@{oItemSub.HSubjoin}@{currentQty}@{HBarCodeDate_1}@{LSH.ToString("D7")}";
                             //TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}";
                             // 娣诲姞鍒扮敓鎴愮殑鏉$爜鍒楄〃
-                            generatedBarcodes.Add(TM);
+                            //generatedBarcodes.Add(TM);
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
 
                            // var HBarCode_verify = TM.Split('@'); //鏍¢獙鏉$爜淇℃伅
@@ -253,14 +254,19 @@
                             //               + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                             sql = "INSERT INTO Gy_BarCodeBill (HInterID, HBarCode, HBarCodeType, HMaterID, HUnitID, HQty, HKFDate, HKFPeriod, HKFDQDate, " +
        "HBatchNo, HBarcodeQtys, HBarcodeNo, HSupID, HGroupID, HMaker, HMakeDate, HPrintQty, HEndQty, HSupflag, " +
-       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty,HSTOCKORGID,HOWNERID) " +
+       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty,HSTOCKORGID,HOWNERID) " +
       "VALUES (" +
-       linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + null + "', " + HKFPeriod + ", '" + null + "', " +
-       "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + UserName + "',getdate()" + "," + "0" + ", " + "0" + ", 1, " +
-       "0, 0, '', '" + HSourceBillType + "', '', '" +
-       null + "', '" + null + "', " + HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'," + OrganizationID + "," + OrganizationID + "," + null + ")";
+       linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + null + "', " + HKFPeriod + ", '" + null + "', '" 
+       + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + UserName + "',getdate()" + "," + "0" + ", " + "0" + ", 1, " +
+       "0, 0, '', '" + HSourceBillType + "', ''," +
+      HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'," + OrganizationID + "," + OrganizationID  + ")";
                             LogService.Write("鐢熸垚鏉$爜锛� " + sql);
-                            oCn.RunProc(sql); 
+                            oCn.RunProc(sql);
+
+                            DataSet getID = oCn.RunProcReturn("select HitemID from Gy_BarCodeBill with(nolock) where HBarCode='" + TM + "'", "Gy_BarCodeBill");
+                            var getBarCodeID = (getID.Tables[0].Rows[0]["HitemID"]).ToString();
+                            generatedBarcodes.Add(getBarCodeID);
+
                             oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HSupID + "_" + HMaterID + "_" + HBarCodeDate + "'");
                             virtualCount++;
                            }
@@ -366,7 +372,8 @@
                 }
 
                 string inClause = string.Join(",", inValues);
-                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})" + " order by 鐗╂枡浠g爜,cast(娴佹按鍙� as int)";
+
+                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarItemID IN ({inClause})" + " order by 鐗╂枡浠g爜,cast(娴佹按鍙� as int)";
 
                 // 鐩存帴鎵цSQL鏌ヨ
                 DataSet ds = oCn.RunProcReturn(sql, "h_v_Gy_UserMaterRelationPrint");

--
Gitblit v1.9.1