|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.WMS.Core.Application.Dtos;
|
|
|
|
|
using DS.WMS.Core.Application.Entity;
|
|
|
|
|
using DS.WMS.Core.Application.Interface;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.FeeApi.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 付费申请API
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class PaymentApplicationController : ApiController
|
|
|
|
|
{
|
|
|
|
|
readonly IPaymentApplicationService _service;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="service"></param>
|
|
|
|
|
public PaymentApplicationController(IPaymentApplicationService service)
|
|
|
|
|
{
|
|
|
|
|
_service = service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("GetList")]
|
|
|
|
|
public async Task<DataResult<PaymentApplicationModel>> ListAsync([FromBody] PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
return await _service.GetListAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取待付费的业务列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("GetBizList")]
|
|
|
|
|
public async Task<DataResult<List<BizPaymentApplication>>> BizListAsync([FromBody] PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
return await _service.GetBizListAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取申请单详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">申请单ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet, Route("Get")]
|
|
|
|
|
public async Task<DataResult<PaymentApplicationDto>> GetAsync([FromQuery] long id)
|
|
|
|
|
{
|
|
|
|
|
return await _service.GetAsync(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据业务编号及类型获取关联费用记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("GetFees")]
|
|
|
|
|
public async Task<DataResult<PaymentApplicaitonBiz>> GetFeesAsync([FromBody] params FeeClient[] items)
|
|
|
|
|
{
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return DataResult<PaymentApplicaitonBiz>.Failed("缺少请求参数");
|
|
|
|
|
|
|
|
|
|
return await _service.GetFeesAsync(items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提交申请单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="application">申请单</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Save")]
|
|
|
|
|
public async Task<DataResult<PaymentApplication>> SaveAsync([FromBody] PaymentApplication application)
|
|
|
|
|
{
|
|
|
|
|
return await _service.SaveAsync(application);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按业务提交申请单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("BizSave")]
|
|
|
|
|
public async Task<DataResult<PaymentApplication>> SaveAsync([FromBody] ApplicationRequest<PaymentApplication> request)
|
|
|
|
|
{
|
|
|
|
|
if (request.Items == null || request.Items.Count == 0)
|
|
|
|
|
return DataResult<PaymentApplication>.Failed("缺少请求参数");
|
|
|
|
|
|
|
|
|
|
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 (model.Ids == null || model.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("参数无效", 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 (model.Ids == null || model.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.DeleteAsync(model.Ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发起审批
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">申请单ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("ApplyAudit")]
|
|
|
|
|
public async Task<DataResult> ApplyAuditAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model.Ids == null || model.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.SubmitApprovalAsync(TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT, model.Remark, model.Ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 撤销审批
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">申请单ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Withdraw")]
|
|
|
|
|
public async Task<DataResult> WithdrawAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model.Ids == null || model.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
return await _service.WithdrawAsync(model.Ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 标识收到发票
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model">申请单ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("SetInvoiceReceived")]
|
|
|
|
|
public async Task<DataResult> SetInvoiceReceivedAsync([FromBody] IdModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model.Ids == null || model.Ids.Length == 0 || model.Value == null)
|
|
|
|
|
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
|
|
|
|
|
|
|
|
|
|
bool flag = Convert.ToBoolean(model.Value);
|
|
|
|
|
return await _service.SetInvoiceReceivedAsync(flag, model.Ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|