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