From d74b85f0c08da89bf57c0de6eed3d74066dbd627 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 07 二月 2025 10:36:37 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/BarCodeController.cs |  200 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 174 insertions(+), 26 deletions(-)

diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index 6e9d2a5..b17ad08 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -1,4 +1,5 @@
 锘縰sing DBUtility;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using SQLHelper;
 using System;
@@ -22,7 +23,7 @@
     {
         private JsonResult objJsonResult = new JsonResult();
         private json objjson = new json();
-        public new ClsCNSRM oCn = new ClsCNSRM();
+        public new ClsCN oCn = new ClsCN();
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
         public T ScriptDeserialize<T>(string strJson)
@@ -46,7 +47,7 @@
             string msg1 = _value.ToString();
             try
             {
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 oCn.RunProc("exec H_p_SRM_BarCodeBill_PrintQty '" + msg1 + "'");
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
@@ -131,7 +132,7 @@
                 string WeiShu = ""; //灏炬暟
                 //string sKFDate = DateTime.Now.ToString("yyyy-MM-dd");
                 DataSet Ds;
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                 {
                     if (ClsPub.isLong(oItemSub.HMaterID) != 0)
@@ -338,7 +339,7 @@
                 string WeiShu = ""; //灏炬暟
                 //string sKFDate = DateTime.Now.ToString("yyyy-MM-dd");
                 DataSet Ds;
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -550,7 +551,7 @@
                 string sDay = "";            //鏃�
                 string WeiShu = ""; //灏炬暟
                 DataSet Ds;
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -584,7 +585,7 @@
                                 TM = "0" + TM;
                             }
                             //TM = "B" + TM;
-                            TM = "SRM" + "B" + TM;
+                            TM = "SRM" + "B" + TM;                           
 
                             if (HSumQty - HMinQty > 0)
                             {
@@ -603,6 +604,13 @@
                                 }
                                 HMinQty = HSumQty;
                             }
+
+                            if (FCusName.Contains("娣诲悍绉戞妧"))
+                            {
+                                //澶栫鎵规鏉$爜瑙勫垯锛歋RMB+缁勭粐+鏂欏彿+鎵规+锛�+鏁伴噺
+                                TM = "SRMB" + "100" + oItemSub.HMaterNumber + oItemSub.HBatchNo + "锛�" + HMinQty;
+                            }
+
                             Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
                             bar.HBarCode = TM;
                             bar.HMaterID = oItemSub.HMaterID;
@@ -628,6 +636,10 @@
                             bar.HSupID = oItemSub.HSupID;
                             bar.HEndQty = WeiShu;
                             bar.HMTONO = oItemSub.HMTONO;
+                            bar.HSupBatchNo = oItemSub.HSupBatchNo;
+                            bar.HSupMaterNumber = oItemSub.HSupMaterNumber;
+                            bar.HISKFPERIOD = oItemSub.HISKFPERIOD;
+                            bar.HMaterNumber = oItemSub.HMaterNumber;
                             ls2.Add(bar);
                         }
                     }
@@ -693,8 +705,19 @@
                             {
                                 TM2 = "0" + TM2;
                             }
-                            bar2.HMaterID = oItemSub2.HMaterID;
-                            bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2;
+
+                            if (FCusName.Contains("娣诲悍绉戞妧"))
+                            {
+                                //鍐呯鎵规鏉$爜瑙勫垯锛歋RM+缁勭粐+鏂欏彿+鎵规+锛�+鏁伴噺
+                                TM2 = "SRM" + "100" + oItemSub2.HMaterNumber + oItemSub2.HBatchNo + "锛�" + HWXQty;
+                                bar2.HBarCode = TM2;
+                            }
+                            else
+                            {
+                                bar2.HBarCode = oItemSub2.HBarCode + "-" + TM2;
+                            }
+
+                            bar2.HMaterID = oItemSub2.HMaterID;                           
                             bar2.HUnitID = oItemSub2.HUnitID;
                             bar2.HQty = HWXQty;
                             bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo);
