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.
69 lines
2.1 KiB
69 lines
2.1 KiB
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Volo.Abp.Application.Dtos;
|
|
using Volo.Abp.Application.Services;
|
|
using Win_in.Sfs.Scp.WebApi.Parts;
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi.POs
|
|
{
|
|
/// <summary>
|
|
/// 采购订单服务
|
|
/// </summary>
|
|
[AllowAnonymous]
|
|
[Route("api/scp/po")]
|
|
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
|
|
public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService
|
|
{
|
|
private readonly IPurchaseOrderRepository _purchaseOrderRepository;
|
|
|
|
public PurchaseOrderAppService(IPurchaseOrderRepository repository) : base(repository)
|
|
{
|
|
_purchaseOrderRepository = repository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 按ID获取采购订单 (Get purchase order by ID)
|
|
/// </summary>
|
|
/// <param name="id">唯一ID(unique ID)</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("{id}")]
|
|
public override async Task<PurchaseOrderDTO> GetAsync(Guid id)
|
|
{
|
|
return await base.GetAsync(id);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 按条件获取采购订单列表 (Get purchase order list by request condition)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[Route("")]
|
|
public override async Task<PagedResultDto<PurchaseOrderDTO>> GetListAsync(RequestDTO input)
|
|
{
|
|
return await base.GetListAsync(input);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 新增采购订单(Create New purchase order)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
[Route("")]
|
|
public async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderDTO poCreateDTO)
|
|
{
|
|
var entity = ObjectMapper.Map<PurchaseOrderDTO, PurchaseOrder>(poCreateDTO);
|
|
var ret = await _purchaseOrderRepository.InsertAsync(entity);
|
|
var dto = ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(ret);
|
|
return dto;
|
|
}
|
|
|
|
}
|
|
}
|