From ac49b8f7c4902fef6a41a1dad4ca6fa692c2d7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 18 Jun 2024 08:39:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=B5=81=E7=A8=8B=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E5=AE=9E=E4=BE=8B=E7=9A=84=E5=86=85=E5=AE=B9api?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/IClientFlowInstanceService.cs | 7 ++++++- .../Flow/Method/ClientFlowInstanceService.cs | 18 +++++++++++------- .../ClientFlowInstanceController.cs | 7 +++---- 3 files changed, 20 insertions(+), 12 deletions(-) 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 5a89d8bc..c5969f87 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Interface/IClientFlowInstanceService.cs @@ -69,5 +69,10 @@ public interface IClientFlowInstanceService /// DataResult> GetFlowInstanceHistoryList(string id); - DataResult GetFlowInstance(long businessId, BusinessType? businessType, string type); + /// + /// 工作流审批 + /// + /// 工作流实例 + /// + DataResult> GetFlowInstances(long businessId, BusinessType? businessType); } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs index 7f2c2b07..e76490dc 100644 --- a/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Flow/Method/ClientFlowInstanceService.cs @@ -72,21 +72,25 @@ public class ClientFlowInstanceService : FlowInstanceService, IClientFlowInstanc } /// - /// ȡָ͵Ĺʵ + /// ȡʵϢ /// /// ҵID /// ҵ - /// ģ /// - public DataResult GetFlowInstance(long businessId, BusinessType? businessType, string type) + public DataResult> GetFlowInstances(long businessId, BusinessType? businessType) { - var query = db.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType && x.AuditType == type); + var query = db.Queryable().Where(x => x.BusinessId == businessId && x.BusinessType == businessType && x.FlowStatus != 1); if (businessType.HasValue) query = query.Where(x => x.BusinessType == businessType.Value); - var entity = query.OrderByDescending(x => x.CreateTime).Take(1).First(); - var result = entity == null ? null : entity.Adapt(); - return DataResult.Success(result); + var list = query.OrderBy(x => x.CreateTime).Select(x => new FlowInstance + { + Content = x.Content, + AuditType = x.AuditType, + CreateBy = x.CreateBy, + CreateTime = x.CreateTime + }).ToList(); + return DataResult>.Success(list.Select(x => x.Adapt()).ToList()); } /// diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs index 05b5a8b7..2b3a11b2 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/ClientFlowInstanceController.cs @@ -122,10 +122,9 @@ public class ClientFlowInstanceController : ApiController /// 流程类型 /// [HttpGet, Route("GetFlowContent")] - public DataResult GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType? businessType, [FromQuery] AuditType type) + public DataResult> GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType? businessType) { - var res = _invokeService.GetFlowInstance(businessId, businessType, type.ToString()); - string? content = res.Data?.Content; - return DataResult.Success(content ?? string.Empty); + var result = _invokeService.GetFlowInstances(businessId, businessType); + return result; } } \ No newline at end of file