@@ -708,6 +731,9 @@
                             bar2.HSupID = oItemSub2.HSupID;
                             bar2.HEndQty = WeiShu1;
                             bar2.HMTONO = oItemSub2.HMTONO;
+                            bar2.HSupBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HSupBatchNo);
+                            bar2.HSupMaterNumber = DBUtility.ClsPub.isStrNull(oItemSub2.HSupMaterNumber);
+                            bar2.HISKFPERIOD = DBUtility.ClsPub.isInt(oItemSub2.HISKFPERIOD);
                             ls3.Add(bar2);
                             //LogService.Write("娴嬭瘯鍔�+++" + oItemSub2.HSupID);
                         }
@@ -732,6 +758,9 @@
                 string HKFDQDate = "";
                 string HWei = "";
                 string HMTONO = "";
+                string HSupBatchNo = "";
+                string HSupMaterNumber = "";
+                Int64 HISKFPERIOD = 0;
                 oCn.BeginTran();
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                 {
@@ -760,18 +789,29 @@
                         HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                         HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                         HWei = ClsPub.isStrNull(oItemSub.HEndQty);
+                        HSupBatchNo = ClsPub.isStrNull(oItemSub.HSupBatchNo);
+                        HSupMaterNumber = ClsPub.isStrNull(oItemSub.HSupMaterNumber);
+                        HISKFPERIOD = DBUtility.ClsPub.isInt(oItemSub.HISKFPERIOD);
+
                         if (FCusName.Contains("澶忓疂"))
                         {
                             HBarCode = $"{oItemSub.HMaterID}";
                             HBarCodeType = "鍝佺鐮乢澶栫";
                         }
+
+                        if (FCusName.Contains("娣诲悍绉戞妧"))
+                        {
+                            //HBarCodeType = "鎵规鏉$爜";
+                        }
+
                         string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD " +
                                     ") values ("
                                     + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                     + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" + HSupBatchNo+ "','" + HSupMaterNumber + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD +
+                                    ")";
                         oCn.RunProc(sql);
                         //LogService.Write(sql);
                         sql = "exec setLSH '" + DateTime.Today + "'";
@@ -800,18 +840,28 @@
                         HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                         HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                         HWei = ClsPub.isStrNull(oItemSub.HEndQty);
+                        HSupBatchNo = ClsPub.isStrNull(oItemSub.HSupBatchNo);
+                        HSupMaterNumber = ClsPub.isStrNull(oItemSub.HSupMaterNumber);
+                        HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                         if (FCusName.Contains("澶忓疂"))
                         {
                             HBarCode = $"{oItemSub.HMaterID}";
                             HBarCodeType = "鍝佺鐮�";
                         }
+
+                        if (FCusName.Contains("娣诲悍绉戞妧"))
+                        {
+                            //HBarCodeType = "鎵规鏉$爜";
+                        }
+
                         string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                     ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO ,HSupBatchNo,HSupMaterNumber,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                     ") values ("
                                     + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                     + "','" + HBatchNo + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                                    + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO +  "','" +
+                                    HSupBatchNo + "','" + HSupMaterNumber + "','" + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
                         oCn.RunProc(sql);
                         //LogService.Write(sql);
                     }
@@ -908,7 +958,7 @@
                 string sPeriod = "";        //鏈�
                 string sDay = "";            //鏃�
                 DataSet Ds;
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -1338,6 +1388,59 @@
                 return objjson;
             }
         }
