using DS.Module.Core; 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 { /// /// 自由开票API /// public class FreeInvoiceController : ApiController { readonly IFreeInvoiceService _service; /// /// 初始化 /// /// public FreeInvoiceController(IFreeInvoiceService service) { _service = service; } /// /// 获取发票详情 /// /// 发票ID /// [HttpGet, Route("Get")] public async Task> GetAsync(long id) { return await _service.GetAsync(id); } /// /// 获取待开票的业务列表 /// /// /// 注意!!【费用范围】需通过 OtherQueryCondition 字段传入 [HttpPost, Route("GetBizList")] public async Task>> GetBizListAsync([FromBody] PageRequest request) { return await _service.GetBizListAsync(request); } /// /// 根据业务编号及类型获取费用记录 /// /// 业务ID与业务类型 /// [HttpPost, Route("GetFees")] public async Task> GetFeesAsync([FromBody] DetailInquiry inquiry) { return await _service.GetFeesAsync(inquiry); } /// /// 根据业务编号及类型获取该票业务的币别 /// /// 业务ID与业务类型 /// [HttpPost, Route("GetCurrencies")] public async Task>> GetCurrenciesAsync([FromBody] DetailInquiry inquiry) { return await _service.GetCurrenciesAsync(inquiry); } /// /// 提交发票开票 /// /// 请求参数 /// [HttpPost, Route("Save")] public async Task> SaveAsync([FromBody] InvoiceRequest request) { if (!ModelState.IsValid) return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); request.Invoice.Mode = InvoiceMode.Free; return await _service.SaveAsync(request); } } }