public static void SetWorkflowByStep(WF_WORKFLOW_INST row, StepConfig stepConfig) { DateTime now = DateTime.Now; SetWorkflowByStep(row, stepConfig.Name, stepConfig.DisplayName, now, (int)stepConfig.StepType, (int)StepState.NotReceive, now); }
protected WorkflowException(StepConfig stepConfig, ErrorConfig errorConfig, string message, Exception innerException) : base(message, innerException) { StepConfig = stepConfig; ErrorConfig = errorConfig; }
public void BeginStepExecute(StepConfig stepConfig, int priority, string workflowName, WorkflowContent content, IUnitOfData context) { StringBuilder sb = new StringBuilder(); content.SaveStringBuilder(sb); // throw new System.NotImplementedException(); WorkflowDbContext wfContent = context as WorkflowDbContext; //ATAW_WORKFLOWContext wfContent = context as ATAW_WORKFLOWContext; WF_WORKFLOW_INST inst = new WF_WORKFLOW_INST(); inst.WI_ID = wfContent.GetUniId(); inst.WI_CONTENT_XML = sb.ToString(); inst.WI_NAME = workflowName; wfContent.WF_WORKFLOW_INST.Add(inst); //步骤基本信息 StepUtil.SetWorkflowByStep(inst, stepConfig.Name, stepConfig.DisplayName, wfContent.Now, (int)stepConfig.StepType, (int)StepState.ProcessNotSend); inst.WI_INDEX = 1; inst.WI_PRIORITY = priority; //扩展信息 //父子流程 //主表控制 content.SetAllMainRow(wfContent, stepConfig, inst.WI_ID); }
public void SetMainRowStatus(IUnitOfData context, StepConfig stepConfig) { WorkflowDbContext wfContent = context as WorkflowDbContext; string sql = "UPDATE {0} SET " + " {1}_WF_STATUS = @WF_STATUS , " + " {1}_STEP_NAME = @STEP_NAME , " + " {1}_WF_TIME = @WF_TIME " + " WHERE FID = @FID"; sql = string.Format(sql, MainTableName, Prefix); wfContent.RegisterSqlCommand(sql, new SqlParameter[] { new SqlParameter("@WF_STATUS", stepConfig.DisplayName) { DbType = DbType.String }, new SqlParameter("@STEP_NAME", stepConfig.Name) { DbType = DbType.String }, new SqlParameter("@WF_TIME", wfContent.Now) { DbType = DbType.DateTime }, new SqlParameter("@FID", FID) { DbType = DbType.String }, } ); }
public static void SendStep(Workflow workflow, StepConfig nextStep, IUnitOfData source) { DateTime now = DateTime.Now; // = AtawIocContext.Current.FetchInstance<IUnitOfData>(); WorkflowDbContext dbContext = source as WorkflowDbContext; WF_WORKFLOW_INST workflowRow = workflow.WorkflowRow; WorkflowContent content = WorkflowInstUtil.CreateContent(workflowRow); using (dbContext) { //拷贝新步骤 WF_STEP_INST stepRow = new WF_STEP_INST(); (source as WorkflowDbContext).WF_STEP_INST.Add(stepRow); CopyWorkflowToStep(dbContext, workflowRow, stepRow, FlowAction.Flow); //人工步骤的处理 bool isManual = workflow.CurrentStep.Config.StepType == StepType.Manual; if (isManual) { CopyManualInfo(workflow.WorkflowRow, stepRow); } //更新工作流实例 workflowRow.WI_INDEX = workflowRow.WI_INDEX.Value <int>() + 1; if (isManual) { workflowRow.WI_LAST_MANUAL = workflowRow.WI_CURRENT_STEP; workflowRow.WI_LAST_MANUAL_NAME = workflowRow.WI_CURRENT_STEP_NAME; //更新参与人列表 string refIds = workflowRow.WI_REF_LIST; QuoteIdList ulRef = QuoteIdList.LoadFromString(refIds); string receiveId = workflowRow.WI_RECEIVE_ID; string sendId = workflowRow.WI_SEND_ID; string processId = workflowRow.WI_PROCESS_ID; ulRef.Add(receiveId); ulRef.Add(sendId); ulRef.Add(processId); int outInt; workflowRow.WI_REF_LIST = ulRef.ToString(out outInt); //接收人 处理人 重新置为空 workflowRow.WI_RECEIVE_ID = ""; workflowRow.WI_LAST_PROCESS_ID = workflowRow.WI_PROCESS_ID; workflowRow.WI_PROCESS_ID = ""; workflowRow.WI_RECEIVE_LIST = ""; //清空超时和提醒标识 if (workflowRow.WI_IS_TIMEOUT.Value <bool>() == true) { workflowRow.WI_IS_TIMEOUT = false; } //清空错误处理信息 WI_ERROR_TYPE WI_MAX_RETRY_TIMES WI_RETRY_TIMES WI_NEXT_EXE_DATE WorkflowInstUtil.ClearError(workflowRow); } //更新主表信息 SetWorkflowByStep(source, workflowRow, nextStep); content.SetMainRowStatus(source, nextStep); dbContext.Submit(); } // IUnitOfData dbContext = AtawIocContext.Current.FetchInstance<IUnitOfData>(); //ATAW_WORKFLOWContext context = dbContext as ATAW_WORKFLOWContext; //拷贝新步骤 //WF_STEP_INST stepRow = new WF_STEP_INST(); }
//public static void FinishStep(Workflow workflow, WorkflowContent content, EndStepConfig config, // IUnitOfData source, BaseProcessor processor) //{ // FinishType finishType = FinishType.Normal; // if (config.EnableModify) // { // finishType = FinishType.ModifiedNormal; // } // FinishData result = FinishStep(workflow, finishType, // workflow.WorkflowRow["WI_PROCESS_ID"], content); // source.Submit(); //} public static void SetWorkflowByStep(IUnitOfData source, WF_WORKFLOW_INST workflowRow, StepConfig nextStep) { workflowRow.WI_LAST_STEP = workflowRow.WI_CURRENT_STEP; workflowRow.WI_LAST_STEP_NAME = workflowRow.WI_CURRENT_STEP_NAME; WorkflowInstUtil.SetWorkflowByStep(workflowRow, nextStep); nextStep.Prepare(workflowRow, source); }
protected static bool SendStep(Workflow workflow, StepConfig nextConfig) { Step step = workflow.CurrentStep; bool result = step.SendStep(nextConfig); Step nextStep = nextConfig.CreateStep(workflow); workflow.UpdateStep(nextStep); State nextState = nextStep.GetState(StepState.NotReceive); workflow.UpdateState(nextState); return(result); }
private Workflow(string workflowId, IUnitOfData workflowSource) : this(workflowSource) { //Source = workflowSource; WorkflowDbContext dbContext = workflowSource as WorkflowDbContext; WF_WORKFLOW_INST row = dbContext.WF_WORKFLOW_INST.FirstOrDefault(a => a.WI_ID == workflowId); AtawDebug.AssertNotNull(row, "该流程已处理或异常,请进历史页面查看", this); WorkflowId = row.WI_ID; WorkflowRow = row; Config = WorkflowConfig.GetByName(row.WI_WD_NAME, workflowSource); //WorkflowConfig.ConnString = StepConfig stepConfig = Config.Steps[row.WI_CURRENT_STEP]; if (stepConfig != null) { CurrentStep = stepConfig.CreateStep(this); CurrentState = CurrentStep.GetState(row.WI_STATUS.Value <StepState>()); } else { throw new AtawException("不存在的步骤" + row.WI_CURRENT_STEP, this); } }
public bool Back(string backStepName) { ManualStepConfig manualConfig = Config as ManualStepConfig; // var backStepName = string.Empty; if (manualConfig.HaveBack) { if (backStepName.IsAkEmpty()) { // 否则退到上一人工步骤,如果没有则报错 backStepName = WorkflowRow.WI_LAST_MANUAL; } AtawDebug.AssertNotNullOrEmpty(backStepName, string.Format(ObjectUtil.SysCulture, "人工步骤{0}没有可以回退的上一个人工步骤", manualConfig.Name), this); } StepConfig backStep = Config.Parent.Steps[backStepName]; AtawDebug.AssertArgumentNull(backStep, string.Format(ObjectUtil.SysCulture, "指定的人工步骤{0} 不存在", backStepName), this); return(StepUtil.BackStep(Workflow, backStep)); }
public static bool BackStep(Workflow workflow, StepConfig backStep) { var workflowRow = workflow.WorkflowRow; var source = workflow.Source as WorkflowDbContext; var stepInst = GetBackStep(workflow, backStep); var newStepInst = new WF_STEP_INST(); source.WF_STEP_INST.Add(newStepInst); CopyWorkflowToStep(source, workflow.WorkflowRow, newStepInst, FlowAction.Back); CopyManualInfo(workflow.WorkflowRow, newStepInst); //回退步骤 修改接收人列表 和 接收人个数 //从步骤实例表中查询上次接收的人 workflowRow.WI_INDEX = stepInst.SI_INDEX; workflowRow.WI_RECEIVE_ID = stepInst.SI_RECEIVE_ID;//上次接收的人 workflowRow.WI_RECEIVE_LIST = QuoteIdList.GetQuoteId(stepInst.SI_RECEIVE_ID); workflowRow.WI_RECEIVE_COUNT = 1; workflowRow.WI_SEND_ID = GlobalVariable.UserId.ToString(); workflowRow.WI_SEND_DATE = source.Now; workflowRow.WI_LAST_MANUAL = stepInst.SI_LAST_MANUAL; workflowRow.WI_LAST_MANUAL_NAME = stepInst.SI_LAST_MANUAL_NAME; workflowRow.WI_LAST_STEP = stepInst.SI_LAST_STEP; workflowRow.WI_LAST_STEP_NAME = stepInst.SI_LAST_STEP_NAME; workflowRow.WI_CURRENT_CREATE_DATE = DateTime.Now; // stepInst.SI_VALID_FLAG = 1; WorkflowInstUtil.ClearError(workflowRow); WorkflowInstUtil.SetWorkflowByStep(workflowRow, backStep); WorkflowContent workflowContent = WorkflowInstUtil.CreateContent(workflow.WorkflowRow); workflowContent.SetMainRowStatus(source, backStep); backStep.Prepare(workflowRow, source); source.Submit(); return(true); }
public RouteStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
public override bool Execute(Workflow workflow) { StepConfig nextConfig = workflow.CurrentStep.Config.NextSteps.First(); return(SendStep(workflow, nextConfig)); }
public AutoStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
protected WorkflowException(StepConfig stepConfig, ErrorConfig errorConfig) { StepConfig = stepConfig; ErrorConfig = errorConfig; }
/// <summary> /// Initializes a new instance of the PlugInException class. /// </summary> public PlugInException(StepConfig stepConfig, ErrorConfig errorConfig, Exception innerException) : base(stepConfig, errorConfig, "插件计算错误", innerException) { }
public EndStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
public void AddNextConfig(StepConfig config, int fromX, int fromY, int toX, int toY) { config.PrevStepName.Add(Name); NextStepNames.Add(new StepConnectionConfig(config.Name, fromX, fromY, toX, toY)); }
public void AddNextConfig(StepConfig config) { AddNextConfig(config, 0, 0, 0, 0); }
protected Step(Workflow workflow, StepConfig config) { fWorkflow = workflow; Config = config; }
public bool SendStep(StepConfig nextStep) { Send(nextStep); ClearDataSet(); return(true); }
protected abstract void Send(StepConfig nextStep);
public MergeStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
protected override void Send(StepConfig nextStep) { StepUtil.SendStep(Workflow, nextStep, Source); }
//private void SaveWorkflowInst() //{ // WorkflowResolver.SetCommands(AdapterCommand.Update); // UpdateUtil.UpdateTableResolvers(Source.Context, null, WorkflowResolver); //} //public bool IsTimeout //{ // get // { // ManualStepConfig manualConfig = Config as ManualStepConfig; // bool isTimeout = TimeLimitConfig.IsTimeOut(manualConfig.TimeLimiter, // Source.Context, WorkflowRow, "WI_CURRENT_CREATE_DATE"); // if (!isTimeout) // isTimeout = TimeLimitConfig.IsTimeOut(Workflow.Config.TimeLimiter, // Source.Context, WorkflowRow, "WI_CREATE_DATE"); // return isTimeout; // } //} protected override void Send(StepConfig nextStep) { //if (IsTimeout) // WorkflowRow["WI_IS_TIMEOUT"] = true; StepUtil.SendStep(Workflow, nextStep, Source); }
public BeginStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
public ManualStep(Workflow workflow, StepConfig config) : base(workflow, config) { }
/// <summary> /// Initializes a new instance of the NoActorException class. /// </summary> public NoActorException(StepConfig stepConfig, ErrorConfig errorConfig) : base(stepConfig, errorConfig) { }
protected override void Send(StepConfig nextStep) { AtawDebug.ThrowAtawException(string.Format(ObjectUtil.SysCulture, "工作流{1}的结束步骤{0}没有Send操作", Config.Parent.Name, Config.Name), this); }
private static WF_STEP_INST GetBackStep(Workflow workflow, StepConfig nextStep) { var context = workflow.Source as WorkflowDbContext; return(context.WF_STEP_INST.Where(m => m.SI_WI_ID == workflow.WorkflowRow.WI_ID).OrderBy(m => m.SI_INDEX).FirstOrDefault(m => m.SI_CURRENT_STEP == nextStep.Name)); }
public NoActorException(StepConfig stepConfig, ErrorConfig errorConfig, Exception innerException) : base(stepConfig, errorConfig, "没有找到下一步骤的操作者", innerException) { }