mahao 1 year ago
parent
commit
09d6b17247
  1. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs
  3. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs
  4. 66
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs
  5. 45
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs
  6. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs
  7. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs
  8. 54
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  9. 59
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

20
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/IMaterialRelationshipAppService.cs

@ -1,22 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.ApplicationBase;
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
{
public interface IMaterialRelationshipAppService : ICrudAppService<MaterialRelationshipDto,
MaterialRelationshipDto,
Guid,
MaterialRelationshipRequestDto,
MaterialRelationshipCreateDto,
MaterialRelationshipUpdateDto>,
IBranchBaseDataAppService<MaterialRelationshipDto, Guid>
public interface IMaterialRelationshipAppService
{
}
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs

@ -108,14 +108,6 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
}
/// <summary>
/// FIS
/// </summary>
public class MaterialRelationshipRequestDto : RequestDtoBase
{
}
/// <summary>

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs

@ -16,8 +16,6 @@ using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.DtoBase;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ

66
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs

@ -1,48 +1,27 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Shouldly;
using Volo.Abp;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.Controls;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
namespace Win.Sfs.SettleAccount.Boms
{
/// <summary>
/// BOM
/// </summary>
//[Authorize(SettleAccountPermissions.Boms.Default)]
[AllowAnonymous]
[Route("api/settleaccount/BomAppService")]
public class BomAppService : SettleAccountApplicationBase<Bom>
@ -52,46 +31,21 @@ namespace Win.Sfs.SettleAccount.Boms
/// </summary>
private readonly INormalEfCoreRepository<Bom, Guid> _repository;
private readonly IGuidGenerator _guidGenerator;
private readonly IObjectMapper _objectMapper;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<Material, Guid> _materialRepository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _importColumnMapRepository;
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _versionRepository;
/// <summary>
/// ¹¹Ôì·½·¨
/// ¹¹Ôì
/// </summary>
public BomAppService(
INormalEfCoreRepository<Bom, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> versionRepository,
ISettleAccountBranchEfCoreRepository<Material, Guid> materialRepository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> importColumnMapRepository,
IDistributedCache<Bom> cache
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
IDistributedCache<Bom> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{
_repository = repository;
_guidGenerator = guidGenerator;
_objectMapper = objectMapper;
_excelImportService = excelImportService;
_versionRepository = versionRepository;
_materialRepository = materialRepository;
_importColumnMapRepository = importColumnMapRepository;
}
#region µ¼Èë¡¢µ¼³ö
#region µ¼³ö
/// <summary>
/// µ¼³ö
/// </summary>

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

@ -1,42 +1,22 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Shouldly;
using Volo.Abp;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Guids;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.Controls
{
/// <summary>
/// 期间设置
/// </summary>
//[Authorize(SettleAccountPermissions.CentralizedControls.Default)]
[AllowAnonymous]
[Route("api/settleaccount/CentralizedControl")]
public class CentralizedControlAppService : SettleAccountApplicationBase<CentralizedControl>
@ -46,16 +26,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
/// </summary>
private readonly INormalEfCoreRepository<CentralizedControl, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 构建方法
/// 构造
/// </summary>
public CentralizedControlAppService(
INormalEfCoreRepository<CentralizedControl, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
IDistributedCache<CentralizedControl> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -63,10 +38,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
_excelImportService = excelImportService;
}
#region 导入、导
#region 导出
/// <summary>
/// 导出
/// </summary>
@ -103,6 +77,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
#endregion
#region 开启、关闭
/// <summary>
/// 开启版本
/// </summary>
[HttpPost]
[Route("open")]
public async Task<bool> OpenVersion(List<Guid> ids)
@ -115,11 +92,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
return true;
}
[HttpPost]
[Route("close")]
/// <summary>
/// 关闭版本
/// </summary>
[HttpPost]
[Route("close")]
public async Task<bool> ClosedVersion(List<Guid> ids)
{
var entitys = await _repository.GetListAsync(p => ids.Contains(p.Id));

17
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs

@ -29,6 +29,7 @@ using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.DtoBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
@ -37,7 +38,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// <summary>
/// 客户零件关系
/// </summary>
//[Authorize(SettleAccountPermissions.MaterialRelationships.Default)]
[AllowAnonymous]
[Route("api/settleaccount/MaterialRelationshipAppService")]
public class MaterialRelationshipAppService : SettleAccountApplicationBase<MaterialRelationship>
@ -47,17 +47,11 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 构造方法
/// 构造
/// </summary>
public MaterialRelationshipAppService(
INormalEfCoreRepository<MaterialRelationship, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IDistributedCache<MaterialRelationship> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -65,9 +59,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{
_repository = repository;
_mapRepository = mapRepository;
_excelImportService = excelImportService;
}
#region 导入、导出
@ -122,7 +113,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary>
[HttpPost]
[Route("Export")]
public async Task<string> ExportAsync(MaterialRelationshipRequestDto input)
public async Task<string> ExportAsync(RequestDtoBase input)
{
string fileName = $"客户零件关系_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
@ -143,7 +134,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary>
[HttpPost]
[Route("list")]
public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(MaterialRelationshipRequestDto input)
public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(RequestDtoBase input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Materials/MaterialAppService.cs

@ -1,7 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shouldly;
using System;
using System.Collections.Generic;
@ -10,16 +8,8 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Materials
@ -27,50 +17,27 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// <summary>
/// 物料主数据
/// </summary>
//[Authorize(SettleAccountPermissions.Materials.Default)]
[AllowAnonymous]
[Route("api/settleaccount/MaterialAppService")]
public class MaterialAppService : SettleAccountApplicationBase<Material>
{
private readonly IExcelImportAppService _excelImportService;
/// <summary>
/// 物料主数据仓储
/// </summary>
private readonly INormalEfCoreRepository<Material, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<Bom, Guid> _bomRepository;
private readonly ISettleAccountBranchEfCoreRepository<BomVersion, Guid> _bomversionRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> _priceversionRepository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> _relationshipRepository;
/// <summary>
/// 构建方法
/// 构造
/// </summary>
public MaterialAppService(
INormalEfCoreRepository<Material, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
ISettleAccountBranchEfCoreRepository<Bom, Guid> bomRepository,
ISettleAccountBranchEfCoreRepository<BomVersion, Guid> bomversionRepository,
TaskJobService service,
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> relationshipRepository,
ISettleAccountBranchEfCoreRepository<PriceList, Guid> priceRepository,
ISettleAccountBranchEfCoreRepository<PriceListVersion, Guid> priceversionRepository,
IDistributedCache<Material> cache,
IDistributedCache<Material> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{
_priceRepository = priceRepository;
_priceversionRepository = priceversionRepository;
_bomRepository = bomRepository;
_excelImportService = excelImportService;
_repository = repository;
_relationshipRepository = relationshipRepository;
_mapRepository = mapRepository;
_bomversionRepository = bomversionRepository;
_repository = repository;
}
#region 导入、导出
@ -79,7 +46,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// </summary>
[HttpPost]
[Route("Export")]
//[Authorize(SettleAccountPermissions.Materials.Default)]
public virtual async Task<string> ExportAsync(MaterialRequestDto input)
{
string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd"));
@ -112,7 +78,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// </summary>
[HttpPost]
[Route("list")]
//[Authorize(SettleAccountPermissions.Materials.Default)]
virtual public async Task<PagedResultDto<MaterialDto>> GetListAsync(MaterialRequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount,

54
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -4,35 +4,25 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NPOI.SS.UserModel;
using SettleAccount.Job.Services.Report;
using Shouldly;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TaskJob.EventArgs;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.Prices
{
/// <summary>
/// 标准价格单-相关应用服务
/// 销售价格单
/// </summary>
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("api/SettleAccount/TB_PRICE_LIST_Service")]
[AllowAnonymous]
public class PriceListAppService : ApplicationService
@ -55,15 +45,15 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
#region 导入、导出
/// <summary>
/// 获取导入模板
/// </summary>
[HttpPost("import-template")]
public virtual async Task<IActionResult> ImportTemplateAsync()
{
await Task.CompletedTask;
return new Microsoft.AspNetCore.Mvc.OkResult();
}
///// <summary>
///// 获取导入模板
///// </summary>
//[HttpPost("import-template")]
//public virtual async Task<IActionResult> ImportTemplateAsync()
//{
// await Task.CompletedTask;
// return new Microsoft.AspNetCore.Mvc.OkResult();
//}
/// <summary>
/// 导入
@ -100,7 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("Export")]
public virtual async Task<string> ExportAsync(TB_PRICE_LIST_RequestDto input)
public virtual async Task<string> ExportAsync(RequestDto input)
{
IExporter _csv = new CsvExporter();
@ -115,18 +105,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
string _fileName = string.Empty;
//声明导出容器
byte[] result = null;
switch (input.FileType)
{
case 0:
_fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
_fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
_fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
byte[] result = await _excel.ExportAsByteArray(dtoDetails);
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
@ -147,12 +127,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("list")]
public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(TB_PRICE_LIST_RequestDto input)
public virtual async Task<PagedResultDto<TB_PRICE_LISTDto>> GetListAsync(RequestDto input)
{
if (!string.IsNullOrEmpty(input.Version))
{
input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "Version", Logic = EnumFilterLogic.And, Value = input.Version });
}
var entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys);

59
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -1,14 +1,18 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase;
@ -17,29 +21,24 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary>
/// 备件价格
/// </summary>
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
[AllowAnonymous]
[Route("api/SettleAccount/TB_PRICE_BJ_Service")]
public class PriceListAppServiceBJ : CurdBaseAppService<PriceListBJ, PriceListBJDto, PriceListBJRequestDto, PriceListBJ, PriceListBJImportDto, PriceListBJExportDto>
public class PriceListAppServiceBJ : SettleAccountApplicationBase<PriceListBJ>
{
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly PriceListManagerBJ _priceListManagerBJ;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
public PriceListAppServiceBJ(
INormalEfCoreRepository<PriceListBJ, Guid> repository,
PriceListManagerBJ priceListManagerBJ,
IDistributedCache<PriceListBJ> cache,
IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository
) :base(repository: repository, excelImportService: excelImportService)
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
_priceListManagerBJ = priceListManagerBJ;
_excelImportService = excelImportService;
_mapRepository = mapRepository;
}
#region 导入、导出
@ -48,7 +47,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary>
[HttpPost]
[Route("Import")]
public override async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
public async Task<string> ImportAsync([FromForm] IFormFileCollection files, string version)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
@ -68,6 +67,40 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
await _priceListManagerBJ.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
[Route("Export")]
public async Task<string> ExportAsync(RequestDto input)
{
string fileName = $"备件价格_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJExportDto>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
[Route("list")]
public async Task<PagedResultDto<PriceListBJDto>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PriceListBJ>, List<PriceListBJDto>>(entities);
return new PagedResultDto<PriceListBJDto>(totalCount, dtos);
}
#endregion
#region 原有的方法之后废弃删除

Loading…
Cancel
Save