|
|
@ -46,38 +46,34 @@ namespace WY.NewJit.MsgCheck |
|
|
|
public async Task<BillM100> InsertM100(BillM100 m100Obj, bool autoSave = false, bool isBatchImportBreakNum = false) |
|
|
|
{ |
|
|
|
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) //批量导入断号模块调用
|
|
|
|
{ |
|
|
|
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.HostSN2 = 0; //WaitPrint的HostSN2从m100的HostSN2取值
|
|
|
|
} |
|
|
|
m100Ret = await _billM100Repository.InsertAsync(m100Obj, autoSave); //插入M100
|
|
|
|
await _waitPrintRepository.InsertManyAsync(wpArr, autoSave); //插入未打印表
|
|
|
|
await _waitPrintRepository.InsertManyAsync(wpArr2, autoSave); //插入未打印表
|
|
|
|
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) |
|
|
|
{ |
|
|
@ -143,6 +139,25 @@ namespace WY.NewJit.MsgCheck |
|
|
|
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) |
|
|
|
{ |
|
|
|
var m100Ret = await _billM100Repository.UpdateAsync(m100Obj, autoSave); |
|
|
|