From 73a5779f0d27535a46ae5bc00a5e006be6c24d25 Mon Sep 17 00:00:00 2001
From: hudong <Administrator@PC-20250329JZUF>
Date: 星期四, 03 七月 2025 08:37:36 +0800
Subject: [PATCH] 1.河南平高变更单需求修改 审核自动触发出库任务2.增加优先级字段3.分拣接口提出来单独使用4.增加入库单明细临时表 5增加过账日期表和审核回调逻辑

---
 api/WmsSpaHelper.cs |  303 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 252 insertions(+), 51 deletions(-)

diff --git a/api/WmsSpaHelper.cs b/api/WmsSpaHelper.cs
index bb2979d..98edcb4 100644
--- a/api/WmsSpaHelper.cs
+++ b/api/WmsSpaHelper.cs
@@ -43,6 +43,7 @@
 using HH.WCS.Mobox3.pinggao.core;
 using static HH.WCS.Mobox3.pinggao.api.OtherModel.Putaway_Order_In;
 using System.Web.Http.Results;
+using System.Runtime.Caching;
 
 namespace HH.WCS.Mobox3.pinggao.api
 {
@@ -2004,7 +2005,7 @@
                             S_END_LOC = endinfo.S_CODE,
                             S_END_AREA = endinfo.S_AREA_CODE,
                             S_END_WH = endinfo.S_WH_CODE,
-
+                            N_PRIORITY=1,
                             N_TYPE = 2,
                             // S_TYPE = WMSTask.GetTypeStr(1),
                             S_TYPE = "鍑哄簱绌烘墭鐩�,
@@ -2118,6 +2119,28 @@
             }
 
         }
+        private static readonly ObjectCache Cache = MemoryCache.Default;
+        private const string CachePrefix = "ClickProtection_";
+        private const int CacheDurationInSeconds = 2;
+
+        public static bool IsClickAllowed(string parameter)
+        {
+            string cacheKey = CachePrefix + parameter;
+
+            // 妫�煡缂撳瓨涓槸鍚﹀凡瀛樺湪璇ュ弬鏁�+            if (Cache.Contains(cacheKey))
+            {
+                // 缂撳瓨涓瓨鍦紝璇存槑5绉掑唴宸茬偣鍑昏繃
+                return false;
+            }
+            else
+            {
+                // 缂撳瓨涓笉瀛樺湪锛屾坊鍔犲埌缂撳瓨骞惰缃�绉掑悗杩囨湡
+                CacheItemPolicy policy = new CacheItemPolicy { AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(CacheDurationInSeconds) };
+                Cache.Set(cacheKey, parameter, policy);
+                return true;
+            }
+        }
         /// <summary>
         /// 鍒嗘嫞
         /// </summary>
@@ -2127,6 +2150,17 @@
         {
 
             var result = new SimpleResult();
+            if (!IsClickAllowed(model.cntr_code))
+            {
+                // 鎻愮ず鐢ㄦ埛5绉掑唴宸茬偣鍑昏繃
+                result.resultMsg = "鎮ㄥ凡鐐瑰嚮杩囷紝璇�绉掑悗鍐嶈瘯銆�;
+                result.resultCode = 1;
+                return result;
+            }
+            else
+            {
+              
+            }
             // var db = new SqlHelper<object>().GetInstance();
 
             using (var db = new SqlHelper<object>().GetInstance())
@@ -2165,26 +2199,35 @@
 
                     }
                     LogHelper.Info($"S_OUT_TYPE{po.S_OUT_TYPE}");
+                    var gzra = db.Queryable<TN_GZ_SZ>().Where(a => a.N_ENABLE == 1).First();
+                    var GZRQ = DateTime.Now.ToString("yyyyMMdd");
+                    if (gzra != null)
+                    {
+                        GZRQ = gzra.S_GZRQ.ToString("yyyyMMdd");
+                    }
                     //鏍规嵁涓嶅悓鍑哄簱绫诲瀷 鍥炶皟sap
                     if (po.S_OUT_TYPE == "鍐查攢鍑哄簱")
                     {
-                        result = await CXAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, start);
+                        result = await CXAddOutboundOrder(GZRQ,db, model.MaterList, model.arrival_no, model.cntr_code, start);
                     }
                     else
                     if (po.S_OUT_TYPE == "鍑哄簱")//鏅�鍑哄簱
                     {
                         LogHelper.Info($"S_OUT_TYPE{po.S_OUT_TYPE}");
-                        result = await AddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, start);
+                        result = await AddOutboundOrder(GZRQ, db, model.MaterList, model.arrival_no, model.cntr_code, start);
                     }
                     else if (po.S_OUT_TYPE == "璁″垝澶栧彂鏂欏嚭搴�)
                     {
-                        result = await jhwtlAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, start);
+                        result = await jhwtlAddOutboundOrder(GZRQ,db, model.MaterList, model.arrival_no, model.cntr_code, start);
                     }
                     else if (po.S_OUT_TYPE == "鎴愭湰涓績鍑哄簱")
                     {
-                        result = await CBAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, start);
+                        result = await CBAddOutboundOrder(GZRQ,db, model.MaterList, model.arrival_no, model.cntr_code, start);
                     }
