using DS.Module.Core; using DS.Module.Core.Data; using DS.Module.Core.Enums; 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 PaymentFreeSettlementController : ApiController { readonly IFreeSettlementService _service; /// /// 初始化 /// /// public PaymentFreeSettlementController(IFreeSettlementService 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) { request.Settlement.Mode = SettlementMode.FreeSettlement; return await _service.SaveAsync(request); } /// /// 根据业务编号及类型获取该票业务的币别 /// /// 业务ID与业务类型 /// [HttpPost, Route("GetCurrencies")] public async Task>> GetCurrenciesAsync([FromBody] FeeClient[] items) { return await _service.GetCurrenciesAsync(items); } /// /// 删除申请单明细 /// /// 申请单明细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); } } }