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.

92 lines
3.0 KiB
C#

using DS.Module.Core;
using DS.Module.Core.Data;
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 PaymentFreeSettlementController : ApiController
{
readonly IPaymentFreeSettlementService _service;
/// <summary>
/// 初始化
/// </summary>
/// <param name="service"></param>
public PaymentFreeSettlementController(IPaymentFreeSettlementService service)
{
_service = service;
}
/// <summary>
/// 获取待结算费用分页列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("GetFeeList")]
public async Task<DataResult<List<SettlementBiz>>> GetFeeListAsync([FromBody] PageRequest request)
{
return await _service.GetBizListAsync(request);
}
/// <summary>
/// 根据付费申请创建结算单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost, Route("Save")]
public async Task<DataResult<PaymentSettlement>> SaveAsync([FromBody] SettlementRequest<PaymentSettlement> 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);
}
}
}