|
|
@ -164,12 +164,13 @@ namespace WY.NewJit.EdiReceive.Services |
|
|
|
if (notRepeatOrder.Count == 0) |
|
|
|
{ |
|
|
|
ret.Status = false; |
|
|
|
ret.Message = "根据Vin和HostSN,排除在数据库中重复的Excel订单后,已经没有不重复的订单!"; |
|
|
|
ret.Message = $"本次导入Excel文件中{input.Count}条记录,重复订单数量{input.Count- notRepeatOrder.Count},都是重复的订单、无法导入!"; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
#region 断号提醒
|
|
|
|
//校验两次导入之间是否断号
|
|
|
|
string betweenBreakNumMsg = await CheckBetweenBreakNum(input); |
|
|
|
int priorMaxHostSN = await _lastImportHostSNDomainService.GetLastImportMaxHostSN(); |
|
|
|
string betweenBreakNumMsg = await CheckBetweenBreakNum(input, priorMaxHostSN); |
|
|
|
//校验本次导入数据是否断号
|
|
|
|
string breakNumMsg = CheckBreakNum(ref notRepeatOrder); |
|
|
|
|
|
|
@ -261,6 +262,16 @@ namespace WY.NewJit.EdiReceive.Services |
|
|
|
//更新本次导入的最大HostSN
|
|
|
|
int curMaxHostSN = input.Max(itm => itm.HostSN); |
|
|
|
await _lastImportHostSNDomainService.SetCurrentImportMaxHostSN(curMaxHostSN); |
|
|
|
|
|
|
|
if (notRepeatOrder.Count < input.Count) |
|
|
|
{ |
|
|
|
int repeatCount = input.Count - notRepeatOrder.Count; |
|
|
|
|
|
|
|
ret.Message = $"本次导入Excel文件中{input.Count}条记录,上次导入最大流水号是{priorMaxHostSN},本次导入重复记录{repeatCount}"; |
|
|
|
ret.Status = false; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
ret.Status = true; |
|
|
|
return ret; |
|
|
|
} |
|
|
@ -326,13 +337,13 @@ namespace WY.NewJit.EdiReceive.Services |
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<string> CheckBetweenBreakNum(List<ImportRecord> input) |
|
|
|
private async Task<string> CheckBetweenBreakNum(List<ImportRecord> input, int priorMaxHostSN) |
|
|
|
{ |
|
|
|
string ret = ""; |
|
|
|
//取本次导入的最小HostSN
|
|
|
|
int curMinHostSN = input.Min(itm => itm.HostSN); |
|
|
|
//上次导入的最大HostSN
|
|
|
|
int priorMaxHostSN = await _lastImportHostSNDomainService.GetLastImportMaxHostSN(); |
|
|
|
//int priorMaxHostSN = await _lastImportHostSNDomainService.GetLastImportMaxHostSN();
|
|
|
|
if (priorMaxHostSN > 0) //第一次导入时(priorMaxHostSN = 0),不需要校验两次导入之间的断号
|
|
|
|
{ |
|
|
|
if (curMinHostSN <= priorMaxHostSN + 1) |
|
|
|