public string DoUnSendSubFlow(GenerWorkFlow gwf) { WorkNode wn = this.GetCurrentWorkNode(); 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); if (num == 0) { return("@您不能执行撤消发送,因为当前工作不是您发送的。"); } // 处理事件。 string msg = wn.HisFlow.DoFlowEventEntity(EventListOfNode.UndoneBefore, wn.HisNode, wn.HisWork, null); // 删除工作者。 GenerWorkerLists wls = new GenerWorkerLists(); wls.Delete(GenerWorkerListAttr.WorkID, this.WorkID, GenerWorkerListAttr.FK_Node, gwf.FK_Node.ToString()); if (this.HisFlow.HisDataStoreModel == BP.WF.Template.DataStoreModel.ByCCFlow) { wn.HisWork.Delete(); } gwf.FK_Node = wnPri.HisNode.NodeID; gwf.NodeName = wnPri.HisNode.Name; gwf.Update(); BP.DA.DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsPass=0 WHERE WorkID=" + this.WorkID + " AND FK_Node=" + gwf.FK_Node); ShiftWorks fws = new ShiftWorks(); fws.Delete(ShiftWorkAttr.FK_Node, wn.HisNode.NodeID.ToString(), ShiftWorkAttr.WorkID, this.WorkID.ToString()); #region 判断撤消的百分比条件的临界点条件 if (wn.HisNode.PassRate != 0) { decimal all = (decimal)BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(*) NUM FROM WF_GenerWorkerList WHERE FID=" + this.FID + " AND FK_Node=" + wnPri.HisNode.NodeID); decimal ok = (decimal)BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(*) NUM FROM WF_GenerWorkerList WHERE FID=" + this.FID + " AND IsPass=1 AND FK_Node=" + wnPri.HisNode.NodeID); decimal rate = ok / all * 100; if (wn.HisNode.PassRate <= rate) { DBAccess.RunSQL("UPDATE WF_GenerWorkerList SET IsPass=0 WHERE FK_Node=" + wn.HisNode.NodeID + " AND WorkID=" + this.FID); } else { DBAccess.RunSQL("UPDATE WF_GenerWorkerList SET IsPass=3 WHERE FK_Node=" + wn.HisNode.NodeID + " AND WorkID=" + this.FID); } } #endregion // 处理事件。 msg += wn.HisFlow.DoFlowEventEntity(EventListOfNode.UndoneAfter, wn.HisNode, wn.HisWork, null); // 记录日志.. wn.AddToTrack(ActionType.UnSend, WebUser.No, WebUser.Name, wn.HisNode.NodeID, wn.HisNode.Name, "无"); return("@撤消执行成功." + msg); }
public string DoUnSendSubFlow(GenerWorkFlow gwf) { WorkNode wn = this.GetCurrentWorkNode(); 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); if (num == 0) { return("@您不能执行撤消发送,因为当前工作不是您发送的。"); } // 处理事件。 string msg = wn.HisFlow.DoFlowEventEntity(EventListOfNode.UndoneBefore, wn.HisNode, wn.HisWork, null); // 删除工作者。 GenerWorkerLists wls = new GenerWorkerLists(); wls.Delete(GenerWorkerListAttr.WorkID, this.WorkID, GenerWorkerListAttr.FK_Node, gwf.FK_Node.ToString()); if (this.HisFlow.HisDataStoreModel == BP.WF.Template.DataStoreModel.ByCCFlow) { wn.HisWork.Delete(); } gwf.FK_Node = wnPri.HisNode.NodeID; gwf.NodeName = wnPri.HisNode.Name; gwf.Update(); BP.DA.DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsPass=0 WHERE WorkID=" + this.WorkID + " AND FK_Node=" + gwf.FK_Node); ShiftWorks fws = new ShiftWorks(); fws.Delete(ShiftWorkAttr.FK_Node, wn.HisNode.NodeID.ToString(), ShiftWorkAttr.WorkID, this.WorkID.ToString()); #region 判断撤消的百分比条件的临界点条件 if (wn.HisNode.PassRate != 0) { decimal all = (decimal)BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(*) NUM FROM dbo.WF_GenerWorkerList WHERE FID=" + this.FID + " AND FK_Node=" + wnPri.HisNode.NodeID); decimal ok = (decimal)BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(*) NUM FROM dbo.WF_GenerWorkerList WHERE FID=" + this.FID + " AND IsPass=1 AND FK_Node=" + wnPri.HisNode.NodeID); decimal rate = ok / all * 100; if (wn.HisNode.PassRate <= rate) { DBAccess.RunSQL("UPDATE WF_GenerWorkerList SET IsPass=0 WHERE FK_Node=" + wn.HisNode.NodeID + " AND WorkID=" + this.FID); } else { DBAccess.RunSQL("UPDATE WF_GenerWorkerList SET IsPass=3 WHERE FK_Node=" + wn.HisNode.NodeID + " AND WorkID=" + this.FID); } } #endregion // 处理事件。 msg += wn.HisFlow.DoFlowEventEntity(EventListOfNode.UndoneAfter, wn.HisNode, wn.HisWork, null); // 记录日志.. wn.AddToTrack(ActionType.UnSend, WebUser.No, WebUser.Name, wn.HisNode.NodeID, wn.HisNode.Name, "无"); if (wnPri.HisNode.IsStartNode) { if (BP.Web.WebUser.IsWap) { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A> , <a href='" + VirPath + "WF/MyFlowInfo.aspx?DoType=DeleteFlow&WorkID=" + wn.HisWork.OID + "&FK_Flow=" + this.FlowNo + "' /><img src='" + VirPath + "WF/Img/Btn/Delete.gif' border=0/>此流程已经完成(删除它)</a>。" + msg); } else { if (this.HisFlow.FK_FlowSort != "00") { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A> , <a href='" + VirPath + "WF/MyFlowInfo.aspx?DoType=DeleteFlow&WorkID=" + wn.HisWork.OID + "&FK_Flow=" + this.FlowNo + "' /><img src='" + VirPath + "WF/Img/Btn/Delete.gif' border=0/>此流程已经完成(删除它)</a>。" + msg); } else { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A> , <a href='" + VirPath + "WF/Do.aspx?ActionType=DeleteFlow&WorkID=" + wn.HisWork.OID + "&FK_Flow=" + this.FlowNo + "' /><img src='" + VirPath + "WF/Img/Btn/Delete.gif' border=0/>此流程已经完成(删除它)</a>。" + msg); } } } else { // 更新是否显示。 // DBAccess.RunSQL("UPDATE WF_ForwardWork SET IsRead=1 WHERE WORKID=" + this.WorkID + " AND FK_Node=" + wnPri.HisNode.NodeID); if (BP.Web.WebUser.IsWap == false) { if (this.HisFlow.FK_FlowSort != "00") { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A>。" + msg); } else { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A>。" + msg); } } else { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FID=" + gwf.FID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A>。" + msg); } } }
/// <summary> /// 执行撤销发送 /// </summary> /// <param name="gwf"></param> /// <returns></returns> public string DoUnSendHeiLiu_Main(GenerWorkFlow gwf) { Node currNode = new Node(gwf.FK_Node); Node priFLNode = currNode.HisPriFLNode; GenerWorkerList wl = new GenerWorkerList(); //判断改操作人员是否是分流节点上的人员. int i = wl.Retrieve(GenerWorkerListAttr.FK_Node, priFLNode.NodeID, GenerWorkerListAttr.FK_Emp, BP.Web.WebUser.No); if (i == 0) { return("@不是您把工作发送到当前节点上,所以您不能撤消。"); } WorkNode wn = this.GetCurrentWorkNode(); WorkNode wnPri = new WorkNode(this.WorkID, priFLNode.NodeID); // 记录日志.. wnPri.AddToTrack(ActionType.UnSend, WebUser.No, WebUser.Name, wnPri.HisNode.NodeID, wnPri.HisNode.Name, "无"); //删除当前节点的流程 GenerWorkerLists wls = new GenerWorkerLists(); wls.Delete(GenerWorkerListAttr.WorkID, this.WorkID, GenerWorkerListAttr.FK_Node, gwf.FK_Node.ToString()); if (this.HisFlow.HisDataStoreModel == BP.WF.Template.DataStoreModel.ByCCFlow) { wn.HisWork.Delete(); } //更改流程信息 gwf.FK_Node = wnPri.HisNode.NodeID; gwf.NodeName = wnPri.HisNode.Name; gwf.Update(); BP.DA.DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsPass=0 WHERE WorkID=" + this.WorkID + " AND FK_Node=" + gwf.FK_Node); //删除子线程的功能 foreach (Node ndNext in wnPri.HisNode.HisToNodes) { i = DBAccess.RunSQL("DELETE FROM WF_GenerWorkerList WHERE FID=" + this.WorkID + " AND FK_Node=" + ndNext.NodeID); if (i == 0) { continue; } if (ndNext.HisRunModel == RunModel.SubThread) { /*如果到达的节点是子线程,就查询出来发起的子线程。*/ GenerWorkFlows gwfs = new GenerWorkFlows(); gwfs.Retrieve(GenerWorkFlowAttr.FID, this.WorkID); foreach (GenerWorkFlow en in gwfs) { BP.WF.Dev2Interface.Flow_DeleteSubThread(gwf.FK_Flow, en.WorkID, "合流节点撤销发送前,删除子线程."); } continue; } // 删除工作记录。 Works wks = ndNext.HisWorks; if (this.HisFlow.HisDataStoreModel == BP.WF.Template.DataStoreModel.ByCCFlow) { wks.Delete(GenerWorkerListAttr.FID, this.WorkID); } } ShiftWorks fws = new ShiftWorks(); fws.Delete(ShiftWorkAttr.FK_Node, wn.HisNode.NodeID.ToString(), ShiftWorkAttr.WorkID, this.WorkID.ToString()); #region 恢复工作轨迹,解决工作抢办。 if (wnPri.HisNode.IsStartNode == false) { WorkNode ppPri = wnPri.GetPreviousWorkNode(); wl = new GenerWorkerList(); wl.Retrieve(GenerWorkerListAttr.FK_Node, wnPri.HisNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID); RememberMe rm = new RememberMe(); rm.Retrieve(RememberMeAttr.FK_Node, wnPri.HisNode.NodeID, RememberMeAttr.FK_Emp, ppPri.HisWork.Rec); string[] empStrs = rm.Objs.Split('@'); foreach (string s in empStrs) { if (s == "" || s == null) { continue; } if (s == wl.FK_Emp) { continue; } GenerWorkerList wlN = new GenerWorkerList(); wlN.Copy(wl); wlN.FK_Emp = s; WF.Port.WFEmp myEmp = new Port.WFEmp(s); wlN.FK_EmpText = myEmp.Name; wlN.Insert(); } } #endregion 恢复工作轨迹,解决工作抢办。 // 删除以前的节点数据. wnPri.DeleteToNodesData(priFLNode.HisToNodes); if (wnPri.HisNode.IsStartNode) { if (wnPri.HisNode.HisFormType != NodeFormType.SDKForm) { return("@撤消执行成功."); } else { return("@撤销成功."); } } else { return("@撤消执行成功."); } }
/// <summary> /// 执行撤销发送 /// </summary> /// <param name="gwf"></param> /// <returns></returns> public string DoUnSendHeiLiu_Main(GenerWorkFlow gwf) { Node currNode = new Node(gwf.FK_Node); Node priFLNode = currNode.HisPriFLNode; GenerWorkerList wl = new GenerWorkerList(); int i = wl.Retrieve(GenerWorkerListAttr.FK_Node, priFLNode.NodeID, GenerWorkerListAttr.FK_Emp, BP.Web.WebUser.No); if (i == 0) { return("@不是您把工作发送到当前节点上,所以您不能撤消。"); } WorkNode wn = this.GetCurrentWorkNode(); WorkNode wnPri = new WorkNode(this.WorkID, priFLNode.NodeID); // 记录日志.. wnPri.AddToTrack(ActionType.UnSend, WebUser.No, WebUser.Name, wnPri.HisNode.NodeID, wnPri.HisNode.Name, "无"); GenerWorkerLists wls = new GenerWorkerLists(); wls.Delete(GenerWorkerListAttr.WorkID, this.WorkID, GenerWorkerListAttr.FK_Node, gwf.FK_Node.ToString()); if (this.HisFlow.HisDataStoreModel == BP.WF.Template.DataStoreModel.ByCCFlow) { wn.HisWork.Delete(); } gwf.FK_Node = wnPri.HisNode.NodeID; gwf.NodeName = wnPri.HisNode.Name; gwf.Update(); BP.DA.DBAccess.RunSQL("UPDATE WF_GenerWorkerlist SET IsPass=0 WHERE WorkID=" + this.WorkID + " AND FK_Node=" + gwf.FK_Node); BP.DA.DBAccess.RunSQL("UPDATE WF_GenerFH SET FK_Node=" + gwf.FK_Node + " WHERE FID=" + this.WorkID); ShiftWorks fws = new ShiftWorks(); fws.Delete(ShiftWorkAttr.FK_Node, wn.HisNode.NodeID.ToString(), ShiftWorkAttr.WorkID, this.WorkID.ToString()); #region 恢复工作轨迹,解决工作抢办。 if (wnPri.HisNode.IsStartNode == false) { WorkNode ppPri = wnPri.GetPreviousWorkNode(); wl = new GenerWorkerList(); wl.Retrieve(GenerWorkerListAttr.FK_Node, wnPri.HisNode.NodeID, GenerWorkerListAttr.WorkID, this.WorkID); // BP.DA.DBAccess.RunSQL("UPDATE WF_GenerWorkerList SET IsPass=0 WHERE FK_Node=" + backtoNodeID + " AND WorkID=" + this.WorkID); RememberMe rm = new RememberMe(); rm.Retrieve(RememberMeAttr.FK_Node, wnPri.HisNode.NodeID, RememberMeAttr.FK_Emp, ppPri.HisWork.Rec); string[] empStrs = rm.Objs.Split('@'); foreach (string s in empStrs) { if (s == "" || s == null) { continue; } if (s == wl.FK_Emp) { continue; } GenerWorkerList wlN = new GenerWorkerList(); wlN.Copy(wl); wlN.FK_Emp = s; WF.Port.WFEmp myEmp = new Port.WFEmp(s); wlN.FK_EmpText = myEmp.Name; wlN.Insert(); } } #endregion 恢复工作轨迹,解决工作抢办。 // 删除以前的节点数据. wnPri.DeleteToNodesData(priFLNode.HisToNodes); if (wnPri.HisNode.IsStartNode) { if (BP.Web.WebUser.IsWap) { if (wnPri.HisNode.HisFormType != NodeFormType.SDKForm) { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A> , <a href='" + this.VirPath + this.AppType + "/MyFlowInfo.aspx?DoType=DeleteFlow&WorkID=" + wn.HisWork.OID + "&FK_Flow=" + this.FlowNo + "' /><img src='" + VirPath + "WF/Img/Btn/Delete.gif' border=0/>此流程已经完成(删除它)</a>。"); } else { return("@撤销成功."); } } else { if (wnPri.HisNode.HisFormType != NodeFormType.SDKForm) { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A> , <a href='" + this.VirPath + this.AppType + "/MyFlowInfo.aspx?DoType=DeleteFlow&WorkID=" + wn.HisWork.OID + "&FK_Flow=" + this.FlowNo + "' /><img src='" + VirPath + "WF/Img/Btn/Delete.gif' border=0/>此流程已经完成(删除它)</a>。"); } else { return("@撤销成功."); } } } else { // 更新是否显示。 #warning // DBAccess.RunSQL("UPDATE WF_ForwardWork SET IsRead=1 WHERE WORKID=" + this.WorkID + " AND FK_Node=" + wnPri.HisNode.NodeID); if (BP.Web.WebUser.IsWap == false) { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A>。"); } else { return("@撤消执行成功,您可以点这里<a href='" + this.VirPath + this.AppType + "/MyFlow.aspx?FK_Flow=" + this.FlowNo + "&WorkID=" + this.WorkID + "&FK_Node=" + gwf.FK_Node + "'><img src='" + VirPath + "WF/Img/Btn/Do.gif' border=0/>执行工作</A>。"); } } }