From 78915bea9c19bdc241353bdd48ef548354d1ab96 Mon Sep 17 00:00:00 2001 From: mahao Date: Wed, 12 Jul 2023 15:32:38 +0800 Subject: [PATCH] BBAC EDI --- .../Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs | 7 + .../Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs | 136 ++++++++++++++++++ .../Entities/BQ/BBAC_SE_EDI_Service.cs | 69 ++++++++- ...ttleAccountApplicationAutoMapperProfile.cs | 10 ++ 4 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_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 52a14e90..bb1f79c7 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 @@ -12,36 +12,43 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos /// /// 期间 /// + [Display(Name = "期间")] public int Version { set; get; } /// /// 发货时间 /// + [Display(Name = "发货时间")] public DateTime ShippingDate { set; get; } /// /// 发运单号 /// + [Display(Name = "发运单号")] public string WmsBillNum { set; get; } /// /// 零件号 /// + [Display(Name = "零件号")] public string LU { get; set; } /// /// 生产号 /// + [Display(Name = "生产号")] public string PN { get; set; } /// /// 组合键值(LU+PN) /// + [Display(Name = "组合键值(LU+PN)")] public string KeyCode { get; set; } /// /// 数量 /// + [Display(Name = "数量")] public decimal Qty { get; set; } /// 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 new file mode 100644 index 00000000..1b82715a --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs @@ -0,0 +1,136 @@ +using Magicodes.ExporterAndImporter.Core; +using System; +using System.ComponentModel.DataAnnotations; + +namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos +{ + /// + /// BBAC的EDI数据 + /// + public class BBAC_SE_EDI_DTO + { + /// + /// LU+生产码 + /// + [Display(Name = "LU+生产码")] + public string KeyCode { get; set; } = null!; + + /// + /// 期间 + /// + [Display(Name = "期间")] + public int Version { get; set; } + + /// + /// 零件号 + /// + [Display(Name = "零件号")] + public string LU { get; set; } = null!; + + /// + /// 生产码 + /// + [Display(Name = "生产码")] + public string PN { get; set; } = null!; + + /// + /// 日顺序号 + /// + [Display(Name = "日顺序号")] + public string SeqNumber { get; set; } = null!; + + /// + /// 小总成号 + /// + [Display(Name = "小总成号")] + public string AssemblyCode { get; set; } = null!; + + /// + /// 注塑码 + /// + [Display(Name = "注塑码")] + public string InjectionCode { get; set; } = null!; + + /// + /// EDI数量 + /// + [Display(Name = "EDI数量")] + public decimal Qty { get; set; } + + /// + /// 订货时间 + /// + [Display(Name = "订货时间")] + public DateTime BeginDate { get; set; } + } + + /// + /// 导出 + /// + public class BBAC_SE_EDI_EXPORT_DTO + { + /// + /// LU+生产码 + /// + [Display(Name = "LU+生产码")] + [ExporterHeader(DisplayName = "LU+生产码")] + public string KeyCode { get; set; } = null!; + + /// + /// 期间 + /// + [Display(Name = "期间")] + [ExporterHeader(DisplayName = "期间")] + public int Version { get; set; } + + /// + /// 零件号 + /// + [Display(Name = "零件号")] + [ExporterHeader(DisplayName = "零件号")] + public string LU { get; set; } = null!; + + /// + /// 生产码 + /// + [Display(Name = "生产码")] + [ExporterHeader(DisplayName = "{0}")] + public string PN { get; set; } = null!; + + /// + /// 日顺序号 + /// + [Display(Name = "日顺序号")] + [ExporterHeader(DisplayName = "{0}")] + public string SeqNumber { get; set; } = null!; + + /// + /// 小总成号 + /// + [Display(Name = "小总成号")] + [ExporterHeader(DisplayName = "{0}")] + public string AssemblyCode { get; set; } = null!; + + /// + /// 注塑码 + /// + [Display(Name = "注塑码")] + [ExporterHeader(DisplayName = "{0}")] + public string InjectionCode { get; set; } = null!; + + /// + /// EDI数量 + /// + [Display(Name = "EDI数量")] + [ExporterHeader(DisplayName = "{0}")] + public decimal Qty { get; set; } + + /// + /// 订货时间 + /// + [Display(Name = "订货时间")] + [ExporterHeader(DisplayName = "{0}")] + public DateTime BeginDate { get; set; } + } + +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SE_EDI_Service.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SE_EDI_Service.cs index 83228735..a7791e30 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SE_EDI_Service.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SE_EDI_Service.cs @@ -1,17 +1,80 @@ using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components; +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.Application.Services; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { + /// + /// BBAC的EDI数据 + /// [AllowAnonymous] [Route("api/settleaccount/bbac_se_edi_service")] public class BBAC_SE_EDI_SERVICE : ApplicationService { + /// + /// BBAC的EDI数据仓储 + /// + private readonly INormalEfCoreRepository _repository; + + /// + /// excel服务 + /// + private readonly IExcelImportAppService _excelImportService; + + /// + /// 构造 + /// + public BBAC_SE_EDI_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService) + { + _repository = repository; + _excelImportService = excelImportService; + } + + #region 导出 + /// + /// 导出 + /// + [HttpPost] + [Route("Export")] + public async Task ExportAsync(RequestDto input) + { + string fileName = $"BBAC的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 查询 + /// + /// 获取列表 + /// + [HttpPost] + [Route("list")] + 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); + } + #endregion + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index b88f2bcc..84012d2a 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -137,6 +137,7 @@ namespace Win.Sfs.SettleAccount CreateMapPURCHASE_PRICE(); CreateMapTB_RePartsRelationship(); CreateMapBBAC_SE_DETAIL(); + CreateMapBBAC_SE_EDI(); } #region 北汽 @@ -767,5 +768,14 @@ namespace Win.Sfs.SettleAccount CreateMap(); } + /// + /// BBAC EDI + /// + private void CreateMapBBAC_SE_EDI() + { + CreateMap(); + CreateMap(); + } + } }