Browse Source

生成记录号方法修改

master
lvzb 1 year ago
parent
commit
1fe88246f8
  1. 29
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
  2. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
  3. 17
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs
  4. 141
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs

29
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs

@ -118,7 +118,7 @@ namespace WY.NewJit.MsgCheck
/// 序列领域服务 /// 序列领域服务
/// </summary> /// </summary>
private readonly SequenceDomainService _sequenceDomainService; private readonly SequenceDomainService _sequenceDomainService;
private readonly BillNumberRecordDomainService _aaa;
/// <summary> /// <summary>
/// 配置 /// 配置
/// </summary> /// </summary>
@ -180,11 +180,12 @@ namespace WY.NewJit.MsgCheck
IRepository<FisTB_BILL_HIS> tbBillHisRepository, IRepository<FisTB_BILL_HIS> tbBillHisRepository,
IRepository<FisTS_SORT_DETAIL_HIS> tsSortDetailHisRepository, IRepository<FisTS_SORT_DETAIL_HIS> tsSortDetailHisRepository,
IRepository<PrintTemplateConfiguration,Guid> printTemplateConfigurationRepository, IRepository<PrintTemplateConfiguration,Guid> printTemplateConfigurationRepository,
IRepository<ZHBPrintStatus, Guid> zHBPrintStatusRepository IRepository<ZHBPrintStatus, Guid> zHBPrintStatusRepository,
BillNumberRecordDomainService aaa
) )
{ {
_aaa = aaa;
_billM100Repository = BillM100Repository; _billM100Repository = BillM100Repository;
_billM100PartRepository = BillM100PartRepository; _billM100PartRepository = BillM100PartRepository;
_logger = logger; _logger = logger;
@ -213,6 +214,28 @@ namespace WY.NewJit.MsgCheck
#endregion #endregion
#region 私有方法 #region 私有方法
[UnitOfWork]
[HttpPost]
[Route("get-billnumber")]
public async Task<BillNumberRecord> GetBillNumber(int number, string productLine,bool t)
{
if (t)
{
_aaa.CleanBillNumberRecordCache();
}
var res=await _aaa.GetBillNumber(number, productLine);
return res;
}
[UnitOfWork]
[HttpPost]
[Route("get-billnumberrec")]
public async Task<List<BillNumberRecord>> GetBillNumberRec(bool isupdate)
{
var aaa =await _aaa.GetOrUpDateBillNumberRecordCache(isupdate);
return aaa;
}
/// <summary> /// <summary>
/// 查询柱护板 /// 查询柱护板
/// </summary> /// </summary>

2
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

@ -988,7 +988,7 @@
柱护板缓存列表(打印柱护板时用到) 柱护板缓存列表(打印柱护板时用到)
</summary> </summary>
</member> </member>
<member name="M:WY.NewJit.MsgCheck.BillM100AppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100Part,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgCheck.BillM100AppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.MenBanPackingList,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.ZhuHuBanPackingList,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgVehicle,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PartCfg,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.MaterialExt,System.Guid},WY.NewJit.EntityFrameworkCore.WMSDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.MenBanPackingRec,System.Guid},WY.NewJit.MsgBaseData.LineSNDomianService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.ZhuHuBanPackingRec,System.Guid},WY.NewJit.Commons.SequenceDomainService,Microsoft.Extensions.Configuration.IConfiguration,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTB_BILL},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTS_SORT_DETAIL},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTB_BILL_HIS},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTS_SORT_DETAIL_HIS},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PrintTemplateConfiguration,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.ZHBPrintStatus,System.Guid})"> <member name="M:WY.NewJit.MsgCheck.BillM100AppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100Part,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgCheck.BillM100AppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.MenBanPackingList,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.ZhuHuBanPackingList,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgVehicle,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PartCfg,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.MaterialExt,System.Guid},WY.NewJit.EntityFrameworkCore.WMSDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.MenBanPackingRec,System.Guid},WY.NewJit.MsgBaseData.LineSNDomianService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.ZhuHuBanPackingRec,System.Guid},WY.NewJit.Commons.SequenceDomainService,Microsoft.Extensions.Configuration.IConfiguration,Volo.Abp.Uow.IUnitOfWorkManager,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTB_BILL},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTS_SORT_DETAIL},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTB_BILL_HIS},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.Extends.PaiGe.WMS.FisTS_SORT_DETAIL_HIS},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PrintTemplateConfiguration,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.ZHBPrintStatus,System.Guid},WY.NewJit.MsgCheck.BillNumberRecordDomainService)">
<summary> <summary>
构造函数 构造函数
</summary> </summary>

17
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs

@ -15,6 +15,21 @@ namespace WY.NewJit.MsgCheck
/// </summary> /// </summary>
public class BillNumberRecord : AuditedAggregateRoot<Guid> public class BillNumberRecord : AuditedAggregateRoot<Guid>
{ {
public BillNumberRecord()
{
}
public BillNumberRecord(Guid id, string productLine, int roundNumber, int recordNumber, int insertedRows, DateTime updateTime) : base(id)
{
ProductLine = productLine;
RoundNumber = roundNumber;
RecordNumber = recordNumber;
InsertedRows = insertedRows;
UpdateTime = updateTime;
}
/// <summary> /// <summary>
/// 产线# /// 产线#
/// </summary> /// </summary>
@ -39,7 +54,7 @@ namespace WY.NewJit.MsgCheck
/// 一次处理后成的号码列表 /// 一次处理后成的号码列表
/// </summary> /// </summary>
[NotMapped] [NotMapped]
public virtual List<PrintData> Datas { get; set; } public virtual List<PrintData> Datas { get; set; } = new List<PrintData>();
} }
} }

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

