diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
index 60f04b0..39da2f0 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
@@ -503,6 +503,7 @@ namespace WY.NewJit.EdiReceive
{
//tar.CreatePerson = "导入";
tar.CreateTime = ServerHelper.CurrentDateTime;
+ tar.OnlineTime = tar.PaintOfflineTime; //导入文件时 总装上线时间 为空,使用 涂装下线时间 代替 总装上线时间
}
//报文解析
ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute);
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs
index c9e3bc8..8927519 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs
@@ -78,75 +78,86 @@ namespace WY.NewJit
///
public static string ToSerialNumStr(DateTime? onlineTime, int? hostSN, string m100_r100, string productLine)
{
- if (onlineTime == null)
- {
- throw new Exception("ToSerialNumStr上线时间不能为空:" + hostSN.ToString());
- }
if (hostSN == null)
{
- throw new Exception("ToSerialNumStr大众顺序号不能为空!");
- }
- if (m100_r100.IsNullOrEmpty())
- {
- throw new Exception("ToSerialNumStr m100_r100参数不能为空!");
- }
- if (productLine.IsNullOrEmpty())
- {
- throw new Exception("ToSerialNumStr productLine参数不能为空!");
+ throw new Exception("ToSerialNumStr大众顺序号不能为空!!");
}
- /*
- 1.SerialNumStr在分钟后面插入00
- 2.取报文中的上线时间、大众顺序号,如果缓存分钟键没有,则增加一个
- 3.如果缓存中有该分钟键,取最大“大众顺序号”更新
- 4.如果缓存中有该分钟键,并且比当前上线时间的“大众顺序号”大1000以上,则 01
- 5.分钟键超过2000时,保留1000
- 6.字典按产线分组
- */
- string secondPart = "00";
+ return hostSN.ToString().PadLeft(6, '0'); ; //红旗顺序号不重复,按红旗顺序号排序
- string pl = (m100_r100?.Trim() + productLine?.Trim()).ToLower();
- Dictionary childDic = GetDicByPL(pl); //根据产线取子字典
+ //if (onlineTime == null)
+ //{
+ // throw new Exception("ToSerialNumStr上线时间不能为空:" + hostSN.ToString());
+ //}
+ //if (hostSN == null)
+ //{
+ // throw new Exception("ToSerialNumStr大众顺序号不能为空!");
+ //}
+ //if (m100_r100.IsNullOrEmpty())
+ //{
+ // throw new Exception("ToSerialNumStr m100_r100参数不能为空!");
+ //}
+ //if (productLine.IsNullOrEmpty())
+ //{
+ // throw new Exception("ToSerialNumStr productLine参数不能为空!");
+ //}
+ ///*
+ //1.SerialNumStr在分钟后面插入00
+ //2.取报文中的上线时间、大众顺序号,如果缓存分钟键没有,则增加一个
+ //3.如果缓存中有该分钟键,取最大“大众顺序号”更新
+ //4.如果缓存中有该分钟键,并且比当前上线时间的“大众顺序号”大1000以上,则 01
+ //5.分钟键超过2000时,保留1000
+ //6.字典按产线分组
+ //*/
+ //string secondPart = "00";
- DateTime curOnlineTime = (DateTime)onlineTime;
- int curHostSN = (int)hostSN;
+ //string pl = (m100_r100?.Trim() + productLine?.Trim()).ToLower();
+ //Dictionary childDic = GetDicByPL(pl); //根据产线取子字典
- if (childDic.ContainsKey(curOnlineTime)) //缓存中有
- {
- int cacheHostSN = childDic[curOnlineTime];
+ //DateTime curOnlineTime = (DateTime)onlineTime;
+ //int curHostSN = (int)hostSN;
- if (curHostSN > cacheHostSN)
- {
- childDic[curOnlineTime] = curHostSN; //取最大“大众顺序号”更新
- }
- //大1000以上,则 01
- //202309251350 - 00 - 51999
- //差1000以上
- //202309251350 - 01 - 50001
- //202309251350 - 01 - 50002
- //202309251351 - 00 - 50003
- if (cacheHostSN - curHostSN >= 1000)
- {
- secondPart = "01";
- }
- }
- else //缓存中没有
- {
- childDic.Add(curOnlineTime, curHostSN); //添加缓存
- }
- return ((DateTime)onlineTime).ToString("yyyyMMddHHmm") + secondPart + hostSN.ToString().PadLeft(5, '0');
+ //if (childDic.ContainsKey(curOnlineTime)) //缓存中有
+ //{
+ // int cacheHostSN = childDic[curOnlineTime];
+
+ // if (curHostSN > cacheHostSN)
+ // {
+ // childDic[curOnlineTime] = curHostSN; //取最大“大众顺序号”更新
+ // }
+ // //大1000以上,则 01
+ // //202309251350 - 00 - 51999
+ // //差1000以上
+ // //202309251350 - 01 - 50001
+ // //202309251350 - 01 - 50002
+ // //202309251351 - 00 - 50003
+ // if (cacheHostSN - curHostSN >= 1000)
+ // {
+ // secondPart = "01";
+ // }
+ //}
+ //else //缓存中没有
+ //{
+ // childDic.Add(curOnlineTime, curHostSN); //添加缓存
+ //}
+ //return ((DateTime)onlineTime).ToString("yyyyMMddHHmm") + secondPart + hostSN.ToString().PadLeft(5, '0');
}
public static string ToSerialNumStr(DateTime? onlineTime, int? hostSN)
{
- if (onlineTime == null)
- {
- throw new Exception("ToSerialNumStr上线时间不能为空:" + hostSN.ToString());
- }
if (hostSN == null)
{
throw new Exception("ToSerialNumStr大众顺序号不能为空!");
}
- return ((DateTime)onlineTime).ToString("yyyyMMddHHmmss") + hostSN.ToString().PadLeft(5, '0');
+ return hostSN.ToString().PadLeft(6, '0'); ; //红旗顺序号不重复,按红旗顺序号排序
+ //if (onlineTime == null)
+ //{
+ // throw new Exception("ToSerialNumStr上线时间不能为空:" + hostSN.ToString());
+ //}
+ //if (hostSN == null)
+ //{
+ // throw new Exception("ToSerialNumStr大众顺序号不能为空!");
+ //}
+ //return ((DateTime)onlineTime).ToString("yyyyMMddHHmmss") + hostSN.ToString().PadLeft(5, '0');
}
///
@@ -158,23 +169,29 @@ namespace WY.NewJit
///
public static string ToSerialNumStr(string priorSerialNumStr, int? hostSN)
{
- if (priorSerialNumStr == null)
- {
- throw new Exception("ToSerialNumStr上一个排序字段值不能为空:" + priorSerialNumStr);
- }
if (hostSN == null)
{
throw new Exception("ToSerialNumStr大众顺序号不能为空!");
}
- if (priorSerialNumStr.Length == 17 || priorSerialNumStr.Length == 19)
- { }
- else
- {
- throw new Exception("priorSerialNumStr不是17或19位!");
- }
- string prefix = priorSerialNumStr.Substring(0, priorSerialNumStr.Length - 5);
+ return hostSN.ToString().PadLeft(6, '0'); //红旗顺序号不重复,按红旗顺序号排序
+
+ //if (priorSerialNumStr == null)
+ //{
+ // throw new Exception("ToSerialNumStr上一个排序字段值不能为空:" + priorSerialNumStr);
+ //}
+ //if (hostSN == null)
+ //{
+ // throw new Exception("ToSerialNumStr大众顺序号不能为空!");
+ //}
+ //if (priorSerialNumStr.Length == 17 || priorSerialNumStr.Length == 19)
+ //{ }
+ //else
+ //{
+ // throw new Exception("priorSerialNumStr不是17或19位!");
+ //}
+ //string prefix = priorSerialNumStr.Substring(0, priorSerialNumStr.Length - 5);
- return prefix + hostSN.ToString().PadLeft(5, '0');
+ //return prefix + hostSN.ToString().PadLeft(5, '0');
}
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
index db12ef0..c5ef30d 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
@@ -323,8 +323,10 @@ namespace WY.NewJit.EdiReceive.Services
throw new Exception($"{_errorMessagePrefix}更新M100失败:{m100Obj.HostSN2}");
}
- bool hasBeforeNotPrint = await _hqM100DomainServie.BeforeNotPrint((int)(m100Obj.HostSN2));
- bool isReplenishPrint = hasBeforeNotPrint ? false : true; //未打印表包含重新解析之前的记录,设置成正常打印,否则设置成补打
+ //bool hasBeforeNotPrint = await _hqM100DomainServie.BeforeNotPrint((int)(m100Obj.HostSN2));
+ //bool isReplenishPrint = hasBeforeNotPrint ? false : true; //未打印表包含重新解析之前的记录,设置成正常打印,否则设置成补打
+ bool isReplenishPrint = await _hqM100DomainServie.JugdeIsReplenishPrint(m100Obj.ProductLine, (int)(m100Obj.HostSN2));
+
//判断未打印表是否有数据,有则更新,没有则插入
ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, isReplenishPrint);
if (wpRet.Status == false)
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
index 53ece1d..dd2bee6 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
@@ -28,15 +28,18 @@ namespace WY.NewJit.MsgCheck
///
private readonly IRepository _waitPrintRepository;
+ private readonly IRepository _alreadyPrintRepository;
+
public HQ_M100DomainService(
IRepository billM100Repository,
ILogger logger,
- IRepository waitPrintRepository
- )
+ IRepository waitPrintRepository,
+ IRepository alreadyPrintRepository)
{
_billM100Repository = billM100Repository;
_logger = logger;
_waitPrintRepository = waitPrintRepository;
+ _alreadyPrintRepository = alreadyPrintRepository;
}
public async Task InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false)
@@ -211,5 +214,30 @@ namespace WY.NewJit.MsgCheck
bool hasBeforeNotPrint = qry.Any(itm => itm.HostSN2 < hostSN2 && itm.PrintType == PrintTypeEnum.OrderPrint && itm.BillStatus == BillStatusEnum.Match);
return hasBeforeNotPrint;
}
+
+ ///
+ /// 判断是否进入补打流程
+ ///
+ ///
+ ///
+ ///
+ public async Task JugdeIsReplenishPrint(string productLine, int curHostSN2)
+ {
+ //在已打印表是最大的顺序号
+ var qry2 = await _alreadyPrintRepository.GetQueryableAsync();
+ var lst = qry2.Where(itm => itm.ProductLine == productLine);
+ int maxHostSN;
+ if (lst.Any())
+ {
+ maxHostSN = qry2.Where(itm => itm.ProductLine == productLine).Max(itm => itm.HostSN2);
+ }
+ else
+ {
+ maxHostSN = 0;
+ }
+
+ bool isMax = curHostSN2 > maxHostSN;
+ return isMax == false;
+ }
}
}