From ad991b59a542ae0ea25604a17c088081a63b8603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=B8=A4=E6=97=AD=5BIrelia=5D?= <366601522@qq.com> Date: Sun, 16 Apr 2023 13:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E8=BE=B9=E4=BB=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...FrameworkCore.SqlServer.StoreDbContext.sql | 153 ++++++++++++++++++ .../SfsCrudWithDetailsAppServiceBase.cs | 3 +- .../DTOs/WipWarehouseAdjustNoteDTO.cs | 41 +++++ .../DTOs/WipWarehouseAdjustNoteDetailDTO.cs | 24 +++ .../IWipWarehouseAdjustNoteAppService.cs | 17 ++ .../WipWarehouseAdjustNoteDetailInput.cs | 24 +++ .../Inputs/WipWarehouseAdjustNoteEditInput.cs | 48 ++++++ .../WipWarehouseAdjustNoteImportInput.cs | 71 ++++++++ .../WipWarehouseAdjustNotePermissions.cs | 21 +++ .../StorePermissionDefinitionProvider.cs | 3 + .../DTOs/WipWarehouseAdjustRequestDTO.cs | 15 ++ .../WipWarehouseAdjustRequestDetailDTO.cs | 24 +++ .../IWipWarehouseAdjustRequestAppService.cs | 7 + .../WipWarehouseAdjustRequestDetailInput.cs | 24 +++ .../WipWarehouseAdjustRequestEditInput.cs | 26 +++ .../WipWarehouseAdjustRequestImportInput.cs | 54 +++++++ .../WipWarehouseAdjustRequestPermissions.cs | 24 +++ ...Sfs.Wms.Store.Application.Contracts.csproj | 2 - .../PurchaseReceiptJobAppService.cs | 1 - .../WipWarehouseAdjustNoteAppService.cs | 136 ++++++++++++++++ ...WipWarehouseAdjustNoteAutoMapperProfile.cs | 88 ++++++++++ .../PurchaseOrders/PurchaseOrderAppService.cs | 1 - .../SupplierAsns/SupplierAsnAppService.cs | 4 +- .../ProductReceiptRequestAppService.cs | 1 - .../ProductRecycleRequestAppService.cs | 6 +- .../PurchaseReturnRequestAppService.cs | 2 +- .../WipWarehouseAdjustRequestAppService.cs | 148 +++++++++++++++++ ...WarehouseAdjustRequestAutoMapperProfile.cs | 77 +++++++++ .../StoreApplicationAutoMapperProfile.cs | 3 + .../Win_in.Sfs.Wms.Store.Application.csproj | 1 + .../IWipWarehouseAdjustNoteManager.cs | 11 ++ .../IWipWarehouseAdjustNoteRepository.cs | 8 + .../WipWarehouseAdjustNote.cs | 65 ++++++++ .../WipWarehouseAdjustNoteDetail.cs | 24 +++ .../WipWarehouseAdjustNoteManager.cs | 118 ++++++++++++++ .../IWipWarehouseAdjustRequestManager.cs | 9 ++ .../IWipWarehouseAdjustRequestRepository.cs | 9 ++ .../WipWarehouseAdjustRequest.cs | 25 +++ .../WipWarehouseAdjustRequestDetail.cs | 30 ++++ .../WipWarehouseAdjustRequestManager.cs | 80 +++++++++ .../IStoreDbContext.cs | 3 +- ...ustNoteDbContextModelCreatingExtensions.cs | 52 ++++++ .../WipWarehouseAdjustNoteEfCoreRepository.cs | 11 ++ ...RequestDbContextModelCreatingExtensions.cs | 52 ++++++ ...pWarehouseAdjustRequestEfCoreRepository.cs | 13 ++ .../StoreDbContext.cs | 3 +- .../StoreDbContextModelCreatingExtensions.cs | 2 + .../StoreEntityFrameworkCoreModule.cs | 6 + .../Notes/TransferNoteAutoMapperProfile.cs | 13 +- ...WipWarehouseAdjustNoteAutoMapperProfile.cs | 26 +++ ...WarehouseAdjustRequestAutoMapperProfile.cs | 24 +++ .../Jobs/ProductionReturnJobEventHandler.cs | 2 +- .../WipWarehouseAdjustRequestEventHandler.cs | 95 +++++++++++ .../StoreEventAutoMapperProfile.cs | 40 +++-- .../WipWarehouseAdjustNoteEventHandler.cs | 128 +++++++++++++++ 55 files changed, 1868 insertions(+), 30 deletions(-) create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql index f10be54b4..9e908aedd 100644 --- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql +++ b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.StoreDbContext.sql @@ -1863,6 +1863,52 @@ CREATE TABLE [Store_WarehouseTransferNote] ( ) +CREATE TABLE [Store_WipWarehouseAdjustNote] ( + [Id] uniqueidentifier NOT NULL, + [Type] nvarchar(64) NULL, + [RequestNumber] nvarchar(max) NULL, + [JobNumber] nvarchar(64) NULL, + [Confirmed] bit NOT NULL, + [ConfirmTime] datetime2 NULL, + [ExtraProperties] nvarchar(max) NULL, + [ConcurrencyStamp] nvarchar(40) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [TenantId] uniqueidentifier NULL, + [Remark] nvarchar(3072) NULL, + [Worker] nvarchar(max) NULL, + [Number] nvarchar(64) NOT NULL, + [ActiveDate] datetime2 NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustNote] PRIMARY KEY ([Id]) +) + + +CREATE TABLE [Store_WipWarehouseAdjustRequest] ( + [Id] uniqueidentifier NOT NULL, + [Type] nvarchar(64) NULL, + [ExtraProperties] nvarchar(max) NULL, + [ConcurrencyStamp] nvarchar(40) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [TenantId] uniqueidentifier NULL, + [Remark] nvarchar(3072) NULL, + [Worker] nvarchar(max) NULL, + [Number] nvarchar(64) NOT NULL, + [ActiveDate] datetime2 NOT NULL, + [AutoSubmit] bit NOT NULL, + [AutoAgree] bit NOT NULL, + [AutoHandle] bit NOT NULL, + [AutoCompleteJob] bit NOT NULL, + [DirectCreateNote] bit NOT NULL, + [RequestStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustRequest] PRIMARY KEY ([Id]) +) + + CREATE TABLE [Store_WorkOrder] ( [Id] uniqueidentifier NOT NULL, [WorkOrderId] nvarchar(64) NULL, @@ -5069,6 +5115,98 @@ CREATE TABLE [Store_WarehouseTransferNoteDetail] ( ) +CREATE TABLE [Store_WipWarehouseAdjustNoteDetail] ( + [Id] uniqueidentifier NOT NULL, + [Reason] nvarchar(64) NULL, + [ReasonCode] nvarchar(max) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [MasterID] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NULL, + [Number] nvarchar(64) NOT NULL, + [Remark] nvarchar(3072) NULL, + [ItemName] nvarchar(64) NULL, + [ItemDesc1] nvarchar(64) NULL, + [ItemDesc2] nvarchar(64) NULL, + [ItemCode] nvarchar(64) NOT NULL, + [Uom] nvarchar(64) NOT NULL, + [Qty] decimal(18,6) NOT NULL, + [StdPackQty] decimal(18,6) NOT NULL, + [FromPackingCode] nvarchar(450) NULL, + [ToPackingCode] nvarchar(max) NULL, + [FromContainerCode] nvarchar(max) NULL, + [ToContainerCode] nvarchar(max) NULL, + [FromLot] nvarchar(max) NULL, + [ToLot] nvarchar(max) NULL, + [SupplierBatch] nvarchar(64) NULL, + [ArriveDate] datetime2 NOT NULL, + [ProduceDate] datetime2 NOT NULL, + [ExpireDate] datetime2 NOT NULL, + [FromLocationCode] nvarchar(64) NOT NULL, + [FromLocationArea] nvarchar(64) NULL, + [FromLocationGroup] nvarchar(64) NULL, + [FromLocationErpCode] nvarchar(64) NOT NULL, + [FromWarehouseCode] nvarchar(64) NOT NULL, + [FromStatus] nvarchar(64) NOT NULL, + [ToLocationCode] nvarchar(64) NOT NULL, + [ToLocationArea] nvarchar(64) NULL, + [ToLocationGroup] nvarchar(64) NULL, + [ToLocationErpCode] nvarchar(64) NOT NULL, + [ToWarehouseCode] nvarchar(64) NOT NULL, + [ToStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustNoteDetail] PRIMARY KEY ([Id]), + CONSTRAINT [FK_Store_WipWarehouseAdjustNoteDetail_Store_WipWarehouseAdjustNote_MasterID] FOREIGN KEY ([MasterID]) REFERENCES [Store_WipWarehouseAdjustNote] ([Id]) ON DELETE CASCADE +) + + +CREATE TABLE [Store_WipWarehouseAdjustRequestDetail] ( + [Id] uniqueidentifier NOT NULL, + [Reason] nvarchar(max) NULL, + [ReasonCode] nvarchar(max) NULL, + [CreationTime] datetime2 NOT NULL, + [CreatorId] uniqueidentifier NULL, + [LastModificationTime] datetime2 NULL, + [LastModifierId] uniqueidentifier NULL, + [MasterID] uniqueidentifier NOT NULL, + [TenantId] uniqueidentifier NULL, + [Number] nvarchar(64) NOT NULL, + [Remark] nvarchar(3072) NULL, + [ItemName] nvarchar(64) NULL, + [ItemDesc1] nvarchar(64) NULL, + [ItemDesc2] nvarchar(64) NULL, + [ItemCode] nvarchar(64) NOT NULL, + [Uom] nvarchar(64) NOT NULL, + [Qty] decimal(18,6) NOT NULL, + [StdPackQty] decimal(18,6) NOT NULL, + [FromPackingCode] nvarchar(max) NULL, + [ToPackingCode] nvarchar(max) NULL, + [FromContainerCode] nvarchar(max) NULL, + [ToContainerCode] nvarchar(max) NULL, + [FromLot] nvarchar(max) NULL, + [ToLot] nvarchar(max) NULL, + [SupplierBatch] nvarchar(64) NULL, + [ArriveDate] datetime2 NOT NULL, + [ProduceDate] datetime2 NOT NULL, + [ExpireDate] datetime2 NOT NULL, + [FromLocationCode] nvarchar(64) NOT NULL, + [FromLocationArea] nvarchar(64) NULL, + [FromLocationGroup] nvarchar(64) NULL, + [FromLocationErpCode] nvarchar(64) NOT NULL, + [FromWarehouseCode] nvarchar(64) NOT NULL, + [FromStatus] nvarchar(64) NOT NULL, + [ToLocationCode] nvarchar(64) NOT NULL, + [ToLocationArea] nvarchar(64) NULL, + [ToLocationGroup] nvarchar(64) NULL, + [ToLocationErpCode] nvarchar(64) NOT NULL, + [ToWarehouseCode] nvarchar(64) NOT NULL, + [ToStatus] nvarchar(64) NOT NULL, + CONSTRAINT [PK_Store_WipWarehouseAdjustRequestDetail] PRIMARY KEY ([Id]), + CONSTRAINT [FK_Store_WipWarehouseAdjustRequestDetail_Store_WipWarehouseAdjustRequest_MasterID] FOREIGN KEY ([MasterID]) REFERENCES [Store_WipWarehouseAdjustRequest] ([Id]) ON DELETE CASCADE +) + + CREATE TABLE [Store_WorkOrderDetail] ( [Id] uniqueidentifier NOT NULL, [EffectiveDate] datetime2 NOT NULL, @@ -5699,6 +5837,21 @@ CREATE INDEX [IX_Store_WarehouseTransferNoteDetail_MasterID] ON [Store_Warehouse CREATE UNIQUE INDEX [IX_Store_WarehouseTransferNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode] ON [Store_WarehouseTransferNoteDetail] ([Number], [FromPackingCode], [FromLocationCode], [ToLocationCode]) WHERE [FromPackingCode] IS NOT NULL +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustNote_Number] ON [Store_WipWarehouseAdjustNote] ([Number]) + + +CREATE INDEX [IX_Store_WipWarehouseAdjustNoteDetail_MasterID] ON [Store_WipWarehouseAdjustNoteDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode_FromStatus_ToStatus] ON [Store_WipWarehouseAdjustNoteDetail] ([Number], [FromPackingCode], [FromLocationCode], [ToLocationCode], [FromStatus], [ToStatus]) WHERE [FromPackingCode] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_WipWarehouseAdjustRequest_Number] ON [Store_WipWarehouseAdjustRequest] ([Number]) + + +CREATE INDEX [IX_Store_WipWarehouseAdjustRequestDetail_MasterID] ON [Store_WipWarehouseAdjustRequestDetail] ([MasterID]) + + CREATE UNIQUE INDEX [IX_Store_WorkOrder_Number] ON [Store_WorkOrder] ([Number]) diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs index 83fcd6ee9..600523dce 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs @@ -558,7 +558,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase protected virtual async Task> ImportProcessingEntityAsync(Dictionary dictionary) { + await Task.CompletedTask.ConfigureAwait(false); return dictionary; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs new file mode 100644 index 000000000..18f2d3f4a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDTO.cs @@ -0,0 +1,41 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-实体DTO +/// +public class WipWarehouseAdjustNoteDTO : SfsStoreDTOBase, IHasNumber +{ + /// + /// 线边仓调整申请单号 + /// + [Display(Name = "线边仓调整申请单号")] + public string RequestNumber { get; set; } + + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + public string JobNumber { get; set; } + + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + public DateTime? ConfirmTime { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs new file mode 100644 index 000000000..0e460c91b --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/DTOs/WipWarehouseAdjustNoteDetailDTO.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整记录-明细表 +/// +public class WipWarehouseAdjustNoteDetailDTO : SfsStoreDetailWithFromToDTOBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs new file mode 100644 index 000000000..737ae169c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/IWipWarehouseAdjustNoteAppService.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IWipWarehouseAdjustNoteAppService : + ISfsStoreMasterReadOnlyAppServiceBase +{ + Task ConfirmAsync(Guid id); + + /// + /// 新增实体 + /// + /// CreateInput + Task CreateAsync(WipWarehouseAdjustNoteEditInput input); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs new file mode 100644 index 000000000..9c16118d8 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteDetailInput.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边仓调整-明细表DTO +/// +public class WipWarehouseAdjustNoteDetailInput : SfsStoreDetailWithFromToInputBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs new file mode 100644 index 000000000..5a92e2884 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteEditInput.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 新增和更新基础DTO +/// +public class WipWarehouseAdjustNoteEditInput : SfsStoreCreateOrUpdateInputBase +{ + #region Base + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + #endregion + + #region Update + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + public DateTime? ConfirmTime { get; set; } + #endregion + + /// + /// 线边仓调整申请单号 + /// + [Display(Name = "线边仓调整申请单号")] + public string RequestNumber { get; set; } + + /// + /// 任务ID + /// + [Display(Name = "任务ID")] + public string JobNumber { get; set; } + + /// + /// 调拨类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + [Display(Name = "详情")] + public List Details { get; set; } = new List(); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs new file mode 100644 index 000000000..05ab88ea6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/Inputs/WipWarehouseAdjustNoteImportInput.cs @@ -0,0 +1,71 @@ +using System; +using System.ComponentModel.DataAnnotations; +using DocumentFormat.OpenXml.Drawing; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class WipWarehouseAdjustNoteImportInput : SfsStoreImportInputBase +{ + /// + /// 调拨类型 + /// + [Display(Name = "调拨类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调拨类型")] + [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("区域内调拨(储位内移库)", EnumTransSubType.Transfer_Inside)] + public string Type { get; set; } + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + [ImporterHeader(IsIgnore = true)] + [Required(ErrorMessage = "{0}是必填项")] + public bool Confirmed { get; set; } + + /// + /// 物料号 + /// + [Display(Name = "物料号")] + [Required(ErrorMessage = "{0}是必填项")] + public string ItemCode { get; set; } + + /// + /// 调拨数量 + /// + [Display(Name = "调拨数量")] + [Required(ErrorMessage = "{0}是必填项")] + public decimal Qty { get; set; } + + /// + /// 调出库位 + /// + [Display(Name = "调出库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string FromLocationCode { get; set; } + + /// + /// 调入库位 + /// + [Display(Name = "调入库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string ToLocationCode { get; set; } + + /// + /// 箱码 + /// + [Display(Name = "箱码")] + [Required(ErrorMessage = "{0}是必填项")] + public string PackingCode { get; set; } + + /// + /// 状态 + /// + [Display(Name = "状态")] + [Required(ErrorMessage = "{0}是必填项")] + public EnumInventoryStatus Status { get; set; } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs new file mode 100644 index 000000000..ef96ab44a --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNotePermissions.cs @@ -0,0 +1,21 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class WipWarehouseAdjustNotePermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustNote); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + public static void AddWipWarehouseAdjustNotePermission(this PermissionGroupDefinition permissionGroup) + { + var WipWarehouseAdjustNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustNote))); + WipWarehouseAdjustNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + WipWarehouseAdjustNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + WipWarehouseAdjustNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs index ceda25aae..92bbc9d6d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs @@ -79,6 +79,9 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider storeGroup.AddReportPermission(); storeGroup.AddDashboardPermission(); + storeGroup.AddWipWarehouseAdjustRequestPermission(); + storeGroup.AddWipWarehouseAdjustNotePermission(); + #region Jobs storeGroup.AddPurchaseReceiptJobPermission(); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs new file mode 100644 index 000000000..80ccd8d74 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDTO.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-实体DTO +/// +public class WipWarehouseAdjustRequestDTO : SfsStoreRequestDTOBase, IHasNumber +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs new file mode 100644 index 000000000..712395401 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/DTOs/WipWarehouseAdjustRequestDetailDTO.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 线边调整-明细表 +/// +public class WipWarehouseAdjustRequestDetailDTO : SfsStoreDetailWithFromToDTOBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs new file mode 100644 index 000000000..ba5a69fbd --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestAppService.cs @@ -0,0 +1,7 @@ +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public interface IWipWarehouseAdjustRequestAppService + : ISfsStoreRequestMasterAppServiceBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs new file mode 100644 index 000000000..2af3ac206 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestDetailInput.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 库存转移记录-明细表 +/// +public class WipWarehouseAdjustRequestDetailInput : SfsStoreDetailWithFromToInputBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs new file mode 100644 index 000000000..729cf8338 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestEditInput.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +/// +/// 新增和更新基础DTO +/// +public class WipWarehouseAdjustRequestEditInput : SfsStoreRequestCreateOrUpdateInputBase +{ + #region Base + + /// + /// 调拨类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 明细列表 + /// + [Display(Name = "明细列表")] + public List Details { get; set; } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs new file mode 100644 index 000000000..53c947bb9 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/Inputs/WipWarehouseAdjustRequestImportInput.cs @@ -0,0 +1,54 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public class WipWarehouseAdjustRequestImportInput : SfsStoreImportInputBase +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "调整类型")] + [ExporterHeader(DisplayName = "调整类型")] + [ValueMapping("线边仓调整", EnumTransSubType.CountAdjust_WIP)] + public string Type { get; set; } + + /// + /// 物品编号 + /// + [Display(Name = "物料号")] + [Required(ErrorMessage = "{0}是必填项")] + public string ItemCode { get; set; } + + /// + /// 调整数量 + /// + [Display(Name = "调拨数量")] + [Required(ErrorMessage = "{0}是必填项")] + public decimal Qty { get; set; } + + /// + /// 调整库位 + /// + [Display(Name = "调整库位")] + [Required(ErrorMessage = "{0}是必填项")] + public string FromLocationCode { get; set; } + + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs new file mode 100644 index 000000000..3f535c72c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestPermissions.cs @@ -0,0 +1,24 @@ +using Volo.Abp.Authorization.Permissions; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application.Contracts; + +public static class WipWarehouseAdjustRequestPermissions +{ + public const string Default = StorePermissions.GroupName + "." + nameof(WipWarehouseAdjustRequest); + public const string Create = Default + "." + StorePermissions.CreateStr; + public const string Update = Default + "." + StorePermissions.UpdateStr; + public const string Delete = Default + "." + StorePermissions.DeleteStr; + + public static void AddWipWarehouseAdjustRequestPermission(this PermissionGroupDefinition permissionGroup) + { + var WipWarehouseAdjustRequestPermission = permissionGroup.AddPermission(Default, + StorePermissionDefinitionProvider.L(nameof(WipWarehouseAdjustRequest))); + WipWarehouseAdjustRequestPermission.AddChild(Create, + StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); + WipWarehouseAdjustRequestPermission.AddChild(Update, + StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); + WipWarehouseAdjustRequestPermission.AddChild(Delete, + StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj index cfb6a4466..a14d0abb2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj @@ -42,10 +42,8 @@ - - diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs index e1c099ab0..2c646ae7e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs @@ -173,7 +173,6 @@ public class PurchaseReceiptJobAppService : /// 按Id获取实体 不走缓存 /// /// 实体Id - /// /// [HttpGet("no-cache/{id}")] public virtual async Task GetNoCacheAsync(Guid id) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs new file mode 100644 index 000000000..49dcab912 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAppService.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +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; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application; + +/// +/// 线边调整记录 +/// +[Authorize] +[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-note")] +public class WipWarehouseAdjustNoteAppService : SfsStoreWithDetailsAppServiceBase + , + IWipWarehouseAdjustNoteAppService +{ + private readonly IWipWarehouseAdjustNoteManager _WipWarehouseAdjustNoteManager; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + + public WipWarehouseAdjustNoteAppService( + IWipWarehouseAdjustNoteRepository repository, + IWipWarehouseAdjustNoteManager WipWarehouseAdjustNoteManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService) : base(repository) + { + _WipWarehouseAdjustNoteManager = WipWarehouseAdjustNoteManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; + } + + #region 东阳使用 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var WipWarehouseAdjustNote in addList) + { + if (WipWarehouseAdjustNote.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) //储位内调拨 + { + WipWarehouseAdjustNote.Type = EnumTransSubType.Transfer_Inside.ToString();//重点 需要转换 + foreach (var detail in WipWarehouseAdjustNote.Details) + { + var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + detail.ItemCode = balanceDto.ItemCode; + detail.ArriveDate = balanceDto.ArriveDate; + detail.ItemDesc1 = balanceDto.ItemDesc1; + detail.ItemDesc2 = balanceDto.ItemDesc2; + detail.ItemName = balanceDto.ItemName; + detail.ProduceDate = balanceDto.ProduceDate; + detail.Qty = balanceDto.Qty; + detail.Uom = balanceDto.Uom; + detail.ExpireDate = balanceDto.ExpireDate; + detail.StdPackQty = balanceDto.StdPackQty; + detail.SupplierBatch = balanceDto.SupplierBatch; + + detail.FromLocationArea = balanceDto.LocationArea; + detail.FromContainerCode = balanceDto.ContainerCode; + detail.FromLocationErpCode = balanceDto.LocationErpCode; + detail.FromLocationGroup = balanceDto.LocationGroup; + detail.FromPackingCode = balanceDto.PackingCode; + detail.FromLocationArea = balanceDto.LocationArea; + detail.FromStatus = balanceDto.Status; + detail.FromWarehouseCode = balanceDto.WarehouseCode; + detail.FromLot = balanceDto.Lot; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.LocationGroupCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + detail.ToContainerCode = balanceDto.ContainerCode; + detail.ToPackingCode = balanceDto.PackingCode; + detail.ToLocationArea = balanceDto.LocationArea; + detail.ToStatus = balanceDto.Status; + detail.ToLot = balanceDto.Lot; + } + } + } + + return dictionary; + } + + /// + /// 确认对应的记录单 + /// + /// + /// + [HttpPost("confirm/{id}")] + public virtual async Task ConfirmAsync(Guid id) + { + var entity = await _WipWarehouseAdjustNoteManager.ConfirmAsync(id).ConfigureAwait(false); + var dto = ObjectMapper.Map(entity); + return dto; + } + + /// + /// 新增实体 + /// + /// CreateInput + [HttpPost("")] + public override async Task CreateAsync(WipWarehouseAdjustNoteEditInput input) + { + var entity = ObjectMapper.Map(input); + + entity=await _WipWarehouseAdjustNoteManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + + return dto; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs new file mode 100644 index 000000000..3d08493f8 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteAutoMapperProfile.cs @@ -0,0 +1,88 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustNoteMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + ; + + CreateMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + .Ignore(x => x.TenantId) + .Ignore(x => x.ConcurrencyStamp) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConfirmTime) + .Ignore(x => x.RequestNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Details) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .ForMember(x => x.ToPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.FromPackingCode, y => y.MapFrom(d => d.PackingCode)) + .ForMember(x => x.FromStatus, y => y.MapFrom(d => d.Status)) + .ForMember(x => x.ToStatus, y => y.MapFrom(d => d.Status)) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToLocationErpCode) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.Reason) + .Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.ToLot) + .Ignore(x => x.StdPackQty) + .Ignore(x => x.Uom) + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index 533107d6b..5967d9876 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -26,7 +26,6 @@ public class PurchaseOrderAppService : private readonly IPurchaseOrderManager _purchaseOrderManager; private readonly ISupplierAppService _supplierAppService; private readonly IItemBasicAppService _itemBasicAppService; - private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobAppService; public PurchaseOrderAppService( IPurchaseOrderRepository repository, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs index e9ac75db2..1bf717949 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/SupplierAsns/SupplierAsnAppService.cs @@ -73,7 +73,7 @@ public class SupplierAsnAppService : /// /// 生成ASN订单号 /// - /// + /// /// [HttpPost("generate-supplierasn-number")] public async Task GenerateSupplierAsnNumberAsync(DateTime activeDate) @@ -101,7 +101,7 @@ public class SupplierAsnAppService : { var entities = await _repository.GetListAsync( p => p.PlanArriveDate.Year == DateTime.Now.Year && p.PlanArriveDate.Month == DateTime.Now.Month && - p.PlanArriveDate.Day == DateTime.Now.Day, true); + p.PlanArriveDate.Day == DateTime.Now.Day, true).ConfigureAwait(false); return ObjectMapper.Map, List>(entities); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs index 54689060c..f6c44ac51 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductReceiptRequests/ProductReceiptRequestAppService.cs @@ -86,7 +86,6 @@ public class ProductReceiptRequestAppService : /// 赋值详情 /// /// - /// /// private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs index 0393a2ccd..9275973f6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductRecycleRequests/ProductRecycleRequestAppService.cs @@ -37,7 +37,6 @@ public class ProductRecycleRequestAppService : private readonly IProductRecycleRequestManager _productRecycleRequestManager; private readonly IBomAppService _bomApp; private readonly IItemStoreRelationAppService _itemStoreRelationApp; - private readonly IItemBasicAppService _itemBasicAppService; private readonly IBalanceAppService _balanceAppService; private readonly ILocationAppService _locationAppService; private readonly ITransactionTypeAppService _transactionTypeAppService; @@ -46,7 +45,10 @@ public class ProductRecycleRequestAppService : IProductRecycleRequestRepository repository, IProductRecycleRequestManager productRecycleRequestManager, IBomAppService bomApp, - IItemStoreRelationAppService itemStoreRelationApp, ILocationAppService locationAppService, IBalanceAppService balanceAppService, ITransactionTypeAppService transactionTypeAppService) + IItemStoreRelationAppService itemStoreRelationApp, + ILocationAppService locationAppService, + IBalanceAppService balanceAppService, + ITransactionTypeAppService transactionTypeAppService) : base(repository, productRecycleRequestManager) { _productRecycleRequestManager = productRecycleRequestManager; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs index c5b6388e9..77ff33bb5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReturnRequests/PurchaseReturnRequestAppService.cs @@ -268,7 +268,7 @@ public class PurchaseReturnRequestAppService : /// /// /// - /// + /// /// /// private static void CheckTransactionType( diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs new file mode 100644 index 000000000..819a11568 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs @@ -0,0 +1,148 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain; +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; +using Win_in.Sfs.Wms.Store.Domain.Shared; + +namespace Win_in.Sfs.Wms.Store.Application; + +/// +/// 调拨转移记录 +/// +[Authorize] +[Route($"{StoreConsts.RootPath}wip-warehouse-adjust-request")] +public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase + , + IWipWarehouseAdjustRequestAppService +{ + private readonly IWipWarehouseAdjustRequestManager _WipWarehouseAdjustRequestManager; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; + + public WipWarehouseAdjustRequestAppService( + IWipWarehouseAdjustRequestRepository repository, + IWipWarehouseAdjustRequestManager WipWarehouseAdjustRequestManager, + IBalanceAppService balanceAppService, + ILocationAppService locationAppService, + IItemBasicAppService itemBasicAppService) : base(repository, WipWarehouseAdjustRequestManager) + { + _WipWarehouseAdjustRequestManager = WipWarehouseAdjustRequestManager; + _balanceAppService = balanceAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; + } + + #region 东阳使用 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var WipWarehouseAdjustRequest in addList) + { + WipWarehouseAdjustRequest.Worker = CurrentUser.GetUserName(); + WipWarehouseAdjustRequest.CreatorId = CurrentUser.Id; + + await SetEntityPropertiesAsync(WipWarehouseAdjustRequest, EnumTransSubType.CountAdjust_WIP).ConfigureAwait(false); + foreach (var detail in WipWarehouseAdjustRequest.Details) + { + detail.ToLocationCode = detail.FromLocationCode;//调整库位一致 + + var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) + .ConfigureAwait(false); + var fromLocationDto = await _locationAppService.GetByCodeAsync(detail.FromLocationCode) + .ConfigureAwait(false); + + detail.ItemCode = itemBasicDto.Code; + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2 = itemBasicDto.Desc2; + detail.ItemName = itemBasicDto.Name; + + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty = itemBasicDto.StdPackQty; + + detail.Qty = detail.Qty; + + detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + + detail.FromPackingCode = string.Empty; + detail.FromContainerCode = string.Empty; + detail.ToPackingCode = string.Empty; + detail.ToContainerCode = string.Empty; + detail.FromStatus = EnumInventoryStatus.OK; + detail.ToStatus = EnumInventoryStatus.OK; + detail.FromLot = string.Empty; + detail.ToLot = string.Empty; + } + } + + return dictionary; + } + + private async Task SetEntityPropertiesAsync(WipWarehouseAdjustRequest entity, EnumTransSubType subType) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Adjust, subType) + .ConfigureAwait(false); + entity.Worker = CurrentUser.GetUserName(); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + /// + /// 新增实体 + /// + /// CreateInput + public override async Task CreateAsync(WipWarehouseAdjustRequestEditInput input) + { + var entity = ObjectMapper.Map(input); + + await _WipWarehouseAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false); + + var dto = ObjectMapper.Map(entity); + return dto; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs new file mode 100644 index 000000000..e5ecad6a2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAutoMapperProfile.cs @@ -0,0 +1,77 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustRequestMapperProfile() + { + CreateMap() + .ReverseMap(); + + CreateMap(); + + CreateMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ActiveDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.RequestStatus) + .Ignore(x => x.Details) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x=>x.ToPackingCode) + .Ignore(x => x.FromPackingCode) + .Ignore(x => x.FromStatus) + .Ignore(x => x.ToStatus) + .Ignore(x => x.FromLocationGroup) + .Ignore(x => x.FromLocationArea) + .Ignore(x => x.FromLocationErpCode) + .Ignore(x => x.FromWarehouseCode) + .Ignore(x => x.ToLocationArea) + .Ignore(x => x.ToLocationGroup) + .Ignore(x => x.ToLocationErpCode) + .Ignore(x => x.ToWarehouseCode) + .Ignore(x => x.SupplierBatch).Ignore(x => x.ArriveDate).Ignore(x => x.ProduceDate).Ignore(x => x.ExpireDate) + .Ignore(x => x.Remark) + .Ignore(x => x.ItemName) + .Ignore(x => x.ItemDesc1) + .Ignore(x => x.ItemDesc2) + .Ignore(x => x.FromContainerCode) + .Ignore(x => x.ToContainerCode) + .Ignore(x => x.FromLot) + .Ignore(x => x.ToLot) + .Ignore(x => x.StdPackQty) + .Ignore(x => x.Uom) + .Ignore(x => x.MasterID) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Id) + .Ignore(x => x.Number) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + .Ignore(x => x.TenantId) + ; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs index c146f557f..8dfb70eb6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs @@ -23,6 +23,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile PutawayRequestAutoMapperProfile(); CountAdjustRequestAutoMapperProfile(); ScrapRequestAutoMapperProfile(); + WipWarehouseAdjustRequestMapperProfile(); #endregion @@ -78,6 +79,8 @@ public partial class StoreApplicationAutoMapperProfile : Profile TransferNoteMapperProfile(); NoOkConvertOkNoteAutoMapperProfile(); InventoryInitialNoteAutoMapperProfile(); + WipWarehouseAdjustNoteMapperProfile(); + #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj index 1d06fbf89..8baf5221b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Win_in.Sfs.Wms.Store.Application.csproj @@ -22,6 +22,7 @@ + diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs new file mode 100644 index 000000000..8e610fb9e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteManager.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading.Tasks; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustNoteManager : + ISfsStoreManager, IBulkImportService +{ + Task ConfirmAsync(Guid id); +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs new file mode 100644 index 000000000..64a7411c6 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/IWipWarehouseAdjustNoteRepository.cs @@ -0,0 +1,8 @@ +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustNoteRepository : ISfsStoreRepositoryBase, + ISfsBulkRepositoryBase +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs new file mode 100644 index 000000000..3ded8d094 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNote.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp; +using Win_in.Sfs.Shared.Domain.Entities; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 盘点差异调整记录 +/// +public class WipWarehouseAdjustNote : SfsStoreAggregateRootBase, IHasJobNumber +{ + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 任务ID + /// + [IgnoreUpdate] + public string RequestNumber { get; set; } + + /// + /// 任务ID + /// + [IgnoreUpdate] + public string JobNumber { get; set; } + + /// + /// 明细列表 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new(); + + /// + /// 已确认 + /// + [Display(Name = "已确认")] + public bool Confirmed { get; set; } + + /// + /// 确认时间 + /// + [Display(Name = "确认时间")] + [IgnoreUpdate] + public DateTime? ConfirmTime { get; set; } + + public void Confirm(DateTime confirmTime) + { + CheckStatus(Confirmed); + Confirmed = true; + ConfirmTime = confirmTime; + } + + private static void CheckStatus(bool confirmed) + { + if (confirmed) + { + throw new UserFriendlyException("当前状态为 【已确认】 ,无法再次确认!"); + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs new file mode 100644 index 000000000..878d8fd63 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteDetail.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 盘点差异调整记录-明细表 +/// +public class WipWarehouseAdjustNoteDetail : SfsStoreDetailWithFromToEntityBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs new file mode 100644 index 000000000..ba26d8c9e --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/WipWarehouseAdjustNote/WipWarehouseAdjustNoteManager.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Volo.Abp; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Event; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class WipWarehouseAdjustNoteManager : SfsStoreManagerBase, + IWipWarehouseAdjustNoteManager +{ + private readonly IWipWarehouseAdjustNoteRepository _repository; + + public WipWarehouseAdjustNoteManager( + IWipWarehouseAdjustNoteRepository repository + ) : base(repository) + { + _repository = repository; + } + + [UnitOfWork] + public virtual async Task ConfirmAsync(Guid id) + { + var entity = await Repository.FindAsync(id).ConfigureAwait(false); + Check.NotNull(entity, EntityClassName); + entity.Confirm(Clock.Now); + await PublishConfirmedAsync(entity).ConfigureAwait(false); + return await Repository.UpdateAsync(entity).ConfigureAwait(false); + } + + private async Task PublishConfirmedAsync(WipWarehouseAdjustNote entity) + { + try + { + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(entity), false) + .ConfigureAwait(false); + } + catch (Exception ex) + { + Logger.LogDebug($"{nameof(WipWarehouseAdjustNote)} Confirmed Event:{ex.Message}", null); + Console.WriteLine(ex.Source); + throw; + } + } + + /// + /// 执行导入 + /// + public virtual async Task ImportDataAsync(List mergeEntities, + List deleteEntities = null) + { + if (deleteEntities != null && deleteEntities.Count > 0) + { + await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + } + + foreach (var entity in mergeEntities) + { + entity.SetIdAndNumberWithDetails(GuidGenerator, + await GenerateNumberAsync(nameof(WipWarehouseAdjustNote), Clock.Now).ConfigureAwait(false)); + } + + await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); + + var insertDetails = new List(); + + foreach (var item in mergeEntities) + { + await SetDetailAsync(item.Details).ConfigureAwait(false); + + insertDetails.AddRange(item.Details); + } + + await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false); + } + + private async Task SetDetailAsync(List details) + { + foreach (var detail in details) + { + var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); + + if (item != null) + { + detail.ItemName = item.Name; + detail.ItemDesc1 = item.Desc1; + detail.ItemDesc2 = item.Desc2; + } + + var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + Check.NotNull(balance, "库存", + $"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); + + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + //通过箱码和库位获取库存信息 + detail.FromStatus = balance.Status; + + detail.FromLot = balance.Lot; + detail.FromWarehouseCode = balance.WarehouseCode; + detail.FromContainerCode = balance.ContainerCode; + + detail.ToLot = balance.Lot; + detail.ToWarehouseCode = balance.WarehouseCode; + detail.ToContainerCode = balance.ContainerCode; + + detail.ToStatus = balance.Status; + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs new file mode 100644 index 000000000..3385bbe47 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestManager.cs @@ -0,0 +1,9 @@ +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public interface IWipWarehouseAdjustRequestManager : + ISfsStoreRequestManager, + IBulkImportService +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs new file mode 100644 index 000000000..dd69d923c --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/IWipWarehouseAdjustRequestRepository.cs @@ -0,0 +1,9 @@ +using System; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain +{ + public interface IWipWarehouseAdjustRequestRepository : ISfsStoreRepositoryBase, ISfsBulkRepositoryBase + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs new file mode 100644 index 000000000..25f00e538 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequest.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Entities; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 调拨申请 +/// +public class WipWarehouseAdjustRequest : SfsStoreRequestAggregateRootBase +{ + + /// + /// 调整类型 + /// + [Display(Name = "调整类型")] + public string Type { get; set; } + + /// + /// 明细列表 + /// + [IgnoreUpdate] + public override List Details { get; set; } = new List(); + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs new file mode 100644 index 000000000..aacab5098 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDetail.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using System.Text.Json; +using Win_in.Sfs.Shared.Domain; + +namespace Win_in.Sfs.Wms.Store.Domain; + +/// +/// 线边库存调整调整明细 +/// +public class WipWarehouseAdjustRequestDetail : SfsStoreDetailWithFromToEntityBase +{ + /// + /// 原因 + /// + [Display(Name = "调整原因")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string Reason { get; set; } + + /// + /// 调整代码 + /// + [Display(Name = "原因代码")] + [StringLength(SfsEfCorePropertyConst.RemarkLength, ErrorMessage = "{0}最多输入{1}个字符")] + public string ReasonCode { get; set; } + + public override string ToString() + { + return JsonSerializer.Serialize(this); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs new file mode 100644 index 000000000..e11444523 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestManager.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; + +namespace Win_in.Sfs.Wms.Store.Domain; + +public class WipWarehouseAdjustRequestManager : + SfsStoreRequestManagerBase, + IWipWarehouseAdjustRequestManager +{ + private readonly IWipWarehouseAdjustRequestRepository _repository; + + public WipWarehouseAdjustRequestManager( + IWipWarehouseAdjustRequestRepository repository + ) : base(repository) + { + _repository = repository; + } + + /// + /// 执行导入 + /// + public virtual async Task ImportDataAsync(List WipWarehouseAdjustRequests, + List deleteEntities = null) + { + if (deleteEntities != null && deleteEntities.Count > 0) + { + await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); + } + + _ = new List(); + + foreach (var item in WipWarehouseAdjustRequests) + { + await BuildDetailAsync(item.Details).ConfigureAwait(false); + } + + await CreateManyAsync(WipWarehouseAdjustRequests).ConfigureAwait(false); + } + + private async Task BuildDetailAsync(List details) + { + foreach (var detail in details) + { + var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); + + if (item != null) + { + detail.ItemName = item.Name; + detail.ItemDesc1 = item.Desc1; + detail.ItemDesc2 = item.Desc2; + } + + var balance = await BalanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + Check.NotNull(balance, "库存", + $"不存在箱码为{detail.FromPackingCode},零件编码为{detail.ItemCode},库位为{detail.FromLocationCode},状态为{detail.FromStatus}的库存!"); + + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + //通过箱码和库位获取库存信息 + detail.FromStatus = balance.Status; + + detail.FromLot = balance.Lot; + detail.FromWarehouseCode = balance.WarehouseCode; + detail.FromContainerCode = balance.ContainerCode; + + detail.ToLot = balance.Lot; + detail.ToWarehouseCode = balance.WarehouseCode; + detail.ToContainerCode = balance.ContainerCode; + + detail.ToStatus = balance.Status; + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs index 782b3c977..c99a156c0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs @@ -29,6 +29,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet ProductRecycleRequests { get; } public DbSet ScrapRequests { get; } public DbSet CountAdjustRequests { get; } + public DbSet WipWarehouseAdjustRequests { get; } #endregion @@ -82,7 +83,7 @@ public interface IStoreDbContext : IEfCoreDbContext public DbSet CustomerReturnNotes { get; } public DbSet ContainerBindNotes { get; } public DbSet NoOkConvertOkNotes { get; } - + public DbSet WipWarehouseAdjustNotes { get; } #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..971a7ef92 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteDbContextModelCreatingExtensions.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class WipWarehouseAdjustNoteDbContextModelCreatingExtensions +{ + public static void ConfigureWipWarehouseAdjustNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNote), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Properties + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustNoteDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + b.Property(q => q.Reason).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + b.HasIndex(q => new { q.Number, q.FromPackingCode, q.FromLocationCode, q.ToLocationCode, q.FromStatus, q.ToStatus }).IsUnique(); + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs new file mode 100644 index 000000000..9cac2a7c2 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/WipWarehouseAdjustNotes/WipWarehouseAdjustNoteEfCoreRepository.cs @@ -0,0 +1,11 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class WipWarehouseAdjustNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase, IWipWarehouseAdjustNoteRepository +{ + public WipWarehouseAdjustNoteEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs new file mode 100644 index 000000000..20ce75a3f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestDbContextModelCreatingExtensions.cs @@ -0,0 +1,52 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public static class WipWarehouseAdjustRequestDbContextModelCreatingExtensions +{ + public static void ConfigureWipWarehouseAdjustRequest(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequest), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Properties + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); + + //Indexes + b.HasIndex(q => new { q.Number }).IsUnique(); + }); + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + nameof(WipWarehouseAdjustRequestDetail), options.Schema); + //Configure ABP properties + b.ConfigureByConvention(); + //Configure Sfs base properties + b.ConfigureSfsStoreBase(); + //Configure Sfs store detail properties + b.ConfigureSfsStoreDetailBase(); + + //Properties + b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); + + //Relations + + //Indexes + + }); + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs new file mode 100644 index 000000000..75e96baeb --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestEfCoreRepository.cs @@ -0,0 +1,13 @@ +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; + +public class WipWarehouseAdjustRequestEfCoreRepository : + SfsStoreEfCoreRepositoryBase, IWipWarehouseAdjustRequestRepository +{ + public WipWarehouseAdjustRequestEfCoreRepository(IDbContextProvider dbContextProvider) : base( + dbContextProvider) + { + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs index 6fc300b69..9a5dbfa35 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs @@ -28,6 +28,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet ProductRecycleRequests { get; set; } public DbSet ScrapRequests { get; set; } public DbSet CountAdjustRequests { get; set; } + public DbSet WipWarehouseAdjustRequests { get; set; } #endregion @@ -81,7 +82,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext public DbSet CustomerReturnNotes { get; set; } public DbSet ContainerBindNotes { get; set; } public DbSet NoOkConvertOkNotes { get; set; } - + public DbSet WipWarehouseAdjustNotes { get; set; } #endregion #region Jobs diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs index 81da8fb02..38813f279 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs @@ -59,6 +59,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigurePutawayRequest(options); builder.ConfigureScrapRequest(options); builder.ConfigureCountAdjustRequest(options); + builder.ConfigureWipWarehouseAdjustRequest(options); #endregion @@ -95,6 +96,7 @@ public static class StoreDbContextModelCreatingExtensions builder.ConfigureContainerBindNote(options); builder.ConfigureNoOkConvertOKNote(options); builder.ConfigureInventoryInitialNote(options); + builder.ConfigureWipWarehouseAdjustNote(options); #endregion 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 8f1d8db60..d51a8a347 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 @@ -63,6 +63,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); #endregion @@ -100,6 +101,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient(); + context.Services.AddTransient(); #endregion @@ -189,6 +191,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); #endregion @@ -260,6 +264,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); options.Entity(orderOptions => orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); + options.Entity(orderOptions => + orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details)); #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs index 88593ab57..bec022137 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs @@ -9,13 +9,24 @@ public partial class StoreEventAutoMapperProfile : Profile { private void TransferNoteAutoMapperProfile() { - CreateMap() + CreateMap() .Ignore(x => x.ExtraProperties) .Ignore(x => x.DocNumber) .Ignore(x => x.JobNumber) .Ignore(x => x.Worker) .Ignore(x => x.TransType) .Ignore(x => x.TransSubType) + .Ignore(x=>x.PackingCode) + .Ignore(x => x.Lot) + .Ignore(x => x.Status) + .Ignore(x => x.TransInOut) + .Ignore(x => x.LocationCode) + .Ignore(x => x.LocationGroup) + .Ignore(x => x.LocationErpCode) + .Ignore(x => x.LocationArea) + .Ignore(x => x.ContainerCode) + .Ignore(x => x.ManageType) + .Ignore(x => x.WarehouseCode) ; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs new file mode 100644 index 000000000..25cba43ed --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/WipWarehouseAdjustNoteAutoMapperProfile.cs @@ -0,0 +1,26 @@ +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.Domain; + +namespace Win_in.Sfs.Wms.Store.Event +{ + public partial class StoreEventAutoMapperProfile : Profile + { + private void WipWarehouseAdjustNoteAutoMapperProfile() + { + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.TransSubType) + ; + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs new file mode 100644 index 000000000..99dceeb96 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/WipWarehouseAdjustRequestAutoMapperProfile.cs @@ -0,0 +1,24 @@ +using AutoMapper; +using Volo.Abp.AutoMapper; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event; + +public partial class StoreEventAutoMapperProfile : Profile +{ + private void WipWarehouseAdjustRequestAutoMapperProfile() + { + CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() + .ForMember(x => x.RequestNumber, y => y.MapFrom(d => d.Number)) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Confirmed) + .Ignore(x => x.ConfirmTime) + ; + + CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() + ; + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs index 11cca065d..b8ac3da2a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionReturnJobEventHandler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.EventBus; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs new file mode 100644 index 000000000..75e931018 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/WipWarehouseAdjustRequestEventHandler.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; +using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; +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.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessRequest; + +public class WipWarehouseAdjustRequestEventHandler + : StoreEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + , ILocalEventHandler> + +{ + private readonly IWipWarehouseAdjustNoteAppService _wipWarehouseAdjustNoteAppService; + private readonly IWipWarehouseAdjustRequestManager _wipWarehouseAdjustRequestManager; + private readonly IBalanceAppService _balanceAppService; + + public WipWarehouseAdjustRequestEventHandler( + IWipWarehouseAdjustNoteAppService wipWarehouseAdjustNoteAppService, IBalanceAppService balanceAppService, IWipWarehouseAdjustRequestManager wipWarehouseAdjustRequestManager) + { + _wipWarehouseAdjustNoteAppService = wipWarehouseAdjustNoteAppService; + _balanceAppService = balanceAppService; + _wipWarehouseAdjustRequestManager = wipWarehouseAdjustRequestManager; + } + + /// + /// 创建后 + /// + /// Event data + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + + if (entity.AutoSubmit) + { + await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 批量创建后 + /// + /// Event data + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _wipWarehouseAdjustRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + /// + /// 审批后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.DirectCreateNote) + { + var note = await BuildCountAdjustNoteCreateInputAsync(entity).ConfigureAwait(false); + await _wipWarehouseAdjustNoteAppService.CreateAsync(note).ConfigureAwait(false); + } + } + + #region 私有 + + private async Task BuildCountAdjustNoteCreateInputAsync( + WipWarehouseAdjustRequest entity) + { + var createInput = ObjectMapper.Map(entity); + createInput.JobNumber = string.Empty; + createInput.RequestNumber = entity.Number; + createInput.ActiveDate = Clock.Now; + return createInput; + } + + #endregion +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs index 72e46f880..9dfa74f8d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs @@ -24,6 +24,31 @@ public partial class StoreEventAutoMapperProfile : Profile //到货单 PurchaseReceiptRequestAutoMapperProfile(); + //线边调整 + WipWarehouseAdjustRequestAutoMapperProfile(); + + #endregion + + #region Jobs + + CountJobAutoMapperProfile(); + DeliverJobAutoMapperProfile(); + InspectJobAutoMapperProfile(); + IssueJobAutoMapperProfile(); + JisDeliverJobAutoMapperProfile(); + ProductionReturnJobAutoMapperProfile(); + ProductReceiveJobAutoMapperProfile(); + PurchaseReceiptJobAutoMapperProfile(); + PurchaseReturnJobAutoMapperProfile(); + PutawayJobAutoMapperProfile(); + UnplannedIssueJobAutoMapperProfile(); + UnplannedReceiptJobAutoMapperProfile(); + + #endregion + + #region Notes + + WipWarehouseAdjustNoteAutoMapperProfile(); #endregion @@ -69,21 +94,6 @@ public partial class StoreEventAutoMapperProfile : Profile CountAdjustRequestAutoMapperProfile(); InventoryInitialNoteAutoMapperProfile(); - #region Jobs - - CountJobAutoMapperProfile(); - DeliverJobAutoMapperProfile(); - InspectJobAutoMapperProfile(); - IssueJobAutoMapperProfile(); - JisDeliverJobAutoMapperProfile(); - ProductionReturnJobAutoMapperProfile(); - ProductReceiveJobAutoMapperProfile(); - PurchaseReceiptJobAutoMapperProfile(); - PurchaseReturnJobAutoMapperProfile(); - PutawayJobAutoMapperProfile(); - UnplannedIssueJobAutoMapperProfile(); - UnplannedReceiptJobAutoMapperProfile(); - #endregion } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs new file mode 100644 index 000000000..b80add431 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/WipWarehouseAdjustNoteEventHandler.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +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.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Event.Transaction; + +namespace Win_in.Sfs.Wms.Store.Event.BusinessNote; + +public class WipWarehouseAdjustNoteEventHandler + : StoreInventoryEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + private const EnumTransType TransType = EnumTransType.Adjust; + private const EnumTransSubType TransSubType = EnumTransSubType.CountAdjust_WIP; + + private readonly IWipWarehouseAdjustRequestAppService _wipWarehouseAdjustRequestApp; + private readonly IItemBasicAppService _itemBasicAppService; + + public WipWarehouseAdjustNoteEventHandler( + IWipWarehouseAdjustRequestAppService wipWarehouseAdjustRequestApp, IItemBasicAppService itemBasicAppService) + { + _wipWarehouseAdjustRequestApp = wipWarehouseAdjustRequestApp; + _itemBasicAppService = itemBasicAppService; + } + + /// + /// 批量创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddTransactionsAsync(entities).ConfigureAwait(false); + + foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) + { + await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + } + } + + /// + /// 创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entities = new List { eventData.Entity }; + await AddTransactionsAsync(entities).ConfigureAwait(false); + + foreach (var entity in entities.Where(entity => !string.IsNullOrEmpty(entity.RequestNumber))) + { + await _wipWarehouseAdjustRequestApp.CompleteByNumberAsync(entity.RequestNumber).ConfigureAwait(false); + } + } + + #region 库存操作 + + private async Task AddTransactionsAsync(List countAdjustNotes) + { + var transactions = new List(); + //如果要做库存事务汇总,可以修改此处 + foreach (var countAdjustNote in countAdjustNotes) + { + transactions.AddRange(await BuildTransactions(countAdjustNote).ConfigureAwait(false)); + } + + await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false); + } + + private async Task> BuildTransactions(WipWarehouseAdjustNote countAdjustNote) + { + var transactions = new List(); + + foreach (var detail in countAdjustNote.Details) + { + var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + var transaction = new TransactionEditInput(); + + transaction.TransType = TransType; + transaction.TransSubType = TransSubType; + + transaction.TransInOut = detail.Qty > 0 ? EnumTransInOut.In : EnumTransInOut.Out; + + transaction.Worker = countAdjustNote.Worker; + transaction.DocNumber = countAdjustNote.Number; + transaction.JobNumber = string.Empty; + + transaction.ItemCode = detail.ItemCode; + transaction.ItemDesc1=detail.ItemDesc1; + transaction.ItemDesc2=detail.ItemDesc2; + transaction.ItemName = detail.ItemName; + transaction.StdPackQty = detail.StdPackQty; + transaction.DocNumber = detail.Number; + transaction.Uom=detail.Uom; + transaction.PackingCode = detail.ToPackingCode; + transaction.Lot = detail.ToLot; + transaction.Qty=detail.Qty; + transaction.Status = detail.ToStatus; + transaction.LocationCode = detail.ToLocationCode; + transaction.LocationGroup = detail.ToLocationGroup; + transaction.LocationArea = detail.ToLocationArea; + transaction.LocationErpCode = detail.ToLocationErpCode; + transaction.LocationCode=detail.ToLocationCode; + transaction.ContainerCode = detail.ToContainerCode; + transaction.ManageType = itemBasicDto.ManageType; + transaction.WarehouseCode = detail.ToWarehouseCode; + + transactions.Add(transaction); + } + + return transactions; + } + + #endregion +}