2018-03-12 23:44:05 +08:00
|
|
|
|
using System;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Infrastructure;
|
|
|
|
|
using OpenAuth.App.Extention;
|
2018-03-12 23:44:05 +08:00
|
|
|
|
using OpenAuth.App.Request;
|
2017-11-30 17:47:41 +08:00
|
|
|
|
using OpenAuth.App.Response;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
using OpenAuth.App.SSO;
|
2017-11-29 20:49:14 +08:00
|
|
|
|
using OpenAuth.Repository.Domain;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
namespace OpenAuth.App
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
public class FlowInstanceApp :BaseApp<FlowInstance>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><>ȡʵ<C8A1><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʵ<CFA2><CAB5>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
2017-11-29 20:49:14 +08:00
|
|
|
|
/// <param name="keyVlaue">The key vlaue.</param>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <returns>FlowInstance.</returns>
|
|
|
|
|
public FlowInstance GetEntity(string keyVlaue)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
return UnitWork.FindSingle<FlowInstance>(u =>u.Id == keyVlaue);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD>ύ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>༭<EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD>)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
/// <param name="flowInstance"></param>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <param name="wfOperationHistoryEntity"></param>
|
|
|
|
|
/// <returns></returns>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
public int SaveProcess(string processId, FlowInstance flowInstance, FlowInstanceOperationHistory wfOperationHistoryEntity = null)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
if (string.Empty ==(flowInstance.Id))
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
UnitWork.Add(flowInstance);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
flowInstance.Id = (processId);
|
|
|
|
|
UnitWork.Update(flowInstance);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
if (wfOperationHistoryEntity != null)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
wfOperationHistoryEntity.InstanceId = processId;
|
|
|
|
|
UnitWork.Add(wfOperationHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Save();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="wfRuntimeModel"></param>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
/// <param name="flowInstance"></param>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <param name="processOperationHistoryEntity"></param>
|
|
|
|
|
/// <returns></returns>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
public int SaveProcess(WF_RuntimeModel wfRuntimeModel, FlowInstance flowInstance, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
if (string.Empty == (flowInstance.Id))
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
2018-03-16 17:33:54 +08:00
|
|
|
|
flowInstance.Id = (string)(wfRuntimeModel.processId);
|
|
|
|
|
UnitWork.Add(flowInstance);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
flowInstance.Id =(flowInstance.Id);
|
|
|
|
|
UnitWork.Update(flowInstance);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
2018-03-16 17:33:54 +08:00
|
|
|
|
processOperationHistoryEntity.InstanceId = flowInstance.Id;
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Add(processOperationHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
if (processTransitionHistoryEntity != null)
|
|
|
|
|
{
|
2018-03-16 17:33:54 +08:00
|
|
|
|
processTransitionHistoryEntity.InstanceId = flowInstance.Id;
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Add(processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Save();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="processInstanceEntity"></param>
|
|
|
|
|
/// <param name="processSchemeEntity"></param>
|
|
|
|
|
/// <param name="processOperationHistoryEntity"></param>
|
|
|
|
|
/// <param name="processTransitionHistoryEntity"></param>
|
|
|
|
|
/// <returns></returns>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
public int SaveProcess(FlowInstance processInstanceEntity,
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processInstanceEntity.Id=(processInstanceEntity.Id);
|
|
|
|
|
UnitWork.Update(processInstanceEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
|
|
|
|
|
UnitWork.Add(processOperationHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
if (processTransitionHistoryEntity != null)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
|
|
|
|
|
UnitWork.Add(processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Save();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5> <20><><EFBFBD>˽ڵ<CBBD><DAB5><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </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>
|
2018-03-16 17:33:54 +08:00
|
|
|
|
public int SaveProcess(string sql,string dbbaseId, FlowInstance processInstanceEntity, FlowInstanceOperationHistory processOperationHistoryEntity, FlowInstanceTransitionHistory processTransitionHistoryEntity = null)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processInstanceEntity.Id=(processInstanceEntity.Id);
|
|
|
|
|
UnitWork.Update(processInstanceEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processOperationHistoryEntity.InstanceId = processInstanceEntity.Id;
|
|
|
|
|
UnitWork.Add(processOperationHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
if (processTransitionHistoryEntity != null)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
processTransitionHistoryEntity.InstanceId = processInstanceEntity.Id;
|
|
|
|
|
UnitWork.Add(processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//if (!string.IsNullOrEmpty(dbbaseId) && !string.IsNullOrEmpty(sql))//<2F><><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>sql<71><6C><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
//{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
// DataBaseLinkEntity dataBaseLinkEntity = dataBaseLinkService.GetEntity(dbbaseId);//<2F><>ȡ
|
2017-03-24 15:35:52 +08:00
|
|
|
|
// this.BaseRepository(dataBaseLinkEntity.DbConnection).ExecuteBySql(sql.Replace("{0}", processInstanceEntity.Id));
|
|
|
|
|
//}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
UnitWork.Save();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD><EFBFBD><EFBFBD>API
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ʵ<EFBFBD><CAB5>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <param name="processId"><3E><><EFBFBD><EFBFBD>GUID</param>
|
|
|
|
|
/// <param name="schemeInfoId">ģ<><C4A3><EFBFBD><EFBFBD>ϢID</param>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <param name="wfLevel"></param>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <param name="code"><3E><><EFBFBD>̱<EFBFBD><CCB1><EFBFBD></param>
|
|
|
|
|
/// <param name="customName"><3E>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
|
|
|
|
/// <param name="description"><3E><>ע</param>
|
|
|
|
|
/// <param name="frmData"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ</param>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// <returns></returns>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
public bool CreateInstance(string processId, string schemeInfoId, FlowInstance FlowInstance, string frmData = null)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowScheme FlowScheme = UnitWork.FindSingle<FlowScheme>(u => u.Id == schemeInfoId);
|
2018-03-15 10:32:36 +08:00
|
|
|
|
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
|
|
|
|
{
|
2018-03-15 10:32:36 +08:00
|
|
|
|
schemeContent = FlowScheme.SchemeContent,
|
2017-03-24 15:35:52 +08:00
|
|
|
|
currentNodeId = "",
|
|
|
|
|
frmData = frmData,
|
|
|
|
|
processId = processId
|
|
|
|
|
};
|
2018-03-20 17:40:50 +08:00
|
|
|
|
WF_Runtime wfruntime = null;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
if (frmData == null)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw new Exception("<22>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var user = AuthUtil.GetCurrentUser();
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
|
|
|
|
FlowInstance.ActivityType = wfruntime.GetStatus();//-1<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|
|
|
|
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
|
|
|
|
FlowInstance.PreviousId = wfruntime.runtimeModel.currentNodeId;
|
|
|
|
|
FlowInstance.SchemeType = FlowScheme.SchemeType;
|
|
|
|
|
FlowInstance.FrmType = FlowScheme.FrmType;
|
|
|
|
|
FlowInstance.Disabled = 0;//<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>
|
|
|
|
|
FlowInstance.CreateUserId = user.User.Id.ToString();
|
|
|
|
|
FlowInstance.CreateUserName = user.User.Account;
|
|
|
|
|
FlowInstance.MakerList = (wfruntime.GetStatus() != 4 ? GetMakerList(wfruntime) : "");//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
FlowInstance.IsFinish = (wfruntime.GetStatus() == 4 ? 1 : 0);
|
2018-03-16 17:33:54 +08:00
|
|
|
|
FlowInstance.SchemeContent = FlowScheme.SchemeContent;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
2018-03-16 17:33:54 +08:00
|
|
|
|
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
FlowInstanceOperationHistory processOperationHistoryEntity = new FlowInstanceOperationHistory();
|
|
|
|
|
processOperationHistoryEntity.Content = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + user.User.Name + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><CCBD>̡<EFBFBD>" + FlowInstance.Code + "/" + FlowInstance.CustomName + "<22><>";
|
2017-03-24 15:35:52 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
|
|
|
|
|
FlowInstanceTransitionHistory processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
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
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region ί<EFBFBD>м<EFBFBD>¼
|
|
|
|
|
//List<WFDelegateRecord> delegateRecordEntitylist = GetDelegateRecordList(schemeInfoId, FlowInstance.Code, FlowInstance.CustomName, FlowInstance.MakerList);
|
|
|
|
|
//FlowInstance.MakerList += delegateUserList;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
2018-03-16 17:33:54 +08:00
|
|
|
|
SaveProcess(wfruntime.runtimeModel, FlowInstance, processOperationHistoryEntity, processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="processId"></param>
|
|
|
|
|
/// <returns></returns>
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public bool NodeVerification(string processId, bool flag, string description = "")
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
bool _res = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string _sqlstr = "", _dbbaseId = "";
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance FlowInstance = GetEntity(processId);
|
|
|
|
|
FlowInstanceOperationHistory FlowInstanceOperationHistory = new FlowInstanceOperationHistory();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|
|
|
|
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;//<2F><>ת<EFBFBD><D7AA>¼
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
currentNodeId = FlowInstance.ActivityId,
|
|
|
|
|
previousId = FlowInstance.PreviousId,
|
2017-03-24 15:35:52 +08:00
|
|
|
|
processId = processId
|
|
|
|
|
};
|
2018-03-20 17:40:50 +08:00
|
|
|
|
WF_Runtime wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region <EFBFBD><EFBFBD>ǩ
|
|
|
|
|
if (FlowInstance.ActivityType == 0)//<2F><>ǩ
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, "");//<2F><><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD>ڵ<EFBFBD>ͨ<EFBFBD><CDA8>
|
|
|
|
|
///Ѱ<><D1B0><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>˵Ľڵ<C4BD>Id
|
2017-03-24 15:35:52 +08:00
|
|
|
|
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")
|
|
|
|
|
{
|
|
|
|
|
var id = AuthUtil.GetCurrentUser().User.Id.ToString();
|
|
|
|
|
foreach (string one in _makerList.Split(','))
|
|
|
|
|
{
|
|
|
|
|
if (id == one || id.IndexOf(one) != -1)
|
|
|
|
|
{
|
|
|
|
|
_VerificationNodeId = item;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_VerificationNodeId != "")
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.nodeDictionary[_VerificationNodeId].name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><>ͬ<EFBFBD><CDAC>,<2C><>ע<EFBFBD><D7A2>" + description;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.nodeDictionary[_VerificationNodeId].name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>,<2C><>ע<EFBFBD><D7A2>" + description;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string _Confluenceres = wfruntime.NodeConfluence(_VerificationNodeId, flag, AuthUtil.GetCurrentUser().User.Id.ToString(), description);
|
|
|
|
|
var _data = new
|
|
|
|
|
{
|
|
|
|
|
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
|
|
|
|
frmData = wfruntime.runtimeModel.frmData
|
|
|
|
|
};
|
|
|
|
|
switch (_Confluenceres)
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
case "-1"://<2F><>ͨ<EFBFBD><CDA8>
|
|
|
|
|
FlowInstance.IsFinish = 3;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
break;
|
2018-03-12 23:44:05 +08:00
|
|
|
|
case "1"://<2F>ȴ<EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
break;
|
2018-03-12 23:44:05 +08:00
|
|
|
|
default://ͨ<><CDA8>
|
|
|
|
|
FlowInstance.PreviousId = FlowInstance.ActivityId;
|
|
|
|
|
FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
|
|
|
|
FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|
|
|
|
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
|
|
|
|
FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
|
|
|
|
|
FlowInstance.MakerList = (wfruntime.runtimeModel.nextNodeType == 4 ?"": GetMakerList(wfruntime) );//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
|
|
|
|
|
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
|
|
|
|
|
processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
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
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw (new Exception("<22><><EFBFBD><EFBFBD><EFBFBD>쳣,<2C>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽ڵ<CBBD>"));
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
#region һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
else//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 1, AuthUtil.GetCurrentUser().User.Id.ToString(), description);
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance.PreviousId = FlowInstance.ActivityId;
|
|
|
|
|
FlowInstance.ActivityId = wfruntime.runtimeModel.nextNodeId;
|
|
|
|
|
FlowInstance.ActivityType = wfruntime.runtimeModel.nextNodeType;//-1<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|
|
|
|
FlowInstance.ActivityName = wfruntime.runtimeModel.nextNode.name;
|
|
|
|
|
FlowInstance.MakerList = wfruntime.runtimeModel.nextNodeType == 4 ? "" : GetMakerList(wfruntime);//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
FlowInstance.IsFinish = (wfruntime.runtimeModel.nextNodeType == 4 ? 1 : 0);
|
|
|
|
|
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
|
|
|
|
|
|
|
|
|
|
processTransitionHistoryEntity = new FlowInstanceTransitionHistory
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
FromNodeId = wfruntime.runtimeModel.currentNodeId,
|
|
|
|
|
FromNodeName = wfruntime.runtimeModel.currentNode.name.Value,
|
|
|
|
|
FromNodeType = wfruntime.runtimeModel.currentNodeType,
|
|
|
|
|
ToNodeId = wfruntime.runtimeModel.nextNodeId,
|
|
|
|
|
ToNodeName = wfruntime.runtimeModel.nextNode.name.Value,
|
|
|
|
|
ToNodeType = wfruntime.runtimeModel.nextNodeType,
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.currentNode.name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><>ͬ<EFBFBD><CDAC>,<2C><>ע<EFBFBD><D7A2>" + description;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance.IsFinish = 3; //<2F><>ʾ<EFBFBD>ýڵ㲻ͬ<E3B2BB><CDAC>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, -1, AuthUtil.GetUserName(), description);
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.currentNode.name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC>,<2C><>ע<EFBFBD><D7A2>" + description;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
var data = new
|
|
|
|
|
{
|
|
|
|
|
SchemeContent = wfruntime.runtimeModel.schemeContentJson.ToString(),
|
|
|
|
|
frmData = wfruntime.runtimeModel.frmData
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
_res = true;
|
2018-03-16 17:33:54 +08:00
|
|
|
|
SaveProcess(_sqlstr, _dbbaseId, FlowInstance, FlowInstanceOperationHistory, processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return _res;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="processId"></param>
|
|
|
|
|
/// <param name="nodeId"></param>
|
|
|
|
|
/// <param name="description"></param>
|
|
|
|
|
/// <returns></returns>
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public bool NodeReject(string processId, string nodeId, string description = "")
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance FlowInstance = GetEntity(processId);
|
|
|
|
|
FlowInstanceOperationHistory FlowInstanceOperationHistory = new FlowInstanceOperationHistory();
|
|
|
|
|
FlowInstanceTransitionHistory processTransitionHistoryEntity = null;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
WF_RuntimeInitModel wfRuntimeInitModel = new WF_RuntimeInitModel()
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
currentNodeId = FlowInstance.ActivityId,
|
|
|
|
|
previousId = FlowInstance.PreviousId,
|
2017-03-24 15:35:52 +08:00
|
|
|
|
processId = processId
|
|
|
|
|
};
|
2018-03-20 17:40:50 +08:00
|
|
|
|
WF_Runtime wfruntime = new WF_Runtime(wfRuntimeInitModel);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string resnode = "";
|
|
|
|
|
if (nodeId == "")
|
|
|
|
|
{
|
|
|
|
|
resnode = wfruntime.RejectNode();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
resnode = nodeId;
|
|
|
|
|
}
|
|
|
|
|
wfruntime.MakeTagNode(wfruntime.runtimeModel.currentNodeId, 0, AuthUtil.GetUserName(), description);
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance.IsFinish = 4;//4<><34>ʾ<EFBFBD><CABE><EFBFBD>أ<EFBFBD><D8A3><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
if (resnode != "")
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstance.PreviousId = FlowInstance.ActivityId;
|
|
|
|
|
FlowInstance.ActivityId = resnode;
|
|
|
|
|
FlowInstance.ActivityType = wfruntime.GetNodeStatus(resnode);//-1<><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>,0<><30>ǩ<EFBFBD><C7A9>ʼ,1<><31>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>,2һ<32><D2BB><EFBFBD>ڵ<EFBFBD>,4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|
|
|
|
FlowInstance.ActivityName = wfruntime.runtimeModel.nodeDictionary[resnode].name;
|
|
|
|
|
FlowInstance.MakerList = GetMakerList(wfruntime.runtimeModel.nodeDictionary[resnode], FlowInstance.PreviousId);//<2F><>ǰ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ִ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
#region <EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>¼
|
|
|
|
|
processTransitionHistoryEntity = new FlowInstanceTransitionHistory();
|
2017-03-24 15:35:52 +08:00
|
|
|
|
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(),
|
2018-03-12 23:44:05 +08:00
|
|
|
|
frmData = (FlowInstance.FrmType == 0 ? wfruntime.runtimeModel.frmData : null)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
};
|
2018-03-12 23:44:05 +08:00
|
|
|
|
FlowInstanceOperationHistory.Content = "<22><>" + "todo name" + "<22><><EFBFBD><EFBFBD>" + wfruntime.runtimeModel.currentNode.name + "<22><><EFBFBD><EFBFBD>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><>ע<EFBFBD><D7A2>" + description;
|
2017-03-24 15:35:52 +08:00
|
|
|
|
|
2018-03-16 17:33:54 +08:00
|
|
|
|
SaveProcess(FlowInstance, FlowInstanceOperationHistory, processTransitionHistoryEntity);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// Ѱ<>Ҹýڵ<C3BD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="wfruntime"></param>
|
|
|
|
|
/// <returns></returns>
|
2018-03-20 17:40:50 +08:00
|
|
|
|
private string GetMakerList(WF_Runtime wfruntime)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string makerList = "";
|
|
|
|
|
if (wfruntime.runtimeModel.nextNodeId == "-1")
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw (new Exception("<22><EFBFBD>Ѱ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ڵ<EFBFBD>"));
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
if (wfruntime.runtimeModel.nextNodeType == 0)//<2F><><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD>ǩ<EFBFBD>ڵ<EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
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")
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw (new Exception("<22><EFBFBD>Ѱ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>ǩ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"));
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else if (_makerList == "1")
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw (new Exception("<22><>ǩ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"));
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (makerList != "")
|
|
|
|
|
{
|
|
|
|
|
makerList += ",";
|
|
|
|
|
}
|
|
|
|
|
makerList += _makerList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
makerList = GetMakerList(wfruntime.runtimeModel.nextNode, wfruntime.runtimeModel.processId);
|
|
|
|
|
if (makerList == "-1")
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
throw (new Exception("<22><EFBFBD>Ѱ<EFBFBD>ҵ<EFBFBD><D2B5>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"));
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return makerList;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// Ѱ<>Ҹýڵ<C3BD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="node"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private string GetMakerList(dynamic node, string processId)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string makerlsit = "";
|
|
|
|
|
|
|
|
|
|
if (node.setInfo == null)
|
|
|
|
|
{
|
|
|
|
|
makerlsit = "-1";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
if (node.setInfo.NodeDesignate.Value == "NodeDesignateType1")//<2F><><EFBFBD>г<EFBFBD>Ա
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
makerlsit = "1";
|
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType2")//ָ<><D6B8><EFBFBD><EFBFBD>Ա
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
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";
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType3")//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쵼
|
2017-03-24 15:35:52 +08:00
|
|
|
|
//{
|
|
|
|
|
// UserEntity userEntity = userService.GetEntity(OperatorProvider.Provider.Current().UserId);
|
|
|
|
|
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
|
|
|
|
// {
|
|
|
|
|
// makerlsit = "-1";
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// makerlsit = userEntity.ManagerId;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType4")//ǰһ<C7B0><D2BB><EFBFBD><EFBFBD><EFBFBD>쵼
|
2017-03-24 15:35:52 +08:00
|
|
|
|
//{
|
2018-03-12 23:44:05 +08:00
|
|
|
|
// FlowInstanceTransitionHistory transitionHistoryEntity = FlowInstanceTransitionHistoryService.GetEntity(processId, node.id.Value);
|
2017-03-24 15:35:52 +08:00
|
|
|
|
// UserEntity userEntity = userService.GetEntity(transitionHistoryEntity.CreateUserId);
|
|
|
|
|
// if (string.IsNullOrEmpty(userEntity.ManagerId))
|
|
|
|
|
// {
|
|
|
|
|
// makerlsit = "-1";
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// makerlsit = userEntity.ManagerId;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType5")//<2F><><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD><EFBFBD>쵼
|
2017-03-24 15:35:52 +08:00
|
|
|
|
//{
|
|
|
|
|
// 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;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//else if (node.setInfo.NodeDesignate.Value == "NodeDesignateType6")//<2F><><EFBFBD><EFBFBD><EFBFBD>߹<EFBFBD>˾<EFBFBD>쵼
|
2017-03-24 15:35:52 +08:00
|
|
|
|
//{
|
|
|
|
|
// 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>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2018-03-12 23:44:05 +08:00
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// <para><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2017-01-20 15:44:45</para>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="processId">The process identifier.</param>
|
|
|
|
|
/// <param name="verificationData">The verification data.</param>
|
2017-10-11 16:19:34 +08:00
|
|
|
|
public void VerificationProcess(string processId, string verificationData)
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
dynamic verificationDataJson = verificationData.ToJson();
|
|
|
|
|
|
2018-03-12 23:44:05 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
if (verificationDataJson.VerificationFinally.Value == "3")
|
|
|
|
|
{
|
|
|
|
|
string _nodeId = "";
|
|
|
|
|
if (verificationDataJson.NodeRejectStep != null)
|
|
|
|
|
{
|
|
|
|
|
_nodeId = verificationDataJson.NodeRejectStep.Value;
|
|
|
|
|
}
|
|
|
|
|
NodeReject(processId, _nodeId, verificationDataJson.VerificationOpinion.Value);
|
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
else if (verificationDataJson.VerificationFinally.Value == "2")//<2F><>ʾ<EFBFBD><CABE>ͬ<EFBFBD><CDAC>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
NodeVerification(processId, false, verificationDataJson.VerificationOpinion.Value);
|
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
else if (verificationDataJson.VerificationFinally.Value == "1")//<2F><>ʾͬ<CABE><CDAC>
|
2017-03-24 15:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
NodeVerification(processId, true, verificationDataJson.VerificationOpinion.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-12 23:44:05 +08:00
|
|
|
|
|
|
|
|
|
|
2018-03-20 17:40:50 +08:00
|
|
|
|
public void Add(FlowInstance instance)
|
2018-03-12 23:44:05 +08:00
|
|
|
|
{
|
2018-03-20 17:40:50 +08:00
|
|
|
|
Repository.Add(instance);
|
2018-03-12 23:44:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(FlowInstance flowScheme)
|
|
|
|
|
{
|
|
|
|
|
Repository.Update(u => u.Id == flowScheme.Id, u => new FlowInstance
|
|
|
|
|
{
|
|
|
|
|
//todo:Ҫ<>ĵ<DEB8>
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TableData Load(QueryFlowInstanceListReq request)
|
|
|
|
|
{
|
|
|
|
|
//todo:<3A><><EFBFBD><EFBFBD>/<2F>Ѱ<EFBFBD>/<2F>ҵ<EFBFBD>
|
|
|
|
|
var result = new TableData();
|
|
|
|
|
|
|
|
|
|
result.count = UnitWork.Find<FlowInstance>(u => u.CreateUserId == request.userid).Count();
|
|
|
|
|
if (request.type == "inbox") //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
result.data = UnitWork.Find<FlowInstance>(request.page, request.limit, "CreateDate descending", null).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (request.type == "outbox") //<2F>Ѱ<EFBFBD><D1B0><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
result.data = UnitWork.Find<FlowInstance>(request.page, request.limit, "CreateDate descending", null).ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else //<2F>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
result.data = UnitWork.Find<FlowInstance>(request.page, request.limit, "CreateDate descending", null).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2017-03-24 15:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|