From 611ab18e970094d0c5717d7f4ada109ef5eb078e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=B8=A4=E6=97=AD=5BIrelia=5D?= <366601522@qq.com> Date: Sun, 9 Apr 2023 14:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=94=B6=E8=B4=A7=20>=20?= =?UTF-8?q?=E6=94=B6=E8=B4=A7=E4=BB=BB=E5=8A=A1=20>=20=E6=8A=A5=E6=A3=80?= =?UTF-8?q?=E5=8D=95=EF=BC=88=E8=B4=A8=E6=A3=80=E4=BB=BB=E5=8A=A1=EF=BC=89?= =?UTF-8?q?=20>=20=E6=A3=80=E9=AA=8C=E8=AE=B0=E5=BD=95=20>=20=E4=B8=8D?= =?UTF-8?q?=E5=90=88=E6=A0=BC=E5=BA=93=E5=AD=98=20=E4=B8=8D=E5=90=88?= =?UTF-8?q?=E6=A0=BC=E8=BD=AC=E5=90=88=E6=A0=BC=20=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=20=E5=BA=93=E5=AD=98=E4=BA=8B=E5=8A=A1=20?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E8=BD=AC=E7=A7=BB=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=9F=A5=E8=AF=A2=20=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E9=86=92=20=E9=87=87=E8=B4=AD=E4=B8=8A=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PlanAndActualController.cs | 19 ++-- .../TransferLogAutoMapperProfile.cs | 12 ++ .../Transactions/Transaction.cs | 3 + .../TransferLogs/TransferLogExtensions.cs | 2 + .../UserNotifyMessageAutoMapperProfile.cs | 2 + .../UserNotifyMessageService.cs | 1 - .../ClosedXmlExportImportService.cs | 11 ++ .../CurrentUserExtensions.cs | 2 +- .../Inputs/TransferNoteImportInput.cs | 5 + .../InventoryTransferNoteMapperProfile.cs | 17 ++- .../NoOkConvertOKNoteAutoMapperProfile.cs | 5 +- .../PutawayNoteAutoMapperProfile.cs | 4 + .../Jobs/InspectJobs/InspectJobManager.cs | 21 +++- ...PurchaseReceiptRequestAutoMapperProfile.cs | 1 - .../Jobs/InspectJobEventHandler.cs | 105 ++++++++++++++---- .../Requests/PutawayRequestEventHandler.cs | 1 - .../Transactions/InspectNoteEventHandler.cs | 2 + .../PurchaseReceiptNoteEventHandler.cs | 2 + .../publish/conf/settings/appsettings.json | 4 +- 19 files changed, 177 insertions(+), 42 deletions(-) diff --git a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs index c62b042bf..0dc46b18f 100644 --- a/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs +++ b/be/Hosts/Win_in.Sfs.Wms.Dashboard.Host/Controllers/PlanAndActualController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Serilog; using Volo.Abp.AspNetCore.Mvc; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Dashboard.Host.Models; @@ -101,9 +102,9 @@ public class PlanAndActualController : AbpController dto.MinQty = itemSafetyStork.MinStock; } - dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode); - dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode); - dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode); + dto.ReceiptNoteCount = CountReceiptNoteCount(purchaseReceipts, detail.ItemCode, detail.Lot); + dto.ReceiptQty = CountReceiptQty(purchaseReceipts, detail.ItemCode, detail.Lot); + dto.PutawayQty = CountPutawayQty(putawayNotes, detail.ItemCode, detail.Lot); dtos.Add(dto); } @@ -117,19 +118,19 @@ public class PlanAndActualController : AbpController return dtos.OrderBy(t => t.SupplierShortName).ToList(); } - private static decimal CountPutawayQty(List putawayNotes, string itemCode) + private static decimal CountPutawayQty(List putawayNotes, string itemCode, string lot) { - return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty)); + return putawayNotes.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.ToLot == lot).Sum(t => t.Qty)); } - private static decimal CountReceiptQty(List purchaseReceipts, string itemCode) + private static decimal CountReceiptQty(List purchaseReceipts, string itemCode, string lot) { - return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode).Sum(t => t.Qty)); + return purchaseReceipts.Sum(t => t.Details.Where(t => t.ItemCode == itemCode && t.HandledLot == lot).Sum(t => t.Qty)); } - private static int CountReceiptNoteCount(List purchaseReceipts, string itemCode) + private static int CountReceiptNoteCount(List purchaseReceipts, string itemCode, string lot) { - return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode)); + return purchaseReceipts.Sum(t => t.Details.Count(t => t.ItemCode == itemCode && t.Lot == lot)); } private async Task> GetSupplierAsnsAsync() diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs index 853045acb..5111d1731 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/TransferLogs/TransferLogAutoMapperProfile.cs @@ -1,4 +1,5 @@ using AutoMapper; +using Volo.Abp.AutoMapper; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Domain; @@ -10,6 +11,17 @@ public partial class InventoryApplicationAutoMapperProfile : Profile { CreateMap() .ReverseMap(); + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TransferNumber) + .Ignore(x => x.FromTransNumber) + .Ignore(x => x.ToTransNumber) + .Ignore(x => x.TransferTime) + .Ignore(x => x.ActiveDate) + .Ignore(x => x.ConcurrencyStamp) + .Ignore(x => x.Id) + ; } } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs index 335ebcdd3..3414f7104 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Transactions/Transaction.cs @@ -56,6 +56,9 @@ public class Transaction : SfsInventoryAggregateRootBase JobNumber = other.JobNumber; DocNumber = other.DocNumber; ManageType = other.ManageType; + LocationGroup= other.LocationGroup; + LocationArea= other.LocationArea; + LocationErpCode= other.LocationErpCode; } /// diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs index 42a056d2d..804b35ee7 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/TransferLogs/TransferLogExtensions.cs @@ -62,6 +62,7 @@ public static class TransferLogExtensions transaction.ProduceDate = transferLog.ProduceDate; transaction.ExpireDate = transferLog.ExpireDate; transaction.StdPackQty = transferLog.StdPackQty; + transaction.Uom = transferLog.Uom; //出库库存事务的数量要改成负数 transaction.Qty = -transferLog.Qty; @@ -92,6 +93,7 @@ public static class TransferLogExtensions transaction.ProduceDate = transferLog.ProduceDate; transaction.ExpireDate = transferLog.ExpireDate; transaction.StdPackQty = transferLog.StdPackQty; + transaction.Uom = transferLog.Uom; transaction.Qty = transferLog.Qty; return transaction; 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 48275639c..6695cb221 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 @@ -1,3 +1,4 @@ +using System; using AutoMapper; using Volo.Abp.AutoMapper; using Win_in.Sfs.Message.Application.Contracts; @@ -11,6 +12,7 @@ public class UserNotifyMessageAutoMapperProfile : Profile { CreateMap() .IgnoreAuditedObjectProperties() + .BeforeMap((x, y) => y.UserId = x.CreatorId==null?Guid.Empty: x.CreatorId.Value) .ReverseMap(); CreateMap(); diff --git a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs index 7a9a9f491..5d38f1352 100644 --- a/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs +++ b/be/Modules/Message/src/Win_in.Sfs.Message.Application/UserNotifyMessages/UserNotifyMessageService.cs @@ -23,7 +23,6 @@ namespace Win_in.Sfs.Message.Application; public class UserNotifyMessageService : SfsMessageCrudAppServiceBase , IUserNotifyMessageService { - public UserNotifyMessageService(IUserNotifyMessageRepository repository) : base(repository) { } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs index 26fd511e7..91d1cb82c 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/ExportAndImport/ClosedXmlExportImportService.cs @@ -11,6 +11,7 @@ using ClosedXML; using ClosedXML.Excel; using ClosedXML.Graphics; using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Wordprocessing; using Irony; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -37,6 +38,11 @@ public class ClosedXmlExportImportService : IExportImportService { using var workbook = new XLWorkbook(); var name = typeof(TModel).GetCustomAttribute()?.Name ?? typeof(TModel).Name; + if (name.Length > 30) + { + name=name.Substring(0, 30); + } + var fileName = $"{name}_导出.xlsx"; var ws = workbook.Worksheets.Add(name); ws.Style.Font.FontName = "宋体"; @@ -79,6 +85,11 @@ public class ClosedXmlExportImportService : IExportImportService using var workbook = new XLWorkbook(); var type = typeof(TImportModel); var name = type.GetCustomAttribute()?.Name ?? type.Name; + if (name.Length > 30) + { + name=name.Substring(0, 30); + } + var fileName = $"{name}_导入模板.xlsx"; var ws = workbook.Worksheets.Add(name); var properties = GetPropertiesForImportModel(type); diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs index ea9f3afa0..4623096c0 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain/CurrentUserExtensions.cs @@ -6,7 +6,7 @@ public static class CurrentUserExtensions { public static string GetUserName(this ICurrentUser currentUser) { - return currentUser.FindClaimValue("name"); + return currentUser.Name; } public static string GetName(this ICurrentUser currentUser) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs index 928fcb9ea..53c5f1e1c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/TransferNotes/Inputs/TransferNoteImportInput.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using DocumentFormat.OpenXml.Drawing; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -11,6 +12,10 @@ public class TransferNoteImportInput : SfsStoreImportInputBase /// [Display(Name = "调拨类型")] [Required(ErrorMessage = "{0}是必填项")] + [ValueMapping("标准", "Normal")] + [ValueMapping("储位内移库", "enuimSameERPLoc")] + [ValueMapping("储位间移库", "DiffERPLoc")] + [ValueMapping("储位间移库", "ItemScrap")] public string Type { get; set; } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs index b17634241..0f5f18085 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/InventoryTransferNotes/InventoryTransferNoteMapperProfile.cs @@ -17,9 +17,22 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() - .Ignore(x => x.MasterID) .Ignore(x => x.TenantId) .Ignore(x => x.Number) - .Ignore(x => x.Id); + .Ignore(x => x.Id) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Id) + ; + + CreateMap() + .IgnoreAuditedObjectProperties() + .Ignore(x => x.TenantId) + .Ignore(x => x.Id) + ; + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs index 8e4ceba11..11421503a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/NoOkConvertOKNotes/NoOkConvertOKNoteAutoMapperProfile.cs @@ -19,7 +19,10 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() .IgnoreAuditedObjectProperties() .Ignore(x => x.Number) - .Ignore(x => x.Details) .Ignore(x => x.Id); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs index bc9465bde..43030955a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAutoMapperProfile.cs @@ -23,5 +23,9 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Number) .Ignore(x => x.Id) .Ignore(x => x.JobNumber); + + CreateMap() + .IgnoreAuditedObjectProperties() + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs index 7f62cdaa6..9930d91b2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/InspectJobs/InspectJobManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.Uow; using Volo.Abp.Users; using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; @@ -47,6 +48,7 @@ public class InspectJobManager : SfsJobManagerBase /// /// /// + [UnitOfWork] public override async Task CompleteAsync(InspectJob input, ICurrentUser user) { //执行任务 @@ -134,12 +136,22 @@ public class InspectJobManager : SfsJobManagerBase /// public async Task CompleteSummaryDetailStatusAsync(Guid id, Guid summaryDetailId, InspectJobSummaryDetail input, ICurrentUser currentUser) { - var jobEntity = await Repository.FindAsync(id).ConfigureAwait(false); + var jobEntity = await Repository.FindAsync(id); + + jobEntity.Details.Where(p => p.DetailInspectStatus == EnumDetailInspectStatus.DefaultOK || + p.DetailInspectStatus == EnumDetailInspectStatus.OK).ToList().ForEach(p => + { + p.GoodQty = p.ReceiveQty; + }); + + var goodqty = jobEntity.Details.Where(p => + p.DetailInspectStatus == EnumDetailInspectStatus.DefaultOK || + p.DetailInspectStatus == EnumDetailInspectStatus.OK).Sum(p => p.GoodQty); //获取 汇总详情 var summaryDetailEntity = jobEntity.SummaryDetails.Find(p => p.Id == summaryDetailId); - var itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode).ConfigureAwait(false); + var itemQuality = await _itemQualityAclService.GetByItemCodeAsync(summaryDetailEntity.ItemCode, jobEntity.SupplierCode); if (itemQuality.InspectType != EnumInspectType.Exempt) { //获取质检标准 @@ -150,6 +162,9 @@ public class InspectJobManager : SfsJobManagerBase await CheckCompleteSummaryDetailAsync(summaryDetailEntity, aql, input).ConfigureAwait(false); } + input.GoodQty = goodqty; + summaryDetailEntity.GoodQty = goodqty; + //构造 汇总详情 await BuildInspectJobSummaryDetailAsync(input, summaryDetailEntity).ConfigureAwait(false); @@ -174,7 +189,7 @@ public class InspectJobManager : SfsJobManagerBase #endregion - await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData(CopyJob),false).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsUpdateEntitySummaryDetailEventData(CopyJob)).ConfigureAwait(false); return summaryDetailEntity; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs index 32442195c..59a16066b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/PurchaseReceiptRequestAutoMapperProfile.cs @@ -41,7 +41,6 @@ public partial class StoreEventAutoMapperProfile : Profile #region PurchaseReceiptRequestDetail, PurchaseReceiptJobDetailInput CreateMap() - .Ignore(x => x.ArriveDate) .Ignore(x => x.Status) .Ignore(x => x.RecommendToLocationCode) .Ignore(x => x.RecommendToLocationErpCode) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs index a4dea093e..c49520a36 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/InspectJobEventHandler.cs @@ -15,51 +15,72 @@ public class InspectJobEventHandler : , ILocalEventHandler> , ILocalEventHandler>> , ILocalEventHandler> -, ILocalEventHandler> + , ILocalEventHandler> { private readonly IInspectNoteAppService _inspectNoteAppService; public InspectJobEventHandler( IInspectNoteAppService inspectNoteAppService - ) + ) { _inspectNoteAppService = inspectNoteAppService; } + /// + /// 质检任务 完成后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData) { var entity = eventData.Entity; - var inspectNote = BuildInspectNote(entity); - await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); } /// - /// 创建 质检任务后 + /// 质检任务创建后 /// /// /// [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) { - var entity = eventData.Entity; - var inspectNote = BuildInspectNote(entity); - await _inspectNoteAppService.CreateAsync(inspectNote).ConfigureAwait(false); - //await CompleteExemptInspectJobAsync(new List { entity }); + var entities = eventData.Entity; + + foreach (var entity in entities) + { + await CreateInspectNoteAsync(entity).ConfigureAwait(false); + } } + /// + /// 创建 质检任务后 + /// + /// + /// [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { - _ = eventData.Entity; + var entity = eventData.Entity; + await CreateInspectNoteAsync(entity).ConfigureAwait(false); + } - //await CompleteExemptInspectJobAsync(entities); - await Task.CompletedTask.ConfigureAwait(false); + #region 私有 + /// + /// 创建质检记录 + /// + /// + /// + private async Task CreateInspectNoteAsync(InspectJob entity) + { + var input = ObjectMapper.Map(entity); + await _inspectNoteAppService.CreateAsync(input).ConfigureAwait(false); + return input; } /// - /// 汇总 详情被修改后 + /// 汇总 详情被修改后 /// /// Event data [UnitOfWork] @@ -75,7 +96,8 @@ public class InspectJobEventHandler : { var noteCreateInput = new InspectNoteEditInput(); - var noteSummaryDetailInput = ObjectMapper.Map(jobSummaryDetail); + var noteSummaryDetailInput = + ObjectMapper.Map(jobSummaryDetail); noteCreateInput.SummaryDetails.Add(noteSummaryDetailInput); @@ -92,13 +114,54 @@ public class InspectJobEventHandler : } /// - /// 构造 质检记录 + /// 完成免检任务 /// - /// + /// /// - private InspectNoteEditInput BuildInspectNote(InspectJob entity) + private async Task CompleteExemptInspectJobAsync(List entities) { - var input = ObjectMapper.Map(entity); - return input; + foreach (var inspectJob in entities) + { + var summaryDetail = inspectJob.SummaryDetails.FirstOrDefault(); + //免检任务自动完成 并调用检验记录生成业务 + if (summaryDetail?.InspectType != EnumInspectType.Exempt) + { + await CompleteExemptInspectJobAsync(inspectJob, summaryDetail); + } + } + } + + /// + /// 处理免检 物品 + /// + /// + /// + /// + private async Task CompleteExemptInspectJobAsync(InspectJob inspectJob, InspectJobSummaryDetail summarydDetail) + { + //任务状态直接完成 + await inspectJob.CompleteAsync(inspectJob.CreatorId, "", Clock.Now).ConfigureAwait(false); + foreach (var detail in inspectJob.Details) + { + await inspectJob.SetDetail( + detail.Id, + detail.GoodQty, + detail.FailedReason, + detail.FailedQty, + detail.CrackQty, + detail.NotPassedQty, + inspectJob.Worker, + detail.SupplierBatch, + detail.ArriveDate, + detail.ProduceDate, + detail.ExpireDate, + detail.ContainerCode, + detail.LocationCode, + detail.Lot, + detail.PackingCode, + detail.ReceiveQty).ConfigureAwait(false); + } } + + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs index acc5b6388..b6f22120f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/PutawayRequestEventHandler.cs @@ -70,7 +70,6 @@ public class PutawayRequestEventHandler /// private async Task BulidPutawayJobCreateInputAsync(PutawayRequest putawayRequest) { - await Task.CompletedTask.ConfigureAwait(false); var createInput = ObjectMapper.Map(putawayRequest); createInput.JobType = EnumJobType.PutawayJob; createInput.JobStatus = EnumJobStatus.Open; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs index c16c3cc10..a55d73a54 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/InspectNoteEventHandler.cs @@ -57,6 +57,8 @@ public class InspectNoteEventHandler FromContainerCode = detail.ContainerCode, FromLocationCode = detail.LocationCode, FromLocationErpCode = detail.LocationErpCode, + FromLocationArea = detail.LocationArea, + FromLocationGroup = detail.LocationGroup, FromLot = detail.Lot, FromPackingCode = detail.PackingCode, FromStatus = EnumInventoryStatus.INSP, diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs index 47c5787d6..891d194c9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/PurchaseReceiptNoteEventHandler.cs @@ -303,6 +303,8 @@ public class PurchaseReceiptNoteEventHandler createInput.Details.ForEach(p => { + p.LocationGroup = inspectLocation.LocationGroupCode; + p.LocationArea = inspectLocation.AreaCode; p.LocationCode = inspectLocation.Code; p.LocationErpCode = inspectLocation.ErpLocationCode; p.WarehouseCode = inspectLocation.WarehouseCode; diff --git a/build/src/docker/publish/conf/settings/appsettings.json b/build/src/docker/publish/conf/settings/appsettings.json index dd6801411..8ad836316 100644 --- a/build/src/docker/publish/conf/settings/appsettings.json +++ b/build/src/docker/publish/conf/settings/appsettings.json @@ -100,13 +100,13 @@ //转发地址配置 "RemoteServices": { "Auth": { - "BaseUrl": "http://localhost:59093/" + "BaseUrl": "http://dev.ccwin-in.com:59093/" }, "BaseData": { "BaseUrl": "http://dev.ccwin-in.com:59094/" }, "Default": { - "BaseUrl": "http://localhost:59093/" + "BaseUrl": "http://dev.ccwin-in.com:59093/" }, "FileStorage": { "BaseUrl": "http://dev.ccwin-in.com:59092/"