+
+        [Route("GetHBarCodeShowBillSub_Merge")]
+        [HttpGet]
+        /// <summary>
+        /// 鏉$爜鐢熸垚琛ㄤ綋(鐗╂枡锛屾壒娆$浉鍚岋紝鍚堝苟鏁伴噺)
+        /// </summary>
+        /// <param name="sMsg"></param>
+        /// <returns></returns>
+        public object GetHBarCodeShowBillSub_Merge(string HInterID)
+        {
+            try
+            {
+                DataSet ds;
+                string s = "";
+                string ShowItem = " * ";//鏄剧ず鐨勫瓧娈�
+                if (DBUtility.ClsPub.isLong(HInterID) == 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触,閫佽揣鍗曞唴鐮佷负绌�";
+                    objjson.data = null;
+                    return objjson;
+                }
+
+                ds = oCn.RunProcReturn("Select * from h_v_SRM_Barcode_MergePOInStock where HInterID = " + HInterID, "h_v_SRM_Barcode_MergePOInStock");
+
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objjson.code = "0";
+                    objjson.count = 0;
+                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.data = null;
+                    return objjson;
+                }
+                else
+                {
+                    objjson.code = "0";
+                    objjson.count = 10000;
+                    objjson.Message = "鑾峰彇鎴愬姛";
+                    objjson.data = ds.Tables[0];
+                    return objjson;
+                }
+            }
+            catch (Exception e)
+            {
+                objjson.code = "0";
+                objjson.count = 0;
+                objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+                objjson.data = null;
+                return objjson;
+            }
+        }
+
         /// <summary>
         /// 鏉$爜妗f鍒楄〃
         /// </summary>
@@ -1350,11 +1453,13 @@
         public object GetBarCodeShowList([FromBody] JObject msg)
         {
             string HSupNo = msg["HSupNo"].ToString(); string sqlWhere = msg["sqlWhere"].ToString();
+            //娣诲姞鍒楀悕
+            List<object> columnNameList = new List<object>();           
             try
             {
                 string VsWhere = "";
                 string PcWhere = "";
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 DataSet ds;
                 string sql = " Where hsupid in (select HSupID from h_v_Gy_UserSupplierList where 鐢ㄦ埛=''" + HSupNo.Trim() + "'') " + sqlWhere;
 
@@ -1374,16 +1479,24 @@
                 {
                     objjson.code = "0";
                     objjson.count = 0;
-                    objjson.Message = "鑾峰彇澶辫触";
+                    objjson.Message = "鏃犵浉鍏虫潯鐮佷俊鎭紒";
                     objjson.data = null;
                     return objjson;
                 }
                 else
                 {
+                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    {
+                        Type dataType = col.DataType;
+                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                    }
+
                     objjson.code = "0";
                     objjson.count = 10000;
                     objjson.Message = "鑾峰彇鎴愬姛";
                     objjson.data = ds.Tables[0];
+                    objjson.list = columnNameList;
                     return objjson;
                 }
             }
@@ -1567,7 +1680,7 @@
                 string sDay = "";            //鏃�
                 string WeiShu = ""; //灏炬暟
                 DataSet Ds;
-                SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                 oCn.BeginTran();
                 Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
                 LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
@@ -1692,6 +1805,7 @@
                             bar.HSupID = oItemSub.HSupID;
                             bar.HEndQty = WeiShu;
                             bar.HMTONO = oItemSub.HMTONO;
+                            bar.HISKFPERIOD = oItemSub.HISKFPERIOD;
                             ls2.Add(bar);
                         }
                     }
@@ -1759,7 +1873,23 @@
                                 TM2 = "0" + TM2;
                             }
                             bar2.HMaterID = oItemSub2.HMaterID;
