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.

82 lines
2.8 KiB
C#

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
{
/// <summary>
/// 发票申请审核API
/// </summary>
public class InvoiceApplicationAuditController : ApiController
{
readonly IInvoiceApplicationAuditService _auditService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="auditService"></param>
public InvoiceApplicationAuditController(IInvoiceApplicationAuditService auditService)
{
_auditService = auditService;
}
/// <summary>
/// 获取待审核列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <remarks>注意!!【仅查看待审核】需要通过 OtherQueryCondition 属性传入</remarks>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<InvoiceApplicationDto>>> ListAsync([FromBody] PageRequest<bool?> request)
{
return await _auditService.GetListAsync(request);
}
/// <summary>
/// 发票申请审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async Task<DataResult> 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);
}
/// <summary>
/// 将申请单重置为未打印状态
/// </summary>
/// <param name="model">申请单ID</param>
/// <returns></returns>
[HttpPost, Route("SetUnPrinted")]
public async Task<DataResult> SetUnPrinted(IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.SetUnPrinted(model.Ids);
}
/// <summary>
/// 变更申请单审批状态(用于工作流框架的回调)
/// </summary>
/// <param name="callback">回调信息</param>
/// <returns></returns>
[HttpPost, Route("ChangeStatus")]
public async Task<DataResult> ChangeStatusAsync([FromBody] FlowCallback callback)
{
if (callback == null)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.UpdateStatusAsync(callback);
}
}
}