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
{
///
/// 付费结算API
///
public class PaymentSettlementController : ApiController
{
readonly IPaymentSettlementService _service;
///
/// 初始化
///
///
public PaymentSettlementController(IPaymentSettlementService service)
{
_service = service;
}
///
/// 获取列表
///
///
///
[HttpPost, Route("GetList")]
public async Task>> ListAsync([FromBody] PageRequest request)
{
return await _service.GetListAsync(request);
}
///
/// 获取付费结算及其明细
///
/// 结算单ID
///
[HttpGet, Route("Get")]
public async Task> GetAsync(long id)
{
return await _service.GetAsync(id);
}
///
/// 获取付费申请分页列表
///
///
///
[HttpPost, Route("GetApplicationList")]
public async Task>> GetApplicationListAsync([FromBody] PageRequest request)
{
return await _service.GetApplicationListAsync(request);
}
///
/// 获取付费申请的费用明细
///
/// 申请单ID
///
[HttpGet, Route("GetDetails")]
public async Task>> GetDetailsAsync(long id)
{
return await _service.GetDetailsAsync(id);
}
///
/// 根据付费申请创建结算单
///
///
///
[HttpPost, Route("Save")]
public async Task> SaveAsync([FromBody] SettlementRequest request)
{
return await _service.SaveAsync(request);
}
///
/// 删除申请单明细
///
/// 申请单明细ID
///
[HttpPost, Route("DeleteDetail")]
public async Task DeleteDetailAsync([FromBody] IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _service.DeleteDetailAsync(model.Ids);
}
///
/// 删除申请单
///
/// 申请单ID
///
[HttpPost, Route("Delete")]
public async Task DeleteAsync([FromBody] IdModel model)
{
if (model.Ids == null || model.Ids.Length == 0)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return await _service.DeleteAsync(model.Ids);
}
}
}