@ -7,14 +7,18 @@ using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using WY.NewJit.MsgBaseData; using WY.NewJit.MsgBaseData;
using WY.NewJit.PrintTable;
namespace WY.NewJit.MsgCheck namespace WY.NewJit.MsgCheck
{ {
public class BillNumberRecordDomainService : DomainService public class BillNumberRecordDomainService : DomainService
{ {
private readonly IRepository<BillNumberRecord, Guid> _billNumberRepository; private readonly IRepository<BillNumberRecord, Guid> _billNumberRepository;
// private readonly IRepository<WaitPrint, Guid> _waitPrintRepository;
private ILogger<M100CheckDomainService> _logger; private ILogger<M100CheckDomainService> _logger;
private readonly LogRemindDomainService _logRemindDomainService; private readonly LogRemindDomainService _logRemindDomainService;
public static List<BillNumberRecord> _billNumberRecordCaches= new List<BillNumberRecord>() ;
public BillNumberRecordDomainService( public BillNumberRecordDomainService(
IRepository<BillNumberRecord, Guid> billNumberRepository, IRepository<BillNumberRecord, Guid> billNumberRepository,
ILogger<M100CheckDomainService> logger, ILogger<M100CheckDomainService> logger,
@ -24,99 +28,120 @@ namespace WY.NewJit.MsgCheck
_logger = logger; _logger = logger;
_logRemindDomainService = logRemindDomainService; _logRemindDomainService = logRemindDomainService;
} }
/// <summary>
/// 清空缓存
/// </summary>
public void CleanBillNumberRecordCache()
{
_billNumberRecordCaches.Clear();
}
public async Task<List<BillNumberRecord>> GetOrUpDateBillNumberRecordCache(bool isupdate)
{
if (isupdate)
{
await _billNumberRepository.UpdateManyAsync(_billNumberRecordCaches);
}
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();
//}
}
return _billNumberRecordCaches;
}
/// <summary>
/// 解析号码
/// </summary>
/// <param name="number"></param>
/// <param name="productLine"></param>
/// <returns></returns>
public async Task<BillNumberRecord> GetBillNumber(int number, string productLine) public async Task<BillNumberRecord> GetBillNumber(int number, string productLine)
{ {
BillNumberRecord record = new BillNumberRecord();
List<PrintData> datas = new List<PrintData>(); List<PrintData> datas = new List<PrintData>();
var bill = await _billNumberRepository.GetAsync(r => r.ProductLine == productLine); var recordcache= _billNumberRecordCaches.FirstOrDefault(r=>r.ProductLine==productLine);
int recordNumber = bill.RecordNumber;//记录号 int recordNumber = recordcache.RecordNumber;//记录号
int roundNumber = bill.RoundNumber; int roundNumber = recordcache.RoundNumber; //记录轮数
int x = number - recordNumber; int x = number - recordNumber;
//当接到顺序号减去记录的顺序号小于-1000时代表了该号码属于新轮次里的顺序号(下一轮)
//更新数据库记录号、轮数+1
//插入未打印列表 数为 (1999-r)+(x-1)+1
if (x <= -1000) if (x <= -1000)
{ {
roundNumber++; roundNumber++;
record.InsertedRows = (1999 - recordNumber) + (number - 1) + 1; recordcache.InsertedRows = (1999 - recordNumber) + (number - 1) + 1;
for (int i = 1; i <= record.InsertedRows; i++)
for (int i = 1; i <= recordcache.InsertedRows; i++)
{ {
PrintData data = new PrintData(); PrintData item = new PrintData();
BillNumberTypeEnum type = BillNumberTypeEnum.; BillNumberTypeEnum type = BillNumberTypeEnum.;
if (i + recordNumber > 1999) if (i + recordNumber > 1999)
{ {
if ((i + recordNumber - 1999) != number) type = BillNumberTypeEnum.; if ((i + recordNumber - 1999) != number) type = BillNumberTypeEnum.;
data.HostSN = i + recordNumber - 1999; item = CreatPrintData(type, i + recordNumber - 1999, roundNumber * 100000);
data.Round = roundNumber * 100000;
data.HostSN2 = roundNumber * 100000 + i + recordNumber - 1999;
// ls.Add((roundNumber.ToString()+(i + recordNumber - 1999).ToString()), type);
} }
else else
{ {
if ((i + recordNumber) != number) type = BillNumberTypeEnum.; if ((i + recordNumber) != number) type = BillNumberTypeEnum.;
data.HostSN = i + recordNumber;
data.Round = roundNumber * 100000;
data.HostSN2 = roundNumber * 100000 + i + recordNumber;
// ls.Add((roundNumber.ToString()+(i + recordNumber).ToString()), type);
}
data.BillNumberType = type;
item = CreatPrintData(type, i + recordNumber, (roundNumber - 1) * 100000);
}
datas.Add(item);
} }
recordNumber = number; recordcache.RecordNumber = number;
record.RoundNumber= roundNumber+1; recordcache.RoundNumber = roundNumber;
} }
//当接到顺序号减去记录的顺序号小于0大于-1000时代表了该号码属于记录轮次里的顺序号(当前轮)
//不更新数据库记录号和轮数
else if (-1000 < x && x < 0) else if (-1000 < x && x < 0)
{ {
PrintData data = new PrintData(); var item = CreatPrintData(BillNumberTypeEnum., number, roundNumber * 100000);
record.RoundNumber = roundNumber; datas.Add(item);
record.InsertedRows = 0;
data.BillNumberType = BillNumberTypeEnum.;
data.HostSN = recordNumber;
data.Round = roundNumber * 100000;
data.HostSN2 = roundNumber * 100000 + recordNumber;
datas.Add(data);
// ls.Add((roundNumber.ToString() + (recordNumber).ToString()), BillNumberTypeEnum.迟到);
} }
//当接到顺序号减去记录的顺序号小于1000大于0时代表了该号码属于记录轮次里的顺序号(当前轮)
//更新数据库记录号、不更新轮数
//插入未打印列表 插入条数为|x-r|条
else if (0 < x && x < 1000) else if (0 < x && x < 1000)
{ {
record.RoundNumber = roundNumber; recordcache.InsertedRows = (number - recordNumber);
record.RoundNumber = (number - recordNumber); for (int i = 1; i <= recordcache.InsertedRows; i++)
for (int i = 1; i <= record.RoundNumber; i++)
{ {
PrintData data = new PrintData();
BillNumberTypeEnum type = BillNumberTypeEnum.; BillNumberTypeEnum type = BillNumberTypeEnum.;
if ((i + recordNumber) != number) type = BillNumberTypeEnum.; if ((i + recordNumber) != number) type = BillNumberTypeEnum.;
var item = CreatPrintData(type, i + recordNumber, roundNumber * 100000);
data.BillNumberType = type; datas.Add(item);
data.HostSN = i + recordNumber;
data.Round = roundNumber * 100000;
data.HostSN2 = roundNumber * 100000 + i + recordNumber;
datas.Add(data);
// ls.Add((roundNumber.ToString() + (i + recordNumber).ToString()), type);
} }
recordNumber = number; recordcache.RecordNumber = number;
} }
//当接到顺序号减去记录的顺序号大于1000时代表了该号码属于记录轮次的上一个轮次里的顺序号(上一轮)
//不更新数据库记录号和轮数
else if (x >= 1000) else if (x >= 1000)
{ {
PrintData data = new PrintData(); var item = CreatPrintData(BillNumberTypeEnum., number, (roundNumber - 1) * 100000);
record.RoundNumber = roundNumber - 1; datas.Add(item);
record.RoundNumber = 0;
data.BillNumberType = BillNumberTypeEnum.;
data.HostSN = recordNumber;
data.Round = roundNumber * 100000;
data.HostSN2 = roundNumber * 100000 + recordNumber;
datas.Add(data);
// ls.Add((roundNumber.ToString() + (recordNumber).ToString()), BillNumberTypeEnum.迟到);
}
record.Datas = datas;
return record;
} }
recordcache.Datas = datas;
public async Task<ObjectResultDto> UpdateBillNumberRecord(BillNumberRecord record) return recordcache;
}
/// <summary>
/// 创建实体
/// </summary>
/// <param name="type"></param>
/// <param name="hostSn"></param>
/// <param name="round"></param>
/// <returns></returns>
private PrintData CreatPrintData(BillNumberTypeEnum type ,int hostSn,int round )
{ {
ObjectResultDto reslut = new ObjectResultDto(); PrintData item = new PrintData();
return reslut; item.BillNumberType = type;
item.HostSN = hostSn;
item.Round = round;
item.HostSN2 = item.HostSN + item.Round;
return item;
} }
} }
} }

Loading…
Cancel
Save