Browse Source

修改批量导入断号的bug

master
liuyunfeng 12 months ago
parent
commit
aaefa906ad
  1. 17
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs
  2. 24
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs
  3. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100CheckDomainService.cs
  4. 67
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/M100DomainService.cs

17
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/MenBanPackingRecService.cs

@ -344,20 +344,25 @@ namespace Win.Sfs.SettleAccount.FISes
var alreadyPrintIdLst = mbRecLst.Select(p => p.M100BillId).Distinct().ToList(); //未打印\已打印表id列表 var alreadyPrintIdLst = mbRecLst.Select(p => p.M100BillId).Distinct().ToList(); //未打印\已打印表id列表
var _apList = await _alreadyPrintRepository.Where(p => alreadyPrintIdLst.Contains(p.Id)).ToListAsync(); var _apList = await _alreadyPrintRepository.Where(p => alreadyPrintIdLst.Contains(p.Id)).ToListAsync();
List<WaitPrint> _wpList = new List<WaitPrint>(); List<WaitPrint> _wpList = new List<WaitPrint>();
foreach (var alreadyPrint in _apList) //遍历已打印表 foreach (var alreadyPrintItem in _apList) //遍历已打印表
{ {
var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == alreadyPrint.HostSN2 && r.BusinessType == alreadyPrint.BusinessType); if (alreadyPrintItem.HostSN2 == 0)
{
throw new BusinessException("1001", $"批量导入断号的报文HostSN2=0,不能报废!");
}
var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == alreadyPrintItem.HostSN2 && r.BusinessType == alreadyPrintItem.BusinessType);
if (waitPrintLst.Count == 0) //未打印表没有(对应已打印表)记录 if (waitPrintLst.Count == 0) //未打印表没有(对应已打印表)记录
{ {
var wp = ObjectMapper.Map<AlreadyPrint, WaitPrint>(alreadyPrint); var wp = ObjectMapper.Map<AlreadyPrint, WaitPrint>(alreadyPrintItem);
_wpList.Add(wp); _wpList.Add(wp);
} }
else if(waitPrintLst.Count == 1) //未打印表有一条记录 else if(waitPrintLst.Count == 1) //未打印表有一条记录
{ {
if (alreadyPrint.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) if (alreadyPrintItem.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum)
{ {
throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrint.HostSN2 + "】,不能报废!"); throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrintItem.HostSN2 + "】,不能报废!");
} }
//未打印有一条补打的记录,忽略已打印的对应记录,将未打印记录的补打状态改成顺序打印状态
if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint) if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint)
{ {
waitPrintLst[0].PrintType = WY.NewJit.PrintTable.PrintTypeEnum.OrderPrint; waitPrintLst[0].PrintType = WY.NewJit.PrintTable.PrintTypeEnum.OrderPrint;
@ -366,7 +371,7 @@ namespace Win.Sfs.SettleAccount.FISes
} }
else if (waitPrintLst.Count > 1) else if (waitPrintLst.Count > 1)
{ {
throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【"+ alreadyPrint.HostSN2+ "】请检查后在报废!"); throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【"+ alreadyPrintItem.HostSN2+ "】请检查后在报废!");
} }
} }
await _alreadyPrintRepository.DeleteManyAsync(_apList); await _alreadyPrintRepository.DeleteManyAsync(_apList);

24
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/ZhuHuBanPackingRecService.cs

