diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ErpLocationItemReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ErpLocationItemReader.cs index d7f692439..5fdea32b5 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ErpLocationItemReader.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.TyrpAgent/Incoming/ErpLocationItemReader.cs @@ -43,7 +43,7 @@ public class ErpLocationItemReader : IReader var toBeProcessedIssue = await _ilocdoutManager.GetToBeProcessedListAsync().ConfigureAwait(false); if (!toBeProcessedIssue.Any()) { - _logger.LogInformation("未读到EOS开账数据"); + _logger.LogInformation("未读到Tyrp开账数据"); return new List(); } //locdout逐一转换为locdout diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs index faf9e93ba..a659f09a9 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PurchasePrices/PurchasePriceSheetAppService.cs @@ -48,6 +48,7 @@ public class PurchasePriceSheetAppService : SfsBaseDataAppServiceBase CheckPurPriceAsync( string supplierCode, string itemCode) { + var aaaa= await _repository.GetListAsync().ConfigureAwait(false); bool result = false; var entitys = await _repository.GetListAsync(p => p.SupplierCode == supplierCode && p.ItemCode == itemCode).ConfigureAwait(false); if (entitys.Count == 0) result = true; diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs index 5c9adc871..208501c60 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application.Contracts/Balances/IBalanceAppService.cs @@ -176,4 +176,5 @@ public interface IBalanceAppService Task GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(string packingCode, string itemCode, string locationCode, EnumInventoryStatus status,string lot); Task> GetRecommendBalancesByLocationsExpectOldBalancesAsync(RecommendBalanceRequestInput input); + Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status, DateTime datetime, string countPlanNumber); } diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs index 7e81b3b08..132482f2d 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Balances/BalanceAppService.cs @@ -301,7 +301,36 @@ public class BalanceAppService await _repository.UpdateAsync(entity).ConfigureAwait(false); } } - + /// + /// 设置为可用 根据 库位 零件 箱码 批次 状态 + /// + /// + /// + /// + /// + /// + /// + [HttpPost("countplan-active")] + public virtual async Task CountPlanActiveAsync(string packingCode, + string itemCode, + string lot, + string locationCode, + EnumInventoryStatus status,DateTime datetime,string countPlanNumber) + { + var entity = await _repository.FirstOrDefaultAsync(p => + p.ItemCode == itemCode + && p.Lot == lot + && p.LocationCode == locationCode + && p.PackingCode == packingCode + && p.Status == status + && p.LastCountTime==datetime + && p.LastCountPlanNumber== countPlanNumber).ConfigureAwait(false); + if (entity != null) + { + await entity.ActiveAsync().ConfigureAwait(false); + await _repository.UpdateAsync(entity).ConfigureAwait(false); + } + } #endregion Update #region Get diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Statuses/EnumOrderStatus.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Statuses/EnumOrderStatus.cs index 8e52f3d2b..210df8d38 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Statuses/EnumOrderStatus.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/Statuses/EnumOrderStatus.cs @@ -13,5 +13,6 @@ public enum EnumOrderStatus /// /// 开放 /// + [Display(Name = "开放")] Open = 1, } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs index 951f8ef85..7bb531bc3 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/PutawayNotes/PutawayNoteAppService.cs @@ -31,6 +31,7 @@ public class PutawayNoteAppService : public readonly IInspectJobAppService _inspectJobAppService; public readonly IPurchaseOrderManager _purchaseOrderManager; public readonly IPurchasePriceSheetAppService _purchasePriceSheetAppService; + public readonly IErpLocationItemAppService _erpLocationItemAppService; public PutawayNoteAppService( IPutawayNoteRepository repository, @@ -38,13 +39,15 @@ public class PutawayNoteAppService : IPurchaseReceiptNoteAppService purchaseReceiptNoteAppService, IInspectJobAppService inspectJobAppService, IPurchaseOrderManager purchaseOrderManager, - IPurchasePriceSheetAppService purchasePriceSheetAppService ) : base(repository) + IPurchasePriceSheetAppService purchasePriceSheetAppService, + IErpLocationItemAppService erpLocationItemAppService) : base(repository) { _putawayNoteManager = putawayNoteManager; _purchaseReceiptNoteAppService = purchaseReceiptNoteAppService; _inspectJobAppService = inspectJobAppService; _purchaseOrderManager = purchaseOrderManager; _purchasePriceSheetAppService = purchasePriceSheetAppService; + _erpLocationItemAppService= erpLocationItemAppService; } /// @@ -58,8 +61,6 @@ public class PutawayNoteAppService : { foreach (var detail in input.Details) { - try - { var isClosed = await _purchaseOrderManager.CheckIsCloseAsync(input.Number,input.SupplierCode, detail.ItemCode).ConfigureAwait(false); if (isClosed) { @@ -70,6 +71,12 @@ public class PutawayNoteAppService : { throw new UserFriendlyException($"供应商【{input.SupplierCode}】零件名称【{detail.ItemCode}】无采购价格无法执行采购上架!"); } + var erpLocationItem = await _erpLocationItemAppService.CheckItemErpLocationIsAvailable(detail.ItemCode, detail.ToLocationErpCode).ConfigureAwait(false); + + if (erpLocationItem == null) + { + throw new UserFriendlyException($"未找到零件【{detail.ItemCode}】与ERP储位【{detail.ToLocationErpCode}】的开账信息"); + } var purchasereDetail = await _purchaseReceiptNoteAppService .GetDetailByItemAndPackingAsync(detail.ItemCode, detail.ToPackingCode).ConfigureAwait(false); if (purchasereDetail != null) @@ -81,10 +88,6 @@ public class PutawayNoteAppService : throw new UserFriendlyException($"包含【{detail.ToPackingCode}】箱码的报检单,尚未完成质检"); } } - } - catch (Exception ex) - { - } } var entity = ObjectMapper.Map(input); 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 dcea1fb59..f083bf418 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 @@ -95,9 +95,13 @@ public class PurchaseOrderAppService : purchaseOrder.SupplierCode = supplierDto.Code; purchaseOrder.SupplierAddress = supplierDto.Address; purchaseOrder.SupplierName = supplierDto.Name; - + if (purchaseOrder.OrderStatus == EnumOrderStatus.Close) + { + throw new UserFriendlyException($"不允许导入关闭订单状态的订单"); + } foreach (var detail in purchaseOrder.Details) { + detail.LineStatus = EnumOrderStatus.Open; var itemBasicDto = itemBasicDtos.First(p => p.Code == detail.ItemCode); detail.ItemName = itemBasicDto.Name; 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 2abff99a5..5bad74a89 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 @@ -50,7 +50,6 @@ public class CountPlanAppService : base.CreatePolicyName = CountPlanPermissions.Create; base.UpdatePolicyName = CountPlanPermissions.Update; base.DeletePolicyName = CountPlanPermissions.Delete; - } /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/BalanceAclService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/BalanceAclService.cs index 3ce7fa22d..1041c827b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/BalanceAclService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/BalanceAclService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading.Tasks; using Win_in.Sfs.Shared.Domain.Shared; @@ -32,7 +33,11 @@ public class BalanceAclService { await _appService.ActiveAsync(packingCode, itemCode, lot, locationCode, status).ConfigureAwait(false); } - + public virtual async Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, + EnumInventoryStatus status, DateTime dateTime, string countPlanNumber) + { + await _appService.CountPlanActiveAsync(packingCode, itemCode, lot, locationCode, status, dateTime,countPlanNumber).ConfigureAwait(false); + } public virtual async Task InactiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/IBalanceAclService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/IBalanceAclService.cs index 3a97a2071..762df4a0c 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/IBalanceAclService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain.Acl/Balance/IBalanceAclService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -16,5 +17,6 @@ namespace Win_in.Sfs.Wms.Store.Domain.Acl.Balance Task GetByItemLocationAndPackingAsync(string packingCode, string itemCode, string locationCode); Task GetByPackingCodeAsync(string packingCode); Task> GetListByPackingCodesAsync(List packingCodes); + Task CountPlanActiveAsync(string packingCode, string itemCode, string lot, string locationCode, EnumInventoryStatus status,DateTime dateTime,string countPlanNumber); } } 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 f60603fae..f0d16e6bd 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 @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using DocumentFormat.OpenXml.Office2013.Word; using Microsoft.Extensions.Logging; using Volo.Abp; using Win_in.Sfs.Basedata.Application.Contracts; @@ -15,13 +16,15 @@ namespace Win_in.Sfs.Wms.Store.Domain; public class CountPlanManager : SfsStoreRequestManagerBase, ICountPlanManager { private readonly ICountPlanRepository _repository; - + private readonly ICountJobRepository _jobRepository; public CountPlanManager( - ICountPlanRepository repository + ICountPlanRepository repository, + ICountJobRepository jobRepository ) : base(repository) { _repository = repository; + _jobRepository = jobRepository; } /// @@ -278,7 +281,16 @@ public class CountPlanManager : SfsStoreRequestManagerBasep.JobStatus == EnumJobStatus.Doing && p.CountPlanNumber == entity.Number && p.InventoryStage == entity.InventoryStage, true).ConfigureAwait(false); + var josbdeatils = jobs.SelectMany(r => r.DepDetails); + var groups = josbdeatils.GroupBy(r => r.PackingCode).Where(g => g.Count() > 1&&!string.IsNullOrEmpty(g.Key)).Select(g => g.Key); + if (groups.Any()) + { + var mesagge= groups.JoinAsString(","); + throw new UserFriendlyException($"盘点计划 中箱码存在重复请检查后完成重复箱码为【{mesagge}】!"); + } entity.EndTime = DateTime.Now; Check.NotNull(entity, EntityClassName); entity.SetDetails(type); @@ -296,6 +308,8 @@ public class CountPlanManager : SfsStoreRequestManagerBase { + p.FirstCountQty = 0; + p.FinalCountQty = 0; p.DetailStatus = EnumCountStatus.New; }); } @@ -349,7 +363,10 @@ public class CountPlanManager : SfsStoreRequestManagerBase notes = new List(); - foreach (var job in jobs) - { - var countNote = ObjectMapper.Map(job); - countNote.EndTime = DateTime.Now; - notes.Add(countNote); - } - if (notes.Count > 0) + //List notes = new List(); + //foreach (var job in jobs) + //{ + // var countNote = ObjectMapper.Map(job); + // countNote.EndTime = DateTime.Now; + // notes.Add(countNote); + //} + //if (notes.Count > 0) + //{ + // await _countNoteManager.CreateManyAsync(notes).ConfigureAwait(false); + //} + //创建盘点记录 + var countNote = BuildCountNote(entity); + + if (countNote.Details.Count > 0) { - await _countNoteManager.CreateManyAsync(notes).ConfigureAwait(false); + await _countNoteManager.CreateAsync(countNote).ConfigureAwait(false); } - await _countJobAppService.CloseByCountPlanAsync(entity.Number).ConfigureAwait(false); } @@ -133,6 +139,23 @@ public class CountPlanEventHandler countNote.DepDetails.AddRange(depDetails); return countNote; } + /// + /// 赋值盘点差异调整记录主表 + /// + /// + /// + private CountNote BuildCountNote(CountPlan countPlan) + { + var countNote = ObjectMapper.Map(countPlan); + countNote.Details = new List(); + foreach (var countPlanDetail in countPlan.Details.Where(p => p.DetailStatus == EnumCountStatus.Completed)) + { + var countNoteDetail = ObjectMapper.Map(countPlanDetail); + countNote.Details.Add(countNoteDetail); + } + + return countNote; + } /// /// 创建盘点任务 @@ -239,7 +262,7 @@ public class CountPlanEventHandler foreach (var detail in entity.Details.Where(p => p.FinalCountQty == p.InventoryQty || p.DetailStatus != EnumCountStatus.Completed)) { - await BalanceAclService.ActiveAsync(detail.PackingCode, detail.ItemCode, detail.Lot, detail.LocationCode, detail.Status).ConfigureAwait(false); + await BalanceAclService.CountPlanActiveAsync(detail.PackingCode, detail.ItemCode, detail.Lot, detail.LocationCode, detail.Status,DateTime.Now,entity.Number).ConfigureAwait(false); } }