From c3d2666ddfe09fd79ccff9782e4cbba6cab35547 Mon Sep 17 00:00:00 2001 From: 杨张扬 <634643841@qq.com> Date: 星期二, 10 六月 2025 18:03:17 +0800 Subject: [PATCH] 库存管理的过期天数要改为过期小时、取消的任务不计入库存管理 --- wms/SpecHelper.cs | 13 ++++++++++--- core/Monitor.cs | 8 ++++++++ models/TN_InventoryM.cs | 2 +- core/WCSCore.cs | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/Monitor.cs b/core/Monitor.cs index 6a604c2..7ac23a4 100644 --- a/core/Monitor.cs +++ b/core/Monitor.cs @@ -534,6 +534,7 @@ db.Updateable<TN_InventoryM>(targetInM).UpdateColumns(it => new { it.ITEMSTATE }).ExecuteCommand(); } + targetInM = db.Queryable<TN_InventoryM>().LeftJoin<TN_CG_Detail>((o, i) => o.S_ID == i.S_ID). Where((o, i) => System.DateTime.Now >= o.EXPIRATION && i.S_ITEM_STATE == "寰呮" && i.N_ITEM_STATE == 1).First(); @@ -565,6 +566,13 @@ db.Updateable<TN_InventoryM>(targetInM).UpdateColumns(it => new { it.EXPIRATION_DAY }).ExecuteCommand(); } + var targetInM_De = db.Queryable<TN_InventoryM>().LeftJoin<TN_Task>((o, i) => o.RFID == i.S_CNTR_CODE). + Where((o, i) => i.N_B_STATE == 4 || i.S_B_STATE == "閿欒").ToList();//閿欒鐨勪换鍔″垹闄ゅ搴旂殑搴撳瓨淇℃伅 + if (targetInM_De.Count>0) + { + db.Deleteable<TN_InventoryM>(targetInM_De).ExecuteCommand(); + } + // 鍚屾 TN_DayProDetail var curDay = System.DateTime.Now.Date; var targetEPDs = db.Queryable<TN_EquipProDetail>().Where(a => a.DOWNLINETIME >= curDay && a.DOWNLINETIME <= curDay.AddDays(1)).ToList(); diff --git a/core/WCSCore.cs b/core/WCSCore.cs index 8d572b2..f1d10c1 100644 --- a/core/WCSCore.cs +++ b/core/WCSCore.cs @@ -175,7 +175,7 @@ } } }); - + break; case 8: diff --git a/models/TN_InventoryM.cs b/models/TN_InventoryM.cs index 96f339f..4a5df52 100644 --- a/models/TN_InventoryM.cs +++ b/models/TN_InventoryM.cs @@ -55,7 +55,7 @@ public DateTime EXPIRATION { get; set; } /// <summary> - /// 璺濈杩囨湡杩樻湁鍑犲ぉ + /// 璺濈杩囨湡杩樻湁鍑犲皬鏃� /// </summary> public string EXPIRATION_DAY { get; set; } = "0"; } diff --git a/wms/SpecHelper.cs b/wms/SpecHelper.cs index bd4bc53..9803712 100644 --- a/wms/SpecHelper.cs +++ b/wms/SpecHelper.cs @@ -407,6 +407,12 @@ } } + /// <summary> + /// 璁$畻鏃堕棿宸�+ /// </summary> + /// <param name="start"></param> + /// <param name="end"></param> + /// <returns></returns> public static int CalculateDaysDifference(DateTime start, DateTime end) { try @@ -420,11 +426,12 @@ return 0; } - // 鑾峰彇鎬诲ぉ鏁帮紙鍖呮嫭灏忔暟閮ㄥ垎锛�- double totalDays = difference.TotalDays; + + // 鑾峰彇鎬诲皬鏃舵暟锛堝寘鎷皬鏁伴儴鍒嗭級 + double totalHours = difference.TotalHours; // 鍚戜笂鍙栨暣 - return (int)Math.Ceiling(totalDays); + return (int)Math.Ceiling(totalHours); } catch (Exception ex) { -- Gitblit v1.9.1