mahao 1 year ago
parent
commit
660f04e6bc
  1. 10
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  2. 59
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  3. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs

10
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs

@ -29,11 +29,11 @@ namespace Win.Sfs.SettleAccount
var configuration = new ConfigurationBuilder() var configuration = new ConfigurationBuilder()
#if DEBUG //#if DEBUG
.AddJsonFile("appsettings.Development.json") // .AddJsonFile("appsettings.Development.json")
#else //#else
.AddJsonFile("appsettings.json") // .AddJsonFile("appsettings.json")
#endif //#endif
.Build(); .Build();

59
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -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(" ", "");
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.Replace(" ", "").Replace(" ", " "); 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;
} }

31
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs

@ -3,7 +3,9 @@ using Microsoft.AspNetCore.Mvc;
using Shouldly; using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
@ -72,6 +74,35 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
var dtos = ObjectMapper.Map<List<CentralizedControl>, List<CentralizedControlDto>>(entities); var dtos = ObjectMapper.Map<List<CentralizedControl>, List<CentralizedControlDto>>(entities);
return new PagedResultDto<CentralizedControlDto>(totalCount, dtos); return new PagedResultDto<CentralizedControlDto>(totalCount, dtos);
} }
/// <summary>
/// 新增实体
/// </summary>
[HttpPost]
virtual public async Task<CentralizedControlDto> CreateAsync(CentralizedControlCreateDto input)
{
var _first = _repository.Where(p => p.Version == input.Version).FirstOrDefault();
if (_first != null)
{
throw new BusinessException("001", "已经存在该期间,不能重复添加!");
}
var entity = new CentralizedControl(
GuidGenerator.Create(),
input.BranchId,
input.Year,
input.Period,
input.Year + input.Period,
input.State
);
await _repository.InsertAsync(entity);
var dto = ObjectMapper.Map<CentralizedControl, CentralizedControlDto>(entity);
return dto;
}
#endregion #endregion
#region 开启、关闭 #region 开启、关闭

Loading…
Cancel
Save