From 24d0b060842426436a438d7471dd4e4b80775df5 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Tue, 12 Mar 2024 13:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E7=AE=B1=E6=B6=89=E5=8F=8AexpectOut?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commons/SplitPacking_UpdateDetailInput.cs | 40 +++++++++++++++++++ .../ExpectOuts/IExpectOutAppService.cs | 8 ++++ .../ExpectOuts/ExpectOutAppService.cs | 34 ++++++++++++++++ .../TransferNotes/TransferNoteAppService.cs | 23 ++++++++++- 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/Commons/SplitPacking_UpdateDetailInput.cs diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/Commons/SplitPacking_UpdateDetailInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/Commons/SplitPacking_UpdateDetailInput.cs new file mode 100644 index 000000000..9b47d3434 --- /dev/null +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/SplitPackings/Commons/SplitPacking_UpdateDetailInput.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Basedata.SplitPackings.Commons; +public class SplitPacking_UpdateDetailInput +{ + /// + /// 主表number + /// + [Required(ErrorMessage = "{0}是必填项")] + public string Number { get; set; } + /// + /// 子表from标签 + /// + [Required(ErrorMessage = "{0}是必填项")] + public string FromPackingCode { get; set; } + /// + /// from数量 + /// + [Required(ErrorMessage = "{0}是必填项")] + [Range(1, 99999, ErrorMessage = "{0}值范围在1至99999之间")] + public decimal FromQty { get; set; } + /// + /// 子表的to标签 + /// + [Required(ErrorMessage = "{0}是必填项")] + public string ToPackingCode { get; set; } + /// + /// to数量 + /// + [Required(ErrorMessage = "{0}是必填项")] + [Range(1, 99999, ErrorMessage = "{0}值范围在1至99999之间")] + public decimal ToQty { get; set; } + + +} diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs index 6ce12eb30..1b293473d 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/ExpectOuts/IExpectOutAppService.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Threading.Tasks; +using Win_in.Sfs.Basedata.SplitPackings.Commons; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -29,4 +30,11 @@ public interface IExpectOutAppService string packingCode, EnumInventoryStatus enumInventoryStatus, string lot); + + /// + /// 保存拆箱时涉及的明细修改 + /// + /// + Task> SaveDetail_SplitPackingAsync(SplitPacking_UpdateDetailInput input); + } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs index 5125a0034..c1700e45d 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs @@ -6,6 +6,8 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Basedata.SplitPackings.Commons; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -179,4 +181,36 @@ public class ExpectOutAppService return ObjectMapper.Map, List>(entitys); } + + /// + /// 保存拆箱时涉及的明细修改 + /// + /// + [HttpPost("save-detail-split-packing")] + public virtual async Task> SaveDetail_SplitPackingAsync(SplitPacking_UpdateDetailInput input) + { + var obj = await _repository.FindAsync(p => p.JobNumber == input.Number && p.PackingCode == input.FromPackingCode && p.Qty == input.FromQty).ConfigureAwait(false); + if (obj == null) + { + return null; + } + + //插入目标箱 + var newObj = CommonHelper.CloneObj(obj); + newObj.SetId(GuidGenerator.Create()); + newObj.PackingCode = input.ToPackingCode; + newObj.Qty = input.ToQty; + var insRet = await _repository.InsertAsync(newObj).ConfigureAwait(false); + //修改源箱 + obj.Qty = input.FromQty - input.ToQty; + var updRet = await _repository.UpdateAsync(obj).ConfigureAwait(false); + List lst = new List(); + lst.Add(insRet); + lst.Add(updRet); + var ret = ObjectMapper.Map, List>(lst); + return ret; + } + + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index f2ee44369..3ee3eb757 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -10,6 +10,7 @@ using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Basedata.SplitPackings.Commons; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -38,6 +39,10 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase private readonly IInspectJobAppService _inspectJobAppService; //质检 private readonly IIssueJobAppService _issueJobAppService; //发料 + private readonly IExpectOutAppService _expectOutAppService; // + + + public TransferNoteAppService( @@ -49,7 +54,8 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase IPurchaseReceiptJobAppService purchaseReceiptJobAppService, IPurchaseReceiptRequestAppService purchaseReceiptRequestAppService, IInspectJobAppService inspectJobAppService, - IIssueJobAppService issueJobAppService) : base(repository) + IIssueJobAppService issueJobAppService, + IExpectOutAppService expectOutAppService) : base(repository) { _transferNoteManager = transferNoteManager; _balanceAppService = balanceAppService; @@ -59,6 +65,7 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase _purchaseReceiptRequestAppService = purchaseReceiptRequestAppService; _inspectJobAppService = inspectJobAppService; _issueJobAppService = issueJobAppService; + _expectOutAppService = expectOutAppService; } #region 东阳使用 @@ -438,6 +445,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase [HttpPost("split-packing-inspect")] public async Task SplitPacking_InspectAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) { + SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput(); + newInput.Number = updateJobDetailInput.Number; + newInput.FromPackingCode = updateJobDetailInput.FromPackingCode; + newInput.FromQty = updateJobDetailInput.FromQty; + newInput.ToPackingCode = updateJobDetailInput.ToPackingCode; + newInput.ToQty = updateJobDetailInput.ToQty; + var expectOutRet = await _expectOutAppService.SaveDetail_SplitPackingAsync(newInput).ConfigureAwait(false); var jobRet = await _inspectJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); var ret = await SplitPackingAsync(transferNoteEditInput).ConfigureAwait(false); //库存操作 return ret; @@ -452,6 +466,13 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase [HttpPost("split-packing-issue")] public async Task SplitPacking_IssueAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInput updateJobDetailInput) { + SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput(); + newInput.Number = updateJobDetailInput.Number; + newInput.FromPackingCode = updateJobDetailInput.FromPackingCode; + newInput.FromQty = updateJobDetailInput.FromQty; + newInput.ToPackingCode = updateJobDetailInput.ToPackingCode; + newInput.ToQty = updateJobDetailInput.ToQty; + var expectOutRet = await _expectOutAppService.SaveDetail_SplitPackingAsync(newInput).ConfigureAwait(false); var jobRet = await _issueJobAppService.SaveDetail_SplitPackingAsync(updateJobDetailInput).ConfigureAwait(false); var ret = await SplitPackingAsync(transferNoteEditInput).ConfigureAwait(false); //库存操作 return ret;