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.
86 lines
2.6 KiB
86 lines
2.6 KiB
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.Basedata.Application.Contracts;
|
|
using Win_in.Sfs.Shared.Domain;
|
|
|
|
namespace Win_in.Sfs.Wms.Pda.Controllers.BaseDatas;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route($"{PdaHostConst.ROOT_ROUTE}item")]
|
|
|
|
public class ItemController : AbpController
|
|
{
|
|
private readonly IItemBasicAppService _itemBasicAppService;
|
|
private readonly IItemPackAppService _itemPackAppService;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="itemBasicAppService"></param>
|
|
/// <param name="itemPackAppService"></param>
|
|
public ItemController(IItemBasicAppService itemBasicAppService
|
|
, IItemPackAppService itemPackAppService
|
|
)
|
|
{
|
|
_itemBasicAppService = itemBasicAppService;
|
|
_itemPackAppService = itemPackAppService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据code获取物品信息
|
|
/// </summary>
|
|
/// <param name="code"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("{code}")]
|
|
|
|
public virtual async Task<ItemBasicDTO> GetAsync(string code)
|
|
{
|
|
var dto = await _itemBasicAppService.GetByCodeAsync(code).ConfigureAwait(false);
|
|
return dto;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据名称获取物品
|
|
/// </summary>
|
|
/// <param name="name"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("by-name")]
|
|
public virtual async Task<List<ItemBasicDTO>> GetListByNameAsync(string name)
|
|
{
|
|
var dtos = await _itemBasicAppService.GetListByNameAsync(name).ConfigureAwait(false);
|
|
|
|
return dtos;
|
|
}
|
|
/// <summary>
|
|
/// 按零件号模糊查询
|
|
/// </summary>
|
|
/// <param name="itemCode"></param>
|
|
/// <param name="pageSize"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <param name="sortBy"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("get-fuzzy")]
|
|
public virtual async Task<PagedResultDto<ItemBasicDTO>> GetListAsync( string itemCode, int pageSize,int pageIndex,string sortBy)
|
|
{
|
|
var input = new SfsBaseDataRequestInputBase
|
|
{
|
|
MaxResultCount = pageSize,
|
|
SkipCount = (pageIndex - 1) * pageSize,
|
|
Sorting = sortBy,
|
|
Condition = new Condition { Filters = new List<Filter>() }
|
|
};
|
|
if (!string.IsNullOrWhiteSpace(itemCode))
|
|
{
|
|
input.Condition.Filters.Add(new Filter("Code", itemCode, EnumFilterAction.Like.ToString()));
|
|
}
|
|
var itemDTOs = await _itemBasicAppService.GetPagedListByFilterAsync(input, false).ConfigureAwait(false);
|
|
|
|
return itemDTOs;
|
|
}
|
|
}
|
|
|