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.
 
 
 
 
 
 

147 lines
4.4 KiB

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-note")]
public class TransferNoteController : AbpController
{
private readonly ITransferNoteAppService _transferNoteAppService;
/// <summary>
///
/// </summary>
/// <param name="transferNoteAppService"></param>
public TransferNoteController(ITransferNoteAppService transferNoteAppService)
{
_transferNoteAppService = transferNoteAppService;
}
/// <summary>
/// 获取盘点任务详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
public virtual async Task<ActionResult<TransferNoteDTO>> GetAsync(Guid id)
{
var result = await _transferNoteAppService.GetAsync(id).ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// 获取列表 筛选
/// </summary>
/// <param name="sfsRequestDTO"></param>
/// <returns></returns>
[HttpPost("list")]
public virtual async Task<PagedResultDto<TransferNoteDTO>> GetListAsync(SfsStoreRequestInputBase sfsRequestDTO)
{
var list = await _transferNoteAppService.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<TransferNoteDTO>> GetListAsync(int pageSize, int pageIndex)
{
var request = new SfsStoreRequestInputBase
{
MaxResultCount = pageSize,
SkipCount = (pageIndex - 1) * pageSize,
Sorting = $"{nameof(TransferNoteDTO.Number)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(TransferNoteDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferNoteDTO.Confirmed),"false","==")
}
}
};
var list = await _transferNoteAppService.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(TransferNoteDTO.Number)} ASC",
Condition = new Condition
{
Filters = new List<Filter>
{
new(nameof(TransferNoteDTO.Type),EnumTransSubType.Transfer_Area.ToString(),"=="),
new(nameof(TransferNoteDTO.Confirmed),"false","==")
}
}
};
var count = await _transferNoteAppService.GetCountByFilterAsync(request).ConfigureAwait(false);
return Ok(count);
}
/// <summary>
/// 根据number获取要料详情
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
[HttpGet("{number}")]
public virtual async Task<ActionResult<TransferNoteDTO>> GetAsync(string number)
{
var result = await _transferNoteAppService.GetByNumberAsync(number).ConfigureAwait(false);
return Ok(result);
}
/// <summary>
/// 完成对应的请求
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("complete/{id}")]
public virtual async Task<TransferNoteDTO> CompleteAsync(Guid id)
{
var entity = await _transferNoteAppService.ConfirmAsync(id).ConfigureAwait(false);
return entity;
}
/// <summary>
/// 库存转移
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("")]
public virtual async Task<TransferNoteDTO> Create(TransferNoteEditInput input)
{
return await _transferNoteAppService.CreateAsync(input).ConfigureAwait(false);
}
}