From 39f20d0d2e0143e45fb317336f154170d6b82485 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期二, 11 十一月 2025 08:55:29 +0800
Subject: [PATCH] 小卫托条码生成

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |  345 +++++++++++++++++++++++++++++++
 WebAPI/Controllers/BaseSet/Gy_MaterialController.cs  |  171 +++++++++-----
 WebAPI/Controllers/条码管理/WEBSController.cs            |   98 ++++++++
 3 files changed, 551 insertions(+), 63 deletions(-)

diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index 528db2a..6599d79 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -4377,11 +4377,11 @@
                 if (!tb2.Columns.Contains("鐘舵��"))
                     error += "娌℃湁鎵惧埌銆愮姸鎬併�戠殑鏍囬,";
 
-                if (!tb2.Columns.Contains("榛樿浠撳簱"))
-                    error += "娌℃湁鎵惧埌銆愰粯璁や粨搴撱�戠殑鏍囬,";
+                //if (!tb2.Columns.Contains("榛樿浠撳簱"))
+                //    error += "娌℃湁鎵惧埌銆愰粯璁や粨搴撱�戠殑鏍囬,";
 
-                if (!tb2.Columns.Contains("榛樿浠撲綅"))
-                    error += "娌℃湁鎵惧埌銆愰粯璁や粨浣嶃�戠殑鏍囬,";
+                //if (!tb2.Columns.Contains("榛樿浠撲綅"))
+                //    error += "娌℃湁鎵惧埌銆愰粯璁や粨浣嶃�戠殑鏍囬,";
 
                 if (!tb2.Columns.Contains("鐗堟湰鍙�"))
                     error += "娌℃湁鎵惧埌銆愮増鏈彿銆戠殑鏍囬,";
@@ -4442,8 +4442,8 @@
                     HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["瀵瑰簲ERP鐗╂枡"].ToString());
                     HUnitName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璁¢噺鍗曚綅"].ToString());
                     HDeptName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["浣跨敤閮ㄩ棬"].ToString());
-                    HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撳簱"].ToString());
-                    HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撲綅"].ToString());
+                        HWHName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撳簱"].ToString());
+                        HSPName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["榛樿浠撲綅"].ToString());
                     HSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["渚涘簲鍟�"].ToString());
                     HSupNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["渚涘簲鍟嗕唬鐮�"].ToString());
                     HMadeSupName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍒堕�犲晢"].ToString());
@@ -4534,67 +4534,83 @@
                         {
                             tb2.Rows[i]["HDeptID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
                         }
-                        //鏌ヨ浠撳簱
-                        ds = oCN.RunProcReturn("select * from Gy_Warehouse where  HName='" + HWHName + "'  and HUSEORGID=" + HORGid + "", "Gy_Warehouse");
+                        if (HWHName != "")
+                        {
+                            //鏌ヨ浠撳簱
+                            ds = oCN.RunProcReturn("select * from Gy_Warehouse where  HName='" + HWHName + "'  and HUSEORGID=" + HORGid + "", "Gy_Warehouse");
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撳簱:" + HWHName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HSPGroupID"].ToString();
-                        }
-                        string HWHID = tb2.Rows[i]["HWHID"].ToString();
-                        //鏌ヨ浠撲綅
-                        ds = oCN.RunProcReturn("select * from Gy_StockPlace where  HName='" + HSPName + "'and HSPGroupID=" + HWHID+ "  and HUSEORGID=" + HORGid + "", "Gy_StockPlace");
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撳簱:" + HWHName + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HWHID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
+                            
+                            string HWHID = tb2.Rows[i]["HWHID"].ToString();
+                            if (HWHID != "")
+                            {
+                                //鏌ヨ浠撲綅
+                                ds = oCN.RunProcReturn("select * from Gy_StockPlace where  HName='" + HSPName + "'and HSPGroupID=" + HWHID + "  and HUSEORGID=" + HORGid + "", "Gy_StockPlace");
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撲綅:" + HSPName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
+                                if (ds.Tables[0].Rows.Count == 0)
+                                {
+                                    objJsonResult.code = "0";
+                                    objJsonResult.count = 0;
+                                    objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,浠撲綅:" + HSPName + ",涓嶅瓨鍦紒";
+                                    objJsonResult.data = null;
+                                    return objJsonResult;
+                                }
+                                else
+                                {
+                                    tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                                }
+                            }
+                               
                         }
