| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IWMsInfoServices; |
| | |
| | | { |
| | | public class Inventory_BatchServices : ServiceBase<Dt_Inventory_Batch, IRepository<Dt_Inventory_Batch>>, IInventory_BatchServices |
| | | { |
| | | public Inventory_BatchServices(IRepository<Dt_Inventory_Batch> BaseDal) : base(BaseDal) |
| | | private IMessageInfoService _messageInfoService; |
| | | public Inventory_BatchServices(IRepository<Dt_Inventory_Batch> BaseDal, IMessageInfoService messageInfoService) : base(BaseDal) |
| | | { |
| | | _messageInfoService = messageInfoService; |
| | | } |
| | | |
| | | public IRepository<Dt_Inventory_Batch> Repository => BaseDal; |
| | | |
| | | public WebResponseContent GetExpiredAndlow() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | DateTime dateTime = DateTime.Now.AddDays(30).Date; |
| | | List<Dt_Inventory_Batch> inventory_Batches = BaseDal.QueryData(x => x.ValidityPeriod < dateTime); |
| | | foreach (var item in inventory_Batches) |
| | | { |
| | | var day = (item.ValidityPeriod - DateTime.Now).Days; |
| | | string d = $"è¿æ{day}å¤©è¿æ"; |
| | | if (day < 0) d = $"å·²è¿æ{Math.Abs(day)}天"; |
| | | _messageInfoService.AddMessageInfo(MessageGroupByEnum.InventoryExceedAlarm, "ç©æåç§°:" + item.MaterielName, $"ç©æç¼å·ã{item.MaterielCode}ãç©ææ¹æ¬¡ã{item.BatchNo}ã{d}"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |