/// <summary> /// 流程实例返元的处理方法 /// </summary> /// <param name="strID">实例流程的编号</param> /// <returns></returns> protected bool WFOperateGoStart(string strID) { //具有返元权限的操作人员可以做 TWfInstTaskDetailLogic instTaskLogic = new TWfInstTaskDetailLogic(); List <TWfInstTaskDetailVo> taskInstList = instTaskLogic.SelectByObject(new TWfInstTaskDetailVo() { WF_INST_ID = strID }, 0, 100); //如果指定的流程无实际的节点,则返回 if (taskInstList.Count < 1) { return(false); } TWfInstTaskDetailVo taskInstFirst = taskInstList[0]; TWfInstTaskDetailVo taskInstLast = taskInstList[taskInstList.Count - 1]; List <TWfSettingTaskVo> taskSettingList = new TWfSettingTaskLogic().SelectByObjectListForSetp(new TWfSettingTaskVo() { WF_ID = taskInstFirst.WF_ID }); TWfInstControlVo wfInst = new TWfInstControlLogic().Details(taskInstFirst.WF_INST_ID); //如果配置信息没有任何节点,则返回 if (taskSettingList.Count < 1) { return(false); } TWfInstTaskDetailVo taskNew = new TWfInstTaskDetailVo(); taskNew.ID = this.GetGUID(); taskNew.INST_NOTE = taskSettingList[0].TASK_NOTE; taskNew.INST_TASK_CAPTION = taskSettingList[0].TASK_CAPTION; taskNew.INST_TASK_STARTTIME = this.GetDateTimeToStanString(); taskNew.INST_TASK_STATE = TWfCommDict.StepState.StateNormal; taskNew.OBJECT_USER = taskInstFirst.OBJECT_USER; //使用上环节的目标处理人 taskNew.PRE_INST_TASK_ID = taskInstLast.ID; //上一个环节的编号,将成为本环节的上环节编号 //返元的所有新节点的前一个节点肯定是空的,直接置空即可 //taskNew.PRE_TASK_ID = i3.ValueObject.ConstValues.SpecialCharacter.EmptyValuesFillChar; taskNew.WF_ID = taskSettingList[0].WF_ID; taskNew.WF_INST_ID = taskInstFirst.WF_INST_ID; taskNew.WF_SERIAL_NO = taskInstFirst.WF_SERIAL_NO; taskNew.WF_TASK_ID = taskSettingList[0].ID; //将原环节表的标志位更新为完成 taskInstLast.INST_TASK_ENDTIME = this.GetDateTimeToStanString(); taskInstLast.INST_TASK_STATE = TWfCommDict.StepState.StateDown; taskInstLast.INST_TASK_DEAL_STATE = TWfCommDict.StepDealState.ForToZero; taskInstLast.REAL_USER = (this.Page as PageBase).LogInfo.UserInfo.ID; //环节表更新完毕,接着更新控制表 //更新控制表信息 //退回时要把附件和评论信息放入数据库,业务数据也要全部退回 //写入流程产生的新数据 instTaskLogic.Create(taskNew); instTaskLogic.Edit(new TWfInstTaskDetailVo() { ID = taskInstLast.ID, INST_TASK_ENDTIME = taskInstLast.INST_TASK_ENDTIME, INST_TASK_STATE = taskInstLast.INST_TASK_STATE, INST_TASK_DEAL_STATE = taskInstLast.INST_TASK_DEAL_STATE, REAL_USER = taskInstLast.REAL_USER }); TWfInstControlLogic instWFLogic = new TWfInstControlLogic(); instWFLogic.Edit(new TWfInstControlVo() { ID = wfInst.ID, WF_INST_TASK_ID = taskNew.ID, WF_TASK_ID = taskNew.WF_TASK_ID }); //附件和评论都无效 //业务数据直接copy第一个节点时的数据即可 TWfInstTaskServiceLogic serviceLogic = new TWfInstTaskServiceLogic(); List <TWfInstTaskServiceVo> serviceList = new List <TWfInstTaskServiceVo>(); List <TWfInstTaskServiceVo> serviceOldList = new TWfInstTaskServiceLogic().SelectByObject(new TWfInstTaskServiceVo() { WF_INST_ID = taskInstFirst.WF_INST_ID, WF_INST_TASK_ID = taskInstFirst.ID }, 0, 100); if (null != serviceOldList) { foreach (TWfInstTaskServiceVo service in serviceOldList) { //增加ID,流程实例编号、环节实例编号等内容,业务代码,Key和Value由业务系统自己处理 TWfInstTaskServiceVo stemp = new TWfInstTaskServiceVo(); stemp.ID = this.GetGUID(); stemp.WF_INST_ID = wfInst.ID; stemp.WF_INST_TASK_ID = taskNew.ID; stemp.SERVICE_NAME = service.SERVICE_NAME; stemp.SERVICE_KEY_NAME = service.SERVICE_KEY_NAME; stemp.SERVICE_KEY_VALUE = service.SERVICE_KEY_VALUE; stemp.SERVICE_ROW_SIGN = service.SERVICE_ROW_SIGN; serviceList.Add(stemp); } } foreach (TWfInstTaskServiceVo serviceTemp in serviceList) { serviceLogic.Create(serviceTemp); } return(true); }