diff --git a/be/Hosts/Core.Host/Win_in.Sfs.Core.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.LabelDbContext.sql b/be/Hosts/Core.Host/Win_in.Sfs.Core.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.LabelDbContext.sql index 62cc74b72..77c90ba24 100644 --- a/be/Hosts/Core.Host/Win_in.Sfs.Core.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.LabelDbContext.sql +++ b/be/Hosts/Core.Host/Win_in.Sfs.Core.Host/scripts/db.Microsoft.EntityFrameworkCore.SqlServer.LabelDbContext.sql @@ -49,6 +49,7 @@ CREATE TABLE [Label_InventoryLabel] ( [SupplierSimpleName] nvarchar(max) NULL, [SupplierItemCode] nvarchar(max) NULL, [SupplierItemName] nvarchar(max) NULL, + [PlanArriveDate] datetime2 NOT NULL, [ExtraProperties] nvarchar(max) NULL, [ConcurrencyStamp] nvarchar(40) NULL, [CreationTime] datetime2 NOT NULL, 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 97de80e01..8cbecdc09 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 @@ -700,6 +700,7 @@ CREATE TABLE [Store_DeliverNote] ( [DeliverTime] datetime2 NOT NULL, [DeliverRequestNumber] nvarchar(max) NULL, [DeliverRequestType] nvarchar(64) NOT NULL, + [CountPrint] int NOT NULL, [ExtraProperties] nvarchar(max) NULL, [ConcurrencyStamp] nvarchar(40) NULL, [CreationTime] datetime2 NOT NULL, @@ -1280,7 +1281,7 @@ CREATE TABLE [Store_ProductReceiptRequest] ( [Shift] nvarchar(64) NULL, [Team] nvarchar(64) NULL, [PlanDate] datetime2 NOT NULL, - [Type] nvarchar(64) NULL, + [Type] nvarchar(64) NOT NULL, [ExtraProperties] nvarchar(max) NULL, [ConcurrencyStamp] nvarchar(40) NULL, [CreationTime] datetime2 NOT NULL, diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageApplicationAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageApplicationAutoMapperProfile.cs index 2d5b76e71..737aa0ae5 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageApplicationAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageApplicationAutoMapperProfile.cs @@ -2,7 +2,7 @@ using AutoMapper; namespace Win_in.Sfs.Message.Application; -public class MessageApplicationAutoMapperProfile : Profile +public partial class MessageApplicationAutoMapperProfile : Profile { public MessageApplicationAutoMapperProfile() { @@ -10,7 +10,9 @@ public class MessageApplicationAutoMapperProfile : Profile * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ - new MessageTypeAutoMapperProfile().MessageTypeAutoMapperProfileConfig(); - new NotifyMessageAutoMapperProfile().NotifyMessageAutoMapperProfileConfig(); + UserNotifyAutoMapperProfile(); + MessageTypeAutoMapperProfile(); + MessageTypeSubscribesAutoMapperProfile(); + NotifyMessageAutoMapperProfileConfig(); } } diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypeSubscribes/MessageTypeSubscribeAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypeSubscribes/MessageTypeSubscribeAutoMapperProfile.cs index 6946cb987..7fedb3bf6 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypeSubscribes/MessageTypeSubscribeAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypeSubscribes/MessageTypeSubscribeAutoMapperProfile.cs @@ -5,12 +5,20 @@ using Win_in.Sfs.Message.Domain; namespace Win_in.Sfs.Message.Application; -public class MessageTypeSubscribeAutoMapperProfile : Profile +public partial class MessageApplicationAutoMapperProfile : Profile { - public MessageTypeSubscribeAutoMapperProfile() + public void MessageTypeSubscribesAutoMapperProfile() { CreateMap() .IgnoreAuditedObjectProperties() .ReverseMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x=>x.Id) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.TenantId) + .Ignore(x => x.ExtraProperties) + ; } } diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypes/MessageTypeAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypes/MessageTypeAutoMapperProfile.cs index f0f24b3d9..d602c2108 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypes/MessageTypeAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/MessageTypes/MessageTypeAutoMapperProfile.cs @@ -5,9 +5,9 @@ using Win_in.Sfs.Message.Domain; namespace Win_in.Sfs.Message.Application; -public class MessageTypeAutoMapperProfile : Profile +public partial class MessageApplicationAutoMapperProfile : Profile { - public void MessageTypeAutoMapperProfileConfig() + public void MessageTypeAutoMapperProfile() { CreateMap() .IgnoreAuditedObjectProperties() diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/NotifyMessages/NotifyMessageAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/NotifyMessages/NotifyMessageAutoMapperProfile.cs index 8df3f3732..cfbf6da69 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/NotifyMessages/NotifyMessageAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/NotifyMessages/NotifyMessageAutoMapperProfile.cs @@ -6,7 +6,7 @@ using Win_in.Sfs.Shared.Event; namespace Win_in.Sfs.Message.Application; -public class NotifyMessageAutoMapperProfile : Profile +public partial class MessageApplicationAutoMapperProfile : Profile { public void NotifyMessageAutoMapperProfileConfig() { @@ -30,6 +30,7 @@ public class NotifyMessageAutoMapperProfile : Profile .Ignore(x => x.LastModifierId) .Ignore(x => x.CreationTime) .Ignore(x => x.CreatorId) + .Ignore(x=>x.Id) ; } } diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs index 6695cb221..c86fc455e 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageAutoMapperProfile.cs @@ -6,9 +6,9 @@ using Win_in.Sfs.Message.Domain; namespace Win_in.Sfs.Message.Application; -public class UserNotifyMessageAutoMapperProfile : Profile +public partial class MessageApplicationAutoMapperProfile : Profile { - public UserNotifyMessageAutoMapperProfile() + public void UserNotifyAutoMapperProfile() { CreateMap() .IgnoreAuditedObjectProperties() 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 c28220728..f99e6672e 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 @@ -85,6 +85,12 @@ public enum EnumTransSubType [Display(Name = "人工报废")] Scrap_Manual = 3601, + /// + /// 完工报废 + /// + [Display(Name = "完工报废")] + Scrap_Product = 3604, + /// /// 线边调整 /// diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumProductReceiptType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumProductReceiptType.cs index da81aec1e..b6c96841d 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumProductReceiptType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumProductReceiptType.cs @@ -5,9 +5,9 @@ namespace Win_in.Sfs.Shared.Domain.Shared; public enum EnumProductReceiptType { /// - /// 人工缴库 + /// 人工缴库(完工缴库) /// - [Display(Name = "人工缴库")] + [Display(Name = "人工缴库(完工缴库)")] ProductReceipt_Manual = 2101, /// diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumScrapType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumScrapType.cs index 28e91741f..87dfc09eb 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumScrapType.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumScrapType.cs @@ -5,9 +5,9 @@ namespace Win_in.Sfs.Shared.Domain.Shared; public enum EnumScrapType { /// - /// 人工报废 + /// 人工报废(原料报废) /// - [Display(Name = "人工报废")] + [Display(Name = "人工报废(原料报废)")] Scrap_Manual = 3601, /// @@ -15,4 +15,10 @@ public enum EnumScrapType /// [Display(Name = "线边报废")] Scrap_WIP = 3603, + + /// + /// 完工报废 + /// + [Display(Name = "完工报废")] + Scrap_Product = 3604, } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsJobRecommendFromDetailDTOBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsJobRecommendFromDetailDTOBase.cs index e53cb5aee..e2161239f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsJobRecommendFromDetailDTOBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Bases/DTOs/SfsJobRecommendFromDetailDTOBase.cs @@ -220,10 +220,13 @@ public abstract class SfsJobRecommendFromDetailDTOBase HandledProduceDate = RecommendProduceDate; HandledExpireDate = RecommendExpireDate; HandledLot = RecommendLot; + HandledQty = RecommendQty; + HandledFromLocationCode = RecommendFromLocationCode; HandledFromLocationErpCode = RecommendFromLocationErpCode; - - HandledQty = RecommendQty; + HandledFromLocationArea= RecommendFromLocationArea; + HandledFromWarehouseCode= RecommendFromWarehouseCode; + HandledFromLocationGroup = RecommendFromLocationGroup; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/DTOs/ProductReceiptRequestDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/DTOs/ProductReceiptRequestDTO.cs index 62ad7ba0b..265f55e52 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/DTOs/ProductReceiptRequestDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ProductReceiptRequests/DTOs/ProductReceiptRequestDTO.cs @@ -1,6 +1,7 @@ using System; 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; @@ -54,6 +55,6 @@ public class ProductReceiptRequestDTO : SfsStoreRequestDTOBase [Display(Name = "类型")] - public string Type { get; set; } + public EnumProductReceiptType Type { get; set; } } 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 f4dd44438..09f948138 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 @@ -70,7 +70,7 @@ public class ProductReceiptRequestEditInput : SfsStoreRequestCreateOrUpdateInput /// 类型 /// [Display(Name = "类型")] - public string Type { get; set; } + public string EnumProductReceiptType { get; set; } /// /// 明细列表 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ScrapRequests/Inputs/ScrapRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ScrapRequests/Inputs/ScrapRequestImportInput.cs index e2331a47f..85191a64c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ScrapRequests/Inputs/ScrapRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/ScrapRequests/Inputs/ScrapRequestImportInput.cs @@ -1,4 +1,6 @@ using System.ComponentModel.DataAnnotations; +using DocumentFormat.OpenXml.Wordprocessing; +using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application.Contracts; @@ -7,11 +9,16 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; public class ScrapRequestImportInput : SfsStoreImportInputBase { /// - /// 类型 + /// 报废类型 /// - [Display(Name = "类型")] - [Required] - public EnumScrapType Type { get; set; } + [Display(Name = "报废类型")] + [Required(ErrorMessage = "{0}是必填项")] + [ImporterHeader(Name = "报废类型")] + [ExporterHeader(DisplayName = "报废类型")] + [ValueMapping("线边报废", EnumTransSubType.Scrap_WIP)] + [ValueMapping("原料报废", EnumTransSubType.Scrap_Manual)] + [ValueMapping("完工报废", EnumTransSubType.Scrap_Product)] + public string Type { get; set; } /// /// 物料代码 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 c1aee21d2..5a388cefe 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 @@ -5,11 +5,13 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; - +using DocumentFormat.OpenXml.Office.CustomUI; 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 Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -25,28 +27,124 @@ namespace Win_in.Sfs.Wms.Store.Application; /// [Authorize] [Route($"{StoreConsts.RootPath}product-receipt-request")] - public class ProductReceiptRequestAppService : - SfsStoreRequestAppServiceBase + SfsStoreRequestAppServiceBase { private readonly IProductReceiptRequestManager _productReceiptRequestManager; - private readonly IAreaAppService _areaApp; + private readonly IItemBasicAppService _itemBasicAppService; + private readonly ILocationAppService _locationAppService; public ProductReceiptRequestAppService( IProductReceiptRequestRepository repository , IProductReceiptRequestManager productReceiptRequestManager - , IAreaAppService areaApp - ) : base(repository, productReceiptRequestManager) + , IAreaAppService areaApp, + IItemBasicAppService itemBasicAppService, + ILocationAppService locationAppService) : base(repository, productReceiptRequestManager) { - - this._areaApp = areaApp; + _areaApp = areaApp; + _itemBasicAppService = itemBasicAppService; + _locationAppService = locationAppService; _productReceiptRequestManager = productReceiptRequestManager; base.CreatePolicyName = ProductReceiptRequestPermissions.Create; base.UpdatePolicyName = ProductReceiptRequestPermissions.Update; base.DeletePolicyName = ProductReceiptRequestPermissions.Delete; } + #region 东阳 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected override async Task> ImportProcessingEntityAsync( + Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var productReceiptRequest in addList) + { + productReceiptRequest.Worker = CurrentUser.GetUserName(); + productReceiptRequest.CreatorId = CurrentUser.Id; + + await SetRequestAutoPropertiesAsync(productReceiptRequest).ConfigureAwait(false); + foreach (var detail in productReceiptRequest.Details) + { + await SetDetailPropertiesAsync(detail).ConfigureAwait(false); + } + } + + return dictionary; + } + + /// + /// 赋值详情 + /// + /// + /// + /// + private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail) + { + var itemBasic = await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + + if (itemBasic != null) + { + detail.ItemName = itemBasic.Name; + detail.ItemDesc1 = itemBasic.Desc1; + detail.ItemDesc2 = itemBasic.Desc2; + detail.StdPackQty = itemBasic.StdPackQty; + detail.Uom = itemBasic.BasicUom; + } + + var location = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + + if (location != null) + { + detail.LocationErpCode = location.ErpLocationCode; + detail.WarehouseCode = location.WarehouseCode; + detail.LocationArea = location.AreaCode; + detail.LocationGroup = location.LocationGroupCode; + } + } + + /// + /// 设置事务类型 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(ProductReceiptRequest entity) + { + var enumTransSubType = EnumTransSubType.None; + switch (entity.Type) + { + case EnumProductReceiptType.ProductReceipt_Manual: + enumTransSubType = EnumTransSubType.ProductReceipt_Manual; + break; + case EnumProductReceiptType.ProductReceipt_WIP: + enumTransSubType = EnumTransSubType.ProductReceipt_WIP; + break; + default: + throw new UserFriendlyException("缴库类型错误"); + } + + var tranType = await TransactionTypeAclService + .GetByTransTypeAsync(EnumTransType.ProductReceipt, enumTransSubType) + .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 + /// /// 新增实体 /// @@ -56,7 +154,6 @@ public class ProductReceiptRequestAppService : //[Authorize(ProductReceiptRequestPermissions.Create)] public override async Task CreateAsync(ProductReceiptRequestEditInput input) { - var entity = ObjectMapper.Map(input); await _productReceiptRequestManager.CreateAsync(entity).ConfigureAwait(false); @@ -79,35 +176,37 @@ public class ProductReceiptRequestAppService : bool includeDetails = false, CancellationToken cancellationToken = default) { - Expression> expression = p => p.Type == type; + Expression> expression = p => p.Type.ToString() == type; if (requestInput.Condition.Filters?.Count > 0) { expression = expression.And(requestInput.Condition.Filters.ToLambda()); } return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, - requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); + requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); } [HttpPost("export-by-type")] public virtual async Task ExportByTypeAsync(SfsExportRequestInput requestInput, string type) { - - Expression> expression = p => p.Type == type; + Expression> expression = p => p.Type.ToString() == type; if (requestInput.Condition.Filters?.Count > 0) { expression = expression.And(requestInput.Condition.Filters.ToLambda()); } - var entities = await _repository.GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, requestInput.Sorting, true).ConfigureAwait(false); + var entities = await _repository + .GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, requestInput.Sorting, + true).ConfigureAwait(false); var list = ObjectMapper.Map, List>(entities); return ExportImportService.Export(list, true, "Details"); } - #region Import + #region 校验 - protected virtual async Task CheckImportInputBusinessAsync(ProductReceiptRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) + protected virtual async Task CheckImportInputBusinessAsync(ProductReceiptRequestImportInput importInput, + EnumImportMethod importMethod, List validationRresult) { //await base.CheckImportInputBusinessAsync(importInput, importMethod); @@ -124,7 +223,8 @@ public class ProductReceiptRequestAppService : //CheckTransactionType(EnumTransInOut.In, transactionType.InInventoryStatuses.FirstOrDefault(), transactionType, itemBasic, location); } - protected async Task CheckItemBasicAsync(ProductReceiptRequestImportInput importInput, List validationRresult) + protected async Task CheckItemBasicAsync(ProductReceiptRequestImportInput importInput, + List validationRresult) { var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); @@ -132,25 +232,30 @@ public class ProductReceiptRequestAppService : { validationRresult.Add("物品代码", $"物品代码{importInput.ItemCode}不存在"); } + //可以缴入负数 if (importInput.Qty == 0) { validationRresult.Add("数量", $"数量不能等于0"); } + return item; } - protected async Task CheckLocationAsync(ProductReceiptRequestImportInput importInput, List validationRresult) + protected async Task CheckLocationAsync(ProductReceiptRequestImportInput importInput, + List validationRresult) { var location = await LocationAclService.GetByCodeAsync(importInput.LocationCode).ConfigureAwait(false); if (location == null) { validationRresult.Add("调入库位", $"调入库位{importInput.LocationCode}不存在"); } + return location; } - protected async Task CheckAreaAsync(ProductReceiptRequestImportInput importInput, List validationRresult) + protected async Task CheckAreaAsync(ProductReceiptRequestImportInput importInput, + List validationRresult) { var location = await _areaApp.GetByCodeAsync(importInput.RawArea).ConfigureAwait(false); if (location == null) @@ -161,17 +266,14 @@ public class ProductReceiptRequestAppService : protected async Task CheckTransactionTypeAsync(List validationRresult) { - var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.ProductReceipt, EnumTransSubType.None).ConfigureAwait(false); + var transactionType = await TransactionTypeAclService + .GetByTransTypeAsync(EnumTransType.ProductReceipt, EnumTransSubType.None).ConfigureAwait(false); if (transactionType == null) { validationRresult.Add("事务类型", $"{EnumTransType.ProductReceipt.GetDisplayName()}事务类型不存在"); } - return transactionType; - } - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _productReceiptRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); + return transactionType; } protected override Func GetEntityExpression() @@ -179,118 +281,92 @@ public class ProductReceiptRequestAppService : return p => p.Type; } - 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(); + #endregion - var inputDetails = group.ToList(); + //protected virtual async Task ImportDataAsync(List entites, + // List deleteEntities) + //{ + // await _productReceiptRequestManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); + //} + //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); + // } + // } - if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) - { - var exist = await GetEntityAsync(input).ConfigureAwait(false); + // var entites = new List(); - var entity = ObjectMapper.Map(input); + // var details = new List(); - await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); + // var deleteEntites = new List(); - switch (importMethod) - { - case EnumImportMethod.Update: - entity.SetId(exist != null ? exist.Id : GuidGenerator.Create()); + // var entityExpression = GetEntityExpression(); - if (exist != null) - { - entity.SetId(exist.Id); - } - break; - case EnumImportMethod.Replace: - if (exist != null) - { - deleteEntites.Add(exist); - } + // var groupList = importResult.Data.ToList().GroupBy(entityExpression).Distinct().ToList(); - entity.SetId(GuidGenerator.Create()); - break; - } + // foreach (var group in groupList) + // { + // var input = group.FirstOrDefault(); - foreach (var inputDetail in inputDetails) - { - var detail = ObjectMapper.Map(inputDetail); + // var inputDetails = group.ToList(); - detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + // if (!inputDetails.Any(t => t.ReportStatus == EnumImportReportStatus.Failed)) + // { + // var exist = await GetEntityAsync(input).ConfigureAwait(false); - await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); - entity.AddDetail(detail); - } + // var entity = ObjectMapper.Map(input); - entites.Add(entity); - } - } + // await SetEntityPropertiesAsync(entity, input).ConfigureAwait(false); - return (entites, deleteEntites); - } + // switch (importMethod) + // { + // case EnumImportMethod.Update: + // entity.SetId(exist != null ? exist.Id : GuidGenerator.Create()); - private async Task SetDetailPropertiesAsync(ProductReceiptRequestDetail detail, ProductReceiptRequestImportInput input) - { - var itemBasic = await ItemBasicAclService.GetByCodeAsync(input.ItemCode).ConfigureAwait(false); + // if (exist != null) + // { + // entity.SetId(exist.Id); + // } - if (itemBasic != null) - { - detail.ItemName = itemBasic.Name; - detail.ItemDesc1 = itemBasic.Desc1; - detail.ItemDesc2 = itemBasic.Desc2; - detail.Qty = input.Qty; - detail.StdPackQty = itemBasic.StdPackQty; - } + // break; + // case EnumImportMethod.Replace: + // if (exist != null) + // { + // deleteEntites.Add(exist); + // } - var location = await LocationAclService.GetByCodeAsync(input.LocationCode).ConfigureAwait(false); + // entity.SetId(GuidGenerator.Create()); + // break; + // } - if (location != null) - { - detail.LocationErpCode = location.ErpLocationCode; - detail.WarehouseCode = location.WarehouseCode; - } - } + // foreach (var inputDetail in inputDetails) + // { + // var detail = + // ObjectMapper.Map(inputDetail); - private async Task SetEntityPropertiesAsync(ProductReceiptRequest entity, ProductReceiptRequestImportInput input) - { - entity.Worker = CurrentUser.GetUserName(); + // detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } + // await SetDetailPropertiesAsync(detail, input).ConfigureAwait(false); + // entity.AddDetail(detail); + // } - private async Task SetRequestAutoPropertiesAsync(ProductReceiptRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.ProductReceipt, Enum.Parse(entity.Type)).ConfigureAwait(false); + // entites.Add(entity); + // } + // } - Check.NotNull(tranType, "事务类型", "事务类型不存在"); + // return (entites, deleteEntites); + //} - entity.AutoCompleteJob = tranType.AutoCompleteJob; - entity.AutoSubmit = tranType.AutoSubmitRequest; - entity.AutoAgree = tranType.AutoAgreeRequest; - entity.AutoHandle = tranType.AutoHandleRequest; - entity.DirectCreateNote = tranType.DirectCreateNote; - } + //private async Task SetEntityPropertiesAsync(ProductReceiptRequest entity, ProductReceiptRequestImportInput input) + //{ + // entity.Worker = CurrentUser.GetUserName(); - #endregion + // await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); + //} } 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 1f997794c..11691171d 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 @@ -6,7 +6,9 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Label.Application.Contracts; using Win_in.Sfs.Label.Domain; @@ -14,6 +16,7 @@ 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.Inventory.Domain; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -30,18 +33,22 @@ public class PurchaseReturnRequestAppService : SfsStoreRequestAppServiceBase , IPurchaseReturnRequestAppService { - private readonly IPurchaseReturnRequestManager _purchaseReturnRequestManager; - private readonly IInventoryLabelAppService _inventoryLabelApp; + private readonly ILocationAppService _locationAppService; + private readonly ITransactionTypeAppService _transactionTypeAppService; + private readonly IPurchaseReturnRequestManager _purchaseReturnRequestManager; public PurchaseReturnRequestAppService( IPurchaseReturnRequestRepository repository, IPurchaseReturnRequestManager purchaseReturnRequestManager, - IInventoryLabelAppService inventoryLabelApp - ) : base(repository, purchaseReturnRequestManager) + IInventoryLabelAppService inventoryLabelApp, + ILocationAppService locationAppService, + ITransactionTypeAppService transactionTypeAppService) : base(repository, purchaseReturnRequestManager) { _purchaseReturnRequestManager = purchaseReturnRequestManager; - this._inventoryLabelApp = inventoryLabelApp; + _inventoryLabelApp = inventoryLabelApp; + _locationAppService = locationAppService; + _transactionTypeAppService = transactionTypeAppService; base.CreatePolicyName = PurchaseReturnRequestPermissions.Create; base.UpdatePolicyName = PurchaseReturnRequestPermissions.Update; @@ -55,6 +62,102 @@ public class PurchaseReturnRequestAppService : 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 purchaseReturnRequest in addList) + { + await SetRequestAutoPropertiesAsync(purchaseReturnRequest).ConfigureAwait(false); + purchaseReturnRequest.Worker = CurrentUser.GetUserName(); + purchaseReturnRequest.CreatorId = CurrentUser.Id; + + foreach (var detail in purchaseReturnRequest.Details) + { + //通过箱标签 查找标签服务 构造其他字段 + var labelDto = await _inventoryLabelApp.GetByCodeAsync(detail.PackingCode).ConfigureAwait(false); + var balanceDto = await BalanceAclService.GetByPackingCodeAsync(detail.PackingCode).ConfigureAwait(false); + var locationDto= await _locationAppService.GetByCodeAsync(balanceDto.LocationCode).ConfigureAwait(false); + purchaseReturnRequest.AsnNumber = labelDto.AsnNumber; + purchaseReturnRequest.RpNumber = labelDto.RpNumber; + purchaseReturnRequest.ReturnTime=DateTime.Now; + purchaseReturnRequest.SupplierCode= labelDto.SupplierCode; + purchaseReturnRequest.ReturnType = EnumPurchaseReturnType.AfterPuton; + purchaseReturnRequest.PoNumber = labelDto.PoNumber; + await SetDetailPropertiesAsync(detail, labelDto, balanceDto,locationDto).ConfigureAwait(false); + } + } + + return dictionary; + } + + /// + /// 赋值Request业务属性 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(PurchaseReturnRequest entity) + { + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.PurchaseReturn, 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( + PurchaseReturnRequestDetail detail, + InventoryLabelDto labelDto, + BalanceDTO balanceDto, + LocationDTO locationDto) + { + if (labelDto != null) + { + detail.PoNumber = labelDto.PoNumber; + } + + if (balanceDto != null) + { + detail.PackingCode = balanceDto.PackingCode; + detail.ContainerCode = balanceDto.ContainerCode; + + detail.WarehouseCode = locationDto.WarehouseCode; + detail.LocationCode = balanceDto.LocationCode; + detail.LocationErpCode = locationDto.ErpLocationCode; + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup = locationDto.LocationGroupCode; + + detail.Status = balanceDto.Status; + detail.Lot = balanceDto.Lot; + detail.SupplierBatch = balanceDto.SupplierBatch; + detail.Uom = balanceDto.Uom; + detail.ArriveDate = balanceDto.ArriveDate; + detail.ProduceDate = balanceDto.ProduceDate; + detail.ExpireDate = balanceDto.ExpireDate; + detail.ItemName = balanceDto.ItemName; + detail.ItemDesc1 = balanceDto.ItemDesc1; + detail.ItemDesc2 = balanceDto.ItemDesc2; + detail.StdPackQty = balanceDto.StdPackQty; + detail.Qty = balanceDto.Qty; + } + } + + #endregion + + #region 校验 + protected virtual async Task CheckImportInputBusinessAsync(PurchaseReturnRequestImportInput importInput, EnumImportMethod importMethod, List validationRresult) { //await base.CheckImportInputBusinessAsync(importInput, importMethod); @@ -140,162 +243,6 @@ public class PurchaseReturnRequestAppService : return transactionType; } - protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - { - await _purchaseReturnRequestManager.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, inputDetail).ConfigureAwait(false); - entity.AddDetail(detail); - } - - entites.Add(entity); - } - } - - return (entites, deleteEntites); - } - - private async Task SetDetailPropertiesAsync( - PurchaseReturnRequestDetail detail, - PurchaseReturnRequestImportInput input) - { - //通过箱标签 查找标签服务 构造其他字段 - - var label = await _inventoryLabelApp.GetByCodeAsync(input.PackingCode).ConfigureAwait(false); - - if (label != null) - { - detail.PoNumber = label.PoNumber; - } - - var balance = await BalanceAclService.GetByPackingCodeAsync(input.PackingCode).ConfigureAwait(false); - - if (balance != null) - { - detail.PackingCode = balance.PackingCode; - detail.ContainerCode = balance.ContainerCode; - detail.LocationCode = balance.LocationCode; - detail.LocationErpCode = balance.LocationErpCode; - detail.WarehouseCode = balance.WarehouseCode; - detail.Status = balance.Status; - detail.Lot = balance.Lot; - detail.SupplierBatch = balance.SupplierBatch; - detail.ArriveDate = balance.ArriveDate; - detail.ProduceDate = balance.ProduceDate; - detail.ExpireDate = balance.ExpireDate; - detail.ItemName = balance.ItemName; - detail.ItemDesc1 = balance.ItemDesc1; - detail.ItemDesc2 = balance.ItemDesc2; - detail.StdPackQty = balance.StdPackQty; - - detail.Qty = balance.Qty; - } - } - - private async Task SetEntityPropertiesAsync(PurchaseReturnRequest entity, PurchaseReturnRequestImportInput input) - { - entity.Worker = CurrentUser.GetUserName(); - - //通过箱标签 查找标签服务 构造其他字段 - - var label = await _inventoryLabelApp.GetByCodeAsync(input.PackingCode).ConfigureAwait(false); - - Check.NotNull(label, nameof(InventoryLabel)); - - entity.RpNumber = label.RpNumber; - entity.AsnNumber = label.AsnNumber; - entity.PoNumber = label.PoNumber; - - var balance = await BalanceAclService.GetByPackingCodeAsync(input.PackingCode).ConfigureAwait(false); - - Check.NotNull(balance, nameof(BalanceDTO)); - - //var order = await this._orderAppService.GetByNumberAsync(label.PoNumber); - - //Check.NotNull(order, nameof(PurchaseOrder)); - - entity.SupplierCode = label.SupplierCode; - - entity.ReturnTime = DateTime.Now; - - await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); - } - - private async Task SetRequestAutoPropertiesAsync(PurchaseReturnRequest entity) - { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.PurchaseReturn, 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; - } - /// /// 被 TransactionTypeHelper.CheckTransactionType()取代 /// @@ -375,4 +322,5 @@ public class PurchaseReturnRequestAppService : } + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs index 2c81b848c..be7623764 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs @@ -66,11 +66,27 @@ public class ScrapRequestAppService : SfsStoreRequestAppServiceBase { scrapRequest.CreatorId = CurrentUser.Id; scrapRequest.Worker = CurrentUser.Name; - - scrapRequest.Type = EnumTransSubType.Scrap_WIP.ToString(); scrapRequest.ActiveDate = DateTime.Now; + scrapRequest.Type = scrapRequest.Type; + + EnumTransSubType enumTransSubType = 0; + + if (scrapRequest.Type == "原料报废") + { + enumTransSubType = EnumTransSubType.Scrap_Manual; + } + + if (scrapRequest.Type== "线边报废") + { + enumTransSubType = EnumTransSubType.Scrap_WIP; + } + + if (scrapRequest.Type == "完工报废") + { + enumTransSubType = EnumTransSubType.Scrap_Product; + } - await SetEntityPropertiesAsync(scrapRequest, EnumTransSubType.Scrap_WIP).ConfigureAwait(false); + await SetEntityPropertiesAsync(scrapRequest, enumTransSubType).ConfigureAwait(false); foreach (var detail in scrapRequest.Details) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJob.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJob.cs index 8749782e5..03978c7a8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJob.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJob.cs @@ -78,14 +78,18 @@ public class PurchaseReturnJob : SfsJobAggregateRootBase /// /// - public virtual async Task SetDetail(Guid id, string handledLocationCode, string handledLocationErpCode, string handledWarehouseCode, decimal handledQty, + public virtual async Task SetDetail(Guid id, string handledLocationCode, string handledLocationErpCode, string handledWarehouseCode,string handledFromLocationArea,string handledFromLocationGroup, decimal handledQty, string handledSupplierBatch, DateTime handledArriveDate, DateTime handledProduceDate, DateTime handledExpireDate, string handledContainerCode, string handledLot, string handledPackingCode, string reason) { var detail = GetDetail(id); detail.HandledFromLocationCode = handledLocationCode; detail.HandledFromLocationErpCode = handledLocationErpCode; + detail.HandledFromLocationArea = handledFromLocationArea; detail.HandledFromWarehouseCode = handledWarehouseCode; + detail.HandledFromLocationGroup = handledFromLocationGroup; + detail.HandledQty = handledQty; + detail.HandledSupplierBatch = handledSupplierBatch; detail.HandledArriveDate = handledArriveDate; detail.HandledProduceDate = handledProduceDate; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJobManager.cs index 081df3087..c375cbcfd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/PurchaseReturnJobs/PurchaseReturnJobManager.cs @@ -35,13 +35,19 @@ public class PurchaseReturnJobManager : SfsJobManagerBase p.Id == detail.Id); await entity.SetDetail( detail.Id, detail.HandledFromLocationCode, detail.HandledFromLocationErpCode, detail.HandledFromWarehouseCode, + detail.HandledFromLocationArea, + detail.HandledFromLocationGroup, detail.HandledQty, - detail.HandledSupplierBatch, detail.HandledArriveDate, detail.HandledProduceDate, detail.HandledExpireDate, + detail.HandledSupplierBatch, + detail.HandledArriveDate, + detail.HandledProduceDate, + detail.HandledExpireDate, detail.HandledContainerCode, detail.HandledLot, detail.HandledPackingCode, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteManager.cs index be4733302..5b6caa107 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteManager.cs @@ -12,9 +12,12 @@ public class ProductReceiptNoteManager : SfsStoreManagerBase private async Task BackFlushAsync(ProductReceiptNote productReceiptNote) { - //生成【MES】回冲接口 TODO #region 【判断】是否需要记录回冲记录 及下线结算接口 - //【判断】是否需要记录回冲记录 TODO - //【是】 完工收货时,创建回冲记录 + //【是】 完工收货时,创建回冲记录 //var isBackFlush = await SettingManager.IsTrueAsync(StoreSettings.ProductionReceipt.AutoCreateBackFlush); ; //扣原材料 //var isOffLine = await _settingProvider.IsTrueAsync(StoreSettings.ProductionReceipt.AutoCreateOfflineSettlement); ; //下线结算 + + //是否需要下线结算 - //获取所有成品的零件号 - //一次性获得所有BOM信息避免每个明细都查询一遍;false 为bom不展开,便于测试 - var totalBomList = await GetBomListAsync(productReceiptNote).ConfigureAwait(false); + if (isBackFlush || isOffLine) + { + //获取所有成品的零件号 + //一次性获得所有BOM信息避免每个明细都查询一遍;false 为bom不展开,便于测试 + var totalBomList = await GetBomListAsync(productReceiptNote); - //取不到bom信息要报错,不能进行下去 + //取不到bom信息要报错,不能进行下去 - //根据回冲记录获取成品零件种类和数量,并获取相关要消耗的原材料库存 - var productSumList = productReceiptNote.Details.GroupBy(p => new { p.ItemCode, p.RawLocationCode, p.Qty }) - .Select(s => new BackFlushInventoryTotal - { - ItemCode = s.Key.ItemCode, - RawLocationCode = s.Key.RawLocationCode, - Qty = s.Key.Qty, - TotalQty = s.Sum(n => n.Qty), - }).ToList(); - //根据父级零件汇总的数量,获取BOM子表明细原材料的数量 - var subInventoryTotalList = new List(); + //根据回冲记录获取成品零件种类和数量,并获取相关要消耗的原材料库存 + var productSumList = productReceiptNote.Details.GroupBy(p => new { p.ItemCode, p.RawLocationCode, p.Qty }) + .Select(s => new BackFlushInventoryTotal + { + ItemCode = s.Key.ItemCode, + RawLocationCode = s.Key.RawLocationCode, + Qty = s.Key.Qty, + TotalQty = s.Sum(n => n.Qty), + }).ToList(); - foreach (var productSumItem in productSumList) - { - var subBomList = totalBomList.Where(p => p.Product == productSumItem.ItemCode).ToList(); - //根据bom和父级零件总数获取子零件总数,然后将子零件总数汇总进 总零件数量 - await GetSubBackFlushInventoryList(productSumItem, subBomList, subInventoryTotalList).ConfigureAwait(false); - } + //根据父级零件汇总的数量,获取BOM子表明细原材料的数量 + var subInventoryTotalList = new List(); - await _backFlushNoteManager.CreateByProductReceiptNoteAsync(productReceiptNote, subInventoryTotalList) - .ConfigureAwait(false); + foreach (var productSumItem in productSumList) + { + var subBomList = totalBomList.Where(p => p.Product == productSumItem.ItemCode).ToList(); - //【判断】是否需要下线结算 - if (subInventoryTotalList.Any(p => p.IsOffLine == true)) - { - //【是】 创建【下线结算记录】 - await _offlineSettlementNoteManager - .CreateByProductReceiptNoteAsync(productReceiptNote, subInventoryTotalList).ConfigureAwait(false); + //根据bom和父级零件总数获取子零件总数,然后将子零件总数汇总进 总零件数量 + await GetSubBackFlushInventoryList(productSumItem, subBomList, subInventoryTotalList).ConfigureAwait(false); + } + + if (isBackFlush) + { + await _backFlushNoteManager.CreateByProductReceiptNoteAsync(productReceiptNote, subInventoryTotalList).ConfigureAwait(false); + } + //【判断】是否需要下线结算 + if (isOffLine && subInventoryTotalList.Any(p => p.IsOffLine == true)) + { + //【是】 创建【下线结算记录】 + await _offlineSettlementNoteManager.CreateByProductReceiptNoteAsync(productReceiptNote, subInventoryTotalList).ConfigureAwait(false); + + } } #endregion diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ProductReceiptRequests/ProductReceiptRequest.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ProductReceiptRequests/ProductReceiptRequest.cs index e81b58839..7d9b25646 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ProductReceiptRequests/ProductReceiptRequest.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Requests/ProductReceiptRequests/ProductReceiptRequest.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Win_in.Sfs.Shared.Domain.Entities; +using Win_in.Sfs.Shared.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Domain; @@ -43,7 +44,7 @@ public class ProductReceiptRequest : SfsStoreRequestAggregateRootBase [IgnoreUpdate] - public string Type { get; set; } + public EnumProductReceiptType Type { get; set; } /// /// 明细列表 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ProductReceiptRequests/ProductReceiptRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ProductReceiptRequests/ProductReceiptRequestDbContextModelCreatingExtensions.cs index 366dd9158..9e3184751 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ProductReceiptRequests/ProductReceiptRequestDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/ProductReceiptRequests/ProductReceiptRequestDbContextModelCreatingExtensions.cs @@ -23,8 +23,8 @@ public static class ProductReceiptRequestDbContextModelCreatingExtensions b.Property(q => q.ProdLine).HasMaxLength(SfsPropertyConst.NameLength); b.Property(q => q.Shift).HasMaxLength(SfsPropertyConst.NameLength); b.Property(q => q.Team).HasMaxLength(SfsPropertyConst.NameLength); - b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.NameLength); b.Property(q => q.PlanDate); + b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion(); //Relations diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestDbContextModelCreatingExtensions.cs index 8178b4c88..6ee78be44 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestDbContextModelCreatingExtensions.cs @@ -24,7 +24,6 @@ public static class PurchaseReceiptRequestDbContextModelCreatingExtensions b.Property(q => q.PlanArriveDate).IsRequired(); b.Property(q => q.Number).IsRequired(); b.Property(q => q.TimeWindow).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength); - b.Property(q => q.SupplierName).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.AsnNumber).HasMaxLength(SfsPropertyConst.NameLength); b.Property(q => q.RpNumber).HasMaxLength(SfsPropertyConst.NameLength); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs index 0622a13c0..065cc9c81 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/DeliverJobAutoMapperProfile.cs @@ -18,6 +18,7 @@ public partial class StoreEventAutoMapperProfile : Profile .ForMember(x => x.JobNumber, y => y.MapFrom(d => d.Number)) .ForMember(x => x.ActiveDate, y => y.MapFrom(d => DateTime.Now)) .ForMember(x => x.Worker, y => y.MapFrom(d => d.CompleteUserName)) + .Ignore(x=>x.CountPrint) ; CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs index 8cc67eb37..5dbb2df1b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/DeliverRequestMapperProfile.cs @@ -72,6 +72,7 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .ForMember(x => x.DeliverRequestNumber, y => y.MapFrom(d => d.Number)).Ignore(x => x.JobNumber) + .Ignore(x=>x.CountPrint) .Ignore(x => x.Details); CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReturnRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReturnRequestAutoMapperProfile.cs index bbe21a42e..19215afb5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReturnRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReturnRequestAutoMapperProfile.cs @@ -15,7 +15,7 @@ public partial class StoreEventAutoMapperProfile : Profile CreateMap() .ForMember(x => x.PurchaseReturnRequestNumber, y => y.MapFrom(d => d.Number)) - .Ignore(x => x.WarehouseCode) + .Ignore(x=>x.WarehouseCode) .Ignore(x => x.IsAutoComplete) .Ignore(x => x.JobType) .Ignore(x => x.JobDescription) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InspectRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InspectRequestEventHandler.cs index 427044073..0855510ab 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InspectRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/InspectRequestEventHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.EventBus; +using Volo.Abp.Uow; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -28,6 +29,7 @@ public class InspectRequestEventHandler : StoreEventHandlerBase /// /// /// + [UnitOfWork] public virtual async Task HandleEventAsync(SfsCancelledEntityEventData eventData) { var entity = eventData.Entity; @@ -39,6 +41,7 @@ public class InspectRequestEventHandler : StoreEventHandlerBase /// /// /// + [UnitOfWork] public virtual async Task HandleEventAsync(SfsAgreedEntityEventData eventData) { await Task.CompletedTask.ConfigureAwait(false); @@ -50,6 +53,7 @@ public class InspectRequestEventHandler : StoreEventHandlerBase /// /// /// + [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { var entity = eventData.Entity; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ProductReceiptNoteEventHandler.cs similarity index 70% rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptNoteEventHandler.cs rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ProductReceiptNoteEventHandler.cs index 27e909f60..a0af46225 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/ProductReceiptNoteEventHandler.cs @@ -18,15 +18,17 @@ public class ProductReceiptNoteEventHandler { private readonly IPutawayJobAppService _putawayJobAppService; - private readonly IProductReceiptRequestAppService _productReceiptRequestApp; + //private readonly IProductReceiptRequestAppService _productReceiptRequestApp; + private readonly IProductReceiptRequestManager _productReceiptRequestManager; public ProductReceiptNoteEventHandler( IPutawayJobAppService putawayJobAppService - , IProductReceiptRequestAppService productReceiptRequestApp - ) + //, IProductReceiptRequestAppService productReceiptRequestApp + , IProductReceiptRequestManager productReceiptRequestManager) { _putawayJobAppService = putawayJobAppService; - _productReceiptRequestApp = productReceiptRequestApp; + //_productReceiptRequestApp = productReceiptRequestApp; + _productReceiptRequestManager = productReceiptRequestManager; } public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) @@ -41,7 +43,9 @@ public class ProductReceiptNoteEventHandler if (!string.IsNullOrEmpty(entity.ProductReceiptRequestNumber)) { - await _productReceiptRequestApp.CompleteByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + //await _productReceiptRequestApp.CompleteByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + var productReceiptRequest=await _productReceiptRequestManager.GetByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + await _productReceiptRequestManager.CompleteAsync(productReceiptRequest).ConfigureAwait(false); } } @@ -64,7 +68,9 @@ public class ProductReceiptNoteEventHandler { if (!string.IsNullOrEmpty(entity.ProductReceiptRequestNumber)) { - await _productReceiptRequestApp.CompleteByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + //await _productReceiptRequestApp.CompleteByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + var productReceiptRequest = await _productReceiptRequestManager.GetByNumberAsync(entity.ProductReceiptRequestNumber).ConfigureAwait(false); + await _productReceiptRequestManager.CompleteAsync(productReceiptRequest).ConfigureAwait(false); } } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs index 1bca59154..e59b18222 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ProductReceiptRequestEventHandler.cs @@ -19,22 +19,62 @@ public class ProductReceiptRequestEventHandler : StoreEventHandlerBase , ILocalEventHandler> , ILocalEventHandler> + ,ILocalEventHandler> + , ILocalEventHandler>> { private readonly IProductReceiveJobAppService _productReceiveJobAppService; private readonly IProductionLineAppService _productionLineAppService; private readonly IProductReceiptNoteAppService _productReceiptNoteApp; + private readonly IProductReceiptRequestManager _productReceiptRequestManager; public ProductReceiptRequestEventHandler( IProductReceiveJobAppService productReceiveJobAppService , IProductionLineAppService productionLineAppService , IProductReceiptNoteAppService productReceiptNoteApp - ) + , IProductReceiptRequestManager productReceiptRequestManager) { _productReceiveJobAppService = productReceiveJobAppService; _productionLineAppService = productionLineAppService; this._productReceiptNoteApp = productReceiptNoteApp; + _productReceiptRequestManager = productReceiptRequestManager; } + /// + /// 创建后 + /// + /// Event data + [UnitOfWork] + public async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.AutoSubmit) + { + await _productReceiptRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + + /// + /// 批量创建后 + /// + /// Event data + [UnitOfWork] + public async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _productReceiptRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } + } + + /// + /// 审批后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) { @@ -53,6 +93,11 @@ public class ProductReceiptRequestEventHandler } } + /// + /// 取消后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCancelledEntityEventData eventData) { @@ -60,6 +105,7 @@ public class ProductReceiptRequestEventHandler await _productReceiveJobAppService.CancelByProductionPlanAsync(entity.Number).ConfigureAwait(false); } + #region 私有 private async Task> BuildProductReceiveJobsAsync( ProductReceiptRequest productionPlan) { @@ -160,4 +206,6 @@ public class ProductReceiptRequestEventHandler return note; } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReturnRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReturnRequestEventHandler.cs index 00d4f1c96..59d9a65cd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReturnRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PurchaseReturnRequestEventHandler.cs @@ -13,25 +13,57 @@ public class PurchaseReturnRequestEventHandler : StoreEventHandlerBase , ILocalEventHandler> , ILocalEventHandler> + , ILocalEventHandler> + , ILocalEventHandler>> { private readonly IPurchaseReturnJobAppService _purchaseReturnJobAppService; + private readonly IPurchaseReturnRequestManager _purchaseReturnRequestManager; public PurchaseReturnRequestEventHandler( - IPurchaseReturnJobAppService purchaseReturnJobAppService - ) + IPurchaseReturnJobAppService purchaseReturnJobAppService, + IPurchaseReturnRequestManager purchaseReturnRequestManager) { _purchaseReturnJobAppService = purchaseReturnJobAppService; + _purchaseReturnRequestManager = purchaseReturnRequestManager; } - public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) - { - var request = eventData.Entity; - var jobCreateInputs = await BuildPurchaseReturnJobDetailAsync(request).ConfigureAwait(false); + /// + /// 创建后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + if (entity.AutoSubmit) + { + await _purchaseReturnRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } - await _purchaseReturnJobAppService.CreateManyAsync(jobCreateInputs).ConfigureAwait(false); + /// + /// 批量创建后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entitys = eventData.Entity; + foreach (var entity in entitys) + { + if (entity.AutoSubmit) + { + await _purchaseReturnRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } + } } + /// + /// 审批后 + /// + /// + /// public virtual async Task HandleEventAsync(SfsAbortedEntityEventData eventData) { var request = eventData.Entity; @@ -39,6 +71,20 @@ public class PurchaseReturnRequestEventHandler await _purchaseReturnJobAppService.CancelByPurchaseReturnRequestAsync(request.Number).ConfigureAwait(false); } + /// + /// 执行后 + /// + /// + /// + public virtual async Task HandleEventAsync(SfsHandledEntityEventData eventData) + { + var request = eventData.Entity; + + var jobCreateInputs = await BuildPurchaseReturnJobDetailAsync(request).ConfigureAwait(false); + + await _purchaseReturnJobAppService.CreateManyAsync(jobCreateInputs).ConfigureAwait(false); + } + #region 私有 private async Task> BuildPurchaseReturnJobDetailAsync(PurchaseReturnRequest request) @@ -50,11 +96,11 @@ public class PurchaseReturnRequestEventHandler foreach (var item in groupBy) { var location = await LocationAclService.GetByCodeAsync(item.Key).ConfigureAwait(false); - if (location != null) { //初始化 var job = ObjectMapper.Map(request); + job.WarehouseCode = location.WarehouseCode; job.JobType = EnumJobType.PurchaseReturnJob; job.JobStatus = EnumJobStatus.Open; @@ -79,4 +125,5 @@ public class PurchaseReturnRequestEventHandler } #endregion + }