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.

168 lines
6.0 KiB
C#

using DS.Module.Core;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface;
using DS.WMS.Core.Flow.Dtos;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.FeeApi.Controllers
{
/// <summary>
/// 费用审核服务
/// </summary>
public class FeeAuditController : ApiController
{
readonly IFeeAuditService _auditService;
/// <summary>
/// 初始化
/// </summary>
/// <param name="auditService"></param>
public FeeAuditController(IFeeAuditService auditService)
{
_auditService = auditService;
}
/// <summary>
6 months ago
/// 获取待审核列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
/// <remarks>注意!!【仅看待审批】需要通过 OtherQueryCondition 属性传入</remarks>
[HttpPost, Route("GetList")]
public async Task<DataResult<List<FeeAuditBusiness>>> ListAsync([FromBody] PageRequest<bool> request)
{
return await _auditService.GetListAsync(request);
6 months ago
}
/// <summary>
/// 根据查询条件获取费用明细
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetFees")]
public async Task<DataResult<PendingAuditFee>> GetFeesAsync([FromBody] AuditDetailRequest request)
{
return await _auditService.GetFeesAsync(request);
}
/// <summary>
/// 获取业务相关联的费用统计
/// </summary>
/// <param name="request">查询条件</param>
/// <returns></returns>
[HttpPost, Route("GetStat")]
3 months ago
public async Task<DataResult<FeeAuditStatistics>> GetStatAsync(FeeStatisticsRequestV2 request)
{
return await _auditService.GetStatAsync(request.Id, request.BusinessType, request.FeeId);
}
6 months ago
/// <summary>
/// 获取整票待审核列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetBizList")]
public async Task<DataResult<List<FeeAuditBusiness>>> BizListAsync([FromBody] PageRequest<bool> request)
6 months ago
{
return await _auditService.GetBizListAsync(request);
}
/// <summary>
/// 按费用审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Audit")]
public async Task<DataResult> AuditAsync(AuditRequest request)
{
if (request == null || request.Ids.Length == 0 || (request.Result != 1 && request.Result != 2))
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(request.Result, request.Remark, request.Ids);
}
/// <summary>
/// 按业务审核
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("AuditByBiz")]
public async Task<DataResult> AuditAsync(BizAuditRequest request)
{
if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || request.Items.Count == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditAsync(request);
}
6 months ago
/// <summary>
3 months ago
/// 一键审核当前登录用户的所有待审核项
6 months ago
/// </summary>
3 months ago
/// <param name="request"></param>
6 months ago
/// <returns></returns>
[HttpPost, Route("OneClickAudit")]
3 months ago
public async Task<DataResult> OneClickAuditAsync(AuditConditionRequest request)
6 months ago
{
3 months ago
if (request.Result != 1 && request.Result != 2)
6 months ago
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
3 months ago
return await _auditService.AuditAsync(request);
6 months ago
}
/// <summary>
/// 整票审核
6 months ago
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("BusinessAudit")]
public async Task<DataResult> AuditBusinessAsync(BizAuditRequest request)
{
if (request == null || (request.Result != 1 && request.Result != 2) || request.Items == null || request.Items.Count == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _auditService.AuditBusinessAsync(request);
}
/// <summary>
/// 设置业务锁定状态
/// </summary>
/// <param name="operation">请求信息</param>
/// <returns></returns>
[HttpPost, Route("SetLocking")]
public async Task<DataResult> SetLockingAsync(BizOperation operation)
{
bool? isLocked = null;
try
{
isLocked = Convert.ToBoolean(operation.Value);
}
catch
{
return DataResult.Failed($"参数{nameof(operation.Value)}无效", MultiLanguageConst.IllegalRequest);
}
return await _auditService.SetFeeLockingAsync(operation.Items.Select(x => new Core.Op.Entity.BusinessFeeStatus
{
BusinessId = x.Id,
BusinessType = x.BusinessType,
IsFeeLocking = isLocked
}));
}
/// <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);
}
}
}