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; namespace DS.WMS.MainApi.Controllers; /// /// 流程实例-客户端 /// public class ClientFlowInstanceController : ApiController { private readonly IClientFlowInstanceService _invokeService; /// /// 构造函数 /// /// public ClientFlowInstanceController(IClientFlowInstanceService invokeService) { _invokeService = invokeService; } /// /// 确定是否为最后审批人 /// /// 任务类型 /// 业务ID /// 业务类型(可空) /// [HttpGet, Route("IsLastMarker")] public DataResult IsLastMarker([FromQuery] TaskBaseTypeEnum taskType, [FromQuery] long bsId, [FromQuery] BusinessType? bsType) { return _invokeService.IsLastMarker(taskType, bsId, bsType); } /// /// 列表 /// /// /// [HttpPost] [Route("GetFlowInstanceList")] public async Task>> GetListByPage([FromBody] PageRequest request) { var res = await _invokeService.GetListAsync(request); return res; } /// /// 编辑 /// /// /// [HttpPost] [Route("EditFlowInstance")] public async Task EditFlowInstance([FromBody] FlowInstanceReq model) { var res = await _invokeService.EditAsync(model); return res; } /// /// 详情 /// /// /// [HttpGet] [Route("GetFlowInstanceInfo")] public async Task> GetFlowInstanceInfo([FromQuery] long id) { var res = await _invokeService.GetAsync(id); return res; } /// /// 启动实例 /// /// /// [HttpGet] [Route("StartFlowInstance")] public async Task StartFlowInstance([FromQuery] long id) { var res = await _invokeService.StartAsync(id); return res; } /// /// 创建流程实例 /// /// /// [HttpPost] [Route("CreateFlowInstance")] public async Task CreateFlowInstance([FromBody] CreateFlowInstanceReq req) { var res = await _invokeService.CreateAsync(req); return res; } /// /// 审核流程实例 /// /// /// [HttpPost] [Route("AuditFlowInstance")] public Task AuditAsync([FromBody] FlowInstanceAuditReq req) { return _invokeService.AuditAsync(req); } /// /// 根据业务获取流程操作历史 /// /// 业务ID /// 业务类型(可空) /// [HttpGet, Route("GetFlowHistoriesByBiz")] public async Task>> GetFlowInstanceHistoryList([FromQuery] long bsId, [FromQuery] BusinessType? bsType) { return await _invokeService.GetHistoriesAsync(bsId, bsType); } /// /// 运行回调更新 /// /// 审核类型 /// 业务ID /// 业务类型(可选) /// 回调URL(可选) /// /// 若未指定,则使用工作流默认的回调地址 [HttpGet, HttpPost, Route("RunCallback")] public async Task RunCallbackAsync(TaskBaseTypeEnum taskType, long bsId, BusinessType? businessType = null, string? callbackURL = null) { return await _invokeService.RunCallbackAsync(taskType, bsId, businessType, callbackURL); } /// /// 获取流程运行实例的内容 /// /// 业务ID /// 业务类型(可空) /// 指定审批类型(可空,为空时返回所有类型) /// [HttpGet, Route("GetFlowContent")] public async Task>> GetFlowContent( [FromQuery] long businessId, [FromQuery] BusinessType? businessType, [FromQuery] params TaskBaseTypeEnum[]? types) { var result = await _invokeService.GetInstancesByBizAsync(businessId, businessType, types); return result; } }