From f989e2e3dfb3866b5d9fe271f69c728eb5be242d Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期六, 13 九月 2025 14:58:48 +0800
Subject: [PATCH] 条码生成添加工号,条码日期,流水号获取方式调整;

---
 WebAPI/Controllers/MaterialHandingController.cs         |    4 ++--
 WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs         |    2 ++
 WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs |   18 +++++++++++-------
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/WebAPI/Controllers/MaterialHandingController.cs b/WebAPI/Controllers/MaterialHandingController.cs
index 154228d..c51e3cc 100644
--- a/WebAPI/Controllers/MaterialHandingController.cs
+++ b/WebAPI/Controllers/MaterialHandingController.cs
@@ -273,12 +273,12 @@
         #region 鐗╂枡鏍¢獙
         [Route("MaterialHandingController/CheckMaterial")]
         [HttpGet]
-        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID)
+        public object CheckMaterial(string HMaterID, string user, int param,string OrganizationID,string SupID)
         {
             try
             {
                 //ds1鑾峰彇鐨剆ql鍚庢湡璁板緱鏀瑰洖渚涘簲鍟嗭紝淇敼浜�->渚涘簲鍟�
-                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 鐗╂枡浠g爜='" + HMaterID + "'" + "and 鍒涘缓浜�='" + user + "'", "h_v_Gy_UserMaterRelationEdit");
+                var ds1 = oCN.RunProcReturn("select * from h_v_Gy_UserMaterRelationEdit where 鐗╂枡浠g爜='" + HMaterID + "'" + "and 渚涘簲鍟嗕唬鐮�='" + SupID + "'", "h_v_Gy_UserMaterRelationEdit");
                 var ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterID+ "'"+ " and HUSEORGID="+"'"+ OrganizationID+"'", "Gy_Material");
                 if(ds.Tables[0].Rows.Count == 0)
                 {
diff --git a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
index d4af355..f9a7003 100644
--- a/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
+++ b/WebAPI/Controllers/SRM_MaterialBarCodeBillController.cs
@@ -137,8 +137,12 @@
                 string HKFDate= ls[0].HKFDQDate==null? DateTime.Now.ToString("yyyy/MM/dd"): ls[0].HKFDQDate;//鐢熶骇鏃ユ湡
                 string HKFDate_1 = string.Join("", HKFDate.Split('/').Select(x => x.PadLeft(2, '0')));
                 double HMinQty= ls[0].HMinQty;//鏍囧噯鍖呰鏁�
+                string HStatusMan = ls[0].HStatusMan;//宸ュ彿
+                //string HBarCodeDate = ls[0].HBarCodeDate;//宸ュ彿
+                string HBarCodeDate = ls[0].HBarCodeDate == null ? DateTime.Now.ToString("yyyy/MM/dd") : ls[0].HBarCodeDate;//鏉$爜鏃ユ湡
+                string HBarCodeDate_1 = string.Join("", HBarCodeDate.Split('-').Select(x => x.PadLeft(2, '0')));
 
-                double HBQty= ls[0].HBQty;//鏈�灏忓寘瑁呮暟
+                double HBQty = ls[0].HBQty;//鏈�灏忓寘瑁呮暟
                 long HISKFPERIOD= ls[0].HISKFPERIOD;//鏄惁鍚敤淇濊川鏈�
                 long HBatchManager= ls[0].HBatchManager;//鏄惁鍚敤鎵瑰彿
 
@@ -161,7 +165,7 @@
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 oCn.BeginTran();
                 //Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
-                Ds = oCn.RunProcReturn("exec GetLSH '" + HSupID+"_"+ HMaterID+"_" + DateTime.Today+ "'", "GetLSH");
+                Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HSupID+"_"+ HMaterID+"_" + HBarCodeDate + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 #endregion
 
@@ -209,7 +213,7 @@
                               : HMinQty;
                             ///渚涘簲鍟嗗悕绉�+@+鐗╂枡浠g爜+@+鐗╂枡绠�绉�+@+鏁伴噺+@鏉$爜鏁�+@+鏃ユ湡+@+娴佹按鍙�  
                             LSH += 1;
-                            TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HKFDate_1}@{LSH}";
+                            TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{currentQty}@{HBarCodeDate_1}@{LSH}";
                             //TM = $"{oItemSub.HSupName}@{oItemSub.HMaterID}@{oItemSub.HMaterName}@{oItemSub.biaoqianzhangshu}@{HKFDate_1}@{LSH}";
                             // 娣诲姞鍒扮敓鎴愮殑鏉$爜鍒楄〃
                             generatedBarcodes.Add(TM);
@@ -239,15 +243,15 @@
                             //               + 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) " +
+       "HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HMTONO, HProduceDate, HExpiryDate, HISKFPERIOD,HStatusMan,HBarCodeDate,HinitQty) " +
       "VALUES (" +
        linterid.ToString() + ", '" + TM + "', '" + HBarCodeType + "', " + HMaterID + ", " + "0" + ", " + currentQty + ", '" + HKFDate + "', " + HKFPeriod + ", '" + HKFDQDate + "', " +
        "'" + HBatchNo + "', " + get_BarCodecount + ", '" + virtualCount + "', " + HSupID + ", " + "0" + ", '" + ClsPub.CurUserName + "', '" + DateTime.Today.ToString("yyyy-MM-dd") + "', " + "1" + ", " + "0" + ", 1, " +
        "1, 1, '1', '" + HSourceBillType + "', '1', '" +
-       HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ")";
+       HKFDate + "', '" + HKFDQDate + "', " + HISKFPERIOD + ",'" + HStatusMan + "','" + HBarCodeDate + "','" + currentQty + "'" + ")";
                             LogService.Write("鐢熸垚鏉$爜锛� " + sql);
                             oCn.RunProc(sql); 
-                            oCn.RunProc("exec setLSH '" + HSupID + "_" + HMaterID + "_" + DateTime.Today + "'");
+                            oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HSupID + "_" + HMaterID + "_" + HBarCodeDate + "'");
                             virtualCount++;
                            }
 
@@ -352,7 +356,7 @@
                 }
 
                 string inClause = string.Join(",", inValues);
-                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})";
+                string sql = $"SELECT * FROM h_v_Gy_UserMaterRelationPrint WHERE HBarCode IN ({inClause})" + " order by 鐗╂枡浠g爜,cast(娴佹按鍙� as int)";
 
                 // 鐩存帴鎵цSQL鏌ヨ
                 DataSet ds = oCn.RunProcReturn(sql, "h_v_Gy_UserMaterRelationPrint");
diff --git a/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs b/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
index 249ad80..5713504 100644
--- a/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
+++ b/WebAPI/Models/ClsGy_MaterialBarCodeBillModel.cs
@@ -50,6 +50,8 @@
         public string HBarCodeType;
         public long HGroupID;
         public string HRemark;
+        public string HStatusMan; //鎯犲悍宸ュ彿
+        public string HBarCodeDate; //鏉$爜鏃ユ湡       
         // public ClsGy_MaterialBarCodeBillModel();
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1