From dd02b19abd985fa4b2d90fa9dec0137a0f978cd7 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 05 一月 2026 13:36:36 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/仓存管理/条码生成/Sc_BarCodeController.cs |  369 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 365 insertions(+), 4 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 2361b7d..3d3e923 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"
@@ -699,9 +699,17 @@
                 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.HEXPUNIT = dt.Rows[i]["HEXPUNIT"].ToString();                          //鏈夋晥鏈熷崟浣�(鏃ャ�佹湀銆佸勾)
+                ordrlist.HEXPPERIOD = double.Parse(dt.Rows[i]["HEXPPERIOD"].ToString());        //鏈夋晥鏈熷��
 
-                if(HSourceBillType == "鏀舵枡閫氱煡鍗�")
+                if (HSourceBillType == "鏀舵枡閫氱煡鍗�")
                 {
+                    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("鍥涚淮灏�"))
                     {
 
@@ -744,6 +752,8 @@
                         {
                             ordrlist.HGiveAwayFlag = 0;
                         }
+                        ordrlist.HSeOrderBillNo = dt.Rows[i]["閿�鍞鍗曞彿"].ToString();
+                        ordrlist.HSeOrderSEQ = int.Parse(dt.Rows[i]["閿�鍞鍗曡鍙�"].ToString());
                     }
                     if (HSourceBillType == "鏀舵枡閫氱煡鍗�" || HSourceBillType == "閲囪喘璁㈠崟")
                     {
@@ -2692,6 +2702,341 @@
         }
         #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.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].HReInspectionFlag? ordrlist[i].HInspectionDate:null;
+                            barcode.HInspectionCycle = ordrlist[i].HReInspectionFlag ? ordrlist[i].HInspectionCycle : 0;
+                            barcode.HReInspectionDate = ordrlist[i].HReInspectionFlag ? ordrlist[i].HReInspectionDate : null;
+                            barcode.HSeOrderBillNo2 = DBUtility.ClsPub.isStrNull(ordrlist[i].HPOOrderBillMTO);
+                            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;
+                        string HCustomBatchNo = ClsPub.isStrNull(ListRows[i].HInspectionDate).Replace("-","");
+                        string HBarCodeStatus = "姝e父";
+
+                        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" +
+                                    ",HReInspectionFlag,HInspectionDate,HInspectionCycle,HReInspectionDate " +
+                                    ") 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 + "'" +
+                                    "," + HReInspectionFlag + "," + (HInspectionDate == null ? "null" : "'" + HInspectionDate + "'") + "," + HInspectionCycle + "," + (HReInspectionDate == null ? "null" : "'" + HReInspectionDate + "'") +
+                                    ")";
+
+                        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]
@@ -3100,6 +3445,7 @@
             List<HBarCodeList> ListRows = new List<HBarCodeList>();
 
             DataSet Ds;
+            DataSet Ds2;
             for (int i = 0; i < 1; i++)
             {
                 HSourceBillType_Temp = ordrlist.HBillType;
@@ -3142,17 +3488,32 @@
                                 objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖锛屼笉鑳界敓鎴愭潯鐮侊紒";
                                 return objJsonResult;
                             }
-                            DataSet dss = oCN.RunProcReturn("","");
+
+                            Ds2 = oCN.RunProcReturn("select top 1 HCusRelationNumber from Gy_Material m with(nolock) left join Gy_MateNumRelation_Sec b with(nolock) on m.HMASTERID = b.HMaterID where m.HItemID = " + ordrlist.HMaterID, "Gy_MateNumRelation_Sec");
+
+                            string HSKU = "";//鍟嗗搧SKU
+                            if (Ds2.Tables[0].Rows.Count > 0)
+                            {
+                                HSKU = Ds2.Tables[0].Rows[0]["HCusRelationNumber"].ToString();
+                            }
+                            else
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "娌℃湁鍖归厤鍒板搴旂殑鍟嗗搧SKU!";
+                                return objJsonResult;
+                            }
+
                             //todo
                             //鏉$爜鍓嶇紑 = p+鍟嗗搧SKU+鐢熶骇骞翠唤+鐢熶骇鏈堜唤+6浣嶆祦姘村彿+鐢熶骇宸ュ巶浠g爜
-                            sTMNumber = "P" + HMaterialName + lastDigit+ productionMonth;
+                            sTMNumber = "P" + HSKU + lastDigit+ productionMonth;
 
                             //鏍规嵁鏉$爜鍓嶇紑鑾峰彇鏈�澶ф祦姘村彿
                             Ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");
                             LSH = String.Format("{0:D" + HLen + "}", ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1);
 
                             //鎷兼帴鏉$爜
-                            HBarCode_Temp = sTMNumber + LSH+"XXX";
+                            HBarCode_Temp = sTMNumber + "A" + LSH + "AHW";
 
 
                             if (HSumQty - HMinQty > 0)

--
Gitblit v1.9.1