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 81fea90b..311ab6b3 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs @@ -744,6 +744,7 @@ namespace DS.WMS.Core.Fee.Method { Id = x.Id, BusinessId = x.BusinessId, + BusinessType = x.BusinessType, BillAuditStatus = x.BillAuditStatus }).FirstAsync(); if (biz == null) @@ -751,8 +752,14 @@ namespace DS.WMS.Core.Fee.Method } else { - fee = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType).Select( - x => new FeeRecord { Id = x.Id, FeeStatus = x.FeeStatus }).FirstAsync(); + fee = await TenantDb.Queryable().Where(x => x.Id == callback.BusinessId).Select( + x => new FeeRecord + { + Id = x.Id, + FeeStatus = x.FeeStatus, + BusinessId = x.BusinessId, + BusinessType = x.BusinessType + }).FirstAsync(); if (fee == null) return DataResult.Failed(MultiLanguageConst.Operation_Failed); @@ -881,7 +888,7 @@ namespace DS.WMS.Core.Fee.Method .SetColumns(x => x.AuditBy == UserId) .SetColumns(x => x.AuditOperator == User.UserName) .SetColumns(x => x.AuditDate == dtNow) - .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == callback.BusinessType && + .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && (x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.RejectSubmission)).ExecuteCommandAsync(); break; @@ -910,9 +917,10 @@ namespace DS.WMS.Core.Fee.Method } finally { - await feeService.WriteBackStatusAsync(callback.BusinessId, callback.BusinessType.Value); + await feeService.WriteBackStatusAsync( + auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessId : fee.BusinessId, + auditType == TaskBaseTypeEnum.FEE_BUSINESS_AUDIT ? biz.BusinessType : fee.BusinessType); } } - } } 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 396a3a2f..e1cb5cb2 100644 --- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs +++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeRecordService.cs @@ -166,60 +166,63 @@ namespace DS.WMS.Core.Fee.Method foreach (var item in items) { - //逐个判定处理标准 - switch (item.Unit) + if (item.Quantity == 0) { - case "HOUR": //小时 - goto case "P"; + //逐个判定处理标准 + switch (item.Unit) + { + case "HOUR": //小时 + goto case "P"; - case "GE": //个 - goto case "P"; + case "GE": //个 + goto case "P"; - case "DAY": //天 - goto case "P"; + case "DAY": //天 + goto case "P"; - //case "XX": //箱型 - // goto default; + //case "XX": //箱型 + // goto default; - case "JJZL": //计价重量 - goto case "Z"; + case "JJZL": //计价重量 + goto case "Z"; - case "ZJ": //总价 - goto case "P"; + case "ZJ": //总价 + goto case "P"; - case "JZ": //净重 - item.Quantity = 0; - break; + case "JZ": //净重 + item.Quantity = 0; + break; - case "TEU": //TEU - item.Quantity = order.TEU; - break; + case "TEU": //TEU + item.Quantity = order.TEU; + break; - case "JF": //计费吨 - item.Quantity = order.KGS.GetValueOrDefault() / 1000 > order.CBM.GetValueOrDefault() ? order.KGS.GetValueOrDefault() : order.CBM.GetValueOrDefault(); - break; + case "JF": //计费吨 + item.Quantity = order.KGS.GetValueOrDefault() / 1000 > order.CBM.GetValueOrDefault() ? order.KGS.GetValueOrDefault() : order.CBM.GetValueOrDefault(); + break; - case "J": //件数 - item.Quantity = order.PKGS.GetValueOrDefault(); - break; + case "J": //件数 + item.Quantity = order.PKGS.GetValueOrDefault(); + break; - case "C": //尺码 - item.Quantity = order.CBM.GetValueOrDefault(); - break; + case "C": //尺码 + item.Quantity = order.CBM.GetValueOrDefault(); + break; - case "Z": //重量 - item.Quantity = order.KGS.GetValueOrDefault(); - break; + case "Z": //重量 + item.Quantity = order.KGS.GetValueOrDefault(); + break; - case "P": //单票 - item.Quantity = 1; - break; + case "P": //单票 + item.Quantity = 1; + break; - default: //查找箱型标准 - var ctn = ctns.Find(x => x.CtnCode == item.Unit); - item.Quantity = ctn == null ? 0 : ctn.CtnNum.GetValueOrDefault(); - break; - } + default: //查找箱型标准 + var ctn = ctns.Find(x => x.CtnCode == item.Unit); + item.Quantity = ctn == null ? 0 : ctn.CtnNum.GetValueOrDefault(); + break; + } + } //计算税费 item.SetTax(); @@ -1038,7 +1041,7 @@ namespace DS.WMS.Core.Fee.Method /// public async Task WriteBackStatusAsync(long businessId, BusinessType businessType) { - var fees = await TenantDb.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType) + var fees = await TenantDb.Queryable().Where(x => x.BusinessId == businessId) .Select(x => new FeeRecord { FeeType = x.FeeType, diff --git a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs index 7ff57228..0e8e12e3 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs @@ -113,6 +113,15 @@ public interface IClientFlowInstanceService Task WithdrawAsync(TaskBaseTypeEnum taskType, long[] bsIds, BusinessType? businessType = null, string? note = null); + /// + /// 运行回调更新 + /// + /// 业务ID + /// 业务类型 + /// 回调URL + /// + Task RunCallbackAsync(long bsId, BusinessType? businessType = null, string? callbackURL = null); + /// /// 获取流程操作历史 /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Interface/IFlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Interface/IFlowInstanceService.cs index 5196620a..56ce994c 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Interface/IFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Interface/IFlowInstanceService.cs @@ -1,6 +1,5 @@ using DS.Module.Core; using DS.WMS.Core.Flow.Dtos; -using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Flow.Interface; @@ -57,8 +56,7 @@ public interface IFlowInstanceService /// /// public DataResult WithdrawFlowInstance(CancelFlowInstanceReq req); - - + /// /// 获取流程操作历史 /// diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs index 3f2bca85..6d256adb 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/FlowInstanceService.cs @@ -4,6 +4,7 @@ using DS.Module.Core.Extensions; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Entity; using DS.WMS.Core.Flow.Interface; +using DS.WMS.Core.Op.Entity; using DS.WMS.Core.Sys.Entity; using Mapster; using Newtonsoft.Json; @@ -535,6 +536,37 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService } } + /// + /// 运行回调更新 + /// + /// 业务ID + /// 业务类型 + /// 回调URL + /// + public async Task RunCallbackAsync(long bsId, BusinessType? businessType = null, string? callbackURL = null) + { + var instance = await Db.Queryable().Where(x => x.BusinessId == bsId && x.BusinessType == businessType) + .InnerJoin((f, ft) => f.TemplateId == ft.Id).Select((f, ft) => new FlowInstance + { + BusinessId = f.BusinessId, + BusinessType = f.BusinessType, + CallbackURL = ft.CallbackURL, + MarkerNotifyURL = ft.MarkerNotifyURL, + FlowStatus = f.FlowStatus, + Id = f.Id, + AuditType = ft.AuditType + }).FirstAsync(); + + if (instance == null) + return DataResult.FailedWithDesc(MultiLanguageConst.EmptyData); + + if (!string.IsNullOrEmpty(callbackURL)) + instance.CallbackURL = callbackURL; + + await RunCallbackAsync(instance); + return DataResult.Success; + } + /// /// 获取运行实例信息 /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs index 32ea399d..32379440 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs @@ -113,6 +113,20 @@ public class ClientFlowInstanceController : ApiController return res; } + /// + /// 运行回调更新 + /// + /// 业务ID + /// 业务类型(可选) + /// 回调URL(可选) + /// + /// 若未指定,则使用工作流默认的回调地址 + [HttpGet, HttpPost, Route("RunCallback")] + public async Task RunCallbackAsync(long bsId, BusinessType? businessType = null, string? callbackURL = null) + { + return await _invokeService.RunCallbackAsync(bsId, businessType, callbackURL); + } + /// /// 获取流程运行实例的内容 /// @@ -122,7 +136,7 @@ public class ClientFlowInstanceController : ApiController /// [HttpGet, Route("GetFlowContent")] public DataResult> GetFlowContent( - [FromQuery] long businessId, + [FromQuery] long businessId, [FromQuery] BusinessType? businessType, [FromQuery] params TaskBaseTypeEnum[]? types) {