|
|
@ -5,7 +5,10 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Win_in.Sfs.Basedata.Application; |
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
using Win_in.Sfs.Basedata.Domain; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared; |
|
|
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store; |
|
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
@ -30,7 +33,8 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
private readonly ILocationAppService _locationAppService; |
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
private readonly IItemContainerAppService _itemContainerAppService; |
|
|
|
|
|
|
|
private readonly IProductionLineAppService _productionLineAppService; |
|
|
|
private readonly ICoatingIssueRequestAppService _coatingIssueRequestAppService; |
|
|
|
private readonly ITransactionTypeAppService _transactionTypeAppService; |
|
|
|
|
|
|
|
public InjectionPlanRequestAppService( |
|
|
@ -39,6 +43,8 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
ILocationAppService locationAppService, |
|
|
|
IItemBasicAppService itemBasicAppService, |
|
|
|
IItemContainerAppService itemContainerAppService, |
|
|
|
IProductionLineAppService productionLineAppService, |
|
|
|
ICoatingIssueRequestAppService coatingIssueRequestAppService, |
|
|
|
ITransactionTypeAppService transactionTypeAppService |
|
|
|
) |
|
|
|
: base(repository, injectionRequestManager) |
|
|
@ -47,6 +53,8 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
_locationAppService = locationAppService; |
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
|
_itemContainerAppService = itemContainerAppService; |
|
|
|
_productionLineAppService = productionLineAppService; |
|
|
|
_coatingIssueRequestAppService = coatingIssueRequestAppService; |
|
|
|
_transactionTypeAppService = transactionTypeAppService; |
|
|
|
} |
|
|
|
|
|
|
@ -56,8 +64,8 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("")] |
|
|
|
public override async Task<InjectionPlanRequestDTO> CreateAsync(InjectionPlanRequestEditInput input) |
|
|
|
[HttpPost("create-and-handle")] |
|
|
|
public async Task<CoatingIssueRequestDTO> CreateAndHandleAsync(InjectionPlanRequestEditInput input) |
|
|
|
{ |
|
|
|
foreach (var item in input.Details) |
|
|
|
{ |
|
|
@ -67,53 +75,54 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
foreach (var detailInput in input.Details) //赋值生产线
|
|
|
|
input.IssueRequestType = EnumIssueRequestType.PositionCode; |
|
|
|
|
|
|
|
foreach (var detailInput in input.Details) |
|
|
|
{ |
|
|
|
var toLocationDto = |
|
|
|
await _locationAppService.GetByCodeAsync(detailInput.ToLocationCode).ConfigureAwait(false); |
|
|
|
CheckLocation(toLocationDto, detailInput.ToLocationCode); |
|
|
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(detailInput.ItemCode).ConfigureAwait(false); |
|
|
|
CheckItemBasic(itemBasicDto, detailInput.ItemCode); |
|
|
|
var productionLineDto = await _productionLineAppService.GetByLocationCodeAsync(detailInput.ToLocationCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
CheckProductionLine(productionLineDto, detailInput.ProdLine); |
|
|
|
//var positionCodeDto = await _positionCodeRepository.FirstOrDefaultAsync(p => p.PartCode == detailInput.ItemCode && p.LocationCode == detailInput.ToLocationCode).ConfigureAwait(false);
|
|
|
|
|
|
|
|
detailInput.ProdLine = productionLineDto.Code; |
|
|
|
|
|
|
|
detailInput.ToLocationArea = toLocationDto.AreaCode; |
|
|
|
detailInput.ToLocationGroup = toLocationDto.LocationGroupCode; |
|
|
|
detailInput.ToWarehouseCode = toLocationDto.WarehouseCode; |
|
|
|
detailInput.ProdLine = detailInput.ToLocationCode; |
|
|
|
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; |
|
|
|
detailInput.ToLocationErpCode = toLocationDto.ErpLocationCode; |
|
|
|
|
|
|
|
detailInput.ItemDesc1 = itemBasicDto.Desc1; |
|
|
|
detailInput.ItemDesc2 = itemBasicDto.Desc2; |
|
|
|
detailInput.ItemName = itemBasicDto.Name; |
|
|
|
|
|
|
|
var itemContainerDto = await _itemContainerAppService.GetListByItemCodeAsync(detailInput.ItemCode) |
|
|
|
.ConfigureAwait(false); |
|
|
|
if (itemContainerDto.Count > 0) |
|
|
|
var itemContainerDto = await _itemContainerAppService.GetByItemCodeAsync(detailInput.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (itemContainerDto != null) |
|
|
|
{ |
|
|
|
detailInput.Uom = itemContainerDto[0].BasicUom; |
|
|
|
detailInput.Qty = itemContainerDto[0].Qty; |
|
|
|
detailInput.Uom = itemContainerDto.BasicUom; |
|
|
|
detailInput.Qty = itemContainerDto.Qty; |
|
|
|
detailInput.BoxQty = itemContainerDto.Qty; |
|
|
|
detailInput.StdPackQty = itemBasicDto.StdPackQty; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
detailInput.Uom = itemBasicDto.BasicUom; |
|
|
|
detailInput.StdPackQty = itemBasicDto.StdPackQty; |
|
|
|
detailInput.Qty = itemBasicDto.StdPackQty; |
|
|
|
throw new UserFriendlyException($"ERP料号【{detailInput.ItemCode}】未配置收容数"); |
|
|
|
} |
|
|
|
|
|
|
|
detailInput.Status = EnumStatus.Open; |
|
|
|
|
|
|
|
//因为是刚创建的 所以发料数一定是0
|
|
|
|
detailInput.Status = EnumStatus.Open; |
|
|
|
detailInput.IssuedQty = 0; |
|
|
|
detailInput.RecommendType = EnumRecommendType.None; |
|
|
|
} |
|
|
|
|
|
|
|
await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false); |
|
|
|
var entity = ObjectMapper.Map<InjectionPlanRequestEditInput, InjectionPlanRequest>(input); |
|
|
|
|
|
|
|
var result = await _injectionRequestManager.CreateByNumberAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
var dto = ObjectMapper.Map<InjectionPlanRequest, InjectionPlanRequestDTO>(result); |
|
|
|
var entity = ObjectMapper.Map<InjectionPlanRequestEditInput, CoatingIssueRequestEditInput>(input); |
|
|
|
var coatingIssueRequestDto = await _coatingIssueRequestAppService.CreateAndHandleAsync(entity).ConfigureAwait(false); |
|
|
|
|
|
|
|
return dto; |
|
|
|
return coatingIssueRequestDto; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -131,17 +140,7 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
entity.AutoHandle = tranType.AutoHandleRequest; |
|
|
|
entity.AutoCompleteJob = tranType.AutoCompleteJob; |
|
|
|
entity.DirectCreateNote = tranType.DirectCreateNote; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("create-and-handle")] |
|
|
|
public async Task<InjectionPlanRequestDTO> CreateAndHandleAsync(InjectionPlanRequestEditInput input) |
|
|
|
{ |
|
|
|
var injectionRequestDto = await CreateAsync(input).ConfigureAwait(false); |
|
|
|
|
|
|
|
await HandleAsync(injectionRequestDto.Id).ConfigureAwait(false); |
|
|
|
|
|
|
|
return injectionRequestDto; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取物品类别列表
|
|
|
@ -210,5 +209,13 @@ public class InjectionPlanRequestAppService : SfsStoreRequestAppServiceBase<Inje |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void CheckProductionLine(ProductionLineDTO productionLineDto, string productionCode) |
|
|
|
{ |
|
|
|
if (productionLineDto == null) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"未找到生产线【{productionCode}】"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|