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 1b293473d..31ae65e93 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 @@ -37,4 +37,10 @@ public interface IExpectOutAppService /// Task> SaveDetail_SplitPackingAsync(SplitPacking_UpdateDetailInput input); + /// + /// 根据任务号、箱码、数量、库位取预计出列表 + /// + /// + Task> GetListByJobNumberAsync(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 67dbeb18a..fb64edbd3 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 @@ -189,12 +189,16 @@ public class ExpectOutAppService [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 && p.LocationCode == input.FromLocationCode).ConfigureAwait(false); - if (obj == null) + var lst = await ListByJobNumberAsync(input).ConfigureAwait(false); + if (lst == null || lst.Count == 0) { throw new UserFriendlyException($"预计出表没有数据:JobNumber={input.Number}|PackingCode={input.FromPackingCode}|Qty={input.FromQty}|LocationCode={input.FromLocationCode}"); } - + if (lst.Count > 1) + { + throw new UserFriendlyException($"预计出表取到多条数据,应该取到一条数据:JobNumber={input.Number}|PackingCode={input.FromPackingCode}|Qty={input.FromQty}|LocationCode={input.FromLocationCode}"); + } + var obj = lst[0]; //插入目标箱 var newObj = CommonHelper.CloneObj(obj); newObj.SetId(GuidGenerator.Create()); @@ -204,13 +208,28 @@ public class ExpectOutAppService //修改源箱 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); + List list = new List(); + list.Add(insRet); + list.Add(updRet); + var ret = ObjectMapper.Map, List>(list); return ret; } + /// + /// 根据任务号、箱码、数量、库位取预计出列表 + /// + /// + [HttpPost("get-list-by-job-number")] + public virtual async Task> GetListByJobNumberAsync(SplitPacking_UpdateDetailInput input) + { + var lst = await ListByJobNumberAsync(input).ConfigureAwait(false); + var ret = ObjectMapper.Map, List>(lst); + return ret; + } + private async Task> ListByJobNumberAsync(SplitPacking_UpdateDetailInput input) + { + return await _repository.GetListAsync(p => p.JobNumber == input.Number && p.PackingCode == input.FromPackingCode && p.Qty == input.FromQty && p.LocationCode == input.FromLocationCode).ConfigureAwait(false); + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/SplitPacking_UpdateJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/SplitPacking_UpdateJobDetailInput.cs index 61a8befe6..c7f3f321e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/SplitPacking_UpdateJobDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/SplitPacking_UpdateJobDetailInput.cs @@ -2,16 +2,20 @@ using System.ComponentModel.DataAnnotations; namespace Win_in.Sfs.Wms.Store.Application.Contracts; -/// -/// -/// -public class SplitPacking_UpdateJobDetailInput +public class SplitPacking_UpdateJobDetailInputBase { /// /// 主表number /// [Required(ErrorMessage = "{0}是必填项")] public string Number { get; set; } +} + + /// + /// + /// +public class SplitPacking_UpdateJobDetailInput : SplitPacking_UpdateJobDetailInputBase +{ /// /// 子表from标签 /// 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 18bf55a9e..2848d8650 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 @@ -445,15 +445,15 @@ 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; - newInput.FromLocationCode = transferNoteEditInput.Details[0].FromLocationCode; - newInput.ToLocationCode = transferNoteEditInput.Details[0].ToLocationCode; - var expectOutRet = await _expectOutAppService.SaveDetail_SplitPackingAsync(newInput).ConfigureAwait(false); + //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; + //newInput.FromLocationCode = transferNoteEditInput.Details[0].FromLocationCode; + //newInput.ToLocationCode = transferNoteEditInput.Details[0].ToLocationCode; + //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; @@ -482,9 +482,31 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase return ret; } + /// + /// 拆箱,预计出表存在数据时不允许办理 + /// + /// + /// + /// + [HttpPost("split-packing-check-expect-out")] + public async Task SplitPackingCheckExpectOutAsync(TransferNoteEditInput transferNoteEditInput, [FromQuery] SplitPacking_UpdateJobDetailInputBase updateJobDetailInputBase) + { + var detailObj = transferNoteEditInput.Details[0]; + SplitPacking_UpdateDetailInput newInput = new SplitPacking_UpdateDetailInput(); + newInput.Number = updateJobDetailInputBase.Number; + newInput.FromPackingCode = detailObj.FromPackingCode; + newInput.FromQty = detailObj.Qty; + newInput.ToPackingCode = detailObj.ToPackingCode; + newInput.ToQty = detailObj.Qty; + newInput.FromLocationCode = detailObj.FromLocationCode; + newInput.ToLocationCode = detailObj.ToLocationCode; + var expectOutLst = await _expectOutAppService.GetListByJobNumberAsync(newInput).ConfigureAwait(false); + if (expectOutLst.Count > 0) + { + throw new UserFriendlyException($"预计出表存在数据,不允许办理拆箱:JobNumber={newInput.Number}|PackingCode={newInput.FromPackingCode}|Qty={newInput.FromQty}|LocationCode={newInput.FromLocationCode}"); + } + var ret = await SplitPackingAsync(transferNoteEditInput).ConfigureAwait(false); + return ret; - - - - + } }