|
|
@ -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<BillNumberRecord> _billNumberRecordCaches= new List<BillNumberRecord>() ;//记录内存
|
|
|
|
|
|
|
|
private readonly IObjectMapper _objectMapper; |
|
|
|
|
|
|
|
public BillNumberRecordDomainService( |
|
|
|
IRepository<BillNumberRecord, Guid> billNumberRepository, |
|
|
|
ILogger<M100CheckDomainService> logger, |
|
|
|
LogRemindDomainService logRemindDomainService, |
|
|
|
IRepository<WaitPrint, Guid> waitPrintRepository) |
|
|
|
IRepository<WaitPrint, Guid> waitPrintRepository, |
|
|
|
IObjectMapper objectMapper) |
|
|
|
{ |
|
|
|
_billNumberRepository = billNumberRepository; |
|
|
|
_logger = logger; |
|
|
|
_logRemindDomainService = logRemindDomainService; |
|
|
|
_waitPrintRepository = waitPrintRepository; |
|
|
|
_objectMapper = objectMapper; |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 获取和更新记录和内存
|
|
|
@ -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<BillNumberRecord>, List<BillNumberRecord>>(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; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 创建实体
|
|
|
|
/// </summary>
|
|
|
|