diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs index e879029..14bc956 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Interfaces/IBillM100AppService.cs @@ -101,6 +101,8 @@ namespace WY.NewJit.MsgCheck /// 生产线超时情况 Task> ProductLineTimeoutRemind(TimeOutRemindInputDto input); + Task> ProductLineTimeoutRemind_New(TimeOutRemindInputDto input); + Task> GetReplenishPrintListAsync(QueryBillM100Dto input); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs index 09219e9..0bf845a 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs @@ -26,6 +26,7 @@ using System.Reflection; using WY.NewJit.Commons; using Volo.Abp; using System.Diagnostics; +using WY.NewJit.PrintTable; namespace WY.NewJit.MsgCheck { @@ -116,6 +117,8 @@ namespace WY.NewJit.MsgCheck private readonly IRepository _tbBillHisRepository; private readonly IRepository _tsSortDetailHisRepository; + private readonly IRepository _waitPrintRepository; + /// /// 错误信息前缀 /// @@ -134,6 +137,13 @@ namespace WY.NewJit.MsgCheck /// private List _zhbCacheList = new List(); #endregion + + #region 缓存 + /// + /// 超时提醒缓存 + /// + private static List _timeoutCacheList = new List(); + #endregion private readonly BillNumberRecordDomainService _aaa; #region 构造函数 /// @@ -157,7 +167,8 @@ namespace WY.NewJit.MsgCheck IUnitOfWorkManager unitOfWorkManager, IRepository tbBillHisRepository, IRepository tsSortDetailHisRepository, - BillNumberRecordDomainService aaa + BillNumberRecordDomainService aaa, + IRepository waitPrintRepository //IRepository printTemplateConfigurationRepository, //IRepository zHBPrintStatusRepository @@ -182,6 +193,7 @@ namespace WY.NewJit.MsgCheck _tbBillHisRepository = tbBillHisRepository; _tsSortDetailHisRepository = tsSortDetailHisRepository; _aaa = aaa; + _waitPrintRepository = waitPrintRepository; //_printTemplateConfigurationRepository = printTemplateConfigurationRepository; //_zHBPrintStatusRepository = zHBPrintStatusRepository; } @@ -592,7 +604,7 @@ select * from ListResultDto ret = new ListResultDto(billLst); int printBillCnt = 0; - if (input.PrintType == PrintTypeEnum.正常打印) + if (input.PrintType == Extends.PaiGe.PrintTypeEnum.正常打印) { if ((input.BeginHostSN % 10000) > 1999) { @@ -656,7 +668,7 @@ select * from return ret; } } - else if (input.PrintType == PrintTypeEnum.补账打印) + else if (input.PrintType == Extends.PaiGe.PrintTypeEnum.补账打印) { //string beginVin = input.BeginVin.TryToRight(6); //string endVin = input.EndVin.TryToRight(6); @@ -680,7 +692,7 @@ select * from } # region 断号处理 - if (isFillBreakNum == true && billLst.Count > 1 && input.PrintType != PrintTypeEnum.补账打印) + if (isFillBreakNum == true && billLst.Count > 1 && input.PrintType != Extends.PaiGe.PrintTypeEnum.补账打印) { billLst = DoBreakNumOperation(input.BeginHostSN, input.EndHostSN, billLst); } @@ -2169,6 +2181,68 @@ select * from return new ListResultDto(retLst); } + + /// + /// 生产线超时提醒(新) + /// 先取未打印列表然后更新缓存列表,如果未打印列表为空取m100更新缓存列表 + /// 当未打印列表没有数据,则取缓存列表返回 + /// + /// 生产线编号列表 + /// 生产线超时情况 + [UnitOfWork] + [HttpPost] + [Route("product-line-timeout-remind-new")] + public virtual async Task> ProductLineTimeoutRemind_New(TimeOutRemindInputDto input) + { + List retLst = new List(); + foreach (string plStr in input.ProductLineList) + { + TimeOutRemindResultDto retObj = new TimeOutRemindResultDto(); + retObj.ProductLine = plStr; + retObj.ConfigMinutes = _configuration[$"ConfigDic:ProductLineTimeoutRemind_New:{plStr}"].TryToInt() ?? 30; + + int maxSN2= await _waitPrintRepository.Where(itm => itm.ProductLine == plStr).MaxAsync(itm => itm.HostSN2); + WaitPrint lastitem = await _waitPrintRepository.FirstOrDefaultAsync(itm => itm.ProductLine == plStr && itm.HostSN2 == maxSN2); + var cache = _timeoutCacheList.FirstOrDefault(itm => itm.ProductLine == plStr); + if (lastitem != null) + { + retObj.LastReceiveTime = lastitem.ReceiveTime ?? ServerHelper.CurrentDateTime; + retObj.TimeoutMinutes = MinuteDiff(retObj.LastReceiveTime, ServerHelper.CurrentDateTime); + if (cache != null) + { + cache.ConfigMinutes = retObj.ConfigMinutes; + cache.LastReceiveTime = retObj.LastReceiveTime; + cache.TimeoutMinutes = retObj.TimeoutMinutes; + } + else + { + _timeoutCacheList.Add(retObj); + } + } + else + { + if (cache != null) + { + retObj.LastReceiveTime = cache.LastReceiveTime; + retObj.TimeoutMinutes = MinuteDiff(cache.LastReceiveTime, ServerHelper.CurrentDateTime); + } + else + { + string maxSNStr = await _billM100Repository.Where(itm => itm.ProductLine == plStr).MaxAsync(itm => itm.SerialNumStr); + BillM100 lastBill = await _billM100Repository.FirstOrDefaultAsync(itm => itm.ProductLine == plStr && itm.SerialNumStr == maxSNStr); + if (lastBill != null) + { + retObj.LastReceiveTime = lastBill.ReceiveTime ?? ServerHelper.CurrentDateTime; + retObj.TimeoutMinutes = MinuteDiff(retObj.LastReceiveTime, ServerHelper.CurrentDateTime); + } + _timeoutCacheList.Add(retObj); + } + } + retLst.Add(retObj); + } + return new ListResultDto(retLst); + } + private int MinuteDiff(DateTime beginTime, DateTime endTime) { TimeSpan beginSpan = new TimeSpan(beginTime.Ticks); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml index 155ff25..a8dd94d 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml @@ -973,7 +973,12 @@ 柱护板缓存列表(打印柱护板时用到) - + + + 超时提醒缓存 + + + 构造函数 @@ -1081,6 +1086,13 @@ 生产线编号列表 生产线超时情况 + + + 生产线超时提醒(新) + + 生产线编号列表 + 生产线超时情况 + 保存柱护板装箱单报表