Browse Source

解决现场反馈bug

HQ
liuyunfeng 6 months ago
parent
commit
7fb9f195b9
  1. 1
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs
  2. 149
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs
  3. 6
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
  4. 32
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs

1
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/EdiReceive/ImportRecordAppService.cs

@ -503,6 +503,7 @@ namespace WY.NewJit.EdiReceive
{ {
//tar.CreatePerson = "导入"; //tar.CreatePerson = "导入";
tar.CreateTime = ServerHelper.CurrentDateTime; tar.CreateTime = ServerHelper.CurrentDateTime;
tar.OnlineTime = tar.PaintOfflineTime; //导入文件时 总装上线时间 为空,使用 涂装下线时间 代替 总装上线时间
} }
//报文解析 //报文解析
ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute); ObjectResultDto ret2 = await _ediParseDomainService.ParseEdi(tarLst, forceExecute);

149
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain.Shared/Common/ServerHelper.cs

@ -78,75 +78,86 @@ namespace WY.NewJit
/// <returns></returns> /// <returns></returns>
public static string ToSerialNumStr(DateTime? onlineTime, int? hostSN, string m100_r100, string productLine) 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) if (hostSN == null)
{ {
throw new Exception("ToSerialNumStr大众顺序号不能为空!"); throw new Exception("ToSerialNumStr大众顺序号不能为空!!");
}
if (m100_r100.IsNullOrEmpty())
{
throw new Exception("ToSerialNumStr m100_r100参数不能为空!");
}
if (productLine.IsNullOrEmpty())
{
throw new Exception("ToSerialNumStr productLine参数不能为空!");
} }
/* return hostSN.ToString().PadLeft(6, '0'); ; //红旗顺序号不重复,按红旗顺序号排序
1.SerialNumStr在分钟后面插入00
2.线
3.
4.线1000 01
5.20001000
6.线
*/
string secondPart = "00";
string pl = (m100_r100?.Trim() + productLine?.Trim()).ToLower(); //if (onlineTime == null)
Dictionary<DateTime, int> childDic = GetDicByPL(pl); //根据产线取子字典 //{
// 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; //string pl = (m100_r100?.Trim() + productLine?.Trim()).ToLower();
int curHostSN = (int)hostSN; //Dictionary<DateTime, int> childDic = GetDicByPL(pl); //根据产线取子字典
if (childDic.ContainsKey(curOnlineTime)) //缓存中有 //DateTime curOnlineTime = (DateTime)onlineTime;
{ //int curHostSN = (int)hostSN;
int cacheHostSN = childDic[curOnlineTime];
if (curHostSN > cacheHostSN) //if (childDic.ContainsKey(curOnlineTime)) //缓存中有
{ //{
childDic[curOnlineTime] = curHostSN; //取最大“大众顺序号”更新 // int cacheHostSN = childDic[curOnlineTime];
}
//大1000以上,则 01 // if (curHostSN > cacheHostSN)
//202309251350 - 00 - 51999 // {
//差1000以上 // childDic[curOnlineTime] = curHostSN; //取最大“大众顺序号”更新
//202309251350 - 01 - 50001 // }
//202309251350 - 01 - 50002 // //大1000以上,则 01
//202309251351 - 00 - 50003 // //202309251350 - 00 - 51999
if (cacheHostSN - curHostSN >= 1000) // //差1000以上
{ // //202309251350 - 01 - 50001
secondPart = "01"; // //202309251350 - 01 - 50002
} // //202309251351 - 00 - 50003
} // if (cacheHostSN - curHostSN >= 1000)
else //缓存中没有 // {
{ // secondPart = "01";
childDic.Add(curOnlineTime, curHostSN); //添加缓存 // }
} //}
return ((DateTime)onlineTime).ToString("yyyyMMddHHmm") + secondPart + hostSN.ToString().PadLeft(5, '0'); //else //缓存中没有
//{
// childDic.Add(curOnlineTime, curHostSN); //添加缓存
//}
//return ((DateTime)onlineTime).ToString("yyyyMMddHHmm") + secondPart + hostSN.ToString().PadLeft(5, '0');
} }
public static string ToSerialNumStr(DateTime? onlineTime, int? hostSN) public static string ToSerialNumStr(DateTime? onlineTime, int? hostSN)
{ {
if (onlineTime == null)
{
throw new Exception("ToSerialNumStr上线时间不能为空:" + hostSN.ToString());
}
if (hostSN == null) if (hostSN == null)
{ {
throw new Exception("ToSerialNumStr大众顺序号不能为空!"); 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');
} }
/// <summary> /// <summary>
@ -158,23 +169,29 @@ namespace WY.NewJit
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public static string ToSerialNumStr(string priorSerialNumStr, int? hostSN) public static string ToSerialNumStr(string priorSerialNumStr, int? hostSN)
{ {
if (priorSerialNumStr == null)
{
throw new Exception("ToSerialNumStr上一个排序字段值不能为空:" + priorSerialNumStr);
}
if (hostSN == null) if (hostSN == null)
{ {
throw new Exception("ToSerialNumStr大众顺序号不能为空!"); throw new Exception("ToSerialNumStr大众顺序号不能为空!");
} }
if (priorSerialNumStr.Length == 17 || priorSerialNumStr.Length == 19) return hostSN.ToString().PadLeft(6, '0'); //红旗顺序号不重复,按红旗顺序号排序
{ }
else //if (priorSerialNumStr == null)
{ //{
throw new Exception("priorSerialNumStr不是17或19位!"); // throw new Exception("ToSerialNumStr上一个排序字段值不能为空:" + priorSerialNumStr);
} //}
string prefix = priorSerialNumStr.Substring(0, priorSerialNumStr.Length - 5); //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');
} }

6
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}"); throw new Exception($"{_errorMessagePrefix}更新M100失败:{m100Obj.HostSN2}");
} }
bool hasBeforeNotPrint = await _hqM100DomainServie.BeforeNotPrint((int)(m100Obj.HostSN2)); //bool hasBeforeNotPrint = await _hqM100DomainServie.BeforeNotPrint((int)(m100Obj.HostSN2));
bool isReplenishPrint = hasBeforeNotPrint ? false : true; //未打印表包含重新解析之前的记录,设置成正常打印,否则设置成补打 //bool isReplenishPrint = hasBeforeNotPrint ? false : true; //未打印表包含重新解析之前的记录,设置成正常打印,否则设置成补打
bool isReplenishPrint = await _hqM100DomainServie.JugdeIsReplenishPrint(m100Obj.ProductLine, (int)(m100Obj.HostSN2));
//判断未打印表是否有数据,有则更新,没有则插入 //判断未打印表是否有数据,有则更新,没有则插入
ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, isReplenishPrint); ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, isReplenishPrint);
if (wpRet.Status == false) if (wpRet.Status == false)

