|
|
@ -15,6 +15,7 @@ using Volo.Abp.Uow; |
|
|
|
using Win.Sfs.SettleAccount.Bases; |
|
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Temp; |
|
|
|
using Win.Sfs.SettleAccount.Entities.CodeSettings; |
|
|
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
|
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
@ -43,7 +44,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _notpubRepository; |
|
|
|
|
|
|
|
|
|
|
|
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationRepository; |
|
|
|
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository; |
|
|
|
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository; |
|
|
|
protected readonly INormalEfCoreRepository<CodeSetting, Guid> _codesetRepository; |
|
|
@ -58,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
PUB_CAN_SA_MNG pubMng, |
|
|
|
BBAC_CAN_SA_MNG bbacMng, |
|
|
|
HBPO_CAN_SA_MNG hbpoMng, |
|
|
|
INormalEfCoreRepository<MaterialRelationship, Guid> relationRepository, |
|
|
|
INormalEfCoreRepository<BBAC_PD, Guid> pdbbacRepository, |
|
|
|
INormalEfCoreRepository<HBPO_PD, Guid> pdhbpoRepository, |
|
|
|
INormalEfCoreRepository<PUB_PD, Guid> pdpubRepository, |
|
|
@ -87,6 +89,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
_codesetRepository = codesetRepository; |
|
|
|
_nothbpoRepository = nothbpoRepository; |
|
|
|
_notpubRepository = notpubRepository; |
|
|
|
_relationRepository= relationRepository; |
|
|
|
} |
|
|
|
|
|
|
|
public INV_MNG() |
|
|
@ -375,6 +378,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
/// <returns></returns>
|
|
|
|
public virtual async Task<bool> ReceivedAsync(List<string> p_invs) |
|
|
|
{ |
|
|
|
var relationList=_relationRepository.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var invList = _repository.Where(p => p_invs.Contains(p.InvbillNum)).ToList();//所有提交发票信息
|
|
|
|
int count = invList.Select(p => p.InvGroupNum).Distinct().Count(); |
|
|
|
if (count > 1) |
|
|
@ -526,6 +532,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
detail.Extend2 = itm.ErpLoc;//ERP库位
|
|
|
|
bbacDetail.Add(detail); |
|
|
|
} |
|
|
|
foreach (var itm in bbacDetail) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(itm.RELU)) |
|
|
|
{ |
|
|
|
if (itm.BusinessType==EnumBusinessType.None) |
|
|
|
{ |
|
|
|
itm.BusinessType= EnumBusinessType.JisBBAC; |
|
|
|
} |
|
|
|
var relist = relationList.Where(p => p.BusinessType == itm.BusinessType).ToList(); |
|
|
|
var material = relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU); |
|
|
|
itm.RELU = material.ErpMaterialCode; |
|
|
|
} |
|
|
|
} |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacmainlist).ConfigureAwait(false); |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacDetail).ConfigureAwait(false); |
|
|
|
foreach (var itm in invList) |
|
|
@ -627,6 +646,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
entityList.AddRange(entityDetail); |
|
|
|
} |
|
|
|
var bbacmainlist = new List<HBPO_PD>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var itm in invList) |
|
|
|
{ |
|
|
|
var bbac = new HBPO_PD( |
|
|
@ -670,6 +696,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
bbacDetail.Add(entity |
|
|
|
); |
|
|
|
} |
|
|
|
foreach (var itm in bbacDetail) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(itm.RELU)) |
|
|
|
{ |
|
|
|
if (itm.BusinessType == EnumBusinessType.None) |
|
|
|
{ |
|
|
|
itm.BusinessType = EnumBusinessType.JisHBPO; |
|
|
|
} |
|
|
|
var relist = relationList.Where(p => p.BusinessType == itm.BusinessType).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var material = relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU); |
|
|
|
itm.RELU = material.ErpMaterialCode; |
|
|
|
} |
|
|
|
} |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacmainlist).ConfigureAwait(false); |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacDetail).ConfigureAwait(false); |
|
|
|
foreach (var itm in invList) |
|
|
@ -784,6 +826,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
state: SettleBillState.客户已收票, |
|
|
|
invGroupNum: itm.InvGroupNum, |
|
|
|
site: string.Empty |
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
bbacmainlist.Add(pub); |
|
|
|
|
|
|
@ -818,6 +862,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers |
|
|
|
bbacDetail.Add(entity |
|
|
|
); |
|
|
|
} |
|
|
|
var main= invList.FirstOrDefault(); |
|
|
|
foreach (var itm in bbacDetail) |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(itm.RELU)) |
|
|
|
{ |
|
|
|
var relist = relationList.Where(p => p.BusinessType == main.BusinessType).ToList(); |
|
|
|
var material = relist.FirstOrDefault(p => p.SettleMaterialCode.Replace(" ","") == itm.LU.Replace(" ", "")); |
|
|
|
itm.RELU = material.ErpMaterialCode; |
|
|
|
itm.BusinessType= main.BusinessType; |
|
|
|
} |
|
|
|
} |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacmainlist); |
|
|
|
await _repository.DbContext.BulkInsertAsync(bbacDetail); |
|
|
|
|
|
|
|