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; namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
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
{ {
public interface IMaterialRelationshipAppService : ICrudAppService<MaterialRelationshipDto, public interface IMaterialRelationshipAppService
MaterialRelationshipDto,
Guid,
MaterialRelationshipRequestDto,
MaterialRelationshipCreateDto,
MaterialRelationshipUpdateDto>,
IBranchBaseDataAppService<MaterialRelationshipDto, Guid>
{ {
} }
} }

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

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

@ -1,42 +1,22 @@
using System; using Microsoft.AspNetCore.Authorization;
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.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Distributed;
using Shouldly; using Shouldly;
using Volo.Abp; using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching; 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.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers; 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.ExcelImporter;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.Controls namespace Win.Sfs.SettleAccount.Entities.Controls
{ {
/// <summary> /// <summary>
/// 期间设置 /// 期间设置
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.CentralizedControls.Default)]
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/CentralizedControl")] [Route("api/settleaccount/CentralizedControl")]
public class CentralizedControlAppService : SettleAccountApplicationBase<CentralizedControl> public class CentralizedControlAppService : SettleAccountApplicationBase<CentralizedControl>
@ -46,16 +26,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<CentralizedControl, Guid> _repository; private readonly INormalEfCoreRepository<CentralizedControl, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly IExcelImportAppService _excelImportService;
/// <summary> /// <summary>
/// 构建方法 /// 构造
/// </summary> /// </summary>
public CentralizedControlAppService( public CentralizedControlAppService(
INormalEfCoreRepository<CentralizedControl, Guid> repository, INormalEfCoreRepository<CentralizedControl, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
IDistributedCache<CentralizedControl> cache, IDistributedCache<CentralizedControl> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -63,10 +38,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{ {
_repository = repository; _repository = repository;
_excelImportService = excelImportService;
} }
#region 导入、导 #region 导出
/// <summary> /// <summary>
/// 导出 /// 导出
/// </summary> /// </summary>
@ -103,6 +77,9 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
#endregion #endregion
#region 开启、关闭 #region 开启、关闭
/// <summary>
/// 开启版本
/// </summary>
[HttpPost] [HttpPost]
[Route("open")] [Route("open")]
public async Task<bool> OpenVersion(List<Guid> ids) public async Task<bool> OpenVersion(List<Guid> ids)
@ -115,11 +92,11 @@ namespace Win.Sfs.SettleAccount.Entities.Controls
return true; return true;
} }
[HttpPost]
[Route("close")]
/// <summary> /// <summary>
/// 关闭版本 /// 关闭版本
/// </summary> /// </summary>
[HttpPost]
[Route("close")]
public async Task<bool> ClosedVersion(List<Guid> ids) public async Task<bool> ClosedVersion(List<Guid> ids)
{ {
var entitys = await _repository.GetListAsync(p => ids.Contains(p.Id)); 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.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.DtoBase;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using Win.Utils; using Win.Utils;
@ -37,7 +38,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// <summary> /// <summary>
/// 客户零件关系 /// 客户零件关系
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.MaterialRelationships.Default)]
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/MaterialRelationshipAppService")] [Route("api/settleaccount/MaterialRelationshipAppService")]
public class MaterialRelationshipAppService : SettleAccountApplicationBase<MaterialRelationship> public class MaterialRelationshipAppService : SettleAccountApplicationBase<MaterialRelationship>
@ -47,17 +47,11 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _repository; private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
private readonly IExcelImportAppService _excelImportService;
/// <summary> /// <summary>
/// 构造方法 /// 构造
/// </summary> /// </summary>
public MaterialRelationshipAppService( public MaterialRelationshipAppService(
INormalEfCoreRepository<MaterialRelationship, Guid> repository, INormalEfCoreRepository<MaterialRelationship, Guid> repository,
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IDistributedCache<MaterialRelationship> cache, IDistributedCache<MaterialRelationship> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -65,9 +59,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{ {
_repository = repository; _repository = repository;
_mapRepository = mapRepository;
_excelImportService = excelImportService;
} }
#region 导入、导出 #region 导入、导出
@ -122,7 +113,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Export")] [Route("Export")]
public async Task<string> ExportAsync(MaterialRelationshipRequestDto input) public async Task<string> ExportAsync(RequestDtoBase input)
{ {
string fileName = $"客户零件关系_{Guid.NewGuid()}.xlsx"; string fileName = $"客户零件关系_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
@ -143,7 +134,7 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("list")] [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 entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); 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.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shouldly; using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -10,16 +8,8 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.CommonManagers; 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.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Materials namespace Win.Sfs.SettleAccount.Entities.Materials
@ -27,50 +17,27 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// <summary> /// <summary>
/// 物料主数据 /// 物料主数据
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.Materials.Default)]
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/MaterialAppService")] [Route("api/settleaccount/MaterialAppService")]
public class MaterialAppService : SettleAccountApplicationBase<Material> public class MaterialAppService : SettleAccountApplicationBase<Material>
{ {
private readonly IExcelImportAppService _excelImportService; /// <summary>
/// 物料主数据仓储
/// </summary>
private readonly INormalEfCoreRepository<Material, Guid> _repository; 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>
/// 构建方法 /// 构造
/// </summary> /// </summary>
public MaterialAppService( public MaterialAppService(
INormalEfCoreRepository<Material, Guid> repository, INormalEfCoreRepository<Material, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository, IDistributedCache<Material> cache,
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,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{ {
_priceRepository = priceRepository; _repository = repository;
_priceversionRepository = priceversionRepository;
_bomRepository = bomRepository;
_excelImportService = excelImportService;
_repository = repository;
_relationshipRepository = relationshipRepository;
_mapRepository = mapRepository;
_bomversionRepository = bomversionRepository;
} }
#region 导入、导出 #region 导入、导出
@ -79,7 +46,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Export")] [Route("Export")]
//[Authorize(SettleAccountPermissions.Materials.Default)]
public virtual async Task<string> ExportAsync(MaterialRequestDto input) public virtual async Task<string> ExportAsync(MaterialRequestDto input)
{ {
string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); string _fileName = string.Format("物料主数据_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd"));
@ -112,7 +78,6 @@ namespace Win.Sfs.SettleAccount.Entities.Materials
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("list")] [Route("list")]
//[Authorize(SettleAccountPermissions.Materials.Default)]
virtual public async Task<PagedResultDto<MaterialDto>> GetListAsync(MaterialRequestDto input) virtual public async Task<PagedResultDto<MaterialDto>> GetListAsync(MaterialRequestDto input)
{ {
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, 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.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NPOI.SS.UserModel;
using SettleAccount.Job.Services.Report;
using Shouldly; using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TaskJob.EventArgs;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.Prices namespace Win.Sfs.SettleAccount.Entities.Prices
{ {
/// <summary> /// <summary>
/// 标准价格单-相关应用服务 /// 销售价格单
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
[Route("api/SettleAccount/TB_PRICE_LIST_Service")] [Route("api/SettleAccount/TB_PRICE_LIST_Service")]
[AllowAnonymous] [AllowAnonymous]
public class PriceListAppService : ApplicationService public class PriceListAppService : ApplicationService
@ -55,15 +45,15 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
} }
#region 导入、导出 #region 导入、导出
/// <summary> ///// <summary>
/// 获取导入模板 ///// 获取导入模板
/// </summary> ///// </summary>
[HttpPost("import-template")] //[HttpPost("import-template")]
public virtual async Task<IActionResult> ImportTemplateAsync() //public virtual async Task<IActionResult> ImportTemplateAsync()
{ //{
await Task.CompletedTask; // await Task.CompletedTask;
return new Microsoft.AspNetCore.Mvc.OkResult(); // return new Microsoft.AspNetCore.Mvc.OkResult();
} //}
/// <summary> /// <summary>
/// 导入 /// 导入
@ -100,7 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Export")] [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(); IExporter _csv = new CsvExporter();
@ -115,18 +105,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
string _fileName = string.Empty; string _fileName = string.Empty;
//声明导出容器 //声明导出容器
byte[] result = null; _fileName = string.Format("销售价格单_{0}.xlsx", Guid.NewGuid().ToString());
switch (input.FileType) byte[] result = await _excel.ExportAsByteArray(dtoDetails);
{
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;
}
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
@ -147,12 +127,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("list")] [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 entitys = await _priceListManager.GetListAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create()); var totalCount = await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
var dtos = ObjectMapper.Map<List<PriceList>, List<TB_PRICE_LISTDto>>(entitys); 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.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Shouldly;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; 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.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; 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.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -17,29 +21,24 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// <summary> /// <summary>
/// 备件价格 /// 备件价格
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.PriceLists.Default)]
[AllowAnonymous] [AllowAnonymous]
[Route("api/SettleAccount/TB_PRICE_BJ_Service")] [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 INormalEfCoreRepository<PriceListBJ, Guid> _repository;
private readonly PriceListManagerBJ _priceListManagerBJ; private readonly PriceListManagerBJ _priceListManagerBJ;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository;
public PriceListAppServiceBJ( public PriceListAppServiceBJ(
INormalEfCoreRepository<PriceListBJ, Guid> repository, INormalEfCoreRepository<PriceListBJ, Guid> repository,
PriceListManagerBJ priceListManagerBJ, PriceListManagerBJ priceListManagerBJ,
IDistributedCache<PriceListBJ> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) :base(repository: repository, excelImportService: excelImportService) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{ {
_repository = repository; _repository = repository;
_priceListManagerBJ = priceListManagerBJ; _priceListManagerBJ = priceListManagerBJ;
_excelImportService = excelImportService;
_mapRepository = mapRepository;
} }
#region 导入、导出 #region 导入、导出
@ -48,7 +47,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
/// </summary> /// </summary>
[HttpPost] [HttpPost]
[Route("Import")] [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(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService); var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
@ -68,6 +67,40 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
await _priceListManagerBJ.ImportAsync(_ls.ToList(), version); await _priceListManagerBJ.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr; 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 #endregion
#region 原有的方法之后废弃删除 #region 原有的方法之后废弃删除

Loading…
Cancel
Save