|
@ -15,6 +15,7 @@ using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
using Win.Sfs.SettleAccount.CommonManagers; |
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
using Win.Sfs.SettleAccount.Constant; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
|
|
|
using Win.Sfs.SettleAccount.Entities.Prices; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
@ -37,11 +38,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository; |
|
|
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PUB可结算仓储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PUB_CAN_SA, Guid> _pubCanSaRepository; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PUB可结算明细仓储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> _pubCanSaDetailRepository; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// PUB不可结算明细仓储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _pubNotSaDetailRepository; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 销售价格仓储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PriceList, Guid> _priceListRepository; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 构造
|
|
|
/// 构造
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository, |
|
|
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository, |
|
|
INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository, |
|
|
INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository, |
|
|
|
|
|
INormalEfCoreRepository<PriceList, Guid> priceListRepository, |
|
|
IDistributedCache<PUB_SA> cache, |
|
|
IDistributedCache<PUB_SA> cache, |
|
|
IExcelImportAppService excelImportService, |
|
|
IExcelImportAppService excelImportService, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
|
ISnowflakeIdGenerator snowflakeIdGenerator, |
|
@ -50,6 +72,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
_repository = repository; |
|
|
_repository = repository; |
|
|
_pubSaDetailRepository = pubSaDetailRepository; |
|
|
_pubSaDetailRepository = pubSaDetailRepository; |
|
|
|
|
|
_priceListRepository = priceListRepository; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 直供件
|
|
|
#region 直供件
|
|
@ -67,6 +90,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
var result = await _exportImporter.UploadExcelImport<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); |
|
|
var result = await _exportImporter.UploadExcelImport<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); |
|
|
var _ls = ObjectMapper.Map<List<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result); |
|
|
var _ls = ObjectMapper.Map<List<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result); |
|
|
|
|
|
|
|
|
|
|
|
//销售价格
|
|
|
|
|
|
var priceListEntitys = await _priceListRepository.GetAllAsync(); |
|
|
|
|
|
|
|
|
var billNum = GuidGenerator.Create().ToString(); |
|
|
var billNum = GuidGenerator.Create().ToString(); |
|
|
var pubSa = new PUB_SA() |
|
|
var pubSa = new PUB_SA() |
|
|
{ |
|
|
{ |
|
@ -76,18 +102,39 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
_ls.ForEach(s => |
|
|
_ls.ForEach(s => |
|
|
{ |
|
|
{ |
|
|
string[] luArr = s.LU.Split(" "); |
|
|
if (s.LU != null) |
|
|
var lus = luArr.Reverse(); |
|
|
{ |
|
|
var result = lus.Aggregate(" ", (current, index) => current + index); |
|
|
List<string> luList = s.LU.Split(" ").ToList(); |
|
|
|
|
|
s.LU = luList[0].Replace(" ", ""); |
|
|
//s.LU = s.LU.Replace(" ", "").Replace(" ", " ");
|
|
|
if (luList.Count > 1) |
|
|
|
|
|
{ |
|
|
|
|
|
luList.RemoveAt(0); |
|
|
|
|
|
luList.Reverse(); |
|
|
|
|
|
var luAssemble = luList.Select(t => t.Replace(" ", "")); |
|
|
|
|
|
s.LU += luAssemble.Aggregate(" ", (current, index) => current + index); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
s.LU = s.LU; |
|
|
s.BillNum = billNum; |
|
|
s.BillNum = billNum; |
|
|
s.Site = "直供件"; |
|
|
s.Site = "直供件"; |
|
|
s.KeyCode = s.LU + s.PN; |
|
|
s.KeyCode = s.LU + s.PN; |
|
|
|
|
|
|
|
|
|
|
|
var priceListEntity = priceListEntitys.Find(t => t.LU == s.LU && s.SettleDate > t.BeginTime && s.SettleDate < t.EndTime); |
|
|
|
|
|
s.Price = priceListEntity?.Price ?? 0; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//await _repository.InsertAsync(pubSa);
|
|
|
//可结算
|
|
|
//await _pubSaDetailRepository.InsertManyAsync(_ls);
|
|
|
var pubCanSa = new List<string>(); |
|
|
|
|
|
//不可结算
|
|
|
|
|
|
var pubNotCanSa = new List<string>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await _repository.InsertAsync(pubSa); |
|
|
|
|
|
await _pubSaDetailRepository.InsertManyAsync(_ls); |
|
|
return ApplicationConsts.SuccessStr; |
|
|
return ApplicationConsts.SuccessStr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|