-                            bar2.HBarCode = oItemSub2.HBarCode.Replace(HBarcodeQty.ToString(), HWXQty.ToString());
+
+                            var HBarCode_NX = oItemSub2.HBarCode.Split('@'); //鍐呯鎷嗗垎鏉$爜缂栧彿
+                            string HBarMaterNumber_NX = HBarCode_NX[0];//鍐呯鏉$爜_鐗╂枡浠g爜
+                            string HBarMaterName_NX = HBarCode_NX[1];//鍐呯鏉$爜_鐗╂枡鍚嶇О
+                            string HBarMaterModel_NX = HBarCode_NX[2];//鍐呯鏉$爜_鐗╂枡瑙勬牸鍨嬪彿
+                            string HBarKFDate_NX = HBarCode_NX[3];//鍐呯鏉$爜_鐢熶骇鏃ユ湡
+                            string HBarQty_NX = HBarCode_NX[4];//鍐呯鏉$爜_鏁伴噺
+                            string HBarKFDQDate_NX = HBarCode_NX[5];//鍐呯鏉$爜_鏈夋晥鏈熻嚦
+                            string HBarBatchNo_NX = HBarCode_NX[6];//鍐呯鏉$爜_鎵瑰彿
+                            string HBarSupName_NX = HBarCode_NX[7];//鍐呯鏉$爜_渚涘簲鍟嗗悕绉�
+                            string HBarSourceBillNo_NX = HBarCode_NX[8];//鍐呯鏉$爜_婧愬崟鍗曞彿
+
+                            HBarQty_NX = HWXQty.ToString();
+
+                            string TM_NX = $"{HBarMaterNumber_NX}@{HBarMaterName_NX}@{HBarMaterModel_NX}@{HBarKFDate_NX}@{HBarQty_NX}@{HBarKFDQDate_NX}@{HBarBatchNo_NX.TrimStart().TrimEnd()}@{HBarSupName_NX}@{HBarSourceBillNo_NX}";
+
+                            bar2.HBarCode = TM_NX;//oItemSub2.HBarCode.Replace(HBarcodeQty.ToString(), HWXQty.ToString());//闂鎵�鍦� 澶栫鍖呰鏁帮紝鏇挎崲鎴愬唴绠卞寘瑁呮暟 
                             bar2.HUnitID = oItemSub2.HUnitID;
                             bar2.HQty = HWXQty;
                             bar2.HBatchNo = DBUtility.ClsPub.isStrNull(oItemSub2.HBatchNo);
@@ -1773,6 +1903,7 @@
                             bar2.HSupID = oItemSub2.HSupID;
                             bar2.HEndQty = WeiShu1;
                             bar2.HMTONO = oItemSub2.HMTONO;
+                            bar2.HISKFPERIOD = oItemSub2.HISKFPERIOD;
                             ls3.Add(bar2);
                         }
                     }
@@ -1795,6 +1926,7 @@
                 string HKFDQDate = "";
                 string HWei = "";
                 string HMTONO = "";
+                Int64 HISKFPERIOD = 0;
                 oCn.BeginTran();
                 foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
                 {
@@ -1826,6 +1958,7 @@
                             HSourceEntryID = ClsPub.isLong(oItemSub.HSourceEntryID);
                             HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                             HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
+                            HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                             HWei = ClsPub.isStrNull(oItemSub.HEndQty);
                             if (FCusName.Contains("澶忓疂"))
                             {
@@ -1834,11 +1967,13 @@
                             }
                             string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                         ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                         ") values ("
                                         + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                         + "','" + HBatchNo + "','" + SubModel.Count + "','" + count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                        + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                                        + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','"
+                                        + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
+                            LogService.Write("鐢熸垚澶栫鏉$爜锛� " + sql);
                             oCn.RunProc(sql);
                             oCn.RunProc("exec setLSH '" + DateTime.Today + "'");
                             count++;
@@ -1871,6 +2006,7 @@
                             HSourceBillNo = ClsPub.isStrNull(oItemSub.HSourceBillNo);
                             HSourceBillType = ClsPub.isStrNull(oItemSub.HSourceBillType);
                             HWei = ClsPub.isStrNull(oItemSub.HEndQty);
+                            HISKFPERIOD = ClsPub.isInt(oItemSub.HISKFPERIOD);
                             if (FCusName.Contains("澶忓疂"))
                             {
                                 HBarCode = $"{oItemSub.HMaterID}";
@@ -1878,11 +2014,13 @@
                             }
                             string sql = "insert into Gy_BarCodeBill (HInterID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HKFDate,HKFPeriod,HKFDQDate" +
                                       ",HBatchNo,HBarcodeQtys,HBarcodeNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HEndQty,HSupflag" +
-                                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO " +
+                                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HMTONO,HProduceDate,HExpiryDate,HISKFPERIOD" +
                                       ") values ("
                                       + linterid.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID + "," + HUnitID + "," + HQty2 + ",'" + HKFDate + "'," + HKFPeriod + ",'" + HKFDQDate
                                       + "','" + HBatchNo + "','" + SubModel.Count + "','" + _count + "'," + HSupID + "," + HGroupID + ",'" + ClsPub.CurUserName + "','" + DateTime.Today + "'," + HPrintQty + ",'" + HWei + "',1"
-                                      + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "')";
+                                      + "," + HSourceInterID + "," + HSourceEntryID + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HMTONO + "','" 
+                                      + HKFDate + "','" + HKFDQDate + "'," + HISKFPERIOD + ")";
+                            LogService.Write("鐢熸垚鍐呯鏉$爜锛� "+ sql);
                             oCn.RunProc(sql);
                             _count++;
                         }
