diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs index 6490ebf..d3fa72c 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs @@ -913,35 +913,6 @@ select * from { m100Obj.NeedReplenishPrint = 1; await _billM100Repository.UpdateAsync(m100Obj); - //var waititem=await _waitPrintRepository.GetAsync(r=>r.M100Id== m100Obj.Id); - // if (waititem == null) - // { - - // WaitPrint targetWaitPrint = new WaitPrint(GuidGenerator.Create()); - // targetWaitPrint.M100Id = m100Obj.Id; - // //targetWaitPrint.BusinessType = m100Obj.BusinessType; - // //targetWaitPrint.ProductLine = sourceWaitPrint.ProductLine; - // //targetWaitPrint.OnlineTime = sourceWaitPrint.OnlineTime; - // //targetWaitPrint.HostSN = breaknum.ToString().Right(5).TryToIntZero(); - // //targetWaitPrint.KNR = null; - // //targetWaitPrint.VIN = null; - // //targetWaitPrint.VehicleModelCode = null; - // //targetWaitPrint.AssemblyID = null; - // //targetWaitPrint.BillStatus = BillStatusEnum.BreakNum; - // //targetWaitPrint.PrintType = PrintTypeEnum.ReplenishPrint; - // //targetWaitPrint.HostSN2 = Convert.ToInt32 (m100Obj.HostSN2); - // //targetWaitPrint.Description = null; - // //targetWaitPrint.ReceiveTime = null; - // //targetWaitPrint.CreationTime = null; - // //targetWaitPrint.CreatorId = null; - // //targetWaitPrint.LastModificationTime = null; - // //targetWaitPrint.LastModifierId = null; - // await _waitPrintRepository.InsertAsync(targetWaitPrint); - // } - // else - // { - // waititem.PrintType =PrintTypeEnum.ReplenishPrint; - // } } #endregion } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs index 88dfda1..c6e5af3 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs @@ -6,6 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Auditing; namespace WY.NewJit.MsgCheck @@ -13,7 +14,7 @@ namespace WY.NewJit.MsgCheck /// /// 单号纪律表 /// - public class BillNumberRecord : AuditedAggregateRoot + public class BillNumberRecord : Entity { public BillNumberRecord() { @@ -27,34 +28,35 @@ namespace WY.NewJit.MsgCheck RecordNumber = recordNumber; InsertedRows = insertedRows; UpdateTime = updateTime; + Datas= new List(); } /// /// 产线# /// - public virtual string ProductLine { get; set; } + public string ProductLine { get; set; } /// /// 轮数# /// - public virtual int RoundNumber { get; set; } + public int RoundNumber { get; set; } /// /// 记录号# /// - public virtual int RecordNumber { get; set; } + public int RecordNumber { get; set; } /// /// 插入数据条数# /// - public virtual int InsertedRows { get; set; } + public int InsertedRows { get; set; } /// /// 更新时间# /// - public virtual DateTime UpdateTime { get; set; } + public DateTime? UpdateTime { get; set; } /// /// 一次处理后成的号码列表 /// [NotMapped] - public virtual List Datas { get; set; } = new List(); + public List Datas { get; set; } = new List(); } } 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 9781ce5..cc748f6 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 @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Logging; + +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; @@ -7,6 +8,7 @@ using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; +using Volo.Abp.ObjectMapping; using WY.NewJit.MsgBaseData; using WY.NewJit.PrintTable; @@ -20,16 +22,20 @@ namespace WY.NewJit.MsgCheck private readonly LogRemindDomainService _logRemindDomainService; public static List _billNumberRecordCaches= new List() ;//记录内存 + private readonly IObjectMapper _objectMapper; + public BillNumberRecordDomainService( IRepository billNumberRepository, ILogger logger, LogRemindDomainService logRemindDomainService, - IRepository waitPrintRepository) + IRepository waitPrintRepository, + IObjectMapper objectMapper) { _billNumberRepository = billNumberRepository; _logger = logger; _logRemindDomainService = logRemindDomainService; _waitPrintRepository = waitPrintRepository; + _objectMapper = objectMapper; } /// /// 获取和更新记录和内存 @@ -58,21 +64,27 @@ namespace WY.NewJit.MsgCheck else { _billNumberRecordCaches.Clear(); - _billNumberRecordCaches = await _billNumberRepository.GetListAsync(); - //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("获取记录缓存错误!"); - // } - // } - //} + //_billNumberRecordCaches = await _billNumberRepository.GetListAsync(); + var aa = await _billNumberRepository.GetListAsync(); + _billNumberRecordCaches = _objectMapper.Map, List>(aa); + + foreach (var item in _billNumberRecordCaches) + { + + var aaaa = item.RecordNumber; + 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 + item.RoundNumber * 100000) != max) + { + ret.Status = false; + ret.Message = "获取记录缓存错误!"; + _logger.LogDebug("获取记录缓存错误!"); + } + } + } + } return ret; } @@ -88,14 +100,7 @@ namespace WY.NewJit.MsgCheck var recordcache= _billNumberRecordCaches.FirstOrDefault(r=>r.ProductLine==productLine); if (recordcache == null) { - recordcache = new BillNumberRecord( - GuidGenerator.Create(), - productLine, - 1, - number, - 0, - DateTime.Now - ); + recordcache = new BillNumberRecord( GuidGenerator.Create(), productLine, 1,number,0, DateTime.Now); _billNumberRecordCaches.Add(recordcache); var item = CreatPrintData(BillNumberTypeEnum.正常, number, 1 * 100000); datas.Add(item); @@ -168,6 +173,7 @@ namespace WY.NewJit.MsgCheck return recordcache; } + /// /// 创建实体 ///