You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

137 lines
4.3 KiB

using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
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.Stores;
/// <summary>
///
/// </summary>
[ApiController]
[Route($"{PdaHostConst.ROOT_ROUTE}store/transferlib-job")]
public class TransferLibJobController : AbpController
{
private readonly ITransferLibJobAppService _transferLibJobAppService;
/// <summary>
///
/// </summary>
/// <param name="transferLibJobAppService"></param>
public TransferLibJobController(ITransferLibJobAppService transferLibJobAppService)
{
_transferLibJobAppService = transferLibJobAppService;
}
/// <summary>
/// 获取盘点任务详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
public virtual async Task<ActionResult<TransferLibJobDTO>> GetAsync(Guid id)
{
var result = await _transferLibJobAppService.GetAsync(id).ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// 获取列表 筛选
/// </summary>
/// <param name="sfsJobDTO"></param>
/// <returns></returns>
[HttpPost("list")]
public virtual async Task<PagedResultDto<TransferLibJobDTO>> GetListAsync(SfsJobRequestInputBase sfsJobDTO)
{
var list = await _transferLibJobAppService.GetPagedListByFilterAsync(sfsJobDTO, true).ConfigureAwait(false);
return list;
}
/// <summary>
/// 获取任务数量
/// </summary>
/// <returns></returns>
[HttpPost("count")]
public virtual async Task<ActionResult<long>> CountAsync(SfsJobRequestInputBase sfsJobDTO)
{
var count = await _transferLibJobAppService.GetCountByFilterAsync(sfsJobDTO).ConfigureAwait(false);
return Ok(count);
}
/// <summary>
/// 完成对应的请求
/// </summary>
/// <param name="id"></param>
/// <param name="jobDTO"></param>
/// <returns></returns>
[HttpPost("complete/{id}")]
public virtual async Task<TransferLibJobDTO> CompleteAsync(Guid id, TransferLibJobDTO jobDTO)
{
var entity = await _transferLibJobAppService.CompleteAsync(id, jobDTO).ConfigureAwait(false);
return entity;
}
/// <summary>
/// 承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("accept/{id}")]
public virtual async Task AcceptAsync(Guid id)
{
await _transferLibJobAppService.AcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 取消承接任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("cancel-accept/{id}")]
public virtual async Task CancelAcceptAsync(Guid id)
{
await _transferLibJobAppService.CancelAcceptAsync(id).ConfigureAwait(false);
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
[HttpGet("list")]
public virtual async Task<PagedResultDto<TransferLibJobDTO>> GetListAsync(int pageSize, int pageIndex)
{
//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
{
MaxResultCount = pageSize,
SkipCount = (pageIndex - 1) * pageSize,
Sorting = $"{nameof(TransferLibJobDTO.Priority)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
//new(nameof(TransferLibJobDTO.WorkGroupCode),jsonCodes,"In"),
new(nameof(TransferLibJobDTO.JobStatus),jsonStatus,"In")
}
}
};
var list = await _transferLibJobAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false);
return list;
}
}