|
|
@ -429,63 +429,63 @@ namespace WY.NewJit.MsgCheck |
|
|
|
if (isMatch) |
|
|
|
{ |
|
|
|
#region 判断是否断号
|
|
|
|
//断号判断规则:大众顺序号生成规则是1至1999的重复循环,重复循环到1时判断之前最近的相同车型的VIN和当前VIN是否连续,如果不连续则表示断号
|
|
|
|
//断号判断:大众顺序号按生产线分类判断;VIN按车型分类判断
|
|
|
|
string curProductLine = m100Bill.ProductLine; |
|
|
|
string curSerialNumStr = m100Bill.SerialNumStr; //排序依据
|
|
|
|
int curHostSN = m100Bill.HostSN ?? 0; |
|
|
|
string curVehicleModel = m100Bill.VehicleModelCode; |
|
|
|
int curVinNum = m100Bill.SerialNum ?? 0; //VIN后六位
|
|
|
|
//取当前生产线最近一条SerialNumStr
|
|
|
|
string priorSerialNumStr = _billM100Repository.Where(itm => |
|
|
|
itm.ProductLine == curProductLine |
|
|
|
&& itm.SerialNumStr.CompareTo(curSerialNumStr) < 0 |
|
|
|
).Max(itm => itm.SerialNumStr); |
|
|
|
if (priorSerialNumStr != null) |
|
|
|
{ |
|
|
|
//取当前生产线最近一条
|
|
|
|
int priorHostSN = _billM100Repository.FirstOrDefault(itm => itm.ProductLine == curProductLine && itm.SerialNumStr == priorSerialNumStr).HostSN ?? 0; |
|
|
|
if (curHostSN == priorHostSN + 1) |
|
|
|
{ |
|
|
|
//不断号
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//取当前生产线、相同车型、最近一条SerialNumStr
|
|
|
|
string priorSerialNumStr2 = _billM100Repository.Where(itm => |
|
|
|
itm.ProductLine == curProductLine |
|
|
|
&& itm.VehicleModelCode == curVehicleModel |
|
|
|
&& itm.SerialNumStr.CompareTo(curSerialNumStr) < 0 |
|
|
|
).Max(itm => itm.SerialNumStr); |
|
|
|
if (priorSerialNumStr2 != null) |
|
|
|
{ |
|
|
|
int priorVinNum = _billM100Repository.FirstOrDefault(itm => itm.SerialNumStr == priorSerialNumStr2).SerialNum ?? 0; |
|
|
|
if (curVinNum == priorVinNum + 1) |
|
|
|
{ |
|
|
|
//不断号
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//断号提醒
|
|
|
|
string errorMsg = $"{curProductLine}生产线M100报文出现断号,当前VIN:{curVinNum}:{curHostSN},上一VIN:{priorVinNum}:{priorHostSN}。可以操作M100单据信息维护模块进行补号!"; |
|
|
|
_logRemindDomainService.WriteLogRemind(_billNumber, errorMsg, LogTypeEnum.M100); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
////断号判断规则:大众顺序号生成规则是1至1999的重复循环,重复循环到1时判断之前最近的相同车型的VIN和当前VIN是否连续,如果不连续则表示断号
|
|
|
|
////断号判断:大众顺序号按生产线分类判断;VIN按车型分类判断
|
|
|
|
//string curProductLine = m100Bill.ProductLine;
|
|
|
|
//string curSerialNumStr = m100Bill.SerialNumStr; //排序依据
|
|
|
|
//int curHostSN = m100Bill.HostSN ?? 0;
|
|
|
|
//string curVehicleModel = m100Bill.VehicleModelCode;
|
|
|
|
//int curVinNum = m100Bill.SerialNum ?? 0; //VIN后六位
|
|
|
|
////取当前生产线最近一条SerialNumStr
|
|
|
|
//string priorSerialNumStr = _billM100Repository.Where(itm =>
|
|
|
|
// itm.ProductLine == curProductLine
|
|
|
|
// && itm.SerialNumStr.CompareTo(curSerialNumStr) < 0
|
|
|
|
// ).Max(itm => itm.SerialNumStr);
|
|
|
|
//if (priorSerialNumStr != null)
|
|
|
|
//{
|
|
|
|
// //取当前生产线最近一条
|
|
|
|
// int priorHostSN = _billM100Repository.FirstOrDefault(itm => itm.ProductLine == curProductLine && itm.SerialNumStr == priorSerialNumStr).HostSN ?? 0;
|
|
|
|
// if (curHostSN == priorHostSN + 1)
|
|
|
|
// {
|
|
|
|
// //不断号
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// //取当前生产线、相同车型、最近一条SerialNumStr
|
|
|
|
// string priorSerialNumStr2 = _billM100Repository.Where(itm =>
|
|
|
|
// itm.ProductLine == curProductLine
|
|
|
|
// && itm.VehicleModelCode == curVehicleModel
|
|
|
|
// && itm.SerialNumStr.CompareTo(curSerialNumStr) < 0
|
|
|
|
// ).Max(itm => itm.SerialNumStr);
|
|
|
|
// if (priorSerialNumStr2 != null)
|
|
|
|
// {
|
|
|
|
// int priorVinNum = _billM100Repository.FirstOrDefault(itm => itm.SerialNumStr == priorSerialNumStr2).SerialNum ?? 0;
|
|
|
|
// if (curVinNum == priorVinNum + 1)
|
|
|
|
// {
|
|
|
|
// //不断号
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// //断号提醒
|
|
|
|
// string errorMsg = $"{curProductLine}生产线M100报文出现断号,当前VIN:{curVinNum}:{curHostSN},上一VIN:{priorVinNum}:{priorHostSN}。可以操作M100单据信息维护模块进行补号!";
|
|
|
|
// _logRemindDomainService.WriteLogRemind(_billNumber, errorMsg, LogTypeEnum.M100);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 当前单据在未匹配时已经参与打印,重新解析后进入补打
|
|
|
|
var m100Obj = m100Bill; |
|
|
|
string curPL = m100Obj.ProductLine; |
|
|
|
string curSNStr = m100Obj.SerialNumStr; |
|
|
|
bool hasPrintData = _billM100Repository.Any(itm => itm.ProductLine == curPL && itm.SerialNumStr.CompareTo(curSNStr) > 0 && itm.BillStatus == BillStatusEnum.Publish); |
|
|
|
if (hasPrintData) //该单据处于未解析时,已经打印
|
|
|
|
{ |
|
|
|
m100Obj.NeedReplenishPrint = 1; |
|
|
|
//_billM100Repository.UpdateAsync(m100Obj, true).GetAwaiter().GetResult();
|
|
|
|
_m100DomainService.UpdateM100(m100Obj, true).GetAwaiter().GetResult(); |
|
|
|
} |
|
|
|
//var m100Obj = m100Bill;
|
|
|
|
//string curPL = m100Obj.ProductLine;
|
|
|
|
//string curSNStr = m100Obj.SerialNumStr;
|
|
|
|
//bool hasPrintData = _billM100Repository.Any(itm => itm.ProductLine == curPL && itm.SerialNumStr.CompareTo(curSNStr) > 0 && itm.BillStatus == BillStatusEnum.Publish);
|
|
|
|
//if (hasPrintData) //该单据处于未解析时,已经打印
|
|
|
|
//{
|
|
|
|
// m100Obj.NeedReplenishPrint = 1;
|
|
|
|
// //_billM100Repository.UpdateAsync(m100Obj, true).GetAwaiter().GetResult();
|
|
|
|
// _m100DomainService.UpdateM100(m100Obj, true).GetAwaiter().GetResult();
|
|
|
|
//}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
ret.Status = true; |
|
|
|