mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-10 19:34:45 +08:00
完成流程实例列表/详情、流程模版添加
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
public class CommonApplyApp
|
||||
{
|
||||
private IRepository<CommonApply> _repository;
|
||||
private IUnitWork _unitWork;
|
||||
|
||||
public CommonApplyApp(IRepository<CommonApply> repository, IUnitWork unitWork)
|
||||
{
|
||||
_repository = repository;
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
public void AddOrUpdate(CommonApply model)
|
||||
{
|
||||
if (model.Id == Guid.Empty)
|
||||
{
|
||||
model.ApplyTime = DateTime.Now;
|
||||
_repository.Add(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repository.Update(u => u.Id == model.Id, u => new CommonApply
|
||||
{
|
||||
UserId = model.UserId,
|
||||
Name = model.Name,
|
||||
Comment = model.Comment,
|
||||
WorkflowName = model.WorkflowName
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改流程状态
|
||||
/// </summary>
|
||||
public void ChangeState(Guid id,string state, string statename)
|
||||
{
|
||||
_repository.Update(u =>u.Id == id, u =>new CommonApply
|
||||
{
|
||||
State = state,
|
||||
StateName = statename
|
||||
});
|
||||
}
|
||||
|
||||
public CommonApply Get(Guid value)
|
||||
{
|
||||
return _repository.FindSingle(u =>u.Id == value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载流程处理
|
||||
/// </summary>
|
||||
/// <param name="userid">用户ID</param>
|
||||
/// <param name="type">inbox:待办事项/outbox:已办事项</param>
|
||||
public GridData Load(Guid userid, string type, int pageCurrent, int pageSize)
|
||||
{
|
||||
var result = new GridData
|
||||
{
|
||||
page = pageCurrent
|
||||
};
|
||||
|
||||
if (type == "inbox") //待办事项
|
||||
{
|
||||
var inboxes = GetInboxProcessIds(userid);
|
||||
result.total = _unitWork.Find<CommonApply>(u => inboxes.Contains(u.Id)).Count();
|
||||
result.rows = _unitWork.Find<CommonApply>(pageCurrent, pageSize, "Sort descending",u => inboxes.Contains(u.Id)).ToList();
|
||||
}
|
||||
else if (type == "outbox") //已办事项
|
||||
{
|
||||
IQueryable<Guid> outboxes = GetOutboxProcessIds(userid);
|
||||
result.total = _unitWork.Find<CommonApply>(u => outboxes.Contains(u.Id)).Count();
|
||||
result.rows = _unitWork.Find<CommonApply>(pageCurrent, pageSize, "Sort descending", u => outboxes.Contains(u.Id)).ToList();
|
||||
}
|
||||
else //我的流程
|
||||
{
|
||||
result.total = _unitWork.Find<CommonApply>(u => u.UserId == userid).Count();
|
||||
result.rows = _unitWork.Find<CommonApply>(pageCurrent, pageSize, "Sort descending", u => u.UserId == userid).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private IQueryable<Guid> GetOutboxProcessIds(Guid userid)
|
||||
{
|
||||
return _unitWork.Find<ApplyTransitionHistory>(u => u.UserId == userid).Select(u => u.ApplyId);
|
||||
}
|
||||
|
||||
private IQueryable<Guid> GetInboxProcessIds(Guid userid)
|
||||
{
|
||||
return _unitWork.Find<Relevance>(u =>u.Key =="ProcessUser" &&(userid == Guid.Empty || u.SecondId == userid)).Select(u =>u.FirstId);
|
||||
}
|
||||
|
||||
public void Del(Guid[] ids)
|
||||
{
|
||||
_repository.Delete(u =>ids.Contains(u.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
64
OpenAuth.App/Extention/IWF_Runtime.cs
Normal file
64
OpenAuth.App/Extention/IWF_Runtime.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.App.Extention
|
||||
{
|
||||
public interface IWF_Runtime
|
||||
{
|
||||
#region 工作流实例流转API
|
||||
/// <summary>
|
||||
/// 工作流实例运行信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
WF_RuntimeModel runtimeModel{get;}
|
||||
/// <summary>
|
||||
/// 获取实例接下来运行的状态
|
||||
/// </summary>
|
||||
/// <returns>-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束</returns>
|
||||
int GetStatus();
|
||||
/// <summary>
|
||||
/// 获取节点类型 0会签开始,1会签结束,2一般节点,开始节点,4流程运行结束
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
int GetNodeStatus(string nodeId);
|
||||
/// <summary>
|
||||
/// 获取会签下面需要审核的ID列表
|
||||
/// </summary>
|
||||
/// <param name="shuntnodeId"></param>
|
||||
/// <returns></returns>
|
||||
List<string> GetCountersigningNodeIdList(string shuntnodeId);
|
||||
/// <summary>
|
||||
/// 通过节点Id获取下一个节点Id
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
string GetNextNodeByNodeId(string nodeId);
|
||||
/// <summary>
|
||||
/// 节点会签审核
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="flag"></param>
|
||||
/// <returns>-1不通过,1等待,其它通过</returns>
|
||||
string NodeConfluence(string nodeId, bool flag,string userId, string description = "");
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string RejectNode();
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
string RejectNode(string nodeId);
|
||||
/// <summary>
|
||||
/// 标记节点1通过,-1不通过,0驳回
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="flag"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="description"></param>
|
||||
void MakeTagNode(string nodeId, int flag,string userId, string description = "");
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
693
OpenAuth.App/Extention/WF_Runtime.cs
Normal file
693
OpenAuth.App/Extention/WF_Runtime.cs
Normal file
@@ -0,0 +1,693 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Infrastructure;
|
||||
|
||||
namespace OpenAuth.App.Extention
|
||||
{
|
||||
/// <summary>
|
||||
/// 版 本 6.1
|
||||
/// Copyright (c) 2013-2016 上海力软信息技术有限公司
|
||||
/// 创建人:陈彬彬
|
||||
/// 日 期:2016.03.04 16:58
|
||||
/// 描 述:工作流流程流转操作类
|
||||
/// </summary>
|
||||
public class WF_Runtime : IWF_Runtime
|
||||
{
|
||||
private WF_RuntimeModel _runtimeModel = null;
|
||||
|
||||
private GetFrmData _getFrmData = null;
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="schemeContent">流程模板</param>
|
||||
/// <param name="currentNodeId">当前节点</param>
|
||||
/// <param name="frmData">表单数据</param>
|
||||
public WF_Runtime(WF_RuntimeInitModel wfRuntimeInitModel,GetFrmData getFrmData = null)
|
||||
{
|
||||
_runtimeModel = new WF_RuntimeModel();
|
||||
_getFrmData = getFrmData;
|
||||
dynamic schemeContentJson = wfRuntimeInitModel.schemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
_runtimeModel.schemeContentJson = schemeContentJson;//模板流程json对象
|
||||
_runtimeModel.nodeDictionary = GetNodeDictionary(schemeContentJson);//节点集合
|
||||
_runtimeModel.lineDictionary = GetLineDictionary(schemeContentJson);//线条集合
|
||||
_runtimeModel.currentNodeId = (wfRuntimeInitModel.currentNodeId == "" ? _runtimeModel.startNodeId : wfRuntimeInitModel.currentNodeId);
|
||||
_runtimeModel.currentNodeType = GetNodeStatus(_runtimeModel.currentNodeId);
|
||||
_runtimeModel.frmData = wfRuntimeInitModel.frmData;
|
||||
if (getFrmData != null)
|
||||
{
|
||||
_runtimeModel.frmType = 1;
|
||||
wfRuntimeInitModel.frmData = GetNodeFrmData(getFrmData);
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.frmType = 0;
|
||||
}
|
||||
|
||||
if (_runtimeModel.currentNodeType == 0 || _runtimeModel.currentNodeType == 4)
|
||||
{
|
||||
_runtimeModel.nextNodeId = "-1";//下一个节点
|
||||
_runtimeModel.nextNodeType = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.nextNodeId = GetNextNode(wfRuntimeInitModel.frmData);//下一个节点
|
||||
_runtimeModel.nextNodeType = GetNodeStatus(_runtimeModel.nextNodeId);
|
||||
}
|
||||
|
||||
_runtimeModel.previousId = wfRuntimeInitModel.previousId;
|
||||
|
||||
_runtimeModel.processId = wfRuntimeInitModel.processId.ToString();
|
||||
_runtimeModel.sqlFrm = SqlBuider(schemeContentJson, wfRuntimeInitModel.frmData, wfRuntimeInitModel.processId.ToString());
|
||||
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
/// <summary>
|
||||
/// 获取工作流节点的字典列表:key节点id
|
||||
/// </summary>
|
||||
/// <param name="schemeContentJson"></param>
|
||||
/// <returns></returns>
|
||||
private Dictionary<string, dynamic> GetNodeDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, dynamic> nodeDictionary = new Dictionary<string, dynamic>();
|
||||
foreach (var item in schemeContentJson.Flow.nodes)
|
||||
{
|
||||
if (!nodeDictionary.ContainsKey(item.id.Value))
|
||||
{
|
||||
nodeDictionary.Add(item.id.Value, item);
|
||||
}
|
||||
if (item.type == "startround")
|
||||
{
|
||||
this._runtimeModel.startNodeId = item.id.Value;
|
||||
}
|
||||
}
|
||||
return nodeDictionary;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取工作流线段的字典列表:key开始节点id,value线条实体列表
|
||||
/// </summary>
|
||||
/// <param name="schemeContentJson"></param>
|
||||
/// <returns></returns>
|
||||
private Dictionary<string, List<dynamic>> GetLineDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, List<dynamic>> lineDictionary = new Dictionary<string, List<dynamic>>();
|
||||
foreach (var item in schemeContentJson.Flow.lines)
|
||||
{
|
||||
if (!lineDictionary.ContainsKey(item.from.Value))
|
||||
{
|
||||
List<dynamic> d = new List<dynamic>();
|
||||
d.Add(item);
|
||||
lineDictionary.Add(item.from.Value, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineDictionary[item.from.Value].Add(item);
|
||||
}
|
||||
}
|
||||
return lineDictionary;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取工作流线段的字典列表:key开始节点id,value线条实体列表
|
||||
/// </summary>
|
||||
/// <param name="schemeContentJson"></param>
|
||||
/// <returns></returns>
|
||||
private Dictionary<string, List<dynamic>> GetToLineDictionary(dynamic schemeContentJson)
|
||||
{
|
||||
Dictionary<string, List<dynamic>> lineDictionary = new Dictionary<string, List<dynamic>>();
|
||||
foreach (var item in schemeContentJson.Flow.lines)
|
||||
{
|
||||
if (!lineDictionary.ContainsKey(item.to.Value))
|
||||
{
|
||||
List<dynamic> d = new List<dynamic>();
|
||||
d.Add(item);
|
||||
lineDictionary.Add(item.to.Value, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
lineDictionary[item.to.Value].Add(item);
|
||||
}
|
||||
}
|
||||
return lineDictionary;
|
||||
}
|
||||
/// <summary>
|
||||
/// 工作流流转条件比较函数
|
||||
/// </summary>
|
||||
/// <param name="frmvalue">表单数据</param>
|
||||
/// <param name="operation"></param>
|
||||
/// <param name="paramValue"></param>
|
||||
/// <returns></returns>
|
||||
private bool LineCompared(string frmvalue, string operation, string paramValue)
|
||||
{
|
||||
bool res = false;
|
||||
switch (operation)
|
||||
{
|
||||
case "Equal"://等于
|
||||
if (decimal.Parse(frmvalue) == decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "NotEqual"://不等于
|
||||
if (decimal.Parse(frmvalue) != decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "Greater"://大于
|
||||
if (decimal.Parse(frmvalue) > decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "GreaterThan"://大于等于
|
||||
if (decimal.Parse(frmvalue) >= decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "Less"://小于
|
||||
if (decimal.Parse(frmvalue) < decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "LessThan"://小于等于
|
||||
if (decimal.Parse(frmvalue) <= decimal.Parse(paramValue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "Null"://为空
|
||||
if (string.IsNullOrEmpty(frmvalue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "NotNull"://不为空
|
||||
if (!string.IsNullOrEmpty(frmvalue))
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "Like"://包含
|
||||
if (frmvalue.IndexOf(paramValue) != -1)
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case "NotLike"://不包含
|
||||
if (frmvalue.IndexOf(paramValue) == -1)
|
||||
{
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取SQL语句
|
||||
/// </summary>
|
||||
/// <param name="tablename"></param>
|
||||
/// <param name="frmData"></param>
|
||||
/// <returns></returns>
|
||||
private string SqlBuider(dynamic schemeContentJson, string frmData, string keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (schemeContentJson.Frm.isSystemTable.Value == 1)
|
||||
{
|
||||
var strSql = new StringBuilder();
|
||||
var frmDataParam = frmData.ToJObject();
|
||||
string sqlname = schemeContentJson.Frm.FrmTableId.Value, sqlvalues = "'" + keyValue + "'";
|
||||
foreach (var item in frmDataParam)
|
||||
{
|
||||
if (item.Key != "__RequestVerificationToken")
|
||||
{
|
||||
sqlname += "," + item.Key;
|
||||
if (item.Value.Type.ToString() == "String")
|
||||
{
|
||||
sqlvalues += ",'" + item.Value + "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlvalues += "," + item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
strSql.Append(string.Format("insert into " + schemeContentJson.Frm.FrmTable.Value + " ({0})values({1})", sqlname, sqlvalues));
|
||||
return strSql.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统表单获取表单数据
|
||||
/// </summary>
|
||||
/// <param name="getFrmData"></param>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
private string GetNodeFrmData(GetFrmData getFrmData,string nodeId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
string _nodeId = (nodeId == null ? _runtimeModel.currentNodeId : nodeId);
|
||||
dynamic _node = _runtimeModel.nodeDictionary[_nodeId];
|
||||
if (_node.setInfo != null)
|
||||
{
|
||||
return getFrmData(_node.setInfo.NodeDataBase.Value, _node.setInfo.NodeTable.Value, _node.setInfo.NodePram.Value, _runtimeModel.processId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取下一个节点
|
||||
/// </summary>
|
||||
/// <param name="frmData">表单数据(用于判断流转条件)</param>
|
||||
private string GetNextNode(string frmData,string nodeId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<dynamic> LineList = null;
|
||||
if (nodeId == null)
|
||||
{
|
||||
LineList = runtimeModel.lineDictionary[runtimeModel.currentNodeId];
|
||||
}
|
||||
else
|
||||
{
|
||||
LineList = runtimeModel.lineDictionary[nodeId];
|
||||
}
|
||||
if (LineList.Count == 1)
|
||||
{
|
||||
return LineList[0].to.Value;
|
||||
}
|
||||
else if (frmData != "")
|
||||
{
|
||||
frmData = frmData.ToLower();//统一转小写
|
||||
var frmDataJson = frmData.ToJObject();//获取数据内容
|
||||
bool flag = false;
|
||||
foreach (var item in LineList)//轮训该节点所有连接的线路
|
||||
{
|
||||
if (item.setInfo == null)//表示该线路没有设置条件,所以流转到下一个节点
|
||||
{
|
||||
return item.to.Value;
|
||||
}
|
||||
foreach (var _item in item.setInfo.ConditionValueJson)//轮询该线条上的所有条件
|
||||
{
|
||||
if (!string.IsNullOrEmpty(frmDataJson[_item.ParamName.Value.ToLower()].Value))
|
||||
{
|
||||
string frmvalue = frmDataJson[_item.ParamName.Value.ToLower()].ToString();
|
||||
string operation = _item.Operation.Value;
|
||||
string paramValue = _item.ParamValue.Value;
|
||||
bool compareValue = LineCompared(frmvalue, operation, paramValue);
|
||||
|
||||
if (_item.Operation.Value == "AND")
|
||||
{
|
||||
flag = compareValue;
|
||||
if (!compareValue)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (compareValue)
|
||||
{
|
||||
flag = compareValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag)//如果满足条件,
|
||||
{
|
||||
return item.to.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "-1";//表示寻找不到节点
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 工作流实例流转API
|
||||
/// <summary>
|
||||
/// 工作流实例运行信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public WF_RuntimeModel runtimeModel
|
||||
{
|
||||
get { return _runtimeModel; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取实例接下来运行的状态
|
||||
/// </summary>
|
||||
/// <returns>-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束</returns>
|
||||
public int GetStatus()
|
||||
{
|
||||
if (_runtimeModel.nextNodeId != "-1")
|
||||
{
|
||||
if (_runtimeModel.nextNode.type == "shuntnode")//会签开始节点
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (_runtimeModel.nextNode.type == "confluencenode")//会签结束节点
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (_runtimeModel.nextNode.type == "endround")//结束节点
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取节点类型 0会签开始,1会签结束,2一般节点,开始节点,4流程运行结束
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
public int GetNodeStatus(string nodeId)
|
||||
{
|
||||
if (_runtimeModel.nodeDictionary[nodeId].type == "shuntnode")//会签开始节点
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (_runtimeModel.nodeDictionary[nodeId].type == "confluencenode")//会签结束节点
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (_runtimeModel.nodeDictionary[nodeId].type == "endround")//结束节点
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else if (_runtimeModel.nodeDictionary[nodeId].type == "startround")//开始节点
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取会签下面需要审核的ID列表
|
||||
/// </summary>
|
||||
/// <param name="shuntnodeId"></param>
|
||||
/// <returns></returns>
|
||||
public List<string> GetCountersigningNodeIdList(string shuntnodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
|
||||
List<dynamic> listline = _runtimeModel.lineDictionary[shuntnodeId];
|
||||
|
||||
foreach (var item in listline)
|
||||
{
|
||||
list.Add(item.to.Value);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过节点Id获取下一个节点Id
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
public string GetNextNodeByNodeId(string nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string frmData = "";
|
||||
if (_runtimeModel.frmType == 0)
|
||||
{
|
||||
frmData = _runtimeModel.frmData;
|
||||
}
|
||||
else
|
||||
{
|
||||
frmData = GetNodeFrmData(_getFrmData, nodeId);
|
||||
}
|
||||
return GetNextNode(frmData, nodeId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 节点会签审核
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="flag"></param>
|
||||
/// <returns>-1不通过,1等待,其它通过</returns>
|
||||
public string NodeConfluence(string nodeId, bool flag,string userId, string description = "")
|
||||
{
|
||||
string res = "-1";
|
||||
try
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
MakeTagNode(nodeId, 1, userId, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeTagNode(nodeId, -1, userId, description);
|
||||
}
|
||||
|
||||
string _nextNodeId = GetNextNodeByNodeId(nodeId);//获取下一个节点
|
||||
if (_nextNodeId != "-1")
|
||||
{
|
||||
Dictionary<string, List<dynamic>> toLines = GetToLineDictionary(_runtimeModel.schemeContentJson);
|
||||
int allnum = toLines[_nextNodeId].Count;
|
||||
int i = 0;
|
||||
foreach (var item in _runtimeModel.schemeContentJson.Flow.nodes)
|
||||
{
|
||||
if (item.id.Value == _nextNodeId)
|
||||
{
|
||||
if(item.setInfo.NodeConfluenceType.Value == "0")//0所有步骤通过
|
||||
{
|
||||
if(flag)
|
||||
{
|
||||
if (item.setInfo.ConfluenceOk == null)
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk = 1;
|
||||
res = "1";
|
||||
}
|
||||
else if (item.setInfo.ConfluenceOk.Value == (allnum - 1))
|
||||
{
|
||||
res = GetNextNodeByNodeId(_nextNodeId);
|
||||
if (res == "-1")
|
||||
{
|
||||
throw (new Exception("会签成功寻找不到下一个节点"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk++;
|
||||
res = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(item.setInfo.NodeConfluenceType.Value == "1")//1一个步骤通过即可
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
res = GetNextNodeByNodeId(_nextNodeId);
|
||||
if (res == "-1")
|
||||
{
|
||||
throw (new Exception("会签成功寻找不到下一个节点"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.setInfo.ConfluenceNo == null)
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo = 1;
|
||||
res = "1";
|
||||
}
|
||||
else if (item.setInfo.ConfluenceNo.Value == (allnum - 1))
|
||||
{
|
||||
res = "-1";
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo++;
|
||||
res = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
else//2按百分比计算
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
if (item.setInfo.ConfluenceOk == null)
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceOk++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.setInfo.ConfluenceNo == null)
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.ConfluenceNo++;
|
||||
}
|
||||
}
|
||||
if ((item.setInfo.ConfluenceNo.Value + item.setInfo.ConfluenceOk.Value) / allnum * 100 > int.Parse(item.setInfo.NodeConfluenceRate.Value))
|
||||
{
|
||||
res = GetNextNodeByNodeId(_nextNodeId);
|
||||
if (res == "-1")
|
||||
{
|
||||
throw (new Exception("会签成功寻找不到下一个节点"));
|
||||
}
|
||||
}
|
||||
else if ((item.setInfo.ConfluenceNo.Value + item.setInfo.ConfluenceOk.Value) == allnum)
|
||||
{
|
||||
res = "-1";
|
||||
}
|
||||
else
|
||||
{
|
||||
res = "1";
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (res == "-1")
|
||||
{
|
||||
MakeTagNode(_nextNodeId, -1, userId);
|
||||
}
|
||||
else if (res != "1")
|
||||
{
|
||||
MakeTagNode(_nextNodeId, 1, userId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_runtimeModel.nextNodeId = res;
|
||||
_runtimeModel.nextNodeType = GetNodeStatus(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw (new Exception("寻找不到会签下合流节点"));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string RejectNode()
|
||||
{
|
||||
return RejectNode(_runtimeModel.currentNodeId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 驳回节点0"前一步"1"第一步"2"某一步" 3"不处理"
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <returns></returns>
|
||||
public string RejectNode(string nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamic _node = _runtimeModel.nodeDictionary[nodeId];
|
||||
if (_node.setInfo != null)
|
||||
{
|
||||
if (_node.setInfo.NodeRejectType.Value == "0")
|
||||
{
|
||||
return _runtimeModel.previousId;
|
||||
}
|
||||
else if (_node.setInfo.NodeRejectType.Value == "1")
|
||||
{
|
||||
return GetNextNodeByNodeId(_runtimeModel.startNodeId);
|
||||
}
|
||||
else if (_node.setInfo.NodeRejectType.Value == "2")
|
||||
{
|
||||
return _node.setInfo.NodeRejectStep.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
else//前一步
|
||||
{
|
||||
return _runtimeModel.previousId;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// 标记节点1通过,-1不通过,0驳回
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="flag"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="description"></param>
|
||||
public void MakeTagNode(string nodeId, int flag, string userId, string description = "")
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in _runtimeModel.schemeContentJson.Flow.nodes)
|
||||
{
|
||||
if (item.id.Value == nodeId)
|
||||
{
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.Taged = flag;
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.UserId = userId;
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.description = description;
|
||||
_runtimeModel.schemeContentJson.Flow.nodes[i].setInfo.TagedTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
35
OpenAuth.App/Extention/WF_RuntimeInitModel.cs
Normal file
35
OpenAuth.App/Extention/WF_RuntimeInitModel.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
|
||||
namespace OpenAuth.App.Extention
|
||||
{
|
||||
/// <summary>
|
||||
/// 版 本 6.1
|
||||
/// Copyright (c) 2013-2016 上海力软信息技术有限公司
|
||||
/// 创建人:陈彬彬
|
||||
/// 日 期:2016.03.04 16:58
|
||||
/// 描 述:工作流流程流转初始化模型类
|
||||
/// </summary>
|
||||
public class WF_RuntimeInitModel
|
||||
{
|
||||
/// <summary>
|
||||
/// GUID
|
||||
/// </summary>
|
||||
public Guid processId { get; set; }
|
||||
/// <summary>
|
||||
/// 工作流模板内容
|
||||
/// </summary>
|
||||
public string schemeContent { get; set; }
|
||||
/// <summary>
|
||||
/// 当前运行节点(默认开始节点)
|
||||
/// </summary>
|
||||
public string currentNodeId { get; set; }
|
||||
/// <summary>
|
||||
/// 提交的表单数据
|
||||
/// </summary>
|
||||
public string frmData { get; set; }
|
||||
/// <summary>
|
||||
/// 上一个节点
|
||||
/// </summary>
|
||||
public string previousId { get; set; }
|
||||
}
|
||||
}
|
||||
86
OpenAuth.App/Extention/WF_RuntimeModel.cs
Normal file
86
OpenAuth.App/Extention/WF_RuntimeModel.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenAuth.App.Extention
|
||||
{
|
||||
/// <summary>
|
||||
/// 版 本 6.1
|
||||
/// Copyright (c) 2013-2016 上海力软信息技术有限公司
|
||||
/// 创建人:陈彬彬
|
||||
/// 日 期:2016.03.04 16:58
|
||||
/// 描 述:工作流流程流转模型类
|
||||
/// </summary>
|
||||
public class WF_RuntimeModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 运行实例的Id
|
||||
/// </summary>
|
||||
public string processId { get; set; }
|
||||
/// <summary>
|
||||
/// 开始节点的ID
|
||||
/// </summary>
|
||||
public string startNodeId { get; set; }
|
||||
/// <summary>
|
||||
/// 开始节点的对象
|
||||
/// </summary>
|
||||
public dynamic startNode { get { return this.nodeDictionary[this.startNodeId]; } }
|
||||
/// <summary>
|
||||
/// 当前节点的ID
|
||||
/// </summary>
|
||||
public string currentNodeId { get; set; }
|
||||
/// <summary>
|
||||
/// 当前节点类型 0会签开始,1会签结束,2一般节点,开始节点,4流程运行结束
|
||||
/// </summary>
|
||||
public int currentNodeType { get; set; }
|
||||
/// <summary>
|
||||
/// 当前节点的对象
|
||||
/// </summary>
|
||||
public dynamic currentNode { get { return this.nodeDictionary[this.currentNodeId]; } }
|
||||
/// <summary>
|
||||
/// 下一个节点
|
||||
/// </summary>
|
||||
public string nextNodeId { get; set; }
|
||||
/// <summary>
|
||||
/// 下一个节点类型
|
||||
/// </summary>
|
||||
public int nextNodeType { get; set; }
|
||||
/// <summary>
|
||||
/// 下一个节点对象
|
||||
/// </summary>
|
||||
public dynamic nextNode { get { return this.nodeDictionary[this.nextNodeId]; } }
|
||||
|
||||
/// <summary>
|
||||
/// 上一个节点
|
||||
/// </summary>
|
||||
public string previousId { get; set; }
|
||||
/// <summary>
|
||||
/// 上一个节点
|
||||
/// </summary>
|
||||
public dynamic previousNode { get { return this.nodeDictionary[this.previousId]; } }
|
||||
/// <summary>
|
||||
/// 实例节点集合
|
||||
/// </summary>
|
||||
public Dictionary<string, dynamic> nodeDictionary { get; set; }
|
||||
/// <summary>
|
||||
/// 流转的线段集合
|
||||
/// </summary>
|
||||
public Dictionary<string, List<dynamic>> lineDictionary { get; set; }
|
||||
/// <summary>
|
||||
/// (建表的表单需要插入的数据表的语句)
|
||||
/// </summary>
|
||||
public string sqlFrm { get; set; }
|
||||
/// <summary>
|
||||
/// 模板json数据
|
||||
/// </summary>
|
||||
public dynamic schemeContentJson { get; set; }
|
||||
/// <summary>
|
||||
/// 表单数据
|
||||
/// </summary>
|
||||
public string frmData { get; set; }
|
||||
/// <summary>
|
||||
/// 表单类型(0自定义表单,1系统表单)
|
||||
/// </summary>
|
||||
public int frmType { get; set; }
|
||||
}
|
||||
|
||||
public delegate string GetFrmData(string DataBaseId, string tableName, string tableFiled, string processId);
|
||||
}
|
||||
@@ -83,6 +83,12 @@
|
||||
<Compile Include="ApplyTransitionHistoryApp.cs" />
|
||||
<Compile Include="CategoryManagerApp.cs" />
|
||||
<Compile Include="AuthorizeApp.cs" />
|
||||
<Compile Include="Extention\IWF_Runtime.cs" />
|
||||
<Compile Include="Extention\WF_Runtime.cs" />
|
||||
<Compile Include="Extention\WF_RuntimeInitModel.cs" />
|
||||
<Compile Include="Extention\WF_RuntimeModel.cs" />
|
||||
<Compile Include="WFProcessInstanceService.cs" />
|
||||
<Compile Include="WFRuntimeService.cs" />
|
||||
<Compile Include="WorkflowInboxApp.cs" />
|
||||
<Compile Include="ModuleElementManagerApp.cs" />
|
||||
<Compile Include="ModuleManagerApp.cs" />
|
||||
@@ -98,7 +104,6 @@
|
||||
<Compile Include="SSO\LoginResult.cs" />
|
||||
<Compile Include="SSO\SSOAuthAttribute.cs" />
|
||||
<Compile Include="SSO\UserAuthSession.cs" />
|
||||
<Compile Include="CommonApplyApp.cs" />
|
||||
<Compile Include="StockManagerApp.cs" />
|
||||
<Compile Include="UserManagerApp.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.App.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class CommonApplyVM :Entity
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string State { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string StateName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid UserId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid? ControllerUserId { get; set; }
|
||||
|
||||
public string WorkflowName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可用命令
|
||||
/// </summary>
|
||||
public CommandModel[] Commands { get; set; }
|
||||
|
||||
public Dictionary<string, string> AvailiableStates { get; set; }
|
||||
|
||||
public static implicit operator CommonApplyVM(CommonApply obj)
|
||||
{
|
||||
return obj.MapTo<CommonApplyVM>();
|
||||
}
|
||||
|
||||
public static implicit operator CommonApply(CommonApplyVM obj)
|
||||
{
|
||||
return obj.MapTo<CommonApply>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
358
OpenAuth.App/WFProcessInstanceService.cs
Normal file
358
OpenAuth.App/WFProcessInstanceService.cs
Normal file
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenAuth.App.Extention;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 工作流实例表操作
|
||||
/// <para>李玉宝新增于2017-01-16 20:33:48</para>
|
||||
/// </summary>
|
||||
public class WFProcessInstanceService
|
||||
{
|
||||
protected IUnitWork _unitWork;
|
||||
|
||||
public WFProcessInstanceService(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#region 获取数据
|
||||
/// <summary>
|
||||
/// 获取实例进程信息实体
|
||||
/// </summary>
|
||||
/// <param name="keyVlaue"></param>
|
||||
/// <returns></returns>
|
||||
public WFProcessInstance GetEntity(Guid keyVlaue)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _unitWork.FindSingle<WFProcessInstance>(u =>u.Id == keyVlaue);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 提交数据
|
||||
/// <summary>
|
||||
/// 存储工作流实例进程(编辑草稿用)
|
||||
/// </summary>
|
||||
/// <param name="processInstanceEntity"></param>
|
||||
/// <param name="processSchemeEntity"></param>
|
||||
/// <param name="wfOperationHistoryEntity"></param>
|
||||
/// <returns></returns>
|
||||
public int SaveProcess(Guid processId, WFProcessInstance processInstanceEntity, WFProcessScheme processSchemeEntity, WFProcessOperationHistory wfOperationHistoryEntity = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Guid.Empty ==(processInstanceEntity.Id))
|
||||
{
|
||||
_unitWork.Add(processSchemeEntity);
|
||||
|
||||
processInstanceEntity.Create();
|
||||
processInstanceEntity.Id = processId;
|
||||
processInstanceEntity.ProcessSchemeId = processSchemeEntity.Id;
|
||||
_unitWork.Add(processInstanceEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
processInstanceEntity.Modify(processId);
|
||||
_unitWork.Update(processInstanceEntity);
|
||||
|
||||
processSchemeEntity.Modify(processInstanceEntity.ProcessSchemeId);
|
||||
_unitWork.Update(processSchemeEntity);
|
||||
}
|
||||
if (wfOperationHistoryEntity != null)
|
||||
{
|
||||
wfOperationHistoryEntity.ProcessId = processId;
|
||||
_unitWork.Add(wfOperationHistoryEntity);
|
||||
}
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 存储工作流实例进程(创建实例进程)
|
||||
/// </summary>
|
||||
/// <param name="wfRuntimeModel"></param>
|
||||
/// <param name="processInstanceEntity"></param>
|
||||
/// <param name="processSchemeEntity"></param>
|
||||
/// <param name="processOperationHistoryEntity"></param>
|
||||
/// <param name="delegateRecordEntity"></param>
|
||||
/// <returns></returns>
|
||||
public int SaveProcess(WF_RuntimeModel wfRuntimeModel, WFProcessInstance processInstanceEntity, WFProcessScheme processSchemeEntity, WFProcessOperationHistory processOperationHistoryEntity, WFProcessTransitionHistory processTransitionHistoryEntity)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Guid.Empty == (processInstanceEntity.Id))
|
||||
{
|
||||
processSchemeEntity.Create();
|
||||
_unitWork.Add(processSchemeEntity);
|
||||
|
||||
processInstanceEntity.Create();
|
||||
processInstanceEntity.Id = Guid.Parse(wfRuntimeModel.processId);
|
||||
processInstanceEntity.ProcessSchemeId = processSchemeEntity.Id;
|
||||
_unitWork.Add(processInstanceEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
processInstanceEntity.Modify(processInstanceEntity.Id);
|
||||
_unitWork.Update(processSchemeEntity);
|
||||
_unitWork.Update(processInstanceEntity);
|
||||
}
|
||||
processOperationHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processOperationHistoryEntity);
|
||||
|
||||
if (processTransitionHistoryEntity != null)
|
||||
{
|
||||
processTransitionHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processTransitionHistoryEntity);
|
||||
}
|
||||
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 存储工作流实例进程(审核驳回重新提交)
|
||||
/// </summary>
|
||||
/// <param name="processInstanceEntity"></param>
|
||||
/// <param name="processSchemeEntity"></param>
|
||||
/// <param name="processOperationHistoryEntity"></param>
|
||||
/// <param name="processTransitionHistoryEntity"></param>
|
||||
/// <returns></returns>
|
||||
public int SaveProcess(WFProcessInstance processInstanceEntity, WFProcessScheme processSchemeEntity,
|
||||
WFProcessOperationHistory processOperationHistoryEntity, WFProcessTransitionHistory processTransitionHistoryEntity = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
processInstanceEntity.Modify(processInstanceEntity.Id);
|
||||
_unitWork.Update(processSchemeEntity);
|
||||
_unitWork.Update(processInstanceEntity);
|
||||
|
||||
processOperationHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processOperationHistoryEntity);
|
||||
|
||||
if (processTransitionHistoryEntity != null)
|
||||
{
|
||||
processTransitionHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processTransitionHistoryEntity);
|
||||
}
|
||||
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新流程实例 审核节点用
|
||||
/// </summary>
|
||||
/// <param name="sql"></param>
|
||||
/// <param name="dbbaseId"></param>
|
||||
/// <param name="processInstanceEntity"></param>
|
||||
/// <param name="processSchemeEntity"></param>
|
||||
/// <param name="processOperationHistoryEntity"></param>
|
||||
/// <param name="delegateRecordEntityList"></param>
|
||||
/// <param name="processTransitionHistoryEntity"></param>
|
||||
/// <returns></returns>
|
||||
public int SaveProcess(string sql,string dbbaseId, WFProcessInstance processInstanceEntity, WFProcessScheme processSchemeEntity, WFProcessOperationHistory processOperationHistoryEntity, WFProcessTransitionHistory processTransitionHistoryEntity = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
processInstanceEntity.Modify(processInstanceEntity.Id);
|
||||
_unitWork.Update(processSchemeEntity);
|
||||
_unitWork.Update(processInstanceEntity);
|
||||
|
||||
processOperationHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processOperationHistoryEntity);
|
||||
|
||||
if (processTransitionHistoryEntity != null)
|
||||
{
|
||||
processTransitionHistoryEntity.ProcessId = processInstanceEntity.Id;
|
||||
_unitWork.Add(processTransitionHistoryEntity);
|
||||
}
|
||||
|
||||
//if (!string.IsNullOrEmpty(dbbaseId) && !string.IsNullOrEmpty(sql))//测试环境不允许执行sql语句
|
||||
//{
|
||||
// DataBaseLinkEntity dataBaseLinkEntity = dataBaseLinkService.GetEntity(dbbaseId);//获取
|
||||
// this.BaseRepository(dataBaseLinkEntity.DbConnection).ExecuteBySql(sql.Replace("{0}", processInstanceEntity.Id));
|
||||
//}
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存工作流进程实例
|
||||
/// </summary>
|
||||
/// <param name="processInstanceEntity"></param>
|
||||
/// <returns></returns>
|
||||
public int SaveProcess(WFProcessInstance processInstanceEntity)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance isExistEntity = _unitWork.FindSingle<WFProcessInstance>(u =>u.Id ==processInstanceEntity.Id);
|
||||
if (isExistEntity == null)
|
||||
{
|
||||
processInstanceEntity.Create();
|
||||
_unitWork.Add(processInstanceEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
processInstanceEntity.Modify(processInstanceEntity.Id);
|
||||
_unitWork.Update(processInstanceEntity);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除工作流实例进程(删除草稿使用)
|
||||
/// </summary>
|
||||
/// <param name="keyValue">主键</param>
|
||||
/// <returns></returns>
|
||||
public int DeleteProcess(Guid keyValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance entity = _unitWork.FindSingle<WFProcessInstance>(u =>u.Id ==keyValue);
|
||||
|
||||
_unitWork.Delete<WFProcessInstance>(u =>u.Id == keyValue);
|
||||
_unitWork.Delete<WFProcessScheme>(u =>u.Id == entity.ProcessSchemeId);
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 虚拟操作实例
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <param name="state">0暂停,1启用,2取消(召回)</param>
|
||||
/// <returns></returns>
|
||||
public int OperateVirtualProcess(Guid keyValue,int state)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance entity = _unitWork.FindSingle<WFProcessInstance>(u =>u.Id ==keyValue);
|
||||
if (entity.IsFinish == 1)
|
||||
{
|
||||
throw new Exception("实例已经审核完成,操作失败");
|
||||
}
|
||||
else if (entity.IsFinish == 2)
|
||||
{
|
||||
throw new Exception("实例已经取消,操作失败");
|
||||
}
|
||||
/// 流程是否完成(0运行中,1运行结束,2被召回,3不同意,4表示被驳回)
|
||||
string content = "";
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
if (entity.EnabledMark == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
entity.EnabledMark = 0;
|
||||
content = "【暂停】暂停了一个流程进程【" + entity.Code + "/" + entity.CustomName + "】";
|
||||
break;
|
||||
case 1:
|
||||
if (entity.EnabledMark == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
entity.EnabledMark = 1;
|
||||
content = "【启用】启用了一个流程进程【" + entity.Code + "/" + entity.CustomName + "】";
|
||||
break;
|
||||
case 2:
|
||||
entity.IsFinish = 2;
|
||||
content = "【召回】召回了一个流程进程【" + entity.Code + "/" + entity.CustomName + "】";
|
||||
break;
|
||||
}
|
||||
_unitWork.Update(entity);
|
||||
WFProcessOperationHistory processOperationHistoryEntity = new WFProcessOperationHistory();
|
||||
processOperationHistoryEntity.ProcessId = entity.Id;
|
||||
processOperationHistoryEntity.Content = content;
|
||||
_unitWork.Add(processOperationHistoryEntity);
|
||||
_unitWork.Save();
|
||||
return 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程指派
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="makeLists"></param>
|
||||
public void DesignateProcess(Guid processId, string makeLists)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance entity = new WFProcessInstance();
|
||||
entity.Id = processId;
|
||||
entity.MakerList = makeLists;
|
||||
_unitWork.Update(entity);
|
||||
}
|
||||
catch {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public GridData Load(string userid, string type, int pageCurrent, int pageSize)
|
||||
{
|
||||
var result = new GridData
|
||||
{
|
||||
page = pageCurrent
|
||||
};
|
||||
|
||||
if (type == "inbox") //待办事项
|
||||
{
|
||||
result.total = _unitWork.Find<WFProcessInstance>(u => u.CreateUserId == userid).Count();
|
||||
result.rows = _unitWork.Find<WFProcessInstance>(pageCurrent, pageSize, "CreateDate descending", null).ToList();
|
||||
|
||||
}
|
||||
else if (type == "outbox") //已办事项
|
||||
{
|
||||
result.total = _unitWork.Find<WFProcessInstance>(u => u.CreateUserId == userid).Count();
|
||||
result.rows = _unitWork.Find<WFProcessInstance>(pageCurrent, pageSize, "CreateDate descending", null).ToList();
|
||||
|
||||
}
|
||||
else //我的流程
|
||||
{
|
||||
result.total = _unitWork.Find<WFProcessInstance>(u => u.CreateUserId == userid).Count();
|
||||
result.rows = _unitWork.Find<WFProcessInstance>(pageCurrent, pageSize, "CreateDate descending", null).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
966
OpenAuth.App/WFRuntimeService.cs
Normal file
966
OpenAuth.App/WFRuntimeService.cs
Normal file
@@ -0,0 +1,966 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App.Extention;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 流程运行
|
||||
/// <para>李玉宝新增于2017-01-17 9:02:02</para>
|
||||
/// </summary>
|
||||
public class WFRuntimeService
|
||||
{
|
||||
private IUnitWork _unitWork;
|
||||
private WFProcessInstanceService wfProcessInstanceService;
|
||||
|
||||
public WFRuntimeService(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
private string delegateUserList = "";
|
||||
|
||||
#region 流程处理API
|
||||
/// <summary>
|
||||
/// 创建一个实例
|
||||
/// </summary>
|
||||
/// <param name="processId">进程GUID</param>
|
||||
/// <param name="schemeInfoId">模板信息ID</param>
|
||||
/// <param name="wfLevel"></param>
|
||||
/// <param name="code">进程编号</param>
|
||||
/// <param name="customName">自定义名称</param>
|
||||
/// <param name="description">备注</param>
|
||||
/// <param name="frmData">表单数据信息</param>
|
||||
/// <returns></returns>
|
||||
public bool CreateInstance(Guid processId, Guid schemeInfoId, WFProcessInstance WFProcessInstance, string frmData = null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
WFSchemeInfo WFSchemeInfo = _unitWork.FindSingle<WFSchemeInfo>(u =>u.Id == schemeInfoId);
|
||||
WFSchemeContent WFSchemeContent = _unitWork.FindSingle<WFSchemeContent>(u =>
|
||||
u.SchemeInfoId==schemeInfoId && u.SchemeVersion ==WFSchemeInfo.SchemeVersion);
|
||||
|
||||
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
||||
{
|
||||
schemeContent = WFSchemeContent.SchemeContent,
|
||||
currentNodeId = "",
|
||||
frmData = frmData,
|
||||
processId = processId
|
||||
};
|
||||
IWF_Runtime wfruntime = null;
|
||||
|
||||
if(frmData == null)
|
||||
{
|
||||
throw new Exception("自定义表单需要提交表单数据");
|
||||
}
|
||||
else
|
||||
{
|
||||
wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
||||
}
|
||||
|
||||
|
||||
#region 实例信息
|
||||
WFProcessInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
||||
WFProcessInstance.ActivityType = wfruntime.GetStatus();//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
WFProcessInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
||||
WFProcessInstance.PreviousId = wfruntime.runtimeModel.currentNodeId;
|
||||
WFProcessInstance.SchemeType = WFSchemeInfo.SchemeType;
|
||||
WFProcessInstance.FrmType = WFSchemeInfo.FrmType;
|
||||
WFProcessInstance.EnabledMark = 1;//正式运行
|
||||
WFProcessInstance.MakerList =(wfruntime.GetStatus() != 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息
|
||||
WFProcessInstance.IsFinish = (wfruntime.GetStatus() == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
#region 实例模板
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = WFSchemeContent.SchemeContent,
|
||||
frmData = frmData
|
||||
};
|
||||
WFProcessScheme WFProcessScheme = new WFProcessScheme {
|
||||
SchemeInfoId = schemeInfoId,
|
||||
SchemeVersion = WFSchemeInfo.SchemeVersion,
|
||||
ProcessType = 1,//1正式,0草稿
|
||||
SchemeContent = data.ToJson().ToString()
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region 流程操作记录
|
||||
WFProcessOperationHistory processOperationHistoryEntity = new WFProcessOperationHistory();
|
||||
processOperationHistoryEntity.Content = "【创建】" + "todo"+ "创建了一个流程进程【" + WFProcessInstance.Code + "/" + WFProcessInstance.CustomName + "】";
|
||||
#endregion
|
||||
|
||||
#region 流转记录
|
||||
WFProcessTransitionHistory processTransitionHistoryEntity = new WFProcessTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name.Value;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate =0;
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
#region 委托记录
|
||||
//List<WFDelegateRecord> delegateRecordEntitylist = GetDelegateRecordList(schemeInfoId, WFProcessInstance.Code, WFProcessInstance.CustomName, WFProcessInstance.MakerList);
|
||||
//WFProcessInstance.MakerList += delegateUserList;
|
||||
#endregion
|
||||
|
||||
wfProcessInstanceService.SaveProcess(wfruntime.runtimeModel, WFProcessInstance, WFProcessScheme, processOperationHistoryEntity, processTransitionHistoryEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建一个实例(草稿创建)
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="customName"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="frmData"></param>
|
||||
/// <returns></returns>
|
||||
public bool CreateInstance(WFProcessInstance WFProcessInstance, string frmData = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance _WFProcessInstance = wfProcessInstanceService.GetEntity(WFProcessInstance.Id);
|
||||
WFProcessScheme WFProcessScheme = _unitWork.FindSingle<WFProcessScheme>(u =>u.Id ==WFProcessInstance.ProcessSchemeId);
|
||||
dynamic schemeContentJson = WFProcessScheme.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
||||
{
|
||||
schemeContent = schemeContentJson.SchemeContent.Value,
|
||||
currentNodeId = "",
|
||||
frmData = frmData,
|
||||
processId = WFProcessScheme.Id
|
||||
};
|
||||
IWF_Runtime wfruntime = null;
|
||||
|
||||
if (frmData == null)
|
||||
{
|
||||
throw new Exception("自定义表单需要提交表单数据");
|
||||
}
|
||||
else
|
||||
{
|
||||
wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
||||
}
|
||||
|
||||
|
||||
#region 实例信息
|
||||
WFProcessInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
||||
WFProcessInstance.ActivityType = wfruntime.GetStatus();//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
WFProcessInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
||||
WFProcessInstance.PreviousId = wfruntime.runtimeModel.currentNodeId;
|
||||
WFProcessInstance.EnabledMark = 1;//正式运行
|
||||
WFProcessInstance.MakerList = (wfruntime.GetStatus() != 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息
|
||||
WFProcessInstance.IsFinish = (wfruntime.GetStatus() == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
#region 实例模板
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = schemeContentJson.SchemeContent.Value,
|
||||
frmData = frmData
|
||||
};
|
||||
WFProcessScheme.ProcessType = 1;//1正式,0草稿
|
||||
WFProcessScheme.SchemeContent = data.ToJson().ToString();
|
||||
#endregion
|
||||
|
||||
#region 流程操作记录
|
||||
WFProcessOperationHistory processOperationHistoryEntity = new WFProcessOperationHistory();
|
||||
processOperationHistoryEntity.Content = "【创建】" + "todo name" + "创建了一个流程进程【" + WFProcessInstance.Code + "/" + WFProcessInstance.CustomName + "】";
|
||||
#endregion
|
||||
|
||||
#region 流转记录
|
||||
WFProcessTransitionHistory processTransitionHistoryEntity = new WFProcessTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name.Value;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate = 0;
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
#region 委托记录
|
||||
//List<WFDelegateRecord> delegateRecordEntitylist = GetDelegateRecordList(WFProcessScheme.SchemeInfoId, WFProcessInstance.Code, WFProcessInstance.CustomName, WFProcessInstance.MakerList);
|
||||
//WFProcessInstance.MakerList += delegateUserList;
|
||||
#endregion
|
||||
|
||||
wfProcessInstanceService.SaveProcess(wfruntime.runtimeModel, WFProcessInstance, WFProcessScheme, processOperationHistoryEntity, processTransitionHistoryEntity);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑表单再次提交(驳回后处理)
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="frmData"></param>
|
||||
/// <returns></returns>
|
||||
public bool EditionInstance(Guid processId, string description, string frmData = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance WFProcessInstance = wfProcessInstanceService.GetEntity(processId);
|
||||
WFProcessScheme WFProcessScheme = _unitWork.FindSingle< WFProcessScheme>(u =>u.Id ==WFProcessInstance.ProcessSchemeId);
|
||||
dynamic schemeContentJson = WFProcessScheme.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = schemeContentJson.SchemeContent.Value,
|
||||
frmData = frmData
|
||||
};
|
||||
WFProcessScheme.SchemeContent = data.ToJson().ToString();
|
||||
|
||||
WFProcessInstance.IsFinish = 0;
|
||||
if (string.IsNullOrEmpty(description))
|
||||
{
|
||||
WFProcessInstance.Description = description;
|
||||
}
|
||||
WFProcessInstance.CreateDate = DateTime.Now;
|
||||
|
||||
#region 流程操作记录
|
||||
WFProcessOperationHistory processOperationHistoryEntity = new WFProcessOperationHistory();
|
||||
processOperationHistoryEntity.Content = "【创建】" + "todo name" + "创建了一个流程进程【" + WFProcessInstance.Code + "/" + WFProcessInstance.CustomName + "】";
|
||||
#endregion
|
||||
|
||||
#region 委托记录
|
||||
//List<WFDelegateRecord> delegateRecordEntitylist = GetDelegateRecordList(WFProcessScheme.SchemeInfoId, WFProcessInstance.Code, WFProcessInstance.CustomName, WFProcessInstance.MakerList);
|
||||
//WFProcessInstance.MakerList += delegateUserList;
|
||||
#endregion
|
||||
|
||||
wfProcessInstanceService.SaveProcess(WFProcessInstance, WFProcessScheme, processOperationHistoryEntity);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建一个草稿
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="schemeInfoId"></param>
|
||||
/// <param name="wfLevel"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="customName"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <param name="frmData"></param>
|
||||
/// <returns></returns>
|
||||
public bool CreateRoughdraft(Guid processId, Guid schemeInfoId, WFProcessInstance WFProcessInstance, string frmData = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFSchemeInfo WFSchemeInfo = _unitWork.FindSingle<WFSchemeInfo>(u =>u.Id ==schemeInfoId);
|
||||
WFSchemeContent WFSchemeContent = _unitWork.FindSingle<WFSchemeContent>(u =>u.SchemeInfoId ==schemeInfoId
|
||||
&& u.SchemeVersion ==WFSchemeInfo.SchemeVersion);
|
||||
|
||||
WFProcessInstance.ActivityId = "";
|
||||
WFProcessInstance.ActivityName = "";
|
||||
WFProcessInstance.ActivityType = 0;//开始节点
|
||||
WFProcessInstance.IsFinish = 0;
|
||||
WFProcessInstance.SchemeType = WFSchemeInfo.SchemeType;
|
||||
WFProcessInstance.EnabledMark = 3;//草稿
|
||||
WFProcessInstance.CreateDate = DateTime.Now;
|
||||
WFProcessInstance.FrmType = WFSchemeInfo.FrmType;
|
||||
|
||||
WFProcessScheme WFProcessScheme = new WFProcessScheme();
|
||||
WFProcessScheme.SchemeInfoId = schemeInfoId;
|
||||
WFProcessScheme.SchemeVersion = WFSchemeInfo.SchemeVersion;
|
||||
WFProcessScheme.ProcessType = WFProcessInstance.EnabledMark;
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = WFSchemeContent.SchemeContent,
|
||||
frmData = frmData
|
||||
};
|
||||
WFProcessScheme.SchemeContent = data.ToJson();
|
||||
|
||||
wfProcessInstanceService.SaveProcess(processId,WFProcessInstance, WFProcessScheme);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建一个草稿
|
||||
/// </summary>
|
||||
/// <param name="WFProcessInstance"></param>
|
||||
/// <param name="frmData"></param>
|
||||
/// <returns></returns>
|
||||
public bool EditionRoughdraft(WFProcessInstance WFProcessInstance, string frmData = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessScheme WFProcessScheme = _unitWork.FindSingle<WFProcessScheme>(u =>u.Id ==WFProcessInstance.ProcessSchemeId);
|
||||
dynamic schemeContentJson = WFProcessScheme.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = schemeContentJson.SchemeContent.Value,
|
||||
frmData = frmData
|
||||
};
|
||||
WFProcessScheme.SchemeContent = data.ToJson().ToString();
|
||||
WFProcessInstance.IsFinish = 0;
|
||||
WFProcessInstance.CreateDate = DateTime.Now;
|
||||
wfProcessInstanceService.SaveProcess(WFProcessInstance.Id,WFProcessInstance, WFProcessScheme);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 节点审核
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <returns></returns>
|
||||
public bool NodeVerification(Guid processId, bool flag, string description = "")
|
||||
{
|
||||
bool _res = false;
|
||||
try
|
||||
{
|
||||
string _sqlstr="", _dbbaseId="";
|
||||
WFProcessInstance WFProcessInstance = wfProcessInstanceService.GetEntity(processId);
|
||||
WFProcessScheme WFProcessScheme = _unitWork.FindSingle<WFProcessScheme>(u =>u.Id ==WFProcessInstance.ProcessSchemeId);
|
||||
WFProcessOperationHistory WFProcessOperationHistory = new WFProcessOperationHistory();//操作记录
|
||||
WFProcessTransitionHistory processTransitionHistoryEntity = null;//流转记录
|
||||
|
||||
dynamic schemeContentJson = WFProcessScheme.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
||||
{
|
||||
schemeContent = schemeContentJson.SchemeContent.Value,
|
||||
currentNodeId = WFProcessInstance.ActivityId,
|
||||
frmData = schemeContentJson.frmData.Value,
|
||||
previousId = WFProcessInstance.PreviousId,
|
||||
processId = processId
|
||||
};
|
||||
IWF_Runtime wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
||||
|
||||
|
||||
#region 会签
|
||||
if (WFProcessInstance.ActivityType == 0)//会签
|
||||
{
|
||||
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1,"");//标记当前节点通过
|
||||
///寻找需要审核的节点Id
|
||||
string _VerificationNodeId = "";
|
||||
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
|
||||
string _makerList = "";
|
||||
foreach (string item in _nodelist)
|
||||
{
|
||||
_makerList = GetMakerList(wfruntime.runtimeModel.nodeDictionary[item], wfruntime.runtimeModel.processId);
|
||||
if (_makerList != "-1")
|
||||
{
|
||||
foreach (string one in _makerList.Split(','))
|
||||
{
|
||||
if (AuthUtil.GetUserName() == one || AuthUtil.GetUserName().IndexOf(one) != -1)
|
||||
{
|
||||
_VerificationNodeId = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_VerificationNodeId != "")
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
WFProcessOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodeDictionary[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
|
||||
}
|
||||
else
|
||||
{
|
||||
WFProcessOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.nodeDictionary[_VerificationNodeId].name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
|
||||
}
|
||||
|
||||
string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetUserName(), description);
|
||||
var _data = new {
|
||||
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
||||
frmData = (WFProcessInstance.FrmType == 0?wfruntime.runtimeModel.frmData:null)
|
||||
};
|
||||
WFProcessScheme.SchemeContent = _data.ToJson().ToString();
|
||||
switch (_Confluenceres)
|
||||
{
|
||||
case "-1"://不通过
|
||||
WFProcessInstance.IsFinish = 3;
|
||||
break;
|
||||
case "1"://等待
|
||||
break;
|
||||
default://通过
|
||||
WFProcessInstance.PreviousId = WFProcessInstance.ActivityId;
|
||||
WFProcessInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
||||
WFProcessInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
WFProcessInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
||||
WFProcessInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
|
||||
WFProcessInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息
|
||||
|
||||
#region 流转记录
|
||||
processTransitionHistoryEntity = new WFProcessTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name.Value;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate = 0;
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
if (wfruntime.runtimeModel.currentNode.setInfo != null && wfruntime.runtimeModel.currentNode.setInfo.NodeSQL != null)
|
||||
{
|
||||
_sqlstr = wfruntime.runtimeModel.currentNode.setInfo.NodeSQL.Value;
|
||||
_dbbaseId = wfruntime.runtimeModel.currentNode.setInfo.NodeDataBaseToSQL.Value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw(new Exception("审核异常,找不到审核节点"));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 一般审核
|
||||
else//一般审核
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, AuthUtil.GetUserName(), description);
|
||||
WFProcessInstance.PreviousId = WFProcessInstance.ActivityId;
|
||||
WFProcessInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
||||
WFProcessInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
WFProcessInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
||||
WFProcessInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? GetMakerList(wfruntime) : "");//当前节点可执行的人信息
|
||||
WFProcessInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
|
||||
#region 流转记录
|
||||
processTransitionHistoryEntity = new WFProcessTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name.Value;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate = 0;
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
if (wfruntime.runtimeModel.currentNode.setInfo != null && wfruntime.runtimeModel.currentNode.setInfo.NodeSQL != null)
|
||||
{
|
||||
_sqlstr = wfruntime.runtimeModel.currentNode.setInfo.NodeSQL.Value;
|
||||
_dbbaseId = wfruntime.runtimeModel.currentNode.setInfo.NodeDataBaseToSQL.Value;
|
||||
}
|
||||
|
||||
WFProcessOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】同意,备注:" + description;
|
||||
}
|
||||
else
|
||||
{
|
||||
WFProcessInstance.IsFinish = 3; //表示该节点不同意
|
||||
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
|
||||
|
||||
WFProcessOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】不同意,备注:" + description;
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
||||
frmData = (WFProcessInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
|
||||
};
|
||||
WFProcessScheme.SchemeContent = data.ToJson().ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
_res = true;
|
||||
wfProcessInstanceService.SaveProcess(_sqlstr, _dbbaseId,WFProcessInstance, WFProcessScheme, WFProcessOperationHistory, processTransitionHistoryEntity);
|
||||
return _res;
|
||||
}
|
||||
catch {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 驳回
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="description"></param>
|
||||
/// <returns></returns>
|
||||
public bool NodeReject(Guid processId,string nodeId, string description = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
WFProcessInstance WFProcessInstance = wfProcessInstanceService.GetEntity(processId);
|
||||
WFProcessScheme WFProcessScheme = _unitWork.FindSingle<WFProcessScheme>(u =>u.Id ==WFProcessInstance.ProcessSchemeId);
|
||||
WFProcessOperationHistory WFProcessOperationHistory = new WFProcessOperationHistory();
|
||||
WFProcessTransitionHistory processTransitionHistoryEntity = null;
|
||||
dynamic schemeContentJson = WFProcessScheme.SchemeContent.ToJson();//获取工作流模板内容的json对象;
|
||||
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
||||
{
|
||||
schemeContent = schemeContentJson.SchemeContent.Value,
|
||||
currentNodeId = WFProcessInstance.ActivityId,
|
||||
frmData = schemeContentJson.frmData.Value,
|
||||
previousId = WFProcessInstance.PreviousId,
|
||||
processId = processId
|
||||
};
|
||||
IWF_Runtime wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
||||
|
||||
|
||||
string resnode = "";
|
||||
if (nodeId == "")
|
||||
{
|
||||
resnode = wfruntime.RejectNode();
|
||||
}
|
||||
else
|
||||
{
|
||||
resnode = nodeId;
|
||||
}
|
||||
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
|
||||
WFProcessInstance.IsFinish = 4;//4表示驳回(需要申请者重新提交表单)
|
||||
if (resnode != "")
|
||||
{
|
||||
WFProcessInstance.PreviousId = WFProcessInstance.ActivityId;
|
||||
WFProcessInstance.ActivityId = resnode;
|
||||
WFProcessInstance.ActivityType = wfruntime.GetNodeStatus(resnode);//-1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
|
||||
WFProcessInstance.ActivityName = wfruntime.runtimeModel.nodeDictionary[resnode].name;
|
||||
WFProcessInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodeDictionary[resnode], WFProcessInstance.PreviousId);//当前节点可执行的人信息
|
||||
#region 流转记录
|
||||
processTransitionHistoryEntity = new WFProcessTransitionHistory();
|
||||
processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
|
||||
processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name.Value;
|
||||
processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
|
||||
processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
|
||||
processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name.Value;
|
||||
processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
|
||||
processTransitionHistoryEntity.TransitionSate = 1;//
|
||||
processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
|
||||
#endregion
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
||||
frmData = (WFProcessInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
|
||||
};
|
||||
WFProcessScheme.SchemeContent = data.ToJson().ToString();
|
||||
WFProcessOperationHistory.Content = "【" + "todo name" + "】【" + wfruntime.runtimeModel.currentNode.name + "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "】驳回,备注:" + description;
|
||||
|
||||
wfProcessInstanceService.SaveProcess(WFProcessInstance, WFProcessScheme, WFProcessOperationHistory, processTransitionHistoryEntity);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 召回流程进程
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
public void CallingBackProcess(Guid processId)
|
||||
{
|
||||
try
|
||||
{
|
||||
wfProcessInstanceService.OperateVirtualProcess(processId,2);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 终止一个实例(彻底删除)
|
||||
/// </summary>
|
||||
/// <param name="processId"></param>
|
||||
/// <returns></returns>
|
||||
public void KillProcess(Guid processId)
|
||||
{
|
||||
try
|
||||
{
|
||||
_unitWork.Delete<WFProcessInstance>(u =>u.Id == processId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取某个节点(审核人所能看到的提交表单的权限)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public string GetProcessSchemeContentByNodeId(string data, string nodeId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<dynamic> list = new List<dynamic>();
|
||||
dynamic schemeContentJson = data.ToJson();//获取工作流模板内容的json对象;
|
||||
string schemeContent1 = schemeContentJson.SchemeContent.Value;
|
||||
dynamic schemeContentJson1 = schemeContent1.ToJson();
|
||||
string FrmContent = schemeContentJson1.Frm.FrmContent.Value;
|
||||
dynamic FrmContentJson = FrmContent.ToJson();
|
||||
|
||||
foreach (var item in schemeContentJson1.Flow.nodes)
|
||||
{
|
||||
if (item.id.Value == nodeId)
|
||||
{
|
||||
foreach (var item1 in item.setInfo.frmPermissionInfo)
|
||||
{
|
||||
foreach (var item2 in FrmContentJson)
|
||||
{
|
||||
if (item2.control_field.Value == item1.fieldid.Value)
|
||||
{
|
||||
if (item1.look.Value == true)
|
||||
{
|
||||
if (item1.down != null)
|
||||
{
|
||||
item2.down = item1.down.Value;
|
||||
}
|
||||
list.Add(item2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
schemeContentJson1.Frm.FrmContent = list.ToJson().ToString();
|
||||
schemeContentJson.SchemeContent = schemeContentJson1.ToString();
|
||||
return schemeContentJson.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取某个节点(审核人所能看到的提交表单的权限)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public string GetProcessSchemeContentByUserId(string data, string userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<dynamic> list = new List<dynamic>();
|
||||
dynamic schemeContentJson = data.ToJson();//获取工作流模板内容的json对象;
|
||||
string schemeContent1 = schemeContentJson.SchemeContent.Value;
|
||||
dynamic schemeContentJson1 = schemeContent1.ToJson();
|
||||
string FrmContent = schemeContentJson1.Frm.FrmContent.Value;
|
||||
dynamic FrmContentJson = FrmContent.ToJson();
|
||||
|
||||
foreach (var item in schemeContentJson1.Flow.nodes)
|
||||
{
|
||||
if (item.setInfo != null && item.setInfo.UserId != null && item.setInfo.UserId.Value == userId)
|
||||
{
|
||||
foreach (var item1 in item.setInfo.frmPermissionInfo)
|
||||
{
|
||||
foreach (var item2 in FrmContentJson)
|
||||
{
|
||||
if (item2.control_field.Value == item1.fieldid.Value)
|
||||
{
|
||||
if (item1.look.Value == true)
|
||||
{
|
||||
if (item1.down != null)
|
||||
{
|
||||
item2.down = item1.down.Value;
|
||||
}
|
||||
list.Add(item2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
schemeContentJson1.Frm.FrmContent = list.ToJson().ToString();
|
||||
schemeContentJson.SchemeContent = schemeContentJson1.ToString();
|
||||
return schemeContentJson.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 寻找该节点执行人
|
||||
/// </summary>
|
||||
/// <param name="wfruntime"></param>
|
||||
/// <returns></returns>
|
||||
private string GetMakerList(IWF_Runtime wfruntime)
|
||||
{
|
||||
try
|
||||
{
|
||||
string makerList = "";
|
||||
if (wfruntime.runtimeModel.nextNodeId == "-1")
|
||||
{
|
||||
throw (new Exception("无法寻找到下一个节点"));
|
||||
}
|
||||
if (wfruntime.runtimeModel.nextNodeType == 0)//如果是会签节点
|
||||
{
|
||||
List<string> _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.nextNodeId);
|
||||
string _makerList = "";
|
||||
foreach (string item in _nodelist)
|
||||
{
|
||||
_makerList = GetMakerList(wfruntime.runtimeModel.nodeDictionary[item], wfruntime.runtimeModel.processId);
|
||||
if (_makerList == "-1")
|
||||
{
|
||||
throw (new Exception("无法寻找到会签节点的审核者,请查看流程设计是否有问题!"));
|
||||
}
|
||||
else if (_makerList == "1")
|
||||
{
|
||||
throw (new Exception("会签节点的审核者不能为所有人,请查看流程设计是否有问题!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (makerList != "")
|
||||
{
|
||||
makerList += ",";
|
||||
}
|
||||
makerList += _makerList;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.processId);
|
||||
if (makerList == "-1")
|
||||
{
|
||||
throw (new Exception("无法寻找到节点的审核者,请查看流程设计是否有问题!"));
|
||||
}
|
||||
}
|
||||
|
||||
return makerList;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 寻找该节点执行人
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
/// <returns></returns>
|
||||
private string GetMakerList(dynamic node, string processId)
|
||||
{
|
||||
try
|
||||
{
|
||||
string makerlsit = "";
|
||||
|
||||
if (node.setInfo == null)
|
||||
{
|
||||
makerlsit = "-1";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//所有成员
|
||||
{
|
||||
makerlsit = "1";
|
||||
}
|
||||
else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//指定成员
|
||||
{
|
||||
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.role, makerlsit);
|
||||
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.post, makerlsit);
|
||||
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.usergroup, makerlsit);
|
||||
makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.user, makerlsit);
|
||||
|
||||
if (makerlsit == "")
|
||||
{
|
||||
makerlsit = "-1";
|
||||
}
|
||||
}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType3")//发起者领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = userEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType4")//前一步骤领导
|
||||
//{
|
||||
// WFProcessTransitionHistory transitionHistoryEntity = wfProcessTransitionHistoryService.GetEntity(processId, node.id.Value);
|
||||
// UserEntity userEntity = userService.GetEntity(transitionHistoryEntity.CreateUserId);
|
||||
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = userEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType5")//发起者部门领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// DepartmentEntity departmentEntity = departmentService.GetEntity(userEntity.DepartmentId);
|
||||
|
||||
// if (string.IsNullOrEmpty(departmentEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = departmentEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType6")//发起者公司领导
|
||||
//{
|
||||
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
||||
// OrganizeEntity organizeEntity = organizeService.GetEntity(userEntity.OrganizeId);
|
||||
|
||||
// if (string.IsNullOrEmpty(organizeEntity.ManagerId))
|
||||
// {
|
||||
// makerlsit = "-1";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// makerlsit = organizeEntity.ManagerId;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return makerlsit;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 将数组转化成逗号相隔的字串
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="Str"></param>
|
||||
/// <returns></returns>
|
||||
private string ArrwyToString(dynamic data, string Str)
|
||||
{
|
||||
string resStr = Str;
|
||||
foreach (var item in data)
|
||||
{
|
||||
if (resStr != "")
|
||||
{
|
||||
resStr += ",";
|
||||
}
|
||||
resStr += item.Value;
|
||||
}
|
||||
return resStr;
|
||||
}
|
||||
|
||||
public WFProcessScheme GetProcessSchemeEntity(Guid keyValue)
|
||||
{
|
||||
return _unitWork.FindSingle<WFProcessScheme>(u => u.Id == keyValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 已办流程进度查看,根据当前访问人的权限查看表单内容
|
||||
/// <para>李玉宝于2017-01-20 15:35:13</para>
|
||||
/// </summary>
|
||||
/// <param name="keyValue">The key value.</param>
|
||||
/// <returns>WFProcessScheme.</returns>
|
||||
public WFProcessScheme GetProcessSchemeByUserId(Guid keyValue)
|
||||
{
|
||||
var entity = GetProcessSchemeEntity(keyValue);
|
||||
entity.SchemeContent = GetProcessSchemeContentByUserId(entity.SchemeContent, AuthUtil.GetCurrentUser().User.Id.ToString());
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 已办流程进度查看,根据当前节点的权限查看表单内容
|
||||
/// <para>李玉宝于2017-01-20 15:34:35</para>
|
||||
/// </summary>
|
||||
/// <param name="keyValue">The key value.</param>
|
||||
/// <param name="nodeId">The node identifier.</param>
|
||||
/// <returns>WFProcessScheme.</returns>
|
||||
public WFProcessScheme GetProcessSchemeEntityByNodeId(Guid keyValue, string nodeId)
|
||||
{
|
||||
var entity = GetProcessSchemeEntity(keyValue);
|
||||
entity.SchemeContent = GetProcessSchemeContentByNodeId(entity.SchemeContent, nodeId);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public WFProcessInstance GetProcessInstanceEntity(Guid keyValue)
|
||||
{
|
||||
return _unitWork.FindSingle<WFProcessInstance>(u => u.Id == keyValue);
|
||||
}
|
||||
|
||||
public void DeleteProcess(Guid keyValue)
|
||||
{
|
||||
var entity = _unitWork.FindSingle<WFProcessInstance>(u => u.Id == keyValue);
|
||||
_unitWork.Delete<WFProcessScheme>(u =>u.Id == entity.ProcessSchemeId);
|
||||
_unitWork.Delete<WFProcessInstance>(u =>u.Id == keyValue);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核流程
|
||||
/// <para>李玉宝于2017-01-20 15:44:45</para>
|
||||
/// </summary>
|
||||
/// <param name="processId">The process identifier.</param>
|
||||
/// <param name="verificationData">The verification data.</param>
|
||||
public void VerificationProcess(Guid processId, string verificationData)
|
||||
{
|
||||
try
|
||||
{
|
||||
dynamic verificationDataJson = verificationData.ToJson();
|
||||
|
||||
//驳回
|
||||
if (verificationDataJson.VerificationFinally.Value == "3")
|
||||
{
|
||||
string _nodeId = "";
|
||||
if (verificationDataJson.NodeRejectStep != null)
|
||||
{
|
||||
_nodeId = verificationDataJson.NodeRejectStep.Value;
|
||||
}
|
||||
NodeReject(processId, _nodeId, verificationDataJson.VerificationOpinion.Value);
|
||||
}
|
||||
else if (verificationDataJson.VerificationFinally.Value == "2")//表示不同意
|
||||
{
|
||||
NodeVerification(processId, false, verificationDataJson.VerificationOpinion.Value);
|
||||
}
|
||||
else if (verificationDataJson.VerificationFinally.Value == "1")//表示同意
|
||||
{
|
||||
NodeVerification(processId, true, verificationDataJson.VerificationOpinion.Value);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// Author:Yubao Li
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenAuth.Domain
|
||||
{
|
||||
/// <summary>
|
||||
/// 同意申请单
|
||||
/// </summary>
|
||||
public partial class CommonApply : Entity
|
||||
{
|
||||
public CommonApply()
|
||||
{
|
||||
this.Sort= 0;
|
||||
this.Name= string.Empty;
|
||||
this.Comment= string.Empty;
|
||||
this.State= string.Empty;
|
||||
this.StateName= string.Empty;
|
||||
this.ApplyTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime ApplyTime { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string State { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string StateName { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid UserId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public System.Guid? ControllerUserId { get; set; }
|
||||
|
||||
|
||||
public string WorkflowName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace OpenAuth.Domain
|
||||
this.ActivityType= 0;
|
||||
this.ActivityName= string.Empty;
|
||||
this.PreviousId= string.Empty;
|
||||
this.ProcessSchemeId= string.Empty;
|
||||
this.ProcessSchemeId=Guid.Empty;
|
||||
this.SchemeType= string.Empty;
|
||||
this.EnabledMark= 0;
|
||||
this.CreateDate= DateTime.Now;
|
||||
@@ -63,7 +63,7 @@ namespace OpenAuth.Domain
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ProcessSchemeId { get; set; }
|
||||
public Guid ProcessSchemeId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -105,5 +105,22 @@ namespace OpenAuth.Domain
|
||||
/// </summary>
|
||||
public string MakerList { get; set; }
|
||||
|
||||
#region 扩展操作
|
||||
/// <summary>
|
||||
/// 新增调用
|
||||
/// </summary>
|
||||
public void Create()
|
||||
{
|
||||
this.CreateDate = DateTime.Now;
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑调用
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
public void Modify(Guid keyValue)
|
||||
{
|
||||
this.Id = keyValue;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Domain
|
||||
{
|
||||
public WFProcessOperationHistory()
|
||||
{
|
||||
this.ProcessId= string.Empty;
|
||||
this.ProcessId= Guid.Empty;
|
||||
this.Content= string.Empty;
|
||||
this.CreateDate= DateTime.Now;
|
||||
this.CreateUserId= string.Empty;
|
||||
@@ -30,7 +30,7 @@ namespace OpenAuth.Domain
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ProcessId { get; set; }
|
||||
public Guid ProcessId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenAuth.Domain
|
||||
public WFProcessScheme()
|
||||
{
|
||||
this.SchemeContent= string.Empty;
|
||||
this.WFSchemeInfoId= string.Empty;
|
||||
this.SchemeInfoId= Guid.Empty;
|
||||
this.SchemeVersion= string.Empty;
|
||||
this.ProcessType= 0;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace OpenAuth.Domain
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string WFSchemeInfoId { get; set; }
|
||||
public Guid SchemeInfoId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -43,5 +43,23 @@ namespace OpenAuth.Domain
|
||||
/// </summary>
|
||||
public int ProcessType { get; set; }
|
||||
|
||||
|
||||
#region 扩展操作
|
||||
/// <summary>
|
||||
/// 新增调用
|
||||
/// </summary>
|
||||
public void Create()
|
||||
{
|
||||
this.Id = Guid.NewGuid();
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑调用
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
public void Modify(Guid keyValue)
|
||||
{
|
||||
this.Id = keyValue;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Domain
|
||||
{
|
||||
public WFProcessTransitionHistory()
|
||||
{
|
||||
this.ProcessId= string.Empty;
|
||||
this.ProcessId= Guid.Empty;
|
||||
this.FromNodeId= string.Empty;
|
||||
this.FromNodeName= string.Empty;
|
||||
this.ToNodeId= string.Empty;
|
||||
@@ -35,7 +35,7 @@ namespace OpenAuth.Domain
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ProcessId { get; set; }
|
||||
public Guid ProcessId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Domain
|
||||
{
|
||||
public WFSchemeContent()
|
||||
{
|
||||
this.WFSchemeInfoId= string.Empty;
|
||||
this.SchemeInfoId= Guid.Empty;
|
||||
this.SchemeVersion= string.Empty;
|
||||
this.SchemeContent= string.Empty;
|
||||
this.CreateDate= DateTime.Now;
|
||||
@@ -31,7 +31,7 @@ namespace OpenAuth.Domain
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string WFSchemeInfoId { get; set; }
|
||||
public Guid SchemeInfoId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<Compile Include="Service\ResManagerService.cs" />
|
||||
<Compile Include="Service\StockManagerService.cs" />
|
||||
<Compile Include="Service\WFFormService.cs" />
|
||||
<Compile Include="Service\WorkflowService.cs" />
|
||||
<Compile Include="Service\WFSchemeService.cs" />
|
||||
<Compile Include="Core\Stock.cs" />
|
||||
<Compile Include="Core\User.cs" />
|
||||
<Compile Include="Core\WFFrmMain.cs" />
|
||||
|
||||
@@ -5,11 +5,15 @@ using OpenAuth.Domain.Interface;
|
||||
|
||||
namespace OpenAuth.Domain.Service
|
||||
{
|
||||
public class WorkflowService
|
||||
/// <summary>
|
||||
/// 流程设计服务
|
||||
/// <para>李玉宝新增于2017-01-16 16:18:35</para>
|
||||
/// </summary>
|
||||
public class WFSchemeService
|
||||
{
|
||||
protected IUnitWork _unitWork;
|
||||
|
||||
public WorkflowService(IUnitWork unitWork)
|
||||
public WFSchemeService(IUnitWork unitWork)
|
||||
{
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
@@ -29,15 +33,16 @@ namespace OpenAuth.Domain.Service
|
||||
entity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(entity);
|
||||
|
||||
modelentity.WFSchemeInfoId = entity.Id.ToString();
|
||||
modelentity.SchemeInfoId = entity.Id;
|
||||
modelentity.SchemeVersion = entity.SchemeVersion;
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
else
|
||||
{
|
||||
Guid schemeid = Guid.Parse(keyValue);
|
||||
WFSchemeContent modelentityold =
|
||||
_unitWork.FindSingle<WFSchemeContent>(u => u.SchemeVersion == entity.SchemeVersion
|
||||
&& u.WFSchemeInfoId == keyValue);
|
||||
&& u.SchemeInfoId == schemeid);
|
||||
|
||||
if (modelentityold.SchemeContent != modelentity.SchemeContent)
|
||||
{
|
||||
@@ -50,7 +55,7 @@ namespace OpenAuth.Domain.Service
|
||||
}
|
||||
else
|
||||
{
|
||||
modelentity.WFSchemeInfoId = keyValue;
|
||||
modelentity.SchemeInfoId = schemeid;
|
||||
modelentity.SchemeVersion = DateTime.Now.ToString("yyyyMMddHHmmssffff");
|
||||
_unitWork.Add(modelentity);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.Mvc.Controllers;
|
||||
|
||||
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用申请流程处理
|
||||
/// <para>李玉宝新增于2016-09-08 19:21:59</para>
|
||||
/// </summary>
|
||||
public class CommonAppliesController : Controller
|
||||
{
|
||||
private WFProcessInstanceService _app;
|
||||
|
||||
public CommonAppliesController()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<WFProcessInstanceService>();
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string Load(string type, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(AuthUtil.GetCurrentUser().User.Id.ToString(), type, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进度查看
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult ProcessLookForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除申请
|
||||
/// </summary>
|
||||
public string Delete(Guid[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (var id in ids)
|
||||
{
|
||||
_app.DeleteProcess(id);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@ namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
/// </summary>
|
||||
public class FlowDesignController :Controller
|
||||
{
|
||||
private WorkflowService wfFlowInfoBLL;
|
||||
private WFSchemeService wfFlowInfoBLL;
|
||||
private UserManagerApp userBLL;
|
||||
|
||||
public FlowDesignController()
|
||||
{
|
||||
wfFlowInfoBLL = AutofacExt.GetFromFac<WorkflowService>();
|
||||
wfFlowInfoBLL = AutofacExt.GetFromFac<WFSchemeService>();
|
||||
userBLL = AutofacExt.GetFromFac<UserManagerApp>();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc;
|
||||
|
||||
namespace LeaRun.Application.Web.Areas.FlowManage.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 版 本 6.1
|
||||
/// Copyright (c) 2013-2016 上海力软信息技术有限公司
|
||||
/// 创建人:陈彬彬
|
||||
/// 日 期:2016.03.19 14:27
|
||||
/// 描 述:流程发起
|
||||
/// </summary>
|
||||
public class FlowLaunchController : Controller
|
||||
{
|
||||
private WFRuntimeService wfProcessBll;
|
||||
|
||||
public FlowLaunchController()
|
||||
{
|
||||
wfProcessBll = AutofacExt.GetFromFac<WFRuntimeService>();
|
||||
}
|
||||
#region 视图功能
|
||||
//
|
||||
// GET: /FlowManage/FlowLaunch/
|
||||
/// <summary>
|
||||
/// 管理
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 预览
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult PreviewIndex()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建流程实例
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult FlowProcessNewForm()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 提交数据
|
||||
/// <summary>
|
||||
/// 创建流程实例
|
||||
/// </summary>
|
||||
/// <param name="wfSchemeInfoId">流程模板信息Id</param>
|
||||
/// <param name="frmData">表单数据</param>
|
||||
/// <param name="type">0发起,3草稿</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult CreateProcess(Guid wfSchemeInfoId, string wfProcessInstanceJson, string frmData)
|
||||
{
|
||||
WFProcessInstance wfProcessInstanceEntity = wfProcessInstanceJson.ToObject<WFProcessInstance>();
|
||||
string text = "创建成功";
|
||||
if (wfProcessInstanceEntity.EnabledMark == 1)//发起流程
|
||||
{
|
||||
wfProcessBll.CreateInstance(Guid.NewGuid(), wfSchemeInfoId, wfProcessInstanceEntity, frmData);
|
||||
}
|
||||
else if (wfProcessInstanceEntity.EnabledMark == 3)//草稿
|
||||
{
|
||||
wfProcessBll.CreateRoughdraft(Guid.NewGuid(), wfSchemeInfoId, wfProcessInstanceEntity, frmData);
|
||||
text = "草稿保存成功";
|
||||
}
|
||||
|
||||
return Content(text);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
|
||||
namespace OpenAuth.Mvc.Areas.FlowManage.Controllers
|
||||
{
|
||||
|
||||
public class FlowProcessController :Controller
|
||||
{
|
||||
private WFRuntimeService wfProcessBll ;
|
||||
|
||||
public FlowProcessController(WFRuntimeService service)
|
||||
{
|
||||
wfProcessBll = service;
|
||||
}
|
||||
#region 视图功能
|
||||
/// <summary>
|
||||
/// 流程监控
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult MonitoringIndex()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程指派
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult DesignationIndex()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程进度查看
|
||||
/// </summary>
|
||||
/// <returns></returns>\
|
||||
[HttpGet]
|
||||
public ActionResult ProcessLookFrom()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程指派
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult ProcessDesignate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取数据(公用)
|
||||
|
||||
/// <summary>
|
||||
/// 获取进程模板Json
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetProcessSchemeJson(Guid keyValue)
|
||||
{
|
||||
var data = wfProcessBll.GetProcessSchemeEntity(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
/// <summary>
|
||||
/// 已办流程进度查看,根据当前访问人的权限查看表单内容
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetProcessSchemeEntityByUserId(Guid keyValue)
|
||||
{
|
||||
var data = wfProcessBll.GetProcessSchemeByUserId(keyValue);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
/// <summary>
|
||||
/// 已办流程进度查看,根据当前节点的权限查看表单内容
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <param name="isPermission"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetProcessSchemeEntityByNodeId(Guid keyValue, string nodeId)
|
||||
{
|
||||
var data = wfProcessBll.GetProcessSchemeEntityByNodeId(keyValue, nodeId);
|
||||
return Content(data.ToJson());
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取进程信息
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetProcessInfoJson(Guid keyValue)
|
||||
{
|
||||
var processInstance = wfProcessBll.GetProcessInstanceEntity(keyValue);
|
||||
var processScheme = wfProcessBll.GetProcessSchemeEntity(processInstance.ProcessSchemeId);
|
||||
var JsonData = new
|
||||
{
|
||||
processInstance = processInstance,
|
||||
processScheme = processScheme
|
||||
};
|
||||
return Content(JsonData.ToJson());
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取进程实例
|
||||
/// </summary>
|
||||
/// <param name="keyValue"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ActionResult GetProcessInstanceJson(Guid keyValue)
|
||||
{
|
||||
var processInstance = wfProcessBll.GetProcessInstanceEntity(keyValue);
|
||||
return Content(processInstance.ToJson());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 提交数据
|
||||
/// <summary>
|
||||
/// 删除工作流实例进程
|
||||
/// </summary>
|
||||
/// <param name="keyValue">主键值</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteProcess(Guid keyValue)
|
||||
{
|
||||
wfProcessBll.DeleteProcess(keyValue);
|
||||
return Content("删除成功。");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核流程
|
||||
/// </summary>
|
||||
/// <param name="processId">工作流实例主键Id</param>
|
||||
/// <param name="processId">审核数据</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult VerificationProcess(Guid processId, string verificationData)
|
||||
{
|
||||
wfProcessBll.VerificationProcess(processId, verificationData);
|
||||
return Content("审核成功。");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="col-md-9">
|
||||
<div class="widget-box widget-color-blue">
|
||||
<div class="widget-header">
|
||||
@Html.Action("MenuHeader", "Home")
|
||||
@Html.Action("MenuHeader", "Home", new {area=""})
|
||||
</div>
|
||||
<div class="widget-body gridwidth">
|
||||
<div class="widget-main">
|
||||
@@ -0,0 +1,72 @@
|
||||
@{
|
||||
ViewBag.Title = "查看流程进度";
|
||||
Layout = "~/Views/Shared/_FlowForm.cshtml";
|
||||
}
|
||||
<script>
|
||||
var processSchemeId = request('processSchemeId');
|
||||
var ActivityId = request('activityId');
|
||||
$(function () {
|
||||
var schemeContent;
|
||||
$.SetForm({
|
||||
url: "../../FlowManage/FlowProcess/GetProcessSchemeJson",
|
||||
param: { keyValue: processSchemeId },
|
||||
success: function (data) {
|
||||
schemeContent = JSON.parse(JSON.parse(data.SchemeContent).SchemeContent);
|
||||
frmdata = JSON.parse(JSON.parse(data.SchemeContent).frmData);
|
||||
|
||||
$('#frmpreview').frmPreview({
|
||||
tablecotent: schemeContent.Frm.FrmContent,
|
||||
width:1080
|
||||
});
|
||||
$('#FlowPanel').flowdesign({
|
||||
width: $(window).width()+3,
|
||||
height: $(window).height()-42,
|
||||
flowcontent: schemeContent.Flow,
|
||||
haveTool: false,
|
||||
isprocessing: true,
|
||||
activityId: ActivityId,
|
||||
nodeData: schemeContent.Flow.nodes
|
||||
});
|
||||
|
||||
$('#frmpreview').frmSetData(frmdata);
|
||||
$('#frmpreview').find('input,select,textarea,.ui-select').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#FlowPanel" data-toggle="tab">流程信息</a></li>
|
||||
<li><a href="#frmpreview" data-toggle="tab">表单信息</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="FlowPanel" class="tab-pane active">
|
||||
</div>
|
||||
<div id="frmpreview" class="tab-pane app_layout app_preview">
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app_preview {
|
||||
height: 620px;
|
||||
}
|
||||
|
||||
.app_preview .item_field_value {
|
||||
width: 964px;
|
||||
}
|
||||
|
||||
.app_preview .item_row {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.app_layout .item_field_label {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
background: #fff !important;
|
||||
}
|
||||
</style>
|
||||
226
OpenAuth.Mvc/Areas/FlowManage/Views/FlowMyProcess/Index.cshtml
Normal file
226
OpenAuth.Mvc/Areas/FlowManage/Views/FlowMyProcess/Index.cshtml
Normal file
@@ -0,0 +1,226 @@
|
||||
@{
|
||||
ViewBag.Title = "我的流程";
|
||||
Layout = "~/Views/Shared/_Index.cshtml";
|
||||
}
|
||||
<script src="~/Content/scripts/plugins/pagination/jquery.pagination-1.2.7.js"></script>
|
||||
<link href="~/Content/scripts/plugins/pagination/jquery.pagination.css" rel="stylesheet" />
|
||||
<script>
|
||||
var params="";
|
||||
$(function () {
|
||||
InitialPage();
|
||||
GetSchemeType();
|
||||
GetGrid();
|
||||
});
|
||||
//初始化页面
|
||||
function InitialPage() {
|
||||
//resize重设(表格、树形)宽高
|
||||
$(window).resize(function (e) {
|
||||
window.setTimeout(function () {
|
||||
$("#taskblock").height($(window).height() - 131);
|
||||
$("#itemTree").height($(window).height() - 52);
|
||||
}, 200);
|
||||
e.stopPropagation();
|
||||
});
|
||||
}
|
||||
//加载树
|
||||
function GetSchemeType() {
|
||||
$.SetForm({
|
||||
url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
|
||||
param: { EnCode: "FlowSort" },
|
||||
success: function (data) {
|
||||
$.each(data, function (id, item) {
|
||||
var row = '<li><a data-value="' + item.id + '">' + item.text + '</a></li>';
|
||||
$('#SchemeType').find('ul').append(row);
|
||||
});
|
||||
$('#SchemeType').find('li>a').click(function () {
|
||||
var id = $(this).attr('data-value');
|
||||
var text = $(this).html();
|
||||
var queryJson = { SchemeType: id };
|
||||
params = { queryJson: JSON.stringify(queryJson) };
|
||||
$("#girdPager").page('remote', 0, params);
|
||||
$('#SchemeType').find('.dropdown-text').html(text);
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//加载表格
|
||||
function GetGrid() {
|
||||
$("#taskblock").height($(window).height() - 131);
|
||||
|
||||
$("#girdPager").panginationEx({
|
||||
url: "../../FlowManage/FlowProcess/GetRuntimePageListJson",
|
||||
success: function (data) {
|
||||
var $flowlist = $("#flowlist");
|
||||
$flowlist.html("");
|
||||
if (data.length > 0) {
|
||||
$('.no-data').hide();
|
||||
}
|
||||
else {
|
||||
$('.no-data').show();
|
||||
}
|
||||
$.each(data, function (i, item) {
|
||||
var _listhtml = '<li><div style="width: ' + (item.isfinish == 4 ? '239px' : '160px') + '; line-height: 38px;margin-top:11px; float: right;">' + (item.isfinish == 4 ? '<a class="btn btn-warning applicationmodel" style="margin-right:4px;" >重新申请</a>' : '') + '<a class="btn btn-success previewmodel" style="margin-right:4px;">进度查看</a><a class="btn btn-danger deletemodel" >流程召回</a></div>';
|
||||
_listhtml += '<div style="float: left;">';
|
||||
_listhtml += '<span class="item-text">' + item.code + '/' + item.customname + '</span>';
|
||||
_listhtml += '<div><span class=\"label label-success-learun\" data-toggle="tooltip" data-placement="top" title="流程分类" >' + item.schemetypename + '</span>';
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-inverse-learun\" data-toggle="tooltip" data-placement="top" title="当前节点">' + item.activityname + '</span>';
|
||||
if (item.enabledmark == 1) {
|
||||
if (item.isfinish == 3) {
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-danger\" data-toggle="tooltip" data-placement="top" title="状态">不通过</span>';
|
||||
}
|
||||
else if (item.isfinish == 1) {
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-success\" data-toggle="tooltip" data-placement="top" title="状态">通过完成</span>';
|
||||
}
|
||||
else if (item.isfinish == 0) {
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-info\" data-toggle="tooltip" data-placement="top" title="状态" >处理中</span>';
|
||||
}
|
||||
else if (item.isfinish == 4) {
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-warning\" data-toggle="tooltip" data-placement="top" title="状态" >被驳回</span>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-important-learun\" data-toggle="tooltip" data-placement="top" title="状态" >暂停</span>';
|
||||
}
|
||||
|
||||
switch (item.wflevel)
|
||||
{
|
||||
case 1:
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-danger\" data-toggle="tooltip" data-placement="top" title="等级" >重要</span>';
|
||||
break;
|
||||
case 2:
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-success\" data-toggle="tooltip" data-placement="top" title="等级" >普通</span>';
|
||||
break;
|
||||
case 3:
|
||||
_listhtml += '<span style="margin-left:5px;" class=\"label label-warning\" data-toggle="tooltip" data-placement="top" title="等级" >一般</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
_listhtml += '</div><p>By.' + item.createusername + '-' + item.createdate + ' | 备注:' + item.description + '</p>';
|
||||
_listhtml += '</div></li>';
|
||||
var $_listhtml = $(_listhtml);
|
||||
$_listhtml.find('.previewmodel')[0].processInstanceId = item.id;
|
||||
$_listhtml.find('.previewmodel')[0].activityId = item.activityid;
|
||||
$_listhtml.find('.previewmodel')[0].processSchemeId = item.processschemeid;
|
||||
$_listhtml.find('.previewmodel')[0].processname = item.code + '/' + item.customname;
|
||||
|
||||
$_listhtml.find('.deletemodel')[0].processInstanceId = item.id;
|
||||
$_listhtml.find('.deletemodel')[0].processSchemeId = item.processschemeid;
|
||||
|
||||
if ($_listhtml.find('.applicationmodel').length > 0)
|
||||
{
|
||||
$_listhtml.find('.applicationmodel')[0].processInstanceId = item.id;
|
||||
$_listhtml.find('.applicationmodel')[0].activityId = item.activityid;
|
||||
$_listhtml.find('.applicationmodel')[0].processSchemeId = item.processschemeid;
|
||||
$_listhtml.find('.applicationmodel')[0].processname = item.code + '/' + item.customname;
|
||||
}
|
||||
|
||||
$flowlist.append($_listhtml);
|
||||
});
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
//进度查看
|
||||
$('.previewmodel').click(function () {
|
||||
var $_btn = $(this).context;
|
||||
var _processInstanceId = $_btn.processInstanceId;
|
||||
var _processSchemeId = $_btn.processSchemeId;
|
||||
var _processname = $_btn.processname;
|
||||
var _activityId = $_btn.activityId;
|
||||
dialogOpen({
|
||||
id: "ProcessLookForm",
|
||||
title: '进度查看【' + _processname + '】',
|
||||
url: '/FlowManage/FlowMyProcess/ProcessLookForm?processSchemeId=' + _processSchemeId + '&activityId=' + _activityId,
|
||||
width: "1100px",
|
||||
height: "700px",
|
||||
btn:null,
|
||||
callBack: function (iframeId) {
|
||||
}
|
||||
});
|
||||
});
|
||||
//流程召回
|
||||
$('.deletemodel').click(function () {
|
||||
var $_btn = $(this).context;
|
||||
var $this = $(this);
|
||||
var _ProcessInstanceId = $_btn.processInstanceId;
|
||||
if (_ProcessInstanceId) {
|
||||
$.ConfirmAjax({
|
||||
msg: "注:您确定要召回吗?该操作将无法恢复",
|
||||
url: "../../FlowManage/FlowProcess/DeleteVirtualProcess",
|
||||
param: { keyValue: _ProcessInstanceId },
|
||||
success: function (data) {
|
||||
$("#girdPager").page('remote', '', params);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
dialogMsg('请选择需要召回的流程!', 0);
|
||||
}
|
||||
});
|
||||
|
||||
//重新申请
|
||||
$('.applicationmodel').click(function () {
|
||||
var $_btn = $(this).context;
|
||||
var _processInstanceId = $_btn.processInstanceId;
|
||||
var _processSchemeId = $_btn.processSchemeId;
|
||||
var _processname = $_btn.processname;
|
||||
var _activityId = $_btn.activityId;
|
||||
dialogOpen({
|
||||
id: "ProcessAgainNewForm",
|
||||
title: '重新申请【' + _processname + '】',
|
||||
url: '/FlowManage/FlowMyProcess/ProcessAgainNewForm?keyValue=' + _processInstanceId + '&activityId=' + _activityId,
|
||||
width: "1100px",
|
||||
height: "700px",
|
||||
btn: null,
|
||||
callBack: function (iframeId) {
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
sortname: "CreateDate desc"
|
||||
});
|
||||
|
||||
//查询事件
|
||||
$("#btn_Search").click(function () {
|
||||
var queryJson = { Keyword: $("#txt_Keyword").val() };
|
||||
params = { queryJson: JSON.stringify(queryJson) };
|
||||
$("#girdPager").page('remote', 0, params);
|
||||
});
|
||||
}
|
||||
|
||||
//回调函数
|
||||
function callBack() {
|
||||
$("#girdPager").page('remote', '', params);
|
||||
}
|
||||
</script>
|
||||
<div class="titlePanel">
|
||||
<div class="title-search">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="SchemeType" class="btn-group">
|
||||
<a class="btn btn-default dropdown-text" data-toggle="dropdown">选择流程分类</a>
|
||||
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
|
||||
<ul class="dropdown-menu"></ul>
|
||||
</div>
|
||||
</td>
|
||||
<td style="padding-left: 5px;">
|
||||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;" />
|
||||
</td>
|
||||
<td style="padding-left: 5px;">
|
||||
<a id="btn_Search" class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<div class="btn-group">
|
||||
<a id="lr-replace" class="btn btn-default" onclick="reload();"><i class="fa fa-refresh"></i> 刷新</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="taskblockPanel">
|
||||
<div id="taskblock" class="taskblock">
|
||||
<ul id="flowlist"></ul>
|
||||
</div>
|
||||
<div id="girdPager" class="m-pagination"></div>
|
||||
<div class="no-data"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,161 @@
|
||||
@{
|
||||
ViewBag.Title = "再次申请";
|
||||
Layout = "~/Views/Shared/_FlowForm.cshtml";
|
||||
}
|
||||
<script>
|
||||
var keyValue = request('keyValue');
|
||||
var ProcessSchemeId = "";
|
||||
var activityId =request('activityId');
|
||||
$(function () {
|
||||
initialPage();
|
||||
})
|
||||
//初始化页面
|
||||
function initialPage() {
|
||||
$('.FlowPanelall').height($.windowHeight() - 40);
|
||||
$('#Description').height($.windowHeight() - 390);
|
||||
//获取表单
|
||||
$.SetForm({
|
||||
url: "../../FlowManage/FlowProcess/GetProcessInfoJson",
|
||||
param: { keyValue: keyValue },
|
||||
success: function (data) {
|
||||
var _schemeContent = JSON.parse(JSON.parse(data.processScheme.SchemeContent).SchemeContent);
|
||||
var _frmdata = JSON.parse(JSON.parse(data.processScheme.SchemeContent).frmData);
|
||||
$('#frmpreview').frmPreview({
|
||||
tablecotent: _schemeContent.Frm.FrmContent
|
||||
});
|
||||
$('#frmpreview').frmSetData(_frmdata);
|
||||
$('#ProcessInfo').SetWebControls(data.processInstance);
|
||||
$('#wfLevel' + data.processInstance.wfLevel).trigger("click");
|
||||
ProcessSchemeId = data.processInstance.ProcessSchemeId;
|
||||
var _node = "";
|
||||
for(var i in _schemeContent.Flow.nodes)
|
||||
{
|
||||
if(_schemeContent.Flow.nodes[i].id == activityId)
|
||||
{
|
||||
_node = _schemeContent.Flow.nodes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
var _username = top.clientuserData[_node.setInfo.UserId] == undefined ? _node.setInfo.UserId : top.clientuserData[_node.setInfo.UserId].RealName;
|
||||
_username = _username == "System" ? '超级管理员' : '_username';
|
||||
$('#ruser').html('驳回人:' + _username + (_node.setInfo.TagedTime != undefined ?'-' +_node.setInfo.TagedTime:''));
|
||||
$('#rDescription').html('备注:' + _node.setInfo.description);
|
||||
}
|
||||
});
|
||||
}
|
||||
//提交表单
|
||||
function btn_Finish() {
|
||||
if (!$('#ProcessInfo').Validform()) {
|
||||
return false;
|
||||
}
|
||||
var _postData = $("#ProcessInfo").GetWebControls(keyValue);
|
||||
_postData["EnabledMark"] = 1;
|
||||
_postData["ProcessSchemeId"] = ProcessSchemeId;
|
||||
_postData["wfLevel"] = $('input[name="wfLevel"]:checked').val();
|
||||
var _data = $("#frmpreview").frmGetData();
|
||||
$.SaveForm({
|
||||
url: "../../FlowManage/FlowRoughdraft/EditionRoughdraftProcess",
|
||||
param: { "keyValue": keyValue, "frmData": JSON.stringify(_data), "wfProcessInstanceJson": JSON.stringify(_postData) },
|
||||
loading: "正在保存数据...",
|
||||
success: function () {
|
||||
$.currentIframe().callback();
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<div class="FlowPanelall">
|
||||
<div id="frmpreview" class="tab-pane app_layout app_preview active">
|
||||
</div>
|
||||
</div>
|
||||
<div class="FlowInfoPanel" id="ProcessInfo">
|
||||
<div class="alert alert-danger" style="text-align: left; margin-bottom: 10px;height:98px;overflow-y:auto;">
|
||||
<p><i class="fa fa-warning alert-dismissible" style="position: relative; top: 1px; font-size: 15px; padding-right: 5px;"></i>
|
||||
此流程被驳回,需要重新申请!
|
||||
</p>
|
||||
<p id="ruser">驳回人:</p>
|
||||
<p id="rDescription">备注:</p>
|
||||
</div>
|
||||
<div style="color:#9f9f9f;padding-bottom:15px;padding-left:5px;"><i style="padding-right:5px;" class="fa fa-info-circle"></i><span>填写左侧表单和实例信息,重新申请</span></div>
|
||||
<table class="form">
|
||||
<tr>
|
||||
<td class="formTitle">流程实例编号<font face="宋体">*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formValue">
|
||||
<input id="Code" disabled type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formTitle">自定义标题<font face="宋体">*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formValue">
|
||||
<input id="CustomName" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formTitle">重要等级<font face="宋体">*</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formValue">
|
||||
<div class="rdio rdio-color_a"><input name="wfLevel" id="wfLevel1" value="1" type="radio" /><label for="wfLevel1">重要</label></div>
|
||||
<div class="rdio rdio-color_f"><input name="wfLevel" id="wfLevel2" value="2" type="radio" checked /><label for="wfLevel2">普通</label></div>
|
||||
<div class="rdio rdio-color_c"><input name="wfLevel" id="wfLevel3" value="3" type="radio" /><label for="wfLevel3">一般</label></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formTitle">备注</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="formValue">
|
||||
<textarea id="Description" class="form-control" style="height: 383px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="form-button">
|
||||
<a id="btn_finish" class="btn btn-success" onclick="btn_Finish();">完成提交</a>
|
||||
</div>
|
||||
<style>
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
.app_preview .item_field_value {
|
||||
width: 664px;
|
||||
}
|
||||
.app_preview .item_row {
|
||||
background-color: #fff;
|
||||
}
|
||||
.app_layout .item_field_label {
|
||||
background-color: #fff;
|
||||
}
|
||||
.FlowPanelall {
|
||||
width: 800px;
|
||||
float: left;
|
||||
overflow-y:auto;
|
||||
}
|
||||
.FlowInfoPanel {
|
||||
float: right;
|
||||
width: 300px;
|
||||
height: 659px;
|
||||
z-index: 1000;
|
||||
background: rgba(0,0,0,0.01);
|
||||
padding: 10px;
|
||||
border-left: 1px solid #ccc;
|
||||
}
|
||||
.form .formTitle {
|
||||
text-align: left;
|
||||
padding-left: 5px;
|
||||
}
|
||||
form .formTitle font {
|
||||
right: auto !important;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.formValue input, .formValue textarea {
|
||||
border-radius: 5px;
|
||||
}
|
||||
input, textarea {
|
||||
background: #fff !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
@{
|
||||
ViewBag.Title = "查看流程进度";
|
||||
Layout = "~/Views/Shared/_FlowForm.cshtml";
|
||||
}
|
||||
<script>
|
||||
var processSchemeId = request('processSchemeId');
|
||||
var ActivityId = request('activityId');
|
||||
$(function () {
|
||||
var schemeContent;
|
||||
$.SetForm({
|
||||
url: "../../FlowManage/FlowProcess/GetProcessSchemeJson",
|
||||
param: { keyValue: processSchemeId },
|
||||
success: function (data) {
|
||||
schemeContent = JSON.parse(JSON.parse(data.SchemeContent).SchemeContent);
|
||||
frmdata = JSON.parse(JSON.parse(data.SchemeContent).frmData);
|
||||
|
||||
$('#frmpreview').frmPreview({
|
||||
tablecotent: schemeContent.Frm.FrmContent,
|
||||
width:1080
|
||||
});
|
||||
$('#FlowPanel').flowdesign({
|
||||
width: $(window).width()+3,
|
||||
height: $(window).height()-42,
|
||||
flowcontent: schemeContent.Flow,
|
||||
haveTool: false,
|
||||
isprocessing: true,
|
||||
activityId: ActivityId,
|
||||
nodeData: schemeContent.Flow.nodes
|
||||
});
|
||||
|
||||
$('#frmpreview').frmSetData(frmdata);
|
||||
$('#frmpreview').find('input,select,textarea,.ui-select').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="#FlowPanel" data-toggle="tab">流程信息</a></li>
|
||||
<li><a href="#frmpreview" data-toggle="tab">表单信息</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="FlowPanel" class="tab-pane active">
|
||||
</div>
|
||||
<div id="frmpreview" class="tab-pane app_layout app_preview">
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
body {
|
||||
overflow:hidden;
|
||||
}
|
||||
.app_preview {
|
||||
height:620px;
|
||||
}
|
||||
.app_preview .item_field_value {
|
||||
width:964px;
|
||||
}
|
||||
.app_preview .item_row {
|
||||
background-color: #fff;
|
||||
}
|
||||
.app_layout .item_field_label {
|
||||
background-color: #fff;
|
||||
}
|
||||
input, textarea {
|
||||
background: #fff!important;
|
||||
}
|
||||
</style>
|
||||
@@ -51,25 +51,35 @@ function MainGrid() {
|
||||
index: "Id",
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
name: "ProcessSchemeId",
|
||||
index: "ProcessSchemeId",
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
name: "ActivityId",
|
||||
index: "ActivityId",
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
index: "Name",
|
||||
name: "Name",
|
||||
label: "申请名称"
|
||||
index: "Code",
|
||||
name: "Code",
|
||||
label: "流程编号"
|
||||
},
|
||||
{
|
||||
index: "Comment",
|
||||
name: "Comment",
|
||||
label: "申请描述"
|
||||
},
|
||||
{
|
||||
index: "StateName",
|
||||
name: "StateName",
|
||||
label: "流程状态"
|
||||
},
|
||||
{
|
||||
index: "WorkflowName",
|
||||
name: "WorkflowName",
|
||||
index: "CustomName",
|
||||
name: "CustomName",
|
||||
label: "流程名称"
|
||||
},
|
||||
{
|
||||
index: "ActivityName",
|
||||
name: "ActivityName",
|
||||
label: "当前节点"
|
||||
},
|
||||
{
|
||||
index: "CreateDate",
|
||||
name: "CreateDate",
|
||||
label: "创建时间"
|
||||
}
|
||||
],
|
||||
url: url + selectedId,
|
||||
@@ -194,7 +204,7 @@ function detail() {
|
||||
title: selected.Name,
|
||||
skin: "layui-layer-rim", //加上边框
|
||||
area: ["800px", "600px"], //宽高
|
||||
content: "/CommonApplies/Detail?id=" + selected.Id,
|
||||
content: "/FlowManage/CommonApplies/ProcessLookForm?processSchemeId=" + selected.ProcessSchemeId + "&activityId="+selected.ActivityId,
|
||||
maxmin: true, //开启最大化最小化按钮
|
||||
end: function() {
|
||||
list.reload();
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.SSO;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
using ProcessStatus = OptimaJet.Workflow.Core.Persistence.ProcessStatus;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用申请流程处理
|
||||
/// <para>李玉宝新增于2016-09-08 19:21:59</para>
|
||||
/// </summary>
|
||||
public class CommonAppliesController : BaseController
|
||||
{
|
||||
private CommonApplyApp _app;
|
||||
|
||||
public CommonAppliesController()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<CommonApplyApp>();
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string Load(string type, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(AuthUtil.GetCurrentUser().User.Id, type, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public string Edit(CommonApply apply)
|
||||
{
|
||||
try
|
||||
{
|
||||
apply.UserId = AuthUtil.GetCurrentUser().User.Id;
|
||||
_app.AddOrUpdate(apply);
|
||||
CreateWorkflowIfNotExists(apply.Id,apply.WorkflowName);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Status = false;
|
||||
Result.Message = ex.Message;
|
||||
}
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
public ActionResult Detail(Guid id)
|
||||
{
|
||||
|
||||
CommonApplyVM apply = _app.Get(id);
|
||||
apply.Commands = GetCommands(id);
|
||||
return View(apply);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除申请
|
||||
/// </summary>
|
||||
public string Delete(Guid[] ids)
|
||||
{
|
||||
try
|
||||
{
|
||||
_app.Del(ids);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Status = false;
|
||||
Result.Message = ex.Message;
|
||||
throw;
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行命令
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public string ExeCmd(Guid id, string cmd)
|
||||
{
|
||||
try
|
||||
{
|
||||
ExecuteCommand(id, cmd, null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result.Status = false;
|
||||
Result.Message = ex.Message;
|
||||
throw;
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(Result);
|
||||
}
|
||||
|
||||
|
||||
private void CreateWorkflowIfNotExists(Guid id, string schemecode)
|
||||
{
|
||||
if (WorkflowInit.Runtime.IsProcessExists(id))
|
||||
return;
|
||||
|
||||
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
||||
{
|
||||
WorkflowInit.Runtime.CreateInstance(schemecode, id);
|
||||
|
||||
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||
|
||||
sync.Wait(new TimeSpan(0, 0, 10));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前登陆用户可执行的命令
|
||||
/// </summary>
|
||||
/// <param name="id">流程实体ID</param>
|
||||
private CommandModel[] GetCommands(Guid id)
|
||||
{
|
||||
var result = new List<CommandModel>();
|
||||
var commands = WorkflowInit.Runtime.GetAvailableCommands(id, AuthUtil.GetCurrentUser().User.Id.ToString());
|
||||
foreach (var workflowCommand in commands) //去除相同的
|
||||
{
|
||||
if (result.Count(c => c.Key == workflowCommand.CommandName) == 0)
|
||||
result.Add(new CommandModel {
|
||||
Key = workflowCommand.CommandName,
|
||||
Value = workflowCommand.LocalizedName,
|
||||
Classifier = workflowCommand.Classifier });
|
||||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行指令
|
||||
/// </summary>
|
||||
/// <param name="id">流程实例ID</param>
|
||||
/// <param name="commandName">命令名称</param>
|
||||
/// <param name="apply">申请实体</param>
|
||||
private void ExecuteCommand(Guid id, string commandName, CommonApply apply)
|
||||
{
|
||||
var currentUser =AuthUtil.GetCurrentUser().User.Id.ToString();
|
||||
|
||||
var commands = WorkflowInit.Runtime.GetAvailableCommands(id, currentUser);
|
||||
|
||||
var command =
|
||||
commands.FirstOrDefault(
|
||||
c => c.CommandName.Equals(commandName, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (command == null)
|
||||
return;
|
||||
|
||||
WorkflowInit.Runtime.ExecuteCommand(id, currentUser, currentUser, command);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,39 +28,39 @@ namespace OpenAuth.Mvc
|
||||
}
|
||||
|
||||
|
||||
protected void Application_Error(object sender, EventArgs e)
|
||||
{
|
||||
var app = (MvcApplication)sender;
|
||||
var context = app.Context;
|
||||
var ex = app.Server.GetLastError();
|
||||
LogHelper.Fatal(ex.Message);
|
||||
//protected void Application_Error(object sender, EventArgs e)
|
||||
//{
|
||||
// var app = (MvcApplication)sender;
|
||||
// var context = app.Context;
|
||||
// var ex = app.Server.GetLastError();
|
||||
// LogHelper.Fatal(ex.Message);
|
||||
|
||||
context.Response.Clear();
|
||||
context.ClearError();
|
||||
var httpException = ex as HttpException;
|
||||
var routeData = new RouteData();
|
||||
routeData.Values["controller"] = "error";
|
||||
routeData.Values["exception"] = ex;
|
||||
routeData.Values["action"] = "http500";
|
||||
if (httpException != null)
|
||||
{
|
||||
// context.Response.Clear();
|
||||
// context.ClearError();
|
||||
// var httpException = ex as HttpException;
|
||||
// var routeData = new RouteData();
|
||||
// routeData.Values["controller"] = "error";
|
||||
// routeData.Values["exception"] = ex;
|
||||
// routeData.Values["action"] = "http500";
|
||||
// if (httpException != null)
|
||||
// {
|
||||
|
||||
|
||||
switch (httpException.GetHttpCode())
|
||||
{
|
||||
case 404:
|
||||
routeData.Values["action"] = "http404";
|
||||
break;
|
||||
case 401: //没有登录
|
||||
routeData.Values["action"] = "http401";
|
||||
break;
|
||||
case 400: //演示版本,没有执行的权限
|
||||
routeData.Values["action"] = "DemoError";
|
||||
break;
|
||||
}
|
||||
}
|
||||
IController controller = new ErrorController();
|
||||
controller.Execute(new RequestContext(new HttpContextWrapper(context), routeData));
|
||||
}
|
||||
// switch (httpException.GetHttpCode())
|
||||
// {
|
||||
// case 404:
|
||||
// routeData.Values["action"] = "http404";
|
||||
// break;
|
||||
// case 401: //没有登录
|
||||
// routeData.Values["action"] = "http401";
|
||||
// break;
|
||||
// case 400: //演示版本,没有执行的权限
|
||||
// routeData.Values["action"] = "DemoError";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// IController controller = new ErrorController();
|
||||
// controller.Execute(new RequestContext(new HttpContextWrapper(context), routeData));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,7 @@ namespace OpenAuth.Mvc.Models
|
||||
{
|
||||
var nextState = WorkflowInit.Runtime.GetLocalizedStateName(e.ProcessId, e.ProcessInstance.CurrentState);
|
||||
|
||||
var _app = AutofacExt.GetFromFac<CommonApplyApp>();
|
||||
_app.ChangeState(e.ProcessId, e.ProcessInstance.CurrentState, nextState);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -150,6 +150,8 @@
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\FlowLaunchController.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\FlowProcessController.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\FormDesignController.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\FlowDesignController.cs" />
|
||||
<Compile Include="Areas\FlowManage\FlowManageAreaRegistration.cs" />
|
||||
@@ -159,7 +161,7 @@
|
||||
<Compile Include="Controllers\WorkflowSchemasController.cs" />
|
||||
<Compile Include="Controllers\DesignerController.cs" />
|
||||
<Compile Include="Controllers\ErrorController.cs" />
|
||||
<Compile Include="Controllers\CommonAppliesController.cs" />
|
||||
<Compile Include="Areas\FlowManage\Controllers\CommonAppliesController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\LoginController.cs" />
|
||||
<Compile Include="Controllers\ModuleElementManagerController.cs" />
|
||||
@@ -1515,9 +1517,12 @@
|
||||
<Content Include="Content\styles\fonts\fontawesome-webfont.woff" />
|
||||
<Content Include="Content\styles\fonts\fontawesome-webfont.woff2" />
|
||||
<Content Include="Content\styles\fonts\FontAwesome.otf" />
|
||||
<Content Include="Areas\FlowManage\Views\FlowMyProcess\Index.cshtml" />
|
||||
<Content Include="Areas\FlowManage\Views\FlowMyProcess\ProcessAgainNewForm.cshtml" />
|
||||
<Content Include="Areas\FlowManage\Views\FlowMyProcess\ProcessLookForm.cshtml" />
|
||||
<Content Include="Areas\FlowManage\Views\CommonApplies\ProcessLookForm.cshtml" />
|
||||
<None Include="Properties\PublishProfiles\default.pubxml" />
|
||||
<Content Include="Views\Designer\Index.cshtml" />
|
||||
<Content Include="Views\CommonApplies\Detail.cshtml" />
|
||||
<None Include="Views\Error\NoAccess.cshtml" />
|
||||
<Content Include="Views\Home\git.cshtml" />
|
||||
<Content Include="Web.config">
|
||||
@@ -1537,7 +1542,7 @@
|
||||
<Content Include="Views\ResourceManager\AssignRes.cshtml" />
|
||||
<Content Include="Views\StockManager\Index.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Views\CommonApplies\Index.cshtml" />
|
||||
<Content Include="Areas\FlowManage\Views\CommonApplies\Index.cshtml" />
|
||||
<Content Include="Views\WorkflowSchemas\Index.cshtml" />
|
||||
<Content Include="Views\Home\Navbar.cshtml" />
|
||||
<Content Include="Views\Shared\Blank.cshtml" />
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
@using OptimaJet.Workflow.Core.Model
|
||||
@model OpenAuth.App.ViewModel.CommonApplyVM
|
||||
|
||||
<script src="/Scripts/jquery.js"></script>
|
||||
<script src="/Scripts/jquery-ui.js"></script>
|
||||
<script src="/Scripts/kinetic-v5.1.0.min.js"></script>
|
||||
<script src="/Scripts/workflowdesigner.min.js"></script>
|
||||
<script src="/Scripts/designerconstants.js"></script>
|
||||
<script src="/Scripts/ace.js"></script>
|
||||
<script src="/Scripts/json5.js"></script>
|
||||
<script src="/BllScripts/queryString.js"></script>
|
||||
|
||||
<link href="/Content/plugins/jQueryUI/base/jquery-ui.min.css" rel="stylesheet" />
|
||||
<link href="/Content/workflowdesigner.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<input value="@Model.Id" id="processId" type="hidden" />
|
||||
<input value="@Model.WorkflowName" id="schemeCode" type="hidden" />
|
||||
|
||||
@if (Model.Commands.Length > 0)
|
||||
{
|
||||
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
||||
<p>
|
||||
<span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
||||
下图蓝色为当前状态,你可以执行:
|
||||
@foreach (var cmd in Model.Commands)
|
||||
{
|
||||
if (cmd.Classifier == TransitionClassifier.Reverse)
|
||||
{
|
||||
<button class="workflowcmd" value="@cmd.Key">@cmd.Value</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="workflowcmd" value="@cmd.Key">@cmd.Value</button>
|
||||
}
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
}
|
||||
|
||||
<div id="wfdesigner"></div>
|
||||
|
||||
<script src="/BllScripts/queryString.js"></script>
|
||||
<script src="/BllScripts/processDetail.js?v=1"></script>
|
||||
@@ -169,7 +169,7 @@
|
||||
</script>
|
||||
|
||||
<!-- #section:basics/sidebar -->
|
||||
@Html.Action("Navbar","Home")
|
||||
@Html.Action("Navbar","Home", new {area=""})
|
||||
|
||||
<!-- /section:basics/sidebar -->
|
||||
<div class="main-content">
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a CodeSmith Template.
|
||||
//
|
||||
// DO NOT MODIFY contents of this file. Changes to this
|
||||
// file will be lost if the code is regenerated.
|
||||
// </autogenerated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Repository.Models.Mapping
|
||||
{
|
||||
public partial class CommonApplyMap
|
||||
: System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<CommonApply>
|
||||
{
|
||||
public CommonApplyMap()
|
||||
{
|
||||
// table
|
||||
ToTable("CommonApply", "dbo");
|
||||
|
||||
// keys
|
||||
HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
Property(t => t.Id)
|
||||
.HasColumnName("Id")
|
||||
.IsRequired();
|
||||
Property(t => t.Sort)
|
||||
.HasColumnName("Sort")
|
||||
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
|
||||
.IsRequired();
|
||||
Property(t => t.ApplyTime)
|
||||
.HasColumnName("ApplyTime")
|
||||
.IsRequired();
|
||||
Property(t => t.Name)
|
||||
.HasColumnName("Name")
|
||||
.HasMaxLength(256)
|
||||
.IsOptional();
|
||||
Property(t => t.Comment)
|
||||
.HasColumnName("Comment")
|
||||
.IsRequired();
|
||||
Property(t => t.State)
|
||||
.HasColumnName("State")
|
||||
.HasMaxLength(1024)
|
||||
.IsRequired();
|
||||
Property(t => t.WorkflowName)
|
||||
.HasColumnName("WorkflowName")
|
||||
.HasMaxLength(1024)
|
||||
.IsRequired();
|
||||
Property(t => t.StateName)
|
||||
.HasColumnName("StateName")
|
||||
.HasMaxLength(1024)
|
||||
.IsOptional();
|
||||
Property(t => t.UserId)
|
||||
.HasColumnName("UserId")
|
||||
.IsRequired();
|
||||
Property(t => t.ControllerUserId)
|
||||
.HasColumnName("ControllerUserId")
|
||||
.IsOptional();
|
||||
|
||||
// Relationships
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsOptional();
|
||||
Property(t => t.ProcessSchemeId)
|
||||
.HasColumnName("ProcessSchemeId")
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
Property(t => t.SchemeType)
|
||||
.HasColumnName("SchemeType")
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsRequired();
|
||||
Property(t => t.ProcessId)
|
||||
.HasColumnName("ProcessId")
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
Property(t => t.Content)
|
||||
.HasColumnName("Content")
|
||||
|
||||
@@ -27,9 +27,8 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
Property(t => t.SchemeContent)
|
||||
.HasColumnName("SchemeContent")
|
||||
.IsRequired();
|
||||
Property(t => t.WFSchemeInfoId)
|
||||
.HasColumnName("WFSchemeInfoId")
|
||||
.HasMaxLength(50)
|
||||
Property(t => t.SchemeInfoId)
|
||||
.HasColumnName("SchemeInfoId")
|
||||
.IsRequired();
|
||||
Property(t => t.SchemeVersion)
|
||||
.HasColumnName("SchemeVersion")
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
.IsRequired();
|
||||
Property(t => t.ProcessId)
|
||||
.HasColumnName("ProcessId")
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
Property(t => t.FromNodeId)
|
||||
.HasColumnName("fromNodeId")
|
||||
|
||||
@@ -24,9 +24,8 @@ namespace OpenAuth.Repository.Models.Mapping
|
||||
Property(t => t.Id)
|
||||
.HasColumnName("Id")
|
||||
.IsRequired();
|
||||
Property(t => t.WFSchemeInfoId)
|
||||
.HasColumnName("WFSchemeInfoId")
|
||||
.HasMaxLength(50)
|
||||
Property(t => t.SchemeInfoId)
|
||||
.HasColumnName("SchemeInfoId")
|
||||
.IsRequired();
|
||||
Property(t => t.SchemeVersion)
|
||||
.HasColumnName("SchemeVersion")
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace OpenAuth.Repository.Models
|
||||
|
||||
public System.Data.Entity.DbSet<ApplyTransitionHistory> ApplyTransitionHistories { get; set; }
|
||||
public System.Data.Entity.DbSet<Category> Categories { get; set; }
|
||||
public System.Data.Entity.DbSet<CommonApply> CommonApplies { get; set; }
|
||||
public System.Data.Entity.DbSet<DicDetail> DicDetails { get; set; }
|
||||
public System.Data.Entity.DbSet<DicIndex> DicIndices { get; set; }
|
||||
public System.Data.Entity.DbSet<Module> Modules { get; set; }
|
||||
@@ -52,7 +51,6 @@ namespace OpenAuth.Repository.Models
|
||||
{
|
||||
modelBuilder.Configurations.Add(new ApplyTransitionHistoryMap());
|
||||
modelBuilder.Configurations.Add(new CategoryMap());
|
||||
modelBuilder.Configurations.Add(new CommonApplyMap());
|
||||
modelBuilder.Configurations.Add(new DicDetailMap());
|
||||
modelBuilder.Configurations.Add(new DicIndexMap());
|
||||
modelBuilder.Configurations.Add(new ModuleMap());
|
||||
|
||||
@@ -124,7 +124,6 @@
|
||||
<Compile Include="TestFunction.cs" />
|
||||
<Compile Include="TestLogin.cs" />
|
||||
<Compile Include="TestAuthen.cs" />
|
||||
<Compile Include="TestCommonApply.cs" />
|
||||
<Compile Include="TestOrg.cs" />
|
||||
<Compile Include="TestUser.cs" />
|
||||
<Compile Include="TestWorkflow.cs" />
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.App.ViewModel;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Mvc.Models;
|
||||
using OptimaJet.Workflow.Core.Persistence;
|
||||
using OptimaJet.Workflow.Core.Runtime;
|
||||
|
||||
namespace OpenAuth.UnitTest
|
||||
{
|
||||
/// <summary>
|
||||
/// 测试通用申请流程
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class TestCommonApply : TestBase
|
||||
{
|
||||
private CommonApplyApp _app;
|
||||
|
||||
public TestCommonApply()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<CommonApplyApp>();
|
||||
Mvc.AutofacExt.InitAutofac();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Addd()
|
||||
{
|
||||
var commonApply = new CommonApply
|
||||
{
|
||||
Id = Guid.Empty,
|
||||
WorkflowName = "新建模板",
|
||||
State = "",
|
||||
StateName = "",
|
||||
Name = "测试"+DateTime.Now.ToLongTimeString()
|
||||
};
|
||||
_app.AddOrUpdate(commonApply);
|
||||
|
||||
CreateWorkflowIfNotExists(commonApply.Id, commonApply.WorkflowName);
|
||||
}
|
||||
|
||||
|
||||
private void CreateWorkflowIfNotExists(Guid id, string schemecode)
|
||||
{
|
||||
if (WorkflowInit.Runtime.IsProcessExists(id))
|
||||
return;
|
||||
|
||||
using (var sync = new WorkflowSync(WorkflowInit.Runtime, id))
|
||||
{
|
||||
WorkflowInit.Runtime.CreateInstance(schemecode, id);
|
||||
|
||||
sync.StatrtWaitingFor(new List<ProcessStatus> { ProcessStatus.Initialized, ProcessStatus.Initialized });
|
||||
|
||||
sync.Wait(new TimeSpan(0, 0, 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using Infrastructure;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Service;
|
||||
|
||||
namespace OpenAuth.UnitTest
|
||||
@@ -7,16 +10,32 @@ namespace OpenAuth.UnitTest
|
||||
[TestClass]
|
||||
public class TestWorkflow :TestBase
|
||||
{
|
||||
private WorkflowService _app;
|
||||
private WFSchemeService _app;
|
||||
private WFRuntimeService _runApp;
|
||||
|
||||
public TestWorkflow()
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<WorkflowService>();
|
||||
_app = AutofacExt.GetFromFac<WFSchemeService>();
|
||||
_runApp = AutofacExt.GetFromFac<WFRuntimeService>();
|
||||
}
|
||||
[TestMethod]
|
||||
public void AddForm()
|
||||
{
|
||||
var datas = _app.GetList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试流程
|
||||
/// <para>李玉宝于2017-01-20 9:59:11</para>
|
||||
/// </summary>
|
||||
[TestMethod]
|
||||
public void AddProcessInstance()
|
||||
{
|
||||
string name = "请假" + DateTime.Now.ToString("yy-mm-dd_HH_mm_ss");
|
||||
string str ="{\"Code\":\"请病假\",\"CustomName\":\""+name+"\",\"wfLevel1\":\"1\",\"wfLevel2\":\"2\",\"wfLevel3\":\"3\",\"Description\":\" \",\"EnabledMark\":1,\"wfLevel\":\"2\"}";
|
||||
string frmData ="{\"4fcd4c6f-eb6b-6a6d-eb4e-7948763c5bba\":\"\",\"88061dda-642e-bcdb-909b-cea2bbe5ad69\":\" \"}";
|
||||
_runApp.CreateInstance(Guid.Empty, Guid.Parse("5f0ca3df-390a-4bd7-aecb-5304bf2d191c"), str.ToObject<WFProcessInstance>(), frmData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?PowerDesigner AppLocale="UTF16" ID="{54F96D9D-A534-4ADF-ADAD-ACFE3C42BC44}" Label="" LastModificationDate="1473246400" Name="OpenAuthDB" Objects="232" Symbols="16" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
|
||||
<?PowerDesigner AppLocale="UTF16" ID="{54F96D9D-A534-4ADF-ADAD-ACFE3C42BC44}" Label="" LastModificationDate="1473246397" Name="OpenAuthDB" Objects="219" Symbols="19" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.6.1.5066"?>
|
||||
<!-- do not edit this file -->
|
||||
|
||||
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
|
||||
@@ -193,6 +193,7 @@ TrgrC12Upd=Yes
|
||||
TrgrC13=Yes
|
||||
UpdateTableStatistics=Yes
|
||||
UpdateColumnStatistics=Yes
|
||||
DeploymentMode=REP
|
||||
|
||||
[FolderOptions\Physical Objects\Database Generation]
|
||||
GenScriptName=DB.sql
|
||||
@@ -3275,6 +3276,7 @@ EnableTrans=No
|
||||
UseTerm=No
|
||||
EnableRequirements=No
|
||||
EnableFullShortcut=Yes
|
||||
SynchroCode=Yes
|
||||
DefaultDttp=
|
||||
IgnoreOwner=No
|
||||
RebuildTrigger=Yes
|
||||
@@ -3965,6 +3967,7 @@ PhysOpts=
|
||||
|
||||
[ModelOptions\Default Opts\FRMESOB<<WorkloadGroup>>]
|
||||
PhysOpts=</a:ModelOptionsText>
|
||||
<a:RepositoryFilename>E:\测试学习\OpenAuth.Net\数据库设计关系图\OpenAuthDB.pdm</a:RepositoryFilename>
|
||||
<c:GenerationOrigins>
|
||||
<o:Shortcut Id="o3">
|
||||
<a:ObjectID>9401CEBA-B163-4ADB-AECF-03CE78C0FFF3</a:ObjectID>
|
||||
@@ -4058,6 +4061,8 @@ ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="
|
||||
ELnkShowStrn=Yes
|
||||
ELnkShowName=Yes
|
||||
ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form>
|
||||
ExtDpdShowStrn=Yes
|
||||
ExtendedDependency_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form>
|
||||
FileObject.Stereotype=No
|
||||
FileObject.DisplayName=Yes
|
||||
FileObject.LocationOrName=No
|
||||
@@ -4208,6 +4213,29 @@ Pen=1 0 128 128 255
|
||||
Shadow color=192 192 192
|
||||
Shadow=0
|
||||
|
||||
[DisplayPreferences\Symbol\USRDEPD]
|
||||
CENTERFont=新宋体,8,N
|
||||
CENTERFont color=0, 0, 0
|
||||
Line style=1
|
||||
AutoAdjustToText=Yes
|
||||
Keep aspect=No
|
||||
Keep center=No
|
||||
Keep size=No
|
||||
Brush color=255 255 255
|
||||
Fill Color=Yes
|
||||
Brush style=1
|
||||
Brush bitmap mode=12
|
||||
Brush gradient mode=0
|
||||
Brush gradient color=118 118 118
|
||||
Brush background image=
|
||||
Custom shape=
|
||||
Custom text mode=0
|
||||
Pen=2 0 128 128 255
|
||||
Shadow color=192 192 192
|
||||
Shadow=0
|
||||
OBJXSTRFont=新宋体,8,N
|
||||
OBJXSTRFont color=0 0 0
|
||||
|
||||
[DisplayPreferences\Symbol\FILO]
|
||||
OBJSTRNFont=新宋体,8,N
|
||||
OBJSTRNFont color=0 0 0
|
||||
@@ -4416,27 +4444,6 @@ Pen=1 0 128 128 192
|
||||
Shadow color=192 192 192
|
||||
Shadow=0
|
||||
|
||||
[DisplayPreferences\Symbol\USRDEPD]
|
||||
OBJXSTRFont=新宋体,8,N
|
||||
OBJXSTRFont color=0 0 0
|
||||
Line style=1
|
||||
AutoAdjustToText=Yes
|
||||
Keep aspect=No
|
||||
Keep center=No
|
||||
Keep size=No
|
||||
Brush color=255 255 255
|
||||
Fill Color=Yes
|
||||
Brush style=1
|
||||
Brush bitmap mode=12
|
||||
Brush gradient mode=0
|
||||
Brush gradient color=118 118 118
|
||||
Brush background image=
|
||||
Custom shape=
|
||||
Custom text mode=0
|
||||
Pen=2 0 128 128 255
|
||||
Shadow color=192 192 192
|
||||
Shadow=0
|
||||
|
||||
[DisplayPreferences\Symbol\Free Symbol]
|
||||
Free TextFont=新宋体,8,N
|
||||
Free TextFont color=0 0 0
|
||||
@@ -6145,6 +6152,7 @@ Drop=No</a:Settings>
|
||||
<a:Modifier>Administrator</a:Modifier>
|
||||
<a:DataType>uniqueidentifier</a:DataType>
|
||||
<a:Column.Mandatory>1</a:Column.Mandatory>
|
||||
<a:AutoMigrated>1</a:AutoMigrated>
|
||||
<a:ExtendedAttributesText>{F4F16ECD-F2F1-4006-AF6F-638D5C65F35E},MYSQL50,56={9C949EAB-FF87-446D-938C-8F03A4ABDC8E},National,4=true
|
||||
|
||||
</a:ExtendedAttributesText>
|
||||
@@ -7678,6 +7686,7 @@ Drop=No</a:Settings>
|
||||
<a:Comment>所属字典ID</a:Comment>
|
||||
<a:DataType>uniqueidentifier</a:DataType>
|
||||
<a:Column.Mandatory>1</a:Column.Mandatory>
|
||||
<a:AutoMigrated>1</a:AutoMigrated>
|
||||
</o:Column>
|
||||
</c:Columns>
|
||||
<c:Keys>
|
||||
@@ -7987,12 +7996,12 @@ Drop=No</a:Settings>
|
||||
<a:Code>MSSQLSRV2008</a:Code>
|
||||
<a:CreationDate>1430102304</a:CreationDate>
|
||||
<a:Creator>yubaolee</a:Creator>
|
||||
<a:ModificationDate>1430102304</a:ModificationDate>
|
||||
<a:Modifier>yubaolee</a:Modifier>
|
||||
<a:TargetModelURL>file:///%_DBMS%/sqlsv2k8.xdb</a:TargetModelURL>
|
||||
<a:ModificationDate>1395240976</a:ModificationDate>
|
||||
<a:Modifier>Administrator</a:Modifier>
|
||||
<a:TargetModelURL>file:///%[XDB]%/sqlsv2k8.xdb</a:TargetModelURL>
|
||||
<a:TargetModelID>F5C20738-B05A-4F70-BC90-9B5EB9437766</a:TargetModelID>
|
||||
<a:TargetModelClassID>4BA9F647-DAB1-11D1-9944-006097355D9B</a:TargetModelClassID>
|
||||
<a:TargetModelLastModificationDate>1341502043</a:TargetModelLastModificationDate>
|
||||
<a:TargetModelLastModificationDate>1395240976</a:TargetModelLastModificationDate>
|
||||
<c:SessionShortcuts>
|
||||
<o:Shortcut Ref="o4"/>
|
||||
</c:SessionShortcuts>
|
||||
|
||||
Reference in New Issue
Block a user