From fce5082110794e481f7bfcb19661de5dd5b943e0 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Tue, 7 Nov 2023 14:35:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MsgCheck/BillM100s/BillM100AppService.cs | 6 ++-- .../Services/BillNumberRecordDomainService.cs | 31 +++++++++++++------ .../MsgCheck/Services/M100DomainService.cs | 14 ++++----- 3 files changed, 32 insertions(+), 19 deletions(-) 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 52fc123..5bf0756 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 @@ -230,11 +230,11 @@ namespace WY.NewJit.MsgCheck [UnitOfWork] [HttpPost] [Route("get-billnumberrec")] - public async Task> GetBillNumberRec(bool isupdate) + public async Task GetBillNumberRec(bool isupdate) { - var aaa =await _aaa.GetOrUpDateBillNumberRecordCache(isupdate); - return aaa; + var ret = await _aaa.GetOrUpDateBillNumberRecordCache(isupdate); + return ret.Status; } /// /// 查询柱护板 diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs index 4e9b251..d2ce9cb 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs @@ -14,7 +14,7 @@ namespace WY.NewJit.MsgCheck public class BillNumberRecordDomainService : DomainService { private readonly IRepository _billNumberRepository; - // private readonly IRepository _waitPrintRepository; + private readonly IRepository _waitPrintRepository; private ILogger _logger; private readonly LogRemindDomainService _logRemindDomainService; public static List _billNumberRecordCaches= new List() ; @@ -22,11 +22,13 @@ namespace WY.NewJit.MsgCheck public BillNumberRecordDomainService( IRepository billNumberRepository, ILogger logger, - LogRemindDomainService logRemindDomainService) + LogRemindDomainService logRemindDomainService, + IRepository waitPrintRepository) { _billNumberRepository = billNumberRepository; _logger = logger; _logRemindDomainService = logRemindDomainService; + _waitPrintRepository = waitPrintRepository; } /// /// 清空缓存 @@ -36,8 +38,9 @@ namespace WY.NewJit.MsgCheck _billNumberRecordCaches.Clear(); } - public async Task> GetOrUpDateBillNumberRecordCache(bool isupdate) + public async Task GetOrUpDateBillNumberRecordCache(bool isupdate) { + ObjectResultDto ret = new ObjectResultDto(true, null); if (isupdate) { await _billNumberRepository.UpdateManyAsync(_billNumberRecordCaches); @@ -45,13 +48,22 @@ namespace WY.NewJit.MsgCheck else { _billNumberRecordCaches = await _billNumberRepository.GetListAsync(); - //foreach (var item in _billNumberRecordCaches) - //{ - // var iii=await _waitPrintRepository.GetListAsync(r => r.ProductLine == item.ProductLine); - // var ss= iii.Select(r => r.HostSN2).Max(); - //} + foreach (var item in _billNumberRecordCaches) + { + var list = await _waitPrintRepository.GetListAsync(r => r.ProductLine == item.ProductLine); + if (list.Count > 0) + { + var max = list.Select(r => r.HostSN2).Max(); + if(item.RecordNumber!= max) + { + ret.Status = false; + ret.Message = "获取记录缓存错误!"; + _logger.LogDebug("获取记录缓存错误!"); + } + } + } } - return _billNumberRecordCaches; + return ret; } /// /// 解析号码 @@ -143,5 +155,6 @@ namespace WY.NewJit.MsgCheck item.HostSN2 = item.HostSN + item.Round; return item; } + } } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs index 71446de..65d3db2 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs @@ -47,11 +47,11 @@ namespace WY.NewJit.MsgCheck { //调用HostSN2方法 BillNumberRecord billNumRec = await _billNumRecDomainSrv.GetBillNumber(m100Obj.HostSN.TryToIntNotNull(), m100Obj.ProductLine); - var normalObj = billNumRec.dic.FirstOrDefault(itm => itm.Value == BillNumberTypeEnum.正常); - var lateObj = billNumRec.dic.FirstOrDefault(itm => itm.Value == BillNumberTypeEnum.迟到); - var breaknumLst = billNumRec.dic.Where(itm => itm.Value == BillNumberTypeEnum.断号).ToList(); + var normalObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.正常); + var lateObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.迟到); + var breaknumLst = billNumRec.Datas.Where(itm => itm.BillNumberType == BillNumberTypeEnum.断号).ToList(); //更新M100 - m100Obj.HostSN2 = normalObj.Key.TryToInt(); + m100Obj.HostSN2 = normalObj.HostSN2.TryToInt(); //M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录 WaitPrint[] wpArr; if (m100Obj.ProductLine == "08") @@ -87,7 +87,7 @@ namespace WY.NewJit.MsgCheck targetWaitPrint.AssemblyID = null; targetWaitPrint.BillStatus = BillStatusEnum.BreakNum; targetWaitPrint.PrintType = PrintTypeEnum.OrderPrint; - targetWaitPrint.HostSN2 = breaknum.Key.TryToIntZero(); + targetWaitPrint.HostSN2 = breaknum.HostSN2; targetWaitPrint.Description = null; targetWaitPrint.ReceiveTime = null; targetWaitPrint.CreationTime = null; @@ -101,12 +101,12 @@ namespace WY.NewJit.MsgCheck } //处理正常、迟到 BillM100 m100Ret = null; - if (normalObj.Key != null) //正常 + if (normalObj != null) //正常 { m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100 await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表 } - else if (lateObj.Key != null) //迟到 + else if (lateObj != null) //迟到 { m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100