-                        else
+                       if(HSupName!="")
                         {
-                            tb2.Rows[i]["HSPID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            ds = oCN.RunProcReturn("select * from Gy_Supplier where  HNumber='" + HSupNumber + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
+
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,渚涘簲鍟�:" + HSupName + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
                         }
                         //鏌ヨ渚涘簲鍟�
-                        ds = oCN.RunProcReturn("select * from Gy_Supplier where  HNumber='" + HSupNumber + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
+                       if(HMadeSupName!="")
+                        {
+                            //鏌ヨ鍒堕�犲晢
+                            ds = oCN.RunProcReturn("select * from Gy_Supplier where  HName='" + HMadeSupName + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
 
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,渚涘簲鍟�:" + HSupName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
+                            if (ds.Tables[0].Rows.Count == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,鍒堕�犲晢:" + HMadeSupName + ",涓嶅瓨鍦紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                            else
+                            {
+                                tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            }
                         }
-                        else
-                        {
-                            tb2.Rows[i]["HSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                        }
-                        //鏌ヨ鍒堕�犲晢
-                        ds = oCN.RunProcReturn("select * from Gy_Supplier where  HName='" + HMadeSupName + "'  and HUSEORGID=" + HORGid + "", "Gy_Supplier");
-
-                        if (ds.Tables[0].Rows.Count == 0)
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "绗�" + index + "琛�,璇�" + HORGName + "缁勭粐,鍒堕�犲晢:" + HMadeSupName + ",涓嶅瓨鍦紒";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
-                        else
-                        {
-                            tb2.Rows[i]["HMadeSupID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
-                        }
+              
+                        
 
                         //鍣ㄥ叿妗f鍚嶇О
                         if (HMouldName == "")
@@ -4704,15 +4720,19 @@
                     long HUnitID = int.Parse(item["HUnitID"].ToString());
                     DateTime HOutComDate = DateTime.Now;
                     string HOutComNo = item["鍣ㄥ叿鍑哄巶缂栧彿"].ToString();
-                    long HDeptID = int.Parse(item["HDeptID"].ToString());
-                    long HSupID = int.Parse(item["HSupID"].ToString());
+                    var HDeptID_temp = item["HDeptID"].ToString() == "" ? "0" : item["HDeptID"].ToString();
+                    long HDeptID = int.Parse(HDeptID_temp);
+                    var HSupID_temp = item["HSupID"].ToString() == "" ? "0" : item["HSupID"].ToString();
+                    long HSupID = int.Parse(HSupID_temp);
                     string HMouldStatus = item["鐘舵��"].ToString();
-                    long HWHID = int.Parse(item["HWHID"].ToString());
+                    var HWHID_TEMP = item["HWHID"].ToString() == "" ? "0" : item["HWHID"].ToString();
+                    long HWHID = int.Parse(HWHID_TEMP);
                     long HRoutingID = 0;//宸ヨ壓璺嚎id
                     long HBOMID = 0;
                     string HVersion = "";//鐗堟湰
                     long HSPGroupID = 0;//榛樿浠撲綅缁�
-                    long HSPID = int.Parse(item["HSPID"].ToString());//浠撲綅id
+                    var HSPID_temp = item["HSPID"].ToString() == "" ? "0" : item["HSPID"].ToString();
+                    long HSPID = int.Parse(HSPID_temp);//浠撲綅id
                     Double HDesignLife = item["璁捐瀵垮懡"].ToString()=="" ? 0: double.Parse(item["璁捐瀵垮懡"].ToString());
                     Double HUseLife = item["浣跨敤瀵垮懡"].ToString() == "" ? 0 : double.Parse(item["浣跨敤瀵垮懡"].ToString());
                     Double HInitLife = 0;//涓婄嚎鍒濆鍖栧鍛�
@@ -4855,5 +4875,30 @@
         #endregion
         #endregion
 
+
+        //鏍规嵁鏉$爜鎵剧墿鏂欎俊鎭�
+        [Route("Gy_Material/findMaterialByNumber")]
+        [HttpGet]
+        public object findMaterialByNumber(string HbarCode,string HSTOCKORGID)
+        {
+            try
+            {
+                ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material");
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒濆鍖栧け璐ワ紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
     }
 }
\ No newline at end of file
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 10103a7..01cff2b 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"
@@ -2807,6 +2807,351 @@
         }
         #endregion        
 
+
+        #region [鏉$爜鐢熸垚鎺ュ彛_灏忓崼鎵樻潯鐮乚
+        [Route("Sc_BarCode/Sub_SaveBill_xiaowei")]
+        [HttpPost]
+        public object Sub_SaveBill_xiaowei([FromBody] JObject msg)
+        {
+            try
+            {
+                var _value = msg["msg"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string msg2 = sArray[0].ToString();
+                string HOrgType = sArray[1].ToString();//缁勭粐鍚嶇О
+                string HSourceBillTypeName = "鐢熶骇璁㈠崟";//婧愬崟绫诲瀷
+                string HSelectBarCodeType = "鎵樼洏鏉$爜";
+                string CampanyName = "灏忓崼";
+                string UserName = sArray[2].ToString();//鐢ㄦ埛
+                ClsPub.CurUserName = UserName;
+
+                //鑾峰彇鍐呯爜
+                HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+                DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
+                HOrgNumber = "";
+                if (oClsGy_ORGANIZATIONS_View.GetInfoByName(HOrgType))
+                {
+                    HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
+                    HOrgNumber = DBUtility.ClsPub.isStrNull(oClsGy_ORGANIZATIONS_View.omodel.HNumber);
+                }
+                if (HOrgID == -1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-2-055]閫夋嫨缁勭粐鏈夐敊璇�!";
+                    return objJsonResult;
+                }
+                //if (!Sub_AllowSave(msg2, HSelectBarCodeType))//鍗曟嵁瀹屾暣鎬у垽鏂�
+                //{
+                //    return objJsonResult;
+                //}
+                if (HSelectBarCodeType == "浠櫒鎴愬搧鏉$爜瑙勫垯")
+                {
+                    //瀹㈡埛瀹氬埗
+                }
+                else
+                {
+                    //鐢熸垚鏉$爜
+                    SaveBarCode_xiaowei(msg2, HSelectBarCodeType, CampanyName, HSourceBillTypeName);
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触!" + e.Message;
+                return objJsonResult;
+            }
+            return objJsonResult;
+        }
+        #endregion        
+
+        #region[鏉$爜鐢熸垚鏂规硶_xiaowei]
+        private object SaveBarCode_xiaowei(string msg2, string HSelectBarCodeType, string CampanyName, string HSourceBillTypeName)
+        {
+            DateTime sDate = DateTime.Now;                      //鏃ユ湡
+            string HSourceBillType_Temp = "";                   //婧愬崟绫诲瀷
+            int n = 0;                                          //鍚屾壒鐢熸垚鐨勬潯鐮佺储寮�
+
+            //鑾峰彇鏄庣粏淇℃伅
+            msg2 = msg2.Replace("\\", "");
+            msg2 = msg2.Replace("\n", "");  //\n
+            HSouceOrderList ordrlist = Newtonsoft.Json.JsonConvert.DeserializeObject<HSouceOrderList>(msg2);
+
+           // List<HSouceOrderList> ordrlist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HSouceOrderList>>(msg2);
+            List<HBarCodeList> ListRows = new List<HBarCodeList>();
+
+            DataSet Ds;
+            for (int i = 0; i < 1; i++)
+            {
+                HSourceBillType_Temp = ordrlist.HBillType;
+
+                if (ClsPub.isLong(ordrlist.HMaterID) != 0)
+                {
+                    if (HSelectBarCodeType == "鎵樼洏鏉$爜")
+                    {
+                        //鎷嗗垎姣忔潯鐗╂枡璁板綍涓哄鏉℃潯鐮佽褰�
+                        double HSumQty = ClsPub.isDoule(ordrlist.HQty);                      //浜у搧鏁伴噺
+                        double HQty = ClsPub.isDoule(ordrlist.HQty);                         //鏁伴噺
+                        double HMinQty = ClsPub.isDoule(ordrlist.HMinQty);                   //鏈�灏忓寘瑁呮暟
+                        int HBQty = ClsPub.isInt(ordrlist.HBQty);                            //绠辨暟
+                        string WeiShu = "";                                                     //灏炬暟
+
+                        for (int j = 0; j < HBQty; j++)
+                        {
+                            string HBarCode_Temp = "";                                                  //鏉$爜
+                            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());
+                            char productionMonth = 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;
+                            }
+                            //todo
+                            //鏉$爜鍓嶇紑 = p+鍟嗗搧SKU+鐢熶骇骞翠唤+鐢熶骇鏈堜唤+6浣嶆祦姘村彿+鐢熶骇宸ュ巶浠g爜
+                            sTMNumber = "P" + HMaterialName + 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";
+
+
+                            if (HSumQty - HMinQty > 0)
+                            {
+                                WeiShu = "";
+                                HSumQty = HSumQty - HMinQty;
+                            }
+                            else
+                            {
+                                if (HSumQty == HMinQty)
+                                {
+                                    WeiShu = "";
+                                }
+                                else
+                                {
+                                    WeiShu = "灏炬暟";
+                                }
+                                HMinQty = HSumQty;
+                            }
+
+                            HBarCodeList barcode = new HBarCodeList();
+                            barcode.HBarCode2 = HBarCode_Temp;
+                            barcode.HBarCodeType2 = "鎵樼洏鏉$爜";
+                            barcode.HBarCodeSubType2 = "鎵樻潯鐮�";
+                            barcode.HEntryID2 = ClsPub.isStrNull(i + 1);
+                            barcode.HMaterID2 = ordrlist.HMaterID;
+                            barcode.HMaterNumber2 = ordrlist.HMaterNumber;
+                            barcode.HMaterName2 = ordrlist.HMaterName;
+                            barcode.HMaterModel2 = ordrlist.HMaterModel;
+                            barcode.HPinfan2 = ordrlist.HPinfan;
+                            barcode.HPinfanBarCode2 = ordrlist.HPinfanBarCode;
+                            barcode.HAuxPropID2 = ordrlist.HAuxPropID;
+                            barcode.HAuxPropNumber2 = ordrlist.HAuxPropNumber;
+                            barcode.HAuxPropName2 = ordrlist.HAuxPropName;
+                            barcode.HUnitID2 = ordrlist.HUnitID;
+                            barcode.HUnitNumber2 = ordrlist.HUnitNumber;
+                            barcode.HUnitName2 = ordrlist.HUnitName;
+                            barcode.HQty2 = ClsPub.isStrNull(HMinQty);
+                            barcode.HBatchNo2 = ordrlist.HBatchNo;
+                            barcode.HSourceInterID2 = ordrlist.HMainID;
+                            barcode.HSourceEntryID2 = ordrlist.HSubID;
+                            barcode.HSourceBillNo2 = ordrlist.HBillNo;
+                            barcode.HSourceBillType2 = ordrlist.HBillType;
+                            barcode.HPrint = "0";
+                            barcode.HWei = WeiShu;
+                            barcode.HBarcodeNo = ClsPub.isStrNull(n + 1);
+                            barcode.HBarcodeQtys = ordrlist.HBQty;
+                            barcode.HSupID2 = ordrlist.HSupID;
+                            barcode.HSupNumber2 = ordrlist.HSupNumber;
+                            barcode.HSupName2 = ordrlist.HSupName;
+                            barcode.HDeptID2 = ordrlist.HDeptID;
+                            barcode.HDeptNumber2 = ordrlist.HDeptNumber;
+                            barcode.HDeptName2 = ordrlist.HDeptName;
+                            barcode.HRemark2 = ordrlist.HRemark;
+                            barcode.HDate2 = ordrlist.HDate;
+                            barcode.HShowDate2 = ordrlist.HShowDate;
+                            barcode.HWhID2 = ordrlist.HWhID;
+                            barcode.HWhNumber2 = ordrlist.HWhNumber;
+                            barcode.HWhName2 = ordrlist.HWhName;
+                            barcode.HSPID2 = ordrlist.HSPID;
+                            barcode.HSPNumber2 = ordrlist.HSPNumber;
+                            barcode.HSPName2 = ordrlist.HSPName;
+                            barcode.HMTONo2 = ordrlist.HMTONo;
+                            barcode.HCusID2 = ordrlist.HCusID;
+                            barcode.HCusNumber2 = ordrlist.HCusNumber;
+                            barcode.HCusName2 = ordrlist.HCusName;
+                            barcode.HCusType2 = ordrlist.HCusType;
+                            barcode.HSourceID2 = ordrlist.HSourceID;
+                            barcode.HSourceNumber2 = ordrlist.HSourceNumber;
+                            barcode.HSourceName2 = ordrlist.HSourceName;
+                            barcode.HEndDate2 = ordrlist.HEndDate;
+                            barcode.HSeOrderBillNo2 = ordrlist.HSeOrderBillNo;
+                            barcode.HInnerBillNo2 = ordrlist.HInnerBillNo;
+                            barcode.HMaker2 = ordrlist.HMaker;
+                            barcode.HGiveAwayFlag2 = ordrlist.HGiveAwayFlag;
+                            barcode.HCoilNO = ordrlist.HCoilNO;
+                            barcode.HFurnaceNO = ordrlist.HFurnaceNO;
+                            barcode.HFactory = ordrlist.HFactory;
+                            barcode.HAuxQty = ordrlist.HAuxQty;
+                            barcode.HheatNO = ordrlist.HheatNO;
+                            barcode.HGroupID2 = ordrlist.HGroupID;
+                            barcode.HEmpID2 = ordrlist.HEmpID;
+                            barcode.HCusModel2 = ordrlist.HCusModel;
+                            barcode.HCusMaterName2 = ordrlist.HCusMaterName;
+                            barcode.HCheckEmpName2 = ordrlist.HCheckEmpName;
+                            barcode.HZZRQ = ordrlist.HZZRQ;
+                            ListRows.Add(barcode);
+
+                            n += 1;                                                             //鏇存柊鍚屾壒鐢熸垚鐨勬潯鐮佹暟
+                            oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");           //鏇存柊鏈�澶ф祦姘村彿
+                        }
+                    }
+                   
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "閿欒鐨勬潯鐮佺被鍨嬶紝涓嶈兘鐢熸垚鏉$爜锛�";
+                        return objJsonResult;
+                    }
+                }
+            }
+
+
+            try
+            {
+                oCN.BeginTran();
+                for (int i = 0; i < ListRows.Count; i++)
+                {
+                    if (ClsPub.isLong(ListRows[i].HMaterID2) != 0)
+                    {
+                        string HBarCode = ClsPub.isStrNull(ListRows[i].HBarCode2);
+                        string HBarCodeType = ClsPub.isStrNull(ListRows[i].HBarCodeType2);
+                        string HBarCodeSubType = ClsPub.isStrNull(ListRows[i].HBarCodeSubType2);
+                        Int64 HMaterID = ClsPub.isLong(ListRows[i].HMaterID2);
+                        Int64 HEntryID = ClsPub.isLong(ListRows[i].HEntryID2);
+                        Int64 HAuxPropID = ClsPub.isLong(ListRows[i].HAuxPropID2);
+                        Int64 HUnitID = ClsPub.isLong(ListRows[i].HUnitID2);
+                        double HQty2 = ClsPub.isDoule(ListRows[i].HQty2);
+                        string HWei = ClsPub.isStrNull(ListRows[i].HWei);
+                        string HBatchNo2 = ClsPub.isStrNull(ListRows[i].HBatchNo2);
+                        Int64 HSourceInterID = ClsPub.isLong(ListRows[i].HSourceInterID2);
+                        Int64 HSourceEntryID = ClsPub.isLong(ListRows[i].HSourceEntryID2);
+                        string HSourceBillNo = ClsPub.isStrNull(ListRows[i].HSourceBillNo2);
+                        string HSourceBillType = ClsPub.isStrNull(ListRows[i].HSourceBillType2);
+                        Int64 HBarcodeQtys = ClsPub.isLong(ListRows[i].HBarcodeQtys);
+                        Int64 HBarcodeNo = ClsPub.isLong(ListRows[i].HBarcodeNo);
+                        Int64 HSupID = ClsPub.isLong(ListRows[i].HSupID2);
+                        Int64 HDeptID = ClsPub.isLong(ListRows[i].HDeptID2);
+                        Int64 HWhID = ClsPub.isLong(ListRows[i].HWhID2);
+                        Int64 HSPID = ClsPub.isLong(ListRows[i].HSPID2);
+                        string HRemark = ClsPub.isStrNull(ListRows[i].HRemark2);
+                        string HMaterName = ClsPub.isStrNull(ListRows[i].HMaterName2);
+                        string HMaterModel = ClsPub.isStrNull(ListRows[i].HMaterModel2);
+                        string HPinfan = ClsPub.isStrNull(ListRows[i].HPinfan2);
+                        string HMTONo = ClsPub.isStrNull(ListRows[i].HMTONo2);
+                        Int64 HCusID = ClsPub.isLong(ListRows[i].HCusID2);
+                        string HCusType = ClsPub.isStrNull(ListRows[i].HCusType2);
+                        DateTime HEndDate = ClsPub.isDate(ListRows[i].HEndDate2);
+                        string HWorkLineName = ClsPub.isStrNull(ListRows[i].HSourceName2);
+                        string HSeOrderBillNo = ClsPub.isStrNull(ListRows[i].HSeOrderBillNo2);
+                        string HInnerBillNo = ClsPub.isStrNull(ListRows[i].HInnerBillNo2);
+                        bool HGiveAwayFlag = ClsPub.isBool(ListRows[i].HGiveAwayFlag2);
+                        int HPrintQty = ClsPub.isInt(ListRows[i].HPrint);
+
+                        string HCoilNO2 = ClsPub.isStrNull(ListRows[i].HCoilNO);
+                        string HFurnaceNO2 = ClsPub.isStrNull(ListRows[i].HFurnaceNO);
+                        string HFactory2 = ClsPub.isStrNull(ListRows[i].HFactory);
+                        Int64 HAuxQty2 = ClsPub.isLong(ListRows[i].HAuxQty);
+                        string HheatNO2 = ClsPub.isStrNull(ListRows[i].HheatNO);
+                        DateTime HProduceDate = ClsPub.isDate(ListRows[i].HProduceDate);
+                        DateTime HExpiryDate = ClsPub.isDate(ListRows[i].HExpiryDate);
+                        int HGroupID2 = ClsPub.isInt(ListRows[i].HGroupID2);
+                        Int64 HEmpID2 = ClsPub.isLong(ListRows[i].HEmpID2);
+                        string HCusModel2 = ClsPub.isStrNull(ListRows[i].HCusModel2);
+                        string HCusMaterName2 = ClsPub.isStrNull(ListRows[i].HCusMaterName2);
+                        string HCheckEmpName2 = ClsPub.isStrNull(ListRows[i].HCheckEmpName2);
+                        string HZZRQ = ClsPub.isStrNull(ListRows[i].HZZRQ);
+                        oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HBarCodeSubType,HMaterID,HUnitID,HQty" +
+                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                                    ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                                    ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
+                                    ",HGiveAwayFlag " +
+                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
+                                    ",HCoilNO,HFurnaceNO,HFactory,HAuxQty,HheatNO,HProduceDate,HExpiryDate,HEmpID,HCusModel,HCusMaterName,HCheckEmpName,HZZRQ " +
+                                    ") values ("
+                                    + "'" + HBarCode + "','" + HBarCodeType + "','" + HBarCodeSubType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
+                                    + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID2.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+                                    + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+                                    + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+                                    + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
+                                    + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
+                                    + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
+                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "'"
+                                    + ",'" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'," + HEmpID2.ToString() + ",'" + HCusModel2 + "','" + HCusMaterName2 + "','" + HCheckEmpName2 + "','" + HZZRQ + "'" + ")");
+
+                    }
+                }
+                //澧炲姞 鏉$爜瓒呰繃鏈敓鎴愬姛鑳芥帶鍒�
+
+                //
+                //鑷姩瑁呯
+                string sql_autoForBoxBill = "exec h_v_Gy_BarCode_AutoProductBarCodeBox " + HInterID.ToString();
+                oCN.RunProc(sql_autoForBoxBill);
+
+                oCN.Commit();
+                List<Object> listobj = ListRows.ConvertAll(s => (object)s);//List瀹炰綋绫昏浆鎹负object
+                //鑾峰彇鐢熸垚鐨勬潯鐮佷俊鎭�
+                string sql = string.Format(@"select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID");
+                ds = new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_IF_ICMOBillList_Table");
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "[0000-1-037]鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                    objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //搴忓垪鍖朌ataSet涓殑鏃堕棿鏍煎紡锛岀劧鍚庡啀鍙嶅簭鍒楀寲鍥炴潵
+                    objJsonResult.list = listobj;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-2-020]娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒";
+                    objJsonResult.data = null;
+                    objJsonResult.list = listobj;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触锛�" + e.Message;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #endregion
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs" "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
index 39c37af..b24fc8c 100644
--- "a/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
+++ "b/WebAPI/Controllers/\346\235\241\347\240\201\347\256\241\347\220\206/WEBSController.cs"
@@ -4694,6 +4694,33 @@
 
         #endregion
 
+        #region 灏忓崼缁勬墭鏉$爜灞曠ず
+        [Route("WEBSController/get_SavePackUnion_xiaowei")]
+        [HttpGet]
+        public object get_SavePackUnion_xiaowei(string HBarCode_Pack)
+        {
+            try
+            {
+
+                DataSet ds=oCn.RunProcReturn($"select * from h_v_get_PackUnionBill where 鏍堟澘鐮�='{HBarCode_Pack}'", "h_v_get_PackUnionBill");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "success";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = DBUtility.ClsPub.sErrInfo;  //澶辫触锛�
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
         #region 涓婃枡闃查敊鍗�     涓婁紶鐢熷崟
 
         /// <summary>
@@ -7920,6 +7947,77 @@
 
         #endregion
 
+        #region 鐢熶骇缁勬墭鍗曟ā鍧� 鎵弿鎵樻潯鐮佸搴旀潯鐮�--xiaowei    20250630
+
+        /// <summary>
+        /// 鐢熶骇缁勬墭鍗曟ā鍧� 鎵弿鎵樻潯鐮佸搴旀潯鐮�
+        /// </summary>
+        /// <returns></returns>
+        [Route("WEBSController/get_BarCode_PackUnionBill_New_Json_xiaowei")]
+        [HttpGet]
+        public object get_BarCode_PackUnionBill_New_Json_xiaowei(string HBarCode, Int64 HInterID, string HBillNo, string HBillType, string HBillSubType, string HBarCode_Pack, string HMaterNumber_Pack, string HMaker, Int64 HStockOrgID)
+        {
+            //鑾峰彇绯荤粺鍙傛暟
+            string sErrMsg = "";
+            if (oSystemParameter.ShowBillByOrgID(HStockOrgID, ref sErrMsg) == true)
+            {
+                string sMaterialCtl = "Y";          //缁勬墭鐗╂枡鏄惁涓�鑷存帶鍒讹紙Y涓烘帶鍒讹級
+                string sSourceBillTypeCtl = "Y";    //鏈叆搴撴潯鐮佽繘琛岀粍鎵樻椂锛岃繘琛屽悓婧愬崟绫诲瀷鎺у埗锛圷涓烘帶鍒讹級
+                string sSourceBillNoCtl = "Y";      //鏈叆搴撴潯鐮佽繘琛岀粍鎵樻椂锛岃繘琛屽悓婧愬崟鎺у埗锛圷涓烘帶鍒讹級
+                sMaterialCtl = oSystemParameter.omodel.Sc_PackUnionBill_MaterialCtl.ToUpper();
+                sSourceBillTypeCtl = oSystemParameter.omodel.Sc_PackUnionBill_SourceBillTypeCtl.ToUpper();
+                sSourceBillNoCtl = oSystemParameter.omodel.Sc_PackUnionBill_SourceBillNoCtl.ToUpper();
+
+                try
+                {
+                    ds = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_PackUnionBill_New_xiaowei '" + HBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBillSubType + "','" + HBarCode_Pack + "','" + HMaterNumber_Pack + "','" + sMaterialCtl + "','" + sSourceBillTypeCtl + "','" + sSourceBillNoCtl + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_PackUnionBill_New");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎵弿鏉$爜鍙戠敓閿欒锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鎴愬姛锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                catch (Exception e)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵弿鏉$爜澶辫触锛�" + e.ToString();
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鑾峰彇绯荤粺鍙傛暟澶辫触锛� " + sErrMsg;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #endregion
+
+
         #region 杩斿洖缁勬墭鍒楄〃淇℃伅
 
         /// <summary>

--
Gitblit v1.9.1