From 1a94e0e270668ef1cfbcd5043b72bc6591a50706 Mon Sep 17 00:00:00 2001
From: llj <132905093+newwwwwwtree@users.noreply.github.com>
Date: 星期四, 07 八月 2025 15:18:46 +0800
Subject: [PATCH] 价目表新增审核按钮无效修理bug

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |  786 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 739 insertions(+), 47 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 81390b2..d7abb7d 100644
--- "a/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
+++ "b/WebAPI/Controllers/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Sc_BarCodeController.cs"
@@ -129,7 +129,12 @@
                 }
                 else if (sCapName == "娣诲悍绉戞妧")
                 {
+                    list.Add("鍞竴鏉$爜");
                     list.Add("鎵规鏉$爜");
+                }
+                else if (sCapName == "娴疯瘹")
+                {
+                    list.Add("鍝佺鏉$爜");
                 }
                 else
                 {
@@ -158,7 +163,7 @@
         #region [閫氳繃婧愬崟绫诲瀷鏌ユ壘涓嶉�氬崟鎹俊鎭痌
         [Route("Sc_BarCode/ReportFromBillList")]
         [HttpGet]
-        public object ReportFromBillList(int page, int limit, string sWhere,string HSouceBillType,string HOrgID)
+        public object ReportFromBillList(int page, int limit, string sWhere, string HSouceBillType, string HOrgID)
         {
             oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
             List<object> columnNameList = new List<object>();
@@ -171,7 +176,7 @@
                 string tabname = "";
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    sWhere = " where 1=1 and HOrgID='"+HOrgID+"' ";
+                    sWhere = " where 1=1 and HOrgID='" + HOrgID + "' ";
                 }
                 else
                 {
@@ -180,8 +185,8 @@
                 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;
+                        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(select row_number() over (order by 鍗曟嵁鍙�) as HRowNumber,* from h_v_IFCLD_ICMOBillList_Source " + sWhere + " and 浠诲姟鏁伴噺>isnull(鍏ュ簱鏁伴噺,0)  and 鐘舵��<>'缁撴')   as A where HRowNumber >" + pageSize + " *(" + pageNum + "-1)");
                         break;
                     case "鐢熶骇姹囨姤鍗�":
@@ -241,6 +246,11 @@
                         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;
@@ -337,7 +347,7 @@
             List<object> ListRows = new List<object>();
             try
             {
-               
+
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
                 List<DBUtility.BillSelect> oList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DBUtility.BillSelect>>(msg2);
@@ -350,7 +360,7 @@
                             //寰楀埌淇℃伅
                             ds = oCN.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList");
                             //鍐欏叆淇℃伅
-                            ListRows.Add(HSourceOrderList(ds.Tables[0],ordrlist, HBarCodeType));
+                            ListRows.Add(HSourceOrderList(ds.Tables[0], ordrlist, HBarCodeType));
                             break;
                         case "3711": //鐢熶骇姹囨姤鍗�
                             //寰楀埌淇℃伅
@@ -383,7 +393,7 @@
                             ListRows.Add(HSourceOrderList1(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
                             break;
                         case "1202": //鐢熶骇鍏ュ簱
-                             //寰楀埌淇℃伅
+                                     //寰楀埌淇℃伅
                             ds = oWebs.getDataSetBySQL("select * from h_v_IF_ProductInBillList_Source where HMainID=" + oSelectRow.BillMainID + " and HSubID=" + oSelectRow.BillSubID, "h_v_IF_ProductInBillList_Source", ref DBUtility.ClsPub.sExeReturnInfo);
                             //鍐欏叆淇℃伅
                             ListRows.Add(Sub_WriteInForm_InOut(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
@@ -422,6 +432,12 @@
                             //鍐欏叆淇℃伅
                             ListRows.Add(HSourceOrderList1(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
                             break;
+                        case "1204": //棰嗘枡鍑哄簱鍗�
+                            //寰楀埌淇℃伅
+                            ds = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_MateOutBillList " + oSelectRow.BillMainID.ToString() + "," + oSelectRow.BillSubID.ToString(), "h_p_Gy_BarCodeBill_MateOutBillList");
+                            //鍐欏叆淇℃伅
+                            ListRows.Add(HSourceOrderList1(ds.Tables[0], ordrlist, HBarCodeType, HSourceBillType));
+                            break;
                         default:
                             break;
                     }
@@ -444,7 +460,7 @@
             return objJsonResult;
         }
 
-        public object HSourceOrderList(DataTable dt, HSouceOrderList ordrlist,string HBarCodeType) 
+        public object HSourceOrderList(DataTable dt, HSouceOrderList ordrlist, string HBarCodeType)
         {
             oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
             for (int i = 0; i < dt.Rows.Count; i++)
@@ -498,7 +514,7 @@
                 {
                     ordrlist.HMinQty = dt.Rows[i]["鏈敓鎴愭潯鐮佹暟閲�"].ToString();
                 }
-                else if (HBarCodeType == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�"|| HBarCodeType == "浠櫒鎴愬搧鏉$爜瑙勫垯"|| HBarCodeType == "璇曞墏鎴愬搧鏉$爜瑙勫垯")
+                else if (HBarCodeType == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�" || HBarCodeType == "浠櫒鎴愬搧鏉$爜瑙勫垯" || HBarCodeType == "璇曞墏鎴愬搧鏉$爜瑙勫垯")
                 {
                     ordrlist.HMinQty = "1";
                 }
@@ -510,7 +526,7 @@
             return ordrlist;
         }
 
-        public object HSourceOrderList1(DataTable dt, HSouceOrderList ordrlist, string HBarCodeType,string HSourceBillType)
+        public object HSourceOrderList1(DataTable dt, HSouceOrderList ordrlist, string HBarCodeType, string HSourceBillType)
         {
             oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo);
             for (int i = 0; i < dt.Rows.Count; i++)
@@ -537,7 +553,7 @@
                 ordrlist.HRemark = dt.Rows[i]["澶囨敞"].ToString();
                 ordrlist.HMTONo = dt.Rows[i]["璁″垝璺熻釜鍙�"].ToString();
 
-                if(HSourceBillType == "鏀舵枡閫氱煡鍗�")
+                if (HSourceBillType == "鏀舵枡閫氱煡鍗�")
                 {
                     if (oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�")
                     {
@@ -560,10 +576,10 @@
                     ordrlist.HMinQty = dt.Rows[i]["鏈�灏忓寘瑁呮暟"].ToString();
                 }
                 ordrlist.HMaker = ClsPub.CurUserName;
-                if (HSourceBillType== "鏀舵枡閫氱煡鍗�"|| HSourceBillType== "閲囪喘璁㈠崟"|| HSourceBillType=="濮斿璁㈠崟"|| HSourceBillType== "閲囪喘鍏ュ簱鍗�") 
+                if (HSourceBillType == "鏀舵枡閫氱煡鍗�" || HSourceBillType == "閲囪喘璁㈠崟" || HSourceBillType == "濮斿璁㈠崟" || HSourceBillType == "閲囪喘鍏ュ簱鍗�")
                 {
                     ordrlist.HInnerBillNo = dt.Rows[i]["鍐呴儴閲囪喘璁㈠崟鍙�"].ToString();
-                    ordrlist.HSupID= dt.Rows[i]["hsupid"].ToString();
+                    ordrlist.HSupID = dt.Rows[i]["hsupid"].ToString();
                     ordrlist.HSupNumber = dt.Rows[i]["渚涘簲鍟嗕唬鐮�"].ToString();
                     ordrlist.HSupName = dt.Rows[i]["渚涘簲鍟�"].ToString();
                     if (HSourceBillType == "鏀舵枡閫氱煡鍗�")
@@ -577,14 +593,18 @@
                             ordrlist.HGiveAwayFlag = 0;
                         }
                     }
+                    if (HSourceBillType == "閲囪喘璁㈠崟")
+                    {
+                        ordrlist.HSourceBillSEQ = dt.Rows[i]["HSEQ"].ToString();
+                    }
                 }
                 if (HSourceBillType == "閫�璐ч�氱煡鍗�")
                 {
                     ordrlist.HCusID = dt.Rows[i]["HCusID"].ToString();
                     ordrlist.HCusNumber = dt.Rows[i]["瀹㈡埛浠g爜"].ToString();
-                    ordrlist.HCusName= dt.Rows[i]["瀹㈡埛"].ToString();
+                    ordrlist.HCusName = dt.Rows[i]["瀹㈡埛"].ToString();
                 }
-                if (HSourceBillType == "鍏朵粬鍏ュ簱鍗�")
+                if (HSourceBillType == "鍏朵粬鍏ュ簱鍗�" || HSourceBillType == "棰嗘枡鍑哄簱鍗�")
                 {
                     ordrlist.HWhID = dt.Rows[i]["HWhID"].ToString();
                     ordrlist.HWhNumber = dt.Rows[i]["浠撳簱浠g爜"].ToString();
@@ -593,7 +613,7 @@
                     ordrlist.HSPNumber = dt.Rows[i]["浠撲綅浠g爜"].ToString();
                     ordrlist.HSPName = dt.Rows[i]["浠撲綅"].ToString();
                 }
-                if(HSourceBillType == "閿�鍞嚭搴撳崟")
+                if (HSourceBillType == "閿�鍞嚭搴撳崟")
                 {
                     ordrlist.HWhID = dt.Rows[i]["HWhID"].ToString();
                     ordrlist.HWhNumber = dt.Rows[i]["浠撳簱浠g爜"].ToString();
@@ -640,7 +660,7 @@
                 ordrlist.HSPNumber = dt.Rows[i]["浠撲綅浠g爜"].ToString();
                 ordrlist.HSPName = dt.Rows[i]["浠撲綅"].ToString();
                 ordrlist.HMTONo = dt.Rows[i]["璁″垝璺熻釜鍙�"].ToString();
-                ordrlist.HDate = dt.Rows[i]["鏃ユ湡"].ToString(); 
+                ordrlist.HDate = dt.Rows[i]["鏃ユ湡"].ToString();
                 ordrlist.HShowDate = DateTime.Now.ToString();
             }
             return ordrlist;
@@ -687,13 +707,13 @@
                 if (oDs == null && oDs.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "1";
-                    objJsonResult.Message="鐢熸垚鎵规澶辫触锛�";
+                    objJsonResult.Message = "[0000-2-053]鐢熸垚鎵规澶辫触锛�";
                     return objJsonResult;
                 }
                 else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1")
                 {
                     objJsonResult.code = "1";
-                    objJsonResult.Message = "鐢熸垚鎵规鎴愬姛锛�";
+                    objJsonResult.Message = "[0000-2-054]鐢熸垚鎵规鎴愬姛锛�";
                     objJsonResult.data = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                     HBatchNo = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]);
                     b = true;
@@ -704,7 +724,7 @@
             if (b == false)
             {
                 objJsonResult.code = "1";
-                objJsonResult.Message="娌℃湁闇�瑕佺敓鎴愭壒娆$殑鏄庣粏琛岋紒";
+                objJsonResult.Message = "[3899-2-003]娌℃湁闇�瑕佺敓鎴愭壒娆$殑鏄庣粏琛岋紒";
                 return objJsonResult;
             }
             else //瀹屽叏灏侀棴
@@ -728,7 +748,7 @@
                 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 CampanyName = sArray[4].ToString() == "xxx" ? "" : sArray[4].ToString();
                 string UserName = sArray[5].ToString();
                 ClsPub.CurUserName = UserName;
 
@@ -745,7 +765,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "閫夋嫨缁勭粐鏈夐敊璇�!";
+                    objJsonResult.Message = "[0000-2-055]閫夋嫨缁勭粐鏈夐敊璇�!";
                     return objJsonResult;
                 }
                 if (!Sub_AllowSave(msg2, HSelectBarCodeType))//鍗曟嵁瀹屾暣鎬у垽鏂�
@@ -766,7 +786,7 @@
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鏉$爜鐢熸垚澶辫触!"+e.Message;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触!" + e.Message;
                 return objJsonResult;
             }
             return objJsonResult;
@@ -789,17 +809,18 @@
                 long HMaterID = DBUtility.ClsPub.isLong(ordrlist[i].HMaterID);              // 鐗╂枡鍐呯爜
                 string HBatchNo = DBUtility.ClsPub.isStrNull(ordrlist[i].HBatchNo);         // 鎵瑰彿
                 long HAuxPropID = DBUtility.ClsPub.isLong(ordrlist[i].HAuxPropID);          // 杈呭姪灞炴�D
+                string HMTONo = DBUtility.ClsPub.isStrNull(ordrlist[i].HMTONo);             // 璁″垝璺熻釜鍙�
                 double HSourceQty = DBUtility.ClsPub.isDoule(ordrlist[i].HMinQty);          // 婧愬崟鏁伴噺
                 double HQty = DBUtility.ClsPub.isDoule(ordrlist[i].HQty);                   // 鏁伴噺
                 double HMinQty = DBUtility.ClsPub.isDoule(ordrlist[i].HMinQty);             // 鏈�灏忓寘瑁呮暟
                 if (HMaterID != 0)
                 {
-                    DataSet oDsCheck = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + "," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck");
+                    DataSet oDsCheck = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck_New " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck_New");
                     if (oDsCheck == null && oDsCheck.Tables[0].Rows.Count == 0)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鏉$爜鐢熸垚瀹屾暣鎬у垽鏂敊璇�";
+                        objJsonResult.Message = "[3899-2-007]鏉$爜鐢熸垚瀹屾暣鎬у垽鏂敊璇�";
                         return false;
                     }
                     else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "1")
@@ -821,7 +842,7 @@
         #endregion
 
         #region[鏉$爜鐢熸垚鏂规硶]
-        private object SaveBarCode(string msg2, string HSelectBarCodeType, string CampanyName,string HSourceBillTypeName)
+        private object SaveBarCode(string msg2, string HSelectBarCodeType, string CampanyName, string HSourceBillTypeName)
         {
             int LSHlen = 6;             //娴佹按鍙烽暱搴�
             int SumLen = 10;            //鎬婚暱搴�
@@ -833,7 +854,7 @@
             int HBQty = 0;              //绠辨暟
             double HQty = 0;            //鏁伴噺
             string WeiShu = "";         //灏炬暟
-            int LSH = 0;                //娴佹按鍙�
+            Int64 LSH = 0;              //娴佹按鍙�
             string LSH2 = "";           //娴佹按鍙疯浆鎹㈡垚瀛楃
             string sDate = "";          //鏃ユ湡
             string sYear = "";          //骞�
@@ -923,7 +944,7 @@
                             sTMNumber = HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else if (CampanyName == "椋為緳")
                         {
@@ -940,9 +961,10 @@
                             sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
-                        else if (CampanyName == "鐟炰笌绁�") {
+                        else if (CampanyName == "鐟炰笌绁�")
+                        {
                             var date = DateTime.Now.ToString("yyMMdd");//鏃ユ湡
                             if (HSourceBillTypeName == "鏀舵枡閫氱煡鍗�")
                             {
@@ -965,7 +987,7 @@
 
                                 //sTMNumber = ordrlist[j].HMaterNumber + "-鍖呰鏍囪瘑-" + date + "-" + ordrlist[j].HSupNumber + "-";
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                             else if (HSourceBillTypeName == "鐢熶骇鍏ュ簱鍗�")
                             {
@@ -999,13 +1021,13 @@
 
                                 //sTMNumber = ordrlist[j].HMaterNumber + "-鍖呰鏍囪瘑-"+ date + "-缁勭粐浠g爜-";
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                             else
                             {
                                 sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                                 Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                                LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                                LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                             }
                         }
                         else  //閫氱敤鏂规硶
@@ -1014,7 +1036,7 @@
                             sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                             //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                            LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                     }
                     else if (HSelectBarCodeType == "鍝佺鏉$爜")
@@ -1038,7 +1060,7 @@
                         sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 4;
                     }
                     else if (HSelectBarCodeType == "浠櫒鎴愬搧鏉$爜瑙勫垯") //鍙﹀澶勭悊浜�
@@ -1055,7 +1077,7 @@
                         sTMNumber = HMaterNumber + HBatchNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 6;
                     }
                     else if (HSelectBarCodeType == "鍐呴攢鏈烘潯鐮�")
@@ -1065,7 +1087,7 @@
                         sTMNumber = "1" + HModelName + HBarCodeDate + HBarCodeBatchNo + HYasuoji + "00";
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                         if (sTMNumber.Length != 16)
                         {
@@ -1082,7 +1104,7 @@
                         sTMNumber = HMaterNumber.Replace(".", "") + HBarCodeDate + HBarCodeBatchNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                         if (sTMNumber.Length != 18)
                         {
@@ -1098,7 +1120,7 @@
                         sTMNumber = HICMOBillNo;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
                                                                                                                     //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                     }
                     else if (HSelectBarCodeType == "鎵樼洏鏉$爜")
@@ -1107,7 +1129,7 @@
                         //鏉$爜鍓嶇紑 = 鐗╂枡鍐呯爜 + 骞� + 鏈� + 鏃�
                         sTMNumber = HNumber + sYear + sPeriod + sDay;
                         Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
-                        LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                     }
                     else
                     {
@@ -1121,7 +1143,7 @@
                     HMinQty = ClsPub.isDoule(ordrlist[j].HMinQty);
                     HSumQty = ClsPub.isDoule(ordrlist[j].HQty);
                     n = 0;
-                    
+
                     for (int i = k; i < HBQty; i++)
                     {
                         if (HSumQty - HMinQty > 0)
@@ -1171,7 +1193,34 @@
                             objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�";
                             return objJsonResult;
                         }
-                        HBarCodeList barcode = new HBarCodeList();
+                        HBarCodeList barcode = new HBarCodeList(); 
+
+                        if (CampanyName == "娴疯瘹") //绯荤粺鍙傛暟  瀹㈡埛瀹氬埗鍖栧悕绉�
+                        {
+                            string sHMTONo = "";            //璁″垝璺熻釜鍙�
+                            string sHSourceBillNo = "";     //婧愬崟鍗曞彿
+                            string sHSourceBillSEQ = "";    //婧愬崟琛屽彿
+                            string sSupNumber = "";         //渚涘簲鍟嗕唬鐮�
+                            string sHQty = "";              //鏁伴噺
+
+                            sHMTONo = DBUtility.ClsPub.isStrNull(ordrlist[j].HMTONo);
+                            sHSourceBillNo = DBUtility.ClsPub.isStrNull(ordrlist[j].HBillNo);
+                            sHSourceBillSEQ = DBUtility.ClsPub.isStrNull(ordrlist[j].HSourceBillSEQ);
+                            sSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[j].HSupNumber);
+                            sHQty = DBUtility.ClsPub.isStrNull(HMinQty);
+
+                            if (DBUtility.ClsPub.isStrNull(ordrlist[j].HBillType) == "1102") //婧愬崟锛氶噰璐鍗�
+                            {
+                                //鏉$爜瑙勫垯锛氶噰璐鍗曞崟鍙稝琛屽彿@鐗╂枡浠g爜@MTO@鏁伴噺@渚涘簲鍟嗕唬鐮�
+                                TM = sHSourceBillNo + "@" + sHSourceBillSEQ + "@" + HMaterNumber + "@" + sHMTONo + "@" + sHQty + "@" + sSupNumber;
+                            }
+                            else
+                            {
+                                //鏉$爜瑙勫垯锛氱墿鏂欏唴鐮丂MTO@鏁伴噺
+                                TM = HNumber + "@" + sHMTONo + "@" + sHQty;
+                            }
+                        }
+
                         barcode.HBarCode2 = TM;
                         barcode.HEntryID2 = ClsPub.isStrNull(j + 1);
                         barcode.HMaterID2 = ordrlist[j].HMaterID;
@@ -1371,7 +1420,8 @@
                                     + ", " + 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 + "'" + ")");
+                                    + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "'"
+                                    + ",'" + HCoilNO2 + "','" + HFurnaceNO2 + "','" + HFactory2 + "'," + HAuxQty2 + ",'" + HheatNO2 + "','" + HProduceDate + "','" + HExpiryDate + "'," + HEmpID2.ToString() + ",'" + HCusModel2 + "','" + HCusMaterName2 + "','" + HCheckEmpName2 + "'" + ")");
 
 
                         //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value);
@@ -1433,7 +1483,7 @@
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                    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;
@@ -1442,7 +1492,7 @@
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒";
+                    objJsonResult.Message = "[0000-2-020]娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒";
                     objJsonResult.data = null;
                     objJsonResult.list = listobj;
                     return objJsonResult;
@@ -1453,7 +1503,7 @@
                 oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "鏉$爜鐢熸垚澶辫触锛�" + e.Message;
+                objJsonResult.Message = "[3899-2-006]鏉$爜鐢熸垚澶辫触锛�" + e.Message;
                 return objJsonResult;
             }
         }
@@ -1472,7 +1522,7 @@
         {
             try
             {
-                oCN.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HitemID in("+msg+")", ref DBUtility.ClsPub.sExeReturnInfo);
+                oCN.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HitemID in(" + msg + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = "鏇存柊鎵撳嵃娆℃暟鎴愬姛";
@@ -1488,6 +1538,648 @@
         }
         #endregion
 
+        #region 鏉$爜瀛樺叆鏉$爜涓绘。
+        /// <summary>
+        /// 鏉$爜杞瓨鏉$爜涓绘。
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_BarCode/SaveBarCode_NoGenerate")]
+        [HttpPost]
+        public object SaveBarCode_NoGenerate([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 HSelectBarCodeType = sArray[3].ToString();
+                string CampanyName = sArray[4].ToString() == "xxx" ? "" : sArray[4].ToString();
+                string UserName = sArray[5].ToString();
+                string barCodeNo = sArray[6].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
+                {
+
+                    // 鏉$爜杞瓨
+                    msg2 = msg2.Replace("\\", "");
+                    msg2 = msg2.Replace("\n", "");  //\n
+                    List<HSouceOrderList> ordrlist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HSouceOrderList>>(msg2);
+                    LogService.Write(ordrlist[0]);
+
+                    long HSourceInterID = string.IsNullOrEmpty(ordrlist[0].HMainID) == true ? 0 : ClsPub.isLong(ordrlist[0].HMainID);
+                    long HSourceEntryID = string.IsNullOrEmpty(ordrlist[0].HSubID) == true ? 0 : ClsPub.isLong(ordrlist[0].HSubID);
+                    DataSet ds1 = oCN.RunProcReturn("exec h_p_SC_BarCode_Transfer " +
+                        "@HBarCodeNo = N'" + barCodeNo + "'" +
+                        ",@HSubID = " + ordrlist[0].HSubID +
+                        ",@HMaterID = " + ordrlist[0].HMaterID +
+                        ",@HGiveAwayFlag = " + ordrlist[0].HGiveAwayFlag +
+                        ",@HQty = " + ordrlist[0].HQty +
+                        ",@HUnitID = " + ordrlist[0].HUnitID +
+                        ",@HMinQty = " + ordrlist[0].HMinQty +
+                        ",@HSupID = " + ordrlist[0].HSupID +
+                        ",@HBatchNo = N'" + ordrlist[0].HBatchNo + "'" +
+                        ",@HMTONO = N'" + ordrlist[0].HMTONo + "'" +
+                        ",@HBarCodeDate = N'" + ordrlist[0].HDate + "'" +
+                        ",@HEmpID = " + ordrlist[0].HEmpID +
+                        ",@HGroupID = " + ordrlist[0].HGroupID +
+                        ",@HSourceInterID = " + HSourceInterID +
+                        ",@HSourceEntryID = " + HSourceEntryID +
+                        ",@HBarCodeType = N'" + HSelectBarCodeType + "'"+
+                        ",@HSourceBillNo = N'" + ordrlist[0].HBillNo + "'"+
+                        ",@HMaker = N'" + UserName + "'"
+                        , "h_p_SC_BarCode_Transfer");
+
+                    if ((bool)ds1.Tables[0].Rows[0]["returntype"] == true)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = ds1.Tables[0].Rows[0]["mesg"].ToString();
+                    }
+                    else
+                    {
+                        throw new Exception(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 [鏉$爜鐢熸垚鎺ュ彛-杩﹀崡]
+        [Route("Sc_BarCode/Sub_SaveBill_JiaNan")]
+        [HttpPost]
+        public object Sub_SaveBill_JiaNan([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 HSelectBarCodeType = sArray[3].ToString();                               //鏉$爜绫诲瀷
+                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))
+                {
+                    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_JiaNan(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_JiaNan(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 == "BarCode")
+                    {
+                        //鎷嗗垎姣忔潯鐗╂枡璁板綍涓哄鏉℃潯鐮佽褰�
+                        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++)
+                        {
+                            string HBarCode_Temp = "";                                                  //鏉$爜
+                            string sTMNumber = "";                                                      //鏉$爜鍓嶇紑
+                            string LSH = "";                                                            //鏈�澶ф祦姘村彿
+                            int HLen = 4;                                                            //娴佹按鍙烽暱搴�
+
+                            //鏉$爜鎷兼帴鎵�闇�瀛楁
+                            string HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[i].HSupNumber).Replace(".", "");             //渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級
+                            string sDateStr = sDate.ToString("yyMMdd");                                                         //鍚姩鏃ユ湡锛圷YMMDD锛�
+
+                            if (HSupNumber.Trim() == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "渚涘簲鍟嗕唬鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�";
+                                return objJsonResult;
+                            }
+
+                            //鏉$爜鍓嶇紑 = R+渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級+鍚姩鏃ユ湡锛圷YMMDD锛�+鍥涗綅娴佹按鍙�
+                            sTMNumber = "R" + HSupNumber + sDateStr;
+
+                            //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
+                            Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");
+                            LSH = String.Format("{0:D" + HLen + "}", ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1);
+
+                            //鎷兼帴鏉$爜
+                            HBarCode_Temp = sTMNumber + LSH;
+
+
+                            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[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.HZZRQ = ordrlist[i].HZZRQ;
+                            ListRows.Add(barcode);
+
+                            n += 1;                                                             //鏇存柊鍚屾壒鐢熸垚鐨勬潯鐮佹暟
+                            oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");           //鏇存柊鏈�澶ф祦姘村彿
+                        }
+                    }
+                    else if (HSelectBarCodeType == "BarCode_Box")
+                    {
+                        int HBQty = ClsPub.isInt(ordrlist[i].HBQty);                            //绠辨暟
+
+                        for (int j = 0; j < HBQty; j++)
+                        {
+                            string HBarCode_Temp = "";                                                  //鏉$爜
+                            string sTMNumber = "";                                                      //鏉$爜鍓嶇紑
+                            string LSH = "";                                                            //鏈�澶ф祦姘村彿
+                            int HLen = 4;                                                               //娴佹按鍙烽暱搴�
+
+                            //鏉$爜鎷兼帴鎵�闇�瀛楁
+                            string HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[i].HSupNumber).Replace(".", "");             //渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級
+                            string sDateStr = sDate.ToString("yyMMdd");                                                         //鍚姩鏃ユ湡锛圷YMMDD锛�
+
+                            if (HSupNumber.Trim() == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "渚涘簲鍟嗕唬鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�";
+                                return objJsonResult;
+                            }
+
+                            //鏉$爜鍓嶇紑 = R+渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級+鍚姩鏃ユ湡锛圷YMMDD锛�+鍥涗綅娴佹按鍙�
+                            sTMNumber = "B" + HSupNumber + sDateStr;
+
+                            //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
+                            Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");
+                            LSH = String.Format("{0:D" + HLen + "}", ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1);
+
+                            //鎷兼帴鏉$爜
+                            HBarCode_Temp = sTMNumber + LSH;
+
+                            HBarCodeList barcode = new HBarCodeList();
+                            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(0);
+                            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 = "";
+                            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.HZZRQ = ordrlist[i].HZZRQ;
+                            ListRows.Add(barcode);
+
+                            n += 1;                                                             //鏇存柊鍚屾壒鐢熸垚鐨勬潯鐮佹暟
+                            oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");           //鏇存柊鏈�澶ф祦姘村彿
+                        }
+                    }
+                    else if (HSelectBarCodeType == "BarCode_Pack")
+                    {
+                        int HBQty = ClsPub.isInt(ordrlist[i].HBQty);                            //绠辨暟
+
+                        for (int j = 0; j < HBQty; j++)
+                        {
+                            string HBarCode_Temp = "";                                                  //鏉$爜
+                            string sTMNumber = "";                                                      //鏉$爜鍓嶇紑
+                            string LSH = "";                                                            //鏈�澶ф祦姘村彿
+                            int HLen = 4;                                                               //娴佹按鍙烽暱搴�
+
+                            //鏉$爜鎷兼帴鎵�闇�瀛楁
+                            string HSupNumber = DBUtility.ClsPub.isStrNull(ordrlist[i].HSupNumber).Replace(".", "");             //渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級
+                            string sDateStr = sDate.ToString("yyMMdd");                                                         //鍚姩鏃ユ湡锛圷YMMDD锛�
+
+                            if (HSupNumber.Trim() == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "渚涘簲鍟嗕唬鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�";
+                                return objJsonResult;
+                            }
+
+                            //鏉$爜鍓嶇紑 = R+渚涘簲鍟嗕唬鐮侊紙鍘绘帀鍒嗛殧绗︼級+鍚姩鏃ユ湡锛圷YMMDD锛�+鍥涗綅娴佹按鍙�
+                            sTMNumber = "P" + HSupNumber + sDateStr;
+
+                            //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
+                            Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");
+                            LSH = String.Format("{0:D" + HLen + "}", ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1);
+
+                            //鎷兼帴鏉$爜
+                            HBarCode_Temp = sTMNumber + LSH;
+
+                            HBarCodeList barcode = new HBarCodeList();
+                            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(0);
+                            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 = "";
+                            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.HZZRQ = ordrlist[i].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 + "'" + ")");
+
+                    }
+                }
+                //澧炲姞 鏉$爜瓒呰繃鏈敓鎴愬姛鑳芥帶鍒�
+
+                //
+
+                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