diff --git a/DOC/工作流介绍.docx b/DOC/工作流介绍.docx
new file mode 100644
index 00000000..4bdf3461
Binary files /dev/null and b/DOC/工作流介绍.docx differ
diff --git a/Infrastructure/GenericHelpers.cs b/Infrastructure/GenericHelpers.cs
index a8a9eaa7..284ff92f 100644
--- a/Infrastructure/GenericHelpers.cs
+++ b/Infrastructure/GenericHelpers.cs
@@ -43,5 +43,33 @@ namespace Infrastructure
};
}
}
+ ///
+ /// 把数组转为逗号连接的字符串
+ ///
+ ///
+ ///
+ ///
+ public static string ArrayToString(dynamic data, string Str)
+ {
+ string resStr = Str;
+ foreach (var item in data)
+ {
+ if (resStr != "")
+ {
+ resStr += ",";
+ }
+
+ if (item is string)
+ {
+ resStr += item;
+ }
+ else
+ {
+ resStr += item.Value;
+
+ }
+ }
+ return resStr;
+ }
}
}
\ No newline at end of file
diff --git a/OpenAuth.App/Flow/FlowNode.cs b/OpenAuth.App/Flow/FlowNode.cs
index af9566c0..12062339 100644
--- a/OpenAuth.App/Flow/FlowNode.cs
+++ b/OpenAuth.App/Flow/FlowNode.cs
@@ -8,6 +8,8 @@
public const string START = "start round mix";
public const string END = "end round";
public const string NODE = "node";
+ public const string FORK = "fork"; //会签开始节点
+ public const string JOIN = "join"; //会签结束节点
public string id { get; set; }
@@ -21,11 +23,6 @@
///
/// The set information.
public Setinfo setInfo { get; set; }
-
- public FlowNode()
- {
- setInfo = new Setinfo();
- }
}
public class Setinfo
@@ -33,11 +30,6 @@
public Nodedesignatedata NodeDesignateData { get; set; }
public string NodeCode { get; set; }
public string NodeName { get; set; }
-
- public Setinfo()
- {
- NodeDesignateData = new Nodedesignatedata();
- }
}
///
diff --git a/OpenAuth.App/Flow/FlowRuntime.cs b/OpenAuth.App/Flow/FlowRuntime.cs
index c4667aa3..a4f6d94b 100644
--- a/OpenAuth.App/Flow/FlowRuntime.cs
+++ b/OpenAuth.App/Flow/FlowRuntime.cs
@@ -181,11 +181,11 @@ namespace OpenAuth.App.Flow
///
public int GetNodeType(string nodeId)
{
- if (_runtimeModel.nodes[nodeId].type == "shuntnode")//会签开始节点
+ if (_runtimeModel.nodes[nodeId].type == FlowNode.FORK)//会签开始节点
{
return 0;
}
- else if (_runtimeModel.nodes[nodeId].type == "confluencenode")//会签结束节点
+ else if (_runtimeModel.nodes[nodeId].type == FlowNode.JOIN)//会签结束节点
{
return 1;
}
@@ -435,6 +435,7 @@ namespace OpenAuth.App.Flow
throw;
}
}
+ ///
/// 标记节点1通过,-1不通过,0驳回
///
///
@@ -446,7 +447,7 @@ namespace OpenAuth.App.Flow
int i = 0;
foreach (var item in _runtimeModel.schemeContentJson.nodes)
{
- if (item.id.Value == nodeId)
+ if (item.id.Value.ToString() == nodeId)
{
_runtimeModel.schemeContentJson.nodes[i].setInfo.Taged = flag;
_runtimeModel.schemeContentJson.nodes[i].setInfo.UserId = userId;
diff --git a/OpenAuth.App/Flow/FlowRuntimeModel.cs b/OpenAuth.App/Flow/FlowRuntimeModel.cs
index 9f4f57cf..ffb005c7 100644
--- a/OpenAuth.App/Flow/FlowRuntimeModel.cs
+++ b/OpenAuth.App/Flow/FlowRuntimeModel.cs
@@ -30,7 +30,7 @@ namespace OpenAuth.App.Flow
///
public string nextNodeId { get; set; }
///
- /// 下一个节点类型
+ /// 下一个节点类型 -1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
///
/// The type of the next node.
public int nextNodeType { get; set; }
diff --git a/OpenAuth.App/FlowInstanceApp.cs b/OpenAuth.App/FlowInstanceApp.cs
index 30f0807d..601e5d75 100644
--- a/OpenAuth.App/FlowInstanceApp.cs
+++ b/OpenAuth.App/FlowInstanceApp.cs
@@ -16,85 +16,7 @@ namespace OpenAuth.App
///
public class FlowInstanceApp : BaseApp
{
- #region ύ
-
- ///
- /// 洢ʵ̣˲ύ
- ///
- ///
- ///
- ///
- ///
- ///
- public int SaveProcess(FlowInstance processInstanceEntity,
- FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
- {
- try
- {
- processInstanceEntity.Id = (processInstanceEntity.Id);
- UnitWork.Update(processInstanceEntity);
-
- processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
- UnitWork.Add(processOperationHistoryEntity);
-
- if (processTransitionHistoryEntity != null)
- {
- processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
- UnitWork.Add(processTransitionHistoryEntity);
- }
-
- UnitWork.Save();
- return 1;
- }
- catch
- {
- throw;
- }
- }
- ///
- /// ʵ ˽ڵ
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public int SaveProcess(string sql, string dbbaseId, FlowInstance processInstanceEntity, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
- {
- try
- {
- processInstanceEntity.Id = (processInstanceEntity.Id);
- UnitWork.Update(processInstanceEntity);
-
- processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
- UnitWork.Add(processOperationHistoryEntity);
-
- if (processTransitionHistoryEntity != null)
- {
- processTransitionHistoryEntity.InstanceId = 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;
- }
- }
-
- #endregion
-
-
+
#region ̴API
///
/// һʵ
@@ -166,153 +88,142 @@ namespace OpenAuth.App
///
/// ڵ
///
- ///
+ ///
///
- public bool NodeVerification(string processId, bool flag, string description = "")
+ public bool NodeVerification(string instanceId, bool flag, string description = "")
{
- bool _res = false;
- try
+ FlowInstance flowInstance = Get(instanceId);
+ FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();//¼
+ FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//ת¼
+
+ FlowRuntime wfruntime = new FlowRuntime(flowInstance);
+
+
+ #region ǩ
+ if (flowInstance.ActivityType == 0)//ǩ
{
- string _sqlstr = "", _dbbaseId = "";
- FlowInstance FlowInstance = Get(processId);
- FlowInstanceOperationHistory FlowInstanceOperationHistory = new FlowInstanceOperationHistory();//¼
- FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//ת¼
-
- FlowRuntime wfruntime = new FlowRuntime(FlowInstance);
-
-
- #region ǩ
- if (FlowInstance.ActivityType == 0)//ǩ
+ wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, "");//ǵǰڵͨ
+ ///ѰҪ˵ĽڵId
+ string _VerificationNodeId = "";
+ List _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
+ string _makerList = "";
+ foreach (string item in _nodelist)
{
- wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, "");//ǵǰڵͨ
- ///ѰҪ˵ĽڵId
- string _VerificationNodeId = "";
- List _nodelist = wfruntime.GetCountersigningNodeIdList(wfruntime.runtimeModel.currentNodeId);
- string _makerList = "";
- foreach (string item in _nodelist)
+ _makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId);
+ if (_makerList != "-1")
{
- _makerList = GetMakerList(wfruntime.runtimeModel.nodes[item], wfruntime.runtimeModel.flowInstanceId);
- if (_makerList != "-1")
+ var id = AuthUtil.GetCurrentUser().User.Id;
+ foreach (string one in _makerList.Split(','))
{
- var id = AuthUtil.GetCurrentUser().User.Id;
- foreach (string one in _makerList.Split(','))
+ if (id == one || id.IndexOf(one) != -1)
{
- if (id == one || id.IndexOf(one) != -1)
- {
- _VerificationNodeId = item;
- break;
- }
+ _VerificationNodeId = item;
+ break;
}
}
}
-
- if (_VerificationNodeId != "")
- {
- if (flag)
- {
- FlowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
- }
- else
- {
- FlowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
- }
-
- string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id, description);
- var _data = new
- {
- SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
- wfruntime.runtimeModel.frmData
- };
- switch (_Confluenceres)
- {
- case "-1"://ͨ
- FlowInstance.IsFinish = 3;
- break;
- case "1"://ȴ
- break;
- default://ͨ
- FlowInstance.PreviousId = FlowInstance.ActivityId;
- FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
- FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1,0ǩʼ,1ǩ,2һڵ,4н
- FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
- FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
- FlowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//ǰڵִеϢ
-
- #region ת¼
- processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
- processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
- processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
- processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
- processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
- processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
- processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
- processTransitionHistoryEntity.TransitionSate = 0;
- processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
- #endregion
-
- break;
- }
- }
- else
- {
- throw (new Exception("쳣,Ҳ˽ڵ"));
- }
}
- #endregion
- #region һ
- else//һ
+ if (_VerificationNodeId != "")
{
if (flag)
{
- wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, AuthUtil.GetCurrentUser().User.Id, description);
- FlowInstance.PreviousId = FlowInstance.ActivityId;
- FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
- FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1,0ǩʼ,1ǩ,2һڵ,4н
- FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
- FlowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//ǰڵִеϢ
- FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
- #region ת¼
-
- processTransitionHistoryEntity = new FlowInstanceTransitionHistory
- {
- FromNodeId = wfruntime.runtimeModel.currentNodeId,
- FromNodeName = wfruntime.runtimeModel.currentNode.name,
- FromNodeType = wfruntime.runtimeModel.currentNodeType,
- ToNodeId = wfruntime.runtimeModel.nextNodeId,
- ToNodeName = wfruntime.runtimeModel.nextNode.name,
- ToNodeType = wfruntime.runtimeModel.nextNodeType,
- TransitionSate = 0
- };
- processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
- #endregion
-
-
- FlowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
+ flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
}
else
{
- FlowInstance.IsFinish = 3; //ʾýڵ㲻ͬ
- wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
-
- FlowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
+ flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.nodes[_VerificationNodeId].name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
}
- var data = new
+
+ string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id, description);
+ var _data = new
{
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
wfruntime.runtimeModel.frmData
};
- }
- #endregion
+ switch (_Confluenceres)
+ {
+ case "-1"://ͨ
+ flowInstance.IsFinish = 3;
+ break;
+ case "1"://ȴ
+ break;
+ default://ͨ
+ flowInstance.PreviousId = flowInstance.ActivityId;
+ flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
+ flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1,0ǩʼ,1ǩ,2һڵ,4н
+ flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
+ flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
+ flowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime));//ǰڵִеϢ
- _res = true;
- SaveProcess(_sqlstr, _dbbaseId, FlowInstance, FlowInstanceOperationHistory, processTransitionHistoryEntity);
- return _res;
+ #region ת¼
+ processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
+ processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
+ processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
+ processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
+ processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
+ processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
+ processTransitionHistoryEntity.ToNodeType = wfruntime.runtimeModel.nextNodeType;
+ processTransitionHistoryEntity.TransitionSate = 0;
+ processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
+ #endregion
+
+ break;
+ }
+ }
+ else
+ {
+ throw (new Exception("쳣,Ҳ˽ڵ"));
+ }
}
- catch
+ #endregion
+
+ #region һ
+ else//һ
{
- throw;
+ if (flag)
+ {
+ wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1
+ , AuthUtil.GetCurrentUser().User.Id, description);
+ flowInstance.PreviousId = flowInstance.ActivityId;
+ flowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
+ flowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;
+ flowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
+ flowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//ǰڵִеϢ
+ flowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
+ #region ת¼
+
+ processTransitionHistoryEntity = new FlowInstanceTransitionHistory
+ {
+ FromNodeId = wfruntime.runtimeModel.currentNodeId,
+ FromNodeName = wfruntime.runtimeModel.currentNode.name,
+ FromNodeType = wfruntime.runtimeModel.currentNodeType,
+ ToNodeId = wfruntime.runtimeModel.nextNodeId,
+ ToNodeName = wfruntime.runtimeModel.nextNode.name,
+ ToNodeType = wfruntime.runtimeModel.nextNodeType,
+ TransitionSate = 0
+ };
+ processTransitionHistoryEntity.IsFinish = (processTransitionHistoryEntity.ToNodeType == 4 ? 1 : 0);
+ #endregion
+
+
+ flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
+ }
+ else
+ {
+ flowInstance.IsFinish = 3; //ʾýڵ㲻ͬ
+ wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
+
+ flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "ͬ,ע" + description;
+ }
}
+ #endregion
+
+ UnitWork.Update(flowInstance);
+ UnitWork.Add(flowInstanceOperationHistory);
+ UnitWork.Add(processTransitionHistoryEntity);
+ UnitWork.Save();
+ return true;
}
///
///
@@ -323,59 +234,56 @@ namespace OpenAuth.App
///
public bool NodeReject(string processId, string nodeId, string description = "")
{
- try
+ FlowInstance flowInstance = Get(processId);
+ FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
+ FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
+
+ FlowRuntime wfruntime = new FlowRuntime(flowInstance);
+
+
+ string resnode = "";
+ if (nodeId == "")
{
- FlowInstance flowInstance = Get(processId);
- FlowInstanceOperationHistory flowInstanceOperationHistory = new FlowInstanceOperationHistory();
- FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
-
- FlowRuntime wfruntime = new FlowRuntime(flowInstance);
-
-
- string resnode = "";
- if (nodeId == "")
- {
- resnode = wfruntime.RejectNode();
- }
- else
- {
- resnode = nodeId;
- }
- wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
- flowInstance.IsFinish = 4;//4ʾأҪύ
- if (resnode != "")
- {
- flowInstance.PreviousId = flowInstance.ActivityId;
- flowInstance.ActivityId = resnode;
- flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1,0ǩʼ,1ǩ,2һڵ,4н
- flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name;
- flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//ǰڵִеϢ
- #region ת¼
- processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
- processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
- processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
- processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
- processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
- processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
- 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 = (flowInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
- };
- flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + ",ע" + description;
-
- SaveProcess(flowInstance, flowInstanceOperationHistory, processTransitionHistoryEntity);
- return true;
+ resnode = wfruntime.RejectNode();
}
- catch
+ else
{
- throw;
+ resnode = nodeId;
}
+ wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
+ flowInstance.IsFinish = 4;//4ʾأҪύ
+ if (resnode != "")
+ {
+ flowInstance.PreviousId = flowInstance.ActivityId;
+ flowInstance.ActivityId = resnode;
+ flowInstance.ActivityType = wfruntime.GetNodeType(resnode);//-1,0ǩʼ,1ǩ,2һڵ,4н
+ flowInstance.ActivityName = wfruntime.runtimeModel.nodes[resnode].name;
+ flowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodes[resnode], flowInstance.PreviousId);//ǰڵִеϢ
+ #region ת¼
+ processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
+ processTransitionHistoryEntity.FromNodeId = wfruntime.runtimeModel.currentNodeId;
+ processTransitionHistoryEntity.FromNodeName = wfruntime.runtimeModel.currentNode.name;
+ processTransitionHistoryEntity.FromNodeType = wfruntime.runtimeModel.currentNodeType;
+ processTransitionHistoryEntity.ToNodeId = wfruntime.runtimeModel.nextNodeId;
+ processTransitionHistoryEntity.ToNodeName = wfruntime.runtimeModel.nextNode.name;
+ 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 = (flowInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
+ };
+ flowInstanceOperationHistory.Content = "" + "todo name" + "" + wfruntime.runtimeModel.currentNode.name + "" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + ",ע" + description;
+
+ UnitWork.Add(flowInstance);
+ UnitWork.Add(flowInstanceOperationHistory);
+ UnitWork.Add(processTransitionHistoryEntity);
+ UnitWork.Save();
+
+ return true;
}
#endregion
@@ -454,10 +362,10 @@ namespace OpenAuth.App
//}
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//ָԱ
//{
- makerlsit = ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit);
+ makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.role, makerlsit);
// makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.post, makerlsit);
// makerlsit = ArrwyToString(node.setInfo.NodeDesignateData.usergroup, makerlsit);
- makerlsit = ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit);
+ makerlsit = GenericHelpers.ArrayToString(node.setInfo.NodeDesignateData.users, makerlsit);
if (makerlsit == "")
{
@@ -531,68 +439,33 @@ namespace OpenAuth.App
///
///
///
- private string ArrayToString(dynamic data, string Str)
- {
- string resStr = Str;
- foreach (var item in data)
- {
- if (resStr != "")
- {
- resStr += ",";
- }
-
- if (item is string)
- {
- resStr += item;
- }
- else
- {
- resStr += item.Value;
-
- }
- }
- return resStr;
- }
-
-
+
///
///
/// 2017-01-20 15:44:45
///
- /// The process identifier.
- /// The verification data.
- public void VerificationProcess(string processId, string verificationData)
+ public void Verification(VerificationReq request)
{
- try
+ //
+ if (request.VerificationFinally == "3")
{
- dynamic verificationDataJson = verificationData.ToJson();
-
- //
- if (verificationDataJson.VerificationFinally.Value == "3")
+ string _nodeId = "";
+ if (!string.IsNullOrEmpty(request.NodeRejectStep))
{
- 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);
+ _nodeId = request.NodeRejectStep;
}
+ NodeReject(request.FlowInstanceId, _nodeId, request.VerificationOpinion);
}
- catch
+ else if (request.VerificationFinally == "2")//ʾͬ
{
- throw;
+ NodeVerification(request.FlowInstanceId, false, request.VerificationOpinion);
+ }
+ else if (request.VerificationFinally == "1")//ʾͬ
+ {
+ NodeVerification(request.FlowInstanceId, true, request.VerificationOpinion);
}
}
-
public void Update(FlowInstance flowScheme)
{
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance());
diff --git a/OpenAuth.App/OpenAuth.App.csproj b/OpenAuth.App/OpenAuth.App.csproj
index fcebeebf..22df6fa4 100644
--- a/OpenAuth.App/OpenAuth.App.csproj
+++ b/OpenAuth.App/OpenAuth.App.csproj
@@ -120,6 +120,7 @@
+
diff --git a/OpenAuth.App/Request/VerificationReq.cs b/OpenAuth.App/Request/VerificationReq.cs
new file mode 100644
index 00000000..e053b7a0
--- /dev/null
+++ b/OpenAuth.App/Request/VerificationReq.cs
@@ -0,0 +1,21 @@
+namespace OpenAuth.App.Request
+{
+ public class VerificationReq
+ {
+ public string FlowInstanceId { get; set; }
+ ///
+ /// 1:同意;2:不同意;3:驳回
+ ///
+ public string VerificationFinally { get; set; }
+
+ ///
+ /// 审核意见
+ ///
+ public string VerificationOpinion { get; set; }
+
+ ///
+ /// 驳回的步骤
+ ///
+ public string NodeRejectStep { get; set; }
+ }
+}
diff --git a/OpenAuth.Mvc/Controllers/FlowInstancesController.cs b/OpenAuth.Mvc/Controllers/FlowInstancesController.cs
index 8ca3df3f..cff18bc4 100644
--- a/OpenAuth.Mvc/Controllers/FlowInstancesController.cs
+++ b/OpenAuth.Mvc/Controllers/FlowInstancesController.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using System.Web.Http;
using System.Web.Mvc;
using Infrastructure;
using Newtonsoft.Json.Linq;
@@ -27,6 +26,26 @@ namespace OpenAuth.Mvc.Controllers
return View();
}
+ public ActionResult Verification()
+ {
+ return View();
+ }
+
+ [HttpPost]
+ public string Verification(VerificationReq request)
+ {
+ try
+ {
+ App.Verification(request);
+
+ }
+ catch (Exception ex)
+ {
+ Result.Code = 500;
+ Result.Message = ex.Message;
+ }
+ return JsonHelper.Instance.Serialize(Result);
+ }
public string Get(string id)
{
@@ -80,7 +99,7 @@ namespace OpenAuth.Mvc.Controllers
///
/// 加载列表
///
- public string Load([FromUri]QueryFlowInstanceListReq request)
+ public string Load([System.Web.Http.FromUri]QueryFlowInstanceListReq request)
{
return JsonHelper.Instance.Serialize(App.Load(request));
}
diff --git a/OpenAuth.Mvc/OpenAuth.Mvc.csproj b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
index 54540b1b..052e3a6b 100644
--- a/OpenAuth.Mvc/OpenAuth.Mvc.csproj
+++ b/OpenAuth.Mvc/OpenAuth.Mvc.csproj
@@ -195,6 +195,7 @@
+
@@ -638,6 +639,7 @@
+
diff --git a/OpenAuth.Mvc/Views/FlowInstances/Verification.cshtml b/OpenAuth.Mvc/Views/FlowInstances/Verification.cshtml
new file mode 100644
index 00000000..aaed2e43
--- /dev/null
+++ b/OpenAuth.Mvc/Views/FlowInstances/Verification.cshtml
@@ -0,0 +1,52 @@
+
+@section header
+{
+
+
+
+}
+
+
+
+
+
diff --git a/OpenAuth.Mvc/userJs/flowInstanceOp.js b/OpenAuth.Mvc/userJs/flowInstanceOp.js
new file mode 100644
index 00000000..4522b7ec
--- /dev/null
+++ b/OpenAuth.Mvc/userJs/flowInstanceOp.js
@@ -0,0 +1,69 @@
+layui.config({
+ base: "/js/"
+}).use(['form', 'vue', 'ztree', 'layer', 'utils', 'element', 'jquery', 'droptree', 'openauth', 'flow/gooflow', 'flowlayout'], function () {
+ var form = layui.form, element = layui.element,
+ //layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
+ layer = layui.layer,
+ $ = layui.jquery;
+ var openauth = layui.openauth;
+ var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
+
+ var vm = new Vue({
+ el: "#formEdit"
+ });
+
+ var id = $.getUrlParam("id"); //ID
+ $("#FlowInstanceId").val(id);
+
+ //标签切换
+ element.on('tab(tab)', function (data) {
+ parent.layer.iframeAuto(index);
+ });
+
+ /*=========流程设计(begin)======================*/
+ var flowDesignPanel = $('#flowPanel').flowdesign({
+ height: 300,
+ widht: 300,
+ haveTool: false
+ });
+ /*=========流程设计(end)=====================*/
+
+ $.getJSON('/FlowInstances/get?id=' + id,
+ function (data) {
+ var obj = data.Result;
+ flowDesignPanel.loadData(JSON.parse(obj.SchemeContent));
+
+ //取表单的结构数据
+ $.getJSON("/forms/get?id=" + obj.FrmId, function (data) {
+ if (data.Code != 500) {
+ $("#frmPreview").html(data.Result.Html);
+ }
+ });
+ });
+
+ //提交数据
+ form.on('submit(formSubmit)',
+ function (data) {
+ $.post("/FlowInstances/Verification",
+ data.field,
+ function (result) {
+ layer.msg(result.Message);
+ },
+ "json");
+
+ return false; //阻止表单跳转。
+ });
+
+ //$(window).resize(function() {
+ // flowDesignPanel.reinitSize($(window).width()-30, $(window).height()-100);
+ //});
+
+ //该函数供给父窗口确定时调用
+ submit = function () {
+ //只能用隐藏的submit btn才行,用form.submit()时data.field里没有数据
+ $("#btnSubmit").click();
+ }
+
+ //让层自适应iframe
+ parent.layer.iframeAuto(index);
+})
\ No newline at end of file
diff --git a/OpenAuth.Mvc/userJs/flowInstances.js b/OpenAuth.Mvc/userJs/flowInstances.js
index c718bbe5..d9fcbe7d 100644
--- a/OpenAuth.Mvc/userJs/flowInstances.js
+++ b/OpenAuth.Mvc/userJs/flowInstances.js
@@ -128,6 +128,32 @@
editDlg.update(data[0]);
}
+ , btnVerification: function () { //处理
+ var checkStatus = table.checkStatus('mainList')
+ , data = checkStatus.data;
+ if (data.length != 1) {
+ layer.msg("请选择要处理的流程,且同时只能选择一条");
+ return;
+ }
+
+ layer.open({
+ type: 2,
+ area: ['600px', '500px'], //宽高
+ maxmin: true, //开启最大化最小化按钮
+ title: '处理流程',
+ content: '/flowInstances/Verification?id=' + data[0].Id,
+ btn: ['保存', '关闭'],
+ yes: function (index, layero) {
+ var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+ iframeWin.submit();
+ },
+ cancel: function (index) {
+ layer.close(index);
+ mainList();
+ }
+ });
+ }
+
, search: function () { //搜索
mainList({ key: $('#key').val() });
}
diff --git a/OpenAuth.Repository/Domain/FlowInstance.cs b/OpenAuth.Repository/Domain/FlowInstance.cs
index 8eddaa05..f26ae41e 100644
--- a/OpenAuth.Repository/Domain/FlowInstance.cs
+++ b/OpenAuth.Repository/Domain/FlowInstance.cs
@@ -62,7 +62,7 @@ namespace OpenAuth.Repository.Domain
///
public string ActivityId { get; set; }
///
- /// 当前节点类型(0会签节点)
+ /// 当前节点类型 -1无法运行,0会签开始,1会签结束,2一般节点,4流程运行结束
///
public int? ActivityType { get; set; }
///
@@ -130,7 +130,7 @@ namespace OpenAuth.Repository.Domain
///
public string Description { get; set; }
///
- /// 是否完成
+ /// 是否完成 0未完成,1完成并同意,2被召回,3完成但不同意, 4被驳回需要重新提交
///
public int IsFinish { get; set; }
///
diff --git a/数据库设计关系图/OpenAuthDB.pdm b/数据库设计关系图/OpenAuthDB.pdm
index 4757b78b..bd69d01d 100644
--- a/数据库设计关系图/OpenAuthDB.pdm
+++ b/数据库设计关系图/OpenAuthDB.pdm
@@ -1,5 +1,5 @@
-
+
@@ -3967,7 +3967,7 @@ PhysOpts=
[ModelOptions\Default Opts\FRMESOB<<WorkloadGroup>>]
PhysOpts=
-F:\MyProject\OpenAuth.Net\数据库设计关系图\OpenAuthDB.pdm
+C:\MyProject\OpenAuth.Net\数据库设计关系图\OpenAuthDB.pdm
9401CEBA-B163-4ADB-AECF-03CE78C0FFF3
@@ -9029,9 +9029,9 @@ Drop=No
ActivityType
1504793917
Administrator
-1504798127
+1521866779
Administrator
-当前节点类型(0会签节点)
+当前节点类型-1无法运行,0会签开始,1会签结束,2一般节点,3开始节点,4流程运行结束
int
@@ -9257,9 +9257,9 @@ Drop=No
IsFinish
1504793917
Administrator
-1520667807
+1521866723
Administrator
-是否完成
+是否完成0运行中,1完成并同意,2被召回,3完成但不同意, 4被驳回需要重新提交
0
int
1