/// <summary> /// 查询出来所有的抄送信息 /// </summary> /// <param name="flowNo"></param> /// <param name="workid"></param> /// <param name="fid"></param> public CCLists(string flowNo, Int64 workid, Int64 fid) { QueryObject qo = new QueryObject(this); qo.AddWhere(CCListAttr.FK_Flow, flowNo); qo.addAnd(); if (fid != 0) { qo.AddWhereIn(CCListAttr.WorkID, "(" + workid + "," + fid + ")"); } else { qo.AddWhere(CCListAttr.WorkID, workid); } qo.DoQuery(); }
public int RetrieveFID() { QueryObject qo = new QueryObject(this); qo.AddWhereIn(WorkAttr.OID, "(" + this.FID + "," + this.OID + ")"); int i = qo.DoQuery(); if (i == 0) { if (SystemConfig.IsDebug == false) { this.CheckPhysicsTable(); throw new Exception("@节点[" + this.EnDesc + "]数据丢失:WorkID=" + this.OID + " FID=" + this.FID + " sql=" + qo.SQL); } } return(i); }
public QueryObject InitQueryObjectByEns(Entities ens, bool IsShowSearchKey, DTSearchWay dw, string dtKey, Attrs attrs, AttrsOfSearch attrsOfSearch, AttrSearchs searchAttrs) { QueryObject qo = new QueryObject(ens); #region 关键字 string keyVal = ""; //Attrs attrs = en.EnMap.Attrs; if (IsShowSearchKey) { TB keyTB = this.GetTBByID("TB_Key"); if (keyTB != null) { keyVal = keyTB.Text.Trim(); } else { UserRegedit ur = new UserRegedit(); //ur.MyPK = WebUser.No + ens.GetNewEntity.ClassID + "_SearchAttrs"; QueryObject urObj = new QueryObject(ur); urObj.AddWhere("MyPK", WebUser.No + ens.GetNewEntity.ClassID + "_SearchAttrs"); urObj.DoQuery(); keyVal = ur.SearchKey; } this.Page.Session["SKey"] = keyVal; } if (keyVal.Length >= 1) { Attr attrPK = new Attr(); foreach (Attr attr in attrs) { if (attr.IsPK) { attrPK = attr; break; } } int i = 0; foreach (Attr attr in attrs) { switch (attr.MyFieldType) { case FieldType.Enum: case FieldType.FK: case FieldType.PKFK: continue; default: break; } if (attr.MyDataType != DataType.AppString) { continue; } if (attr.MyFieldType == FieldType.RefText) { continue; } if (attr.Key == "FK_Dept") { continue; } i++; if (i == 1) { /* 第一次进来。 */ qo.addLeftBracket(); switch (SystemConfig.AppCenterDBType) { case BP.DA.DBType.Oracle: case BP.DA.DBType.Informix: qo.AddWhere(attr.Key, " LIKE ", " '%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'"); break; case BP.DA.DBType.MySQL: qo.AddWhere(attr.Key, " LIKE ", "CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')"); break; default: qo.AddWhere(attr.Key, " LIKE ", " '%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'"); break; } continue; } qo.addOr(); switch (SystemConfig.AppCenterDBType) { case BP.DA.DBType.Oracle: case BP.DA.DBType.Informix: qo.AddWhere(attr.Key, " LIKE ", "'%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'"); break; case BP.DA.DBType.MySQL: qo.AddWhere(attr.Key, " LIKE ", "CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')"); break; default: qo.AddWhere(attr.Key, " LIKE ", "'%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'"); break; } } qo.MyParas.Add("SKey", keyVal); qo.addRightBracket(); } else { qo.addLeftBracket(); qo.AddWhere("abc", "all"); qo.addRightBracket(); } #endregion #region 普通属性 string opkey = ""; // 操作符号。 foreach (AttrOfSearch attr in attrsOfSearch) { if (attr.IsHidden) { qo.addAnd(); qo.addLeftBracket(); qo.AddWhere(attr.RefAttrKey, attr.DefaultSymbol, attr.DefaultValRun); qo.addRightBracket(); continue; } if (attr.SymbolEnable == true) { opkey = this.GetDDLByKey("DDL_" + attr.Key).SelectedItemStringVal; if (opkey == "all") { continue; } } else { opkey = attr.DefaultSymbol; } qo.addAnd(); qo.addLeftBracket(); if (attr.DefaultVal.Length >= 8) { string date = "2005-09-01"; try { /* 就可能是年月日。 */ string y = this.GetDDLByKey("DDL_" + attr.Key + "_Year").SelectedItemStringVal; string m = this.GetDDLByKey("DDL_" + attr.Key + "_Month").SelectedItemStringVal; string d = this.GetDDLByKey("DDL_" + attr.Key + "_Day").SelectedItemStringVal; date = y + "-" + m + "-" + d; if (opkey == "<=") { DateTime dt = DataType.ParseSysDate2DateTime(date).AddDays(1); date = dt.ToString(DataType.SysDataFormat); } } catch { } qo.AddWhere(attr.RefAttrKey, opkey, date); } else { qo.AddWhere(attr.RefAttrKey, opkey, this.GetTBByID("TB_" + attr.Key).Text); } qo.addRightBracket(); } #endregion #region 外键 foreach (AttrSearch attr1 in searchAttrs) { Attr attr = attr1.HisAttr; if (attr.MyFieldType == FieldType.RefText) { continue; } DDL ddl = this.GetDDLByKey("DDL_" + attr.Key); if (ddl.Items.Count == 0) { continue; } string selectVal = ddl.SelectedItemStringVal; if (selectVal == "all") { continue; } if (selectVal == "mvals") { UserRegedit sUr = new UserRegedit(); sUr.MyPK = WebUser.No + this.EnsName + "_SearchAttrs"; sUr.RetrieveFromDBSources(); /* 如果是多选值 */ string cfgVal = sUr.MVals; AtPara ap = new AtPara(cfgVal); string instr = ap.GetValStrByKey(attr.Key); if (instr == null || instr == "") { if (attr.Key == "FK_Dept" || attr.Key == "FK_Unit") { if (attr.Key == "FK_Dept") { selectVal = WebUser.FK_Dept; ddl.SelectedIndex = 0; } //if (attr.Key == "FK_Unit") //{ // selectVal = WebUser.FK_Unit; // ddl.SelectedIndex = 0; //} } else { continue; } } else { instr = instr.Replace("..", "."); instr = instr.Replace(".", "','"); instr = instr.Substring(2); instr = instr.Substring(0, instr.Length - 2); qo.addAnd(); qo.addLeftBracket(); qo.AddWhereIn(attr.Key, "(" + instr + ")"); qo.addRightBracket(); continue; } } qo.addAnd(); qo.addLeftBracket(); if (attr.UIBindKey == "BP.Port.Depts" || attr.UIBindKey == "BP.Port.Units") //判断特殊情况。 { qo.AddWhere(attr.Key, " LIKE ", selectVal + "%"); } else { qo.AddWhere(attr.Key, selectVal); } //qo.AddWhere(attr.Key,this.GetDDLByKey("DDL_"+attr.Key).SelectedItemStringVal ) ; qo.addRightBracket(); } #endregion . if (dw != DTSearchWay.None) { string dtFrom = this.GetTBByID("TB_S_From").Text.Trim(); string dtTo = this.GetTBByID("TB_S_To").Text.Trim(); if (dw == DTSearchWay.ByDate) { qo.addAnd(); qo.addLeftBracket(); qo.SQL = dtKey + " >= '" + dtFrom + " 01:01'"; qo.addAnd(); qo.SQL = dtKey + " <= '" + dtTo + " 23:59'"; qo.addRightBracket(); //qo.AddWhere(dtKey, ">=", dtFrom+" 01:01"); //qo.addAnd(); //qo.AddWhere(dtKey, "<=", dtTo + " 23:59"); //qo.addRightBracket(); } if (dw == DTSearchWay.ByDateTime) { qo.addAnd(); qo.addLeftBracket(); qo.SQL = dtKey + " >= '" + dtFrom + "'"; qo.addAnd(); qo.SQL = dtKey + " <= '" + dtTo + "'"; qo.addRightBracket(); //qo.addAnd(); //qo.addLeftBracket(); //qo.AddWhere(dtKey, ">=", dtFrom); //qo.addAnd(); //qo.AddWhere(dtKey, "<=", dtTo); //qo.addRightBracket(); } } // throw new Exception(qo.SQL); return(qo); }
/// <summary> /// 递归删除两个节点之间的数据 /// </summary> /// <param name="nds">到达的节点集合</param> public void DeleteToNodesData(Nodes nds) { /*开始遍历到达的节点集合*/ foreach (Node nd in nds) { Work wk = nd.HisWork; wk.OID = this.WorkID; if (wk.Delete() == 0) { wk.FID = this.WorkID; if (wk.Delete(WorkAttr.FID, this.WorkID) == 0) { continue; } } #region 除当前节点数据,删除附件信息。 // 删除明细表信息。 MapDtls dtls = new MapDtls("ND" + nd.NodeID); foreach (MapDtl dtl in dtls) { ps = new Paras(); ps.SQL = "DELETE " + dtl.PTable + " WHERE RefPK=" + dbStr + "WorkID"; ps.Add("WorkID", this.WorkID.ToString()); BP.DA.DBAccess.RunSQL(ps); } // 删除表单附件信息。 BP.DA.DBAccess.RunSQL("DELETE FROM Sys_FrmAttachmentDB WHERE RefPKVal=" + dbStr + "WorkID AND FK_MapData=" + dbStr + "FK_MapData ", "WorkID", this.WorkID.ToString(), "FK_MapData", "ND" + nd.NodeID); // 删除签名信息。 BP.DA.DBAccess.RunSQL("DELETE FROM Sys_FrmEleDB WHERE RefPKVal=" + dbStr + "WorkID AND FK_MapData=" + dbStr + "FK_MapData ", "WorkID", this.WorkID.ToString(), "FK_MapData", "ND" + nd.NodeID); #endregion 除当前节点数据。 /*说明:已经删除该节点数据。*/ DBAccess.RunSQL("DELETE WF_GenerWorkerList WHERE (WorkID=" + dbStr + "WorkID1 OR FID=" + dbStr + "WorkID2 ) AND FK_Node=" + dbStr + "FK_Node", "WorkID1", this.WorkID, "WorkID2", this.WorkID, "FK_Node", nd.NodeID); if (nd.IsFL) { /* 如果是分流 */ GenerWorkerLists wls = new GenerWorkerLists(); QueryObject qo = new QueryObject(wls); qo.AddWhere(GenerWorkerListAttr.FID, this.WorkID); qo.addAnd(); string[] ndsStrs = nd.HisToNDs.Split('@'); string inStr = ""; foreach (string s in ndsStrs) { if (s == "" || s == null) { continue; } inStr += "'" + s + "',"; } inStr = inStr.Substring(0, inStr.Length - 1); if (inStr.Contains(",") == true) { qo.AddWhere(GenerWorkerListAttr.FK_Node, int.Parse(inStr)); } else { qo.AddWhereIn(GenerWorkerListAttr.FK_Node, "(" + inStr + ")"); } qo.DoQuery(); foreach (GenerWorkerList wl in wls) { Node subNd = new Node(wl.FK_Node); Work subWK = subNd.GetWork(wl.WorkID); subWK.Delete(); //删除分流下步骤的节点信息. DeleteToNodesData(subNd.HisToNodes); } DBAccess.RunSQL("DELETE WF_GenerWorkFlow WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); DBAccess.RunSQL("DELETE WF_GenerWorkerList WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); DBAccess.RunSQL("DELETE WF_GenerFH WHERE FID=" + dbStr + "WorkID", "WorkID", this.WorkID); } DeleteToNodesData(nd.HisToNodes); } }
private void ReorderLog(Node fromND, Node toND) { /*开始遍历到达的节点集合*/ foreach (Node nd in fromND.HisToNodes) { Work wk = nd.HisWork; wk.OID = this.WorkID; if (wk.RetrieveFromDBSources() == 0) { wk.FID = this.WorkID; if (wk.Retrieve(WorkAttr.FID, this.WorkID) == 0) { continue; } } if (nd.IsFL) { /* 如果是分流 */ GenerWorkerLists wls = new GenerWorkerLists(); QueryObject qo = new QueryObject(wls); qo.AddWhere(GenerWorkerListAttr.FID, this.WorkID); qo.addAnd(); string[] ndsStrs = nd.HisToNDs.Split('@'); string inStr = ""; foreach (string s in ndsStrs) { if (s == "" || s == null) { continue; } inStr += "'" + s + "',"; } inStr = inStr.Substring(0, inStr.Length - 1); if (inStr.Contains(",") == true) { qo.AddWhere(GenerWorkerListAttr.FK_Node, int.Parse(inStr)); } else { qo.AddWhereIn(GenerWorkerListAttr.FK_Node, "(" + inStr + ")"); } qo.DoQuery(); foreach (GenerWorkerList wl in wls) { Node subNd = new Node(wl.FK_Node); Work subWK = subNd.GetWork(wl.WorkID); infoLog += "\r\n*****************************************************************************************"; infoLog += "\r\n节点ID:" + subNd.NodeID + " 工作名称:" + subWK.EnDesc; infoLog += "\r\n处理人:" + subWK.Rec + " , " + wk.RecOfEmp.Name; infoLog += "\r\n接收时间:" + subWK.RDT + " 处理时间:" + subWK.CDT; infoLog += "\r\n ------------------------------------------------- "; foreach (Attr attr in wk.EnMap.Attrs) { if (attr.UIVisible == false) { continue; } infoLog += "\r\n " + attr.Desc + ":" + subWK.GetValStrByKey(attr.Key); } //递归调用。 ReorderLog(subNd, toND); } } else { infoLog += "\r\n*****************************************************************************************"; infoLog += "\r\n节点ID:" + wk.NodeID + " 工作名称:" + wk.EnDesc; infoLog += "\r\n处理人:" + wk.Rec + " , " + wk.RecOfEmp.Name; infoLog += "\r\n接收时间:" + wk.RDT + " 处理时间:" + wk.CDT; infoLog += "\r\n ------------------------------------------------- "; foreach (Attr attr in wk.EnMap.Attrs) { if (attr.UIVisible == false) { continue; } infoLog += "\r\n" + attr.Desc + " : " + wk.GetValStrByKey(attr.Key); } } /* 如果到了当前的节点 */ if (nd.NodeID == toND.NodeID) { break; } //递归调用。 ReorderLog(nd, toND); } }
private void BindSearch() { Flow fl = new Flow(this.FK_Flow); var gwfs = new GenerWorkFlows(); var qo = new QueryObject(gwfs); qo.AddWhere(GenerWorkFlowAttr.FK_Flow, FK_Flow); if (!string.IsNullOrWhiteSpace(Depts)) { qo.addAnd(); qo.AddWhereIn(GenerWorkFlowAttr.FK_Dept, "(" + Depts + ")"); } if (!string.IsNullOrWhiteSpace(Emps)) { qo.addAnd(); qo.AddWhereIn(GenerWorkFlowAttr.Starter, "(" + Emps.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Aggregate(string.Empty, (curr, next) => curr + "'" + next + "',").TrimEnd(',') + ")"); } if (!string.IsNullOrWhiteSpace(DateFrom)) { qo.addAnd(); qo.AddWhere(GenerWorkFlowAttr.RDT, ">", DateFrom); } if (!string.IsNullOrWhiteSpace(DateTo)) { qo.addAnd(); qo.AddWhere(GenerWorkFlowAttr.RDT, "<=", DateTo); } if (!string.IsNullOrWhiteSpace(Keywords)) { qo.addAnd(); qo.AddWhere(GenerWorkFlowAttr.Title, "LIKE", "%" + Keywords + "%"); } qo.addOrderBy(GenerWorkFlowAttr.RDT); var url = string.Format("FlowDB.aspx?FK_Flow={0}&WorkID={1}&IsSearch=1&Depts={2}&DeptsText={3}&Emps={4}&EmpsText={5}&DateFrom={6}&DateTo={7}&Keywords={8}", FK_Flow, WorkID, Depts, DeptsText, Emps, EmpsText, DateFrom, DateTo, Keywords); Pub2.BindPageIdxEasyUi(qo.GetCount(), url, this.PageIdx, SystemConfig.PageSize); qo.DoQuery(gwfs.GetNewEntity.PK, SystemConfig.PageSize, this.PageIdx); this.Pub1.AddTable("class='Table' cellspacing='0' cellpadding='0' border='0' style='width:100%'"); Pub1.AddTR(); Pub1.AddTDGroupTitle("colspan='8'", fl.Name); Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDGroupTitle("style='text-align:center'", "序号"); this.Pub1.AddTDGroupTitle("部门"); this.Pub1.AddTDGroupTitle("发起人"); this.Pub1.AddTDGroupTitle("发起时间"); this.Pub1.AddTDGroupTitle("当前停留节点"); this.Pub1.AddTDGroupTitle("标题"); this.Pub1.AddTDGroupTitle("处理人"); this.Pub1.AddTDGroupTitle("操作"); this.Pub1.AddTREnd(); int idx = 0; foreach (GenerWorkFlow item in gwfs) { idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(SystemConfig.PageSize * (this.PageIdx - 1) + idx); this.Pub1.AddTD(item.DeptName); this.Pub1.AddTD(item.StarterName); this.Pub1.AddTD(item.RDT); this.Pub1.AddTD(item.NodeName); this.Pub1.AddTD(item.Title); this.Pub1.AddTD(item.TodoEmps); this.Pub1.AddTDBegin(); this.Pub1.Add("<a href=\"javascript:WinOpen('./../../WFRpt.aspx?WorkID=" + item.WorkID + "&FK_Flow=" + this.FK_Flow + "&FID=" + item.FID + "','ds'); \" class='easyui-linkbutton'>轨迹</a> "); //this.Pub1.Add("<a href=\"javascript:WinOpen('../../../WFRpt.aspx?WorkID=" + item.WorkID + "&FK_Flow=" + this.FK_Flow + "&FID=" + item.FID + "&FK_Node=" + item.FK_Node + "','ds'); \" >报告</a>-"); this.Pub1.Add("<a href=\"javascript:DelIt('" + item.FK_Flow + "','" + item.WorkID + "');\" class='easyui-linkbutton' data-options=\"iconCls:'icon-delete'\" onclick=\"return confirm('您确定要删除吗?');\">删除</a> "); this.Pub1.Add("<a href=\"javascript:FlowShift('" + item.FK_Flow + "','" + item.WorkID + "');\" class='easyui-linkbutton'>移交</a> "); this.Pub1.Add("<a href=\"javascript:FlowSkip('" + item.FK_Flow + "','" + item.WorkID + "');\" class='easyui-linkbutton'>跳转</a>"); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
public void BindData() { string ensname = this.Request.QueryString["EnsName"]; if (ensname == null) { ensname = this.Request.QueryString["EnsName"]; } Entities ens = BP.En.ClassFactory.GetEns(ensname); Entity en = ens.GetNewEntity; QueryObject qo = new QueryObject(ens); string[] strs = this.Request.RawUrl.Split('&'); string[] strs1 = this.Request.RawUrl.Split('&'); foreach (string str in strs) { if (str.IndexOf("EnsName") != -1) { continue; } string[] mykey = str.Split('='); string key = mykey[0]; if (key == "OID" || key == "MyPK") { continue; } if (key == "FK_Dept") { this.FK_Dept = mykey[1]; continue; } if (en.EnMap.Attrs.Contains(key) == false) { continue; } if (mykey[1] == "mvals") { //如果用户多项选择了,就要找到它的选择项目. UserRegedit sUr = new UserRegedit(); sUr.MyPK = WebUser.No + this.EnsName + "_SearchAttrs"; sUr.RetrieveFromDBSources(); /* 如果是多选值 */ string cfgVal = sUr.MVals; AtPara ap = new AtPara(cfgVal); string instr = ap.GetValStrByKey(key); string val = ""; if (instr == null || instr == "") { if (key == "FK_Dept" || key == "FK_Unit") { if (key == "FK_Dept") { val = WebUser.FK_Dept; } } else { continue; } } else { instr = instr.Replace("..", "."); instr = instr.Replace(".", "','"); instr = instr.Substring(2); instr = instr.Substring(0, instr.Length - 2); qo.AddWhereIn(mykey[0], instr); } } else { qo.AddWhere(mykey[0], mykey[1]); } qo.addAnd(); } if (this.FK_Dept != null && (this.Request.QueryString["FK_Emp"] == null || this.Request.QueryString["FK_Emp"] == "all")) { if (this.FK_Dept.Length == 2) { qo.AddWhere("FK_Dept", " = ", "all"); qo.addAnd(); } else { if (this.FK_Dept.Length == 8) { //if (this.Request.QueryString["ByLike"] != "1") qo.AddWhere("FK_Dept", " = ", this.FK_Dept); } else { qo.AddWhere("FK_Dept", " like ", this.FK_Dept + "%"); } qo.addAnd(); } } qo.AddHD(); if (this.DoType == "Exp") { /*如果是导出,就把它导出到excel.*/ this.ExportDGToExcel(qo.DoQueryToTable(), en.EnMap, en.EnDesc + "数据导出"); this.WinClose(); return; } int num = qo.DoQuery(); // Log.DebugWriteWarning(qo.SQL); // Log.DefaultLogWriteLineError(qo.SQL); this.ShowTitle = ens.GetNewEntity.EnMap.EnDesc + ",数据:" + num + " 条。"; this.UCSys1.DataPanelDtl(ens, null); }