@ -377,27 +377,37 @@ namespace Win.Sfs.SettleAccount.FISes
////await _zHBPrintStatusRepository.DeleteAsync(r => vins.Contains(r.VIN) && r.GroupName == groupName.GroupName); ////await _zHBPrintStatusRepository.DeleteAsync(r => vins.Contains(r.VIN) && r.GroupName == groupName.GroupName);
#region 删除已打印表、插入未打印表 #region 删除已打印表、插入未打印表
var zhbRecLst = await _ZhuHuBanPackingListRepository.Where(p => idList.Contains(p.Id)).SelectMany(p => p.Details).ToListAsync(); var zhbRecLst = await _ZhuHuBanPackingListRepository.Where(p => idList.Contains(p.Id)).SelectMany(p => p.Details).ToListAsync();
var alreadyPrintIdLst = zhbRecLst.Select(p => p.M100BillId).Distinct().ToList(); //未打印\已打印表id列表 var alreadyPrintIdLst = zhbRecLst.Select(p => p.M100BillId).Distinct().ToList(); //ZhuHuBanPackingList.M100BillId对应 未打印\已打印表id
var _apList = await _alreadyPrintRepository.Where(p => alreadyPrintIdLst.Contains(p.Id)).ToListAsync(); var _apList = await _alreadyPrintRepository.Where(p => alreadyPrintIdLst.Contains(p.Id)).ToListAsync();
List<WaitPrint> _wpList = new List<WaitPrint>(); List<WaitPrint> _wpList = new List<WaitPrint>();
foreach (var ap in _apList) //遍历已打印表 foreach (var alreadyPrintItem in _apList) //遍历已打印表
{ {
var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == ap.HostSN2 && r.BusinessType == ap.BusinessType); if (alreadyPrintItem.HostSN2 == 0)
{
throw new BusinessException("1001", $"批量导入断号的报文HostSN2=0,不能报废!");
}
var waitPrintLst = await _waitPrintRepository.GetListAsync(r => r.HostSN2 == alreadyPrintItem.HostSN2 && r.BusinessType == alreadyPrintItem.BusinessType);
if (waitPrintLst.Count == 0) //未打印表没有(对应已打印表)记录 if (waitPrintLst.Count == 0) //未打印表没有(对应已打印表)记录
{ {
var wp = ObjectMapper.Map<AlreadyPrint, WaitPrint>(ap); var wp = ObjectMapper.Map<AlreadyPrint, WaitPrint>(alreadyPrintItem);
_wpList.Add(wp); _wpList.Add(wp);
} }
else if (waitPrintLst.Count == 1) //未打印表有一条记录 else if (waitPrintLst.Count == 1) //未打印表有一条记录
{ {
if (ap.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum) if (alreadyPrintItem.BillStatus == BillStatusEnum.BreakNum && waitPrintLst[0].BillStatus == BillStatusEnum.BreakNum)
{
throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + alreadyPrintItem.HostSN2 + "】,不能报废!");
}
//未打印有一条补打的记录,忽略已打印的对应记录,将未打印记录的补打状态改成顺序打印状态
if (waitPrintLst[0].PrintType == WY.NewJit.PrintTable.PrintTypeEnum.ReplenishPrint)
{ {
throw new BusinessException("1001", "未打印列表和已打印列表出现都是断号的情况号码未【" + ap.HostSN2 + "】,不能报废!"); waitPrintLst[0].PrintType = WY.NewJit.PrintTable.PrintTypeEnum.OrderPrint;
await _waitPrintRepository.UpdateAsync(waitPrintLst[0]);
} }
} }
else if (waitPrintLst.Count > 1) else if (waitPrintLst.Count > 1)
{ {
throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【" + ap.HostSN2 + "】请检查后在报废!"); throw new BusinessException("1001", "未打印列表里出现大众顺序号重复号码为【" + alreadyPrintItem.HostSN2 + "】请检查后在报废!");
} }
} }
await _alreadyPrintRepository.DeleteManyAsync(_apList); await _alreadyPrintRepository.DeleteManyAsync(_apList);

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

@ -342,7 +342,7 @@ namespace WY.NewJit.MsgCheck
m100Bill.SetAssemblyID(null); m100Bill.SetAssemblyID(null);
m100Bill.SetBillStatus(BillStatusEnum.NotMatch); m100Bill.SetBillStatus(BillStatusEnum.NotMatch);
//var succObj1 = _billM100Repository.InsertAsync(m100Bill, true).GetAwaiter().GetResult(); //var succObj1 = _billM100Repository.InsertAsync(m100Bill, true).GetAwaiter().GetResult();
var succObj1 = _m100DomainService.InsertM100(m100Bill, true).GetAwaiter().GetResult(); var succObj1 = _m100DomainService.InsertM100(m100Bill, true, true).GetAwaiter().GetResult();
//不匹配时,插入未知总成 //不匹配时,插入未知总成
var succObj2 = InsertUnknownAssembly(m100Bill); var succObj2 = InsertUnknownAssembly(m100Bill);

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