32
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs

@ -28,15 +28,18 @@ namespace WY.NewJit.MsgCheck
/// </summary> /// </summary>
private readonly IRepository<WaitPrint, Guid> _waitPrintRepository; private readonly IRepository<WaitPrint, Guid> _waitPrintRepository;
private readonly IRepository<AlreadyPrint, Guid> _alreadyPrintRepository;
public HQ_M100DomainService( public HQ_M100DomainService(
IRepository<BillM100, Guid> billM100Repository, IRepository<BillM100, Guid> billM100Repository,
ILogger<M100CheckDomainService> logger, ILogger<M100CheckDomainService> logger,
IRepository<WaitPrint, Guid> waitPrintRepository IRepository<WaitPrint, Guid> waitPrintRepository,
) IRepository<AlreadyPrint, Guid> alreadyPrintRepository)
{ {
_billM100Repository = billM100Repository; _billM100Repository = billM100Repository;
_logger = logger; _logger = logger;
_waitPrintRepository = waitPrintRepository; _waitPrintRepository = waitPrintRepository;
_alreadyPrintRepository = alreadyPrintRepository;
} }
public async Task<BillM100> InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false) public async Task<BillM100> 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); bool hasBeforeNotPrint = qry.Any(itm => itm.HostSN2 < hostSN2 && itm.PrintType == PrintTypeEnum.OrderPrint && itm.BillStatus == BillStatusEnum.Match);
return hasBeforeNotPrint; return hasBeforeNotPrint;
} }
/// <summary>
/// 判断是否进入补打流程
/// </summary>
/// <param name="productLine"></param>
/// <param name="curHostSN2"></param>
/// <returns></returns>
public async Task<bool> 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;
}
} }
} }

Loading…
Cancel
Save