From e5c661c9d5dd92eecd810e6ce11ff67ec38b08f0 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期三, 29 十月 2025 01:28:40 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/FangCangZhiNeng
---
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs | 78 --------------------------------------
1 files changed, 1 insertions(+), 77 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
index 0859da2..4b06b24 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/InventoryInfoService.cs"
@@ -25,82 +25,6 @@
}
public IRepository<Dt_InventoryInfo> Repository => BaseDal;
- public WebResponseContent GetExpiredAndlow()
- {
- try
- {
- // 鑾峰彇褰撳墠鏃堕棿锛堝彧鍙栨棩鏈熼儴鍒嗭紝蹇界暐鏃堕棿锛�
- DateTime currentDate = DateTime.Today;
- // 璁$畻30澶╁悗鐨勬棩鏈�
- DateTime thresholdDate = currentDate.AddDays(30);
-
- // 鏌ユ壘搴撳瓨涓墍鏈夊晢鍝�
- var inventoryList = BaseDal.QueryData();
- var expiredSoonList = new List<object>();
-
- foreach (var item in inventoryList)
- {
- // 妫�鏌alidityPeriod鏄惁涓虹┖
- if (string.IsNullOrEmpty(item.ValidityPeriod))
- continue;
-
- // 浣跨敤绮剧‘鏍煎紡瑙f瀽 "2037-10-02"
- if (DateTime.TryParseExact(item.ValidityPeriod.Trim(), "yyyy-MM-dd",
- System.Globalization.CultureInfo.InvariantCulture,
- System.Globalization.DateTimeStyles.None, out DateTime expiryDate))
- {
- // 璁$畻鍓╀綑澶╂暟锛堝彧姣旇緝鏃ユ湡閮ㄥ垎锛�
- double daysRemaining = (expiryDate - currentDate).TotalDays;
-
- // 妫�鏌ユ槸鍚﹀湪30澶╁唴锛堝寘鎷凡杩囨湡鐨勶級
- if (daysRemaining <= 30)
- {
- expiredSoonList.Add(new
- {
- MaterielCode = item.MaterielCode ?? "",
- BatchNo = item.BatchNo ?? "",
- ValidityPeriod = item.ValidityPeriod,
- ExpiryDate = expiryDate.ToString("yyyy-MM-dd"),
- });
- }
- }
- else
- {
- // 璁板綍瑙f瀽澶辫触鐨勮褰曪紙鐢ㄤ簬璋冭瘯锛�
- Console.WriteLine($"鏃犳硶瑙f瀽鏁堟湡: {item.ValidityPeriod}");
- }
- }
-
- // 鎸夊墿浣欏ぉ鏁板崌搴忔帓鍒楋紙鍗冲皢杩囨湡鐨勬帓鍓嶉潰锛�
- var sortedList = expiredSoonList.OrderBy(x =>
- {
- var days = (int)((dynamic)x).DaysRemaining;
- return days;
- }).ToList();
-
- return new WebResponseContent
- {
- Status = true,
- Message = $"鍙戠幇 {sortedList.Count} 涓晢鍝佸皢鍦�30澶╁唴杩囨湡",
- Data = new
- {
- TotalCount = sortedList.Count,
- ExpiredCount = sortedList.Count(x => ((dynamic)x).DaysRemaining < 0),
- WarningCount = sortedList.Count(x => ((dynamic)x).DaysRemaining >= 0),
- CheckDate = currentDate.ToString("yyyy-MM-dd"),
- Items = sortedList
- }
- };
- }
- catch (Exception ex)
- {
- return new WebResponseContent
- {
- Status = false,
- Message = $"鑾峰彇鏁堟湡鏁版嵁澶辫触: {ex.Message}"
- };
- }
- }
/// <summary>
/// 鑾峰彇搴撳瓨
@@ -152,6 +76,6 @@
}
-
+
}
}
--
Gitblit v1.9.3