From 409529b1a6e7478d691e95f84713bdd5ad5ffed2 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 05 八月 2025 19:05:14 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |   66 +++++++++++++++++++++++++-------
 1 files changed, 51 insertions(+), 15 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 cd7a5aa..d7abb7d 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"
@@ -132,6 +132,10 @@
                     list.Add("鍞竴鏉$爜");
                     list.Add("鎵规鏉$爜");
                 }
+                else if (sCapName == "娴疯瘹")
+                {
+                    list.Add("鍝佺鏉$爜");
+                }
                 else
                 {
                     list.Add("鍞竴鏉$爜");
@@ -589,6 +593,10 @@
                             ordrlist.HGiveAwayFlag = 0;
                         }
                     }
+                    if (HSourceBillType == "閲囪喘璁㈠崟")
+                    {
+                        ordrlist.HSourceBillSEQ = dt.Rows[i]["HSEQ"].ToString();
+                    }
                 }
                 if (HSourceBillType == "閫�璐ч�氱煡鍗�")
                 {
@@ -801,12 +809,13 @@
                 long HMaterID = DBUtility.ClsPub.isLong(ordrlist[i].HMaterID);              // 鐗╂枡鍐呯爜
                 string HBatchNo = DBUtility.ClsPub.isStrNull(ordrlist[i].HBatchNo);         // 鎵瑰彿
                 long HAuxPropID = DBUtility.ClsPub.isLong(ordrlist[i].HAuxPropID);          // 杈呭姪灞炴�D
+                string HMTONo = DBUtility.ClsPub.isStrNull(ordrlist[i].HMTONo);             // 璁″垝璺熻釜鍙�
                 double HSourceQty = DBUtility.ClsPub.isDoule(ordrlist[i].HMinQty);          // 婧愬崟鏁伴噺
                 double HQty = DBUtility.ClsPub.isDoule(ordrlist[i].HQty);                   // 鏁伴噺
                 double HMinQty = DBUtility.ClsPub.isDoule(ordrlist[i].HMinQty);             // 鏈�灏忓寘瑁呮暟
                 if (HMaterID != 0)
                 {
-                    DataSet oDsCheck = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + "," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck");
+                    DataSet oDsCheck = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck_New " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck_New");
                     if (oDsCheck == null && oDsCheck.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
@@ -845,7 +854,7 @@
             int HBQty = 0;              //绠辨暟
             double HQty = 0;            //鏁伴噺
             string WeiShu = "";         //灏炬暟
-            int LSH = 0;                //娴佹按鍙�
+            Int64 LSH = 0;              //娴佹按鍙�
             string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
             string sDate = "";          //鏃ユ湡
             string sYear = "";          //骞�
@@ -935,7 +944,7 @@
                             sTMNumber = HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else if (CampanyName == "椋為緳")
                         {
@@ -952,7 +961,7 @@
                             sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else if (CampanyName == "鐟炰笌绁�")
                         {
@@ -978,7 +987,7 @@
 
                                 //sTMNumber = ordrlist[j].HMaterNumber + "-鍖呰鏍囪瘑-" + date + "-" + ordrlist[j].HSupNumber + "-";
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                             else if (HSourceBillTypeName == "鐢熶骇鍏ュ簱鍗�")
                             {
@@ -1012,13 +1021,13 @@
 
                                 //sTMNumber = ordrlist[j].HMaterNumber + "-鍖呰鏍囪瘑-"+ date + "-缁勭粐浠g爜-";
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                             else
                             {
                                 sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                         }
                         else  //閫氱敤鏂规硶
@@ -1027,7 +1036,7 @@
                             sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                     }
                     else if (HSelectBarCodeType == "鍝佺鏉$爜")
@@ -1051,7 +1060,7 @@
                         sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 4;
                     }
                     else if (HSelectBarCodeType == "浠櫒鎴愬搧鏉$爜瑙勫垯") //鍙﹀澶勭悊浜�
@@ -1068,7 +1077,7 @@
                         sTMNumber = HMaterNumber + HBatchNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 6;
                     }
                     else if (HSelectBarCodeType == "鍐呴攢鏈烘潯鐮�")
@@ -1078,7 +1087,7 @@
                         sTMNumber = "1" + HModelName + HBarCodeDate + HBarCodeBatchNo + HYasuoji + "00";
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                         if (sTMNumber.Length != 16)
                         {
@@ -1095,7 +1104,7 @@
                         sTMNumber = HMaterNumber.Replace(".", "") + HBarCodeDate + HBarCodeBatchNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                         if (sTMNumber.Length != 18)
                         {
@@ -1111,7 +1120,7 @@
                         sTMNumber = HICMOBillNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                     }
                     else if (HSelectBarCodeType == "鎵樼洏鏉$爜")
@@ -1120,7 +1129,7 @@
                         //鏉$爜鍓嶇紑 = 鐗╂枡鍐呯爜 + 骞� + 鏈� + 鏃�
                         sTMNumber = HNumber + sYear + sPeriod + sDay;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                     }
                     else
                     {
@@ -1184,7 +1193,34 @@
                             objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�";
                             return objJsonResult;
                         }
-                        HBarCodeList barcode = new HBarCodeList();
+                        HBarCodeList barcode = new HBarCodeList(); 
+
+                        if (CampanyName == "娴疯瘹") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
+                        {
+                            string sHMTONo = "";            //璁″垝璺熻釜鍙�
+                            string sHSourceBillNo = "";     //婧愬崟鍗曞彿
+                            string sHSourceBillSEQ = "";    //婧愬崟琛屽彿
+                            string sSupNumber = "";         //渚涘簲鍟嗕唬鐮�
+                            string sHQty = "";              //鏁伴噺
+
+                            sHMTONo = DBUtility.ClsPub.isStrNull(ordrlist[j].HMTONo);
+                            sHSourceBillNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HBillNo);
+                            sHSourceBillSEQ = DBUtility.ClsPub.isStrNull(ordrlist[j].HSourceBillSEQ);
+                            sSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HSupNumber);
+                            sHQty = DBUtility.ClsPub.isStrNull(HMinQty);
+
+                            if (DBUtility.ClsPub.isStrNull(ordrlist[j].HBillType) == "1102") //婧愬崟锛氶噰璐鍗�
+                            {
+                                //鏉$爜瑙勫垯锛氶噰璐鍗曞崟鍙稝琛屽彿@鐗╂枡浠g爜@MTO@鏁伴噺@渚涘簲鍟嗕唬鐮�
+                                TM = sHSourceBillNo + "@" + sHSourceBillSEQ + "@" + HMaterNumber + "@" + sHMTONo + "@" + sHQty + "@" + sSupNumber;
+                            }
+                            else
+                            {
+                                //鏉$爜瑙勫垯锛氱墿鏂欏唴鐮丂MTO@鏁伴噺
+                                TM = HNumber + "@" + sHMTONo + "@" + sHQty;
+                            }
+                        }
+
                         barcode.HBarCode2 = TM;
                         barcode.HEntryID2 = ClsPub.isStrNull(j + 1);
                         barcode.HMaterID2 = ordrlist[j].HMaterID;

--
Gitblit v1.9.1