From 285015f236f14bd882f5851bca3a20275ca61e4f Mon Sep 17 00:00:00 2001 From: zhaoxinyu <89237069@qq.com> Date: Wed, 6 Mar 2024 10:41:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=99=A8=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Equipments/EquipmentAppService.cs | 54 ++++++++++++++++++- .../EquipmentAreaAutoMapperProfile.cs | 1 + .../Equipments/EquipmentAutoMapperProfile.cs | 2 + .../Equipments/EquipmentRecordAppService.cs | 36 ++++++++++--- .../StoreEntityFrameworkCoreModule.cs | 1 + 5 files changed, 86 insertions(+), 8 deletions(-) diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs index 6a734a07d..a93db8119 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.IO; using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; @@ -15,6 +17,8 @@ using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Application.Contracts.ExportAndImport; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -29,14 +33,17 @@ public class EquipmentAppService //private readonly ItemValidator _itemValidator; private readonly IEquipmentManager _manager; private new readonly IEquipmentRepository _repository; - + private readonly IExportImportService _importService; + public EquipmentAppService( IEquipmentRepository repository, IDistributedCache cache, + IExportImportService importService, // ItemValidator itemValidator, IEquipmentManager manager) : base(repository, cache) { + _importService=importService; _repository = repository; //_itemValidator = itemValidator; _manager = manager; @@ -52,7 +59,52 @@ public class EquipmentAppService { await Task.CompletedTask.ConfigureAwait(false); } + //public override async Task ImportAsync([FromForm] SfsImportRequestInput requestInput, [Required] IFormFile file) + //{ + // List errors = new List(); + // using var ms = new MemoryStream(); + // await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); + // var inputFileBytes = ms.GetAllBytes(); + // var dtos=_importService.Import(inputFileBytes).ToList(); + // var list=ObjectMapper.Map, List>(dtos); + + + + + + // foreach (var itm in list) + // { + // itm.SetId(GuidGenerator.Create()); + // itm.Code = string.Format("{0}{1}", "Q", itm.Code); + + // } + + + + + // ////var bytes = result.FileContents; + // ////result.FileContents = null; + // ////HttpContextAccessor.HttpContext.Response.Headers.AccessControlExposeHeaders = "X-Response"; + // ////HttpContextAccessor.HttpContext.Response.Headers.Add("X-Response", + // //// JsonSerializer.Serialize(new { result.ExceptionMessage, result.FileName, result.FileCode, result })); + + // ////Console.WriteLine(@"导入错误信息:" + result.ExceptionMessage); + + // ////var resultAction = new TestResult(bytes, ExportImportService.ContentType) { FileDownloadName = result.FileName }; + // ////resultAction.errorNum = result.ErrorNum; + // ////resultAction.successNum = resultAction.successNum; + // //return resultAction; + + + + + + + + + // // return base.ImportAsync(requestInput, file); + //} //protected ICategoryAppService _categoryApp => LazyServiceProvider.LazyGetRequiredService(); //protected IItemCategoryAppService _itemCategoryApp => LazyServiceProvider.LazyGetRequiredService(); diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs index 34507c831..503434c56 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAreaAutoMapperProfile.cs @@ -19,6 +19,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile .Ignore(x => x.Remark) .Ignore(x => x.ExtraProperties) .Ignore(x => x.ConcurrencyStamp) + ; //CreateMap() diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs index fec39f919..0f2899506 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs @@ -19,6 +19,8 @@ public partial class BasedataApplicationAutoMapperProfile : Profile .Ignore(x => x.Remark) .Ignore(x => x.ExtraProperties) .Ignore(x => x.ConcurrencyStamp) + .ForMember(p =>p.Code, p => p.MapFrom(q =>"Q" +q.Code)) + ; //CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentRecordAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentRecordAppService.cs index df6bf8b6a..56a246d0c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentRecordAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Equipments/EquipmentRecordAppService.cs @@ -23,7 +23,7 @@ namespace Win_in.Sfs.Wms.Store.Application; [Authorize] [Route($"{StoreConsts.RootPath}EquipmentRecord")] public class EquipmentRecordAppService - : SfsCrudAppServiceBase , IEquipmentRecordAppService @@ -42,32 +42,54 @@ public class EquipmentRecordAppService _manager = manager; _repository = repository; } - + /// + /// 没用 + /// + /// + /// + /// + /// + [HttpPost("addDetail")] public Task AddDetailListAsync(Guid id, List list) { throw new NotImplementedException(); } - + /// + /// 没用 + /// + [HttpPost("check")] public Task CheckStatusAsync(string number) { throw new NotImplementedException(); } - + /// + /// 没用 + /// + [HttpPost("getlist")] public Task> GetDetailListAsync(Guid id, SfsStoreRequestInputBase requestInput) { throw new NotImplementedException(); } - + /// + /// 没用 + /// + [HttpPost("updateDetail")] public Task UpdateDetailAsync(Guid id, Guid detailId, EquipmentRecordDTO updateDTO) { throw new NotImplementedException(); } - + /// + /// 没用 + /// + [HttpPost("upsertAsync")] public Task UpsertAsync(EquipmentRecordEditInput input) { throw new NotImplementedException(); } - + /// + /// 没用 + /// + [HttpPost("withDetil")] Task ISfsReadOnlyWithDetailsAppService.GetDetailAsync(Guid id, Guid detailId) { throw new NotImplementedException(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs index 0a5316749..2b05879e9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs @@ -32,6 +32,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); #endregion