From 9661a38ed3de92c2c7a186c7c439bfec4f07b651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 1 Nov 2024 10:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 3 +- .../DS.Module.Core/Enums/FeeStatus.cs | 2 +- .../DS.WMS.Core/Fee/Method/FeeAuditService.cs | 123 +----------------- .../Fee/Method/FeeRecordService.cs | 6 +- .../Method/FeeBillTaskService.cs | 111 ++++++++++++++++ .../TaskInteraction/Method/FeeTaskService.cs | 84 ++++++------ .../TaskInteraction/Method/TaskService.cs | 4 +- .../Controllers/FeeAuditController.cs | 29 ++++- .../Controllers/FeeRecordController.cs | 21 +-- 9 files changed, 201 insertions(+), 182 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index ee26a220..942ce322 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -629,11 +629,12 @@ public static class MultiLanguageConst public const string AuditUnauthorization = "Audit_Unauthorized"; [Description("当前暂无待审批的项")] public const string NoAuditItems = "No_Audit_Items"; - [Description("所选项正在进行审批")] public const string ItemsAreAuditing = "Items_Are_Auditing"; [Description("没有找到费用名称")] public const string NoFeeName = "NoFeeName"; + [Description("无法执行操作,当前订单的整票费用审核状态为:{0}")] + public const string BillFeeStatusError = "BillRecvStatusError"; #endregion #region 申请相关 diff --git a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs index e3c42d33..1b6f1151 100644 --- a/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs +++ b/ds-wms-service/DS.Module.Core/Enums/FeeStatus.cs @@ -166,7 +166,7 @@ namespace DS.Module.Core /// /// 待提交 /// - [Description("待提交")] + [Description("应收待提交")] Pending = 0, /// diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs index 09827b8d..1ad71fbd 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -727,7 +727,6 @@ namespace DS.WMS.Core.Fee.Method if (await taskService.HasAuthorizedAsync()) { result = await taskService.AuditAsync(request); - if (!result.Succeeded) return result; } @@ -751,28 +750,6 @@ namespace DS.WMS.Core.Fee.Method } } - //long userId = long.Parse(User.UserId); - //entity.BillFeeStatusTime = DateTime.Now; - ////变更状态为提交审核 - //if (request.TaskType == TaskBaseTypeEnum.BILL_RECV_AUDIT) - // entity.BillAuditStatus = BillAuditStatus.RecvPassed; - //else if (request.TaskType == TaskBaseTypeEnum.BILL_PAY_AUDIT) - // entity.BillAuditStatus = BillAuditStatus.PayPassed; - - //await TenantDb.Updateable(entity).UpdateColumns(x => new - //{ - // x.BillAuditStatus, - // x.BillFeeStatusTime - //}).ExecuteCommandAsync(); - - ////修改关联费用状态为审核完成 - //await TenantDb.Updateable().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted) - //.SetColumns(x => x.FeeStatus == FeeStatus.AuditPassed) - //.SetColumns(x => x.AuditBy == userId) - //.SetColumns(x => x.AuditOperator == User.UserName) - //.SetColumns(x => x.AuditDate == entity.BillFeeStatusTime) - //.ExecuteCommandAsync(); - await TenantDb.Ado.CommitTranAsync(); return result; } @@ -807,25 +784,7 @@ namespace DS.WMS.Core.Fee.Method public async Task UpdateStatusAsync(FlowCallback callback) { var auditType = callback.AuditType; - FeeRecord? fee = null; - BusinessFeeStatus? biz = null; - if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT || auditType == TaskBaseTypeEnum.BILL_PAY_AUDIT) - { - biz = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType) - .Select(x => new BusinessFeeStatus - { - Id = x.Id, - BillAuditStatus = x.BillAuditStatus, - BillFeeStatusTime = x.BillFeeStatusTime, - ARFeeStatus = x.ARFeeStatus, - APFeeStatus = x.APFeeStatus - }).FirstAsync(); - if (biz == null) - return DataResult.Failed(MultiLanguageConst.EmptyData); - } - else - { - fee = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId).Select( + FeeRecord? fee = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId).Select( x => new FeeRecord { Id = x.Id, @@ -833,12 +792,10 @@ namespace DS.WMS.Core.Fee.Method BusinessId = x.BusinessId, BusinessType = x.BusinessType }).FirstAsync(); - if (fee == null) - return DataResult.Failed(MultiLanguageConst.EmptyData); - - fee.Reason = callback.RejectReason; - } + if (fee == null) + return DataResult.Failed(MultiLanguageConst.EmptyData); + fee.Reason = callback.RejectReason; long userId = long.Parse(User.UserId); DateTime dtNow = DateTime.Now; await TenantDb.Ado.BeginTranAsync(); @@ -940,78 +897,8 @@ namespace DS.WMS.Core.Fee.Method break; } - if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT) - { - FeeStatus status = FeeStatus.RejectSubmission; - if (callback.FlowStatus == FlowStatusEnum.Approve) - { - biz.BillAuditStatus = BillAuditStatus.RecvPassed; - biz.ARFeeStatus = BillFeeStatus.AuditPassed; - status = FeeStatus.AuditPassed; - } - else if (callback.FlowStatus == FlowStatusEnum.Reject) - { - biz.BillAuditStatus = BillAuditStatus.RecvRejected; - biz.ARFeeStatus = BillFeeStatus.RejectSubmission; - } - - biz.BillFeeStatusTime = dtNow; - await TenantDb.Updateable(biz).UpdateColumns(x => new - { - x.BillAuditStatus, - x.BillFeeStatusTime, - x.ARFeeStatus - }).ExecuteCommandAsync(); - - await TenantDb.Updateable() - .SetColumns(x => x.FeeStatus == status) - .SetColumns(x => x.AuditBy == userId) - .SetColumns(x => x.AuditOperator == User.UserName) - .SetColumns(x => x.AuditDate == dtNow) - .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted) - .ExecuteCommandAsync(); - } - else if (auditType == TaskBaseTypeEnum.BILL_PAY_AUDIT) - { - FeeStatus status = FeeStatus.RejectSubmission; - if (callback.FlowStatus == FlowStatusEnum.Approve) - { - biz.BillAuditStatus = BillAuditStatus.PayPassed; - biz.APFeeStatus = BillFeeStatus.AuditPassed; - status = FeeStatus.AuditPassed; - } - else if (callback.FlowStatus == FlowStatusEnum.Reject) - { - biz.BillAuditStatus = BillAuditStatus.PayRejected; - biz.APFeeStatus = BillFeeStatus.RejectSubmission; - } - - biz.BillFeeStatusTime = dtNow; - await TenantDb.Updateable(biz).UpdateColumns(x => new - { - x.BillAuditStatus, - x.BillFeeStatusTime, - x.APFeeStatus - }).ExecuteCommandAsync(); - - await TenantDb.Updateable() - .SetColumns(x => x.FeeStatus == status) - .SetColumns(x => x.AuditBy == userId) - .SetColumns(x => x.AuditOperator == User.UserName) - .SetColumns(x => x.AuditDate == dtNow) - .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted) - .ExecuteCommandAsync(); - } - + await feeService.WriteBackStatusAsync(fee.BusinessId, fee.BusinessType); await TenantDb.Ado.CommitTranAsync(); - - if (auditType != TaskBaseTypeEnum.BILL_RECV_AUDIT && auditType != TaskBaseTypeEnum.BILL_PAY_AUDIT) - { - await feeService.WriteBackStatusAsync( - biz != null ? biz.BusinessId : fee.BusinessId, - biz != null ? biz.BusinessType : fee.BusinessType); - } - return DataResult.Success; } catch (Exception ex) diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs index 785dbce9..fd34e74f 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -895,12 +895,14 @@ namespace DS.WMS.Core.Fee.Method if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT) { if (entity.BillAuditStatus != BillAuditStatus.Pending && entity.BillAuditStatus != BillAuditStatus.RecvRejected) - return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription())); + return DataResult.Failed(string.Format( + MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BillFeeStatusError)), entity.BillAuditStatus.GetDescription())); } else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT) { if (entity.BillAuditStatus != BillAuditStatus.RecvPassed && entity.BillAuditStatus != BillAuditStatus.PayRejected) - return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription())); + return DataResult.Failed(string.Format( + MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BillFeeStatusError)), entity.BillAuditStatus.GetDescription())); } else { diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs index 8453a18a..5c1537ed 100644 --- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeBillTaskService.cs @@ -1,4 +1,7 @@ using DS.Module.Core; +using DS.WMS.Core.Fee.Entity; +using DS.WMS.Core.Flow.Dtos; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.TaskInteraction.Dtos; using DS.WMS.Core.TaskInteraction.Interface; @@ -17,9 +20,117 @@ namespace DS.WMS.Core.TaskInteraction.Method { } + /// + /// 批量创建 + /// + /// + /// + /// public override Task CreateMultipleTaskAsync(TaskCreationRequest request, bool useTransaction = true) { return Task.FromResult(DataResult.Failed("不支持批量提交整票审核任务")); } + + /// + /// 回调更新 + /// + /// + /// + public override async Task UpdateBusinessAsync(FlowCallback callback) + { + var auditType = callback.AuditType; + if (auditType != TaskBaseTypeEnum.BILL_RECV_AUDIT && auditType != TaskBaseTypeEnum.BILL_PAY_AUDIT) + return; + + var biz = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType) + .Select(x => new BusinessFeeStatus + { + Id = x.Id, + BillAuditStatus = x.BillAuditStatus, + BillFeeStatusTime = x.BillFeeStatusTime, + ARFeeStatus = x.ARFeeStatus, + APFeeStatus = x.APFeeStatus + }).FirstAsync(); + if (biz == null) + return; + + long userId = long.Parse(User.UserId); + DateTime dtNow = DateTime.Now; + await TenantDb.Ado.BeginTranAsync(); + try + { + if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT) + { + FeeStatus status = FeeStatus.RejectSubmission; + if (callback.FlowStatus == FlowStatusEnum.Approve) + { + biz.BillAuditStatus = BillAuditStatus.RecvPassed; + biz.ARFeeStatus = BillFeeStatus.AuditPassed; + status = FeeStatus.AuditPassed; + } + else if (callback.FlowStatus == FlowStatusEnum.Reject) + { + biz.BillAuditStatus = BillAuditStatus.RecvRejected; + biz.ARFeeStatus = BillFeeStatus.RejectSubmission; + } + + biz.BillFeeStatusTime = dtNow; + await TenantDb.Updateable(biz).UpdateColumns(x => new + { + x.BillAuditStatus, + x.BillFeeStatusTime, + x.ARFeeStatus + }).ExecuteCommandAsync(); + + await TenantDb.Updateable() + .SetColumns(x => x.FeeStatus == status) + .SetColumns(x => x.AuditBy == userId) + .SetColumns(x => x.AuditOperator == User.UserName) + .SetColumns(x => x.AuditDate == dtNow) + .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted) + .ExecuteCommandAsync(); + } + else if (auditType == TaskBaseTypeEnum.BILL_PAY_AUDIT) + { + FeeStatus status = FeeStatus.RejectSubmission; + if (callback.FlowStatus == FlowStatusEnum.Approve) + { + biz.BillAuditStatus = BillAuditStatus.PayPassed; + biz.APFeeStatus = BillFeeStatus.AuditPassed; + status = FeeStatus.AuditPassed; + } + else if (callback.FlowStatus == FlowStatusEnum.Reject) + { + biz.BillAuditStatus = BillAuditStatus.PayRejected; + biz.APFeeStatus = BillFeeStatus.RejectSubmission; + } + + biz.BillFeeStatusTime = dtNow; + await TenantDb.Updateable(biz).UpdateColumns(x => new + { + x.BillAuditStatus, + x.BillFeeStatusTime, + x.APFeeStatus + }).ExecuteCommandAsync(); + + await TenantDb.Updateable() + .SetColumns(x => x.FeeStatus == status) + .SetColumns(x => x.AuditBy == userId) + .SetColumns(x => x.AuditOperator == User.UserName) + .SetColumns(x => x.AuditDate == dtNow) + .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted) + .ExecuteCommandAsync(); + } + + await base.UpdateBusinessAsync(callback); + await TenantDb.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + await TenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(Db); + throw; + } + } } } diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeTaskService.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeTaskService.cs index c803d107..93f19d14 100644 --- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/FeeTaskService.cs @@ -8,6 +8,7 @@ using DS.WMS.Core.TaskInteraction.Dtos; using DS.WMS.Core.TaskInteraction.Entity; using DS.WMS.Core.TaskInteraction.Interface; using DS.WMS.Core.TaskPlat.Dtos; +using Mapster; using Masuit.Tools; using Masuit.Tools.Systems; @@ -52,13 +53,7 @@ namespace DS.WMS.Core.TaskInteraction.Method bool updateFlag = false; var task = await GetQuery(request.BusinessId, request.BusinessType, request.TaskType).FirstAsync(); if (task != null && AuditTaskTypes.Contains(request.TaskType) && (task.TaskStatus == TaskStatusEnum.Pending || task.TaskStatus == TaskStatusEnum.Cancel)) - { updateFlag = true; - } - else - { - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskExists)); - } long userId = long.Parse(User.UserId); DateTime dtNow = DateTime.Now; @@ -129,57 +124,54 @@ namespace DS.WMS.Core.TaskInteraction.Method await LogService.WriteLogAsync(task); } - //审核任务需创建工作流 - if (AuditTaskTypes.Contains(request.TaskType)) + result = await CreateAndStartWorkflow(task, false); + if (!result.Succeeded) + return result; + + if (updateFlag) { - result = await CreateAndStartWorkflow(task, false); + result = await SetTaskStatusAsync(new TaskUpdateRequest + { + BusinessId = request.BusinessId, + BusinessType = request.BusinessType, + TaskTypeName = request.TaskTypeName, + TaskStatus = TaskStatusEnum.Create + }, false); + if (!result.Succeeded) return result; + } + else //费用审核需拆分任务 + { + var instance = result.Data as FlowInstance; + var ids = FlowInstanceService.GetMarkers(instance).Select(long.Parse).ToArray(); + var recvUserList = await FillInUserInfoAsync(ids); - if (updateFlag) - { - result = await SetTaskStatusAsync(new TaskUpdateRequest + var fee = await TenantDb.Queryable().Where(x => x.Id == request.BusinessId) + .Select(x => new { - BusinessId = request.BusinessId, - BusinessType = request.BusinessType, - TaskTypeName = request.TaskTypeName, - TaskStatus = TaskStatusEnum.Create - }, false); + x.Id, + x.BusinessId, + x.BusinessType + }).FirstAsync(); + foreach (var item in recvUserList) + { + var copiedInfo = info.DeepClone(); + copiedInfo.Head.BSNO = fee.BusinessId; //替换为费用关联的订单ID + copiedInfo.Main.RecvUserInfoList.Clear(); + copiedInfo.Main.RecvUserInfoList.Add(item); + copiedInfo.Main.ExtData = new { fee.BusinessType, FeeId = fee.Id }; + result = await ManagerService.InitTaskJob(copiedInfo); if (!result.Succeeded) - return result; - } - else //费用审核需拆分任务 - { - var instance = result.Data as FlowInstance; - var ids = FlowInstanceService.GetMarkers(instance).Select(long.Parse).ToArray(); - var recvUserList = await FillInUserInfoAsync(ids); - - var fee = await TenantDb.Queryable().Where(x => x.Id == request.BusinessId) - .Select(x => new - { - x.Id, - x.BusinessId, - x.BusinessType - }).FirstAsync(); - foreach (var item in recvUserList) { - var copiedInfo = info.DeepClone(); - copiedInfo.Head.BSNO = fee.BusinessId; //替换为费用关联的订单ID - copiedInfo.Main.RecvUserInfoList.Clear(); - copiedInfo.Main.RecvUserInfoList.Add(item); - copiedInfo.Main.ExtData = new { fee.BusinessType, FeeId = fee.Id }; - - result = await ManagerService.InitTaskJob(copiedInfo); - if (!result.Succeeded) - { - await Db.Deleteable(instance).ExecuteCommandAsync(); - return result; - } + await Db.Deleteable(instance).ExecuteCommandAsync(); + return result; } } } + if (useTransaction) await TenantDb.Ado.CommitTranAsync(); @@ -450,7 +442,7 @@ namespace DS.WMS.Core.TaskInteraction.Method } //获取指定业务的所有关联费用类任务 - internal async Task> GetFeeTasks(BusinessType bsType, long[] bsIds, params long[] excludeFeeIds) + async Task> GetFeeTasks(BusinessType bsType, long[] bsIds, params long[] excludeFeeIds) { return await TenantDb.Queryable() .InnerJoin((t, f) => t.BusinessId == f.Id) diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/TaskService.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/TaskService.cs index 23f5aa62..327ccf3b 100644 --- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/TaskService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/TaskService.cs @@ -1055,7 +1055,7 @@ namespace DS.WMS.Core.TaskInteraction.Method public virtual async Task UpdateBusinessAsync(FlowCallback callback) { ArgumentNullException.ThrowIfNull(callback, nameof(callback)); - if (callback.AuditType == null || callback.BusinessType == null) + if (callback.AuditType == null) return; string remark = "终审完成,审批结果为:" + callback.FlowStatus.GetDescription(); @@ -1070,7 +1070,7 @@ namespace DS.WMS.Core.TaskInteraction.Method RecvUserIdList = [task.CreateBy] //通知任务发起人 }; //创建驳回任务以进行通知 - await CreateTaskAsync(request); + await CreateTaskAsync(request, false); //更新任务描述为驳回原因 await SetTaskBaseDescription(callback.BusinessId, request.TaskType, callback.RejectReason!); diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs index 895c2db0..bff5b762 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeAuditController.cs @@ -1,9 +1,11 @@ -using DS.Module.Core; +using System.Net; +using DS.Module.Core; using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.TaskInteraction.Dtos; +using DS.WMS.Core.TaskInteraction.Interface; using Microsoft.AspNetCore.Mvc; namespace DS.WMS.FeeApi.Controllers @@ -152,7 +154,7 @@ namespace DS.WMS.FeeApi.Controllers } /// - /// 变更费用审批状态(用于工作流框架的回调) + /// 变更费用审核状态 /// /// 回调信息 /// @@ -164,5 +166,28 @@ namespace DS.WMS.FeeApi.Controllers return await _auditService.UpdateStatusAsync(callback); } + + /// + /// 整票审核回调 + /// + /// + /// 回调信息 + /// + [HttpPost, Route("BillCallback")] + public async Task BillCallbackAsync([FromServices] IFeeBillTaskService service, [FromBody] FlowCallback callback) + { + if (callback == null) + return BadRequest("参数无效"); + + try + { + await service.UpdateBusinessAsync(callback); + return Ok(); + } + catch (Exception ex) + { + return StatusCode((int)HttpStatusCode.InternalServerError, ex.Message); + } + } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs index ca1a28b8..2ec6c9e8 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FeeRecordController.cs @@ -5,6 +5,7 @@ using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Fee.Method.ReportProviders; using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.TaskInteraction.Dtos; using Microsoft.AspNetCore.Mvc; namespace DS.WMS.FeeApi.Controllers @@ -226,29 +227,29 @@ namespace DS.WMS.FeeApi.Controllers /// /// 发起整票审核 /// - /// 业务ID和类型 + /// 业务ID和类型 /// [HttpPost, Route("ApplyBusinessAudit")] - public async Task ApplyBillAuditAsync([FromBody] IdModel model) + public async Task ApplyBillAuditAsync([FromBody] TaskRequest request) { - if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null) - return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); - return await _feeService.SubmitBillAuditAsync(bid, (BusinessType)model.BusinessType.Value, model.Value); + return await _feeService.SubmitBillAuditAsync(request.BusinessId, request.BusinessType.GetValueOrDefault(), request.TaskType); } /// /// 撤销整票审核 /// - /// 业务ID和类型 + /// 业务ID和类型 /// [HttpPost, Route("WithdrawBusiness")] - public async Task WithdrawBillAsync([FromBody] IdModel model) + public async Task WithdrawBillAsync([FromBody] TaskRequest request) { - if (!long.TryParse(model.Id, out long bid) || model.BusinessType == null) - return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest); + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); - return await _feeService.WithdrawBillAsync(bid, (BusinessType)model.BusinessType.Value, model.Value); + return await _feeService.WithdrawBillAsync(request.BusinessId, request.BusinessType.GetValueOrDefault(), request.TaskType); } ///