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.2 KiB
137 lines
4.2 KiB
2 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
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/transfer-request")]
|
||
|
|
||
|
public class TransferRequestController : AbpController
|
||
|
{
|
||
|
private readonly ITransferRequestAppService _transferRequestAppService;
|
||
|
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
/// <param name="transferRequestAppService"></param>
|
||
|
public TransferRequestController(ITransferRequestAppService transferRequestAppService)
|
||
|
{
|
||
|
_transferRequestAppService = transferRequestAppService;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取盘点任务详情
|
||
|
/// </summary>
|
||
|
/// <param name="id"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpGet("{id}")]
|
||
|
|
||
|
public virtual async Task<ActionResult<TransferRequestDTO>> GetAsync(Guid id)
|
||
|
{
|
||
|
var result = await _transferRequestAppService.GetAsync(id).ConfigureAwait(false);
|
||
|
return Ok(result);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取列表 筛选
|
||
|
/// </summary>
|
||
|
/// <param name="sfsRequestDTO"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpPost("list")]
|
||
|
public virtual async Task<PagedResultDto<TransferRequestDTO>> GetListAsync(SfsStoreRequestInputBase sfsRequestDTO)
|
||
|
{
|
||
|
var list = await _transferRequestAppService.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<TransferRequestDTO>> GetListAsync(int pageSize, int pageIndex)
|
||
|
{
|
||
|
|
||
|
var request = new SfsStoreRequestInputBase
|
||
|
{
|
||
|
MaxResultCount = pageSize,
|
||
|
SkipCount = (pageIndex - 1) * pageSize,
|
||
|
Sorting = $"{nameof(TransferRequestDTO.Number)} ASC",
|
||
|
Condition = new Condition
|
||
|
{
|
||
|
Filters = new List<Filter>
|
||
|
{
|
||
|
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
|
||
|
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==")
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var list = await _transferRequestAppService.GetPagedListByFilterAsync(request, true).ConfigureAwait(false);
|
||
|
return list;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取任务数量
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
[HttpGet("count")]
|
||
|
public virtual async Task<ActionResult<long>> CountAsync()
|
||
|
{
|
||
|
var request = new SfsStoreRequestInputBase
|
||
|
{
|
||
|
Sorting = $"{nameof(TransferRequestDTO.Number)} ASC",
|
||
|
Condition = new Condition
|
||
|
{
|
||
|
Filters = new List<Filter>
|
||
|
{
|
||
|
new(nameof(TransferRequestDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
|
||
|
new(nameof(TransferRequestDTO.RequestStatus),((int)EnumRequestStatus.New).ToString(),"==")
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
var count = await _transferRequestAppService.GetCountByFilterAsync(request).ConfigureAwait(false);
|
||
|
|
||
|
return Ok(count);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 根据number获取要料详情
|
||
|
/// </summary>
|
||
|
/// <param name="number"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpGet("{number}")]
|
||
|
|
||
|
public virtual async Task<ActionResult<TransferRequestDTO>> GetAsync(string number)
|
||
|
{
|
||
|
var result = await _transferRequestAppService.GetByNumberAsync(number).ConfigureAwait(false);
|
||
|
return Ok(result);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 完成对应的请求
|
||
|
/// </summary>
|
||
|
/// <param name="id"></param>
|
||
|
/// <returns></returns>
|
||
|
[HttpPost("complete/{id}")]
|
||
|
|
||
|
public virtual async Task<TransferRequestDTO> CompleteAsync(Guid id)
|
||
|
{
|
||
|
var entity = await _transferRequestAppService.CompleteAsync(id).ConfigureAwait(false);
|
||
|
return entity;
|
||
|
}
|
||
|
}
|