From 4c7cb8434be52f1de8557c069ebf82dfbfd8d6ee Mon Sep 17 00:00:00 2001
From: zrg <z1873@LAPTOP-EAVL132E>
Date: 星期三, 05 十一月 2025 15:29:46 +0800
Subject: [PATCH] 增加凯贝装箱单

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |   83 +++++++++++++++++++++++++++++++++++------
 1 files changed, 71 insertions(+), 12 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 5217d00..77ba140 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"
@@ -909,6 +909,8 @@
             string HSupNumber = ""; // 渚涘簲鍟嗙紪鐮�
             string HPOInStockBillNo = ""; // 鏀舵枡閫氱煡鍗曞彿
 
+            string HPOOrderBillNo = ""; // 閲囪喘璁㈠崟鍙�
+
             DataSet Ds;
             msg2 = msg2.Replace("\\", "");
             msg2 = msg2.Replace("\n", "");  //\n
@@ -959,6 +961,8 @@
                     
                     HPOInStockBillNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HBillNo); // 鏀舵枡閫氱煡鍗曞彿 鍏磋揪鏉$爜
                     HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HSupNumber);// 渚涘簲鍟嗙紪鍙� 鍏磋揪鏉$爜
+
+                    HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HBillNo); // 閲囪喘璁㈠崟鍙� 灏忓崼鐢靛櫒
                     //
                     sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
                     sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
@@ -1069,6 +1073,14 @@
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             LSHlen = 3; // 涓変綅娴佹按鍙�
+                        }
+                        else if (CampanyName.Contains("灏忓崼"))
+                        {
+                            // 灏忓崼鐢靛櫒
+                            // 鏉$爜鍓嶇紑 = 鍗曟嵁鍙� + 鐗╂枡缂栫爜 + 鎵规鍙�
+                            sTMNumber = HPOOrderBillNo + "@" + HMaterNumber + "@" + HBatchNo;
+                            Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else  //閫氱敤鏂规硶
                         {
@@ -1824,7 +1836,7 @@
         }
         #endregion
 
-        #region 鏇存柊鏉$爜 瀵瑰簲鍗曟嵁 鍗曞彿 娆℃暟 鏃堕棿
+        #region 鏇存柊鏉$爜瀵瑰簲鍑哄簱鐢宠鍗曞彿 鍏磋揪
         public class BarCodeMeta
         {
             public string HBarCode { get; set; }
@@ -1851,23 +1863,24 @@
             string msg2 = sArray[0].ToString();
             string HBillType = sArray[1].ToString();
             string HBillNo = sArray[2].ToString();
+            string HOrgName = sArray[3].ToString();
 
             List<BarCodeMeta> BarCodeMetaList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<BarCodeMeta>>(msg2);
+            oCN.BeginTran();
             try
             {
-                oCN.BeginTran();
-
                 for(int i = 0; i < BarCodeMetaList.Count; i++)
                 {
                     if (HBillType == "1205") // 閿�鍞嚭搴�
                     {
-                        oCN.RunProcReturn("Update Gy_BarCodeBill set HOutStockDate = getdate(), HOutStockCounts=isnull(HOutStockCounts,0)+1," +
-                           "HOutStockBillNo='" + HBillNo + " 'where HBarCode = '" + BarCodeMetaList[i].HBarCode + "'", "Gy_BarCodeBill");
-                    }
-                    if (HBillType == "1201") // 閲囪喘鍏ュ簱
-                    {
-                        oCN.RunProcReturn("Update Gy_BarCodeBill set HInStockDate = getdate(), HInStockCounts=isnull(HOutStockCounts,0)+1," +
-                           "HInStockBillNo='" + HBillNo + " 'where HBarCode = '" + BarCodeMetaList[i].HBarCode + "'", "Gy_BarCodeBill");
+
+                        if (HOrgName.Contains("鍏磋揪") && !string.IsNullOrEmpty(HBillNo))
+                        {
+                            // 鍏磋揪 閿�鍞嚭搴撴洿鏂� 鍙戣揣閫氱煡鍗�
+                            oCN.RunProcReturn("Update Gy_BarCodeBill set " +
+                            "HSeOutStockBillNo='" + HBillNo + "' where HBarCode = '" + BarCodeMetaList[i].HBarCode + "'", "Gy_BarCodeBill");
+                        }
+                        
                     }
                 }
                 
@@ -1879,6 +1892,7 @@
             }
             catch (Exception e)
             {
+                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "淇敼澶辫触!" + e.Message;
@@ -1890,12 +1904,12 @@
         #region [鑾峰彇鏍囩鎵撳嵃鎸囦护 CPCL鎸囦护]
         [Route("Sc_BarCode/Get_BarCodePrintCode_CPCL")]
         [HttpGet]
-        public object Get_BarCodePrintCode_CPCL(string HOrginationName, string HViewName, string HBillSubType, int HInterID, int HItemID)
+        public object Get_BarCodePrintCode_CPCL(string HOrginationName, string HBillSubType, int HInterID, int HItemID)
         {
             try
             {
                 ds = oCN.RunProcReturn("exec h_p_getHBarCodePrintCode_CPCL N'" + HOrginationName + "'" +
-                   ",N'" + HViewName + "',N'" + HBillSubType + "'," + HInterID + "," + HItemID, "h_p_getHBarCodePrintCode_CPCL");
+                   ",N'" + HBillSubType + "'," + HInterID + "," + HItemID, "h_p_getHBarCodePrintCode_CPCL");
                 if((int)ds.Tables[0].Rows[0]["resultType"] == 1)
                 {
                     string resultMesg = ds.Tables[0].Rows[0]["payload"].ToString().Replace("\\r\\n", "\r\n");
@@ -2735,6 +2749,51 @@
         }
         #endregion
 
+        #region [鏉$爜鐢熸垚鎺ュ彛_灏忓崼闀洉鐮乚
+        [Route("Sc_BarCode/SaveSNByICMO_XW")]
+        [HttpGet]
+        public object SaveSNByICMO_XW(String HBillNo,string HSN, int HBeginNo, int HEndNo, int HCount)
+        {
+            try
+            {
+                //ds = oCN.RunProcReturn("exec h_p_WMS_GetSNByICMO_XW '" + HCount + "', "+ HSeq, "h_p_WMS_GetSNByICMO_XW");
+
+                //if (ds == null)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "[0000-2-020]娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜淇濆瓨澶辫触锛�";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+
+                
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "[0000-1-037]鏉$爜鐢熸垚鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+                
+                
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触!" + e.Message;
+                return objJsonResult;
+            }
+        }
+        #endregion        
+
         #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1