From f90bc93b0b72f02b7931784ac0f05d92c428cd73 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期三, 14 一月 2026 10:21:05 +0800
Subject: [PATCH] 小卫条码规则变更

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |   68 +++++++++++----------------------
 1 files changed, 23 insertions(+), 45 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 89500ec..0cc67c0 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"
@@ -3389,6 +3389,7 @@
                 string HSelectBarCodeType = "鎵樼洏鏉$爜";
                 string CampanyName = "灏忓崼";
                 string UserName = sArray[2].ToString();//鐢ㄦ埛
+                string barCode_middle = sArray[3].ToString();//涓鐮�
                 ClsPub.CurUserName = UserName;
 
                 //鑾峰彇鍐呯爜
@@ -3418,7 +3419,7 @@
                 else
                 {
                     //鐢熸垚鏉$爜
-                    SaveBarCode_xiaowei(msg2, HSelectBarCodeType, CampanyName, HSourceBillTypeName);
+                    SaveBarCode_xiaowei(msg2, HSelectBarCodeType, CampanyName, HSourceBillTypeName, barCode_middle);
                 }
             }
             catch (Exception e)
@@ -3433,7 +3434,7 @@
         #endregion        
 
         #region[鏉$爜鐢熸垚鏂规硶_xiaowei]
-        private object SaveBarCode_xiaowei(string msg2, string HSelectBarCodeType, string CampanyName, string HSourceBillTypeName)
+        private object SaveBarCode_xiaowei(string msg2, string HSelectBarCodeType, string CampanyName, string HSourceBillTypeName,string barCode_middle)
         {
             DateTime sDate = DateTime.Now;                      //鏃ユ湡
             string HSourceBillType_Temp = "";                   //婧愬崟绫诲瀷
@@ -3470,54 +3471,31 @@
                             string sTMNumber = "";                                                      //鏉$爜鍓嶇紑
                             string LSH = "";                                                            //鏈�澶ф祦姘村彿
                             int HLen = 6;                                                            //娴佹按鍙烽暱搴�
-
+                            
                             //鏉$爜鎷兼帴鎵�闇�瀛楁
                             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());
-                            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() == "")
-                            {
-                                objJsonResult.code = "0";
-                                objJsonResult.count = 0;
-                                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;
-                            }
-
+                            
+                            DataSet dds= oCN.RunProcReturn("exec h_p_rule_BarCodePack_xiaowei "+ ordrlist.HMaterID+",'"+ barCode_middle+"'", "h_p_rule_BarCodePack_xiaowei");
                             //todo
+                            if (dds.Tables[0].Rows[0]["HBack"]=="1")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鐢熸垚鏉$爜澶辫触锛�" + dds.Tables[0].Rows[0]["HRemark"].ToString();
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else if(dds == null || dds.Tables[0].Rows.Count <= 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鐢熸垚鏉$爜澶辫触锛屾湭鎵惧埌鏉$爜锛�" ;
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
                             //鏉$爜鍓嶇紑 = p+鍟嗗搧SKU+鐢熶骇骞翠唤+鐢熶骇鏈堜唤+6浣嶆祦姘村彿+鐢熶骇宸ュ巶浠g爜
-                            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 + "A" + LSH + "AHW";
-
+                            HBarCode_Temp = dds.Tables[0].Rows[0]["HRemark"].ToString();
 
                             if (HSumQty - HMinQty > 0)
                             {

--
Gitblit v1.9.1