From 07f7a5d24069fe75bfd350916e151a2ecc644b52 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期日, 04 一月 2026 18:24:06 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs" "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
index b818d4d..228f7c8 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
@@ -3100,6 +3100,7 @@
             List<HBarCodeList> ListRows = new List<HBarCodeList>();
 
             DataSet Ds;
+            DataSet Ds2;
             for (int i = 0; i < 1; i++)
             {
                 HSourceBillType_Temp = ordrlist.HBillType;
@@ -3126,7 +3127,13 @@
                             string HMaterialName = DBUtility.ClsPub.isStrNull(ordrlist.HMaterName);
                             string HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist.HSupNumber).Replace(".", "");             //渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級
                             int lastDigit = int.Parse(DateTime.Today.Year.ToString().Last().ToString());
-                            char productionMonth = DateTime.Today.Month <= 9
+                            int currentMonth = DateTime.Now.Month;
+                            char[] monthToLetter = {
+                            'N', 'P', 'Q', 'R', 'S', 'T',
+                            'U', 'V', 'W', 'X', 'Y', 'Z'
+                                                };
+                            char productionMonth = monthToLetter[currentMonth - 1];
+                            char productionDay = DateTime.Today.Month <= 9
                             ? (char)(DateTime.Today.Month + '0')
                             : (char)('A' + DateTime.Today.Month - 10);
                             if (HMaterialName.Trim() == "")
@@ -3136,16 +3143,32 @@
                                 objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖锛屼笉鑳界敓鎴愭潯鐮侊紒";
                                 return objJsonResult;
                             }
+
+                            Ds2 = oCN.RunProcReturn("select top 1 HCusRelationNumber from Gy_Material m with(nolock) left join Gy_MateNumRelation_Sec b with(nolock) on m.HMASTERID = b.HMaterID where m.HItemID = " + ordrlist.HMaterID, "Gy_MateNumRelation_Sec");
+
+                            string HSKU = "";//鍟嗗搧SKU
+                            if (Ds2.Tables[0].Rows.Count > 0)
+                            {
+                                HSKU = Ds2.Tables[0].Rows[0]["HCusRelationNumber"].ToString();
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "娌℃湁鍖归厤鍒板搴旂殑鍟嗗搧SKU!";
+                                return objJsonResult;
+                            }
+
                             //todo
                             //鏉$爜鍓嶇紑 = p+鍟嗗搧SKU+鐢熶骇骞翠唤+鐢熶骇鏈堜唤+6浣嶆祦姘村彿+鐢熶骇宸ュ巶浠g爜
-                            sTMNumber = "P" + HMaterialName + lastDigit+ productionMonth;
+                            sTMNumber = "P" + HSKU + lastDigit+ productionMonth;
 
                             //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");
                             LSH = String.Format("{0:D" + HLen + "}", ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1);
 
                             //鎷兼帴鏉$爜
-                            HBarCode_Temp = sTMNumber + LSH+"XXX";
+                            HBarCode_Temp = sTMNumber + "A" + LSH + "AHW";
 
 
                             if (HSumQty - HMinQty > 0)

--
Gitblit v1.9.1