Browse Source

打印纪律服务添加注释

master
lvzb 1 year ago
parent
commit
3606af5aec
  1. 24
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs

24
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs

@ -23,7 +23,7 @@ namespace WY.NewJit.MsgCheck
private ILogger<M100CheckDomainService> _logger;//日志 private ILogger<M100CheckDomainService> _logger;//日志
private readonly LogRemindDomainService _logRemindDomainService; private readonly LogRemindDomainService _logRemindDomainService;
private readonly Microsoft.Extensions.Configuration.IConfiguration _configuration;//配置 private readonly Microsoft.Extensions.Configuration.IConfiguration _configuration;//配置
public static List<BillNumberRecord> _billNumberRecordCaches= new List<BillNumberRecord>() ;//记录内 public static List<BillNumberRecord> _billNumberRecordCaches = new List<BillNumberRecord>();//记录缓
public BillNumberRecordDomainService( public BillNumberRecordDomainService(
IRepository<BillNumberRecord, Guid> billNumberRepository, IRepository<BillNumberRecord, Guid> billNumberRepository,
@ -41,38 +41,38 @@ namespace WY.NewJit.MsgCheck
/// <summary> /// <summary>
/// 获取和更新记录和内存 /// 获取和更新记录和内存
/// </summary> /// </summary>
/// <param name="isupdate"></param> /// <param name="isupdate">true 更新缓存 false 获取缓存</param>
/// <returns></returns> /// <returns></returns>
public async Task<ObjectResultDto> GetOrUpDateBillNumberRecordCache(bool isupdate) public async Task<ObjectResultDto> GetOrUpDateBillNumberRecordCache(bool isupdate)
{ {
ObjectResultDto ret = new ObjectResultDto(true, null); ObjectResultDto ret = new ObjectResultDto(true, null);
if (isupdate) if (isupdate)
{ {
//await _billNumberRepository.UpdateManyAsync(_billNumberRecordCaches);
foreach (var item in _billNumberRecordCaches) foreach (var item in _billNumberRecordCaches)
{ {
var re = await _billNumberRepository.GetListAsync(r => r.Id == item.Id); var re = await _billNumberRepository.GetListAsync(r => r.Id == item.Id);
if (re.Count == 0) if (re.Count == 0)
{ {
await _billNumberRepository.InsertAsync(item); await _billNumberRepository.InsertAsync(item);//缓存记录表无纪律则插入
} }
else else
{ {
await _billNumberRepository.UpdateAsync(item); await _billNumberRepository.UpdateAsync(item);//缓存记录表有纪律则更新
} }
} }
} }
else else
{ {
_billNumberRecordCaches.Clear(); _billNumberRecordCaches.Clear();//清空缓存
_billNumberRecordCaches = await _billNumberRepository.GetListAsync(); _billNumberRecordCaches = await _billNumberRepository.GetListAsync();
//验证验证记录缓存和未打印列表里是否一致
foreach (var item in _billNumberRecordCaches) foreach (var item in _billNumberRecordCaches)
{ {
var list = await _waitPrintRepository.GetListAsync(r => r.ProductLine == item.ProductLine); var list = await _waitPrintRepository.GetListAsync(r => r.ProductLine == item.ProductLine);
if (list.Count > 0) if (list.Count > 0) //当未打印列表里有未打印数据则验证
{ {
var max = list.Select(r => r.HostSN2).Max(); var max = list.Select(r => r.HostSN2).Max(); //当前产线未打印列表里hostsn2最大号
if ((item.RecordNumber + item.RoundNumber * 100000) != max) if ((item.RecordNumber + item.RoundNumber * 100000) != max)//验证记录缓存和未打印列表里是否一致不一致报错
{ {
ret.Status = false; ret.Status = false;
ret.Message = "获取记录缓存错误!"; ret.Message = "获取记录缓存错误!";
@ -87,14 +87,14 @@ namespace WY.NewJit.MsgCheck
/// <summary> /// <summary>
/// 解析号码 /// 解析号码
/// </summary> /// </summary>
/// <param name="number"></param> /// <param name="number">大众顺序号</param>
/// <param name="productLine"></param> /// <param name="productLine">产线</param>
/// <returns></returns> /// <returns></returns>
public async Task<BillNumberRecord> GetBillNumber(int number, string productLine) public async Task<BillNumberRecord> GetBillNumber(int number, string productLine)
{ {
List<PrintData> datas = new List<PrintData>(); List<PrintData> datas = new List<PrintData>();
var recordcache = _billNumberRecordCaches.FirstOrDefault(r => r.ProductLine == productLine); var recordcache = _billNumberRecordCaches.FirstOrDefault(r => r.ProductLine == productLine);
if (recordcache == null) 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); _billNumberRecordCaches.Add(recordcache);

Loading…
Cancel
Save