|
@ -2,6 +2,7 @@ using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
using Castle.Components.DictionaryAdapter; |
|
|
|
|
|
using Volo.Abp; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.EventBus; |
|
|
using Volo.Abp.Uow; |
|
|
using Volo.Abp.Uow; |
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
@ -19,16 +20,14 @@ public class AssembleIssueJobEventHandler : |
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<AssembleIssueJob>> |
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<AssembleIssueJob>> |
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<AssembleIssueJob>>> |
|
|
, ILocalEventHandler<SfsCreatedEntityEventData<List<AssembleIssueJob>>> |
|
|
{ |
|
|
{ |
|
|
private readonly IAssembleIssueNoteAppService _assembleIssueNoteAppService; |
|
|
|
|
|
private readonly IExpectOutAppService _expectOutAppService; |
|
|
private readonly IExpectOutAppService _expectOutAppService; |
|
|
private readonly ILocationAppService _locationAppService; |
|
|
private readonly ILocationAppService _locationAppService; |
|
|
private readonly ITransferLibRequestAppService _transferLibRequestAppService; |
|
|
private readonly ITransferLibRequestAppService _transferLibRequestAppService; |
|
|
|
|
|
|
|
|
public AssembleIssueJobEventHandler(IAssembleIssueNoteAppService assembleIssueNoteAppService, |
|
|
public AssembleIssueJobEventHandler( |
|
|
IExpectOutAppService expectOutAppService, |
|
|
IExpectOutAppService expectOutAppService, |
|
|
ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) |
|
|
ILocationAppService locationAppService, ITransferLibRequestAppService transferLibRequestAppService) |
|
|
{ |
|
|
{ |
|
|
_assembleIssueNoteAppService = assembleIssueNoteAppService; |
|
|
|
|
|
_expectOutAppService = expectOutAppService; |
|
|
_expectOutAppService = expectOutAppService; |
|
|
_locationAppService = locationAppService; |
|
|
_locationAppService = locationAppService; |
|
|
_transferLibRequestAppService = transferLibRequestAppService; |
|
|
_transferLibRequestAppService = transferLibRequestAppService; |
|
@ -128,6 +127,25 @@ public class AssembleIssueJobEventHandler : |
|
|
{ |
|
|
{ |
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) |
|
|
var locationDto = await _locationAppService.GetByCodeAsync(detail.RecommendFromLocationCode) |
|
|
.ConfigureAwait(false); |
|
|
.ConfigureAwait(false); |
|
|
|
|
|
var locationList = await _locationAppService.GetListByGroupsAsync( |
|
|
|
|
|
new List<string> { detail.RecommendFromLocationGroup }).ConfigureAwait(false); |
|
|
|
|
|
var locationListSort = locationList.OrderBy(p => p.RowCode); |
|
|
|
|
|
|
|
|
|
|
|
var locationDtoRowOne = new LocationDTO(); |
|
|
|
|
|
if (locationListSort.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
locationDtoRowOne = locationListSort.FirstOrDefault(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
locationDtoRowOne = await _locationAppService.GetFirstRowOneAsync().ConfigureAwait(false); |
|
|
|
|
|
if (locationDtoRowOne == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException("没有找到1层的库位"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (locationDto.Type == EnumLocationType.RAW) |
|
|
if (locationDto.Type == EnumLocationType.RAW) |
|
|
{ |
|
|
{ |
|
|
if (!await IsMinRowAsync(assembleIssueJob).ConfigureAwait(false)) |
|
|
if (!await IsMinRowAsync(assembleIssueJob).ConfigureAwait(false)) |
|
@ -154,7 +172,7 @@ public class AssembleIssueJobEventHandler : |
|
|
|
|
|
|
|
|
detailInput.RecommendFromQty = detail.RecommendFromQty; |
|
|
detailInput.RecommendFromQty = detail.RecommendFromQty; |
|
|
detailInput.RecommendFromLot = detail.RecommendFromLot; |
|
|
detailInput.RecommendFromLot = detail.RecommendFromLot; |
|
|
detailInput.RecommendFromPackingCode = detailInput.RecommendFromPackingCode; |
|
|
detailInput.RecommendFromPackingCode = detail.RecommendFromPackingCode; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
|
|
|
|
|
|
detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; |
|
|
detailInput.RecommendFromArriveDate = detail.RecommendFromArriveDate; |
|
@ -170,7 +188,7 @@ public class AssembleIssueJobEventHandler : |
|
|
|
|
|
|
|
|
detailInput.RecommendToQty = detail.RecommendToQty; |
|
|
detailInput.RecommendToQty = detail.RecommendToQty; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
detailInput.RecommendToPackingCode = detailInput.RecommendToPackingCode; |
|
|
detailInput.RecommendToPackingCode = detail.RecommendToPackingCode; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
detailInput.RecommendToLot = detail.RecommendToLot; |
|
|
|
|
|
|
|
|
detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; |
|
|
detailInput.RecommendToArriveDate = detail.RecommendToArriveDate; |
|
@ -178,13 +196,13 @@ public class AssembleIssueJobEventHandler : |
|
|
detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; |
|
|
detailInput.RecommendToProduceDate = detail.RecommendToProduceDate; |
|
|
detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; |
|
|
detailInput.RecommendToSupplierBatch = detail.RecommendToSupplierBatch; |
|
|
|
|
|
|
|
|
detailInput.RecommendToLocationCode = detail.RecommendToLocationCode; |
|
|
detailInput.RecommendToLocationCode = locationDtoRowOne.Code; |
|
|
detailInput.RecommendToLocationGroup = detail.RecommendToLocationGroup; |
|
|
detailInput.RecommendToLocationGroup = locationDtoRowOne.LocationGroupCode; |
|
|
detailInput.RecommendToLocationArea = detail.RecommendToLocationArea; |
|
|
detailInput.RecommendToLocationArea = locationDtoRowOne.AreaCode; |
|
|
detailInput.RecommendToLocationErpCode = detail.RecommendToLocationErpCode; |
|
|
detailInput.RecommendToLocationErpCode = locationDtoRowOne.ErpLocationCode; |
|
|
detailInput.RecommendToWarehouseCode = detail.RecommendToWarehouseCode; |
|
|
detailInput.RecommendToWarehouseCode = locationDtoRowOne.WarehouseCode; |
|
|
|
|
|
|
|
|
input.Details = new EditableList<TransferLibRequestDetailInput>() { detailInput }; |
|
|
input.Details = new EditableList<TransferLibRequestDetailInput> { detailInput }; |
|
|
|
|
|
|
|
|
await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); |
|
|
await _transferLibRequestAppService.CreateAsync(input).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
@ -192,21 +210,6 @@ public class AssembleIssueJobEventHandler : |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建补料记录实体
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private async Task<AssembleIssueNoteEditInput> BuildAssembleIssueNoteAsync(AssembleIssueJob entity) |
|
|
|
|
|
{ |
|
|
|
|
|
var assembleIssueNoteCreateInput = ObjectMapper.Map<AssembleIssueJob, AssembleIssueNoteEditInput>(entity); |
|
|
|
|
|
assembleIssueNoteCreateInput.JobNumber = entity.Number; |
|
|
|
|
|
|
|
|
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
return assembleIssueNoteCreateInput; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 判断是不是在最底层 如果不是则把状态变更为等待
|
|
|
/// 判断是不是在最底层 如果不是则把状态变更为等待
|
|
|
/// </summary>
|
|
|
/// </summary>
|