using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.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 PaymentFreeSettlementController : ApiController
{
readonly IPaymentFreeSettlementService _service;
///
/// 初始化
///
///
public PaymentFreeSettlementController(IPaymentFreeSettlementService service)
{
_service = service;
}
///
/// 获取待结算业务分页列表
///
///
///
[HttpPost, Route("GetBizList")]
public async Task>> GetBizListAsync([FromBody] PageRequest request)
{
return await _service.GetBizListAsync(request);
}
///
/// 根据业务编号及类型获取关联费用记录
///
/// 业务ID与业务类型
///
[HttpPost, Route("GetFees")]
public async Task> GetFeesAsync([FromBody] FeeClient[] items)
{
return await _service.GetFeesAsync(items);
}
///
/// 获取付费自由结算单
///
/// 结算单ID
///
[HttpGet, Route("Get")]
public async Task> GetAsync(long id)
{
return await _service.GetAsync(id);
}
///
/// 获取付费自由结算明细
///
///
///
/// 注意!!需要指定结算单ID,通过 OtherQueryCondition 传入
[HttpPost, Route("GetDetails")]
public async Task> GetDetailsAsync(PageRequest request)
{
return await _service.GetDetailsAsync(request);
}
///
/// 根据付费申请创建结算单
///
///
///
[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 (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
return await _service.DeleteDetailAsync(model.Ids);
}
///
/// 删除申请单
///
/// 申请单ID
///
[HttpPost, Route("Delete")]
public async Task DeleteAsync([FromBody] IdModel model)
{
if (!ModelState.IsValid)
return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest);
return await _service.DeleteAsync(model.Ids);
}
///
/// 设置结算单的锁定状态
///
///
[HttpPost, Route("SetLock")]
public async Task 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);
}
}
}