@ -46,38 +46,34 @@ namespace WY.NewJit.MsgCheck
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)
{ {
BillM100 m100Ret = null; BillM100 m100Ret = null;
//调用HostSN2方法
BillNumberRecord billNumRec = await _billNumRecDomainSrv.GetBillNumber(m100Obj.HostSN.TryToIntNotNull(), m100Obj.ProductLine);
var normalObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var lateObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var breakNumLst = billNumRec.Datas.Where(itm => itm.BillNumberType == BillNumberTypeEnum.).ToList();
//更新M100
m100Obj.HostSN2 = normalObj != null ? normalObj.HostSN2 : lateObj.HostSN2;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr;
if (m100Obj.ProductLine == "08")
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
}
else
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec };
}
if (isBatchImportBreakNum) //批量导入断号模块调用 if (isBatchImportBreakNum) //批量导入断号模块调用
{ {
foreach (var wp in wpArr) //更新M100
m100Obj.HostSN2 = 0;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr2 = M100ConvertToWaitPrint(m100Obj);
foreach (var wp in wpArr2)
{ {
wp.PrintType = PrintTypeEnum.ReplenishPrint; wp.PrintType = PrintTypeEnum.ReplenishPrint;
//wp.HostSN2 = 0; //WaitPrint的HostSN2从m100的HostSN2取值
} }
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100 m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表 await _waitPrintRepository.InsertManyAsync(wpArr2, autoSave); //插入未打印表
return m100Ret; return m100Ret;
} }
//调用HostSN2方法
BillNumberRecord billNumRec = await _billNumRecDomainSrv.GetBillNumber(m100Obj.HostSN.TryToIntNotNull(), m100Obj.ProductLine);
var normalObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var lateObj = billNumRec.Datas.FirstOrDefault(itm => itm.BillNumberType == BillNumberTypeEnum.);
var breakNumLst = billNumRec.Datas.Where(itm => itm.BillNumberType == BillNumberTypeEnum.).ToList();
//更新M100
m100Obj.HostSN2 = normalObj != null ? normalObj.HostSN2 : lateObj.HostSN2;
//M100转换成WaitPrint:一个底盘、08产线插入3条记录,其它产线插入1条记录
WaitPrint[] wpArr = M100ConvertToWaitPrint(m100Obj);
//处理断号 //处理断号
if (breakNumLst.Count > 0) if (breakNumLst.Count > 0)
{ {
@ -122,9 +118,9 @@ namespace WY.NewJit.MsgCheck
foreach (var item in wpArr) //遍历门板、柱护板、其它柱护板 foreach (var item in wpArr) //遍历门板、柱护板、其它柱护板
{ {
var insObj = await _waitPrintRepository.FirstOrDefaultAsync(itm => var insObj = await _waitPrintRepository.FirstOrDefaultAsync(itm =>
itm.HostSN2 == m100Obj.HostSN2 itm.HostSN2 == m100Obj.HostSN2
&& itm.BillStatus == BillStatusEnum.BreakNum && itm.BillStatus == BillStatusEnum.BreakNum
&& itm.BusinessType == item.BusinessType); && itm.BusinessType == item.BusinessType);
if (insObj != null) if (insObj != null)
{ {
@ -143,6 +139,25 @@ namespace WY.NewJit.MsgCheck
return m100Ret; return m100Ret;
} }
private WaitPrint[] M100ConvertToWaitPrint(BillM100 m100Obj)
{
WaitPrint[] wpArr;
if (m100Obj.ProductLine == "08")
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
}
else
{
WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec };
}
return wpArr;
}
public async Task<BillM100> UpdateM100(BillM100 m100Obj, bool autoSave = false) public async Task<BillM100> UpdateM100(BillM100 m100Obj, bool autoSave = false)
{ {
var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave); var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave);

Loading…
Cancel
Save