From 6e289cba8f4ef419363f71646f5fcc8e6dfac6d2 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期三, 11 三月 2026 14:02:06 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs | 1525 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1,517 insertions(+), 8 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 62d82ed..51de396 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"
@@ -6,9 +6,11 @@
 using System;
 using System.Collections.Generic;
 using System.Data;
+using System.IO;
 using System.Linq;
 using System.Net;
 using System.Net.Http;
+using System.Web;
 using System.Web.Http;
 using WebAPI.Models;
 
@@ -23,6 +25,7 @@
         public WebServer webserver = new WebServer();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         private WebS.WebService1 oWebs = new WebS.WebService1();
+        public WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public Int64 HInterID = 0;      //鍐呯爜
@@ -204,11 +207,11 @@
                         if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
                         {
                             count = new SQLHelper.ClsCN().RunProcReturn("select top 1000 * from h_v_IF_POInStockBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
-                            sql = string.Format(@"select * from(select  top 1000 row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_POInStockBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                            sql = string.Format(@"select * from(select top 1000 row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_POInStockBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
                         }
                         else
                         {
-                            count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POInStockBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                            count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POInStockBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid ", tabname).Tables[0].Rows.Count;
                             sql = string.Format(@"select * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_POInStockBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
                         }
                         break;
@@ -300,6 +303,148 @@
             return objJsonResult;
         }
         #endregion
+
+        #region [閫氳繃婧愬崟绫诲瀷鏌ユ壘涓嶅悓鍗曟嵁淇℃伅] 浣跨敤鏂扮殑鍒嗛〉鏂瑰紡 
+        [Route("Sc_BarCode/ReportFromBillList_New")]
+        [HttpGet]
+        public object ReportFromBillList_New(int page, int limit, string sWhere, string HSouceBillType, string HOrgID)
+        {
+            oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
+            List<object> columnNameList = new List<object>();
+            try
+            {
+                int count = 0;
+                int pageNum = page;
+                int pageSize = limit;
+                string sql = "";
+                string tabname = "";
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    sWhere = " where 1=1 and HOrgID='" + HOrgID + "' ";
+                }
+                else
+                {
+                    sWhere = " where 1=1 and HOrgID='" + HOrgID + "' " + sWhere;
+                }
+                switch (HSouceBillType)
+                {
+                    case "鐢熶骇璁㈠崟":
+                        tabname = "h_v_IFCLD_ICMOBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IFCLD_ICMOBillList_Source " + sWhere + " and 浠诲姟鏁伴噺>isnull(鍏ュ簱鏁伴噺,0)  and 鐘舵��<>'缁撴' order by 鍗曟嵁鍙�", tabname).Tables[0].Rows.Count;
+                        sql = string.Format($@"select * from h_v_IFCLD_ICMOBillList_Source {sWhere} and 浠诲姟鏁伴噺>isnull(鍏ュ簱鏁伴噺,0)  and 鐘舵��<>'缁撴' order by 鍗曟嵁鍙� offset {(pageNum - 1)*pageSize} rows fetch next {pageSize} rows only;");
+                        break;
+                    case "鐢熶骇姹囨姤鍗�":
+                        tabname = "h_v_IF_ICMOReportBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_ICMOReportBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_ICMOReportBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "閲囪喘璁㈠崟":
+                        tabname = "h_v_IF_POOrderBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POOrderBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format($@"select * from h_v_IF_POOrderBillList_Source {sWhere} order by 鍗曟嵁鍙� offset {(pageNum - 1)*pageSize} rows fetch next {pageSize} rows only;");
+                        break;
+                    case "鏀舵枡閫氱煡鍗�":
+                        tabname = "h_v_IF_POInStockBillList_Source";
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            count = new SQLHelper.ClsCN().RunProcReturn("select top 1000 * from h_v_IF_POInStockBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                            sql = string.Format(@"select * from(select top 1000 row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_POInStockBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        }
+                        else
+                        {
+                            count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POInStockBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid ", tabname).Tables[0].Rows.Count;
+                            sql = string.Format($@"select * from h_v_IF_POInStockBillList_Source {sWhere} order by 鍗曟嵁鍙� offset {(pageNum - 1) * pageSize} rows fetch next {pageSize} rows only; ");
+                        }
+                        break;
+                    case "濮斿璁㈠崟":
+                        tabname = "h_v_IF_EntrustOrderBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_EntrustOrderBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_EntrustOrderBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "鐢熶骇鍏ュ簱鍗�":
+                        tabname = "h_v_IF_ProductInBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_ProductInBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_ProductInBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "閲囪喘鍏ュ簱鍗�":
+                        tabname = "h_v_IF_POStockInBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_POStockInBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_POStockInBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "閿�鍞��璐у崟":
+                        tabname = "h_v_IF_SellOutBackBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBackBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_SellOutBackBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "鐢熶骇閫�鏂欏崟":
+                        tabname = "h_v_IF_MateOutBackBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MateOutBackBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_MateOutBackBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "宸ュ簭娴佽浆鍗�":
+                        tabname = "h_v_IF_ProcessExchangeBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_ProcessExchangeBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_ProcessExchangeBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "閿�鍞嚭搴撳崟":
+                        tabname = "h_v_IF_SellOutBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_SellOutBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    case "棰嗘枡鍑哄簱鍗�":
+                        tabname = "h_v_IF_MateOutBillList_Source";
+                        count = new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_MateOutBillList_Source " + sWhere + " order by 鍗曟嵁鍙� desc,hsubid", tabname).Tables[0].Rows.Count;
+                        sql = string.Format(@"select top " + pageSize + " * from(select row_number() over (order by 鍗曟嵁鍙� desc,hsubid) as HRowNumber,* from h_v_IF_MateOutBillList_Source " + sWhere + ")   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
+                        break;
+                    default:
+                        break;
+                }
+                ds = new SQLHelper.ClsCN().RunProcReturn(sql, tabname);
+                string aa = ds.Tables[0].Columns[0].ToString();
+                //ds.Tables[0].Columns["hmainid"].ColumnName.ToUpper();
+                //ds.Tables[0].Columns["hsubid"].ColumnName.ToUpper();
+                ds.Tables[0].Columns["hmainid"].ColumnName = "HMainID";
+                ds.Tables[0].Columns["hsubid"].ColumnName = "HSubID";
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = count;
+                    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                    objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //搴忓垪鍖朌ataSet涓殑鏃堕棿鏍煎紡锛岀劧鍚庡啀鍙嶅簭鍒楀寲鍥炴潵
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏆傛棤璧勬簮缁戝畾锛�";
+                    objJsonResult.data = null;
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message.ToString();
+                objJsonResult.data = null;
+                objJsonResult.list = columnNameList;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
 
         #region [閫氳繃鏉$爜缂栧彿鑾峰彇HItemId]
         [Route("Sc_BarCode/Get_HItemId")]
@@ -526,6 +671,8 @@
             return ordrlist;
         }
 
+       
+
         public object HSourceOrderList1(DataTable dt, HSouceOrderList ordrlist, string HBarCodeType,string HSourceBillType)
         {
             oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
@@ -552,15 +699,29 @@
                 ordrlist.HUnitName = dt.Rows[i]["璁¢噺鍗曚綅"].ToString();
                 ordrlist.HRemark = dt.Rows[i]["澶囨敞"].ToString();
                 ordrlist.HMTONo = dt.Rows[i]["璁″垝璺熻釜鍙�"].ToString();
+                ordrlist.HProduceDate = DBUtility.ClsPub.isDate(dt.Rows[i]["鐢熶骇鏃ユ湡"]);
+                ordrlist.HExpiryDate = DBUtility.ClsPub.isDate(dt.Rows[i]["鏈夋晥鏈熻嚦"]);
+                //ordrlist.HISKFPERIOD = int.Parse(dt.Rows[i]["HISKFPERIOD"].ToString());
+                ordrlist.HISKFPERIOD = DBUtility.ClsPub.isInt(dt.Rows[i]["HISKFPERIOD"]);
+                ordrlist.HEXPUNIT = dt.Rows[i]["HEXPUNIT"].ToString();                          //鏈夋晥鏈熷崟浣�(鏃ャ�佹湀銆佸勾)
+                ordrlist.HEXPPERIOD = double.Parse(dt.Rows[i]["HEXPPERIOD"].ToString());        //鏈夋晥鏈熷��
 
-                if(HSourceBillType == "鏀舵枡閫氱煡鍗�")
+                if (HSourceBillType == "鏀舵枡閫氱煡鍗�")
                 {
-                    if (oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�")
+                    ordrlist.HAuxPropID = dt.Rows[i]["HAuxPropID"].ToString();
+                    ordrlist.HAuxPropNumber = dt.Rows[i]["杈呭姪灞炴�т唬鐮�"].ToString();
+                    ordrlist.HAuxPropName = dt.Rows[i]["杈呭姪灞炴��"].ToString();
+                    if (oSystemParameter.omodel.WMS_CampanyName.Contains("鍥涚淮灏�"))
+                    {
+
+                    }
+                    else if (oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�")
                     {
                         ordrlist.HFurnaceNO = dt.Rows[i]["鐐夊彿"].ToString();
                         ordrlist.HCoilNO = dt.Rows[i]["閽㈠嵎鎹嗗寘鍙�"].ToString();
                         ordrlist.HheatNO = dt.Rows[i]["鐑鐞�"].ToString();
                     }
+                    
                 }
 
                 if (HBarCodeType == "浠櫒澶栬喘浠舵潯鐮佸鍣ㄨ鍒�")
@@ -592,6 +753,8 @@
                         {
                             ordrlist.HGiveAwayFlag = 0;
                         }
+                        ordrlist.HSeOrderBillNo = dt.Rows[i]["閿�鍞鍗曞彿"].ToString();
+                        ordrlist.HSeOrderSEQ = int.Parse(dt.Rows[i]["閿�鍞鍗曡鍙�"].ToString());
                     }
                     if (HSourceBillType == "鏀舵枡閫氱煡鍗�" || HSourceBillType == "閲囪喘璁㈠崟")
                     {
@@ -771,9 +934,9 @@
                 string CampanyName = sArray[4].ToString()=="xxx"?"": sArray[4].ToString();
                 string UserName = sArray[5].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))
@@ -902,6 +1065,10 @@
             string HCusMaterName = ""; //瀹㈡埛鐗╂枡鍚嶇О
             string HCheckEmpName = ""; //妫�楠屽憳鍚嶇О
 
+            string HSupNumber = ""; // 渚涘簲鍟嗙紪鐮�
+            string HPOInStockBillNo = ""; // 鏀舵枡閫氱煡鍗曞彿
+
+            string HPOOrderBillNo = ""; // 閲囪喘璁㈠崟鍙�
             DataSet Ds;
             msg2 = msg2.Replace("\\", "");
             msg2 = msg2.Replace("\n", "");  //\n
@@ -912,6 +1079,7 @@
                 if (ClsPub.isLong(ordrlist[j].HMaterID) != 0)
                 {
                     HNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterID);
+                    HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HSupNumber);//渚涘簲鍟�
                     HMaterNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HMaterNumber);
                     HBatchNo = ClsPub.isStrNull(ordrlist[j].HBatchNo);
 
@@ -949,6 +1117,11 @@
                     HICMOBillNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HSourceBillNo); //鐢熶骇璁㈠崟鍙凤紙澶忓疂鐢靛櫒锛�
                     HBarCodeBatchNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HPinfanBarCode); //鏉$爜鎵规鍙凤紙澶忓疂鐢靛櫒锛�
                     HBarCodeDate = DBUtility.ClsPub.isStrNull(ordrlist[j].HSupNumber); //鏉$爜鏃ユ湡锛堝瀹濈數鍣級
+                    
+                    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();
@@ -1048,6 +1221,38 @@
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                 LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
+                        }
+                        else if (CampanyName.Contains("鍏磋揪"))
+                        {
+
+                            // 鍏磋揪鏉$爜
+                            //鏉$爜鍓嶇紑 = 鏀舵枡閫氱煡鍗曞彿 + 渚涘簲鍟嗙紪鐮� + 骞� + 鏈� + 鏃� + 3浣嶆祦姘村彿
+                            
+                            sTMNumber = HPOInStockBillNo + "@" + HSupNumber + "@" + sYear + sPeriod + sDay;
+                            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("灏忓崼"))
+                        {
+                            if(HSourceBillTypeName== "閲囪喘璁㈠崟")
+                            {
+                               
+                                //鏉$爜瑙勫垯涓猴細鐗╂枡缂栫爜-渚涘簲鍟嗙紪鐮�-鏉ユ枡鎵瑰彿-鏉ユ枡鏁伴噺-閲囪喘璁㈠崟缂栫爜
+                                sTMNumber = HMaterNumber + "-" + HSupNumber + "-" + HBatchNo + "-" + HBQty + "-" + HPOInStockBillNo;
+
+                                Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+                            }
+                            else
+                            {
+                                // 灏忓崼鐢靛櫒
+                                // 鏉$爜鍓嶇紑 = 鍗曟嵁鍙� + 鐗╂枡缂栫爜 + 鎵规鍙�
+                                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  //閫氱敤鏂规硶
                         {
@@ -1246,7 +1451,7 @@
                                 TM = HNumber + "@" + sHMTONo.Replace(" ","") + "@" + HBatchNo.Replace(" ","") + "@" + sHQty;
                             }
                         }
-
+                        
                         barcode.HBarCode2 = TM;
                         barcode.HEntryID2 = ClsPub.isStrNull(j + 1);
                         barcode.HMaterID2 = ordrlist[j].HMaterID;
@@ -1387,6 +1592,7 @@
                         {
                             HBarCode = HBarCode + ClsPub.isStrNull(ListRows[i].HMTONo2);
                         }
+                       
                         //
                         HMaterID = ClsPub.isLong(ListRows[i].HMaterID2);
                         HEntryID = ClsPub.isLong(ListRows[i].HEntryID2);
@@ -1647,9 +1853,11 @@
                         ",@HFactory = N'" + HFactory + "'" +
                         ",@HCoilNO = N'" + HCoilNO + "'" +
                         ",@HFurnaceNO = N'" + HFurnaceNO + "'" +
-                        ",@HInnerBillNo = N'" + ordrlist[0].HSourceBillNo + "'"
+                        ",@HInnerBillNo = N'" + ordrlist[0].HInnerBillNo + "'" + 
+                        ",@HSourceBillType = N'" + ordrlist[0].HBillType + "'" + 
+                        ",@HStockOrg = N'" + HOrgType + "'" + 
+                        ",@HInterID = N'" + ordrlist[0].HInterID + "'"
                         , "h_p_SC_BarCode_Transfer");
