diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDTO.cs index 31c9b3196..452d45b64 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDTO.cs @@ -94,12 +94,6 @@ public class IntegrationPackingNoteDTO : SfsStoreDTOBase - /// 仓库代码 - /// - [Display(Name = "仓库代码")] - public string WarehouseCode { get; set; } - #endregion #region 标签信息 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDetailDTO.cs index 47fe43e7a..37d574d03 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/DTOs/IntegrationPackingNoteDetailDTO.cs @@ -93,12 +93,6 @@ public class IntegrationPackingNoteDetailDTO : SfsDetailDTOBase [Display(Name = "数量")] public decimal Qty { get; set; } - /// - /// 仓库代码 - /// - [Display(Name = "仓库代码")] - public string WarehouseCode { get; set; } - #endregion #region 标签信息 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteDetailInput.cs index 6e2dc6559..e42db5593 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteDetailInput.cs @@ -15,6 +15,12 @@ public class IntegrationPackingNoteDetailInput : SfsDetailInputBase [Display(Name = "单号")] public string Number { get; set; } + /// + /// 单号 + /// + [Display(Name = "单号")] + public string WarehouseCode { get; set; } + #region 物品基础信息 /// @@ -99,12 +105,6 @@ public class IntegrationPackingNoteDetailInput : SfsDetailInputBase [Display(Name = "数量")] public decimal Qty { get; set; } - /// - /// 仓库代码 - /// - [Display(Name = "仓库代码")] - public string WarehouseCode { get; set; } - #endregion #region 标签信息 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteEditInput.cs index 54dc56cbc..d3efb107f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteEditInput.cs @@ -98,12 +98,6 @@ public class IntegrationPackingNoteEditInput : SfsStoreCreateOrUpdateInputBase [Display(Name = "数量")] public decimal Qty { get; set; } - /// - /// 仓库代码 - /// - [Display(Name = "仓库代码")] - public string WarehouseCode { get; set; } - #endregion #region 标签信息 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteImportInput.cs index 31df822d6..2548927d0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/OperationPacking/IntegrationPackingNotes/Inputs/IntegrationPackingNoteImportInput.cs @@ -91,12 +91,6 @@ public class IntegrationPackingNoteImportInput : SfsStoreImportInputBase [Display(Name = "数量")] public decimal Qty { get; set; } - /// - /// 仓库代码 - /// - [Display(Name = "仓库代码")] - public string WarehouseCode { get; set; } - #endregion #region 标签信息 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/IntegrationPackingNotes/IntegrationPackingNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/IntegrationPackingNotes/IntegrationPackingNoteAppService.cs index 68fa0877e..f6706a754 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/IntegrationPackingNotes/IntegrationPackingNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/IntegrationPackingNotes/IntegrationPackingNoteAppService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -6,7 +7,9 @@ using IdentityServer4.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; +using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Guids; using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata; @@ -78,38 +81,47 @@ public class IntegrationPackingNoteAppService : throw new UserFriendlyException($"此物料已经被【任务编号:{outDtos.First().JobNumber}】占用"); } - var dto = await base.CreateAsync(input).ConfigureAwait(false); + var entity = input.ToObject(); + var number = await GenerateNumberAsync(nameof(IntegrationPackingNote), Clock.Now).ConfigureAwait(false); + entity.Number = number; + entity.SetId(GuidGenerator.Create()); + entity.SetIdAndNumberWithDetails(GuidGenerator, entity.Number); + entity.WarehouseCode = string.Empty; + entity.Details.ForEach(p=>p.WarehouseCode=string.Empty); + + entity = await _repository.InsertAsync(entity).ConfigureAwait(false); foreach (var detailInput in input.Details) { //库存移动 var transferLogEditInput = - await BuildTransferLogsAsync(dto, detailInput) + await BuildTransferLogsAsync(entity, detailInput) .ConfigureAwait(false); transferLogEditInputs.Add(transferLogEditInput); } await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false); + var dto = entity.ToObject(); return dto; } /// /// 构造 库存转移日志实体 /// - /// + /// /// /// private async Task BuildTransferLogsAsync( - IntegrationPackingNoteDTO dto, + IntegrationPackingNote entity, IntegrationPackingNoteDetailInput detailInput) { var fromLocationDto = await _locationAppService.GetByCodeAsync(detailInput.LocationCode).ConfigureAwait(false); - var toLocationDto = await _locationAppService.GetByCodeAsync(dto.LocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(entity.LocationCode).ConfigureAwait(false); var transferLogEditInput = new TransferLogEditInput { - Worker = dto.Worker, + Worker = entity.Worker, Qty = detailInput.Qty, ItemCode = detailInput.ItemCode, FromLocationCode = fromLocationDto.Code, @@ -122,25 +134,25 @@ public class IntegrationPackingNoteAppService : ToLocationArea = toLocationDto.AreaCode, ToLocationGroup = toLocationDto.LocationGroupCode, ToWarehouseCode = toLocationDto.WarehouseCode, - ToPackingCode = dto.PackingCode, - Remark = dto.Remark, - ArriveDate = dto.ArriveDate, + ToPackingCode = entity.PackingCode, + Remark = entity.Remark, + ArriveDate = entity.ArriveDate, DocNumber = string.Empty, - ExpireDate = dto.ExpireDate, + ExpireDate = entity.ExpireDate, FromContainerCode = detailInput.ContainerCode, FromLot = detailInput.Lot, FromPackingCode = detailInput.PackingCode, Uom = detailInput.Uom, FromStatus = EnumInventoryStatus.OK, JobNumber = string.Empty, - ItemDesc1 = dto.ItemDesc1, - StdPackQty = dto.StdPackQty, + ItemDesc1 = entity.ItemDesc1, + StdPackQty = entity.StdPackQty, TransType = EnumTransType.Transfer, - ToLot = dto.Lot, - ItemDesc2 = dto.ItemDesc2, - ItemName = dto.ItemName, - ProduceDate = dto.ProduceDate, - SupplierBatch = dto.SupplierBatch, + ToLot = entity.Lot, + ItemDesc2 = entity.ItemDesc2, + ItemName = entity.ItemName, + ProduceDate = entity.ProduceDate, + SupplierBatch = entity.SupplierBatch, ToContainerCode = detailInput.ContainerCode, ToStatus = EnumInventoryStatus.OK, TransSubType = EnumTransSubType.Transfer_Integration, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs index 72f851c3d..e9a4255df 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/OperationPacking/SeparationPackingNotes/SeparationPackingNoteAppService.cs @@ -182,7 +182,7 @@ public class SeparationPackingNoteAppService : transferLogEditInputs.Add(transferLogEditInput); } - await _repository.UpdateAsync(entity).ConfigureAwait(false); + //await _repository.UpdateAsync(entity).ConfigureAwait(false); var dto = entity.ToObject(); await _transferLogAppService.AddManyAsync(transferLogEditInputs).ConfigureAwait(false);