|
|
@ -49,10 +49,12 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir |
|
|
|
private readonly IExpectOutAppService _expectOutAppService; |
|
|
|
private readonly IBalanceAppService _balanceAppService; |
|
|
|
private readonly IThirdLocationJobAppService _thirdLocationJobAppService; |
|
|
|
private readonly IThirdLocationJobRepository _thirdLocationJobRepository; |
|
|
|
|
|
|
|
public ThirdLocationRequestAppService( |
|
|
|
IThirdLocationRequestRepository repository, |
|
|
|
IThirdLocationJobAppService thirdLocationJobAppService, |
|
|
|
IThirdLocationJobRepository thirdLocationJobRepository, |
|
|
|
IThirdLocationRequestManager thirdLocationRequestManager, |
|
|
|
IPreparationPlanManager preparationPlanManager, |
|
|
|
IItemStoreRelationAppService itemStoreRelationApp, |
|
|
@ -77,6 +79,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir |
|
|
|
_expectOutAppService= expectOutAppService; |
|
|
|
_balanceAppService= balanceAppService; |
|
|
|
_thirdLocationJobAppService= thirdLocationJobAppService; |
|
|
|
_thirdLocationJobRepository= thirdLocationJobRepository; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -240,6 +243,58 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir |
|
|
|
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(request); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 用来重写 完成请求
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public override async Task<ThirdLocationRequestDTO> CompleteAsync(Guid id) |
|
|
|
{ |
|
|
|
var request = await _repository.GetAsync(id).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (request.RequestStatus == EnumRequestStatus.Partial) |
|
|
|
{ |
|
|
|
request.RequestStatus = EnumRequestStatus.Completed; |
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
//await LocalEventBus.PublishAsync(new SfsCompletedEntityEventData<ThirdLocationRequest>(request), false).ConfigureAwait(false);
|
|
|
|
await _repository.UpdateAsync(request).ConfigureAwait(false); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw new UserFriendlyException($"【{request.RequestStatus.GetDisplayName()}】状态不允许取消"); |
|
|
|
} |
|
|
|
var entitys = await _thirdLocationJobRepository.GetListAsync(p => p.RequestNumber == request.Number, "", true).ConfigureAwait(false); |
|
|
|
|
|
|
|
if (entitys.Any()) |
|
|
|
{ |
|
|
|
foreach (var thirdLocationJob in entitys) |
|
|
|
{ |
|
|
|
if (thirdLocationJob.JobStatus == EnumJobStatus.Partial) |
|
|
|
{ |
|
|
|
thirdLocationJob.JobStatus = EnumJobStatus.Done; |
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<ThirdLocationJob>(thirdLocationJob), false).ConfigureAwait(false); |
|
|
|
await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else if (thirdLocationJob.JobStatus == EnumJobStatus.Open) |
|
|
|
{ |
|
|
|
thirdLocationJob.JobStatus = EnumJobStatus.Closed; |
|
|
|
await Task.CompletedTask.ConfigureAwait(false); |
|
|
|
await LocalEventBus.PublishAsync(new SfsClosedEntityEventData<ThirdLocationJob>(thirdLocationJob), false).ConfigureAwait(false); |
|
|
|
await _thirdLocationJobRepository.UpdateAsync(thirdLocationJob).ConfigureAwait(false); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(request); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 赋值Request业务属性
|
|
|
|
/// </summary>
|
|
|
|