From d4cae5c48af02e109b1febce8c7c21e560cd6525 Mon Sep 17 00:00:00 2001 From: xxyy <cathay_xy@163.com> Date: 星期二, 18 三月 2025 14:23:55 +0800 Subject: [PATCH] 更新配置和代码逻辑,优化查询及日志 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index eda759d..f497bd2 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -137,17 +137,11 @@ }); try { - //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) - //{ _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { stock.PalletCode }); - //} } catch (Exception ex) { LogFactory.GetLog("鍒犻櫎缂撳瓨澶辫触").Error(true, $"{stock.PalletCode}_鍒犻櫎缂撳瓨澶辫触锛屽紓甯镐俊鎭細{ex.Message}"); - //using (_simpleCacheService.AcquireLock(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, 2000)) - //{ - //} } return content.OK("浠诲姟瀹屾垚鎴愬姛", task.Remark); @@ -968,11 +962,10 @@ List<DtStockInfo> stockInfoList = stockInfos.Values.ToList(); var result = new DtStockInfo(); - //if (stockInfoList.IsNullOrEmpty()) - //{ - // stockInfoList = await _stockInfoRepository.Db.Queryable<DtStockInfo>() - // .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).IncludesAllFirstLayer().ToListAsync(); - //} + if (areaCode == "CH001") + { + LogFactory.GetLog("CH001").Info(true, JsonConvert.SerializeObject(stockInfoList[0], Formatting.Indented)); + } result = stockInfoList.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull) .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) @@ -982,16 +975,17 @@ .OrderBy(x => x.OutboundTime) .FirstOrDefault(); + if (result != null) _simpleCacheService.HashDel<DtStockInfo>(WIDESEA_Cache.CacheConst.Cache_DtStockInfo, new string[] { result.PalletCode }); else - ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync鏌ヨ瀹炵洏搴撳瓨淇℃伅澶辫触:鏈壘鍒扮鍚堟潯浠剁殑鏁版嵁"); + ConsoleHelper.WriteErrorLine($"{areaCode}-{productionLine}鏌ヨ瀹炵洏搴撳瓨淇℃伅澶辫触:鏈壘鍒扮鍚堟潯浠剁殑鏁版嵁"); return result; } catch (Exception ex) { - ConsoleHelper.WriteErrorLine("QueryStockInfoForRealTrayAsync鏌ヨ瀹炵洏搴撳瓨淇℃伅澶辫触:" + ex.Message + "\r\n" + ex.StackTrace); + ConsoleHelper.WriteErrorLine("鏌ヨ瀹炵洏搴撳瓨淇℃伅澶辫触:" + ex.Message + "\r\n" + ex.StackTrace); return null; } } -- Gitblit v1.9.3