-
                     if((bool)ds1.Tables[0].Rows[0]["returntype"] == true)
                     {
                         objJsonResult.code = "1";
@@ -1671,6 +1879,285 @@
                 return objJsonResult;
             }
             return objJsonResult;
+        }
+        #endregion
+
+        #region 鏉$爜杞瓨鏉$爜涓绘。(鎵归噺)
+        /// <summary>
+        /// 鏉$爜杞瓨鏉$爜涓绘。(鎵归噺)
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_BarCode/SaveBarCode_NoGenerate_Batch")]
+        [HttpPost]
+        public object SaveBarCode_NoGenerate_Batch([FromBody] JObject msg)
+        {
+            try
+            {
+                var _value = msg["msg"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.None);
+                string msg2 = sArray[0].ToString();
+                string HOrgType = sArray[1].ToString();
+                string HSourceBillTypeName = sArray[2].ToString();
+                string HSelectBarCodeType = sArray[3].ToString();
+                string CampanyName = sArray[4].ToString() == "xxx" ? "" : sArray[4].ToString();
+                string UserName = sArray[5].ToString();
+                string barCodeNoStrs = sArray[6].ToString(); // 杩欓噷鐨勬潯鐮佹槸涓庢彁浜ょ殑鍗曟嵁搴忓垪瀵瑰簲鐨勬潯鐮佹暟缁�
+                string HFactory = sArray[7].ToString();
+                string HCoilNO = sArray[8].ToString();
+                string HFurnaceNO = sArray[9].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
+                {
+                    string HBarCodeType = ClsPub.isStrNull(HSelectBarCodeType);
+                    // 鏉$爜杞瓨
+                    msg2 = msg2.Replace("\\", "");
+                    msg2 = msg2.Replace("\n", "");  //\n
+                    List<HSouceOrderList> ordrlist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HSouceOrderList>>(msg2);
+                    List<string> barcodeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(barCodeNoStrs);
+                    // TODO 閫氳繃InterID 鍜� EntryID 浠庢潯鐮佹。妗堜腑鏌ヨ鏄惁鏈夊凡鐢熸垚鐨勫崟鎹� 閲嶆柊鍐欎竴涓瓨鍌ㄨ繃绋嬶紝褰撳凡瀛樺湪瀵瑰簲鐨勬潯鐮佸崟鎹椂锛岃繑鍥炴潯鐮佷富妗d腑鐨勬潯鐮佹。妗�
+                    DataSet dsCache = oCN.RunProcReturn($@"select * from h_v_IF_BarCodeBillList a 
+                                                    Inner Join Gy_BarCodeBill b on a.HItemID = b.HItemID
+                                                    where b.HSourceINterID = { ordrlist[0].HMainID } and b.HSourceEntryID = {ordrlist[0].HSubID}"
+                                                        , "h_v_IF_BarCodeBillList");
+                    if(dsCache.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "2";
+                        objJsonResult.count = 1;
+                        objJsonResult.data = dsCache.Tables[0];
+                        objJsonResult.Message = "鏉$爜宸插瓨鍦�!";
+                        return objJsonResult;
+                    }
+                    DataSet ds1 = new DataSet();
+                    for(int i=0; i<ordrlist.Count; i++)
+                    {
+
+                        long HSourceInterID = string.IsNullOrEmpty(ordrlist[i].HMainID) == true ? 0 : ClsPub.isLong(ordrlist[0].HMainID);
+                        long HSourceEntryID = string.IsNullOrEmpty(ordrlist[i].HSubID) == true ? 0 : ClsPub.isLong(ordrlist[0].HSubID);
+
+                        ds1 = oCN.RunProcReturn("exec h_p_SC_BarCode_Transfer " +
+                        "@HBarCodeNo = N'" + barcodeList[i] + "'" +
+                        ",@HSubID = " + ordrlist[i].HSubID +
+                        ",@HMaterID = " + ordrlist[i].HMaterID +
+                        ",@HGiveAwayFlag = " + ordrlist[i].HGiveAwayFlag +
+                        ",@HQty = " + ordrlist[i].HQty +
+                        ",@HUnitID = " + ordrlist[i].HUnitID +
+                        ",@HMinQty = " + ordrlist[i].HMinQty +
+                        ",@HSupID = " + ordrlist[i].HSupID +
+                        ",@HBatchNo = N'" + ordrlist[i].HBatchNo + "'" +
+                        ",@HMTONO = N'" + ordrlist[i].HMTONo + "'" +
+                        ",@HBarCodeDate = N'" + ordrlist[i].HDate + "'" +
+                        ",@HEmpID = " + ordrlist[i].HEmpID +
+                        ",@HSourceInterID = " + HSourceInterID +
+                        ",@HSourceEntryID = " + HSourceEntryID +
+                        ",@HBarCodeType = N'" + HBarCodeType + "'" +
+                        ",@HSourceBillNo = N'" + ordrlist[i].HSourceBillNo + "'" +
+                        ",@HMaker = N'" + ordrlist[i].HMaker + "'" +
+                        ",@HFactory = N'" + HFactory + "'" +
+                        ",@HCoilNO = N'" + HCoilNO + "'" +
+                        ",@HFurnaceNO = N'" + HFurnaceNO + "'" +
+                        ",@HInnerBillNo = N'" + ordrlist[i].HInnerBillNo + "'" +
+                        ",@HSourceBillType = N'" + ordrlist[i].HBillType + "'" +
+                        ",@HStockOrg = N'" + HOrgType + "'" + 
+                        ",@HInterID = " + ordrlist[i].HInterID
+                        , "h_p_SC_BarCode_Transfer");
+                        if ((bool)ds1.Tables[0].Rows[0]["returntype"] == false)
+                        {
+                            throw new Exception(ds1.Tables[0].Rows[0]["mesg"].ToString());     
+                        }
+                    }
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = ds1.Tables[0].Rows[0]["mesg"].ToString();
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触!" + e.Message;
+                return objJsonResult;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region 鏇存柊鏉$爜瀵瑰簲鍑哄簱鐢宠鍗曞彿 鍏磋揪
+        public class BarCodeMeta
+        {
+            public string HBarCode { get; set; }
+            public string HBatchNo { get; set; }
+            public string HMaterModel  { get; set; }
+            public string HMaterName  { get; set; }
+            public float HQty  { get; set; }
+            public string HSCSPName { get; set; }
+            public string HSCWHName { get; set; }
+            public string HSPName { get; set; }
+            public float HTMQty { get; set; }
+            public string HUnitName { get; set; }
+            public string HWHName { get; set; }
+        }
+
+        [Route("Sc_BarCode/Set_BarCodeBill")]
+        [HttpPost]
+        public object Set_BarCodeBill([FromBody] JObject msg)
+        {
+
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.None);
+            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
+            {
+                for(int i = 0; i < BarCodeMetaList.Count; i++)
+                {
+                    if (HBillType == "1205") // 閿�鍞嚭搴�
+                    {
+
+                        if (HOrgName.Contains("鍏磋揪") && !string.IsNullOrEmpty(HBillNo))
+                        {
+                            // 鍏磋揪 閿�鍞嚭搴撴洿鏂� 鍙戣揣閫氱煡鍗�
+                            oCN.RunProcReturn("Update Gy_BarCodeBill set " +
+                            "HSeOutStockBillNo='" + HBillNo + "' where HBarCode = '" + BarCodeMetaList[i].HBarCode + "'", "Gy_BarCodeBill");
+                        }
+                        
+                    }
+                }
+                
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "";
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇敼澶辫触!" + e.Message;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [鑾峰彇鏍囩鎵撳嵃鎸囦护 CPCL鎸囦护]
+        [Route("Sc_BarCode/Get_BarCodePrintCode_CPCL")]
+        [HttpGet]
+        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'" + 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");
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = resultMesg;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鎵撳嵃鎸囦护鑾峰彇澶辫触!" + ds.Tables[0].Rows[0]["payload"];
+                    return objJsonResult;
+                }
+            }
+            catch(Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵撳嵃鎸囦护鑾峰彇澶辫触!" + e.Message;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [APP 鑾峰彇鎵撳嵃妯℃澘]
+        public class PrintTemplate
+        {
+            public int Id { get; set; }
+            public string OrgShort { get; set; }
+            public string HBillSubtype { get; set; }
+            public string Format { get; set; }
+            public string Description { get; set; }
+            public string[] Placeholder { get; set; }
+        }
+
+        [Route("Sc_BarCode/Get_BarCodeGenTemplate")]
+        [HttpGet]
+        public object Get_BarCodeGenTemplate(string HOrginationName, string HBillSubType)
+        {
+            try
+            {
+
+                string filePath = HttpContext.Current.Server.MapPath("~/Template");
+                string fileFullPath = Path.Combine(filePath, "barCodeTemplateStorage.json");
+
+                if (!File.Exists(fileFullPath))
+                {
+
+                    throw new Exception($"妯℃澘鏂囦欢涓嶅瓨鍦細{fileFullPath}");
+                }
+
+                string jsonContent = File.ReadAllText(fileFullPath);
+                PrintTemplate[] templates = JsonConvert.DeserializeObject<PrintTemplate[]>(jsonContent);
+                PrintTemplate targetTemplate = templates.FirstOrDefault<PrintTemplate>(t => HOrginationName.Contains(t.OrgShort) && string.Equals(t.HBillSubtype, HBillSubType));
+                if (targetTemplate != null)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.data = JsonConvert.SerializeObject(targetTemplate);
+                    return objJsonResult;
+                }
+                else
+                {
+                    throw new Exception($"娌℃湁鎵惧埌瀵瑰簲鐨勬ā鏉�");
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵撳嵃妯℃澘鑾峰彇澶辫触!" + e.Message;
+                return objJsonResult;
+            }
         }
         #endregion
 
@@ -2176,6 +2663,9 @@
                 //澧炲姞 鏉$爜瓒呰繃鏈敓鎴愬姛鑳芥帶鍒�
 
                 //
+                //鑷姩瑁呯
+                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
@@ -2212,6 +2702,1025 @@
             }
         }
         #endregion
+
+        #region [鏉$爜鐢熸垚鎺ュ彛-閿﹂殕]
+        [Route("Sc_BarCode/Sub_SaveBill_JinLong")]
+        [HttpPost]
+        public object Sub_SaveBill_JinLong([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 = sArray[2].ToString();                              //婧愬崟绫诲瀷鍚嶇О
+                string CampanyName = sArray[3].ToString() == "xxx" ? "" : sArray[4].ToString(); //鍔犲伐宸ュ巶鍚嶇О
+                string UserName = sArray[4].ToString();                                         //鐧诲綍璐﹀彿
+                ClsPub.CurUserName = UserName;
+
+                string HSelectBarCodeType = "鍞竴鏉$爜";                                         //鏉$爜绫诲瀷
+
+                //鑾峰彇鍐呯爜
+                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;
+                }
+
+                //鐢熸垚鏉$爜
+                SaveBarCode_JinLong(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[鏉$爜鐢熸垚鏂规硶_閿﹂殕]
+        private object SaveBarCode_JinLong(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
+            List<HSouceOrderList> ordrlist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HSouceOrderList>>(msg2);
+            List<HBarCodeList> ListRows = new List<HBarCodeList>();
+
+            DataSet Ds;
+            for (int i = 0; i < ordrlist.Count; i++)
+            {
+                HSourceBillType_Temp = ordrlist[i].HBillType;
+
+                if (ClsPub.isLong(ordrlist[i].HMaterID) != 0)
+                {
+                    if (HSelectBarCodeType == "鍞竴鏉$爜")
+                    {
+                        //鎷嗗垎姣忔潯鐗╂枡璁板綍涓哄鏉℃潯鐮佽褰�
+                        double HSumQty = ClsPub.isDoule(ordrlist[i].HQty);                                                                      //浜у搧鏁伴噺
+                        double HQty = ClsPub.isDoule(ordrlist[i].HQty);                                                                         //鏁伴噺
+                        double HMinQty = ClsPub.isDoule(ordrlist[i].HMinQty);                                                                   //鏈�灏忓寘瑁呮暟
+                        int HBQty = ClsPub.isInt(ordrlist[i].HBQty);                                                                            //绠辨暟
+                        string WeiShu = "";                                                                                                     //灏炬暟
+
+                        for (int j = 0; j < HBQty; j++)
+                        {
+                            //鍗曚釜鏉$爜鏁伴噺
+                            if (HSumQty - HMinQty > 0)
+                            {
+                                WeiShu = "";
+                                HSumQty = HSumQty - HMinQty;
+                            }
+                            else
+                            {
+                                if (HSumQty == HMinQty)
+                                {
+                                    WeiShu = "";
+                                }
+                                else
+                                {
+                                    WeiShu = "灏炬暟";
+                                }
+                                HMinQty = HSumQty;
+                            }
+
+                            string HBarCode_Temp = "";                                                                                          //鏉$爜
+                            string sTMNumber = "";                                                                                              //鏉$爜鍓嶇紑
+                            string LSH = "";                                                                                                    //鏈�澶ф祦姘村彿
+                            int HLen = 4;                                                                                                       //娴佹按鍙烽暱搴�
+
+                            //鏉$爜鎷兼帴鎵�闇�瀛楁
+                            string HPOOrderBillMTO_TMN = DBUtility.ClsPub.isStrNull(ordrlist[i].HPOOrderBillMTO);                               //閲囪喘璺熻釜鍙�
+
+                            //鏉$爜鍓嶇紑 = 閲囪喘璺熻釜鍙�
+                            sTMNumber = HPOOrderBillMTO_TMN;
+
+                            //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
+                            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);
+
+                            //鏉$爜缂栧彿 = 閲囪喘璺熻釜鍙� + 鐗╂枡浠g爜 + 鐢熶骇鏃ユ湡(yyyy/MM/dd) + 鍗曠鏁伴噺 + 4浣嶆祦姘村彿
+                            string HMaterNumber_BarCode = DBUtility.ClsPub.isStrNull(ordrlist[i].HMaterNumber);
+                            string HInspectionDate_BarCode = DBUtility.ClsPub.isStrNull(ordrlist[i].HInspectionDate).Replace("-", "/");
+                            string HQty_BarCode = ClsPub.isStrNull(HMinQty);
+                            HBarCode_Temp = HPOOrderBillMTO_TMN + "|" + HMaterNumber_BarCode + "|" + HInspectionDate_BarCode + "|" + HQty_BarCode + "|" + LSH;
+
+                            HBarCodeList barcode = new HBarCodeList();
+                            barcode.HSourceBillSEQ = ordrlist[i].HSourceBillSEQ;  // 婧愬崟琛屽彿
+                            barcode.HBarCode2 = HBarCode_Temp;
+                            barcode.HBarCodeType2 = "鍞竴鏉$爜";
+                            barcode.HBarCodeSubType2 = "";
+                            barcode.HEntryID2 = ClsPub.isStrNull(i + 1);
+                            barcode.HMaterID2 = ordrlist[i].HMaterID;
+                            barcode.HMaterNumber2 = ordrlist[i].HMaterNumber;
+                            barcode.HMaterName2 = ordrlist[i].HMaterName;
+                            barcode.HMaterModel2 = ordrlist[i].HMaterModel;
+                            barcode.HPinfan2 = ordrlist[i].HPinfan;
+                            barcode.HPinfanBarCode2 = ordrlist[i].HPinfanBarCode;
+                            barcode.HAuxPropID2 = ordrlist[i].HAuxPropID;
+                            barcode.HAuxPropNumber2 = ordrlist[i].HAuxPropNumber;
+                            barcode.HAuxPropName2 = ordrlist[i].HAuxPropName;
+                            barcode.HUnitID2 = ordrlist[i].HUnitID;
+                            barcode.HUnitNumber2 = ordrlist[i].HUnitNumber;
+                            barcode.HUnitName2 = ordrlist[i].HUnitName;
+                            barcode.HQty2 = ClsPub.isStrNull(HMinQty);
+                            barcode.HBatchNo2 = ordrlist[i].HBatchNo;
+                            barcode.HSourceInterID2 = ordrlist[i].HMainID;
+                            barcode.HSourceEntryID2 = ordrlist[i].HSubID;
+                            barcode.HSourceBillNo2 = ordrlist[i].HBillNo;
+                            barcode.HSourceBillType2 = ordrlist[i].HBillType;
+                            barcode.HPrint = "0";
+                            barcode.HWei = WeiShu;
+                            barcode.HBarcodeNo = ClsPub.isStrNull(n + 1);
+                            barcode.HBarcodeQtys = ordrlist[i].HBQty;
+                            barcode.HSupID2 = ordrlist[i].HSupID;
+                            barcode.HSupNumber2 = ordrlist[i].HSupNumber;
+                            barcode.HSupName2 = ordrlist[i].HSupName;
+                            barcode.HDeptID2 = ordrlist[i].HDeptID;
+                            barcode.HDeptNumber2 = ordrlist[i].HDeptNumber;
+                            barcode.HDeptName2 = ordrlist[i].HDeptName;
+                            barcode.HRemark2 = ordrlist[i].HRemark;
+                            barcode.HDate2 = ordrlist[i].HDate;
+                            barcode.HShowDate2 = ordrlist[i].HShowDate;
+                            barcode.HWhID2 = ordrlist[i].HWhID;
+                            barcode.HWhNumber2 = ordrlist[i].HWhNumber;
+                            barcode.HWhName2 = ordrlist[i].HWhName;
+                            barcode.HSPID2 = ordrlist[i].HSPID;
+                            barcode.HSPNumber2 = ordrlist[i].HSPNumber;
+                            barcode.HSPName2 = ordrlist[i].HSPName;
+                            barcode.HMTONo2 = ordrlist[i].HMTONo;
+                            barcode.HCusID2 = ordrlist[i].HCusID;
+                            barcode.HCusNumber2 = ordrlist[i].HCusNumber;
+                            barcode.HCusName2 = ordrlist[i].HCusName;
+                            barcode.HCusType2 = ordrlist[i].HCusType;
+                            barcode.HSourceID2 = ordrlist[i].HSourceID;
+                            barcode.HSourceNumber2 = ordrlist[i].HSourceNumber;
+                            barcode.HSourceName2 = ordrlist[i].HSourceName;
+                            barcode.HEndDate2 = ordrlist[i].HEndDate;
+                            barcode.HSeOrderBillNo2 = ordrlist[i].HSeOrderBillNo;
+                            barcode.HInnerBillNo2 = ordrlist[i].HInnerBillNo;
+                            barcode.HMaker2 = ordrlist[i].HMaker;
+                            barcode.HGiveAwayFlag2 = ordrlist[i].HGiveAwayFlag;
+                            barcode.HCoilNO = ordrlist[i].HCoilNO;
+                            barcode.HFurnaceNO = ordrlist[i].HFurnaceNO;
+                            barcode.HFactory = ordrlist[i].HFactory;
+                            barcode.HAuxQty = ordrlist[i].HAuxQty;
+                            barcode.HheatNO = ordrlist[i].HheatNO;
+                            barcode.HGroupID2 = ordrlist[i].HGroupID;
+                            barcode.HEmpID2 = ordrlist[i].HEmpID;
+                            barcode.HCusModel2 = ordrlist[i].HCusModel;
+                            barcode.HCusMaterName2 = ordrlist[i].HCusMaterName;
+                            barcode.HCheckEmpName2 = ordrlist[i].HCheckEmpName;
+                            barcode.HReInspectionFlag = ordrlist[i].HReInspectionFlag ? 1 : 0;
+                            barcode.HInspectionDate = ordrlist[i].HInspectionDate;
+                            barcode.HInspectionCycle = ordrlist[i].HReInspectionFlag ? ordrlist[i].HInspectionCycle : 0;
+                            barcode.HReInspectionDate = ordrlist[i].HReInspectionFlag ? ordrlist[i].HReInspectionDate : null;
+                            barcode.HPOOrderBillMTO = DBUtility.ClsPub.isStrNull(ordrlist[i].HPOOrderBillMTO);
+                            barcode.HSeOrderBillNo2 = DBUtility.ClsPub.isStrNull(ordrlist[i].HSeOrderBillNo);
+                            barcode.HCusModel2 = DBUtility.ClsPub.isStrNull(ordrlist[i].HCusModel);
+                            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);
+                        int HReInspectionFlag = ClsPub.isInt(ListRows[i].HReInspectionFlag);
+                        string HInspectionDate = ListRows[i].HInspectionDate;
+                        int HInspectionCycle = ClsPub.isInt(ListRows[i].HInspectionCycle);
+                        string HReInspectionDate = ListRows[i].HInspectionDate;
+                        int HSourceBillSEQ = ClsPub.isInt(ListRows[i].HSourceBillSEQ);
+                        string HCustomBatchNo = ClsPub.isStrNull(ListRows[i].HInspectionDate).Replace("-","");
+                        string HBarCodeStatus = "姝e父";
+                        string HPOOrderBillNoMTO = ClsPub.isStrNull(ListRows[i].HPOOrderBillMTO);
+                        string sql_produceBarCode = "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,HCustomBatchNo,HBarCodeStatus,HOrderBillNo" +
+                                    ",HReInspectionFlag,HInspectionDate,HInspectionCycle,HReInspectionDate,HSourceBillSEQ " +
+                                    ") 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 + "','" + HCustomBatchNo + "','" + HBarCodeStatus + "','" + HPOOrderBillNoMTO + "'" +
+                                    "," + HReInspectionFlag + "," + (HInspectionDate == null ? "null" : "'" + HInspectionDate + "'") + "," + HInspectionCycle + "," + (HReInspectionDate == null ? "null" : "'" + HReInspectionDate + "'") +
+                                    "," + HSourceBillSEQ +
+                                    ")";
+
+                        oCN.RunProc(sql_produceBarCode);
+
+                    }
+                }
+                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
+
+        #region [app 鏉$爜鎷嗙爜鑾峰彇瀛愭潯鐮乚
+        [Route("Sc_BarCode/SplitBarCode_Sub")]
+        [HttpGet]
+        public object SplitBarCode_Sub(string HBarCodeNo)
+        {
+            try
+            {
+                if (string.IsNullOrWhiteSpace(HBarCodeNo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇疯緭鍏ユ潯鐮佺紪鍙�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                // 鍘荤┖鏍�
+                string cleanBarCode = HBarCodeNo.Trim();
+                string prefix = cleanBarCode + "-"; // 鐢ㄤ簬鏌ュ瓙鐮�
+
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+
+                // 1. 鍏堟煡鐩存帴瀛愮爜锛堜竴绾у瓙鐮侊細xxx-1, xxx-2, ...锛�
+                string sqlSub = @"SELECT * FROM h_v_Gy_SplitBarCode WITH(NOLOCK) WHERE HBarCode LIKE '" + prefix + @"%' 
+                AND HBarCode NOT LIKE '" + prefix + @"%-%'
+                AND ISNUMERIC(RIGHT(HBarCode, LEN(HBarCode) - LEN('" + prefix + @"'))) = 1
+                AND TRY_CAST(RIGHT(HBarCode, LEN(HBarCode) - LEN('" + prefix + @"')) AS INT) IS NOT NULL";
+
+                DataSet ds = oCn.RunProcReturn(sqlSub, "Gy_BarCodeBill");
+
+                // 2. 濡傛灉鏈夊瓙鐮� 鈫� 杩斿洖瀛愮爜 + 涓嬩竴涓紪鍙�
+                if (ds != null && ds.Tables[0].Rows.Count > 0)
+                {
+                    int maxSuffix = 0;
+                    foreach (DataRow row in ds.Tables[0].Rows)
+                    {
+                        string barCode = row["HBarCode"].ToString();
+                        string suffix = barCode.Substring(prefix.Length);
+                        if (int.TryParse(suffix, out int num) && num > maxSuffix)
+                            maxSuffix = num;
+                    }
+
+                    string nextBarCode = $"{cleanBarCode}-{maxSuffix + 1}";
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = ds.Tables[0].Rows.Count;
+                    objJsonResult.Message = "鏌ヨ鎴愬姛锛岃繑鍥炵洿鎺ュ瓙鐮�";
+                    objJsonResult.data = new
+                    {
+                        SubBarCodes = ds.Tables[0],
+                        NextBarCode = nextBarCode
+                    };
+                }
+                else
+                {
+                    // 3. 娌℃湁瀛愮爜 鈫� 鏌ヨ嚜宸�
+                    string sqlSelf = @"SELECT * FROM h_v_Gy_SplitBarCode WITH(NOLOCK)  WHERE HBarCode = '" + cleanBarCode.Replace("'", "''") + "'";
+
+                    DataSet dsSelf = oCn.RunProcReturn(sqlSelf, "Gy_BarCodeBill");
+
+                    if (dsSelf != null && dsSelf.Tables[0].Rows.Count > 0)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "璇ユ潯鐮佹棤瀛愮爜锛岃繑鍥炶嚜韬�";
+                        objJsonResult.data = new
+                        {
+                            SubBarCodes = dsSelf.Tables[0],
+                            NextBarCode = $"{cleanBarCode}-1"  // 寤鸿浠� -1 寮�濮�
+                        };
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鏉$爜涓嶅瓨鍦紝璇锋鏌�";
+                        objJsonResult.data = null;
+                    }
+                }
+
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + ex.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [app鏉$爜鎷嗙爜鐢熸垚]
+        [Route("Sc_BarCode/SplitBarCode_Save")]
+        [HttpPost]
+        public object SplitBarCode_Save([FromBody] JObject msg)
+        {
+            try
+            {
+                ListModels oListModels = new ListModels();
+                DAL.ClsGy_BarCodeBill_ChaiMa BillNew = new DAL.ClsGy_BarCodeBill_ChaiMa();
+                var _value = msg["msg"].ToString();
+                string msg1 = _value.ToString();
+
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string barcode = sArray[0].ToString(); //鏉$爜缂栧彿
+                Double splitnum = Convert.ToDouble(sArray[1]); //鎷嗙爜鏁伴噺
+                string data = sArray[2].ToString(); //琛ㄤ綋鏁版嵁
+                string user = sArray[3].ToString(); //鐢ㄦ埛鍚�
+
+                data = data.Replace("\\", "");
+                data = data.Replace("\n", "");  //\n
+
+                List<Model.ClsGy_BarCodeEdit_Model> lsmain = new List<Model.ClsGy_BarCodeEdit_Model>();
+                lsmain = oListModels.getObjectByJson_Gy_SplitBarCode(data);
+
+                oCN.BeginTran();
+
+                ds = oCN.RunProcReturn("select top 1 * from Gy_BarCodeBill where HBarCode='" + barcode + "'", "Gy_BarCodeBill");
+              
+                if (ds != null || ds.Tables[0].Rows.Count > 0)
+                {
+
+                    string sql = "insert into Gy_BarCodeBill (HInterID, HEntryID, HBarCode, HBarCodeType, HBarCodeSubType, HMaterID, HUnitID, HQty, HBatchNo, HSupID, HGroupID, HMaker, HMakeDate, " +
+                  "HPrintQty, HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HinitQty, HEndQty, HBarcodeQtys, HBarcodeNo, HDeptID, HWhID, HSPID, HRemark, " +
+                  "HCusID, HCusType, HEndDate, HWorkLineName, HBarCodeDate, HSTOCKORGID, HOWNERID, HSeOrderBillNo, HGiveAwayFlag, HMaterName, HMaterModel, " +
+                  "HPinfan, HAuxPropID, HMTONo, HInnerBillNo, HCoilNO, HFurnaceNO, HFactory, HAuxQty, HheatNO, HProduceDate, HExpiryDate, HEmpID, HCusModel, HCusMaterName, HCheckEmpName, HZZRQ,HSupMaterNumber,HSupBatchNo" +
+                  ") values (" +
+                  "'" + ds.Tables[0].Rows[0]["HInterID"].ToString() + "', " +
+                  "'" + (int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1).ToString() + "', " +
+                  "'" + lsmain[0].HBarCode.ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HBarCodeType"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HBarCodeSubType"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HMaterID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HUnitID"].ToString() + "', " +
+                  "'" + splitnum + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HBatchNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSupID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HGroupID"].ToString() + "', " +
+                  "'" + user + "', getdate(), " +
+                  "'" + ds.Tables[0].Rows[0]["HPrintQty"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSourceInterID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSourceEntryID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSourceBillNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSourceBillType"].ToString() + "', " +
+                  "'" + splitnum + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HEndQty"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HBarcodeQtys"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HBarcodeNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HDeptID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HWhID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSPID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HRemark"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCusID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCusType"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HEndDate"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HWorkLineName"].ToString() + "', " +
+                  "getdate()," +
+                  "'" + ds.Tables[0].Rows[0]["HSTOCKORGID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HOWNERID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSeOrderBillNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HGiveAwayFlag"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HMaterName"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HMaterModel"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HPinfan"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HAuxPropID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HMTONo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HInnerBillNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCoilNO"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HFurnaceNO"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HFactory"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HAuxQty"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HheatNO"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HProduceDate"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HExpiryDate"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HEmpID"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCusModel"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCusMaterName"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HCheckEmpName"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HZZRQ"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSupBatchNo"].ToString() + "', " +
+                  "'" + ds.Tables[0].Rows[0]["HSupMaterNumber"].ToString() + "'" +
+                  ")";
+                    //鎻掑叆鎷嗗垎鏉$爜
+                    oCN.RunProc(sql);
+                    //鏇存柊鑰佹潯鐮佺殑HQty鏁伴噺
+                    oCN.RunProc("update  Gy_BarCodeBill set HQty= HQty-'"+splitnum+"' where HItemID="+ ds.Tables[0].Rows[0]["HItemID"].ToString());
+
+
+
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+
+                }
+                else
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛佹湭鏌ヨ鍒版潯鐮佷俊鎭�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }               
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [app 鏉$爜鎷嗙爜鑾峰彇鎷嗙爜鎵撳嵃鏁版嵁]
+        [Route("Sc_BarCode/GetSplitBarCode_SubList")]
+        [HttpGet]
+        public object GetSplitBarCode_SubList(string HBarCodeNo)
+        {
+            try
+            {
+                if (string.IsNullOrWhiteSpace(HBarCodeNo))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇疯緭鍏ユ潯鐮佺紪鍙�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }                
+
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+
+
+                var sql = "select * from h_v_Gy_BarCodeBillList_APP where 鏉$爜缂栧彿='"+ HBarCodeNo + "'";
+
+                DataSet ds = oCn.RunProcReturn(sql, "h_v_Gy_BarCodeBillList_APP");
+
+                //鍒ゆ柇鏉$爜鏄惁瀛樺湪鏉$爜妗f
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "[0000-1-037]鏌ヨ鎴愬姛";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "[0000-1-010]娌℃湁杩斿洖浠讳綍璁板綍锛佸綋鍓嶆潯鐮佷笉瀛樺湪鏉$爜妗f";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                return objJsonResult;
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "寮傚父锛�" + ex.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [鏉$爜鐢熸垚鎺ュ彛_灏忓崼闀洉鐮乚
+        [Route("Sc_BarCode/SaveSNByICMO_XW")]
+        [HttpGet]
+        public object SaveSNByICMO_XW(String HBillNo,string HSN, int HBeginNo, int HEndNo, int HCount,string HMachineCode)
+        {
+            try
+            {
+                //if(oWebs.GetWebAPIToLocal_ICMO(HBillNo, "3710", "admin", ref DBUtility.ClsPub.sErrInfo)==false)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "[0000-2-020]鍗曟嵁鍚屾澶辫触璇疯仈绯荤鐞嗗憳,"+ DBUtility.ClsPub.sErrInfo;
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //else
+                //{
+                ds = oCN.RunProcReturn("exec h_p_WMS_SaveSNByICMO_XW '" + @HBillNo + "','" + HSN +"',"+HBeginNo+","+HEndNo+","+HCount+",'"+HMachineCode+"'", "h_p_WMS_SaveSNByICMO_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 = "[0000-2-020]鏉$爜缁戝畾澶辫触锛�"+ 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        
+
+
+        #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();//鐢ㄦ埛
+                string barCode_middle = sArray[3].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, barCode_middle);
+                }
+            }
+            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,string barCode_middle)
+        {
+            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;
+            DataSet Ds2;
+            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(".", "");             //渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級
+                            
+                            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爜
+                            HBarCode_Temp = dds.Tables[0].Rows[0]["HRemark"].ToString();
+
+                            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

--
Gitblit v1.9.1