-
+                    if (result.resultCode == 1)
+                    {
+                        return result;
+                    }
                     //閫氱敤鎺ュ彛 瀵瑰鍣ㄨ揣鍝佺殑鍒犲噺 鍜岀敓鎴愬洖搴撳崟 閮借鐢ㄧ殑鎺ュ彛
                     result = await TYAddOutboundOrder(db, model.MaterList, model.arrival_no, model.cntr_code, model.IsHK, start, po.S_OUT_TYPE, model.cntr_type);
                     if (result.resultCode == 1)
@@ -2443,7 +2486,7 @@
                         };
                         if (WMSHelper.CreateWmsTask(wmsTask))
                         {
-                            LocationHelper.LockLoc(start, 1);
+                            LocationHelper.LockLoc(start, 2);
                             result.resultMsg = $"鍒涘缓浣滀笟鎴愬姛锛屼綔涓氬彿{wmsTask.S_CODE}";
                         }
                     }
@@ -2514,13 +2557,25 @@
                         result.resultMsg = $"{model.cntr_code}鎵樼洏鎵句笉鍒拌揣浣�;
                         return result;
                     }
-                var startloc = db.Queryable<Location>().Where(a => a.S_CODE == model.start).First();
+                var start = "";
+                var startloc1 = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == model.cntr_code).First();
+                if (startloc1 != null)
+                {
+                    start = startloc1.S_LOC_CODE;
+                }
+                else
+                {
+                    result.resultMsg = $"{model.cntr_code}瀹瑰櫒鏈壘鍒拌揣浣嶄俊鎭�;
+                    result.resultCode = 1;
+                    return result;
+                }
+                var startloc = db.Queryable<Location>().Where(a => a.S_CODE ==start).First();
                 //var location = db.Queryable<Location>().Where(a => a.S_CODE == locs.S_LOC_CODE).First();
                 var wmsTask = new WMSTask
                     {
                         S_CNTR_CODE = model.cntr_code,
                         S_CODE = WMSHelper.GenerateTaskNo(),
-                        S_START_LOC = model.start,
+                        S_START_LOC = startloc.S_CODE,
                         S_START_AREA = startloc.S_AREA_CODE,
                         S_START_WH = startloc.S_WH_CODE,
 
@@ -2539,7 +2594,7 @@
                     };
                     if (WMSHelper.CreateWmsTask(wmsTask))
                     {
-                        LocationHelper.LockLoc(model.start, 1);
+                        LocationHelper.LockLoc(startloc.S_CODE, 1);
                         result.resultMsg = $"鍒涘缓浣滀笟鎴愬姛锛屼綔涓氬彿{wmsTask.S_CODE}";
                     }
                 }
@@ -2562,7 +2617,7 @@
         /// <param name="cntr_code"></param>
         /// <param name="start"></param>
         /// <returns></returns>
