Browse Source

生成序号方法优化

master
lvzb 1 year ago
parent
commit
6eae6a8605
  1. 16
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/MsgCheck/BillNumberTypeEnum.cs
  2. 6
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillNumberRecord.cs
  3. 22
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/PrintData.cs
  4. 49
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs

16
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/MsgCheck/BillNumberTypeEnum.cs

@ -7,19 +7,11 @@ namespace WY.NewJit.MsgCheck
{ {
public enum BillNumberTypeEnum public enum BillNumberTypeEnum
{ {
[Description("顺序")] [Description("正常")]
= 0, = 0,
/// <summary>
/// 已匹配,未打印
/// </summary>
[Description("断号")] [Description("断号")]
= 1, = 1,
[Description("迟到")]
/// <summary> = 2,
/// 已打印
/// </summary>
[Description("补打")]
= 2,
} }
} }

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

@ -35,7 +35,11 @@ namespace WY.NewJit.MsgCheck
/// 更新时间# /// 更新时间#
/// </summary> /// </summary>
public virtual DateTime UpdateTime { get; set; } public virtual DateTime UpdateTime { get; set; }
/// <summary>
/// 一次处理后成的号码列表
/// </summary>
[NotMapped] [NotMapped]
public virtual Dictionary<string, BillNumberTypeEnum> dic { get; set; } public virtual List<PrintData> Datas { get; set; }
} }
} }

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

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WY.NewJit.MsgCheck
{
public class PrintData
{
public virtual int HostSN { get; set; }
public virtual int Round { get; set; }
public virtual int HostSN2 { get; set; }
public virtual BillNumberTypeEnum BillNumberType { get; set; }
}
}

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

@ -27,8 +27,8 @@ namespace WY.NewJit.MsgCheck
public async Task<BillNumberRecord> GetBillNumber(int number, string productLine) public async Task<BillNumberRecord> GetBillNumber(int number, string productLine)
{ {
Dictionary<string, BillNumberTypeEnum> ls = new Dictionary<string, BillNumberTypeEnum>();//待打印数据
BillNumberRecord record = new BillNumberRecord(); BillNumberRecord record = new BillNumberRecord();
List<PrintData> datas = new List<PrintData>();
var bill = await _billNumberRepository.GetAsync(r => r.ProductLine == productLine); var bill = await _billNumberRepository.GetAsync(r => r.ProductLine == productLine);
int recordNumber = bill.RecordNumber;//记录号 int recordNumber = bill.RecordNumber;//记录号
int roundNumber = bill.RoundNumber; int roundNumber = bill.RoundNumber;
@ -39,26 +39,41 @@ namespace WY.NewJit.MsgCheck
record.InsertedRows = (1999 - recordNumber) + (number - 1) + 1; record.InsertedRows = (1999 - recordNumber) + (number - 1) + 1;
for (int i = 1; i <= record.InsertedRows; i++) for (int i = 1; i <= record.InsertedRows; i++)
{ {
BillNumberTypeEnum type = BillNumberTypeEnum.; PrintData data = new PrintData();
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.;
ls.Add((roundNumber.ToString()+(i + recordNumber - 1999).ToString()), type); data.HostSN = i + recordNumber - 1999;
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.;
ls.Add((roundNumber.ToString()+(i + recordNumber).ToString()), type); 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;
} }
recordNumber = number; recordNumber = number;
record.RoundNumber= roundNumber+1; record.RoundNumber= roundNumber+1;
} }
else if (-1000 < x && x < 0) else if (-1000 < x && x < 0)
{ {
PrintData data = new PrintData();
record.RoundNumber = roundNumber; record.RoundNumber = roundNumber;
record.InsertedRows = 0; record.InsertedRows = 0;
ls.Add((roundNumber.ToString() + (recordNumber).ToString()), BillNumberTypeEnum.); 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.迟到);
} }
else if (0 < x && x < 1000) else if (0 < x && x < 1000)
{ {
@ -67,20 +82,34 @@ namespace WY.NewJit.MsgCheck
for (int i = 1; i <= record.RoundNumber; i++) for (int i = 1; i <= record.RoundNumber; i++)
{ {
BillNumberTypeEnum type = BillNumberTypeEnum.; PrintData data = new PrintData();
BillNumberTypeEnum type = BillNumberTypeEnum.;
if ((i + recordNumber) != number) type = BillNumberTypeEnum.; if ((i + recordNumber) != number) type = BillNumberTypeEnum.;
ls.Add((roundNumber.ToString() + (i + recordNumber).ToString()), type);
data.BillNumberType = type;
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; recordNumber = number;
} }
else if (x >= 1000) else if (x >= 1000)
{ {
PrintData data = new PrintData();
record.RoundNumber = roundNumber - 1; record.RoundNumber = roundNumber - 1;
record.RoundNumber = 0; record.RoundNumber = 0;
ls.Add((roundNumber.ToString() + (recordNumber).ToString()), BillNumberTypeEnum.); 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.dic = ls; record.Datas = datas;
return record; return record;
} }

Loading…
Cancel
Save