diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs index e489620b7..a50d73ebf 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ItemBasicConverter.cs @@ -49,7 +49,7 @@ public class ItemBasicConverter : IIncomingConverter var materialRequestList = await BuildIncomingToWmsOfItemBasicRequestAsync(incomingFromExternalList).ConfigureAwait(false); await _incomingToWmsManager.CreateBulkAsync(materialRequestList).ConfigureAwait(false); //归档 - await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList); + await _incomingFromExternalManager.ArchiveBulkAsync(incomingFromExternalList).ConfigureAwait(false); } private async Task> BuildIncomingToWmsOfItemBasicRequestAsync(List incomingDataList) diff --git a/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs b/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs index 085cf9304..441352764 100644 --- a/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs +++ b/be/DataExchange/Iac/Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad/PurchaseOrderAppService.cs @@ -22,7 +22,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad; [ApiExplorerSettings(GroupName = SwaggerGroupConsts.WmsWebApi)] public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppService { - private readonly Store.Application.Contracts.IPurchaseOrderAppService _purchaseOrderAppService; + //private readonly Store.Application.Contracts.IPurchaseOrderAppService _purchaseOrderAppService; private readonly IPo_mstrRepository _po_mstrRepository; @@ -34,7 +34,7 @@ public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppServ IConfiguration configuration ) { - _purchaseOrderAppService = purchaseOrderAppService; + //_purchaseOrderAppService = purchaseOrderAppService; _po_mstrRepository = po_mstrRepository; _configuration = configuration; } @@ -77,7 +77,7 @@ public class PurchaseOrderAppService : ApplicationService, IPurchaseOrderAppServ targetObj.ContactEmail = ""; #endregion - await _purchaseOrderAppService.UpsertAsync(targetObj).ConfigureAwait(false); + //await _purchaseOrderAppService.UpsertAsync(targetObj).ConfigureAwait(false); } catch (Exception ex) { 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 472671bb6..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, @@ -3069,6 +3115,7 @@ CREATE TABLE [Store_InspectNoteDetail] ( [Weight] nvarchar(max) NULL, [OtherPropertyJson] nvarchar(max) NULL, [StdPackQty] decimal(18,6) NOT NULL, + [InspectDate] datetime2 NOT NULL, [CreationTime] datetime2 NOT NULL, [CreatorId] uniqueidentifier NULL, [LastModificationTime] datetime2 NULL, @@ -5068,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, @@ -5614,4 +5753,111 @@ CREATE UNIQUE INDEX [IX_Store_ScrapNote_Number] ON [Store_ScrapNote] ([Number]) CREATE INDEX [IX_Store_ScrapNoteDetail_MasterID] ON [Store_ScrapNoteDetail] ([MasterID]) -CREATE UNIQUE INDEX [IX_Store_ScrapNoteDetail_Number_ItemCode_FromPackingCode_FromLocationCode_ToLocationCode_FromLot_FromStatus] ON [Store_ScrapNoteDetail] ([Number], [ItemCode], [FromPackingCode], [FromLocationCode], [ToLocationCode], [ \ No newline at end of file +CREATE UNIQUE INDEX [IX_Store_ScrapNoteDetail_Number_ItemCode_FromPackingCode_FromLocationCode_ToLocationCode_FromLot_FromStatus] ON [Store_ScrapNoteDetail] ([Number], [ItemCode], [FromPackingCode], [FromLocationCode], [ToLocationCode], [FromLot], [FromStatus]) WHERE [FromPackingCode] IS NOT NULL AND [FromLot] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_ScrapRequest_Number] ON [Store_ScrapRequest] ([Number]) + + +CREATE INDEX [IX_Store_ScrapRequestDetail_MasterID] ON [Store_ScrapRequestDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_ScrapRequestDetail_Number_ItemCode_LocationCode] ON [Store_ScrapRequestDetail] ([Number], [ItemCode], [LocationCode]) + + +CREATE UNIQUE INDEX [IX_Store_SupplierAsn_Number] ON [Store_SupplierAsn] ([Number]) + + +CREATE INDEX [IX_Store_SupplierAsn_SupplierCode] ON [Store_SupplierAsn] ([SupplierCode]) + + +CREATE INDEX [IX_Store_SupplierAsnDetail_MasterID] ON [Store_SupplierAsnDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_SupplierAsnDetail_Number_ItemCode_PackingCode] ON [Store_SupplierAsnDetail] ([Number], [ItemCode], [PackingCode]) + + +CREATE UNIQUE INDEX [IX_Store_TransferNote_Number] ON [Store_TransferNote] ([Number]) + + +CREATE INDEX [IX_Store_TransferNoteDetail_MasterID] ON [Store_TransferNoteDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_TransferNoteDetail_Number_FromPackingCode_FromLocationCode_ToLocationCode_FromStatus_ToStatus] ON [Store_TransferNoteDetail] ([Number], [FromPackingCode], [FromLocationCode], [ToLocationCode], [FromStatus], [ToStatus]) WHERE [FromPackingCode] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_TransferRequest_Number] ON [Store_TransferRequest] ([Number]) + + +CREATE INDEX [IX_Store_TransferRequestDetail_MasterID] ON [Store_TransferRequestDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_UnplannedIssueNote_Number] ON [Store_UnplannedIssueNote] ([Number]) + + +CREATE INDEX [IX_Store_UnplannedIssueNoteDetail_MasterID] ON [Store_UnplannedIssueNoteDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_UnplannedIssueNoteDetail_Number_PackingCode_ItemCode_Lot_Status] ON [Store_UnplannedIssueNoteDetail] ([Number], [PackingCode], [ItemCode], [Lot], [Status]) WHERE [Lot] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_UnplannedIssueRequest_Number] ON [Store_UnplannedIssueRequest] ([Number]) + + +CREATE INDEX [IX_Store_UnplannedIssueRequestDetail_MasterID] ON [Store_UnplannedIssueRequestDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_UnplannedIssueRequestDetail_Number_PackingCode_ItemCode_Lot_Status] ON [Store_UnplannedIssueRequestDetail] ([Number], [PackingCode], [ItemCode], [Lot], [Status]) WHERE [Lot] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_UnplannedReceiptNote_Number] ON [Store_UnplannedReceiptNote] ([Number]) + + +CREATE INDEX [IX_Store_UnplannedReceiptNoteDetail_MasterID] ON [Store_UnplannedReceiptNoteDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_UnplannedReceiptNoteDetail_Number_PackingCode_ItemCode_Lot_Status] ON [Store_UnplannedReceiptNoteDetail] ([Number], [PackingCode], [ItemCode], [Lot], [Status]) WHERE [Lot] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_UnplannedReceiptRequest_Number] ON [Store_UnplannedReceiptRequest] ([Number]) + + +CREATE INDEX [IX_Store_UnplannedReceiptRequestDetail_MasterID] ON [Store_UnplannedReceiptRequestDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_UnplannedReceiptRequestDetail_Number_PackingCode_ItemCode_Lot_Status] ON [Store_UnplannedReceiptRequestDetail] ([Number], [PackingCode], [ItemCode], [Lot], [Status]) WHERE [Lot] IS NOT NULL + + +CREATE UNIQUE INDEX [IX_Store_WarehouseTransferNote_Number] ON [Store_WarehouseTransferNote] ([Number]) + + +CREATE INDEX [IX_Store_WarehouseTransferNoteDetail_MasterID] ON [Store_WarehouseTransferNoteDetail] ([MasterID]) + + +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]) + + +CREATE INDEX [IX_Store_WorkOrderDetail_MasterID] ON [Store_WorkOrderDetail] ([MasterID]) + + +CREATE UNIQUE INDEX [IX_Store_WorkOrderDetail_Number_ItemCode] ON [Store_WorkOrderDetail] ([Number], [ItemCode]) + + diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs index dbaf0e54a..3c2da6dba 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Accounts/AccountController.cs @@ -21,7 +21,7 @@ using PdaMenuGroupDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuGroupDto; namespace Win_in.Sfs.Wms.Pda.Controllers.Accounts; /// -/// +/// /// [AllowAnonymous] [ApiController] @@ -38,12 +38,15 @@ public class AccountController : AbpController private readonly ILogger _logger; /// - /// + /// /// /// /// /// /// + /// + /// + /// public AccountController(IProfileAppService profileAppService , ITokenService tokenService , IUserMenuAppService userMenuAppService @@ -59,13 +62,22 @@ public class AccountController : AbpController _logger = logger; } + /// + /// + /// [Display] public class LoginModel { + /// + /// + /// [Display] [Required] public string UserName { get; set; } + /// + /// + /// [Display] [Required] public string Password { get; set; } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs index 4c5488710..444f4c83c 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs @@ -39,6 +39,7 @@ public class BalanceController : AbpController /// /// /// + /// public BalanceController( IBalanceAppService balanceAppService, IItemBasicAppService itemBasicAppService, @@ -440,7 +441,7 @@ public class BalanceController : AbpController public async Task> GetListByLocationTypeAndInventoryStatusAndNotExpectOutAsync( BalanceListByIssueInputByInventoryStatusAndLocationType listInput) { - var expectOut = await _expectOutAppService.GetListByPackingCodeAsync(listInput.packingCode); + var expectOut = await _expectOutAppService.GetListByPackingCodeAsync(listInput.packingCode).ConfigureAwait(false); if (expectOut != null && expectOut.Any()) { diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs index dc0477c94..d9b57eb5d 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/PurchaseReceiptJobController.cs @@ -32,9 +32,7 @@ public class PurchaseReceiptJobController : AbpController /// /// /// - /// /// - /// public PurchaseReceiptJobController( IPurchaseReceiptJobAppService purchaseReceiptJobAppService , IUserWorkGroupAppService userWorkGroupAppService @@ -53,7 +51,7 @@ public class PurchaseReceiptJobController : AbpController [HttpGet("{id}")] public virtual async Task> GetAsync(Guid id) { - var result = await _purchaseReceiptJobAppService.GetNoCacheAsync(id).ConfigureAwait(false); + var result = await _purchaseReceiptJobAppService.GetAsync(id).ConfigureAwait(false); var supplier = await _supplierAppService.GetByCodeAsync(result.SupplierCode).ConfigureAwait(false); result.SupplierName = supplier.Name; diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs index 450e9326c..86c329304 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/IssueNoteController.cs @@ -33,7 +33,7 @@ public class IssueNoteController : AbpController [HttpPost("")] public virtual async Task CreateAsync([FromBody] IssueNoteEditInput input) { - input.RequestType = EnumMaterialRequestType.Direct_Issue.ToString(); + input.RequestType = EnumMaterialRequestType.Issue_Direct.ToString(); input.Details.ForEach(p => { @@ -54,5 +54,4 @@ public class IssueNoteController : AbpController { return await _issueNoteAppService.ConfirmAsync(id).ConfigureAwait(false); } - } diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs index a3b534eaa..6b6a9fd09 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/L7Controller.cs @@ -54,7 +54,7 @@ public class L7Controller : AbpController [HttpPost("create-product-recycle-note-with-l7")] public virtual async Task CreateProductRecycleNoteWithL7Async(ProductRecycleNoteEditInput input) { - return await _productRecycleNoteAppService.CreateWithL7Async(input).ConfigureAwait(false); + return await _productRecycleNoteAppService.CreateAsync(input).ConfigureAwait(false); } /// diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs index 0fd4dd012..c5682b153 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs @@ -26,7 +26,7 @@ public class RecycledMaterialReceiptNoteController : AbpController } /// - /// 获取盘点任务详情 + /// 回收料调整 /// /// /// diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs deleted file mode 100644 index 3c8af2a80..000000000 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/TestController.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Account; -using Volo.Abp.Application.Services; -using Volo.Abp.AspNetCore.Mvc; -using Win_in.Sfs.Auth.Application.Contracts; -using Win_in.Sfs.Wms.Pda.Authenticaitons; -using Win_in.Sfs.Wms.Pda.Models; -using PdaMenuDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuDto; -using PdaMenuGroupDto = Win_in.Sfs.Wms.Pda.Models.PdaMenuGroupDto; - -namespace Win_in.Sfs.Wms.Pda.Controllers.Accounts; - -/// -/// -/// -[AllowAnonymous] -[ApiController] -[Route($"{PdaHostConst.ROOT_ROUTE}asfasf")] - -public class TestController: AbpController -{ - //private readonly IProfileAppService _profileAppService; - //private readonly ITokenService _tokenService; - private readonly IUserMenuAppService _userMenuAppService; - //private readonly IUserWorkGroupAppService _userWorkGroupAppService; - - /// - /// - /// - /// - /// - /// - /// - public TestController( - IUserMenuAppService userMenuAppService - , IUserWorkGroupAppService userWorkGroupAppService - ) - { - //_profileAppService = profileAppService; - //_tokenService = tokenService; - _userMenuAppService = userMenuAppService; - //_userWorkGroupAppService = userWorkGroupAppService; - } - - /// - /// Test - /// - /// - [HttpGet("Test")] - public virtual async Task> Test() - { - return new List() { "sdfsdf'" }; - } -} diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs index 7eb2e6173..37c115932 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs @@ -244,6 +244,16 @@ public class BalanceManager : DomainService, IBalanceManager balance.Status ).ConfigureAwait(false); + //if (!existBalance.IsActive) + //{ + // throw new UserFriendlyException( + // $"箱码为{balance.PackingCode}," + + // $"库位在{balance.LocationCode}," + + // $"批次为{balance.Lot}," + + // $"状态为{balance.Status.GetDisplayName()}" + + // $"的库存是不可用状态"); + //} + existBalance.Qty = balance.Qty; existBalance.ItemName = balance.ItemName; existBalance.ItemDesc1 = balance.ItemDesc1; @@ -423,9 +433,12 @@ public class BalanceManager : DomainService, IBalanceManager expression = expression.And(p => p.ExpireDate > DateTime.Now); } //筛选有效库区 - if (validLocationAreas.Any()) + if (validLocationAreas.Any() ) { - expression = expression.And(p => validLocationAreas.Contains(p.LocationArea)); + if (!string.IsNullOrEmpty(validLocationAreas[0])) + { + expression = expression.And(p => validLocationAreas.Contains(p.LocationArea)); + } } var allBalances = await (await _balanceRepository.GetDbSetAsync().ConfigureAwait(false)) diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs index d2dc012b1..723b2350c 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application.Contracts/InventoryLabels/InventoryLabelWithoutCodeCreateInput.cs @@ -207,4 +207,11 @@ public class InventoryLabelWithoutCodeCreateInput [Display(Name = "要求到货时间")] [Required(ErrorMessage = "{0}是必填项")] public DateTime PlanArriveDate { get; set; } + + /// + /// 备注 + /// + [Display(Name = "备注")] + public string Remark { get; set; } + } diff --git a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs index 76770e7eb..e88e07199 100644 --- a/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs +++ b/be/Modules/Label/src/Win_in.Sfs.Label.Application/InventoryLabels/InventoryLabelAppService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; @@ -15,6 +16,7 @@ using Win_in.Sfs.Label.Application.Contracts; using Win_in.Sfs.Label.Domain; using Win_in.Sfs.Label.Domain.Shared; using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Label.Application; @@ -33,12 +35,14 @@ public class InventoryLabelAppService private new readonly IInventoryLabelRepository _repository; private readonly ISupplierAppService _supplierAppService; private readonly ISupplierItemAppService _supplierItemAppService; + private readonly IItemBasicAppService _itemBasicAppService; public InventoryLabelAppService( IInventoryLabelRepository repository, ILabelDefinitionManager labelDefinitionManager , ISupplierAppService supplierAppService , IItemPackAppService itemPackAppService , ISupplierItemAppService supplierItemAppService + , IItemBasicAppService itemBasicAppService ) : base(repository) { _repository = repository; @@ -46,6 +50,7 @@ public class InventoryLabelAppService _supplierAppService = supplierAppService; _itemPackAppService = itemPackAppService; _supplierItemAppService = supplierItemAppService; + _itemBasicAppService = itemBasicAppService; } [HttpPost("")] @@ -60,6 +65,45 @@ public class InventoryLabelAppService return await base.CreateAsync(input).ConfigureAwait(false); } + /// + /// 按Id获取实体 + /// + /// 实体Id + /// + [HttpGet("{id}")] + public override async Task GetAsync(Guid id) + { + var dto = await base.GetAsync(id).ConfigureAwait(false); + + if (dto != null) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(dto.ItemCode).ConfigureAwait(false); + if (itemBasicDto != null) + { + switch (itemBasicDto.ValidityUnit) + { + case EnumValidityUnit.Infinite: + dto.ExpireDate = DateTime.MaxValue; + break; + case EnumValidityUnit.Day: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity); + break; + case EnumValidityUnit.WeeK: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity * 7); + break; + case EnumValidityUnit.Month: + dto.ExpireDate = DateTime.Now.AddMonths(itemBasicDto.Validity); + break; + case EnumValidityUnit.None: + default: + break; + } + } + } + + return dto; + } + [HttpPost("many")] [UnitOfWork] public virtual async Task> CreateManyAsync(List inputs) @@ -83,7 +127,7 @@ public class InventoryLabelAppService [UnitOfWork] public virtual async Task> CreateManyByNoCodeAsync(List inputs) { - var entitys= ObjectMapper.Map, List>(inputs); + var entitys = ObjectMapper.Map, List>(inputs); await _repository.InsertManyAsync(entitys).ConfigureAwait(false); return ObjectMapper.Map, List>(entitys); } @@ -129,6 +173,36 @@ public class InventoryLabelAppService var createInput = ObjectMapper.Map(input); createInput.Code = numbers[i]; var dto = await base.CreateAsync(createInput).ConfigureAwait(false); + + dto.SupplierCode = input.SupplierCode; + dto.PoNumber = input.PoNumber; + dto.Remark = input.Remark; + dto.AsnNumber = input.AsnNumber; + dto.FullBarcodeString = dto.Code; + + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(dto.ItemCode).ConfigureAwait(false); + if (itemBasicDto != null) + { + switch (itemBasicDto.ValidityUnit) + { + case EnumValidityUnit.Infinite: + dto.ExpireDate = DateTime.MaxValue; + break; + case EnumValidityUnit.Day: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity); + break; + case EnumValidityUnit.WeeK: + dto.ExpireDate = DateTime.Now.AddDays(itemBasicDto.Validity * 7); + break; + case EnumValidityUnit.Month: + dto.ExpireDate = DateTime.Now.AddMonths(itemBasicDto.Validity); + break; + case EnumValidityUnit.None: + default: + break; + } + } + dtos.Add(dto); } return dtos; 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 2c022d8d3..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 @@ -512,7 +512,6 @@ public abstract class SfsCrudWithDetailsAppServiceBase /// 导入数据具体实现,可重写 /// - //[UnitOfWork] protected virtual async Task ImportInternalAsync(SfsImportRequestInput requestInput, byte[] inputFileBytes) { IList modelList = null; @@ -559,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/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs index f99e6672e..451f73df2 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Inventory/EnumTransSubType.cs @@ -127,6 +127,12 @@ public enum EnumTransSubType [Display(Name = "安全库存拉动")] Issue_SafetyStock = 1504, + /// + /// 直接发料 + /// + [Display(Name = "直接发料")] + Issue_Direct = 1505, + /// /// 标准发货 /// diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs index 245c1f9e8..0fa48dec0 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumMaterialRequestType.cs @@ -28,5 +28,5 @@ public enum EnumMaterialRequestType //Issue_SfaetyStock = 1504, [Display(Name = "直接发料")] - Direct_Issue = 1505 + Issue_Direct = 1505 } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs index 34ad65d0c..57e22858e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithFromToDTOBase.cs @@ -79,11 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToDTOBase : SfsStoreDet [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } /// /// 推荐数量 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs index 60677c614..1879df552 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs index ada92e47f..76239bc02 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithFromToDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToDTOBase : SfsStoreDetai [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs index 158f925ff..cc6884027 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDTOBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusDT [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs index 7c0a2e9f0..4cc36f820 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithFromToInputBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToInputBase : SfsStoreD [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs index b10259de3..1285007db 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusInputBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus [Display(Name = "推荐仓库")] public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs index b3e0870be..ce905ac06 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithFromToInputBase.cs @@ -79,12 +79,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToInputBase : SfsStoreDet [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs index c019b0583..f27d709cd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/Inputs/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusInputBase.cs @@ -81,12 +81,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusIn [Display(Name = "推荐仓库")] public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - [Display(Name = "计量单位")] - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs index 791a05915..027134838 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs @@ -42,15 +42,7 @@ public interface IPurchaseReceiptJobAppService Task> SetInspectWithNotInspectAsync(Guid id); /// - /// 按Id获取实体 不走缓存 - /// - /// 实体Id - /// - /// - Task GetNoCacheAsync(Guid id); - - /// - /// 根据收货编号获取收货任务 + /// 根据供应商编号获取收货任务 /// /// Task> GetListBySupplierCodeOnTodayAsync(string supplierCode); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs index 8afa8d50b..f785c718e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/CountNotes/Inputs/CountNoteImportInput.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -39,6 +40,13 @@ public class CountNoteImportInput : SfsStoreImportInputBase [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] public string PackingCode { get; set; } + /// + /// 库存状态 + /// + [Display(Name = "库存状态")] + [Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)] + public EnumInventoryStatus Status { get; set; } + /// /// 托码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs index eb39e36ee..b0aab9524 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs @@ -1,4 +1,9 @@ +using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Shared.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -9,4 +14,25 @@ public interface IDeliverNoteAppService : Task CreateWithL7Async(DeliverNoteEditInput input); + Task> GetForFisListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + Task> GetForNormalListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + Task> GetForRAWListAsync( + SfsStoreRequestInputBase sfsRequestDTO, + bool includeDetails = false, + CancellationToken cancellationToken = default); + + + Task ExportForNormalAsync(SfsStoreRequestInputBase requestInput); + + Task ExportForRAWAsync(SfsExportRequestInput requestInput); + + Task SumPrintAsync(string number); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs index 8a4425a1e..426677c67 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductRecycleNotes/IProductRecycleNoteAppService.cs @@ -7,5 +7,4 @@ public interface IProductRecycleNoteAppService : { Task CreateAsync(ProductRecycleNoteEditInput input); - Task CreateWithL7Async(ProductRecycleNoteEditInput input); } 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/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs index c3d4b92a8..a0a9ec797 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Orders/PurchaseOrders/Inputs/PurchaseOrderImportInput.cs @@ -20,12 +20,14 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// [Display(Name = "采购订单号")] [Key] + [Required(ErrorMessage = "{0}是必填项")] public string Number { get; set; } /// /// 供应商代码 /// [Display(Name = "供应商代码")] + [Required(ErrorMessage = "{0}是必填项")] public string SupplierCode { get; set; } /// @@ -52,6 +54,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 订单日期 /// [Display(Name = "订单日期")] + [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "订单日期", Format = "yyyy/MM/dd")] [ExporterHeader(DisplayName = "订单日期", Format = "yyyy/MM/dd")] public DateTime OrderDate { get; set; } @@ -60,6 +63,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 截止日期 /// [Display(Name = "截止日期")] + [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "截止日期", Format = "yyyy/MM/dd")] [ExporterHeader(DisplayName = "截止日期", Format = "yyyy/MM/dd")] public DateTime DueDate { get; set; } @@ -81,18 +85,21 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 仓库代码 /// [Display(Name = "仓库代码")] + [Required(ErrorMessage = "{0}是必填项")] public string WarehouseCode { get; set; } /// /// 明细-订单行 /// [Display(Name = "明细-订单行")] + [Required(ErrorMessage = "{0}是必填项")] public string PoLine { get; set; } /// /// 明细-物品代码 /// [Display(Name = "明细-物品代码")] + [Required(ErrorMessage = "{0}是必填项")] public string ItemCode { get; set; } /// @@ -106,6 +113,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 数量计量单位 /// [Display(Name = "明细-数量计量单位")] + [Required(ErrorMessage = "{0}是必填项")] public string Uom { get; set; } /// @@ -126,6 +134,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 明细-供应商包装单位 /// [Display(Name = "明细-供应商包装单位")] + [Required(ErrorMessage = "{0}是必填项")] public string SupplierPackUom { get; set; } /// @@ -146,12 +155,14 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 筹措员代码 /// [Display(Name = "明细-筹措员代码")] + [Required(ErrorMessage = "{0}是必填项")] public string PlanUserCode { get; set; } /// /// 生产批次 /// [Display(Name = "明细-生产批次")] + [Required(ErrorMessage = "{0}是必填项")] public string Lot { get; set; } /// @@ -182,6 +193,7 @@ public class PurchaseOrderImportInput : SfsStoreImportInputBase /// 过期时间 /// [Display(Name = "明细-过期时间")] + [Required(ErrorMessage = "{0}是必填项")] public DateTime ExpireDate { get; set; } /// 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/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs index 09f948138..b91d9c807 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/Inputs/ProductReceiptRequestEditInput.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -70,7 +71,7 @@ public class ProductReceiptRequestEditInput : SfsStoreRequestCreateOrUpdateInput /// 类型 /// [Display(Name = "类型")] - public string EnumProductReceiptType { get; set; } + public EnumProductReceiptType Type { get; set; } /// /// 明细列表 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/CountJobs/CountJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs index 60673f7ac..f2b69f2c0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/CountJobs/CountJobAppService.cs @@ -71,6 +71,7 @@ public class CountJobAppService throw new AbpValidationException(result.Errors); } var entity = ObjectMapper.Map(dto); + entity.Number = checkEntity.Number; await _countJobManager.CompleteAsync(entity, CurrentUser).ConfigureAwait(false); return dto; } 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 a72b629b6..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 @@ -22,31 +22,21 @@ public class PurchaseReceiptJobAppService : , IPurchaseReceiptJobAppService { private readonly IFileAppService _fileAppService; - private readonly IInspectJobManager _inspectJobManager; - private readonly IInspectRequestAppService _inspectRequestAppService; private readonly IPurchaseReceiptJobManager _purchaseReceiptJobManager; - private readonly IPurchaseReceiptNoteAppService _purchaseReceiptNoteAppService; /// /// /// - /// /// /// - /// /// public PurchaseReceiptJobAppService(IPurchaseReceiptJobRepository repository, - IInspectJobManager inspectJobManager, IPurchaseReceiptJobManager purchaseReceiptJobManager, IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, - IInspectRequestAppService inspectRequestAppService, IFileAppService fileAppService) : base(repository, purchaseReceiptJobManager) { _purchaseReceiptJobManager = purchaseReceiptJobManager; - _purchaseReceiptNoteAppService = purchaseReceiptNoteAppService; - _inspectRequestAppService = inspectRequestAppService; _fileAppService = fileAppService; - _inspectJobManager = inspectJobManager; } #region 东阳使用 @@ -151,27 +141,28 @@ public class PurchaseReceiptJobAppService : var dict = await _fileAppService.CreateManyHasDictAsync(input.FilesList).ConfigureAwait(false); detail.InspectPhotoJson = JsonSerializer.Serialize(dict); } - - if (detail != null) + else { - detail.FailedReason = input.FailedReason; - detail.MassDefect = input.MassDefect; - detail.PurchaseReceiptInspectStatus = input.PurchaseReceiptInspectStatus; - detail.HandledLot = detail.RecommendLot; - detail.HandledSupplierBatch = detail.RecommendSupplierBatch; - detail.HandledArriveDate = detail.RecommendArriveDate; - detail.HandledProduceDate = detail.RecommendProduceDate; - detail.HandledExpireDate = detail.RecommendExpireDate; - detail.HandledToLocationArea=detail.RecommendToLocationArea; - detail.HandledToLocationGroup=detail.RecommendToLocationGroup; - detail.HandledContainerCode = detail.RecommendContainerCode; - detail.HandledToLocationCode = detail.RecommendToLocationCode; - detail.HandledToLocationErpCode = detail.RecommendToLocationErpCode; - detail.HandledToWarehouseCode = detail.RecommendToWarehouseCode; - detail.HandledPackingCode = detail.RecommendPackingCode; - detail.HandledQty = detail.RecommendQty; + detail.InspectPhotoJson = string.Empty; } + detail.FailedReason = input.FailedReason; + detail.MassDefect = input.MassDefect; + detail.PurchaseReceiptInspectStatus = input.PurchaseReceiptInspectStatus; + detail.HandledLot = detail.RecommendLot; + detail.HandledSupplierBatch = detail.RecommendSupplierBatch; + detail.HandledArriveDate = detail.RecommendArriveDate; + detail.HandledProduceDate = detail.RecommendProduceDate; + detail.HandledExpireDate = detail.RecommendExpireDate; + detail.HandledToLocationArea = detail.RecommendToLocationArea; + detail.HandledToLocationGroup = detail.RecommendToLocationGroup; + detail.HandledContainerCode = detail.RecommendContainerCode; + detail.HandledToLocationCode = detail.RecommendToLocationCode; + detail.HandledToLocationErpCode = detail.RecommendToLocationErpCode; + detail.HandledToWarehouseCode = detail.RecommendToWarehouseCode; + detail.HandledPackingCode = detail.RecommendPackingCode; + detail.HandledQty = detail.RecommendQty; + var entity = await _repository.UpdateAsync(job).ConfigureAwait(false); return ObjectMapper.Map( @@ -182,7 +173,6 @@ public class PurchaseReceiptJobAppService : /// 按Id获取实体 不走缓存 /// /// 实体Id - /// /// [HttpGet("no-cache/{id}")] public virtual async Task GetNoCacheAsync(Guid id) @@ -191,24 +181,10 @@ public class PurchaseReceiptJobAppService : return ObjectMapper.Map(entity); } - /// - /// 根据供应商编号获取收货任务 - /// - /// - [HttpPost("get-by-supplier-code-on-today/{supplierCode}")] - public virtual async Task> GetListBySupplierCodeOnTodayAsync(string supplierCode) - { - var purchaseReceiptJobs = await _repository.GetListAsync(p => - p.SupplierCode == supplierCode && - p.PlanArriveDate.Year == DateTime.Now.Year && - p.PlanArriveDate.Month == DateTime.Now.Month && - p.PlanArriveDate.Day == DateTime.Now.Day); - var dto = ObjectMapper.Map, List>(purchaseReceiptJobs); - return dto; - } #endregion /// + /// 取消收货 /// /// [HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")] @@ -222,6 +198,37 @@ public class PurchaseReceiptJobAppService : } } + /// + /// 根据供应商编号获取收货任务 + /// + /// + [HttpPost("get-by-supplier-code-on-today/{supplierCode}")] + public virtual async Task> GetListBySupplierCodeOnTodayAsync(string supplierCode) + { + var purchaseReceiptJobs = await _repository.GetListAsync(p => + p.SupplierCode == supplierCode && + p.PlanArriveDate.Year == DateTime.Now.Year && + p.PlanArriveDate.Month == DateTime.Now.Month && + p.PlanArriveDate.Day == DateTime.Now.Day).ConfigureAwait(false); + var dto = ObjectMapper.Map, List>(purchaseReceiptJobs); + return dto; + } + + ///// + ///// 取消请求 + ///// + ///// + //[HttpPost("cancel-by-request/{purchaseReceiptRequestNumber}")] + //public virtual async Task CancelByPurchaseReceiptRequestAsync(string purchaseReceiptRequestNumber) + //{ + // var entities = await _repository + // .GetListAsync(p => p.PurchaseReceiptRequestNumber == purchaseReceiptRequestNumber).ConfigureAwait(false); + // foreach (var entity in entities) + // { + // await _purchaseReceiptJobManager.CancelAsync(entity).ConfigureAwait(false); + // } + //} + /* /// /// 承接收货任务 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs index 26971205d..a1529c8b5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountAdjustNotes/CountAdjustNoteAutoMapperProfile.cs @@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs index 015825e1f..278f8a52c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs @@ -1,11 +1,15 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Domain.Repositories; +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.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -25,16 +29,80 @@ public class CountNoteAppService : { private readonly ICountNoteManager _countNoteManager; private readonly ICountPlanAppService _countPlanAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public CountNoteAppService( ICountNoteRepository repository, - ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService) : base(repository) + ICountNoteManager countNoteManager, ICountPlanAppService countPlanAppService, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository) { _countNoteManager = countNoteManager; _countPlanAppService = countPlanAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } + #region 东阳 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var dataList = dictionary.Select(p => p.Key);//查询所有的导入盘点数据 + var resultDictionary = new Dictionary(); + + var allCountPlanNumbersList= dataList.GroupBy(p => p.CountPlanNumber).Select(p => p.Key).ToList(); + //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录 + foreach (var countPlanNumber in allCountPlanNumbersList) + { + var countPlanDto = await _countPlanAppService.GetByNumberAsync(countPlanNumber).ConfigureAwait(false); + if (countPlanDto.RequestType != CountPlanRequestType.Import) + { + throw new UserFriendlyException("非Excel盘点执行方式不能使用导入"); + } + await _repository.DeleteAsync(p => p.CountPlanNumber == countPlanNumber).ConfigureAwait(false); + } + + foreach (var countNote in dataList) + { + countNote.Worker = CurrentUser.GetUserName(); + countNote.CreatorId = CurrentUser.Id; + countNote.BeginTime= DateTime.Now; + countNote.Adjusted = false; + countNote.EndTime=DateTime.Now; + countNote.Stage = EnumCountStage.Audit; + + foreach (var detail in countNote.Details) + { + var locationDto= await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + var itemcBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + + detail.CountLabel =Guid.NewGuid().ToString(); + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup= locationDto.LocationGroupCode; + detail.LocationErpCode= locationDto.ErpLocationCode; + detail.WarehouseCode= locationDto.WarehouseCode; + + detail.ItemCode = itemcBasicDto.Code; + detail.ItemDesc1 = itemcBasicDto.Desc1; + detail.ItemDesc2 = itemcBasicDto.Desc2; + detail.ItemName= itemcBasicDto.Name; + detail.Uom = itemcBasicDto.BasicUom; + } + + resultDictionary.Add(countNote,EntityState.Added); + } + + return resultDictionary; + } + + #endregion + /// /// 新增接口 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs index ebeda8f63..fb83ae1ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAutoMapperProfile.cs @@ -69,7 +69,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Adjusted) .Ignore(X => X.StdPackQty) .Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) - .Ignore(x => x.Status) .Ignore(x => x.SupplierBatch) .Ignore(x => x.ArriveDate) .Ignore(x => x.ProduceDate) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs index ea96420d5..af6df5643 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/IssueNotes/IssueNoteAppService.cs @@ -8,7 +8,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -50,9 +52,11 @@ public class IssueNoteAppService : [HttpPost("confirm/{id}")] public virtual async Task ConfirmAsync(Guid id) { - var entity = await _issueNoteManager.ConfirmAsync(id).ConfigureAwait(false); - var dto = ObjectMapper.Map(entity); - return dto; + var issueNote= await _repository.GetAsync(id).ConfigureAwait(false); + issueNote.Confirmed = true; + issueNote=await _repository.UpdateAsync(issueNote).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsConfirmedEntityEventData(issueNote), false).ConfigureAwait(false); + return ObjectMapper.Map(issueNote); } [HttpPost("confirm-by-number/{number}")] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs index 8180238fa..0d361afa1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAppService.cs @@ -12,7 +12,7 @@ namespace Win_in.Sfs.Wms.Store.Application; /// 回收料调整记录 /// [Authorize] -[Route($"{StoreConsts.RootPath}item-transfrom-note")] +[Route($"{StoreConsts.RootPath}item-transform-note")] public class ItemTransformNoteAppService : SfsStoreWithDetailsAppServiceBase, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs index c26dee52a..341d1b2ac 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ItemTransformNotes/ItemTransformNoteAutoMapperProfile.cs @@ -22,5 +22,15 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x=>x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs index 36e876a07..db384ee8f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductRecycleNotes/ProductRecycleNoteAppService.cs @@ -54,23 +54,6 @@ public class ProductRecycleNoteAppService : return dto; } - /// - /// 新增退货接口 - /// - /// - /// - [HttpPost("create-with-l7")] - public virtual async Task CreateWithL7Async(ProductRecycleNoteEditInput input) - { - var entity = ObjectMapper.Map(input); - - await _productRecycleNoteManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - - return dto; - } - [HttpGet("note-and-back-flush/{id}")] public virtual async Task GetNoteAndBackFlushAsync(Guid id) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs index 302071a0f..35db79092 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ProductionReturnNotes/ProductionReturnNoteAppService.cs @@ -28,7 +28,7 @@ public class ProductionReturnNoteAppService : } /// - /// 新增接口 + /// 新增实体 /// /// /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs index ad717ec51..ba42b49cf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs @@ -1,6 +1,11 @@ using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; +using FluentValidation.Validators; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +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; @@ -22,24 +27,54 @@ public class RecycledMaterialReceiptNoteAppService : { private readonly IRecycledMaterialReceiptNoteManager _RecycledMaterialReceiptNoteManager; private readonly ILocationCapacityAppService _locationCapacityAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public RecycledMaterialReceiptNoteAppService(IRecycledMaterialReceiptNoteRepository repository, IRecycledMaterialReceiptNoteManager RecycledMaterialReceiptNoteManager, - ILocationCapacityAppService locationCapacityAppService) : base(repository) + ILocationCapacityAppService locationCapacityAppService, + ILocationAppService locationAppService, + IItemBasicAppService itemBasicAppService) : base(repository) { _RecycledMaterialReceiptNoteManager = RecycledMaterialReceiptNoteManager; _locationCapacityAppService = locationCapacityAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } + /// + /// 新增实体 + /// + /// CreateInput [HttpPost("")] - //[Authorize(RecycledMaterialReceiptNotePermissions.Create)] public override async Task CreateAsync(RecycledMaterialReceiptNoteEditInput input) { - var entity = ObjectMapper.Map(input); - await _RecycledMaterialReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false); + var entity= ObjectMapper.Map(input); - var dto = ObjectMapper.Map(entity); + entity.Number=string.IsNullOrEmpty(input.Number) + ? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false) + : input.Number; - return dto; + foreach (var detail in entity.Details) + { + var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false); + detail.Number=detailNumber; + var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + detail.LocationErpCode = locationDto.ErpLocationCode; + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup = locationDto.LocationGroupCode; + detail.WarehouseCode=locationDto.WarehouseCode; + var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.StdPackQty = itemBasicDto.StdPackQty; + detail.Uom = itemBasicDto.BasicUom; + } + + entity=await _repository.InsertAsync(entity).ConfigureAwait(false); + + await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(entity),false).ConfigureAwait(false); + + return ObjectMapper.Map(entity); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs index edd59fb19..35ee6a020 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs @@ -22,5 +22,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap< RecycledMaterialReceiptNoteEditInput,RecycledMaterialReceiptNote > () + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .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/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs index 1880e6110..0733dd99a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAutoMapperProfile.cs @@ -21,5 +21,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + ; } } 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 8c91beb97..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 @@ -3,23 +3,15 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; -using DocumentFormat.OpenXml.Office2010.ExcelAc; -using DocumentFormat.OpenXml.Spreadsheet; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; -using Volo.Abp.Uow; -using Volo.Abp.Users; using Win_in.Sfs.Basedata.Application.Contracts; -using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; -using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; -using PurchaseOrderDetail = Win_in.Sfs.Wms.Store.Domain.PurchaseOrderDetail; namespace Win_in.Sfs.Wms.Store.Application; @@ -34,7 +26,7 @@ public class PurchaseOrderAppService : private readonly IPurchaseOrderManager _purchaseOrderManager; private readonly ISupplierAppService _supplierAppService; private readonly IItemBasicAppService _itemBasicAppService; - + public PurchaseOrderAppService( IPurchaseOrderRepository repository, IPurchaseOrderManager purchaseOrderManager, @@ -53,30 +45,31 @@ public class PurchaseOrderAppService : #region 东阳使用 /// - /// 用来重写 导入数据时可以加工数据 + /// 用来重写 导入数据时可以加工数据 /// /// /// protected override async Task> ImportProcessingEntityAsync( Dictionary dictionary) { - var addList= dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); foreach (var purchaseOrder in addList) { purchaseOrder.CreatorId = CurrentUser.Id; purchaseOrder.Worker = CurrentUser.Name; - var supplierDto=await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); + var supplierDto = + await _supplierAppService.GetByCodeAsync(purchaseOrder.SupplierCode).ConfigureAwait(false); purchaseOrder.SupplierCode = supplierDto.Code; purchaseOrder.SupplierAddress = supplierDto.Address; - purchaseOrder.SupplierName= supplierDto.Name; + purchaseOrder.SupplierName = supplierDto.Name; foreach (var detail in purchaseOrder.Details) { - var itemBasicDto= await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - detail.ItemName= itemBasicDto.Name; + detail.ItemName = itemBasicDto.Name; detail.ItemDesc1 = itemBasicDto.Desc1; detail.ItemDesc2 = itemBasicDto.Desc2; } @@ -87,10 +80,8 @@ public class PurchaseOrderAppService : #endregion - - /// - /// 【创建】采购订单 + /// 【创建】采购订单 /// /// /// @@ -111,7 +102,7 @@ public class PurchaseOrderAppService : } /// - /// 【批量创建】采购订单 + /// 【批量创建】采购订单 /// /// /// @@ -163,8 +154,6 @@ public class PurchaseOrderAppService : await _repository.UpdateAsync(entity).ConfigureAwait(false); } - #region Function - [HttpPost("complete/{number}")] public async Task CompleteAsync(string number) { @@ -173,9 +162,6 @@ public class PurchaseOrderAppService : } [HttpPost("cancel/{id}")] - - #endregion - [HttpPost("{id}/detail/open/{detailId}")] public virtual async Task OpenDetailAsync(Guid id, Guid detailId) { @@ -188,13 +174,6 @@ public class PurchaseOrderAppService : await _purchaseOrderManager.CloseDetailAsync(id, detailId).ConfigureAwait(false); } - [HttpPost("check-status")] - public virtual async Task CheckStatusAsync(string number) - { - await Task.CompletedTask.ConfigureAwait(false); - throw new NotImplementedException(); - } - [HttpPost("upsert")] public virtual async Task UpsertAsync(PurchaseOrderEditInput input) { @@ -202,6 +181,27 @@ public class PurchaseOrderAppService : await _repository.UpsertAsync(entity).ConfigureAwait(false); } + + [HttpGet("get-list-by-item-code")] + public virtual async Task> GetListByItemCodeAsync(string itemCode) + { + var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) + .ConfigureAwait(false); + + var dtos = ObjectMapper.Map, List>(entitys); + + return dtos; + } + + #region 校验 + + [HttpPost("check-status")] + public virtual async Task CheckStatusAsync(string number) + { + await Task.CompletedTask.ConfigureAwait(false); + throw new NotImplementedException(); + } + protected virtual async Task CheckImportInputBusinessAsync(PurchaseOrderImportInput importInput, EnumImportMethod importMethod, List validationRresult) { @@ -231,47 +231,17 @@ public class PurchaseOrderAppService : Check.NotNull(item, "供应商代码", "供应商不存在"); } - protected override async Task GetEntityAsync(PurchaseOrderImportInput importInput) - { - return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false); - } - - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - - protected override Func GetEntityExpression() - { - return t => t.Number; - } - - [HttpGet("get-list-by-item-code")] - public virtual async Task> GetListByItemCodeAsync(string itemCode) - { - var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode)) - .ConfigureAwait(false); - - var dtos = ObjectMapper.Map, List>(entitys); - - return dtos; - } + #endregion [HttpGet("get-list-by-supplier-code-and-item-code")] public virtual async Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode) { - var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode); - - List list = new List(); + var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode).ConfigureAwait(false); - foreach (var entity in entitys) - { - var purchaseOrder = await _repository.GetAsync(entity.Id); - list.Add(purchaseOrder); - } - - var dtos = ObjectMapper.Map, List>(list); + var dtos = ObjectMapper.Map, List>(entitys); return dtos; } + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs index 597a98ee4..de9cea2ea 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAppService.cs @@ -106,7 +106,7 @@ public class CountPlanAppService : public virtual async Task UpdateByJobAsync(CountPlanEditInput input) { var entity = ObjectMapper.Map(input); - + entity.Number = input.Number; await _countPlanManager.CompleteByJobAsync(entity).ConfigureAwait(false); } @@ -121,23 +121,6 @@ public class CountPlanAppService : await _countPlanManager.CompleteAsync(id, type).ConfigureAwait(false); } - /* - /// - /// 校正库存 - /// - /// - /// - [HttpPost("adjust/{id}")] - public virtual async Task AdjustAsync(Guid id) - { - - var entity = await _repository.FindAsync(id); - Check.NotNull(entity, EntityClassName); - - await _countPlanManager.AdjustAsync(entity); - - } - */ [HttpPost("check-status")] public virtual async Task CheckStatusAsync(string number) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs index 060a9b36a..fbac04195 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/CountPlans/CountPlanAutoMapperProfile.cs @@ -39,5 +39,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.Remark) + ; } } 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/CountAdjustRequests/CountAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs index c0a9e3222..9f4dece77 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/CountAdjustRequests/CountAdjustRequestAppService.cs @@ -25,22 +25,4 @@ public abstract class CountAdjustRequestAppService : { _countAdjustRequestManager = countAdjustRequestManager; } - - /// - /// 【创建】盘点调整申请 - /// - /// - /// - [HttpPost("")] - //[Authorize(CountAdjustRequestPermissions.Create)] - public override async Task CreateAsync(CountAdjustRequestEditInput input) - { - var entity = ObjectMapper.Map(input); - - await _countAdjustRequestManager.CreateAsync(entity).ConfigureAwait(false); - - var dto = ObjectMapper.Map(entity); - return dto; - } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 439657791..9f59ab043 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Win_in.Sfs.Basedata.Application.Contracts; @@ -29,7 +30,6 @@ public class DeliverRequestAppService : { private readonly IDeliverRequestManager _deliverRequestManager; private readonly IAreaAppService _areaApp; - private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs index 5dd549d4c..484fe8dfb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Data; @@ -32,22 +33,97 @@ public class DeliverRequestFisAppService : private readonly IAreaAppService _areaApp; private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; + private readonly ITransactionTypeAppService _transactionTypeAppService; + private readonly IBalanceAppService _balanceAppService; + private readonly IItemBasicAppService _itemBasicAppService; public DeliverRequestFisAppService( IDeliverRequestRepository repository, IDeliverRequestManager deliverRequestManager, IAreaAppService areaApp, ICustomerAppService customerApp, - ICustomerAddressAppService customerAddressApp - ) + ICustomerAddressAppService customerAddressApp, + ITransactionTypeAppService transactionTypeAppService, + IBalanceAppService balanceAppService, + IItemBasicAppService itemBasicAppService) : base(repository, deliverRequestManager) { _deliverRequestManager = deliverRequestManager; _areaApp = areaApp; _customerApp = customerApp; _customerAddressApp = customerAddressApp; + _transactionTypeAppService = transactionTypeAppService; + _balanceAppService = balanceAppService; + _itemBasicAppService = itemBasicAppService; } + #region 东阳 + + private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.Deliver_FIS).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + entity.DeliverRequestType = EnumDeliverRequestType.FIS; + } + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var itemTransformRequest in addList) + { + itemTransformRequest.Worker = CurrentUser.GetUserName(); + itemTransformRequest.CreatorId = CurrentUser.Id; + itemTransformRequest.DeliverRequestType = EnumDeliverRequestType.FIS; + await SetRequestAutoPropertiesAsync(itemTransformRequest).ConfigureAwait(false); + foreach (var detail in itemTransformRequest.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var transactionType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Deliver, + EnumTransSubType.Deliver_FIS) + .ConfigureAwait(false); + + var balances = await _balanceAppService.GetRecommendBalancesAsync( + new RecommendBalanceRequestInput() + { + ItemCode = itemBasicDto.Code, + Qty = detail.Qty, + LocationTypes = transactionType.OutLocationTypes, + LocationAreas = new List() { detail.AreaCode }, + Statuses = transactionType.OutInventoryStatuses + }).ConfigureAwait(false); + + var balanceSumQty = balances.Sum(t => t.Qty); + + if (balanceSumQty < detail.Qty) + { + throw new UserFriendlyException($"物料号 {detail.ItemCode} " + + $"在库位类型 {transactionType.OutLocationTypes.JoinAsString(",")}," + + $"库区 {detail.AreaCode} " + + $"状态 {transactionType.OutInventoryStatuses.JoinAsString(",")}" + + $"库存余额 {balanceSumQty} 小于 {detail.Qty}。"); + } + + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2 = itemBasicDto.Desc2; + detail.ItemName = itemBasicDto.Name; + detail.Uom = itemBasicDto.BasicUom; + + } + } + + return dictionary; + } + + #endregion + [HttpPost("list")] public override Task> GetPagedListByFilterAsync( SfsStoreRequestInputBase sfsRequestInput, @@ -55,7 +131,7 @@ public class DeliverRequestFisAppService : CancellationToken cancellationToken = default) { sfsRequestInput.Condition.Filters.Add( - new Filter(nameof(DeliverRequest.DeliverRequestType), "2")); + new Filter(nameof(DeliverRequest.DeliverRequestType), "FIS")); return base.GetPagedListByFilterAsync(sfsRequestInput, includeDetails, cancellationToken); } @@ -285,19 +361,7 @@ public class DeliverRequestFisAppService : await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); } - private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.Deliver_FIS).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - entity.DeliverRequestType = EnumDeliverRequestType.FIS; - } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs index a0479d957..647f38610 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ItemTransformRequests/ItemTransformRequestAppService.cs @@ -6,10 +6,13 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Label.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; @@ -20,7 +23,7 @@ namespace Win_in.Sfs.Wms.Store.Application; /// 回收料调整申请 /// [Authorize] -[Route($"{StoreConsts.RootPath}item-transfrom-request")] +[Route($"{StoreConsts.RootPath}item-transform-request")] public class ItemTransformRequestAppService : SfsStoreRequestAppServiceBase, IItemTransformRequestAppService @@ -29,14 +32,17 @@ public class ItemTransformRequestAppService : private readonly IItemTransformRequestManager _manager; private readonly IInventoryLabelAppService _inventoryLabelAppService; + private readonly IBalanceAppService _balanceAppService; public ItemTransformRequestAppService( - IItemTransformRequestRepository repository - , IItemTransformRequestManager manager, - IInventoryLabelAppService inventoryLabelAppService) : base(repository, manager) + IItemTransformRequestRepository repository, + IItemTransformRequestManager manager, + IInventoryLabelAppService inventoryLabelAppService, + IBalanceAppService balanceAppService) : base(repository, manager) { _manager = manager; _inventoryLabelAppService = inventoryLabelAppService; + _balanceAppService = balanceAppService; } /// @@ -57,6 +63,52 @@ public class ItemTransformRequestAppService : return dto; } + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var itemTransformRequest in addList) + { + itemTransformRequest.Worker = CurrentUser.GetUserName(); + itemTransformRequest.CreatorId = CurrentUser.Id; + foreach (var detail in itemTransformRequest.Details) + { + var fromLocationDto= await LocationAclService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto= await LocationAclService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var itemBasicDto=await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + var balanceDto= await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, detail.ItemCode, + detail.FromLocationCode).ConfigureAwait(false); + + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromLocationErpCode = fromLocationDto.ErpLocationCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + + detail.FromSupplierBatch = balanceDto.SupplierBatch; + detail.FromLot = balanceDto.Lot; + detail.FromStatus = balanceDto.Status; + + detail.ToSupplierBatch = string.Empty; + detail.ToLot = balanceDto.Lot; + detail.ToStatus = balanceDto.Status; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + + detail.ItemDesc1 = itemBasicDto.Desc1; + detail.ItemDesc2= itemBasicDto.Desc2; + detail.ItemName= itemBasicDto.Name; + detail.Uom = itemBasicDto.BasicUom; + } + } + + return dictionary; + + + } + protected virtual async Task ImportDataAsync(List entites, List deleteEntities) { await _manager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs index d7f3a3545..7a3ddd00b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs @@ -42,7 +42,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase HandleAsync(Guid id) @@ -170,19 +172,35 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase(input); + foreach (var detail in entity.Details) + { + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var productionLineDto = await _productionLineAppService.GetByLocationGroupCodeAsync(toLocationDto.LocationGroupCode).ConfigureAwait(false); + + detail.ToLocationArea= toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode= toLocationDto.WarehouseCode; + } + + entity.UseOnTheWayLocation = true; var result = await _materialRequestManager.CreateBynNumberAsync(entity).ConfigureAwait(false); @@ -372,7 +390,7 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase CheckItemBasicAsync(MaterialRequestImportInput importInput, List validationRresult) { - var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); + var item = await _itemBasicAppService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) { validationRresult.Add(new ValidationResult($"物品代码{importInput.ItemCode}不存在", new[] { "物品代码" })); 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 5a388cefe..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 @@ -6,12 +6,14 @@ using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using DocumentFormat.OpenXml.Office.CustomUI; +using FluentValidation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -84,7 +86,6 @@ public class ProductReceiptRequestAppService : /// 赋值详情 /// /// - /// /// private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail) { @@ -176,7 +177,12 @@ public class ProductReceiptRequestAppService : bool includeDetails = false, CancellationToken cancellationToken = default) { - Expression> expression = p => p.Type.ToString() == type; + if (!EnumProductReceiptType.TryParse(type, true, out EnumProductReceiptType enumType)) + { + throw new AbpValidationException($"type {type} is not valid"); + } + + Expression> expression = p => p.Type == enumType; if (requestInput.Condition.Filters?.Count > 0) { expression = expression.And(requestInput.Condition.Filters.ToLambda()); 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 c974a01d1..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 @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -17,6 +18,7 @@ namespace Win_in.Sfs.Wms.Store.Application; using System.ComponentModel.DataAnnotations; using Volo.Abp.Data; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Application.Contracts; @@ -27,23 +29,34 @@ using Win_in.Sfs.Wms.Inventory.Application.Contracts; [Route($"{StoreConsts.RootPath}product-recycle-request")] public class ProductRecycleRequestAppService : - SfsStoreRequestAppServiceBase, + SfsStoreRequestAppServiceBase, IProductRecycleRequestAppService { private readonly IProductRecycleRequestManager _productRecycleRequestManager; private readonly IBomAppService _bomApp; private readonly IItemStoreRelationAppService _itemStoreRelationApp; + private readonly IBalanceAppService _balanceAppService; + private readonly ILocationAppService _locationAppService; + private readonly ITransactionTypeAppService _transactionTypeAppService; public ProductRecycleRequestAppService( IProductRecycleRequestRepository repository, IProductRecycleRequestManager productRecycleRequestManager, IBomAppService bomApp, - IItemStoreRelationAppService itemStoreRelationApp) + IItemStoreRelationAppService itemStoreRelationApp, + ILocationAppService locationAppService, + IBalanceAppService balanceAppService, + ITransactionTypeAppService transactionTypeAppService) : base(repository, productRecycleRequestManager) { _productRecycleRequestManager = productRecycleRequestManager; _bomApp = bomApp; _itemStoreRelationApp = itemStoreRelationApp; + _locationAppService = locationAppService; + _balanceAppService = balanceAppService; + _transactionTypeAppService = transactionTypeAppService; base.CreatePolicyName = ProductRecycleRequestPermissions.Create; base.UpdatePolicyName = ProductRecycleRequestPermissions.Update; @@ -75,6 +88,100 @@ public class ProductRecycleRequestAppService : throw new NotImplementedException(); } + #region 东阳 + + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var productRecycleRequest in addList) + { + await SetRequestAutoPropertiesAsync(productRecycleRequest) + .ConfigureAwait(false); + productRecycleRequest.Worker = CurrentUser.GetUserName(); + + foreach (var detail in productRecycleRequest.Details) + { + var balance = await _balanceAppService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.Status = balance.Status; + } + + var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode) + .ConfigureAwait(false); + + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); + } + } + + return dictionary; + } + + private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) + { + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + private async Task SetDetailPropertiesAsync( + ProductRecycleRequestDetail detail) + { + var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + if (item != null) + { + detail.ItemName = item.Name; + detail.ItemDesc1 = item.Desc1; + detail.ItemDesc2 = item.Desc2; + detail.Uom = item.BasicUom; + detail.Qty = detail.Qty; + } + + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + + if (location != null) + { + detail.LocationErpCode = location.ErpLocationCode; + detail.WarehouseCode = location.WarehouseCode; + detail.LocationGroup = location.LocationGroupCode; + detail.LocationArea = location.AreaCode; + } + + var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); + + if (rawLocation != null) + { + detail.RawLocationErpCode = rawLocation.ErpLocationCode; + detail.RawWarehouseCode = rawLocation.WarehouseCode; + detail.RawLocationArea = rawLocation.AreaCode; + detail.RawLocationGroup = rawLocation.LocationGroupCode; + } + + var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.Status = balance.Status; + } + } + + #endregion + #region Import protected virtual async Task CheckImportInputBusinessAsync(ProductRecycleRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) @@ -202,147 +309,6 @@ public class ProductRecycleRequestAppService : return boms; } - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _productRecycleRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - - protected override Func GetEntityExpression() - { - return p => 1; - } - - protected virtual async Task<(List entites, List deleteEntities)> BuildImportDataAsync(ImportResult importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) - { - if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - if (!isAllowPartImport) - { - return (null, null); - } - } - - var entites = new List(); - - var details = new List(); - - var deleteEntites = new List(); - - var entityExpression = GetEntityExpression(); - - var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList(); - - foreach (var group in groupList) - { - var input = group.FirstOrDefault(); - - var inputDetails = group.ToList(); - - if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - var exist = await GetEntityAsync(input).ConfigureAwait(false); - - var entity = ObjectMapper.Map(input); - - await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); - - switch (importMethod) - { - case EnumImportMethod.Update: - if (exist != null) - { - entity.SetId(exist.Id); - } - break; - case EnumImportMethod.Replace: - if (exist != null) - { - deleteEntites.Add(exist); - } - break; - } - - foreach (var inputDetail in inputDetails) - { - var detail = ObjectMapper.Map(inputDetail); - - detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); - - await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); - entity.AddDetail(detail); - } - - entites.Add(entity); - } - } - - return (entites, deleteEntites); - } - - private async Task SetDetailPropertiesAsync( - ProductRecycleRequestDetail detail, - ProductRecycleRequestImportInput input) - { - var item = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - if (item != null) - { - detail.ItemName = item.Name; - detail.ItemDesc1 = item.Desc1; - detail.ItemDesc2 = item.Desc2; - detail.Qty = input.Qty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - } - - var rawLocation = await LocationAclService.GetByCodeAsync(detail.RawLocationCode).ConfigureAwait(false); - - if (rawLocation != null) - { - detail.RawLocationErpCode = rawLocation.ErpLocationCode; - detail.RawWarehouseCode = rawLocation.WarehouseCode; - } - - var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( - string.Empty, - detail.ItemCode, - input.LocationCode).ConfigureAwait(false); - - if (balance != null) - { - detail.Status = balance.Status; - } - - detail.SetProperty(nameof(input.PreStartTime), input.PreStartTime); - detail.SetProperty(nameof(input.WorkHour), input.WorkHour); - } - - private async Task SetEntityPropertiesAsync(ProductRecycleRequest entity, ProductRecycleRequestImportInput input) - { - entity.Worker = CurrentUser.GetUserName(); - - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } - - private async Task SetRequestAutoPropertiesAsync(ProductRecycleRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.ProductRecycle, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } - #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs index c180d8e1b..2b7f6a0d5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAppService.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -27,22 +28,25 @@ public class ProductionReturnRequestAppService : IProductionReturnRequestAppService { private readonly IProductionReturnRequestManager _productionReturnRequestManager; - private readonly IItemStoreRelationAppService _itemStoreRelationApp; - private readonly IPurchaseOrderAppService _purchaseOrderApp; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; public ProductionReturnRequestAppService( IProductionReturnRequestRepository repository, IProductionReturnRequestManager productionRequestReturnManager, IItemStoreRelationAppService itemStoreRelationApp, - IPurchaseOrderAppService purchaseOrderApp - ) + IPurchaseOrderAppService purchaseOrderApp, + IItemBasicAppService itemBasicAppService, + ILocationAppService locationAppService) : base(repository, productionRequestReturnManager) { _productionReturnRequestManager = productionRequestReturnManager; _itemStoreRelationApp = itemStoreRelationApp; _purchaseOrderApp = purchaseOrderApp; + _itemBasicAppService = itemBasicAppService; + _locationAppService = locationAppService; } /// @@ -62,6 +66,40 @@ public class ProductionReturnRequestAppService : return dto; } + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var productionReturnRequest in addList) + { + productionReturnRequest.Worker = CurrentUser.GetUserName(); + productionReturnRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(productionReturnRequest).ConfigureAwait(false); + foreach (var detail in productionReturnRequest.Details) + { + var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty=itemBasicDto.StdPackQty; + + var fromLocationDto= await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + + detail.FromLocationArea = fromLocationDto.AreaCode; + detail.FromWarehouseCode = fromLocationDto.WarehouseCode; + detail.FromLocationGroup = fromLocationDto.LocationGroupCode; + detail.FromLocationErpCode= fromLocationDto.ErpLocationCode; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToLocationErpCode = toLocationDto.ErpLocationCode; + } + } + + return dictionary; + } + #region import protected virtual async Task CheckImportInputBusinessAsync(ProductionReturnRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs index 1f074962d..18c6c170f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ProductionReturnRequests/ProductionReturnRequestAutoMapperProfile.cs @@ -20,7 +20,6 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() - .Ignore(x => x.ToWarehouseCode) .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) 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..d07e428e6 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 @@ -131,8 +131,10 @@ public class PurchaseReturnRequestAppService : /// /// 赋值详情 /// + /// /// /// + /// /// private async Task SetDetailPropertiesAsync( PurchaseReturnRequestDetail detail, @@ -268,7 +270,7 @@ public class PurchaseReturnRequestAppService : /// /// /// - /// + /// /// /// private static void CheckTransactionType( diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index a55992254..630967205 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs @@ -20,16 +20,189 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA { private readonly IDepartmentAppService _departmentApp; private readonly IUnplannedIssueRequestManager _unplannedIssueRequestManager; + private readonly IBalanceAppService _balanceAppService; + private readonly IDepartmentAppService _departmentAppService; public UnplannedIssueRequestForDongyangAppService(IUnplannedIssueRequestRepository repository, IUnplannedIssueRequestManager unplannedIssueRequestManager, - IDepartmentAppService departmentApp - ) : base(repository, unplannedIssueRequestManager) + IDepartmentAppService departmentApp, IBalanceAppService balanceAppService, IDepartmentAppService departmentAppService) : base(repository, unplannedIssueRequestManager) { _unplannedIssueRequestManager = unplannedIssueRequestManager; _departmentApp = departmentApp; + _balanceAppService = balanceAppService; + _departmentAppService = departmentAppService; } + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var unplannedIssueRequest in addList) + { + unplannedIssueRequest.Worker = CurrentUser.GetUserName(); + unplannedIssueRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + await SetEntityPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + + foreach (var detail in unplannedIssueRequest.Details) + { + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); + } + } + + return dictionary; + } + + #region 赋值 + + /// + /// 赋值详情 + /// + /// + /// + private async Task SetDetailPropertiesAsync(UnplannedIssueRequestDetail detail) + { + var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + if (itemBasic != null) + { + detail.ItemCode = itemBasic.Code; + detail.ItemName = itemBasic.Name; + detail.ItemDesc1 = itemBasic.Desc1; + detail.ItemDesc2 = itemBasic.Desc2; + + detail.StdPackQty = itemBasic.StdPackQty; + detail.Uom = itemBasic.BasicUom; + } + + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + + if (location != null) + { + detail.WarehouseCode = location.WarehouseCode; + detail.LocationErpCode = location.ErpLocationCode; + detail.LocationGroup = location.LocationGroupCode; + detail.LocationArea = location.AreaCode; + detail.LocationCode = location.Code; + } + + var balance = await _balanceAppService.GetByItemLocationAndPackingAsync( + string.Empty, + detail.ItemCode, + detail.LocationCode).ConfigureAwait(false); + + if (balance != null) + { + detail.SupplierBatch = balance.SupplierBatch; + detail.ArriveDate = balance.ArriveDate; + detail.ProduceDate = balance.ProduceDate; + detail.ExpireDate = balance.ExpireDate; + + detail.Lot = balance.Lot; + detail.ContainerCode = balance.ContainerCode; + detail.PackingCode = balance.PackingCode; + detail.Qty = balance.Qty; + detail.Status = balance.Status; + } + + //if (!string.IsNullOrEmpty(detail)) + //{ + // var dict = await DictAppService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); + + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode); + + // Check.NotNull(item, "次交易码", "次交易码不存在"); + + // detail.SetProperty("OnceBusiCode", item.Code); + // detail.SetProperty("OnceBusiName", item.Name); + // } + //} + + //if (!string.IsNullOrEmpty(input.CaseCode)) + //{ + // var dict = await DictAppService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); + + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode); + + // Check.NotNull(item, "专案代码", "专案代码不存在"); + + // detail.SetProperty("CaseCode", item.Code); + // detail.SetProperty("CaseName", item.Name); + // } + //} + + //if (!string.IsNullOrEmpty(input.ProjCapacityCode)) + //{ + // var dict = await DictAppService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); + + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.ProjCapacityCode); + + // Check.NotNull(item, "项目分类代码", "项目分类代码不存在"); + + // detail.SetProperty("ProjCapacityCode", item.Code); + // detail.SetProperty("ProjCapacityName", item.Name); + // } + //} + } + + /// + /// 赋值主记录 + /// + /// + /// + private async Task SetEntityPropertiesAsync(UnplannedIssueRequest entity) + { + var userName = CurrentUser.GetUserName(); + + var department = await _departmentAppService.GetByUsernameAsync(userName).ConfigureAwait(false); + + if (department != null) + { + entity.DeptCode = department.Code; + entity.DeptName = department.Name; + } + + entity.Worker = userName; + + entity.BuildDate = DateTime.Now; + + await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); + } + + /// + /// 赋值业务事务 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(UnplannedIssueRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedIssue, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + #endregion + + #region 校验 + protected async Task CheckBalanceAsync(UnplannedIssueRequestImportInput importInput, List validationRresult) { var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( @@ -155,127 +328,5 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA } } - protected override Func GetEntityExpression() - { - return p => (1); - } - - protected override async Task ValidateImportEntityAsync(UnplannedIssueRequestImportInput input, UnplannedIssueRequest entity, List validationRresult) - { - foreach (var detail in entity.Details) - { - var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - if (itemBasic != null) - { - detail.ItemName = itemBasic.Name; - detail.ItemDesc1 = itemBasic.Desc1; - detail.ItemDesc2 = itemBasic.Desc2; - detail.StdPackQty = itemBasic.StdPackQty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - } - - // var balance = await this._balanceApp.GetByPackingCodeAsync(input.PackingCode); - - var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( - string.Empty, - input.ItemCode, - input.LocationCode).ConfigureAwait(false); - - if (balance != null) - { - detail.SupplierBatch = balance.SupplierBatch; - detail.ArriveDate = balance.ArriveDate; - detail.ProduceDate = balance.ProduceDate; - detail.ExpireDate = balance.ExpireDate; - detail.Lot = balance.Lot; - detail.ContainerCode = balance.ContainerCode; - detail.PackingCode = balance.PackingCode; - detail.Qty = input.Qty; - detail.Status = balance.Status; - } - - if (!string.IsNullOrEmpty(input.OnceBusiCode)) - { - var dict = await DictAppService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode); - - Check.NotNull(item, "次交易码", "次交易码不存在"); - - detail.SetProperty("OnceBusiCode", item.Code); - detail.SetProperty("OnceBusiName", item.Name); - } - } - - if (!string.IsNullOrEmpty(input.CaseCode)) - { - var dict = await DictAppService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode); - - Check.NotNull(item, "专案代码", "专案代码不存在"); - - detail.SetProperty("CaseCode", item.Code); - detail.SetProperty("CaseName", item.Name); - } - } - - if (!string.IsNullOrEmpty(input.ProjCapacityCode)) - { - var dict = await DictAppService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.ProjCapacityCode); - - Check.NotNull(item, "项目分类代码", "项目分类代码不存在"); - - detail.SetProperty("ProjCapacityCode", item.Code); - detail.SetProperty("ProjCapacityName", item.Name); - } - } - } - } - - protected override async Task ValidateImportEntities(Dictionary dicts) - { - foreach (var entity in dicts.Keys) - { - var userName = CurrentUser.GetUserName(); - - var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); - - if (department != null) - { - entity.DeptCode = department.Code; - entity.DeptName = department.Name; - } - - entity.Worker = userName; - - entity.BuildDate = DateTime.Now; - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedIssue, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } - return await base.ValidateImportEntities(dicts).ConfigureAwait(false); - } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs index d48b11807..078029270 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestAutoMapperProfile.cs @@ -59,6 +59,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.ContainerCode) .Ignore(x => x.Lot) .Ignore(x => x.Status) - .Ignore(x => x.Number); + .Ignore(x => x.Number) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs index e69792f7b..b4e3d4656 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; - +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Data; using Win_in.Sfs.Auth.Application.Contracts; @@ -29,75 +29,160 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ _departmentApp = departmentApp; } - protected virtual async Task<(List entites, List deleteEntities)> BuildImportDataAsync(ImportResult importResult, EnumImportMethod importMethod = EnumImportMethod.Update, bool isAllowPartImport = false) + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync(Dictionary dictionary) { - if (importResult.Data.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var unplannedIssueRequest in addList) { - if (!isAllowPartImport) + unplannedIssueRequest.Worker = CurrentUser.GetUserName(); + unplannedIssueRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + await SetEntityPropertiesAsync(unplannedIssueRequest).ConfigureAwait(false); + + foreach (var detail in unplannedIssueRequest.Details) { - return (null, null); + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); } } - var entites = new List(); + return dictionary; + } - var details = new List(); + #region 赋值 - var deleteEntites = new List(); + /// + /// 赋值详情 + /// + /// + /// + private async Task SetDetailPropertiesAsync(UnplannedReceiptRequestDetail detail) + { + var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - var entityExpression = GetEntityExpression(); + if (itemBasic != null) + { + detail.ItemName = itemBasic.Name; + detail.ItemDesc1 = itemBasic.Desc1; + detail.ItemDesc2 = itemBasic.Desc2; + detail.StdPackQty = itemBasic.StdPackQty; + detail.Uom = itemBasic.BasicUom; + } - var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList(); + var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - foreach (var group in groupList) + if (location != null) { - var input = group.FirstOrDefault(); + detail.LocationErpCode = location.ErpLocationCode; + detail.WarehouseCode = location.WarehouseCode; + detail.LocationArea = location.AreaCode; + detail.LocationGroup = location.LocationGroupCode; + } - var inputDetails = group.ToList(); + detail.Lot = string.Empty; + detail.ContainerCode = string.Empty; + detail.PackingCode = string.Empty; + detail.Status = EnumInventoryStatus.OK; - if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - var exist = await GetEntityAsync(input).ConfigureAwait(false); + //if (!string.IsNullOrEmpty(detail.OnceBusiCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - var entity = ObjectMapper.Map(input); + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode); - await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); + // Check.NotNull(item, "次交易码", "次交易码不存在"); - switch (importMethod) - { - case EnumImportMethod.Update: - if (exist != null) - { - entity.SetId(exist.Id); - } - break; - - case EnumImportMethod.Replace: - if (exist != null) - { - deleteEntites.Add(exist); - } - break; - } + // detail.SetProperty("OnceBusiCode", item.Code); + // detail.SetProperty("OnceBusiName", item.Name); + // } + //} - foreach (var inputDetail in inputDetails) - { - var detail = ObjectMapper.Map(inputDetail); + //if (!string.IsNullOrEmpty(input.CaseCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode); - await SetDetailPropertiesAsync(detail, inputDetail).ConfigureAwait(false); - entity.AddDetail(detail); - } + // Check.NotNull(item, "专案代码", "专案代码不存在"); - entites.Add(entity); - } + // detail.SetProperty("CaseCode", item.Code); + // detail.SetProperty("CaseName", item.Name); + // } + //} + + //if (!string.IsNullOrEmpty(input.ProjCapacityCode)) + //{ + // var dict = await DictAclService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); + + // if (dict.Items != null && dict.Items.Count > 0) + // { + // var item = dict.Items.FirstOrDefault(t => t.Code == input.ProjCapacityCode); + + // Check.NotNull(item, "项目分类代码", "项目分类代码不存在"); + + // detail.SetProperty("ProjCapacityCode", item.Code); + // detail.SetProperty("ProjCapacityName", item.Name); + // } + //} + } + + /// + /// 赋值主记录 + /// + /// + /// + private async Task SetEntityPropertiesAsync(UnplannedReceiptRequest entity) + { + var userName = CurrentUser.GetUserName(); + + var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); + + if (department != null) + { + entity.DeptCode = department.Code; + entity.DeptName = department.Name; } - return (entites, deleteEntites); + entity.Worker = userName; + + entity.BuildDate = DateTime.Now; + + await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); } - protected async Task CheckBalanceAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + /// + /// 赋值业务事务 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(UnplannedReceiptRequest entity) + { + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedReceipt, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + + #endregion + + #region 校验 + + protected virtual async Task CheckBalanceAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var balance = await BalanceAclService.GetByItemLocationAndPackingAsync( string.Empty, @@ -118,7 +203,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return balance; } - protected async Task CheckCaseCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckCaseCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { if (!string.IsNullOrEmpty(importInput.CaseCode)) { @@ -161,7 +246,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ //} } - protected async Task CheckItemBasicAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckItemBasicAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); if (item == null) @@ -176,7 +261,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return item; } - protected async Task CheckLocationAsync(string locationCode, List validationRresult) + protected virtual async Task CheckLocationAsync(string locationCode, List validationRresult) { var location = await LocationAclService.GetByCodeAsync(locationCode).ConfigureAwait(false); if (location == null) @@ -186,7 +271,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return location; } - protected async Task CheckOnceBusiCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + protected virtual async Task CheckOnceBusiCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { if (!string.IsNullOrEmpty(importInput.OnceBusiCode)) { @@ -208,7 +293,8 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ } } } - protected async Task CheckProjCapacityCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) + + protected virtual async Task CheckProjCapacityCodeAsync(UnplannedReceiptRequestImportInput importInput, List validationRresult) { var dict = await DictAclService.GetByCodeAsync(nameof(importInput.ProjCapacityCode)).ConfigureAwait(false); if (dict == null) @@ -227,7 +313,8 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ } } } - protected async Task CheckTransactionTypeAsync(EnumTransType enumTransType, List validationRresult) + + protected virtual async Task CheckTransactionTypeAsync(EnumTransType enumTransType, List validationRresult) { var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(enumTransType, EnumTransSubType.None).ConfigureAwait(false); if (transactionType == null) @@ -237,116 +324,5 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ return transactionType; } - protected override Func GetEntityExpression() - { - return p => (1); - } - - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _unplannedReceiptRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - } - private async Task SetDetailPropertiesAsync(UnplannedReceiptRequestDetail detail, UnplannedReceiptRequestImportInput input) - { - var itemBasic = await ItemBasicAclService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); - - if (itemBasic != null) - { - detail.ItemName = itemBasic.Name; - detail.ItemDesc1 = itemBasic.Desc1; - detail.ItemDesc2 = itemBasic.Desc2; - detail.StdPackQty = itemBasic.StdPackQty; - } - - var location = await LocationAclService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); - - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - detail.Lot = string.Empty; - detail.ContainerCode = string.Empty; - } - - detail.PackingCode = string.Empty; - - detail.Status = EnumInventoryStatus.OK; - - if (!string.IsNullOrEmpty(input.OnceBusiCode)) - { - var dict = await DictAclService.GetByCodeAsync(nameof(input.OnceBusiCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.OnceBusiCode); - - Check.NotNull(item, "次交易码", "次交易码不存在"); - - detail.SetProperty("OnceBusiCode", item.Code); - detail.SetProperty("OnceBusiName", item.Name); - } - } - - if (!string.IsNullOrEmpty(input.CaseCode)) - { - var dict = await DictAclService.GetByCodeAsync(nameof(input.CaseCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.CaseCode); - - Check.NotNull(item, "专案代码", "专案代码不存在"); - - detail.SetProperty("CaseCode", item.Code); - detail.SetProperty("CaseName", item.Name); - } - } - - if (!string.IsNullOrEmpty(input.ProjCapacityCode)) - { - var dict = await DictAclService.GetByCodeAsync(nameof(input.ProjCapacityCode)).ConfigureAwait(false); - - if (dict.Items != null && dict.Items.Count > 0) - { - var item = dict.Items.FirstOrDefault(t => t.Code == input.ProjCapacityCode); - - Check.NotNull(item, "项目分类代码", "项目分类代码不存在"); - - detail.SetProperty("ProjCapacityCode", item.Code); - detail.SetProperty("ProjCapacityName", item.Name); - } - } - } - - private async Task SetEntityPropertiesAsync(UnplannedReceiptRequest entity, UnplannedReceiptRequestImportInput input) - { - var userName = CurrentUser.GetUserName(); - - var department = await _departmentApp.GetByUsernameAsync(userName).ConfigureAwait(false); - - if (department != null) - { - entity.DeptCode = department.Code; - entity.DeptName = department.Name; - } - - entity.Worker = userName; - - entity.BuildDate = DateTime.Now; - - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } - - private async Task SetRequestAutoPropertiesAsync(UnplannedReceiptRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.UnplannedReceipt, EnumTransSubType.None).ConfigureAwait(false); - - Check.NotNull(tranType, "事务类型", "事务类型不存在"); - - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } + #endregion } 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/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs index 32f1f35b8..322ddb0b1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithFromToEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendFromDetailWithFromToEntityBase : SfsStore /// public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs index 9b40c3155..da3d66f64 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatusEntityBase.cs @@ -66,10 +66,6 @@ public abstract class SfsStoreRecommendFromDetailWithLotPackingQtyLocationStatus /// public string RecommendFromWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } /// /// 推荐数量 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs index 2fc010c5a..6084e48d1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithFromToEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendToDetailWithFromToEntityBase : SfsStoreDe /// public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs index 8b7da50a4..d907f953e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEntityBase.cs @@ -66,11 +66,6 @@ public abstract class SfsStoreRecommendToDetailWithLotPackingQtyLocationStatusEn /// public string RecommendToWarehouseCode { get; set; } - /// - /// 计量单位 - /// - public string Uom { get; set; } - /// /// 推荐数量 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs index 7590d0ddc..ead66142e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/IssueJobs/IssueJobManager.cs @@ -33,8 +33,17 @@ public class IssueJobManager : SfsJobManagerBase, IIss foreach (var detail in input.Details) { //发料子任务 赋值实际转移 - await entity.BuildDetail(detail.Id, detail.HandledFromLocationCode, detail.HandledFromLocationErpCode, detail.HandledFromWarehouseCode, - detail.HandledQty, detail.HandledSupplierBatch, detail.HandledArriveDate, detail.HandledProduceDate, detail.HandledExpireDate, detail.HandledContainerCode, detail.HandledLot, + await entity.BuildDetail(detail.Id, + detail.HandledFromLocationCode, + detail.HandledFromLocationErpCode, + detail.HandledFromWarehouseCode, + detail.HandledQty, + detail.HandledSupplierBatch, + detail.HandledArriveDate, + detail.HandledProduceDate, + detail.HandledExpireDate, + detail.HandledContainerCode, + detail.HandledLot, detail.HandledPackingCode).ConfigureAwait(false); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs index f45395934..7a96bcad8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs @@ -4,5 +4,5 @@ namespace Win_in.Sfs.Wms.Store.Domain; public interface IRecycledMaterialReceiptNoteManager : ISfsStoreManager { - Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs index 1ccb6c7b1..0b0ea9e7f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs @@ -10,18 +10,4 @@ public class RecycledMaterialReceiptNoteManager : SfsStoreManagerBase CreateAsync(RecycledMaterialReceiptNote entity) - { - return await base.CreateAsync(entity).ConfigureAwait(false); - - } - - public virtual async Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote) - { - var RecycledMaterialReceiptNote = ObjectMapper.Map(purchaseReceiptNote); - - await base.CreateAsync(RecycledMaterialReceiptNote).ConfigureAwait(false); - } - } 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/Plans/CountPlans/CountPlanManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs index bebfabce1..f0c42a09b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs @@ -14,12 +14,14 @@ namespace Win_in.Sfs.Wms.Store.Domain; public class CountPlanManager : SfsStoreRequestManagerBase, ICountPlanManager { + private readonly ICountPlanRepository _repository; public CountPlanManager( ICountPlanRepository repository ) : base(repository) { + _repository = repository; } /// @@ -107,9 +109,11 @@ public class CountPlanManager : SfsStoreRequestManagerBase 0) { - SfsBaseDataRequestInputBase itemInput = new SfsBaseDataRequestInputBase(); - itemInput.Condition = partCondition; - itemInput.MaxResultCount = 99999; + var itemInput = new SfsBaseDataRequestInputBase + { + Condition = partCondition, + MaxResultCount = 99999 + }; var itemBaseList = await ItemBasicAppService.GetAllListByFilterAsync(itemInput, false).ConfigureAwait(false); @@ -119,16 +123,18 @@ public class CountPlanManager : SfsStoreRequestManagerBase 0) { - SfsBaseDataRequestInputBase locInput = new SfsBaseDataRequestInputBase(); - locInput.Condition = locCondition; - locInput.MaxResultCount = 99999; + var locInput = new SfsBaseDataRequestInputBase + { + Condition = locCondition, + MaxResultCount = 99999 + }; var locList = await LocationAppService.GetAllListByFilterAsync(locInput, false).ConfigureAwait(false); //库位列表 selectLocationCodes = locList.Select(p => p.Code).Distinct().ToList(); } //状态查询 - string statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList()); + var statusStr = System.Text.Json.JsonSerializer.Serialize(selectStatusList.Select(p => (int)p).ToList()); //最终的查询条件语句 SfsInventoryRequestInputBase banlanceInput = new SfsInventoryRequestInputBase(); @@ -196,10 +202,8 @@ public class CountPlanManager : SfsStoreRequestManagerBase(entity), false) + .ConfigureAwait(false); + await _repository.InsertAsync(entity).ConfigureAwait(false); + return entity; } @@ -128,6 +128,13 @@ public class MaterialRequestManager oldEntity.ReplaceDetail(newDetail.Id, newDetail); } + var flag=oldEntity.Details.Any(p => p.ReceivedQty < p.Qty);//还有补料完 没收到的货 + + if (!flag) + { + oldEntity.Complete(); + } + await Repository.UpdateAsync(oldEntity).ConfigureAwait(false); } 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/Jobs/ProductionReturnJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs index 2bef49393..f75b41476 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductionReturnJobAutoMapperProfile.cs @@ -52,9 +52,6 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .MapExpectInOutTo() - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) - .Ignore(x => x.WarehouseCode) .Ignore(x => x.SerialNumber) .Ignore(x => x.Worker) .Ignore(x => x.ExtraProperties) @@ -63,10 +60,10 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .MapExpectInOutTo() .ForMember(x => x.LocationCode, y => y.MapFrom(d => d.FromLocationCode)) + .ForMember(x => x.LocationArea, y => y.MapFrom(d => d.FromLocationArea)) + .ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.FromLocationGroup)) .ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode)) .ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode)) - .Ignore(x => x.LocationArea) - .Ignore(x => x.LocationGroup) .Ignore(x => x.SerialNumber) .Ignore(x => x.Worker) .Ignore(x => x.ExtraProperties); 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/Plans/CountPlanAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs index 815ec6b6a..bfd07f21d 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Plans/CountPlanAutoMapperProfile.cs @@ -52,13 +52,11 @@ public partial class StoreEventAutoMapperProfile : Profile //盘点计划映射到盘点记录 CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ; CreateMap() .ForMember(x => x.CountPlanNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.Adjusted) ; 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/ExpectInOuts/ProductionReturnStoreEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs similarity index 98% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs index 4c80640e3..5635bf206 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnStoreEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/ExpectInOuts/ProductionReturnJobEventHandler.cs @@ -9,7 +9,7 @@ using Win_in.Sfs.Wms.Store.Event.Inventories; namespace Win_in.Sfs.Wms.Store.Event.ExpectInOuts; -public class ProductionReturnStoreEventHandler : +public class ProductionReturnJobEventHandler : StoreExpectInOutEventHandlerBase , ILocalEventHandler> , ILocalEventHandler> diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs index d5e645fb5..7bede24fc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/IssueJobEventHandler.cs @@ -60,7 +60,7 @@ public class IssueJobEventHandler : foreach (var detail in issueNoteCreateInput.Details) { var location = locations.First(p => p.Code == detail.ToLocationCode); - await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type); //去箱 去托 去批 + await RemovePackingCodeAndContainerCodeAndLotAsync(detail, location.Type).ConfigureAwait(false); //去箱 去托 去批 detail.ToLocationArea = location.AreaCode; detail.ToLocationGroup = location.LocationGroupCode; 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/CountPlanEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs index 05ba4fdaa..53547826f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/CountPlanEventHandler.cs @@ -41,6 +41,9 @@ public class CountPlanEventHandler switch (entity.RequestType) { case CountPlanRequestType.Import: + //冻结库存 + await FreezeBalancesAsync(entity).ConfigureAwait(false); + break; case CountPlanRequestType.Manual: //冻结库存 await FreezeBalancesAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs index 199be122d..a71aeb6c3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ItemTransformRequestEventHandler.cs @@ -44,6 +44,16 @@ public class ItemTransformRequestEventHandler { var transformNoteDetail = new ItemTransformNoteDetailInput() { + FromLocationCode = detail.FromLocationCode, + FromLocationArea = detail.FromLocationArea, + FromLocationErpCode = detail.FromLocationErpCode, + FromLocationGroup = detail.FromLocationGroup, + + ToLocationArea = detail.ToLocationArea, + ToLocationCode = detail.ToLocationCode, + ToLocationErpCode = detail.ToLocationErpCode, + ToLocationGroup = detail.ToLocationGroup, + FromSupplierBatch = detail.FromSupplierBatch, ItemCode = detail.ItemCode, ToItemCode = detail.ToItemCode, @@ -52,7 +62,6 @@ public class ItemTransformRequestEventHandler FromExpireDate = detail.FromExpireDate, FromLot = detail.FromLot, FromPackingCode = detail.FromPackingCode, - ToLocationCode = detail.ToLocationCode, FromStatus = detail.FromStatus, ToContainerCode = detail.ToContainerCode, FromProduceDate = detail.FromProduceDate, @@ -74,6 +83,8 @@ public class ItemTransformRequestEventHandler ToProduceDate = detail.ToProduceDate, ToStatus = detail.ToStatus, ToSupplierBatch = detail.ToSupplierBatch, + FromWarehouseCode = detail.FromWarehouseCode, + ToWarehouseCode = detail.ToWarehouseCode }; createInput.Details.Add(transformNoteDetail); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs index 845a07a72..df7782591 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs @@ -214,7 +214,10 @@ public class MaterialRequestEventHandler var detail = await BuildIssueJobDetailAsync(materialRequestDetail, recommend, toLocationGroupCode).ConfigureAwait(false); if (materialRequest.UseOnTheWayLocation) { - detail.OnTheWayLocationCode = await SettingManager.GetOrNullGlobalAsync(StoreSettings.Common.IssueOnTheWayLocation).ConfigureAwait(false); + //获取在途库 + var locationDto= await _locationAppService.GetFirstByTypeAsync(EnumLocationType.TRANSPORT).ConfigureAwait(false); + + detail.OnTheWayLocationCode = locationDto.Code; } jobDetails.Add(detail); @@ -251,6 +254,7 @@ public class MaterialRequestEventHandler detail.ToLocationCode = materialRequestDetail.ToLocationCode; detail.ToLocationErpCode = materialRequestDetail.ToLocationErpCode; + detail.ToLocationArea= materialRequestDetail.ToLocationArea; detail.ToWarehouseCode = materialRequestDetail.ToWarehouseCode; detail.ToLocationGroup = materialRequestDetail.ToLocationGroup; //detail.Operation = //TODO diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs index e113d92e4..94d4e8369 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs @@ -46,7 +46,7 @@ public class IssueNoteEventHandler var materialRequest = await _materialRequestManager.GetByNumberAsync(entity.RequestNumber).ConfigureAwait(false); - if (entity.RequestType != EnumMaterialRequestType.Direct_Issue.ToString()) + if (entity.RequestType != EnumMaterialRequestType.Issue_Direct.ToString()) { //更新叫料请求的已收数量 foreach (var materialRequestDetail in materialRequest.Details) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs index a315b3a07..fa0a16a2e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductRecycleRequestEventHandler.cs @@ -99,7 +99,9 @@ public class ProductRecycleRequestEventHandler LocationErpCode = detail.RawLocationErpCode, WarehouseCode = detail.RawWarehouseCode, Lot = string.Empty, - Status = EnumInventoryStatus.OK + Status = EnumInventoryStatus.OK, + LocationArea = detail.LocationArea, + LocationGroup = detail.LocationGroup, }; if (item != null) 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/ItemTransformNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs index af56eb5a4..c33adc601 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ItemTransformNoteEventHandler.cs @@ -72,7 +72,9 @@ public class ItemTransformNoteEventHandler TransType = Type, TransSubType = SubType, TransInOut = EnumTransInOut.Out, - + LocationArea = detail.FromLocationArea, + LocationGroup = detail.FromLocationGroup, + LocationErpCode = detail.FromLocationErpCode, PackingCode = detail.FromPackingCode, ItemCode = detail.ItemCode, Lot = detail.FromLot, @@ -106,6 +108,9 @@ public class ItemTransformNoteEventHandler ItemCode = detail.ToItemCode, Lot = detail.ToLot, Status = detail.ToStatus, + LocationArea = detail.ToLocationArea, + LocationGroup = detail.ToLocationGroup, + LocationErpCode = detail.ToLocationErpCode, WarehouseCode = detail.ToWarehouseCode, LocationCode = detail.ToLocationCode, ContainerCode = detail.ToContainerCode, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs index 4aae5fc63..cee202461 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/RecycledMaterialReceiptNoteEventHandler.cs @@ -12,13 +12,18 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions; public class RecycledMaterialReceiptNoteEventHandler : StoreInventoryEventHandlerBase - , ILocalEventHandler> - , ILocalEventHandler>> + , ILocalEventHandler> + , ILocalEventHandler>> { private const EnumTransInOut TransInOut = EnumTransInOut.In; private const EnumTransType TransType = EnumTransType.UnplannedReceipt; private const EnumTransSubType TransSubType = EnumTransSubType.UnplannedReceipt_RecycledMaterialReceipt; + /// + /// 创建后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { @@ -26,6 +31,20 @@ public class RecycledMaterialReceiptNoteEventHandler await AddTransactionsAsync(entity).ConfigureAwait(false); } + /// + /// 批量创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddTransactionsAsync(entities).ConfigureAwait(false); + } + + #region 私有 + private async Task AddTransactionsAsync(RecycledMaterialReceiptNote RecycledMaterialReceiptNote) { var inboundTransactions = new List(); @@ -33,19 +52,10 @@ public class RecycledMaterialReceiptNoteEventHandler inboundTransactions.AddRange(BuildTransactions(RecycledMaterialReceiptNote)); await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); - - } - - [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) - { - var entities = eventData.Entity; - await AddTransactionsAsync(entities).ConfigureAwait(false); } private async Task AddTransactionsAsync(List RecycledMaterialReceiptNotes) { - var inboundTransactions = new List(); //如果要做库存事务汇总,可以修改此处 @@ -74,7 +84,9 @@ public class RecycledMaterialReceiptNoteEventHandler transactions.Add(transaction); } + return transactions; } + #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 +}