mahao 1 year ago
parent
commit
660f04e6bc
  1. 10
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  2. 63
      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()
#if DEBUG
.AddJsonFile("appsettings.Development.json")
#else
.AddJsonFile("appsettings.json")
#endif
//#if DEBUG
// .AddJsonFile("appsettings.Development.json")
//#else
// .AddJsonFile("appsettings.json")
//#endif
.Build();

63
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.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase;
@ -37,11 +38,32 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary>
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>
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository,
INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository,
INormalEfCoreRepository<PriceList, Guid> priceListRepository,
IDistributedCache<PUB_SA> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -50,6 +72,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_repository = repository;
_pubSaDetailRepository = pubSaDetailRepository;
_priceListRepository = priceListRepository;
}
#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 _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 pubSa = new PUB_SA()
{
@ -74,20 +100,41 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
State = "1"
};
_ls.ForEach(s =>
_ls.ForEach(s =>
{
string[] luArr = s.LU.Split(" ");
var lus = luArr.Reverse();
var result = lus.Aggregate(" ", (current, index) => current + index);
//s.LU = s.LU.Replace(" ", "").Replace(" ", " ");
if (s.LU != null)
{
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;
s.BillNum = billNum;
s.Site = "直供件";
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;
}

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

@ -3,7 +3,9 @@ using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
@ -72,6 +74,35 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
var dtos = ObjectMapper.Map<List<CentralizedControl>, List<CentralizedControlDto>>(entities);
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
#region 开启、关闭

Loading…
Cancel
Save