|
|
using DS.Module.Core;
|
|
|
using DS.Module.Core.Data;
|
|
|
using DS.WMS.Core.Application.Dtos;
|
|
|
using DS.WMS.Core.Settlement.Dtos;
|
|
|
using DS.WMS.Core.Settlement.Entity;
|
|
|
using DS.WMS.Core.Settlement.Interface;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
namespace DS.WMS.FeeApi.Controllers
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 付费申请结算API
|
|
|
/// </summary>
|
|
|
public class PaymentSettlementController : ApiController
|
|
|
{
|
|
|
readonly IApplicationSettlementService _service;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 初始化
|
|
|
/// </summary>
|
|
|
/// <param name="service"></param>
|
|
|
public PaymentSettlementController(IApplicationSettlementService service)
|
|
|
{
|
|
|
_service = service;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取列表
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetList")]
|
|
|
public async Task<DataResult<List<ApplicationSettlementDto>>> ListAsync([FromBody] PageRequest<NumberQuery> request)
|
|
|
{
|
|
|
return await _service.GetListAsync(request);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取付费申请结算单
|
|
|
/// </summary>
|
|
|
/// <param name="id">结算单ID</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet, Route("Get")]
|
|
|
public async Task<DataResult<ApplicationSettlementDto>> GetAsync(long id)
|
|
|
{
|
|
|
return await _service.GetAsync(id);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取付费申请结算明细
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
/// <remarks>注意!!若要指定结算单ID,通过 OtherQueryCondition 传入</remarks>
|
|
|
[HttpPost, Route("GetDetails")]
|
|
|
public async Task<DataResult<List<SettlementDetailGroup>>> GetDetailsAsync(PageRequest<long> request)
|
|
|
{
|
|
|
return await _service.GetDetailsAsync(request);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取付费申请分页列表
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
/// <remarks>注意!!【仅未结申请】、【装货港/卸货港】需要通过 OtherQueryCondition 属性传入,对象结构请参考 ApplicationListQuery</remarks>
|
|
|
[HttpPost, Route("GetApplicationList")]
|
|
|
public async Task<DataResult<List<PaymentApplicationDtoV2>>> GetApplicationListAsync([FromBody] PageRequest<ApplicationListQuery> request)
|
|
|
{
|
|
|
return await _service.GetApplicationListAsync(request);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取付费申请的费用明细
|
|
|
/// </summary>
|
|
|
/// <param name="id">付费申请单ID</param>
|
|
|
/// <param name="currency">费用币别(可空)</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpGet, Route("GetApplicationDetailsById")]
|
|
|
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync([FromQuery] long id, [FromQuery] string? currency = null)
|
|
|
{
|
|
|
return await _service.GetApplicationDetailsAsync(id, currency);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据申请获取费用明细
|
|
|
/// </summary>
|
|
|
/// <param name="query"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetApplicationDetailsByDetail"), Obsolete]
|
|
|
public async Task<DataResult<List<PaymentApplicationDetailDto>>> GetApplicationDetailsAsync([FromBody] DetailQuery query)
|
|
|
{
|
|
|
if (!ModelState.IsValid)
|
|
|
{
|
|
|
return DataResult<List<PaymentApplicationDetailDto>>.Failed(
|
|
|
ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
|
|
|
}
|
|
|
|
|
|
return await _service.GetApplicationDetailsAsync(query.Id, query.Currency);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取申请单费用明细的原始币别
|
|
|
/// </summary>
|
|
|
/// <param name="documents"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetExchanges")]
|
|
|
public async Task<DataResult<List<SettlementDocument>>> GetExchangesAsync([FromBody] List<SettlementDocument> documents)
|
|
|
{
|
|
|
return await _service.GetExchangesAsync(documents);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据付费申请创建结算单
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("Save")]
|
|
|
public async Task<DataResult<ApplicationSettlement>> SaveAsync([FromBody] SettlementRequest<ApplicationSettlement> request)
|
|
|
{
|
|
|
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>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("SetLock")]
|
|
|
public async Task<DataResult> SetLockAsync(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);
|
|
|
}
|
|
|
}
|
|
|
}
|