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); } /// /// 获取付费申请结算明细 /// /// /// /// 注意!!若要指定结算单ID,通过 OtherQueryCondition 传入 [HttpPost, Route("GetDetails")] public async Task>> GetDetailsAsync(PageRequest request) { return await _service.GetDetailsAsync(request); } /// /// 获取付费申请分页列表 /// /// /// /// 注意!!【仅未结申请】、【装货港/卸货港】需要通过 OtherQueryCondition 属性传入,对象结构请参考 ApplicationListQuery [HttpPost, Route("GetApplicationList")] public async Task>> GetApplicationListAsync([FromBody] PageRequest request) { return await _service.GetApplicationListAsync(request); } /// /// 获取付费申请的费用明细 /// /// 付费申请单ID /// [HttpGet, Route("GetApplicationDetailsById")] public async Task>> GetApplicationDetailsAsync(long id) { return await _service.GetApplicationDetailsAsync(id); } /// /// 获取结算明细的费用明细 /// /// 申请明细ID /// [HttpPost, Route("GetApplicationDetailsByDetail")] public async Task>> GetApplicationDetailsAsync([FromBody] IdModel model) { if (!ModelState.IsValid) { return DataResult>.Failed( ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); } return await _service.GetApplicationSettlementDetailsAsync(model.Ids); } /// /// 根据付费申请创建结算单 /// /// /// [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); } } }