From d663b2174f31db38abfbff47fe8a89c44389d61c Mon Sep 17 00:00:00 2001 From: mahao Date: Thu, 13 Jul 2023 13:53:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E8=BF=90Dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs | 3 +- .../Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs | 3 +- .../Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs | 3 +- .../Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs | 3 +- .../Entities/BQ/Dtos/PUB_SA_DTO.cs | 51 +++++++++++ .../Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs | 3 +- .../Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs | 4 +- .../BQ/Dtos/TB_RePartsRelationship_DTO.cs | 4 +- .../Entities/BQ/PUB_SA_SERVICE.cs | 84 ++++++++++++++++--- ...ttleAccountApplicationAutoMapperProfile.cs | 12 +++ 10 files changed, 151 insertions(+), 19 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs index bb1f79c7..c19c58f1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs @@ -1,13 +1,14 @@ using Magicodes.ExporterAndImporter.Core; using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// BBAC发运 /// - public class BBAC_SE_DETAIL_DTO + public class BBAC_SE_DETAIL_DTO : EntityDto { /// /// 期间 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs index 1e4da74a..5a8ee0e7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs @@ -1,13 +1,14 @@ using Magicodes.ExporterAndImporter.Core; using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// BBAC的EDI数据 /// - public class BBAC_SE_EDI_DTO + public class BBAC_SE_EDI_DTO : EntityDto { /// /// LU+生产码 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs index bfd3bea6..d00fd381 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs @@ -5,13 +5,14 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// HBPO发运单 /// - public class HBPO_SE_DETAIL_DTO + public class HBPO_SE_DETAIL_DTO : EntityDto { /// /// 期间 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs index 054b8c00..4c2f128e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs @@ -1,13 +1,14 @@ using Magicodes.ExporterAndImporter.Core; using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// HBPO的EDI数据 /// - public class HBPO_SE_EDI_DTO + public class HBPO_SE_EDI_DTO : EntityDto { /// /// LU+生产码 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs new file mode 100644 index 00000000..f076ebf8 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos +{ + /// + /// PUB结算 + /// + public class PUB_SA_DTO : EntityDto + { + /// + /// 期间 + /// + [Display(Name = "期间")] + public int Version { get; set; } + + /// + /// 结算单据 + /// + [Display(Name = "结算单据")] + public string BillNum { get; set; } + + /// + /// 状态 + /// + [Display(Name = "状态")] + public string State { get; set; } + } + + /// + /// 导入 + /// + public class PUB_SA_IMPORT_DTO + { + + } + + /// + /// 导出 + /// + public class PUB_SA_EXPORT_DTO + { + + } + +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs index 6c9b4f61..6ab86ecd 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs @@ -5,13 +5,14 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// PUB发运数据 /// - public class PUB_SE_DETAIL_DTO + public class PUB_SE_DETAIL_DTO : EntityDto { /// /// 期间 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs index e0405c23..e32af455 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs @@ -1,5 +1,7 @@ using Magicodes.ExporterAndImporter.Core; +using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; using Win.Sfs.Shared.DtoBase; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos @@ -7,7 +9,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// /// 采购价格单 /// - public class PURCHASE_PRICE_DTO + public class PURCHASE_PRICE_DTO : EntityDto { /// /// 零件号 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs index 3f14d49f..20fa4d43 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs @@ -1,12 +1,14 @@ using Magicodes.ExporterAndImporter.Core; +using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos { /// /// 客户替换件关系 /// - public class TB_RePartsRelationship_DTO + public class TB_RePartsRelationship_DTO : EntityDto { /// /// 零件号 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index d8516c15..ec5c25f1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -1,43 +1,103 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; +using Shouldly; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; 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.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { /// - /// 公用结算 + /// PUB结算 /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] - public class PUB_SA_SERVICE + public class PUB_SA_SERVICE : SettleAccountApplicationBase { /// - /// 公用结算仓储 + /// PUB结算仓储 /// private readonly INormalEfCoreRepository _repository; /// - /// excel服务 + /// 构造 /// - private readonly IExcelImportAppService _excelImportService; + public PUB_SA_SERVICE(INormalEfCoreRepository repository, + IDistributedCache cache, + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager + ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) + { + _repository = repository; + } + #region 导入、导出 /// - /// 构造 + /// 导入 /// - public PUB_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService) + [HttpPost] + public async Task ImportAsync([FromForm] IFormFileCollection files) { - _repository = repository; - _excelImportService = excelImportService; + ExportImporter _exportImporter = new ExportImporter(); + var result = await _exportImporter.UploadExcelImport(files, _excelImportService); + var _ls = ObjectMapper.Map, List>(result); + await _repository.InsertManyAsync(_ls); + return ApplicationConsts.SuccessStr; } + /// + /// 导出 + /// + [HttpPost] + public async Task ExportAsync(RequestDto input) + { + string fileName = $"HBPO的EDI数据_{Guid.NewGuid()}.xlsx"; + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); + var dtos = ObjectMapper.Map, List>(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 + /// + /// 获取列表 + /// + [HttpPost] + public async Task> 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>(entities); + return new PagedResultDto(totalCount, dtos); + } + + /// + /// 删除 + /// + [HttpPost] + public async Task DeleteAsync(Guid id) + { + await _repository.DeleteAsync(id); + } + #endregion } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index 940643e2..25c97c58 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -136,11 +136,15 @@ namespace Win.Sfs.SettleAccount CreateMapPURCHASE_PRICE(); CreateMapTB_RePartsRelationship(); + CreateMapBBAC_SE_DETAIL(); CreateMapBBAC_SE_EDI(); + CreateMapHBPO_SE_DETAIL(); CreateMapHBPO_SE_EDI(); + CreateMapPUB_SE_DETAIL(); + CreateMapPUB_SA(); } #region BQ @@ -809,5 +813,13 @@ namespace Win.Sfs.SettleAccount CreateMap(); } + /// + /// PUB结算 + /// + private void CreateMapPUB_SA() + { + CreateMap(); + } + } }