|
|
|
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;
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Scp.WebApi
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// 收货单服务
|
|
|
|
/// </summary>
|
|
|
|
[AllowAnonymous]
|
|
|
|
[Route("api/scp/unplanned-receipt")]
|
|
|
|
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
|
|
|
|
public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService
|
|
|
|
{
|
|
|
|
private readonly IUnplannedReceiptRepository _unplannedReceiptRepository;
|
|
|
|
|
|
|
|
public UnplannedReceiptAppService(IUnplannedReceiptRepository repository) : base(repository)
|
|
|
|
{
|
|
|
|
_unplannedReceiptRepository = repository;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 按ID获取收货单 (Get receipt by ID)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">唯一ID(unique ID)</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("{id}")]
|
|
|
|
public override async Task<UnplannedReceiptDTO> GetAsync(Guid id)
|
|
|
|
{
|
|
|
|
return await base.GetAsync(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 按请求条件获取收货单列表(Get receipt list by request condition)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="requestDTO">请求条件DTO(Request condition DTO)</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[Route("")]
|
|
|
|
public override async Task<PagedResultDto<UnplannedReceiptDTO>> GetListAsync(RequestDTO requestDTO)
|
|
|
|
{
|
|
|
|
return await base.GetListAsync(requestDTO);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 新增收货单(Create receipt)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="receiptCreateDTO"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[Route("")]
|
|
|
|
public async Task<UnplannedReceiptDTO> CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO)
|
|
|
|
{
|
|
|
|
var entity = ObjectMapper.Map<UnplannedReceiptCreateDTO, UnplannedReceipt>(receiptCreateDTO);
|
|
|
|
entity.SetId(GuidGenerator.Create());
|
|
|
|
var ret = await _unplannedReceiptRepository.InsertAsync(entity);
|
|
|
|
var dto = ObjectMapper.Map<UnplannedReceipt, UnplannedReceiptDTO>(ret);
|
|
|
|
return dto;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|