diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs index 0fd4dd012..c5682b153 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Stores/RecycledMaterialReceiptNoteController.cs @@ -26,7 +26,7 @@ public class RecycledMaterialReceiptNoteController : AbpController } /// - /// 获取盘点任务详情 + /// 回收料调整 /// /// /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs index dc4e8ffe1..027134838 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/PurchaseReceiptJobs/IPurchaseReceiptJobAppService.cs @@ -40,4 +40,10 @@ public interface IPurchaseReceiptJobAppService /// /// Task> SetInspectWithNotInspectAsync(Guid id); + + /// + /// 根据供应商编号获取收货任务 + /// + /// + Task> GetListBySupplierCodeOnTodayAsync(string supplierCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs index 6af63c5b9..e1c099ab0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs @@ -5,6 +5,7 @@ using System.Text.Json; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.FileStorage.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; @@ -198,6 +199,22 @@ public class PurchaseReceiptJobAppService : } } + /// + /// 根据供应商编号获取收货任务 + /// + /// + [HttpPost("get-by-supplier-code-on-today/{supplierCode}")] + public virtual async Task> GetListBySupplierCodeOnTodayAsync(string supplierCode) + { + var purchaseReceiptJobs = await _repository.GetListAsync(p => + p.SupplierCode == supplierCode && + p.PlanArriveDate.Year == DateTime.Now.Year && + p.PlanArriveDate.Month == DateTime.Now.Month && + p.PlanArriveDate.Day == DateTime.Now.Day).ConfigureAwait(false); + var dto = ObjectMapper.Map, List>(purchaseReceiptJobs); + return dto; + } + ///// ///// 取消请求 ///// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs index 015825e1f..501ef2e4a 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/CountNotes/CountNoteAppService.cs @@ -1,11 +1,13 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Domain.Repositories; +using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -35,6 +37,45 @@ public class CountNoteAppService : _countPlanAppService = countPlanAppService; } + #region 东阳 + + /// + /// 用来重写 导入数据时可以加工数据 + /// + /// + /// + protected async override Task> ImportProcessingEntityAsync(Dictionary dictionary) + { + var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + + foreach (var countNote in addList) + { + var countPlanDto=await _countPlanAppService.GetByNumberAsync(countNote.CountPlanNumber).ConfigureAwait(false); + if (countPlanDto.RequestType != CountPlanRequestType.Import) + { + throw new UserFriendlyException("非Excel盘点执行方式不能使用导入"); + } + //特殊处理 因为盘点记录可以重复导入 所以每次导入前删除调原有记录 + //_repository.DeleteAsync(p=>p.CountPlanNumber==CountPlan) + + countNote.Worker = CurrentUser.GetUserName(); + countNote.CreatorId = CurrentUser.Id; + countNote.BeginTime= DateTime.Now; + countNote.Adjusted = false; + countNote.EndTime=DateTime.Now; + countNote.Stage = EnumCountStage.Audit; + + //foreach (var detail in purchaseReturnRequest.Details) + //{ + + //} + } + + return dictionary; + } + + #endregion + /// /// 新增接口 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs index ad717ec51..d502ec9d8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAppService.cs @@ -1,6 +1,11 @@ using System.Threading.Tasks; +using DocumentFormat.OpenXml.Bibliography; +using FluentValidation.Validators; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Basedata.Application.Contracts; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -22,24 +27,53 @@ public class RecycledMaterialReceiptNoteAppService : { private readonly IRecycledMaterialReceiptNoteManager _RecycledMaterialReceiptNoteManager; private readonly ILocationCapacityAppService _locationCapacityAppService; + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; public RecycledMaterialReceiptNoteAppService(IRecycledMaterialReceiptNoteRepository repository, IRecycledMaterialReceiptNoteManager RecycledMaterialReceiptNoteManager, - ILocationCapacityAppService locationCapacityAppService) : base(repository) + ILocationCapacityAppService locationCapacityAppService, + ILocationAppService locationAppService, + IItemBasicAppService itemBasicAppService) : base(repository) { _RecycledMaterialReceiptNoteManager = RecycledMaterialReceiptNoteManager; _locationCapacityAppService = locationCapacityAppService; + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } - [HttpPost("")] - //[Authorize(RecycledMaterialReceiptNotePermissions.Create)] + /// + /// 新增实体 + /// + /// CreateInput public override async Task CreateAsync(RecycledMaterialReceiptNoteEditInput input) { - var entity = ObjectMapper.Map(input); - await _RecycledMaterialReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false); + var entity= ObjectMapper.Map(input); - var dto = ObjectMapper.Map(entity); + entity.Number=string.IsNullOrEmpty(input.Number) + ? await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false) + : input.Number; - return dto; + foreach (var detail in entity.Details) + { + var detailNumber = await GenerateNumberAsync(nameof(RecycledMaterialReceiptNote), input.ActiveDate) + .ConfigureAwait(false); + detail.Number=detailNumber; + var locationDto = await _locationAppService.GetByCodeAsync(detail.LocationCode).ConfigureAwait(false); + detail.LocationErpCode = locationDto.ErpLocationCode; + detail.LocationArea = locationDto.AreaCode; + detail.LocationGroup = locationDto.LocationGroupCode; + detail.WarehouseCode=locationDto.WarehouseCode; + var itemBasicDto=await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.StdPackQty = itemBasicDto.StdPackQty; + detail.Uom = itemBasicDto.BasicUom; + } + + entity=await _repository.InsertAsync(entity).ConfigureAwait(false); + + await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(entity),false).ConfigureAwait(false); + + return ObjectMapper.Map(entity); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs index edd59fb19..35ee6a020 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteAutoMapperProfile.cs @@ -22,5 +22,14 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.TenantId) .Ignore(x => x.Number) .Ignore(x => x.Id); + + CreateMap< RecycledMaterialReceiptNoteEditInput,RecycledMaterialReceiptNote > () + .IgnoreAuditedObjectProperties() + .Ignore(x => x.Remark) + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.TenantId) + .Ignore(x => x.Number) + .Ignore(x => x.Id); + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs index c3fb8dffc..533107d6b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Orders/PurchaseOrders/PurchaseOrderAppService.cs @@ -26,6 +26,7 @@ public class PurchaseOrderAppService : private readonly IPurchaseOrderManager _purchaseOrderManager; private readonly ISupplierAppService _supplierAppService; private readonly IItemBasicAppService _itemBasicAppService; + private readonly IPurchaseReceiptJobAppService _purchaseReceiptJobAppService; public PurchaseOrderAppService( IPurchaseOrderRepository repository, @@ -233,34 +234,15 @@ public class PurchaseOrderAppService : #endregion - //protected override async Task GetEntityAsync(PurchaseOrderImportInput importInput) - //{ - // return await _repository.FindAsync(t => t.Number == importInput.Number).ConfigureAwait(false); - //} - - //protected virtual async Task ImportDataAsync(List entites, List deleteEntities) - //{ - // await _purchaseOrderManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); - //} - - return dtos; - } - [HttpGet("get-list-by-supplier-code-and-item-code")] public virtual async Task> GetListBySupplierCodeAsync(string supplierCode, string itemCode) { - var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode); - - List list = new List(); + var entitys = await _repository.GetListAsync(p => p.Details.Any(y => y.ItemCode == itemCode) && p.SupplierCode == supplierCode).ConfigureAwait(false); - foreach (var entity in entitys) - { - var purchaseOrder = await _repository.GetAsync(entity.Id); - list.Add(purchaseOrder); - } - - var dtos = ObjectMapper.Map, List>(list); + var dtos = ObjectMapper.Map, List>(entitys); return dtos; } + + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs index f45395934..7a96bcad8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/IRecycledMaterialReceiptNoteManager.cs @@ -4,5 +4,5 @@ namespace Win_in.Sfs.Wms.Store.Domain; public interface IRecycledMaterialReceiptNoteManager : ISfsStoreManager { - Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs index 1ccb6c7b1..0b0ea9e7f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/RecycledMaterialReceiptNotes/RecycledMaterialReceiptNoteManager.cs @@ -10,18 +10,4 @@ public class RecycledMaterialReceiptNoteManager : SfsStoreManagerBase CreateAsync(RecycledMaterialReceiptNote entity) - { - return await base.CreateAsync(entity).ConfigureAwait(false); - - } - - public virtual async Task CreateByPurchaseReceiptNoteAsync(PurchaseReceiptNote purchaseReceiptNote) - { - var RecycledMaterialReceiptNote = ObjectMapper.Map(purchaseReceiptNote); - - await base.CreateAsync(RecycledMaterialReceiptNote).ConfigureAwait(false); - } - } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs index 88cf2c24a..a48c1c1cb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Plans/CountPlans/CountPlanManager.cs @@ -14,12 +14,14 @@ namespace Win_in.Sfs.Wms.Store.Domain; public class CountPlanManager : SfsStoreRequestManagerBase, ICountPlanManager { + private readonly ICountPlanRepository _repository; public CountPlanManager( ICountPlanRepository repository ) : base(repository) { + _repository = repository; } /// @@ -200,10 +202,8 @@ public class CountPlanManager : SfsStoreRequestManagerBase> - , ILocalEventHandler>> + , ILocalEventHandler> + , ILocalEventHandler>> { private const EnumTransInOut TransInOut = EnumTransInOut.In; private const EnumTransType TransType = EnumTransType.UnplannedReceipt; private const EnumTransSubType TransSubType = EnumTransSubType.UnplannedReceipt_RecycledMaterialReceipt; + /// + /// 创建后 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { @@ -26,6 +31,20 @@ public class RecycledMaterialReceiptNoteEventHandler await AddTransactionsAsync(entity).ConfigureAwait(false); } + /// + /// 批量创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddTransactionsAsync(entities).ConfigureAwait(false); + } + + #region 私有 + private async Task AddTransactionsAsync(RecycledMaterialReceiptNote RecycledMaterialReceiptNote) { var inboundTransactions = new List(); @@ -33,19 +52,10 @@ public class RecycledMaterialReceiptNoteEventHandler inboundTransactions.AddRange(BuildTransactions(RecycledMaterialReceiptNote)); await TransactionAppService.AddManyAsync(inboundTransactions).ConfigureAwait(false); - - } - - [UnitOfWork] - public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) - { - var entities = eventData.Entity; - await AddTransactionsAsync(entities).ConfigureAwait(false); } private async Task AddTransactionsAsync(List RecycledMaterialReceiptNotes) { - var inboundTransactions = new List(); //如果要做库存事务汇总,可以修改此处 @@ -74,7 +84,9 @@ public class RecycledMaterialReceiptNoteEventHandler transactions.Add(transaction); } + return transactions; } + #endregion }