using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Flow.Dtos;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
///
/// 发票申请审核API
///
public class InvoiceApplicationAuditController : ApiController
{
readonly IInvoiceApplicationAuditService _auditService;
///
/// 初始化
///
///
public InvoiceApplicationAuditController(IInvoiceApplicationAuditService auditService)
{
_auditService = auditService;
}
///
/// 获取待审核列表
///
///
///
/// 注意!!【仅查看待审核】需要通过 OtherQueryCondition 属性传入
[HttpPost, Route("GetList")]
public async Task>> ListAsync([FromBody] PageRequest request)
{
return await _auditService.GetListAsync(request);
}
///
/// 发票申请审核
///
///
///
[HttpPost, Route("Audit")]
public async Task AuditAsync([FromBody] AuditRequest request)
{
if (request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(request);
}
///
/// 将申请单重置为未打印状态
///
/// 申请单ID
///
[HttpPost, Route("SetUnPrinted")]
public async Task SetUnPrinted(IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.SetUnPrinted(model.Ids);
}
///
/// 变更申请单审批状态(用于工作流框架的回调)
///
/// 回调信息
///
[HttpPost, Route("ChangeStatus")]
public async Task ChangeStatusAsync([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.UpdateStatusAsync(callback);
}
}
}