using DS.Module.Core; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Flow.Interface; using DS.WMS.Core.Op.Entity; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; namespace DS.WMS.MainApi.Controllers; /// /// 流程实例-客户端 /// public class ClientFlowInstanceController : ApiController { private readonly IClientFlowInstanceService _invokeService; /// /// 构造函数 /// /// public ClientFlowInstanceController(IClientFlowInstanceService invokeService) { _invokeService = invokeService; } /// /// 列表 /// /// /// [HttpPost] [Route("GetFlowInstanceList")] public DataResult> GetListByPage([FromBody] PageRequest request) { var res = _invokeService.GetListByPage(request); return res; } /// /// 编辑 /// /// /// [HttpPost] [Route("EditFlowInstance")] public DataResult EditFlowInstance([FromBody] FlowInstanceReq model) { var res = _invokeService.EditFlowInstance(model); return res; } /// /// 详情 /// /// /// [HttpGet] [Route("GetFlowInstanceInfo")] public DataResult GetFlowInstanceInfo([FromQuery] string id) { var res = _invokeService.GetFlowInstanceInfo(id); return res; } /// /// 启动实例 /// /// /// [HttpGet] [Route("StartFlowInstance")] public DataResult StartFlowInstance([FromQuery] string id) { var res = _invokeService.StartFlowInstance(id); return res; } /// /// 创建流程实例 /// /// /// [HttpPost] [Route("CreateFlowInstance")] public DataResult CreateFlowInstance([FromBody] CreateFlowInstanceReq req) { var res = _invokeService.CreateFlowInstance(req); return res; } /// /// 审核流程实例 /// /// /// [HttpPost] [Route("AuditFlowInstance")] public DataResult AuditFlowInstance([FromBody] FlowInstanceAuditReq req) { var res = _invokeService.AuditFlowInstance(req); return res; } /// /// 获取流程操作历史 /// /// /// [HttpGet] [Route("GetFlowInstanceHistoryList")] public DataResult> GetFlowInstanceHistoryList([FromQuery] string id) { var res = _invokeService.GetFlowInstanceHistoryList(id); return res; } /// /// 获取流程运行实例的内容 /// /// 业务ID /// 业务类型(可空) /// 流程类型 /// [HttpGet, Route("GetFlowContent")] public DataResult GetFlowContent([FromQuery] long businessId, [FromQuery] BusinessType? businessType, [FromQuery] AuditType type) { var res = _invokeService.GetFlowInstance(businessId, businessType, type.ToString()); string? content = res.Data?.Content; return DataResult.Success(content ?? string.Empty); } }