3 changed files with 277 additions and 0 deletions
@ -0,0 +1,188 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text.Json; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Auth.Application.Contracts; |
|||
using Win_in.Sfs.Shared.Domain; |
|||
using Win_in.Sfs.Shared.Domain.Shared; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Jobs; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}job/container")] |
|||
public class ContainerJobController : AbpController |
|||
{ |
|||
private readonly IContainerJobAppService _containerJobAppService; |
|||
|
|||
private readonly IUserWorkGroupAppService _userWorkGroupAppService; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="ContainerJobAppService"></param>
|
|||
/// <param name="userWorkGroupAppService"></param>
|
|||
public ContainerJobController( |
|||
IContainerJobAppService ContainerJobAppService |
|||
, IUserWorkGroupAppService userWorkGroupAppService) |
|||
{ |
|||
_userWorkGroupAppService = userWorkGroupAppService; |
|||
_containerJobAppService = ContainerJobAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取任务详情
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{id}")] |
|||
|
|||
public virtual async Task<ActionResult<ContainerJobDTO>> GetAsync(Guid id) |
|||
{ |
|||
var result = await _containerJobAppService.GetAsync(id).ConfigureAwait(false); |
|||
return Ok(result); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取列表 筛选
|
|||
/// </summary>
|
|||
/// <param name="sfsRequestDTO"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("list")] |
|||
public virtual async Task<PagedResultDto<ContainerJobDTO>> GetListAsync(SfsJobRequestInputBase sfsRequestDTO) |
|||
{ |
|||
var list = await _containerJobAppService.GetPagedListByFilterAsync(sfsRequestDTO, true).ConfigureAwait(false); |
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取列表
|
|||
/// </summary>
|
|||
/// <param name="pageSize"></param>
|
|||
/// <param name="pageIndex"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("list")] |
|||
public virtual async Task<PagedResultDto<ContainerJobDTO>> GetListAsync(int pageSize, int pageIndex) |
|||
{ |
|||
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|||
_ = JsonSerializer.Serialize(wlgCodes); |
|||
|
|||
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
|||
var jsonStatus = JsonSerializer.Serialize(status); |
|||
|
|||
var request = new SfsJobRequestInputBase |
|||
{ |
|||
MaxResultCount = pageSize, |
|||
SkipCount = (pageIndex - 1) * pageSize, |
|||
Sorting = $"{nameof(ContainerJobDTO.Priority)} ASC", |
|||
Condition = new Condition |
|||
{ |
|||
Filters = new List<Filter> |
|||
{ |
|||
// new(nameof(ContainerJobDTO.WorkGroupCode),jsonCodes,"In"),
|
|||
new(nameof(ContainerJobDTO.JobStatus),jsonStatus,"In") |
|||
} |
|||
} |
|||
}; |
|||
|
|||
var list = await _containerJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false); |
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据Job Number 获取任务列表
|
|||
/// </summary>
|
|||
/// <param name="jobNumber"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("by-number/{jobNumber}")] |
|||
public virtual async Task<ActionResult<ContainerJobDTO>> GetByNumberAsync(string jobNumber) |
|||
{ |
|||
var jobDto = await _containerJobAppService.GetByNumberAsync(jobNumber).ConfigureAwait(false); |
|||
if (jobDto == null) |
|||
{ |
|||
throw new UserFriendlyException($"未找到编号为 {jobNumber} 的任务"); |
|||
} |
|||
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|||
if (!wlgCodes.Contains(jobDto.WorkGroupCode)) |
|||
{ |
|||
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}"); |
|||
} |
|||
if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id) |
|||
{ |
|||
return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理"); |
|||
} |
|||
return jobDto; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取任务数量
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpGet("count")] |
|||
public virtual async Task<ActionResult<long>> CountAsync() |
|||
{ |
|||
var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); |
|||
var jsonCodes = JsonSerializer.Serialize(wlgCodes); |
|||
|
|||
var status = new List<int>() { (int)EnumJobStatus.Open, (int)EnumJobStatus.Doing }; |
|||
var jsonStatus = JsonSerializer.Serialize(status); |
|||
|
|||
var request = new SfsJobRequestInputBase |
|||
{ |
|||
Sorting = $"{nameof(ContainerJobDTO.Priority)} ASC", |
|||
Condition = new Condition |
|||
{ |
|||
Filters = new List<Filter> |
|||
{ |
|||
new(nameof(ContainerJobDTO.WorkGroupCode),jsonCodes,"In"), |
|||
new(nameof(ContainerJobDTO.JobStatus),jsonStatus,"In") |
|||
} |
|||
} |
|||
}; |
|||
|
|||
var count = await _containerJobAppService.GetCountByFilterAsync(request).ConfigureAwait(false); |
|||
|
|||
return Ok(count); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 承接任务
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("take/{id}")] |
|||
public virtual async Task TakeAsync(Guid id) |
|||
{ |
|||
await _containerJobAppService.AcceptAsync(id).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 取消承接任务
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("cancel-take/{id}")] |
|||
public virtual async Task CancelTakeAsync(Guid id) |
|||
{ |
|||
await _containerJobAppService.CancelAcceptAsync(id).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行任务
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <param name="dto"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("finish/{id}")] |
|||
public virtual async Task FinishAsync(Guid id, [FromBody] ContainerJobDTO dto) |
|||
{ |
|||
await _containerJobAppService.CompleteAsync(id, dto).ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,38 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}store/container")] |
|||
|
|||
public class ContainerNoteController : AbpController |
|||
{ |
|||
private readonly IContainerNoteAppService _containerNoteAppService; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="containerNoteAppService"></param>
|
|||
public ContainerNoteController(IContainerNoteAppService containerNoteAppService) |
|||
{ |
|||
_containerNoteAppService = containerNoteAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建器具转移记录
|
|||
/// </summary>
|
|||
/// <param name="input">CreateInput</param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("")] |
|||
public virtual async Task CreateAsync(ContainerNoteEditInput input) |
|||
{ |
|||
await _containerNoteAppService.CreateAsync(input).ConfigureAwait(false); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|||
|
|||
namespace Win_in.Sfs.Wms.Pda.Controllers.Stores; |
|||
|
|||
/// <summary>
|
|||
///空器具呼叫请求
|
|||
/// </summary>
|
|||
[ApiController] |
|||
[Route($"{PdaHostConst.ROOT_ROUTE}store/container-request")] |
|||
|
|||
public class ContainerRequestController : AbpController |
|||
{ |
|||
private readonly IContainerRequestAppService _containerRequestAppService; |
|||
|
|||
/// <summary>
|
|||
///
|
|||
/// </summary>
|
|||
/// <param name="ContainerRequestAppService"></param>
|
|||
public ContainerRequestController(IContainerRequestAppService ContainerRequestAppService) |
|||
{ |
|||
_containerRequestAppService = ContainerRequestAppService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 空器具申请
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("")] |
|||
public virtual async Task CreateAsync(ContainerRequestEditInput input) |
|||
{ |
|||
_ = await _containerRequestAppService.CreateAsync(input).ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据number获取空器具申请详情
|
|||
/// </summary>
|
|||
/// <param name="number"></param>
|
|||
/// <returns></returns>
|
|||
[HttpGet("{number}")] |
|||
|
|||
public virtual async Task<ActionResult<ContainerRequestDTO>> GetAsync(string number) |
|||
{ |
|||
var result = await _containerRequestAppService.GetByNumberAsync(number).ConfigureAwait(false); |
|||
return Ok(result); |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue