From 33f014d4f7887906c760391ed378c4b710ff6415 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Mon, 24 Jun 2024 10:23:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTOs/ThirdLocationJobDetailDTO.cs | 112 ++++---- .../IThirdLocationJobAppService.cs | 16 +- .../Inputs/ThirdLocationJobDetailInput.cs | 122 ++++---- .../IThirdLocationNoteAppService.cs | 8 +- .../IThirdLocationRequestAppService.cs | 2 +- .../Inputs/ThirdLocationRequestDetailInput.cs | 101 ++++--- .../Inputs/ThirdLocationRequestEditInput.cs | 30 +- .../ThirdLocationJobAppService.cs | 261 +++++++++++++++++- .../ThirdLocationNoteAppService.cs | 23 ++ .../ThirdLocationRequestAppService.cs | 197 ++++++++++--- .../ThirdLocationRequestAutoMapperProfile.cs | 59 +++- .../IThirdLocationRequestManager.cs | 7 +- .../ThirdLocationRequestManager.cs | 21 ++ .../Jobs/ThirdLocationJobAutoMapperProfile.cs | 46 ++- .../ThirdLocationNoteAutoMapperProfile.cs | 3 + .../ThirdLocationRequestAutoMapperProfile.cs | 80 ++++-- .../ThirdLocationNoteEventHandler.cs | 1 + .../Jobs/ThirdLocationJobEventHandler.cs | 12 +- .../ThirdLocationRequestEventHandler.cs | 24 +- .../ThirdLocationNoteEventHandler.cs | 12 +- .../settings/appsettings.Development.json | 4 +- 21 files changed, 867 insertions(+), 274 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs index a97202981..0bf1ac2ce 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/DTOs/ThirdLocationJobDetailDTO.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -7,112 +8,121 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationJobDetailDTO : SfsJobRecommendFromDetailDTOBase, IHasToLocation { - /// - /// 来源库位 + /// 发出时间 /// - [Display(Name = "来源库位")] - public string FromLocationCode { get; set; } + public DateTime IssueTime { get; set; } /// - /// 来源库区 + /// 是否在在途 /// - [Display(Name = "来源库区")] - public string FromLocationArea { get; set; } + public bool IsOnTheWayLocationCode { get; set; } + + #region 目标库位 /// - /// 到库位 + /// 到库位 /// - [Display(Name = "到库位")] public string ToLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] public string ToLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] public string ToLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] public string ToLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] public string ToWarehouseCode { get; set; } + #endregion + + #region 来源库位 + /// - /// 在途库库位 + /// 到库位 /// - [Display(Name = "在途库库位")] - public string OnTheWayLocationCode { get; set; } - + public string FromLocationCode { get; set; } + /// - /// 收货单件码 + /// 到库区 /// - [Display(Name = "收货单件码")] - public string SingleCodeJob { get; set; } + public string FromLocationArea { get; set; } /// - /// 申请单件码 + /// 到库位组 /// - [Display(Name = "申请单件码")] - public string SingleCodeRequest { get; set; } + public string FromLocationGroup { get; set; } /// - /// 过期时间 + /// 到ERP库位 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string FromLocationErpCode { get; set; } /// - /// 工序 + /// 到仓库 /// - [Display(Name = "工序")] - public string Operation { get; set; } + public string FromWarehouseCode { get; set; } + + #endregion + + #region 在途库位 /// - /// 配送方式 + /// 在途库库位 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string OnTheWayLocationCode { get; set; } + + #endregion /// - /// 取整方式 + /// 申请单件码 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public string SingleCodeRequest { get; set; } /// - /// 取整后数量 + /// 已发数量 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public decimal IssuedQty { get; set; } /// - /// 计划拆分规则 + /// 已收数量 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public decimal ReceivedQty { get; set; } + + /// + /// 箱码 + /// + public string PackingCode { get; set; } + + /// + /// 批次 + /// + public string Lot { get; set; } + + /// + /// 过期时间 + /// + public DateTime ExpiredTime { get; set; } /// - /// 计划开始时间 + /// 库位状态 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public EnumInventoryStatus EnumInventoryStatus { get; set; } /// - /// 每次配送数量 + /// 请求未收 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + [NotMapped] + public decimal NotFinishQty => IssuedQty - ReceivedQty; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/IThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/IThirdLocationJobAppService.cs index a0e156bfa..e0244fc40 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/IThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/IThirdLocationJobAppService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -9,4 +9,18 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public interface IThirdLocationJobAppService : ISfsJobAppServiceBase { + /// + /// 执行任务明细 + /// + /// + Task ExecuteDetailAsync(Guid masterId,List detailDto); + + Task> GetByRequestNumberAsync(string requestNumber); + + /// + /// 完成任务 + /// + /// + /// + Task CompleteAsync(Guid id); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs index b64661f1c..472297611 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ThirdLocationJobs/Inputs/ThirdLocationJobDetailInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -7,136 +8,121 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationJobDetailInput : SfsJobRecommendFromDetailInputBase, IHasToLocation { - /// - /// 来源库位 + /// 发出时间 /// - [Display(Name = "来源库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string FromLocationCode { get; set; } + public DateTime IssueTime { get; set; } /// - /// 来源库区 + /// 是否在在途 /// - [Display(Name = "来源库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string FromLocationArea { get; set; } + public bool IsOnTheWayLocationCode { get; set; } + + #region 目标库位 /// - /// 到库位 + /// 到库位 /// - [Display(Name = "到库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToLocationCode { get; set; } /// - /// 到库区 + /// 到库区 /// - [Display(Name = "到库区")] public string ToLocationArea { get; set; } /// - /// 到库位组 + /// 到库位组 /// - [Display(Name = "到库位组")] public string ToLocationGroup { get; set; } /// - /// 到ERP库位 + /// 到ERP库位 /// - [Display(Name = "到ERP库位")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToLocationErpCode { get; set; } /// - /// 到仓库 + /// 到仓库 /// - [Display(Name = "到仓库")] - [Required(ErrorMessage = "{0}是必填项")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToWarehouseCode { get; set; } + #endregion + + #region 来源库位 + /// - /// 在途库库位 + /// 到库位 /// - [Display(Name = "在途库库位")] - public string OnTheWayLocationCode { get; set; } + public string FromLocationCode { get; set; } + + /// + /// 到库区 + /// + public string FromLocationArea { get; set; } /// - /// 收货单件码 + /// 到库位组 /// - [Display(Name = "收货单件码")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string SingleCodeJob { get; set; } + public string FromLocationGroup { get; set; } /// - /// 申请单件码 + /// 到ERP库位 /// - [Display(Name = "申请单件码")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string SingleCodeRequest { get; set; } + public string FromLocationErpCode { get; set; } /// - /// 过期时间 + /// 到仓库 /// - [Display(Name = "过期时间")] - [Required(ErrorMessage = "{0}是必填项")] - public DateTime ExpiredTime { get; set; } + public string FromWarehouseCode { get; set; } + + #endregion + + #region 在途库位 /// - /// 工序 + /// 在途库库位 /// - [Display(Name = "工序")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Operation { get; set; } + public string OnTheWayLocationCode { get; set; } + + #endregion /// - /// 配送方式 + /// 申请单件码 /// - [Display(Name = "配送方式")] - public EnumDistributionType DistributionType { get; set; } + public string SingleCodeRequest { get; set; } /// - /// 取整方式 + /// 已发数量 /// - [Display(Name = "取整方式")] - public EnumTruncType TruncType { get; set; } + public decimal IssuedQty { get; set; } /// - /// 取整后数量 + /// 已收数量 /// - [Display(Name = "取整后数量")] - public decimal RoundedQty { get; set; } + public decimal ReceivedQty { get; set; } /// - /// 计划拆分规则 + /// 箱码 /// - [Display(Name = "计划拆分规则")] - public EnumPlannedSplitRule PlannedSplitRule { get; set; } + public string PackingCode { get; set; } /// - /// 计划开始时间 + /// 批次 /// - [Display(Name = "计划开始时间")] - public DateTime PlanBeginTime { get; set; } + public string Lot { get; set; } /// - /// 每次配送数量 + /// 过期时间 /// - [Display(Name = "每次配送数量")] - public decimal DeliveryQty { get; set; } + public DateTime ExpiredTime { get; set; } /// - /// 位置码 + /// 库位状态 /// - public string PositionCode { get; set; } + public EnumInventoryStatus EnumInventoryStatus { get; set; } /// - /// 推荐类型 + /// 请求未收 /// - public EnumRecommendType RecommendType { get; set; } + [NotMapped] + public decimal NotFinishQty => IssuedQty - ReceivedQty; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ThirdLocationNotes/IThirdLocationNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ThirdLocationNotes/IThirdLocationNoteAppService.cs index 1a22495df..98850ea2b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ThirdLocationNotes/IThirdLocationNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ThirdLocationNotes/IThirdLocationNoteAppService.cs @@ -3,10 +3,16 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; public interface IThirdLocationNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase { - + /// + /// 创建 同时 直接赋值Number 为了返回Number + /// + /// + /// + Task CreateByNumberAsync(ThirdLocationNoteEditInput input); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/IThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/IThirdLocationRequestAppService.cs index e1f47cb2d..166605947 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/IThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/IThirdLocationRequestAppService.cs @@ -9,5 +9,5 @@ public interface IThirdLocationRequestAppService : ISfsStoreRequestMasterAppServiceBase { - + Task UpdateRequestStatusAsync(string requestNumber); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs index f4c6af449..eada1d84f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestDetailInput.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -7,81 +8,111 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationRequestDetailInput : SfsStoreDetailWithQtyInputBase { + #region 目标库位 + /// - /// 目标库位 + /// 到库位 /// - [Display(Name = "目标库位")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string ToLocationCode { get; set; } /// - /// 来源库位 + /// 到库区 + /// + public string ToLocationArea { get; set; } + + /// + /// 到库位组 + /// + public string ToLocationGroup { get; set; } + + /// + /// 到ERP库位 + /// + public string ToLocationErpCode { get; set; } + + /// + /// 到仓库 + /// + public string ToWarehouseCode { get; set; } + + #endregion + + #region 来源库位 + + /// + /// 到库位 /// - [Display(Name = "来源库位")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string FromLocationCode { get; set; } /// - /// 来源库区 + /// 到库区 /// - [Display(Name = "来源库区")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] public string FromLocationArea { get; set; } /// - /// 申请单件码 + /// 到库位组 /// - [Display(Name = "申请单件码")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string SingleCodeRequest { get; set; } + public string FromLocationGroup { get; set; } /// - /// 工作中心 + /// 到ERP库位 /// - [Display(Name = "工作中心")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string WorkStation { get; set; } + public string FromLocationErpCode { get; set; } /// - /// 过期时间 + /// 到仓库 /// - [Display(Name = "过期时间")] - public DateTime ExpiredTime { get; set; } + public string FromWarehouseCode { get; set; } + + #endregion + + #region 在途库位 /// - /// 状态 + /// 在途库库位 /// - [Display(Name = "状态")] - public EnumRequestStatus RequestStatus { get; set; } = EnumRequestStatus.New; + public string OnTheWayLocationCode { get; set; } + + #endregion /// - /// ERP储位 + /// 申请单件码 /// - [Display(Name = "ERP储位")] - public string ToLocationErpCode { get; set; } + public string SingleCodeRequest { get; set; } /// - /// 已发数量 + /// 已发数量 /// - [Display(Name = "已发数量")] public decimal IssuedQty { get; set; } /// - /// 已收数量 + /// 已收数量 /// - [Display(Name = "已收数量")] public decimal ReceivedQty { get; set; } - /// - /// 位置码 + /// 箱码 /// - public string PositionCode { get; set; } + public string PackingCode { get; set; } /// - /// 推荐类型 + /// 批次 /// - public EnumRecommendType RecommendType { get; set; } + public string Lot { get; set; } + /// + /// 过期时间 + /// + public DateTime ExpiredTime { get; set; } + /// + /// 库位状态 + /// + public EnumInventoryStatus EnumInventoryStatus { get; set; } + + /// + /// 请求未收 + /// + [NotMapped] + public decimal NotFinishQty => IssuedQty - ReceivedQty; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestEditInput.cs index 57b2978e9..209e19f4e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ThirdLocationRequests/Inputs/ThirdLocationRequestEditInput.cs @@ -6,41 +6,15 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ThirdLocationRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase { - #region Base - - /// - /// 申请单件码 - /// - [Display(Name = "生产线")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string SingleCodeRequest { get; set; } - - /// - /// 使用在途库 - /// - [Display(Name = "使用在途库")] - public bool UseOnTheWayLocation { get; set; } - #endregion - - #region Create - /// - /// 要货单号 - /// - [Display(Name = "要货单号")] - [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] - public string Number { get; set; } - /// - /// 叫料类型 + /// 三方库申请类型 /// - [Display(Name = "叫料类型")] + [Display(Name = "三方库申请类型")] public string Type { get; set; } - /// /// 明细列表 /// [Display(Name = "明细列表")] public List Details { get; set; } = new List(); - #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs index 42cf848e8..941bde049 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; +using IdentityServer4.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -12,10 +14,13 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain.Shared; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; +using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -29,12 +34,264 @@ public class ThirdLocationJobAppService IThirdLocationJobAppService { private readonly IThirdLocationJobManager _thirdLocationJobManager; + private readonly ITransferLogAppService _transferLogAppService; + private readonly ILocationAppService _locationAppService; + private readonly IThirdLocationNoteAppService _thirdLocationNoteAppService; + + protected IThirdLocationRequestAppService ThirdLocationRequestAppService => + LazyServiceProvider.LazyGetRequiredService(); public ThirdLocationJobAppService( - IThirdLocationJobRepository repository, IThirdLocationJobManager thirdLocationJobManager - ) : base(repository, thirdLocationJobManager) + IThirdLocationJobRepository repository, IThirdLocationJobManager thirdLocationJobManager, + ITransferLogAppService transferLogAppService, ILocationAppService locationAppService, IThirdLocationNoteAppService thirdLocationNoteAppService) : base(repository, thirdLocationJobManager) { _thirdLocationJobManager = thirdLocationJobManager; + _transferLogAppService = transferLogAppService; + _locationAppService = locationAppService; + _thirdLocationNoteAppService = thirdLocationNoteAppService; + } + + [HttpPost("")] + public override async Task CreateAsync(ThirdLocationJobEditInput input) + { + input.JobStatus = EnumJobStatus.Open; + var result = await base.CreateAsync(input).ConfigureAwait(false); + + var buildTransferLogsAsync = await BuildTransferLogsByToTransportAsync(result).ConfigureAwait(false); + + await AddTransferLogsAsync(buildTransferLogsAsync).ConfigureAwait(false); + + return result; + } + + [HttpPost("add-many")] + public override async Task> CreateManyAsync(List inputs) + { + var thirdLocationJobDtos = new List(); + + foreach (var input in inputs) + { + thirdLocationJobDtos.Add(await CreateAsync(input).ConfigureAwait(false)); + } + + return thirdLocationJobDtos; + } + + /// + /// 执行任务明细 + /// + /// + [HttpPost("ExecuteDetail/{masterId}")] + public async Task ExecuteDetailAsync(Guid masterId,List detailDtoList) + { + var thirdLocationJob=await _repository.GetAsync(masterId).ConfigureAwait(false); + thirdLocationJob.JobStatus = EnumJobStatus.Partial; + + var tempDetailDto= new List(); + var entityList=ObjectMapper.Map, List>(thirdLocationJob.Details); + foreach (var detailDto in detailDtoList)//为了不用DTO的赋值 + { + var jobDetailDto=entityList.First(p => p.Id == detailDto.Id); + jobDetailDto.HandledQty = detailDto.HandledQty; + jobDetailDto.RecommendQty = detailDto.RecommendQty; + tempDetailDto.Add(jobDetailDto); + + thirdLocationJob.Details.First(p => p.Id == detailDto.Id).ReceivedQty += detailDto.HandledQty; + } + + var transferLogs = await BuildTransferLogsByFromTransportAsync(thirdLocationJob, tempDetailDto).ConfigureAwait(false); + await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + + var jobDto=await GetAsync(masterId).ConfigureAwait(false); + var tempDetailDtos = new List(); + foreach (var detailDto in detailDtoList) + { + var temp=jobDto.Details.First(p => p.Id == detailDto.Id); + temp.HandledQty=detailDto.HandledQty; + temp.RecommendQty = detailDto.RecommendQty; + tempDetailDtos.Add(temp); + } + + jobDto.Details = tempDetailDtos; + + var input =await BuildThirdLocationNoteAsync(jobDto).ConfigureAwait(false); + var noteDto = await _thirdLocationNoteAppService.CreateByNumberAsync(input).ConfigureAwait(false); + + await UpdateJobStatusAsync(thirdLocationJob).ConfigureAwait(false); + + await _repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + } + + /// + /// 完成任务 + /// + /// + /// + [HttpPost("Complete/{id}")] + public async Task CompleteAsync(Guid id) + { + var kittingIssueJob = await _repository.FindAsync(id).ConfigureAwait(false); + + kittingIssueJob.JobStatus = EnumJobStatus.Done; + + var entity=await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false); + + var dto=ObjectMapper.Map(entity); + + var transferLogEditInputs=await BuildTransferLogsByBackFromAsync(dto).ConfigureAwait(false); + + await AddTransferLogsAsync(transferLogEditInputs).ConfigureAwait(false); + + await ThirdLocationRequestAppService.UpdateRequestStatusAsync(kittingIssueJob.RequestNumber).ConfigureAwait(false); + } + + [HttpPost("Get-By-Request-Number")] + public async Task> GetByRequestNumberAsync(string requestNumber) + { + var list=await _repository.GetListAsync(p => p.RequestNumber == requestNumber).ConfigureAwait(false); + return ObjectMapper.Map, List>(list); + } + + #region 私有 + + private async Task UpdateJobStatusAsync(ThirdLocationJob thirdLocationJob) + { + var flag = true; + foreach (var detail in thirdLocationJob.Details) + { + if (detail.IssuedQty > detail.ReceivedQty) + { + flag = false; + break; + } + } + if (flag) + { + thirdLocationJob.JobStatus = EnumJobStatus.Done; + } + + await _repository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); + await ThirdLocationRequestAppService.UpdateRequestStatusAsync(thirdLocationJob.RequestNumber).ConfigureAwait(false); + await Task.CompletedTask.ConfigureAwait(false); + } + + private async Task AddTransferLogsAsync(List inputList) + { + var transferLogs = new List(); + + transferLogs.AddRange(inputList); + + await _transferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } + + private async Task BuildThirdLocationNoteAsync(ThirdLocationJobDTO jobDto) + { + await Task.CompletedTask.ConfigureAwait(false); + + return ObjectMapper.Map(jobDto); + } + + /// + /// 创建库移 从from到在途 + /// + /// + /// + private async Task> BuildTransferLogsByToTransportAsync(ThirdLocationJobDTO dto) + { + //获取在途库 + var transportLocation =await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + var transferLog = new List(); + foreach (var detailDto in dto.Details) + { + var transferLogEditInput = ObjectMapper.Map(detailDto); + transferLogEditInput.TransType = EnumTransType.Transfer; + transferLogEditInput.DocNumber = dto.Number; + transferLogEditInput.JobNumber = dto.Number; + transferLogEditInput.Remark = $"目标库位:{detailDto.ToLocationCode.Clone()}"; + transferLogEditInput.ToLocationCode = transportLocation.Code; + transferLogEditInput.ToLocationErpCode = transportLocation.ErpLocationCode; + transferLogEditInput.ToLocationArea = transportLocation.AreaCode; + transferLogEditInput.ToLocationGroup = transportLocation.LocationGroupCode; + transferLogEditInput.ToWarehouseCode = transportLocation.WarehouseCode; + + transferLog.Add(transferLogEditInput); + } + + await Task.CompletedTask.ConfigureAwait(false); + + return transferLog; + } + + /// + /// 创建库移 从在途到To + /// + /// + /// + /// + private async Task> BuildTransferLogsByFromTransportAsync(ThirdLocationJob entity, List detailDtos) + { + //获取在途库 + var transportLocation =await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + var transferLog = new List(); + foreach (var detail in entity.Details) + { + var transferLogEditInput = ObjectMapper.Map(detail); + transferLogEditInput.TransType = EnumTransType.Transfer; + transferLogEditInput.DocNumber = entity.Number; + transferLogEditInput.JobNumber = entity.Number; + transferLogEditInput.Remark = $"来源库位:{detail.FromLocationCode.Clone()}"; + transferLogEditInput.FromLocationCode = transportLocation.Code; + transferLogEditInput.FromLocationErpCode = transportLocation.ErpLocationCode; + transferLogEditInput.FromLocationArea = transportLocation.AreaCode; + transferLogEditInput.FromLocationGroup = transportLocation.LocationGroupCode; + transferLogEditInput.FromWarehouseCode = transportLocation.WarehouseCode; + transferLogEditInput.Qty = detailDtos.First(p => p.Id == detail.Id).HandledQty; + + transferLog.Add(transferLogEditInput); + } + + await Task.CompletedTask.ConfigureAwait(false); + + return transferLog; + } + + + private async Task> BuildTransferLogsByBackFromAsync(ThirdLocationJobDTO dto) + { + //获取在途库 + var transportLocation = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + var transferLog = new List(); + foreach (var detailDto in dto.Details) + { + var transferLogEditInput = ObjectMapper.Map(detailDto); + transferLogEditInput.TransType = EnumTransType.Transfer; + transferLogEditInput.DocNumber = dto.Number; + transferLogEditInput.JobNumber = dto.Number; + + transferLogEditInput.FromLocationCode = transportLocation.Code; + transferLogEditInput.FromLocationErpCode = transportLocation.ErpLocationCode; + transferLogEditInput.FromLocationArea = transportLocation.AreaCode; + transferLogEditInput.FromLocationGroup = transportLocation.LocationGroupCode; + transferLogEditInput.FromWarehouseCode = transportLocation.WarehouseCode; + + transferLogEditInput.ToLocationCode = detailDto.FromLocationCode; + transferLogEditInput.ToLocationErpCode = detailDto.FromLocationErpCode; + transferLogEditInput.ToLocationArea = detailDto.FromLocationArea; + transferLogEditInput.ToLocationGroup = detailDto.FromLocationGroup; + transferLogEditInput.ToWarehouseCode = detailDto.ToWarehouseCode; + + transferLogEditInput.Qty = detailDto.IssuedQty - detailDto.ReceivedQty; + + transferLog.Add(transferLogEditInput); + } + + await Task.CompletedTask.ConfigureAwait(false); + + return transferLog; } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ThirdLocationNotes/ThirdLocationNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ThirdLocationNotes/ThirdLocationNoteAppService.cs index c746455d6..a3b83c547 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ThirdLocationNotes/ThirdLocationNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ThirdLocationNotes/ThirdLocationNoteAppService.cs @@ -9,7 +9,9 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -33,4 +35,25 @@ public class ThirdLocationNoteAppService : { _thirdLocationNoteManager = thirdLocationNoteManager; } + + /// + /// 创建 同时 直接赋值Number 为了返回Number + /// + /// + /// + [HttpPost("Create-By-Number")] + public virtual async Task CreateByNumberAsync(ThirdLocationNoteEditInput input) + { + var entity=ObjectMapper.Map(input); + + var number = string.IsNullOrEmpty(entity.Number) + ? await GenerateNumberAsync(nameof(AssembleIssueRequest), entity.ActiveDate).ConfigureAwait(false) + : entity.Number; + entity.SetIdAndNumberWithDetails(GuidGenerator, number); + await _repository.InsertAsync(entity, true).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(entity), false) + .ConfigureAwait(false); + + return entity; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs index 0d74a5c9d..13aae9191 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using Castle.Components.DictionaryAdapter; using DocumentFormat.OpenXml.Office.PowerPoint.Y2021.M06.Main; using DocumentFormat.OpenXml.Vml.Office; using IdentityModel; @@ -40,49 +41,177 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase CreateAsync(ThirdLocationRequestEditInput input) + { + foreach (var detailInput in input.Details) + { + var transportLocationDto = await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + var fromLocationDto=await _locationAppService.GetByCodeAsync(detailInput.FromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detailInput.FromLocationCode).ConfigureAwait(false); + var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false); + + detailInput.OnTheWayLocationCode = transportLocationDto.Code; + + if (fromLocationDto == null) + { + throw new UserFriendlyException($"库位【{detailInput.FromLocationCode}】不存在"); + } + if (toLocationDto == null) + { + throw new UserFriendlyException($"库位【{detailInput.ToLocationCode}】不存在"); + } + if (itemBasicDto == null) + { + throw new UserFriendlyException($"ERP料号【{detailInput.ItemCode}】不存在"); + } + + detailInput.FromLocationArea = fromLocationDto.AreaCode; + detailInput.FromLocationErpCode = fromLocationDto.ErpLocationCode; + detailInput.FromWarehouseCode= fromLocationDto.WarehouseCode; + detailInput.FromLocationGroup = fromLocationDto.LocationGroupCode; + + detailInput.ToLocationArea = toLocationDto.AreaCode; + detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; + detailInput.ToWarehouseCode = toLocationDto.WarehouseCode; + detailInput.ToLocationGroup = toLocationDto.LocationGroupCode; + + detailInput.ItemName = itemBasicDto.Name; + detailInput.ItemDesc1 = itemBasicDto.Name; + detailInput.ItemDesc2= itemBasicDto.Name; + + var balanceDto = await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detailInput.PackingCode, detailInput.ItemCode, detailInput.FromLocationCode, detailInput.EnumInventoryStatus, detailInput.Lot).ConfigureAwait(false); + if (balanceDto == null || balanceDto.Qty <= 0) + { + throw new UserFriendlyException($"ERP料号【{detailInput.ItemCode}】,箱码【{detailInput.PackingCode}】,批次【{detailInput.Lot}】,库位【{detailInput.FromLocationCode}】,状态【{detailInput.EnumInventoryStatus}】的库存,可用余额为【{balanceDto.Qty}】,无法使用。"); + } + + detailInput.ExpiredTime = balanceDto.ExpireDate; + detailInput.StdPackQty=balanceDto.StdPackQty; + detailInput.Uom=balanceDto.Uom; + detailInput.EnumInventoryStatus = balanceDto.Status; + } + + var entity = ObjectMapper.Map(input); + var result =await _thirdLocationRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false); + var requestDto = ObjectMapper.Map(result); + + var thirdLocationJobAsync=await BuildThirdLocationJobAsync(requestDto).ConfigureAwait(false); + + await _thirdLocationJobAppService.CreateManyAsync(thirdLocationJobAsync).ConfigureAwait(false); + + return requestDto; } + + [HttpPost("Update-Request-Status")] + public async Task UpdateRequestStatusAsync(string requestNumber) + { + var thirdLocationRequest=await _repository.GetAsync(p=>p.Number==requestNumber).ConfigureAwait(false); + var jobDtos=await _thirdLocationJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false); + var noFinsh=jobDtos.Any(p => p.JobStatus == EnumJobStatus.Open || + p.JobStatus == EnumJobStatus.Doing || + p.JobStatus == EnumJobStatus.Wait || + p.JobStatus == EnumJobStatus.Partial); + if (noFinsh==false) + { + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; + await _repository.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + } + } + + public override async Task CompleteAsync(Guid id) + { + var thirdLocationRequest = await _repository.GetAsync(id).ConfigureAwait(false); + if (thirdLocationRequest.RequestStatus == EnumRequestStatus.Handling || + thirdLocationRequest.RequestStatus == EnumRequestStatus.Partial || + thirdLocationRequest.RequestStatus == EnumRequestStatus.New) + { + thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed; + } + else + { + throw new UserFriendlyException($"【{thirdLocationRequest.RequestStatus.GetDisplayName()}】状态不允许完成"); + } + + + var jobDtos=await _thirdLocationJobAppService.GetByRequestNumberAsync(thirdLocationRequest.Number).ConfigureAwait(false); + foreach (var job in jobDtos) + { + await _thirdLocationJobAppService.CompleteAsync(job.Id).ConfigureAwait(false); + } + + var entity=await _repository.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + + return ObjectMapper.Map(entity); + } + + public override async Task CancelAsync(Guid id) + { + var thirdLocationRequest = await _repository.GetAsync(id).ConfigureAwait(false); + if (thirdLocationRequest.RequestStatus == EnumRequestStatus.Handling || + thirdLocationRequest.RequestStatus == EnumRequestStatus.Partial || + thirdLocationRequest.RequestStatus == EnumRequestStatus.New) + { + thirdLocationRequest.RequestStatus = EnumRequestStatus.Cancelled; + } + else + { + throw new UserFriendlyException($"【{thirdLocationRequest.RequestStatus.GetDisplayName()}】状态不允许取消"); + } + + await _thirdLocationJobAppService.CompleteAsync(thirdLocationRequest.Id).ConfigureAwait(false); + var entity = await _repository.UpdateAsync(thirdLocationRequest).ConfigureAwait(false); + + return ObjectMapper.Map(entity); + } + + #region 私有 + private async Task> BuildThirdLocationJobAsync(ThirdLocationRequestDTO requestDto) + { + var inputsDict = new Dictionary(); + var groupBy = requestDto.Details.GroupBy(p => p.ItemCode); + var thirdLocationJobEditInputs = new List(); + + foreach (var itemCodeGroupBy in groupBy) + { + var list = itemCodeGroupBy.ToList();//当前零件所有的集合 + + var mastEditInput = ObjectMapper.Map(requestDto); + mastEditInput.Details = new List(); + mastEditInput.Worker = requestDto.Worker; + mastEditInput.WarehouseCode = list.First().ToWarehouseCode; + + var tempJobDetailInputs = ObjectMapper.Map, List>(list); + tempJobDetailInputs.ForEach(p => + { + p.IssuedQty = p.RecommendQty; + p.IssueTime = DateTime.Now; + }); + mastEditInput.Details = tempJobDetailInputs; + + thirdLocationJobEditInputs.Add(mastEditInput); + } + + await Task.CompletedTask.ConfigureAwait(false); + + return thirdLocationJobEditInputs; + } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAutoMapperProfile.cs index 657c21eee..09d997b29 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAutoMapperProfile.cs @@ -1,6 +1,7 @@ using AutoMapper; using Volo.Abp.AutoMapper; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -18,10 +19,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() - .Ignore(x => x.ToLocationArea) - .Ignore(x => x.IssuedQty) - .Ignore(x => x.ToLocationGroup) - .Ignore(x => x.ToWarehouseCode) .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) @@ -64,5 +61,59 @@ public partial class StoreApplicationAutoMapperProfile : Profile .IgnoreAuditedObjectProperties() .Ignore(x => x.RequestStatus) .Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id); + + CreateMap() + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.TransSubType) + + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledQty)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.ExpiredTime)) + + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledContainerCode)) + + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledLot)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledLot)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledPackingCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledContainerCode)) + ; + + CreateMap() + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.TransSubType) + + .ForMember(x => x.Qty, y => y.MapFrom(t => t.HandledQty)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(t => t.HandledSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(t => t.HandledArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(t => t.HandledProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(t => t.ExpiredTime)) + + .ForMember(x => x.FromPackingCode, y => y.MapFrom(t => t.HandledPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(t => t.HandledContainerCode)) + + .ForMember(x => x.FromLot, y => y.MapFrom(t => t.HandledLot)) + .ForMember(x => x.FromStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.ToLot, y => y.MapFrom(t => t.HandledLot)) + .ForMember(x => x.ToStatus, y => y.MapFrom(t => t.Status)) + + .ForMember(x => x.ToPackingCode, y => y.MapFrom(t => t.HandledPackingCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(t => t.HandledContainerCode)) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/IThirdLocationRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/IThirdLocationRequestManager.cs index 02b71010a..61875635a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/IThirdLocationRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/IThirdLocationRequestManager.cs @@ -7,5 +7,10 @@ using Win_in.Sfs.Shared.Domain; public interface IThirdLocationRequestManager : ISfsStoreRequestManager, IBulkImportService { - + /// + /// ͬʱ ֱӸֵNumber Ϊ˷Number + /// + /// + /// + Task CreateByNumberAsync(ThirdLocationRequest entity); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs index dd04c88bc..ce5dbbc8d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ThirdLocationRequests/ThirdLocationRequestManager.cs @@ -29,4 +29,25 @@ public class ThirdLocationRequestManager { throw new NotImplementedException(); } + + /// + /// 创建 同时 直接赋值Number 为了返回Number + /// + /// + /// + public virtual async Task CreateByNumberAsync(ThirdLocationRequest entity) + { + var number = string.IsNullOrEmpty(entity.Number) + ? await GenerateNumberAsync(nameof(ThirdLocationRequest), entity.ActiveDate).ConfigureAwait(false) + : entity.Number; + entity.SetIdAndNumberWithDetails(GuidGenerator, number); + entity.Submit(); + entity.Agree(); + entity.RequestStatus = EnumRequestStatus.Partial; + await _repository.InsertAsync(entity, true).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false) + .ConfigureAwait(false); + + return entity; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs index c2b532e1f..2dee1d1c4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ThirdLocationJobAutoMapperProfile.cs @@ -17,6 +17,8 @@ public partial class StoreEventAutoMapperProfile : Profile .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.RequestNumber)) .ForMember(x => x.ActiveDate, y => y.MapFrom(d => DateTime.Now)) .ForMember(x => x.Worker, y => y.MapFrom(d => d.CompleteUserName)) + .Ignore(x => x.IssueTime) + .Ignore(x => x.ReceiptTime) .Ignore(x => x.Number); CreateMap() @@ -60,9 +62,22 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.RequestNumber)) + .ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number)) + .Ignore(x => x.Confirmed) + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Workshop) + .Ignore(x => x.RequestType) + .Ignore(x => x.UseOnTheWayLocation) + ; + + CreateMap() + .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.RequestNumber)) + .ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number)) .Ignore(x => x.Confirmed) - .Ignore(x => x.JobNumber) .Ignore(x => x.ActiveDate) + .Ignore(x => x.Workshop) + .Ignore(x => x.RequestType) + .Ignore(x => x.UseOnTheWayLocation) ; CreateMap() .ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) @@ -85,6 +100,35 @@ public partial class StoreEventAutoMapperProfile : Profile .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) .ForMember(x => x.SingleCodeRequest, y => y.MapFrom(d => d.SingleCodeRequest)) + .Ignore(x => x.SingleCodeJob) + .Ignore(x => x.RecommendType) + .Ignore(x => x.PositionCode) + ; + + CreateMap() + .ForMember(x => x.Qty, y => y.MapFrom(d => d.HandledQty)) + .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) + .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) + .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.HandledPackingCode)) + .ForMember(x => x.FromContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) + .ForMember(x => x.ToContainerCode, y => y.MapFrom(d => d.HandledContainerCode)) + .ForMember(x => x.FromLot, y => y.MapFrom(d => d.HandledLot)) + .ForMember(x => x.ToLot, y => y.MapFrom(d => d.HandledLot)) + .ForMember(x => x.SupplierBatch, y => y.MapFrom(d => d.HandledSupplierBatch)) + .ForMember(x => x.ArriveDate, y => y.MapFrom(d => d.HandledArriveDate)) + .ForMember(x => x.ProduceDate, y => y.MapFrom(d => d.HandledProduceDate)) + .ForMember(x => x.ExpireDate, y => y.MapFrom(d => d.ExpiredTime)) + .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.FromLocationArea, y => y.MapFrom(d => d.FromLocationArea)) + .ForMember(x => x.FromLocationGroup, y => y.MapFrom(d => d.HandledFromLocationGroup)) + .ForMember(x => x.FromLocationErpCode, y => y.MapFrom(d => d.HandledFromLocationErpCode)) + .ForMember(x => x.FromWarehouseCode, y => y.MapFrom(d => d.HandledFromWarehouseCode)) + .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) + .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) + .ForMember(x => x.SingleCodeRequest, y => y.MapFrom(d => d.SingleCodeRequest)) + .Ignore(x => x.SingleCodeJob) + .Ignore(x => x.RecommendType) + .Ignore(x => x.PositionCode) ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/ThirdLocationNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/ThirdLocationNoteAutoMapperProfile.cs index 2196ffd10..3684d545a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/ThirdLocationNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/ThirdLocationNoteAutoMapperProfile.cs @@ -25,6 +25,9 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.CallBusinessType) .Ignore(x => x.CallRequestNumber) .Ignore(x => x.CallJobNumber) + .Ignore(x => x.UseOnTheWayLocation) + .Ignore(x => x.Confirmed) + .Ignore(x => x.ConfirmTime) ; CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs index 1ed9f4fe5..7d5596c11 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ThirdLocationRequestAutoMapperProfile.cs @@ -1,6 +1,8 @@ +using System; using AutoMapper; using Volo.Abp.AutoMapper; using Win_in.Sfs.Shared.Application; +using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -35,7 +37,7 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.ToContainerCode) ; - CreateMap() + CreateMap() .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) .ForMember(x => x.RequestType, y => y.MapFrom(d => d.Type)) .Ignore(x => x.SingleCodeJob) @@ -57,27 +59,21 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.CompleteUserName) .Ignore(x => x.CompleteTime) .Ignore(x => x.Details) + .Ignore(x => x.UseOnTheWayLocation) ; CreateMap() .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode)) .ForMember(x => x.SingleCodeRequest, y => y.MapFrom(d => d.SingleCodeRequest)) - .Ignore(x => x.SingleCodeJob) + .ForMember(x => x.IsOnTheWayLocationCode, y => y.MapFrom(d => true)) + .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) .Ignore(x => x.RecommendFromLocationArea) .Ignore(x => x.RecommendFromLocationGroup) .Ignore(x => x.HandledFromLocationArea) .Ignore(x => x.HandledFromLocationGroup) .Ignore(x => x.RecommendFromWarehouseCode) .Ignore(x => x.HandledFromWarehouseCode) - .Ignore(x => x.OnTheWayLocationCode) - .Ignore(x => x.DistributionType) - .Ignore(x => x.RoundedQty) - .Ignore(x => x.Operation) .Ignore(x => x.ExpiredTime) - .Ignore(x => x.TruncType) - .Ignore(x => x.PlanBeginTime) - .Ignore(x => x.PlannedSplitRule) - .Ignore(x => x.DeliveryQty) .Ignore(x => x.Status) .Ignore(x => x.RecommendContainerCode) .Ignore(x => x.RecommendPackingCode) @@ -103,6 +99,49 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.RecommendLot) .IgnoreIHasRecommendAndHandledFrom(); + CreateMap() + .ForMember(x => x.FromLocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.SingleCodeRequest, y => y.MapFrom(d => d.SingleCodeRequest)) + .ForMember(x => x.IsOnTheWayLocationCode, y => y.MapFrom(d => true)) + .ForMember(x => x.IssueTime, y => y.MapFrom(d => DateTime.Now)) + .ForMember(x => x.Uom, y => y.MapFrom(d => d.Uom)) + .ForMember(x => x.IssuedQty, y => y.MapFrom(d => 0)) + .ForMember(x => x.NotFinishQty, y => y.MapFrom(d => 0)) + .ForMember(x => x.ReceivedQty, y => y.MapFrom(d => 0)) + + .ForMember(x => x.RecommendFromLocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.RecommendFromLocationGroup, y => y.MapFrom(d => d.FromLocationGroup)) + .ForMember(x => x.RecommendFromLocationArea, y => y.MapFrom(d => d.FromLocationArea)) + .ForMember(x => x.RecommendFromLocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode)) + .ForMember(x => x.RecommendFromWarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode)) + + .ForMember(x => x.HandledFromLocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.HandledFromLocationGroup, y => y.MapFrom(d => d.FromLocationGroup)) + .ForMember(x => x.HandledFromLocationArea, y => y.MapFrom(d => d.FromLocationArea)) + .ForMember(x => x.HandledFromLocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode)) + .ForMember(x => x.HandledFromWarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode)) + + .ForMember(x => x.RecommendPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.RecommendLot, y => y.MapFrom(d => d.Lot)) + .ForMember(x => x.RecommendProduceDate, y => y.MapFrom(d => DateTime.MinValue)) + .ForMember(x => x.RecommendContainerCode, y => y.MapFrom(d => string.Empty)) + .ForMember(x => x.RecommendExpireDate, y => y.MapFrom(d => d.ExpiredTime)) + .ForMember(x => x.RecommendSupplierBatch, y => y.MapFrom(d => string.Empty)) + .ForMember(x => x.RecommendQty, y => y.MapFrom(d => d.Qty)) + .ForMember(x => x.RecommendArriveDate, y => y.MapFrom(d => DateTime.MinValue)) + + .ForMember(x => x.HandledPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.HandledLot, y => y.MapFrom(d => d.Lot)) + .ForMember(x => x.HandledProduceDate, y => y.MapFrom(d => DateTime.MinValue)) + .ForMember(x => x.HandledContainerCode, y => y.MapFrom(d => string.Empty)) + .ForMember(x => x.HandledExpireDate, y => y.MapFrom(d => d.ExpiredTime)) + .ForMember(x => x.HandledSupplierBatch, y => y.MapFrom(d => string.Empty)) + .ForMember(x => x.HandledQty, y => y.MapFrom(d => d.Qty)) + .ForMember(x => x.HandledArriveDate, y => y.MapFrom(d => DateTime.MinValue)) + .ForMember(x => x.HandledUom, y => y.MapFrom(d => d.Uom)) + .ForMember(x => x.Status, y => y.MapFrom(d => d.EnumInventoryStatus)) + ; + CreateMap() .ForMember(x => x.RecommendArriveDate, y => y.MapFrom(d => d.ArriveDate)) .ForMember(x => x.RecommendContainerCode, y => y.MapFrom(d => d.ContainerCode)) @@ -127,7 +166,6 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.HandledFromWarehouseCode) .Ignore(x => x.FromLocationCode) .Ignore(x => x.ToLocationCode) - .Ignore(x => x.SingleCodeJob) .Ignore(x => x.SingleCodeRequest) .Ignore(x => x.HandledContainerCode) .Ignore(x => x.HandledExpireDate) @@ -141,21 +179,21 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.HandledUom) .Ignore(x => x.Remark) .Ignore(x => x.OnTheWayLocationCode) - .Ignore(x => x.DistributionType) - .Ignore(x => x.RoundedQty) - .Ignore(x => x.Operation) .Ignore(x => x.ExpiredTime) - .Ignore(x => x.TruncType) - .Ignore(x => x.PlanBeginTime) - .Ignore(x => x.PlannedSplitRule) - .Ignore(x => x.DeliveryQty) .Ignore(x => x.FromLocationCode) .Ignore(x => x.ToLocationCode) - .Ignore(x => x.SingleCodeJob) .Ignore(x => x.SingleCodeRequest) - .Ignore(x => x.PositionCode) - .Ignore(x => x.RecommendType) .Ignore(x => x.FromLocationArea) + .Ignore(x=>x.IssueTime) + .Ignore(x=>x.IsOnTheWayLocationCode) + + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.IssuedQty) + .Ignore(x => x.ReceivedQty) + .Ignore(x => x.EnumInventoryStatus) + .IgnoreIHasRecommendAndHandledFrom(); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs index 04bcf9e6e..f6358cc17 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Quartz.Simpl; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs index 2ef2db1cd..abf93fb30 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ThirdLocationJobEventHandler.cs @@ -35,18 +35,18 @@ public class ThirdLocationJobEventHandler : _thirdLocationJobRepository = thirdLocationJobRepository; } - public Task HandleEventAsync(SfsCompletedEntityEventData eventData) + public async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCancelledEntityEventData eventData) + public async Task HandleEventAsync(SfsCancelledEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsClosedEntityEventData eventData) + public async Task HandleEventAsync(SfsClosedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs index 25a0d9a72..deb0ac59c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ThirdLocationRequestEventHandler.cs @@ -55,33 +55,33 @@ public class ThirdLocationRequestEventHandler _transferLogAppService = transferLogAppService; } - public Task HandleEventAsync(SfsHandledEntityEventData eventData) + public async Task HandleEventAsync(SfsHandledEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsAbortedEntityEventData eventData) + public async Task HandleEventAsync(SfsAbortedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCompletedEntityEventData eventData) + public async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCreatedEntityEventData eventData) + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCancelledEntityEventData eventData) + public async Task HandleEventAsync(SfsCancelledEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs index cb126c2a2..c4c37ef02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ThirdLocationNoteEventHandler.cs @@ -31,18 +31,18 @@ public class ThirdLocationNoteEventHandler _ThirdLocationRequestRepository = ThirdLocationRequestRepository; } - public Task HandleEventAsync(SfsCreatedEntityEventData eventData) + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } - public Task HandleEventAsync(SfsConfirmedEntityEventData eventData) + public async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) { - throw new NotImplementedException(); + await Task.CompletedTask.ConfigureAwait(false); } } diff --git a/build/src/docker/publish/conf/settings/appsettings.Development.json b/build/src/docker/publish/conf/settings/appsettings.Development.json index ec97ab563..c74d5217b 100644 --- a/build/src/docker/publish/conf/settings/appsettings.Development.json +++ b/build/src/docker/publish/conf/settings/appsettings.Development.json @@ -133,8 +133,8 @@ //"BaseUrl": "http://localhost:59093/" }, "BaseData": { - //"BaseUrl": "http://dev.ccwin-in.com:60084/" - "BaseUrl": "http://localhost:59094/" + "BaseUrl": "http://dev.ccwin-in.com:60084/" + //"BaseUrl": "http://localhost:59094/" }, "Default": { "BaseUrl": "http://dev.ccwin-in.com:60083/"