/// <summary> /// 打开手机端 /// </summary> /// <returns></returns> public string Do_OpenFlow() { string sid = this.GetRequestVal("SID"); string[] strs = sid.Split('_'); GenerWorkerList wl = new GenerWorkerList(); int i = wl.Retrieve(GenerWorkerListAttr.FK_Emp, strs[0], GenerWorkerListAttr.WorkID, strs[1], GenerWorkerListAttr.IsPass, 0); if (i == 0) { return("err@提示:此工作已经被别人处理或者此流程已删除。"); } BP.Port.Emp empOF = new BP.Port.Emp(wl.FK_Emp); Web.WebUser.SignInOfGener(empOF); return("MyFlow.htm?FK_Flow=" + wl.FK_Flow + "&WorkID=" + wl.WorkID + "&FK_Node=" + wl.FK_Node + "&FID=" + wl.FID); }
public void InitNodeIsCurr() { // 获取. Node nd = new Node(this.CurrNodeIDOfFlow); if (nd.IsStartNode) { /* 开始节点允许删除流程 */ this.Btn_DelFlow = true; this.Btn_Send = true; this.Btn_Save = true; return; } #region 判断是否可以撤销发送. WorkNode wn = new WorkNode(this.WorkID, this.CurrNodeIDOfFlow); WorkNode wnPri = wn.GetPreviousWorkNode(); // 判断它是否可以处理上一步工作. GenerWorkerList wl = new GenerWorkerList(); int num = wl.Retrieve(GenerWorkerListAttr.FK_Emp, BP.Web.WebUser.No, GenerWorkerListAttr.FK_Node, wnPri.HisNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID); if (num >= 1) { /*如果能够处理上一步工作*/ } else { /*不能处理上一步工作, 就可以让其退回*/ this.Btn_Return = nd.IsCanReturn; this.Btn_Send = true; this.Btn_Save = true; } #endregion }
/// <summary> /// 说明 :此测试针对于演示环境中的 001 流程编写的单元测试代码。 /// 涉及到了: 创建,发送,撤销,方向条件、退回等功能。 /// </summary> public override void Do() { string fk_flow = "001"; string userNo = "zhoutianjiao"; Flow fl = new Flow(fk_flow); // zhoutianjiao 登录. BP.WF.Dev2Interface.Port_Login(userNo); //创建空白工作, 发起开始节点. Int64 workid = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow); #region 检查发起流程后的数据是否完整? //检查创建这个空白是否有数据完整? sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workid; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@发起流程出错误,不应该找不到报表数据."); } //检查节点表单表是否有数据? sql = "SELECT * FROM ND101 WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@不应该在开始节点表单表中找不到数据,"); } #endregion 检查发起流程后的数据是否完整? //执行发送,并获取发送对象,. SendReturnObjs objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid); #region 检查发送对象返回的信息是否完整? //从获取的发送对象里获取到下一个工作者. string nextUser = objs.VarAcceptersID; if (nextUser != "qifenglin") { throw new Exception(WebUser.No + "启动财务报销流程,下一步的接受人不正确, 应该是qifenglin,他是部门的负责人.现在是:" + nextUser); } if (objs.VarToNodeID != 102) { throw new Exception(WebUser.No + "启动财务报销流程,下一步的节点, 应该是102.现在是:" + objs.VarToNodeID); } //检查节点表单表是否有数据? sql = "SELECT * FROM ND102 WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@不应该在部门经理审批表节点表单表中找不到数据,"); } #endregion 检查发送对象返回的信息是否完整? //检查开始节点的执行撤销是否可用? string info = BP.WF.Dev2Interface.Flow_DoUnSend(fk_flow, workid); #region 检查撤销发送是否符合预期. //检查节点表单表是否有数据? sql = "SELECT * FROM ND102 WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 1) { throw new Exception("@已经撤销了,当前节点表单数据也应该删除,但是ccflow没有删除它。"); } //查询流程注册表. GenerWorkFlow gwf = new GenerWorkFlow(); gwf.WorkID = workid; gwf.RetrieveFromDBSources(); if (gwf.FK_Node != fl.StartNodeID) { throw new Exception("@撤销发送后的数据不符合预期: 没有停留到开始节点上,而是停留在了:" + gwf.FK_Node); } GenerWorkerList gwl = new GenerWorkerList(); gwl.FK_Emp = WebUser.No; gwl.FK_Node = fl.StartNodeID; gwl.WorkID = workid; gwl.Retrieve(); if (gwl.IsPass == true) { throw new Exception("@撤销发送后的数据不符合预期: 当前的操作人员的停留状态应该是未发送,现在是已发送."); } //检查qifenglin的待办工作是否还存在. gwl = new GenerWorkerList(); gwl.FK_Emp = nextUser; gwl.FK_Node = fl.StartNodeID; gwl.WorkID = workid; if (gwl.RetrieveFromDBSources() != 0) { throw new Exception("@撤销发送后的数据不符合预期: 撤销后的接受人的待办工作不应该存在."); } //通检查数据符合预期结果。 BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid); #endregion 检查撤销发送是否符合预期 // 让qifenglin 登录. BP.WF.Dev2Interface.Port_Login(nextUser); //按小于.HeJiFeiYong < 10000 时向下发送。 Hashtable ht = new Hashtable(); ht.Add("HeJiFeiYong", 900); objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid, ht); #region 检查 HeJiFeiYong < 1000 向下发送时是否发送到财务部门上去了。 //检查节点表单表是否有数据? sql = "SELECT HeJiFeiYong FROM ND102 WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@没有找到节点2的数据。"); } int je = int.Parse(dt.Rows[0][0].ToString()); if (je != 900) { throw new Exception("@ht 数据没有传入到节点表里面去,注意如果是自动填充字段将不能写入里面。"); } if (objs.VarAcceptersID != "yangyilei") { throw new Exception("@当合计费用小于 10000 时,执行结果不符合预期. 应该提交给财务部经理yangyilei审批.现在是:" + objs.VarAcceptersID); } //检查yangyilei 是否有待办? sql = "SELECT FK_Emp FROM WF_EmpWorks WHERE WorkID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1 || dt.Rows[0][0].ToString() != objs.VarAcceptersID) { throw new Exception("@执行结果不符合预期: 应该只有一个待办并且是: yangyilei."); } //检查完毕执行撤销发送, 目的是检查当数据 大于1万的方向条件. BP.WF.Dev2Interface.Flow_DoUnSend(fk_flow, workid); //检查qifenglin 是否有待办? sql = "SELECT FK_Emp FROM WF_EmpWorks WHERE WorkID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1 || dt.Rows[0][0].ToString() != "qifenglin") { throw new Exception("@在节点2执行撤销时,数据不符合预期: qifenglin."); } #endregion //按小于.HeJiFeiYong > 10000 时向下发送。 ht = new Hashtable(); ht.Add("HeJiFeiYong", 990999); objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid, ht); #region 检查当合计费用大于10000 时,数据是否符合预期. if (objs.VarAcceptersID != "zhoupeng") { throw new Exception("@在节点2时,数据大于1万,方向条件不符合预期, 应该执行到zhoupeng 现在转入了:" + objs.VarAcceptersID); } //检查zhoupeng 是否有待办? sql = "SELECT FK_Emp FROM WF_EmpWorks WHERE WorkID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@在节点2时,数据大于1万,方向条件不符合预期, 应该执行到zhoupeng一个人, 现在查询的待办结果不对, 执行的查询sql:" + sql); } if (dt.Rows[0][0].ToString() != "zhoupeng") { throw new Exception("@在节点2时,数据大于1万,方向条件不符合预期, 应该是zhoupeng 执行的查询sql:" + sql); } // 检查是否转到了 103 节点上去了? gwf = new GenerWorkFlow(); gwf.WorkID = workid; gwf.RetrieveFromDBSources(); if (gwf.FK_Node != 103) { throw new Exception("@方向条件没有转入到 103上,目前转入到了:" + gwf.FK_Node); } sql = "SELECT HeJiFeiYong FROM ND103 WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@没有找到节点(总经理审批)的数据。"); } #endregion 检查当合计费用大于10000 时,数据是否符合预期. // 让zhoupeng 登录. BP.WF.Dev2Interface.Port_Login("zhoupeng"); //执行发送. objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid); #region 检查总经理审批节点发送后数据是否符合预期? if (objs.VarAcceptersID != "yangyilei") { throw new Exception("@应该发送到 yangyilei 但是没有发送给他."); } //检查qifenglin 是否有待办? sql = "SELECT FK_Emp FROM WF_EmpWorks WHERE WorkID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1 || dt.Rows[0][0].ToString() != "yangyilei") { throw new Exception("@应该发送到 yangyilei 但是没有发送给他."); } //检查报表数据是否完整? sql = "SELECT FlowEnder,FlowEndNode,FlowStarter,WFState,FID,FK_NY FROM ND1Rpt WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows[0]["FlowEnder"].ToString() != "zhoupeng") { throw new Exception("@应该是 zhoupeng 是 FlowEnder ."); } if (dt.Rows[0]["FlowStarter"].ToString() != "zhoutianjiao") { throw new Exception("@应该是 zhoutianjiao 是 FlowStarter ."); } if (dt.Rows[0]["FlowEndNode"].ToString() != "104") { throw new Exception("@应该是 104 是 FlowEndNode ."); } if (int.Parse(dt.Rows[0]["WFState"].ToString()) != (int)WFState.Runing) { throw new Exception("@应该是 WFState.Runing 是 WFState ."); } if (int.Parse(dt.Rows[0]["FID"].ToString()) != 0) { throw new Exception("@应该是 FID =0"); } if (dt.Rows[0]["FK_NY"].ToString() != DataType.CurrentYearMonth) { throw new Exception("@ FK_NY 字段填充错误. "); } #endregion 检查总经理审批节点发送后数据是否符合预期 // 让yangyilei 登录. BP.WF.Dev2Interface.Port_Login("yangyilei"); //执行发送, 这个是最后节点,它应该自动结束。 objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid); #region 检查结束节点是否符合预期? gwf = new GenerWorkFlow(); gwf.WorkID = workid; if (BP.WF.Glo.IsDeleteGenerWorkFlow == true && gwf.RetrieveFromDBSources() != 0) { throw new Exception("@ 流程结束后 WF_GenerWorkFlow 没有删除. "); } sql = "SELECT * FROM wf_GenerWorkerList WHERE WORKID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 0) { throw new Exception("@ 流程结束后 wf_GenerWorkerList 没有删除. "); } //检查报表数据是否完整? sql = "SELECT FlowEnder,FlowEndNode,FlowStarter,WFState,FID,FK_NY FROM ND1Rpt WHERE OID=" + workid; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows[0]["FlowEnder"].ToString() != "yangyilei") { throw new Exception("@应该是 yangyilei 是 FlowEnder ."); } if (dt.Rows[0]["FlowStarter"].ToString() != "zhoutianjiao") { throw new Exception("@应该是 zhoutianjiao 是 FlowStarter ."); } if (dt.Rows[0]["FlowEndNode"].ToString() != "104") { throw new Exception("@应该是 104 是 FlowEndNode ."); } if (int.Parse(dt.Rows[0]["WFState"].ToString()) != (int)WFState.Complete) { throw new Exception("@应该是 WFState.Complete 是 WFState ."); } if (int.Parse(dt.Rows[0]["FID"].ToString()) != 0) { throw new Exception("@应该是 FID =0"); } if (dt.Rows[0]["FK_NY"].ToString() != DataType.CurrentYearMonth) { throw new Exception("@ FK_NY 字段填充错误. "); } #endregion 检查结束节点是否符合预期 }
/// <summary> /// 步骤1 让zhanghaicheng 发起流程. /// </summary> public void Step1() { //给发起人赋值. starterEmp = new Port.Emp(userNo); //让 userNo 登录. BP.WF.Dev2Interface.Port_Login(userNo); //创建空白工作, 发起开始节点. workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null, WebUser.No, null, 0, null); #region 检查创建工作是否符合预期. //检查开始节点写入的数据是否正确? sql = "SELECT * FROM ND2301 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到开始节点的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误.现在的日期是:" + val); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误.现在的日期是:" + val); } break; case WorkAttr.Emps: if (val.Contains(WebUser.No) == false) { throw new Exception("应当包含当前人员,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MD5: //if (Glo.ism //if (val !="0") // throw new Exception("应当 = 0,现在是:"+val); break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != WebUser.No) { throw new Exception("应当 Rec= " + WebUser.No + ",现在是:" + val); } break; //case WorkAttr.Sender: // if (val != WebUser.No) // throw new Exception("应当 Sender= " + WebUser.No + ",现在是:" + val); // break; default: break; } } //检查流程表的数据. sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@流程报表数据被删除了."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case GERptAttr.FID: if (val != "0") { throw new Exception("@应当是0"); } break; case GERptAttr.FK_Dept: if (val != WebUser.FK_Dept) { throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val); } break; case GERptAttr.FK_NY: if (val != DataType.CurrentYearMonth) { throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val); } break; case GERptAttr.FlowDaySpan: if (val != "0") { throw new Exception("@应当是 0 , 现在是:" + val); } break; case GERptAttr.FlowEmps: if (val.Contains(WebUser.No) == false) { throw new Exception("@应当是包含当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnder: if (val != WebUser.No) { throw new Exception("@应当是 当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnderRDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("@应当是 当前日期, 现在是:" + val); } break; case GERptAttr.FlowEndNode: if (val != "2301") { throw new Exception("@应当是 2301, 现在是:" + val); } break; case GERptAttr.FlowStarter: if (val != WebUser.No) { throw new Exception("@应当是 WebUser.No, 现在是:" + val); } break; case GERptAttr.FlowStartRDT: if (string.IsNullOrEmpty(val)) { throw new Exception("@应当不能为空,现在是:" + val); } break; case GERptAttr.Title: if (string.IsNullOrEmpty(val)) { throw new Exception("@不能为空title" + val); } break; case GERptAttr.WFState: WFState sta = (WFState)int.Parse(val); if (sta != WFState.Blank) { throw new Exception("@应当是 WFState.Blank 现在是" + sta.ToString()); } break; default: break; } } #endregion 检查创建工作是否符合预期 //定义一个参数. Hashtable ht = new System.Collections.Hashtable(); ht.Add("GoTo", 1); ht.Add("MyPara", "TestPara"); //执行发送. objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workID, ht); #region 第1步: 检查发送对象. //从获取的发送对象里获取到下一个工作者. zhangyifan(张一帆)、zhoushengyu(周升雨). if (objs.VarAcceptersID != "zhoupeng") { throw new Exception("@下一步的接受人不正确, 应当是: zhoupeng.现在是:" + objs.VarAcceptersID); } if (objs.VarToNodeID != 2302) { throw new Exception("@应该是 2302 节点. 现在是:" + objs.VarToNodeID); } if (objs.VarWorkID != workID) { throw new Exception("@主线程的workid不应该变化:" + objs.VarWorkID); } if (objs.VarCurrNodeID != 2301) { throw new Exception("@当前节点的编号不能变化:" + objs.VarCurrNodeID); } if (objs.VarTreadWorkIDs != null) { throw new Exception("@不应当获得子线程WorkID."); } #endregion 第1步: 检查发送对象. #region 第2步: 检查流程引擎表. //检查创建这个空白是否有数据完整? sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID + " AND FK_Emp='" + objs.VarAcceptersID + "'"; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@不应该找不到当前人员的待办."); } gwf = new GenerWorkFlow(workID); if (gwf.Starter != WebUser.No || gwf.StarterName != WebUser.Name) { throw new Exception("没有写入发起人的信息."); } if (gwf.FK_Dept != starterEmp.FK_Dept) { throw new Exception("@发起人的部门有变化,应当是" + starterEmp.FK_Dept + ",现在是:" + gwf.FK_Dept); } if (gwf.Starter != starterEmp.No) { throw new Exception("@发起人的 No 有变化,应当是" + starterEmp.No + ",现在是:" + gwf.Starter); } //判断当前点. if (gwf.FK_Node != 2302) { throw new Exception("@当前点应该是 2302 现在是:" + gwf.FK_Node); } //判断当前点. if (gwf.FID != 0) { throw new Exception("@当前点应该是 FID=0 现在是:" + gwf.FID); } //判断PWorkID,没有谁调用它,应当是 0. if (gwf.PWorkID != 0) { throw new Exception("@没有谁调用它, 当前点应该是 PWorkID=0 现在是:" + gwf.PWorkID); } //判断 WFState . if (gwf.WFState != WFState.Runing) { throw new Exception("@应当是 WFState=Runing 现在是:" + gwf.WFState.ToString()); } //检查开始节点 发送人的WF_GenerWorkerList的. gwl = new GenerWorkerList(); gwl.CheckPhysicsTable(); gwl.FK_Emp = Web.WebUser.No; gwl.FK_Node = 2301; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == false) { throw new Exception("@应该是通过的状态 "); } if (gwl.Sender.Contains(WebUser.No) == false) { throw new Exception("@应该是 包含当前状态 . "); } if (gwl.Paras != "@MyPara=TestPara@GoTo=1") { throw new Exception("@参数应当是:@MyPara=TestPara@GoTo=1 .现在是:" + gwl.Paras); } //检查接受人的 WF_GenerWorkerList 的. gwl = new GenerWorkerList(); gwl.FK_Emp = objs.VarAcceptersID; gwl.FK_Node = 2302; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == true) { throw new Exception("@应该是未通过的状态 "); } if (gwl.Sender.Contains(WebUser.No) == false) { throw new Exception("@应该是 当前人发送的,现在是: " + gwl.Sender); } #endregion 第2步: 检查流程引擎表. #region 第3步: 检查节点数据表. sql = "SELECT * FROM ND2301 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到开始节点的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误."); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误."); } break; case WorkAttr.Emps: if (val.Contains(WebUser.No) == false) { throw new Exception("应当包含当前人员,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MD5: //if (Glo.ism //if (val !="0") // throw new Exception("应当 = 0,现在是:"+val); break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != WebUser.No) { throw new Exception("应当 Rec= " + WebUser.No + ",现在是:" + val); } break; //case WorkAttr.Sender: // if (val != WebUser.No) // throw new Exception("应当 Sender= " + WebUser.No + ",现在是:" + val); // break; default: break; } } //检查节点2的数据. sql = "SELECT * FROM ND2302 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到 ND2302 的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误."); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误."); } break; case WorkAttr.Emps: if (val.Contains("zhoupeng") == false) { throw new Exception("第二步骤的处理人员,应当zhoupeng ,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MD5: //if (Glo.ism //if (val !="0") // throw new Exception("应当 = 0,现在是:"+val); break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != "zhoupeng") { throw new Exception("应当 Rec= zhoupeng,现在是:" + val); } break; default: break; } } //检查流程表的数据. sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@流程报表数据被删除了."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case GERptAttr.FID: if (val != "0") { throw new Exception("@应当是0"); } break; case GERptAttr.FK_Dept: if (val != WebUser.FK_Dept) { throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val); } break; case GERptAttr.FK_NY: if (val != DataType.CurrentYearMonth) { throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val); } break; case GERptAttr.FlowDaySpan: if (val != "0") { throw new Exception("@应当是 0 , 现在是:" + val); } break; case GERptAttr.FlowEmps: if (val.Contains(WebUser.No) == false) { throw new Exception("@应当是包含当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnder: if (val != WebUser.No) { throw new Exception("@应当是 当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnderRDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("@应当是 当前日期, 现在是:" + val); } break; case GERptAttr.FlowEndNode: if (val != "2302") { throw new Exception("@应当是 2302, 现在是:" + val); } break; case GERptAttr.FlowStarter: if (val != WebUser.No) { throw new Exception("@应当是 WebUser.No, 现在是:" + val); } break; case GERptAttr.FlowStartRDT: if (string.IsNullOrEmpty(val)) { throw new Exception("@应当不能为空,现在是:" + val); } break; case GERptAttr.Title: if (string.IsNullOrEmpty(val)) { throw new Exception("@不能为空title" + val); } break; case GERptAttr.WFState: WFState sta = (WFState)int.Parse(val); if (sta != WFState.Runing) { throw new Exception("@应当是 WFState.Runing 现在是" + sta.ToString()); } break; default: break; } } #endregion 第3步: 检查节点数据表. }
/// <summary> /// 步骤1 让zhoupeng 登录去处理. /// </summary> public void Step2() { //让 zhouepng 登录. BP.WF.Dev2Interface.Port_Login("zhoupeng"); //让他向下发送. objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workID); #region 第1步: 检查发送对象. //从获取的发送对象里获取到下一个工作者. zhangyifan(张一帆)、zhoushengyu(周升雨). if (objs.VarAcceptersID != "zhanghaicheng") { throw new Exception("@下一步的接受人不正确, 应当是: zhanghaicheng.现在是:" + objs.VarAcceptersID); } if (objs.VarToNodeID != 2399) { throw new Exception("@应该是 2399 节点. 现在是:" + objs.VarToNodeID); } if (objs.VarWorkID != workID) { throw new Exception("@主线程的workid不应该变化:" + objs.VarWorkID); } if (objs.VarCurrNodeID != 2302) { throw new Exception("@当前节点的编号不能变化,现在是:" + objs.VarCurrNodeID); } if (objs.VarTreadWorkIDs != null) { throw new Exception("@不应当获得子线程WorkID."); } #endregion 第1步: 检查发送对象. #region 第2步: 检查流程引擎表. //检查待办是否存在。 sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID + " AND FK_Emp='" + objs.VarAcceptersID + "'"; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@不应该找不到当前人员的待办."); } gwf = new GenerWorkFlow(workID); if (gwf.FK_Dept != starterEmp.FK_Dept) { throw new Exception("@发起人的部门有变化,应当是" + starterEmp.FK_Dept + ",现在是:" + gwf.FK_Dept); } if (gwf.Starter != starterEmp.No) { throw new Exception("@发起人的 No 有变化,应当是" + starterEmp.No + ",现在是:" + gwf.Starter); } //判断当前点. if (gwf.FK_Node != 2399) { throw new Exception("@当前点应该是 2399 现在是:" + gwf.FK_Node); } //判断当前点. if (gwf.FID != 0) { throw new Exception("@当前点应该是 FID=0 现在是:" + gwf.FID); } //判断PWorkID,没有谁调用它,应当是 0. if (gwf.PWorkID != 0) { throw new Exception("@没有谁调用它, 当前点应该是 PWorkID=0 现在是:" + gwf.PWorkID); } //判断 WFState . if (gwf.WFState != WFState.Runing) { throw new Exception("@应当是 WFState=Runing 现在是:" + gwf.WFState.ToString()); } //检查开始节点 发送人的WF_GenerWorkerList 的. gwl = new GenerWorkerList(); gwl.FK_Emp = Web.WebUser.No; gwl.FK_Node = 2302; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == false) { throw new Exception("@应该是通过的状态 "); } if (gwl.Sender.Contains("zhanghaicheng") == false) { throw new Exception("@应该是 包含当前状态 . "); } //检查接受人的 WF_GenerWorkerList 的. gwl = new GenerWorkerList(); gwl.FK_Emp = objs.VarAcceptersID; gwl.FK_Node = 2399; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == true) { throw new Exception("@应该是未通过的状态 "); } if (gwl.Sender.Contains(WebUser.No) == false) { throw new Exception("@应该是 当前人发送的,现在是: " + gwl.Sender); } #endregion 第2步: 检查流程引擎表. #region 第3步: 检查节点数据表. sql = "SELECT * FROM ND2301 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到开始节点的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误."); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误."); } break; case WorkAttr.Emps: if (val.Contains("zhanghaicheng") == false) { throw new Exception("应当包含当前人员,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != objs.VarAcceptersID) { throw new Exception("应当 Rec=zhanghaicheng,现在是:" + val); } break; //case WorkAttr.Sender: // if (val != "zhanghaicheng") // throw new Exception("应当 Sender= zhanghaicheng,现在是:" + val); // break; default: break; } } //检查节点2的数据. sql = "SELECT * FROM ND2302 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到 ND2302 的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误."); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误."); } break; case WorkAttr.Emps: if (val.Contains(WebUser.No) == false) { throw new Exception("应当包含当前人员,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != "zhoupeng") { throw new Exception("应当 Rec= zhoupeng,现在是:" + val); } break; default: break; } } //检查节点3的数据. sql = "SELECT * FROM ND2399 WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@发起流程出错误,不应该找不到 ND2399 的数据."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case WorkAttr.CDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("CDT,日期错误."); } break; case WorkAttr.RDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("RDT,日期错误."); } break; case WorkAttr.Emps: if (val.Contains("zhanghaicheng") == false) { throw new Exception("应当包含当前人员,现在是:" + val); } break; case WorkAttr.FID: if (val != "0") { throw new Exception("应当 = 0,现在是:" + val); } break; case WorkAttr.MyNum: if (val != "1") { throw new Exception("应当 = 1,现在是:" + val); } break; case WorkAttr.Rec: if (val != objs.VarAcceptersID) { throw new Exception("应当 Rec= " + objs.VarAcceptersID + ",现在是:" + val); } break; //case WorkAttr.Sender: // if (val != WebUser.No) // throw new Exception("应当 Sender= " + WebUser.No + ",现在是:" + val); // break; default: break; } } //检查流程表的数据. sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@流程报表数据被删除了."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case GERptAttr.FID: if (val != "0") { throw new Exception("@应当是0"); } break; case GERptAttr.FK_Dept: BP.Port.Emp emp = new Port.Emp("zhanghaicheng"); if (val != emp.FK_Dept) { throw new Exception("@应当是" + emp.FK_Dept + ", 现在是:" + val); } break; case GERptAttr.FK_NY: if (val != DataType.CurrentYearMonth) { throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val); } break; case GERptAttr.FlowDaySpan: if (val != "0") { throw new Exception("@应当是 0 , 现在是:" + val); } break; case GERptAttr.FlowEmps: if (val.Contains(WebUser.No) == false) { throw new Exception("@应当是包含当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnder: if (val != WebUser.No) { throw new Exception("@应当是 当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnderRDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("@应当是 当前日期, 现在是:" + val); } break; case GERptAttr.FlowEndNode: if (val != "2399") { throw new Exception("@应当是 2399, 现在是:" + val); } break; case GERptAttr.FlowStarter: if (val == WebUser.No) { throw new Exception("@应当是 WebUser.No, 现在是:" + val); } break; case GERptAttr.FlowStartRDT: if (string.IsNullOrEmpty(val)) { throw new Exception("@应当不能为空,现在是:" + val); } break; case GERptAttr.Title: if (string.IsNullOrEmpty(val)) { throw new Exception("@不能为空title" + val); } break; case GERptAttr.WFState: if (int.Parse(val) != (int)WFState.Runing) { throw new Exception("@应当是 WFState.Runing 现在是" + val); } break; default: break; } } #endregion 第3步: 检查节点数据表. }
protected void Page_Load(object sender, System.EventArgs e) { Response.AddHeader("P3P", "CP=CAO PSA OUR"); Response.AddHeader("Cache-Control", "no-store"); Response.AddHeader("Expires", "0"); Response.AddHeader("Pragma", "no-cache"); string url = this.Request.RawUrl; if (url.Contains("DTT=") == false) { //this.Response.Redirect(url + "&DTT=" + DateTime.Now.ToString("mmDDhhmmss"), true); //return; } try { switch (this.ActionType) { case "Focus": //把任务放入任务池. BP.WF.Dev2Interface.Flow_Focus(Int64.Parse(this.Request.QueryString["WorkID"])); this.WinClose("ss"); break; case "PutOne": //把任务放入任务池. Int64 workid42 = Int64.Parse(this.Request.QueryString["WorkID"]); BP.WF.Dev2Interface.Node_TaskPoolPutOne(workid42); this.WinClose("ss"); break; case "DoAppTask": // 申请任务. Int64 workid2 = Int64.Parse(this.Request.QueryString["WorkID"]); BP.WF.Dev2Interface.Node_TaskPoolTakebackOne(workid2); this.WinClose("ss"); return; case "DoOpenCC": string fk_flow1 = this.Request.QueryString["FK_Flow"]; string fk_node1 = this.Request.QueryString["FK_Node"]; string workid1 = this.Request.QueryString["WorkID"]; string fid1 = this.Request.QueryString["FID"]; string Sta = this.Request.QueryString["Sta"]; if (Sta == "0") { BP.WF.Template.CCList cc1 = new BP.WF.Template.CCList(); cc1.MyPK = this.Request.QueryString["MyPK"]; cc1.Retrieve(); cc1.HisSta = CCSta.Read; cc1.Update(); } this.Response.Redirect("./WorkOpt/OneWork/Track.aspx?FK_Flow=" + fk_flow1 + "&FK_Node=" + fk_node1 + "&WorkID=" + workid1 + "&FID=" + fid1, false); return; case "DelCC": //删除抄送. CCList cc = new CCList(); cc.MyPK = this.MyPK; cc.Retrieve(); cc.HisSta = CCSta.Del; cc.Update(); this.WinClose(); break; case "DelSubFlow": //删除进程。 try { BP.WF.Dev2Interface.Flow_DeleteSubThread(this.FK_Flow, this.WorkID, "手工删除"); this.WinClose(); } catch (Exception ex) { this.WinCloseWithMsg(ex.Message); } break; case "DownBill": Bill b = new Bill(this.MyPK); b.DoOpen(); break; case "DelDtl": GEDtls dtls = new GEDtls(this.EnsName); GEDtl dtl = (GEDtl)dtls.GetNewEntity; dtl.OID = this.RefOID; if (dtl.RetrieveFromDBSources() == 0) { this.WinClose(); break; } FrmEvents fes = new FrmEvents(this.EnsName); //获得事件. // 处理删除前事件. try { fes.DoEventNode(BP.WF.XML.EventListDtlList.DtlItemDelBefore, dtl); } catch (Exception ex) { this.WinCloseWithMsg(ex.Message); break; } dtl.Delete(); // 处理删除后事件. try { fes.DoEventNode(BP.WF.XML.EventListDtlList.DtlItemDelAfter, dtl); } catch (Exception ex) { this.WinCloseWithMsg(ex.Message); break; } this.WinClose(); break; case "EmpDoUp": BP.WF.Port.WFEmp ep = new BP.WF.Port.WFEmp(this.RefNo); ep.DoUp(); BP.WF.Port.WFEmps emps111 = new BP.WF.Port.WFEmps(); // emps111.RemoveCash(); emps111.RetrieveAll(); this.WinClose(); break; case "EmpDoDown": BP.WF.Port.WFEmp ep1 = new BP.WF.Port.WFEmp(this.RefNo); ep1.DoDown(); BP.WF.Port.WFEmps emps11441 = new BP.WF.Port.WFEmps(); // emps11441.RemoveCash(); emps11441.RetrieveAll(); this.WinClose(); break; case "Track": //通过一个串来打开一个工作. string mySid = this.Request.QueryString["SID"]; string[] mystrs = mySid.Split('_'); Int64 myWorkID = int.Parse(mystrs[1]); string fk_emp = mystrs[0]; int fk_node = int.Parse(mystrs[2]); Node mynd = new Node(); mynd.NodeID = fk_node; mynd.RetrieveFromDBSources(); string fk_flow = mynd.FK_Flow; string myurl = "./WorkOpt/OneWork/Track.aspx?FK_Node=" + mynd.NodeID + "&WorkID=" + myWorkID + "&FK_Flow=" + fk_flow; Web.WebUser.SignInOfGener(new BP.Port.Emp(fk_emp), true); this.Response.Write("<script> window.location.href='" + myurl + "'</script> *^_^* <br><br>正在进入系统请稍后,如果长时间没有反应,请<a href='" + myurl + "'>点这里进入。</a>"); return; case "OF": //通过一个串来打开一个工作. string sid = this.Request.QueryString["SID"]; string[] strs = sid.Split('_'); GenerWorkerList wl = new GenerWorkerList(); int i = wl.Retrieve(GenerWorkerListAttr.FK_Emp, strs[0], GenerWorkerListAttr.WorkID, strs[1], GenerWorkerListAttr.FK_Node, strs[2]); if (i == 0) { this.Response.Write("<h2>提示</h2>此工作已经被别人处理或者此流程已删除。"); return; } BP.Port.Emp empOF = new BP.Port.Emp(wl.FK_Emp); Web.WebUser.SignInOfGener(empOF, true); string u = "MyFlow.aspx?FK_Flow=" + wl.FK_Flow + "&WorkID=" + wl.WorkID + "&FK_Node=" + wl.FK_Node + "&FID=" + wl.FID; this.Response.Write("<script> window.location.href='" + u + "'</script> *^_^* <br><br>正在进入系统请稍后,如果长时间没有反应,请<a href='" + u + "'>点这里进入。</a>"); return; case "ExitAuth": BP.Port.Emp emp = new BP.Port.Emp(this.FK_Emp); //首先退出,再进行登录 BP.Web.WebUser.Exit(); BP.Web.WebUser.SignInOfGenerLang(emp, WebUser.SysLang); this.WinClose(); return; case "LogAs": BP.WF.Port.WFEmp wfemp = new BP.WF.Port.WFEmp(this.FK_Emp); if (wfemp.AuthorIsOK == false) { this.WinCloseWithMsg("授权失败"); return; } BP.Port.Emp emp1 = new BP.Port.Emp(this.FK_Emp); BP.Web.WebUser.SignInOfGener(emp1, WebUser.SysLang, WebUser.No, true, false); this.WinClose(); return; case "TakeBack": // 取消授权。 BP.WF.Port.WFEmp myau = new BP.WF.Port.WFEmp(WebUser.No); BP.DA.Log.DefaultLogWriteLineInfo("取消授权:" + WebUser.No + "取消了对(" + myau.Author + ")的授权。"); myau.Author = ""; myau.AuthorWay = 0; myau.Update(); this.WinClose(); return; case "AutoTo": // 执行授权。 BP.WF.Port.WFEmp au = new BP.WF.Port.WFEmp(); au.No = WebUser.No; au.RetrieveFromDBSources(); au.AuthorDate = BP.DA.DataType.CurrentData; au.Author = this.FK_Emp; au.AuthorWay = 1; au.Save(); BP.DA.Log.DefaultLogWriteLineInfo("执行授权:" + WebUser.No + "执行了对(" + au.Author + ")的授权。"); this.WinClose(); return; case "UnSend": //执行撤消发送。 this.Response.Redirect("./WorkOpt/UnSend.aspx?WorkID=" + this.WorkID + "&FK_Flow=" + this.FK_Flow, false); return; case "SetBillState": break; case "WorkRpt": Bill bk1 = new Bill(this.Request.QueryString["OID"]); Node nd = new Node(bk1.FK_Node); this.Response.Redirect("WFRpt.aspx?WorkID=" + bk1.WorkID + "&FID=" + bk1.FID + "&FK_Flow=" + nd.FK_Flow + "&NodeId=" + bk1.FK_Node, false); //this.WinOpen(); //this.WinClose(); break; case "PrintBill": //Bill bk2 = new Bill(this.Request.QueryString["OID"]); //Node nd2 = new Node(bk2.FK_Node); //this.Response.Redirect("NodeRefFunc.aspx?NodeId=" + bk2.FK_Node + "&FlowNo=" + nd2.FK_Flow + "&NodeRefFuncOID=" + bk2.FK_NodeRefFunc + "&WorkFlowID=" + bk2.WorkID); ////this.WinClose(); break; //删除流程中第一个节点的数据,包括待办工作 case "DeleteFlow": string fk_flowDel = this.Request.QueryString["FK_Flow"]; Int64 workid = Int64.Parse(this.Request.QueryString["WorkID"]); //调用DoDeleteWorkFlowByReal方法 WorkFlow wf = new WorkFlow(new Flow(fk_flowDel), workid); wf.DoDeleteWorkFlowByReal(true); // Glo.ToMsg("流程删除成功"); BP.WF.Glo.ToMsg("流程删除成功"); //this.ToWFMsgPage("流程删除成功"); break; default: throw new Exception("ActionType error" + this.ActionType); } } catch (Exception ex) { this.ToErrorPage("执行其间如下异常:<BR>" + ex.Message); } }
/// <summary> /// 步骤1 让zhanghaicheng 发起流程. /// </summary> public void Step1() { //给发起人赋值. starterEmp = new Port.Emp(userNo); //让 userNo 登录. BP.WF.Dev2Interface.Port_Login(userNo); //创建空白工作, 发起开始节点. workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow); #region 检查创建工作是否符合预期. //检查流程表的数据. sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@流程报表数据被删除了."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case GERptAttr.FID: if (val != "0") { throw new Exception("@应当是0"); } break; case GERptAttr.FK_Dept: if (val != WebUser.FK_Dept) { throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val); } break; case GERptAttr.FK_NY: if (val != DataType.CurrentYearMonth) { throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val); } break; case GERptAttr.FlowDaySpan: if (val != "0") { throw new Exception("@应当是 0 , 现在是:" + val); } break; case GERptAttr.FlowEmps: if (BP.WF.Glo.UserInfoShowModel != UserInfoShowModel.UserNameOnly) { if (val.Contains(WebUser.No) == false) { throw new Exception("@应当是包含当前人员, 现在是:" + val); } } break; case GERptAttr.FlowEnder: if (val != WebUser.No) { throw new Exception("@应当是 当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnderRDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("@应当是 当前日期, 现在是:" + val); } break; case GERptAttr.FlowEndNode: if (val != "2401") { throw new Exception("@应当是 2401, 现在是:" + val); } break; case GERptAttr.FlowStarter: if (val != WebUser.No) { throw new Exception("@应当是 WebUser.No, 现在是:" + val); } break; case GERptAttr.FlowStartRDT: if (string.IsNullOrEmpty(val)) { throw new Exception("@应当不能为空,现在是:" + val); } break; case GERptAttr.Title: if (string.IsNullOrEmpty(val)) { throw new Exception("@不能为空title" + val); } break; case GERptAttr.WFState: WFState sta = (WFState)int.Parse(val); if (sta != WFState.Blank) { throw new Exception("@应当是 WFState.Blank 现在是" + sta.ToString()); } break; default: break; } } #endregion 检查创建工作是否符合预期 //执行发送. objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workID, null, null, 0, "zhoupeng"); #region 第1步: 检查发送对象. //从获取的发送对象里获取到下一个工作者. zhangyifan(张一帆)、zhoushengyu(周升雨). if (objs.VarAcceptersID != "zhoupeng") { throw new Exception("@下一步的接受人不正确, 应当是: zhoupeng.现在是:" + objs.VarAcceptersID); } if (objs.VarToNodeID != 2402) { throw new Exception("@应该是 2401 节点. 现在是:" + objs.VarToNodeID); } if (objs.VarWorkID != workID) { throw new Exception("@主线程的workid不应该变化:" + objs.VarWorkID); } if (objs.VarCurrNodeID != 2401) { throw new Exception("@当前节点的编号不能变化:" + objs.VarCurrNodeID); } if (objs.VarTreadWorkIDs != null) { throw new Exception("@不应当获得子线程WorkID."); } #endregion 第1步: 检查发送对象. #region 第2步: 检查流程引擎表. //检查创建这个空白是否有数据完整? sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID + " AND FK_Emp='" + objs.VarAcceptersID + "'"; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { throw new Exception("@不应该找不到当前人员的待办."); } gwf = new GenerWorkFlow(workID); if (gwf.Starter != WebUser.No || gwf.StarterName != WebUser.Name) { throw new Exception("没有写入发起人的信息."); } if (gwf.FK_Dept != starterEmp.FK_Dept) { throw new Exception("@发起人的部门有变化,应当是" + starterEmp.FK_Dept + ",现在是:" + gwf.FK_Dept); } if (gwf.Starter != starterEmp.No) { throw new Exception("@发起人的 No 有变化,应当是" + starterEmp.No + ",现在是:" + gwf.Starter); } //判断当前点. if (gwf.FK_Node != 2402) { throw new Exception("@当前点应该是 2402 现在是:" + gwf.FK_Node); } //判断当前点. if (gwf.FID != 0) { throw new Exception("@当前点应该是 FID=0 现在是:" + gwf.FID); } //判断PWorkID,没有谁调用它,应当是 0. if (gwf.PWorkID != 0) { throw new Exception("@没有谁调用它, 当前点应该是 PWorkID=0 现在是:" + gwf.PWorkID); } //判断 WFState . if (gwf.WFState != WFState.Runing) { throw new Exception("@应当是 WFState=Runing 现在是:" + gwf.WFState.ToString()); } //检查开始节点 发送人的WF_GenerWorkerList 的. gwl = new GenerWorkerList(); gwl.FK_Emp = Web.WebUser.No; gwl.FK_Node = 2401; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == false) { throw new Exception("@应该是通过的状态 "); } //if (gwl.Sender.Contains(WebUser.No) == false) // throw new Exception("@应该是 包含当前状态 . "); //检查接受人的 WF_GenerWorkerList 的. gwl = new GenerWorkerList(); gwl.FK_Emp = objs.VarAcceptersID; gwl.FK_Node = 2402; gwl.WorkID = workID; gwl.Retrieve(); // 没有分合流应当是 0 . if (gwl.FID != 0) { throw new Exception("@没有分合流应当是 0."); } if (gwl.IsEnable == false) { throw new Exception("@应该是启用的状态 "); } if (gwl.IsPass == true) { throw new Exception("@应该是未通过的状态 "); } //if (gwl.Sender.Contains(WebUser.No) == false) // throw new Exception("@应该是 当前人发送的,现在是: " + gwl.Sender); #endregion 第2步: 检查流程引擎表. #region 第3步: 检查节点数据表. //检查流程表的数据. sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID; dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 1) { throw new Exception("@流程报表数据被删除了."); } foreach (DataColumn dc in dt.Columns) { string val = dt.Rows[0][dc.ColumnName].ToString(); switch (dc.ColumnName) { case GERptAttr.PWorkID: if (val != "0") { throw new Exception("@PWorkID应当是0, 现在是:" + val); } break; case GERptAttr.PFlowNo: if (val != "") { throw new Exception("@PFlowNo应当是 '' 现在是:" + val); } break; case GERptAttr.FID: if (val != "0") { throw new Exception("@应当是0"); } break; case GERptAttr.FK_Dept: if (val != starterEmp.FK_Dept) { throw new Exception("@应当是" + starterEmp.FK_Dept + ", 现在是:" + val); } break; case GERptAttr.FK_NY: if (val != DataType.CurrentYearMonth) { throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val); } break; case GERptAttr.FlowDaySpan: if (val != "0") { throw new Exception("@应当是 0 , 现在是:" + val); } break; case GERptAttr.FlowEmps: if (BP.WF.Glo.UserInfoShowModel != UserInfoShowModel.UserNameOnly) { if (val.Contains(WebUser.No) == false) { throw new Exception("@应当是包含当前人员, 现在是:" + val); } } break; case GERptAttr.FlowEnder: if (val != WebUser.No) { throw new Exception("@应当是 当前人员, 现在是:" + val); } break; case GERptAttr.FlowEnderRDT: if (val.Contains(DataType.CurrentData) == false) { throw new Exception("@应当是 当前日期, 现在是:" + val); } break; case GERptAttr.FlowEndNode: if (val != "2402") { throw new Exception("@应当是 2402, 现在是:" + val); } break; case GERptAttr.FlowStarter: if (val != starterEmp.No) { throw new Exception("@应当是 " + starterEmp.No + ", 现在是:" + val); } break; case GERptAttr.FlowStartRDT: if (string.IsNullOrEmpty(val)) { throw new Exception("@应当不能为空,现在是:" + val); } break; case GERptAttr.Title: if (string.IsNullOrEmpty(val)) { throw new Exception("@不能为空title" + val); } break; case GERptAttr.WFState: WFState sta = (WFState)int.Parse(val); if (sta != WFState.Runing) { throw new Exception("@应当是 WFState.Runing 现在是" + sta.ToString()); } break; default: break; } } #endregion 第3步: 检查节点数据表. }