Browse Source

三方库

dev_DY_CC
郑勃旭 10 months ago
parent
commit
669dbbcb49
  1. 33
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs
  2. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs

33
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ThirdLocationJobs/ThirdLocationJobAppService.cs

@ -14,6 +14,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain.Shared;
using Win_in.Sfs.Shared.Domain;
@ -37,18 +38,20 @@ public class ThirdLocationJobAppService
private readonly ITransferLogAppService _transferLogAppService;
private readonly ILocationAppService _locationAppService;
private readonly IThirdLocationNoteAppService _thirdLocationNoteAppService;
private readonly ICurrentUser _currentUser;
protected IThirdLocationRequestAppService ThirdLocationRequestAppService =>
LazyServiceProvider.LazyGetRequiredService<IThirdLocationRequestAppService>();
public ThirdLocationJobAppService(
IThirdLocationJobRepository repository, IThirdLocationJobManager thirdLocationJobManager,
ITransferLogAppService transferLogAppService, ILocationAppService locationAppService, IThirdLocationNoteAppService thirdLocationNoteAppService) : base(repository, thirdLocationJobManager)
ITransferLogAppService transferLogAppService, ILocationAppService locationAppService, IThirdLocationNoteAppService thirdLocationNoteAppService, ICurrentUser currentUser) : base(repository, thirdLocationJobManager)
{
_thirdLocationJobManager = thirdLocationJobManager;
_transferLogAppService = transferLogAppService;
_locationAppService = locationAppService;
_thirdLocationNoteAppService = thirdLocationNoteAppService;
_currentUser = currentUser;
}
[HttpPost("")]
@ -152,6 +155,34 @@ public class ThirdLocationJobAppService
return ObjectMapper.Map<List<ThirdLocationJob>, List<ThirdLocationJobDTO>>(list);
}
[HttpPost("accept/{id}")]
[UnitOfWork]
public override async Task AcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = true;
entity.ClaimsUserName = _currentUser.UserName;
entity.ClaimsUserId = _currentUser.Id.ToString();
entity.AcceptTime = Clock.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
[UnitOfWork]
public override async Task CancelAcceptAsync(Guid id)
{
var entity = await _repository.FindAsync(id).ConfigureAwait(false);
entity.IsClaims = false;
entity.ClaimsUserName = string.Empty;
entity.ClaimsUserId = string.Empty;
entity.AcceptTime = DateTime.Now;
await _repository.UpdateAsync(entity).ConfigureAwait(false);
}
#region 私有
private async Task UpdateJobStatusAsync(ThirdLocationJob thirdLocationJob)

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ThirdLocationRequests/ThirdLocationRequestAppService.cs

@ -142,7 +142,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
thirdLocationRequest.RequestStatus == EnumRequestStatus.Partial ||
thirdLocationRequest.RequestStatus == EnumRequestStatus.New)
{
thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
@ -155,7 +155,7 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
{
await _thirdLocationJobAppService.CompleteAsync(job.Id).ConfigureAwait(false);
}
thirdLocationRequest.RequestStatus = EnumRequestStatus.Completed;
var entity=await _repository.UpdateAsync(thirdLocationRequest).ConfigureAwait(false);
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(entity);
@ -168,14 +168,20 @@ public class ThirdLocationRequestAppService : SfsStoreRequestAppServiceBase<Thir
thirdLocationRequest.RequestStatus == EnumRequestStatus.Partial ||
thirdLocationRequest.RequestStatus == EnumRequestStatus.New)
{
thirdLocationRequest.RequestStatus = EnumRequestStatus.Cancelled;
}
else
{
throw new UserFriendlyException($"【{thirdLocationRequest.RequestStatus.GetDisplayName()}】状态不允许取消");
}
await _thirdLocationJobAppService.CompleteAsync(thirdLocationRequest.Id).ConfigureAwait(false);
var jobDtos = await _thirdLocationJobAppService.GetByRequestNumberAsync(thirdLocationRequest.Number).ConfigureAwait(false);
foreach (var job in jobDtos)
{
await _thirdLocationJobAppService.CompleteAsync(job.Id).ConfigureAwait(false);
}
thirdLocationRequest.RequestStatus = EnumRequestStatus.Cancelled;
var entity = await _repository.UpdateAsync(thirdLocationRequest).ConfigureAwait(false);
return ObjectMapper.Map<ThirdLocationRequest, ThirdLocationRequestDTO>(entity);

Loading…
Cancel
Save