You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.9 KiB
C#

using DS.Module.Core;
2 months ago
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Invoice.Entity;
using DS.WMS.Core.Invoice.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
/// <summary>
/// 自由开票API
/// </summary>
public class FreeInvoiceController : ApiController
{
readonly IFreeInvoiceService _service;
/// <summary>
/// 初始化
/// </summary>
/// <param name="service"></param>
public FreeInvoiceController(IFreeInvoiceService service)
{
_service = service;
}
/// <summary>
/// 获取发票详情
/// </summary>
/// <param name="id">发票ID</param>
/// <returns></returns>
[HttpGet, Route("Get")]
public async Task<DataResult<InvoiceDto>> GetAsync(long id)
{
return await _service.GetAsync(id);
}
/// <summary>
/// 获取待开票的业务列表
/// </summary>
/// <param name="request"></param>
/// <returns>注意!!【费用范围】需通过 OtherQueryCondition 字段传入</returns>
[HttpPost, Route("GetBizList")]
public async Task<DataResult<List<BizInvoiceApplication>>> GetBizListAsync([FromBody] PageRequest<FeeRange?> request)
{
return await _service.GetBizListAsync(request);
}
/// <summary>
/// 根据业务编号及类型获取费用记录
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<InvoiceApplicaitonBiz>> GetFeesAsync([FromBody] FeeClient[] items)
{
return await _service.GetFeesAsync(items);
}
2 months ago
/// <summary>
/// 根据业务编号及类型获取该票业务的币别
/// </summary>
/// <param name="items">业务ID与业务类型</param>
/// <returns></returns>
[HttpPost, Route("GetCurrencies")]
public async Task<DataResult<List<FeeClient>>> GetCurrenciesAsync([FromBody] params FeeClient[] items)
2 months ago
{
return await _service.GetCurrenciesAsync(items);
}
/// <summary>
/// 提交发票开票
/// </summary>
/// <param name="request">请求参数</param>
/// <returns></returns>
[HttpPost, Route("Save")]
2 months ago
public async Task<DataResult<Invoice>> SaveAsync([FromBody] InvoiceRequest<Invoice> request)
{
if (!ModelState.IsValid)
return DataResult<Invoice>.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
2 months ago
request.Invoice.Mode = InvoiceMode.Free;
return await _service.SaveAsync(request);
}
}
}