|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.WMS.Core.Invoice.Dto;
|
|
|
|
|
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 GeneralInvoiceController : ApiController
|
|
|
|
|
{
|
|
|
|
|
readonly IGeneralInvoiceService _service;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="service"></param>
|
|
|
|
|
public GeneralInvoiceController(IGeneralInvoiceService 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></returns>
|
|
|
|
|
[HttpPost, Route("Save")]
|
|
|
|
|
public async Task<DataResult<Invoice>> SaveAsync(InvoiceRequest<Invoice> request)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult<Invoice>.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.SaveAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除发票明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">发票明细ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("DeleteDetail")]
|
|
|
|
|
public async Task<DataResult> DeleteDetailAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.DeleteDetailAsync(model.Ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除发票
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">发票ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Delete")]
|
|
|
|
|
public async Task<DataResult> DeleteAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.DeleteAsync(model.Ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置发票的锁定状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">发票ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("SetLock")]
|
|
|
|
|
public async Task<DataResult> SetLockAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
bool isLocked = Convert.ToBoolean(model.Value);
|
|
|
|
|
return await _service.SetLockAsync(isLocked, model.Ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|