-        public static async Task<SimpleResult> CBAddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
+        public static async Task<SimpleResult> CBAddOutboundOrder(string GZRQ,SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
         {
             //using (var db = new SqlHelper<object>().GetInstance())
             //{
@@ -2590,12 +2645,12 @@
                 //鍥炲弬鐗╂枡淇℃伅
                 List<CBcenterBackDto.HEADItem> iTEMs = new List<CBcenterBackDto.HEADItem>();
                 List<OutboundRecord> records = new List<OutboundRecord>();
-                string GZRQ = "";
+                //string GZRQ = "";
                 string PZZDRQ = "";
-                if (po.BUDAT != null)
-                {
-                    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
-                }
+                //if (po.BUDAT != null)
+                //{
+                //    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
+                //}
                 if (po.BLDAT != null)
                 {
                     PZZDRQ = DateTime.Parse(po.BLDAT.ToString()).ToString("yyyyMMdd");
@@ -2725,7 +2780,7 @@
         /// <param name="cntr_code"></param>
         /// <param name="start"></param>
         /// <returns></returns>
-        public static async Task<SimpleResult> jhwtlAddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
+        public static async Task<SimpleResult> jhwtlAddOutboundOrder(string GZRQ,SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
         {
             //using (var db = new SqlHelper<object>().GetInstance())
             //{
@@ -2743,12 +2798,12 @@
 
                 DateTime dateTime;
                 DateTime dateTime1;
-                string GZRQ = "";
+                //string GZRQ = "";
                 string PZZDRQ = "";
-                if (po.BUDAT != null)
-                {
-                    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
-                }
+                //if (po.BUDAT != null)
+                //{
+                //    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
+                //}
                 if (po.BLDAT != null)
                 {
                     PZZDRQ = DateTime.Parse(po.BLDAT.ToString()).ToString("yyyyMMdd");
@@ -2917,7 +2972,7 @@
         /// <param name="cntr_code"></param>
         /// <param name="start"></param>
         /// <returns></returns>
-        public static async Task<SimpleResult> CXAddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
+        public static async Task<SimpleResult> CXAddOutboundOrder(string GZRQ,SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
         {
             // var db = new SqlHelper<object>().GetInstance();
 
@@ -2927,15 +2982,15 @@
             try
             {
                 //搴撲綅淇℃伅
-                var startinfo = db.Queryable<Location>().Where(it => it.S_CODE == start).First();
+                //var startinfo = db.Queryable<Location>().Where(it => it.S_CODE == start).First();
                 //鍑哄簱鍗曡鎯�                 var po = db.Queryable<TN_Outbound_Order>().Includes(s => s.Details).Where(a => a.S_NO == arrival_no).First();
 
-                string GZRQ = "";
-                if (po.BUDAT != null)
-                {
-                    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
-                }
+                //string GZRQ = "";
+                //if (po.BUDAT != null)
+                //{
+                //    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
+                //}
 
                 //鏉ユ簮鍐查攢鍑瘉瀵瑰簲鐨勭墿鏂欏嚟璇佷俊鎭�                 //var poIn = db.Queryable<TN_Inbound_Order>().Includes(s => s.Details).Where(a => a.S_NO == po.S_BS_NO).First();
@@ -2968,11 +3023,6 @@
                     hEAD.GZRQ = GZRQ;
                     hEAD.SRSJ = DateTime.Now.ToString("yyyyMMdd");
 
-                    //hEAD.WLPZ = porecord.Where(s => s.S_WLBM == item.item_code && s.S_WLH == item.N_ROW_NO).First()?.S_WLPZBH;
-                    //hEAD.WLPZNF = porecord.Where(s=>s.S_WLBM==item.item_code&&s.S_WLH==item.N_ROW_NO).First()?.S_WLPZND;
-
-                    //hEAD.WLPZ = porecord.First()?.S_WLPZBH;
-                    //hEAD.WLPZNF = porecord.First()?.S_WLPZND;
 
                     hEAD.WLPZ = porecord.FirstOrDefault()?.S_WLPZBH;
                     hEAD.WLPZNF = porecord.FirstOrDefault()?.S_WLPZND;
@@ -3093,7 +3143,7 @@
         /// <param name="cntr_code"></param>
         /// <param name="start"></param>
         /// <returns></returns>
-        public static async Task<SimpleResult> AddOutboundOrder(SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
+        public static async Task<SimpleResult> AddOutboundOrder(string GZRQ,SqlSugarClient db, List<Mater> MaterList, string arrival_no, string cntr_code, string start)
         {
             //using (var db = new SqlHelper<object>().GetInstance())
             //{
@@ -3106,7 +3156,7 @@
                 var startinfo = db.Queryable<Location>().Where(it => it.S_CODE == start).First();
                 //鍑哄簱鍗曡鎯�                 var po = db.Queryable<TN_Outbound_Order>().Includes(s => s.Details).Where(a => a.S_NO == arrival_no).First();
-                string GZRQ = "";
+                //string GZRQ = "";
                 string PZZDRQ = "";
                 //if (po.Details[0].S_CJRQ != null)
                 //{
@@ -3126,7 +3176,7 @@
                             KEY = po.S_NO,
                             ZYWLX = "2",
                             PZRQ = DateTime.Now.ToString("yyyyMMdd"),
-                            GZRQ = DateTime.Now.ToString("yyyyMMdd"), // 鍋囪鏃ユ湡鏍煎紡涓�骞�鏈�鏃�
+                            GZRQ = GZRQ, // 鍋囪鏃ユ湡鏍煎紡涓�骞�鏈�鏃�
                             GZRY = po.S_CREATOR_NAME,
                             ITEM = new List<CkBcakDto.ITEM>
                             {
@@ -3871,7 +3921,7 @@
         /// </summary>
         /// <param name="model"></param>
         /// <returns></returns>
-        internal static WeiLiResult Out_Order_Inss(string S_NO)
+        internal static WeiLiResult Out_Order_Inss(string S_NO,int N_PRIORITY)
         {
             var result = new WeiLiResult();
             //  var db = new SqlHelper<object>().GetInstance();
@@ -3897,7 +3947,7 @@
                     else
                     {
                         //var az = db.Queryable<AZInventory>().ToList();
-                        var po1 = new TN_Outbound_Order { S_NO = WMSHelper.GenerateShippNo(), UNAME = po.UNAME, S_FACTORY = po.S_FACTORY, S_CBZX = po.S_CBZX, S_ZZKM = po.S_ZZKM, S_LRZX = po.S_LRZX, BLDAT = po.BLDAT, BUDAT = po.BUDAT, S_OUT_TYPE = po.S_OUT_TYPE, S_BS_TYPE = po.S_BS_TYPE, S_AREA_CODE = po.S_AREA_CODE, S_BS_NO = po.S_NO };
+                        var po1 = new TN_Outbound_Order { S_NO = WMSHelper.GenerateShippNo(), N_PRIORITY=N_PRIORITY, UNAME = po.UNAME, S_FACTORY = po.S_FACTORY, S_CBZX = po.S_CBZX, S_ZZKM = po.S_ZZKM, S_LRZX = po.S_LRZX, BLDAT = po.BLDAT, BUDAT = po.BUDAT, S_OUT_TYPE = po.S_OUT_TYPE, S_BS_TYPE = po.S_BS_TYPE, S_AREA_CODE = po.S_AREA_CODE, S_BS_NO = po.S_NO };
                         List<TN_Ll_detail> tN_Ll_Details = new List<TN_Ll_detail>();
                         po1.Details = new List<TN_Outbound_Detail>();
                         var list = po.Details.Where(s => s.F_QTY > s.F_ACC_D_QTY&&s.S_ERP_WH_CODE=="4004").Select(s => s.S_ITEM_CODE).Distinct().ToArray();
@@ -4373,6 +4423,11 @@
                     db.BeginTran();
 
                     var po = db.Queryable<TN_Inbound_Order>().Includes(p => p.Details).Where(a => a.S_NO == model.S_NO).First();
+
+
+                 
+
+
                     LogHelper.Info($"杩涙潵浜�");
                     #region MyRegion
                     if (po.Details.Count > 0)
@@ -4462,6 +4517,152 @@
                                 w.S_ITEM_CODE == d.S_ITEM_CODE &&
                                 w.N_ROW_NO == d.N_ROW_NO)).OrderBy(s => s.N_ROW_NO)
                             .ToList();
+
+                    #region MyRegion
+
+
+                    List<TN_Center_Inbound_Detail> tN_Center_Inbound_Details=new List<TN_Center_Inbound_Detail>();
+                    foreach (var item in po.Details)
+                    {
+                        bool idadd = true;
+                       // var cir2 = db.Queryable<CGRels>().Where(a => a.S_ITEM_CODE == item.S_ITEM_CODE && a.S_CNTR_TYPE == "鍗婃墭").Select(s => s.S_CNTR_CODE).Distinct().ToArray();
+                        var S_CNTR_CODE = "";
+
+
+
+                        var lcr = db.Queryable<LocCntrRel>()
+                            .InnerJoin<CGRels>((l, c) => l.S_CNTR_CODE == c.S_CNTR_CODE)
+                            .Where((l, c) => c.S_ITEM_CODE == item.S_ITEM_CODE && c.S_CNTR_TYPE == "鍗婃墭")
+                            .OrderByDescending((l, c) => l.T_CREATE)
+                            .Select((l, c) => l).ToList()
+                            .FirstOrDefault();
+
+                        //if (cir2.Count()>0)
+                        //{
+                         
+
+                           // var lcr = db.Queryable<LocCntrRel>().Where(c => cir2.Contains(c.S_CNTR_CODE)).OrderByDescending(s=>s.T_CREATE).First();
+
+                            S_CNTR_CODE = lcr.S_CNTR_CODE;
+                            if (lcr != null)
+                            {
+                                //璧峰搴撲綅
+                                var startloc = db.Queryable<Location>().Where(it => it.S_CODE == lcr.S_LOC_CODE).First();
+                                var wsc = db.Queryable<WCSTask>().Where(it => it.S_CNTR_CODE == S_CNTR_CODE&&it.S_TYPE.Contains("鍑哄簱") && it.N_B_STATE < 3).First();
+                                if (wsc != null)
+                                {
+                                    item.N_B_STATE = 2;
+                                    db.Updateable(item).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
+                                }
+                                else
+                                {
+                                    if (startloc != null)//&&  
+                                    {
+                                        //缁堢偣璐т綅
+                                        var endloc = db.Queryable<Location>().Where(it => it.S_AREA_CODE == "QYQXHQ" && it.N_LOCK_STATE == 0 && it.N_CURRENT_NUM == 0).First();
+
+                                        // var endloc = db.Queryable<Location>().Where(it => it.S_CODE == item.S_END_LOC).First();
+                                        if (endloc != null)
+                                        {
+                                            var optask = new WMSTask
+                                            {
+                                                S_CODE = WMSHelper.GenerateTaskNo(),
+                                                S_START_LOC = startloc.S_CODE,
+                                                S_START_AREA = startloc.S_AREA_CODE,
+                                                S_START_WH = startloc.S_WH_CODE,
+                                                S_END_LOC = endloc.S_CODE,
+                                                S_END_AREA = endloc.S_AREA_CODE,
+                                                S_END_WH = endloc.S_WH_CODE,
+                                                N_PRIORITY = 1,
+                                                S_TYPE = "鍗婃墭鍑哄簱",
+                                                N_TYPE = 2,
+                                                N_B_STATE = 0,
+                                                S_BS_NO = "",
+                                                S_CNTR_CODE = S_CNTR_CODE,
+                                                S_OP_DEF_NAME = item.S_BS_TYPE
+                                            };
+                                            var res = db.Insertable(optask).ExecuteCommand() > 0;
+                                            if (res)
+                                            {
+                                                startloc.N_LOCK_STATE = 2;
+                                                startloc.S_LOCK_STATE = "鍑哄簱閿�;
+                                                db.Updateable(startloc).UpdateColumns(it => new { it.S_LOCK_STATE, it.N_LOCK_STATE }).ExecuteCommand();
+                                            var models = db.Queryable<Location>().Where(a => a.S_CODE == endloc.S_CODE).First();
+                                            // if (model != null && model.S_LOCK_STATE.Trim() == "鏃�)
+                                            if (models != null && models.N_LOCK_STATE == 0)
+                                            {
+                                                models.N_LOCK_STATE = 1;
+                                                models.S_LOCK_STATE = Location.GetLockStateStr(1);
+                                                res = db.Updateable(models).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0;
+                                            }
+                                            //LocationHelper.LockLoc(endloc.S_CODE, 1);
+                                                item.N_B_STATE = 2;
+                                                db.Updateable(item).UpdateColumns(it => new { it.N_B_STATE }).ExecuteCommand();
+                                           
+
+                                        }
+                                        }
+                                        else
+                                        {
+                                        idadd = false;
+                                            LogHelper.Info($" 搴撳尯AGVXHQ鏃犵┖璐т綅");
+
+                                        }
+                                    }
+                                    else
+                                    {
+                                       idadd = false;
+                                        LogHelper.Info($" 搴撳尯鏃犺揣浣�);
+                                    }
+                                }
+
+                            }
+                            else
+                            {
+                            idadd = false;
+                            LogHelper.Info($"鐗╂枡{item.S_ITEM_CODE}鏈壘鍒板鍣ㄥ搴旂殑璐т綅淇℃伅锛岃鑱旂郴浜哄伐缁戝畾鍏崇郴");
+                            }
+                        if (!idadd)
+                        {
+                            TN_Center_Inbound_Detail tN_Center_Inbound_Detail = new TN_Center_Inbound_Detail();
+                            tN_Center_Inbound_Detail.S_IO_NO = item.S_IO_NO;
+                            tN_Center_Inbound_Detail.N_ROW_NO = item.N_ROW_NO;
+                            tN_Center_Inbound_Detail.S_ITEM_CODE = item.S_ITEM_CODE;
+                            tN_Center_Inbound_Detail.F_QTY = item.F_QTY;
+                            tN_Center_Inbound_Detail.S_ITEM_STATE = item.S_ITEM_STATE;
+                            tN_Center_Inbound_Detail.S_ITEM_NAME = item.S_ITEM_NAME;
+                            tN_Center_Inbound_Detail.F_ACC_B_QTY = item.F_ACC_B_QTY;
+                            tN_Center_Inbound_Detail.S_KCDD = item.S_KCDD;
+                            tN_Center_Inbound_Detail.S_UOM = item.S_UOM;//璁¢噺鍗曚綅
+                            tN_Center_Inbound_Detail.S_BATCH_NO = item.S_BATCH_NO;
+                            tN_Center_Inbound_Detail.S_CGPZH = item.S_CGPZH;
+                            tN_Center_Inbound_Detail.S_CGPZXMBH = item.S_CGPZXMBH;
+                            tN_Center_Inbound_Detail.S_CKPZKJND = item.S_CKPZKJND;
+                            tN_Center_Inbound_Detail.S_CKPZXM = item.S_CKPZXM;
+                            tN_Center_Inbound_Detail.S_CXWLPZBH = item.S_CXWLPZBH;
+                            tN_Center_Inbound_Detail.S_HWSJJYZT = item.S_HWSJJYZT;
+                            tN_Center_Inbound_Detail.S_JYPBH = item.S_JYPBH;
+                            tN_Center_Inbound_Detail.S_KJPZSSRQ = item.S_KJPZSSRQ;
+                            tN_Center_Inbound_Detail.S_KJPZSRSJ = item.S_KJPZSRSJ;
+                            tN_Center_Inbound_Details.Add(tN_Center_Inbound_Detail);
+
+                        }
+                        //}
+                        //else
+                        //{
+                        //    LogHelper.Info($"鏈壘鍒扮墿鏂檣item.S_ITEM_CODE}瀵瑰簲鐨勫鍣�);
+                        //}
+
+                    }
+                    db.Insertable(tN_Center_Inbound_Details).ExecuteCommand();
+                    #endregion
+
+                    var gzra = db.Queryable<TN_GZ_SZ>().Where(a => a.N_ENABLE == 1).First();
+                    var GZRQ = DateTime.Now.ToString("yyyyMMdd");
+                    if (gzra!=null)
+                    {
+                        GZRQ= gzra.S_GZRQ.ToString("yyyyMMdd");
+                    }
                     if (po.S_IN_TYPE == "鍐呴噰鍏ュ簱")
                     {
                         List<NcRkDto.ITEM> listitem = new List<NcRkDto.ITEM>();
@@ -4517,7 +4718,7 @@
                                     {
 
                                         KEY = KEY,
-                                        GZRQ = DateTime.Now.ToString("yyyyMMdd"),
+                                        GZRQ = GZRQ,
                                         GZRY = model.GZRY,//GenerateTaskNo
                                         WLPZBH = po.S_NO,
                                         WLPZND = po.S_WLPZND
@@ -4631,12 +4832,12 @@
                     {
                         DateTime dateTime;
                         DateTime dateTime1;
-                        string GZRQ = "";
+                        //string GZRQ = "";
                         string PZZDRQ = "";
-                        if (po.BUDAT != null)
-                        {
-                            GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
-                        }
+                        //if (po.BUDAT != null)
+                        //{
+                        //    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
+                        //}
                         if (po.BLDAT != null)
                         {
                             PZZDRQ = DateTime.Parse(po.BLDAT.ToString()).ToString("yyyyMMdd");
@@ -4849,7 +5050,7 @@
                                     HEAD = new WcRkBc.HEAD
                                     {
                                         KEY = KEY,
-                                        GZRQ = DateTime.Now.ToString("yyyyMMdd"),
+                                        GZRQ = GZRQ,
                                         GZRY = model.GZRY,
                                         GC = po.S_FACTORY
                                     },
@@ -4962,12 +5163,12 @@
                     {
 
                         var materpz = db.Queryable<TN_Inbound_Order>().Where(s => s.S_NO == po.S_NO).First();
-                        string GZRQ = "";
+                        //string GZRQ = "";
                         LogHelper.Info($"鍐查攢鍏ュ簱鍏ュ簱{po.BUDAT}");
-                        if (po.BUDAT != null)
-                        {
-                            GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
-                        }
+                        //if (po.BUDAT != null)
+                        //{
+                        //    GZRQ = DateTime.Parse(po.BUDAT.ToString()).ToString("yyyyMMdd");
+                        //}
 
                         //鍑哄簱鍥炶皟鍏ュ弬
                         CXCkBackDto.Root roots = new CXCkBackDto.Root

--
Gitblit v1.9.1