|
@ -49,6 +49,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
} |
|
|
} |
|
|
public virtual async Task<List<string>> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list) |
|
|
public virtual async Task<List<string>> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var first=p_list.FirstOrDefault(); |
|
|
List<string> errors = new List<string>(); |
|
|
List<string> errors = new List<string>(); |
|
|
var priceErrors = await _service.CheckPriceList(p_list); |
|
|
var priceErrors = await _service.CheckPriceList(p_list); |
|
|
if (priceErrors.Count > 0) |
|
|
if (priceErrors.Count > 0) |
|
@ -58,16 +59,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
errors.Add($"生产号{itm.PN}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据"); |
|
|
errors.Add($"生产号{itm.PN}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
var ls=p_list.Select(p => p.Site.Substring(0, 3)).Distinct().ToList(); |
|
|
if (first.BusinessType == EnumBusinessType.JisHBPO) |
|
|
if(ls.Count>1) |
|
|
|
|
|
{ |
|
|
{ |
|
|
errors.Add($"生成结算数据有多个地点数据{string.Join(",",ls)}"); |
|
|
|
|
|
|
|
|
var ls = p_list.Select(p => p.Site.Substring(0, 3)).Distinct().ToList(); |
|
|
|
|
|
if (ls.Count > 1) |
|
|
|
|
|
{ |
|
|
|
|
|
errors.Add($"生成结算数据有多个地点数据{string.Join(",", ls)}"); |
|
|
} |
|
|
} |
|
|
if (errors.Count > 0) |
|
|
if (errors.Count > 0) |
|
|
{ |
|
|
{ |
|
|
return errors; |
|
|
return errors; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N"); |
|
|
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N"); |
|
|
var _entity = new HBPO_CAN_SA(); |
|
|
var _entity = new HBPO_CAN_SA(); |
|
|
_entity.BillNum = billNumber; |
|
|
_entity.BillNum = billNumber; |
|
@ -96,7 +102,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
settleDate: itm.SettleDate, |
|
|
settleDate: itm.SettleDate, |
|
|
site: itm.Site, |
|
|
site: itm.Site, |
|
|
invbillnum: string.Empty, |
|
|
invbillnum: string.Empty, |
|
|
partcode:itm.PartCode |
|
|
partcode: itm.PartCode |
|
|
); |
|
|
); |
|
|
_detailEntity.RealPartCode = itm.RealPartCode; |
|
|
_detailEntity.RealPartCode = itm.RealPartCode; |
|
|
_entityList.Add(_detailEntity); |
|
|
_entityList.Add(_detailEntity); |
|
@ -104,6 +110,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
await _notRepository.DbContext.BulkDeleteAsync(p_list); |
|
|
await _notRepository.DbContext.BulkDeleteAsync(p_list); |
|
|
await _repository.DbContext.BulkInsertAsync(new List<HBPO_CAN_SA>() { _entity }); |
|
|
await _repository.DbContext.BulkInsertAsync(new List<HBPO_CAN_SA>() { _entity }); |
|
|
await _repository.DbContext.BulkInsertAsync(_entityList); |
|
|
await _repository.DbContext.BulkInsertAsync(_entityList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return errors; |
|
|
return errors; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|