@@ -1915,6 +2053,7 @@
             }
             catch (Exception e)
             {
+                LogService.Write("鐢熸垚鏉$爜鍙戠敓閿欒锛� " + e);
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "" + e.Message + DBUtility.ClsPub.sExeReturnInfo;
@@ -2069,11 +2208,20 @@
                             oCN.RunProc($"update Cg_POOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
                         //鍙嶅啓鎵撳嵃鏁伴噺鍒板澶栬鍗�
                         if (dr["HBarCodeType"].ToString() == "绠卞彿鍐呮潯鐮�" && dr["HSourceBillType"].ToString() == "1601")
-                            oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
-                        //鍙嶅啓鎵撳嵃鏁伴噺鍒伴�佽揣鍗� 锛堜笉闇�瑕佸弽鍐� 閫佽揣鍗曠洿鎺ユ槸鍏宠仈鏌ヨ鍙栫殑鏁伴噺 娌℃湁鍦ㄦ簮鍗曚笂鍋氫繚瀛橈級
-                        if (dr["HSourceBillType"].ToString() == "1103")
-                            oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + dr["HItemID"] + ") ");
-                        //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
+                            oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");                       
+                        if (FCusName.Contains("娣诲悍绉戞妧"))
+                        {
+                            _HBarCodeType = "绠卞彿鍐呮潯鐮�";
+                            if (dr["HSourceBillType"].ToString() == "1103" && dr["HBarCodeType"].ToString() == _HBarCodeType)
+                                oCN.RunProc($"update Cg_POInStockBillSub set HRelationBarCodeQty -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
+                        }
+                        else
+                        {
+                            //鍙嶅啓鎵撳嵃鏁伴噺鍒伴�佽揣鍗� 锛堜笉闇�瑕佸弽鍐� 閫佽揣鍗曠洿鎺ユ槸鍏宠仈鏌ヨ鍙栫殑鏁伴噺 娌℃湁鍦ㄦ簮鍗曚笂鍋氫繚瀛橈級
+                            if (dr["HSourceBillType"].ToString() == "1103")
+                                oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + dr["HItemID"] + ") ");
+                            //oCN.RunProc($"update WW_EntrustOrderBillSub set HBarcodeCount -= {dr["HQty"]} where  HInterID ={dr["HSourceInterID"]} and  HEntryID ={dr["HSourceEntryID"]}");
+                        }
                     }
                 }
                 oCN.RunProc("Delete From Gy_BarCodeBill where HItemID in(" + HInterID + ") ");

--
Gitblit v1.9.1