/// <summary> /// 执行保存. /// </summary> public void Save() { FrmRpt rpt = new FrmRpt(this.EnsName); DataTable dtCol = BP.DA.DBAccess.RunSQLReturnTable(rpt.SQLOfColumn); DataTable dtRow = BP.DA.DBAccess.RunSQLReturnTable(rpt.SQLOfRow); BP.DA.DBAccess.RunSQL("DELETE " + rpt.PTable + " WHERE RefOID=" + this.RefPKVal); Paras ps = new Paras(); ps.SQL = "INSERT INTO " + rpt.PTable + " ()VALUES()"; foreach (DataRow drCol in dtCol.Rows) { string col = drCol[0].ToString(); foreach (DataRow drRow in dtRow.Rows) { ps.Clear(); string row = drRow[0].ToString(); string val = this.Pub1.GetTextBoxByID("TB_" + col + "" + row).Text; ps.Add("Col", col); ps.Add("Row", col); ps.Add("Val", decimal.Parse(val)); ps.Add("MyPK", col + "_" + row + "_" + this.RefPKVal); BP.DA.DBAccess.RunSQL(ps); } } }
/// <summary> /// 删除两个节点之间的业务数据与流程引擎控制数据. /// </summary> private void DeleteSpanNodesGenerWorkerListData() { if (this.IsBackTrack == true) { return; } Paras ps = new Paras(); string dbStr = SystemConfig.AppCenterDBVarStr; // 删除FH, 不管是否有这笔数据. ps.Clear(); ps.SQL = "DELETE FROM WF_GenerFH WHERE FID=" + dbStr + "FID"; ps.Add("FID", this.WorkID); DBAccess.RunSQL(ps); /*如果不是退回并原路返回,就需要清除 两个节点之间的数据, 包括WF_GenerWorkerList的数据.*/ if (this.ReturnToNode.IsStartNode == true) { // 删除其子线程流程. ps.Clear(); ps.SQL = "DELETE FROM WF_GenerWorkFlow WHERE FID=" + dbStr + "FID "; ps.Add("FID", this.WorkID); DBAccess.RunSQL(ps); /*如果退回到了开始的节点,就删除出开始节点以外的数据,不要删除节点表单数据,这样会导致流程轨迹打不开.*/ ps.Clear(); ps.SQL = "DELETE FROM WF_GenerWorkerList WHERE FK_Node!=" + dbStr + "FK_Node AND (WorkID=" + dbStr + "WorkID1 OR FID=" + dbStr + "WorkID2)"; ps.Add(GenerWorkerListAttr.FK_Node, this.ReturnToNode.NodeID); ps.Add("WorkID1", this.WorkID); ps.Add("WorkID2", this.WorkID); DBAccess.RunSQL(ps); return; } /*找到发送到退回的时间点,把从这个时间点以来的数据都要删除掉.*/ ps.Clear(); ps.SQL = "SELECT RDT,ActionType,NDFrom FROM ND" + int.Parse(this.HisNode.FK_Flow) + "Track WHERE NDFrom=" + dbStr + "NDFrom AND WorkID=" + dbStr + "WorkID AND ActionType=" + (int)ActionType.Forward + " ORDER BY RDT desc "; ps.Add("NDFrom", this.ReturnToNode.NodeID); ps.Add("WorkID", this.WorkID); DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(ps); if (dt.Rows.Count >= 1) { string rdt = dt.Rows[0][0].ToString(); ps.Clear(); ps.SQL = "SELECT ActionType,NDFrom FROM ND" + int.Parse(this.HisNode.FK_Flow) + "Track WHERE RDT >=" + dbStr + "RDT AND WorkID=" + dbStr + "WorkID ORDER BY RDT "; ps.Add("RDT", rdt); ps.Add("WorkID", this.WorkID); dt = BP.DA.DBAccess.RunSQLReturnTable(ps); foreach (DataRow dr in dt.Rows) { ActionType at = (ActionType)int.Parse(dr["ActionType"].ToString()); int nodeid = int.Parse(dr["NDFrom"].ToString()); if (nodeid == this.ReturnToNode.NodeID) { continue; } ps.Clear(); ps.SQL = "DELETE FROM WF_GenerWorkerList WHERE FK_Node=" + dbStr + "FK_Node AND (WorkID=" + dbStr + "WorkID1 OR FID=" + dbStr + "WorkID2) "; ps.Add("FK_Node", nodeid); ps.Add("WorkID1", this.WorkID); ps.Add("WorkID2", this.WorkID); DBAccess.RunSQL(ps); } } //删除当前节点的数据. ps.Clear(); ps.SQL = "DELETE FROM WF_GenerWorkerList WHERE FK_Node=" + dbStr + "FK_Node AND (WorkID=" + dbStr + "WorkID1 OR FID=" + dbStr + "WorkID2) "; ps.Add("FK_Node", this.HisNode.NodeID); ps.Add("WorkID1", this.WorkID); ps.Add("WorkID2", this.WorkID); DBAccess.RunSQL(ps); // string sql = "SELECT * FROM ND" + int.Parse(this.HisNode.FK_Flow) + "Track WHERE NDTo='"+this.ReturnToNode.NodeID+" AND WorkID="+this.WorkID; // ActionType }
public void BindMyWork() { Stations sts = WebUser.HisEmp.HisStations; //this._Text="<table class='MyWork' id='strs' >"; this._Text = "<table class='MyWork' id='strs' cellSpacing='0' cellPadding='0' >"; this.Text += "<TR>"; this.Text += "<TD class='MyWorkTitle' >岗位</TD>"; this.Text += "<TD class='MyWorkTitle' >流程</TD>"; //this.Text+="<TD class='MyWorkTitle' >节点</TD>"; //this.Text+="<TD class='MyWorkTitle' >活动</TD>"; // this.Text+="<TD class='MyWorkTitle' >流程图</TD>"; this.Text += "</TR>"; /// 查询出来, 我能启动的流程。 BP.DA.Paras ps = new Paras(); foreach (Station st in sts) { this.Text += "<TR class='MyWorkTR' onmouseover='TROver(this)' onmouseout='TROut(this)' >"; this.Text += "<TD class='MyWorkTD' nowrap >" + st.Name + "</TD>"; this.Text += "<TD class='MyWorkTD' > </TD>"; // this.Text+="<TD class='MyWorkTD' > </TD>"; // this.Text+="<TD class='MyWorkTD' > </TD>"; //this.Text+="<TD class='MyWorkTD' > </TD>"; this.Text += "</TR>"; ps.Clear(); Flows fls = new Flows(); QueryObject qo = new QueryObject(fls); // qo.AddWhere(FlowAttr.StartStation, st.No); qo.DoQuery(); //DataTable mytable=DBAccess.RunSQLReturnTable( "SELECT distinct c.No FROM WF_NodeStation a, WF_Node b, WF_Flow c WHERE a.FK_Node=b.NodeID AND b.FK_Flow =c.No AND a.FK_Station in (SELECT FK_Station FROM Port_EmpStation WHERE FK_Emp ='"+WebUser.No+"' AND FK_Station='"+st.No+"')" ); foreach (Flow fl in fls) { /* 看看有没有此流程的工作 */ this.Text += "<TR class='MyWorkTR' onmouseover='TROver(this)' onmouseout='TROut(this)' >"; this.Text += " <TD class='MyWorkTD' nowrap > </TD>"; this.Text += " <TD class='MyWorkTD' nowrap >" + fl.Name + "</TD>"; //this.Text+=" <TD class='MyWorkTD' nowrap > </TD>"; //this.Text+=" <TD class='MyWorkTD' nowrap ><a href=\"javascript:WinOpen( 'FlowSV2.aspx?FK_Flow="+fl.No+"' )\" >新建</a> <a href=\"../DataUser/FlowDesc/"+fl.No+".gif\" target='flowP' >流程图</a> </TD>"; this.Text += " <TD class='MyWorkTD' nowrap ><a href=\"javascript:WinOpen( 'FlowSV2.aspx?FK_Flow=" + fl.No + "' )\" >新建</a> </TD>"; this.Text += "</TR>"; ps.Clear(); ps.SQL = "SELECT FK_Node, COUNT(*) FROM WF_GenerWorkerlist WHERE FK_Emp=:FK_Emp AND FK_Node IN (SELECT NodeID FROM WF_Node WHERE FK_Flow=:FK_Flow ) GROUP BY FK_Node"; ps.Add("FK_Emp", WebUser.No); ps.Add("FK_Flow", fl.No); DataTable dt = DBAccess.RunSQLReturnTable(ps); /*说明在此工作下面有工作要做。*/ foreach (DataRow dr in dt.Rows) { this.Text += "<TR class='MyWorkTR' onmouseover='TROver(this)' onmouseout='TROut(this)' >"; this.Text += " <TD class='MyWorkTD' nowrap > </TD>"; this.Text += " <TD class='MyWorkTD' nowrap > </TD>"; Node nd = new Node(int.Parse(dr[0].ToString())); this.Text += " <TD class='MyWorkTD' nowrap ><a href=\"javascript:WinOpen( 'MyWork.aspx?FK_Node=" + nd.NodeID + "' )\" > " + nd.Name + "(" + dr[1].ToString() + ")" + "</a></TD>"; this.Text += " <TD class='MyWorkTD' nowrap > </TD>"; //this.Text+=" <TD class='MyWorkTD' nowrap ><a href=''>操作</a> <a href='' >新建</a> <a href='' >流程图</a> </TD>"; this.Text += "</TR>"; } } } this.Text += "</TABLE>"; this.ParseControl(); }