/// <summary> /// 撤销发送 /// </summary> public void UnSend() { /*撤销发送*/ this.Pub2.AddEasyUiPanelInfoBegin("撤销发送"); //查询是否有权限撤销发送 GenerWorkerLists workerlists = new GenerWorkerLists(); QueryObject info = new QueryObject(workerlists); info.AddWhere(GenerWorkerListAttr.FK_Emp, WebUser.No); info.addAnd(); info.AddWhere(GenerWorkerListAttr.IsPass, "1"); info.addAnd(); info.AddWhere(GenerWorkerListAttr.IsEnable, "1"); info.addAnd(); info.AddWhere(GenerWorkerListAttr.WorkID, this.WorkID); int count = info.DoQuery(); if (count > 0) { this.Pub2.Add("<a href =\"javascript:UnSend('" + this.FK_Flow + "','" + this.WorkID + "','" + FID + "')\" >撤销发送</a>"); } else { this.Pub2.Add("您没有此权限."); } this.Pub2.AddEasyUiPanelInfoEnd(); Pub2.AddBR(); }
/// <summary> /// 查询 /// </summary> /// <returns></returns> public string Search_Search() { string TSpan = this.GetRequestVal("TSpan"); string FK_Flow = this.GetRequestVal("FK_Flow"); GenerWorkFlows gwfs = new GenerWorkFlows(); QueryObject qo = new QueryObject(gwfs); qo.AddWhere(GenerWorkFlowAttr.Emps, " LIKE ", "%" + BP.Web.WebUser.No + "%"); if (!DataType.IsNullOrEmpty(TSpan)) { qo.addAnd(); qo.AddWhere(GenerWorkFlowAttr.TSpan, this.GetRequestVal("TSpan")); } if (!DataType.IsNullOrEmpty(FK_Flow)) { qo.addAnd(); qo.AddWhere(GenerWorkFlowAttr.FK_Flow, this.GetRequestVal("FK_Flow")); } qo.Top = 50; if (SystemConfig.AppCenterDBType == DBType.Oracle || SystemConfig.AppCenterDBType == DBType.PostgreSQL) { qo.DoQuery(); DataTable dt = gwfs.ToDataTableField("Ens"); return(BP.Tools.Json.ToJson(dt)); } else { DataTable dt = qo.DoQueryToTable(); return(BP.Tools.Json.ToJson(dt)); } }
/// <summary> /// 查询. /// </summary> /// <param name="EnsName"></param> /// <param name="key"></param> /// <param name="FK_Emp"></param> public void Retrieve(string EnsName, string key, int FK_Emp) { QueryObject qo = new QueryObject(this); qo.AddWhere(DefValAttr.AttrKey, key); qo.addAnd(); qo.AddWhere(DefValAttr.EnsName, EnsName); qo.addAnd(); qo.AddWhere(DefValAttr.FK_Emp, FK_Emp); qo.DoQuery(); }
/// <summary> /// 报表模板 /// </summary> /// <param name="fk_emp">fk_emp</param> /// <param name="className">className</param> /// <param name="attrs">attrs</param> /// <returns>查询返回个数</returns> public int Search(string fk_emp, string className, string attrs) { QueryObject qo = new QueryObject(this); qo.AddWhere(GroupEnsTemplateAttr.Rec, fk_emp); qo.addAnd(); qo.AddWhere(GroupEnsTemplateAttr.Attrs, className); qo.addAnd(); qo.AddWhere(GroupEnsTemplateAttr.EnsName, className); return(qo.DoQuery()); }
public GenerWorkerLists(Int64 workId, int nodeId, string FK_Emp) { QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Emp, FK_Emp); qo.DoQuery(); return; }
/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { try { string sql = "select NO from Sys_MapData where No not in(select No from Sys_MapDtl) and No not like '%Rpt'"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt != null) { foreach (DataRow row in dt.Rows) { MapAttrs attrs = new MapAttrs(); QueryObject qo = new QueryObject(attrs); qo.AddWhere(MapAttrAttr.FK_MapData, row["NO"].ToString()); qo.addAnd(); qo.AddWhere(MapAttrAttr.UIVisible, true); qo.addOrderBy(MapAttrAttr.Y, MapAttrAttr.X); qo.DoQuery(); int rowIdx = 0; foreach (MapAttr mapAttr in attrs) { mapAttr.Idx = rowIdx; mapAttr.DirectUpdate(); rowIdx++; } } } return("执行成功..."); } catch (Exception ex) { } return("执行失败..."); }
/// <summary> /// 查询 /// </summary> /// <param name="enName"></param> /// <returns></returns> public int RetrieveFieldGroup(string enName) { QueryObject qo = new QueryObject(this); qo.AddWhere(GroupFieldAttr.FrmID, enName); qo.addAnd(); qo.AddWhereIsNull(GroupFieldAttr.CtrlID); //qo.AddWhereLen(GroupFieldAttr.CtrlID, " = ", 0, SystemConfig.AppCenterDBType); int num = qo.DoQuery(); if (num == 0) { GroupField gf = new GroupField(); gf.FrmID = enName; MapData md = new MapData(); md.No = enName; if (md.RetrieveFromDBSources() == 0) { gf.Lab = "基础信息"; } else { gf.Lab = md.Name; } gf.Idx = 0; gf.Insert(); this.AddEntity(gf); return(1); } return(num); }
void btn_Del_Click(object sender, EventArgs e) { try { // 检查这个类型是否被使用? MapAttrs attrs = new MapAttrs(); QueryObject qo = new QueryObject(attrs); qo.AddWhere(MapAttrAttr.MyDataType, (int)FieldTypeS.Enum); qo.addAnd(); qo.AddWhere(MapAttrAttr.KeyOfEn, this.RefNo); int i = qo.DoQuery(); if (i == 0) { BP.Sys.SysEnums ses = new SysEnums(); ses.Delete(BP.Sys.SysEnumAttr.EnumKey, this.RefNo); BP.Sys.SysEnumMain m = new SysEnumMain(); m.No = this.RefNo; m.Delete(); this.ToMsgPage("删除成功"); return; } string msg = "错误:下列数据已经引用了枚举您不能删除它。"; // "错误:下列数据已经引用了枚举您不能删除它。"; foreach (MapAttr attr in attrs) { msg += "\t\n" + attr.Field + "" + attr.Name + " Table = " + attr.FK_MapData; } return; } catch (Exception ex) { this.ToErrorPage(ex.Message); } }
void btn_Del_Click(object sender, EventArgs e) { try { // 检查这个类型是否被使用? MapAttrs attrs = new MapAttrs(); QueryObject qo = new QueryObject(attrs); qo.AddWhere(MapAttrAttr.MyDataType, (int)FieldTypeS.FK); qo.addAnd(); qo.AddWhere(MapAttrAttr.KeyOfEn, this.RefNo); int i = qo.DoQuery(); if (i == 0) { BP.Sys.SFTable m = new SFTable(); m.No = this.RefNo; m.Delete(); this.ToMsgPage("外键删除成功"); return; } string msg = "错误:下列数据已经引用了外键您不能删除它。"; foreach (MapAttr attr in attrs) { msg += "\t\n" + attr.Field + "" + attr.Name + " 表" + attr.FK_MapData; } throw new Exception(msg); } catch (Exception ex) { this.ToErrorPage(ex.Message); } }
public bool Full(string enumKey) { Entities ens = (Entities)Cash.GetObjFormApplication("EnumOf" + enumKey + Web.WebUser.SysLang, null); if (ens != null) { this.AddEntities(ens); return(true); } QueryObject qo = new QueryObject(this); qo.AddWhere(SysEnumAttr.EnumKey, enumKey); qo.addAnd(); qo.AddWhere(SysEnumAttr.Lang, Web.WebUser.SysLang); qo.addOrderBy(SysEnumAttr.IntKey); if (qo.DoQuery() == 0) { /* 看看xml配置里面是否有?*/ return(false); } Cash.AddObj("EnumOf" + enumKey + Web.WebUser.SysLang, Depositary.Application, this); return(true); }
public SysDocFiles(string _tableName, string _key) { QueryObject qo = new QueryObject(this); qo.AddWhere(SysDocFileAttr.EnName, _tableName); qo.addAnd(); qo.AddWhere(SysDocFileAttr.RefKey, _key); qo.DoQuery(); }
/// <summary> /// 节点方向 /// </summary> /// <param name="NodeID">节点ID</param> /// <param name="dirType">类型</param> public Directions(int NodeID, int dirType) { QueryObject qo = new QueryObject(this); qo.AddWhere(DirectionAttr.Node, NodeID); qo.addAnd(); qo.AddWhere(DirectionAttr.DirType, dirType); qo.DoQuery(); }
/// <summary> /// 取回任务集合 /// </summary> public GetTasks(string fk_flow) { QueryObject qo = new QueryObject(this); qo.AddWhere(GetTaskAttr.FK_Flow, fk_flow); qo.addAnd(); qo.AddWhereLen(GetTaskAttr.CheckNodes, " >= ", 3, SystemConfig.AppCenterDBType); qo.DoQuery(); }
/// <summary> /// 文件管理者 /// </summary> /// <param name="EnName"></param> /// <param name="refval"></param> public SysFileManagers(string EnName, string refval) { QueryObject qo = new QueryObject(this); qo.AddWhere(SysFileManagerAttr.EnName, EnName); qo.addAnd(); qo.AddWhere(SysFileManagerAttr.RefVal, refval); qo.DoQuery(); }
public int Retrieve(string fromDataTime, string toDataTime) { QueryObject qo = new QueryObject(this); qo.Top = 90000; qo.AddWhere(WorkAttr.RDT, " >=", fromDataTime); qo.addAnd(); qo.AddWhere(WorkAttr.RDT, " <= ", toDataTime); return(qo.DoQuery()); }
/// <summary> /// 查询工作(不适合审核节点查询) /// </summary> /// <param name="empId">工作人员</param> /// <param name="nodeStat">节点状态</param> /// <param name="fromdate">记录日期从</param> /// <param name="todate">记录日期到</param> /// <returns></returns> public int Retrieve(string key, string empId, string fromdate, string todate) { QueryObject qo = new QueryObject(this); qo.AddWhere(WorkAttr.Rec, empId); qo.addAnd(); qo.AddWhere(WorkAttr.RDT, ">=", fromdate); qo.addAnd(); qo.AddWhere(WorkAttr.RDT, "<=", todate); if (key.Trim().Length == 0) { return(qo.DoQuery()); } else { if (key.IndexOf("%") == -1) { key = "%" + key + "%"; } Entity en = this.GetNewEntity; qo.addAnd(); qo.addLeftBracket(); qo.AddWhere(en.PK, " LIKE ", key); foreach (Attr attr in en.EnMap.Attrs) { if (attr.MyFieldType == FieldType.RefText) { continue; } if (attr.UIContralType == UIContralType.DDL || attr.UIContralType == UIContralType.CheckBok) { continue; } qo.addOr(); qo.AddWhere(attr.Key, " LIKE ", key); } qo.addRightBracket(); return(qo.DoQuery()); } }
/// <summary> /// 节点表单 /// </summary> /// <param name="NodeID">节点ID</param> public FrmNodes(string fk_flow, int nodeID) { QueryObject qo = new QueryObject(this); qo.AddWhere(FrmNodeAttr.FK_Flow, fk_flow); qo.addAnd(); qo.AddWhere(FrmNodeAttr.FK_Node, nodeID); qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); }
public int SearchMapAttrsYesVisable(string fk_map) { QueryObject qo = new QueryObject(this); qo.AddWhere(MapAttrAttr.FK_MapData, fk_map); qo.addAnd(); qo.AddWhere(MapAttrAttr.UIVisible, 1); qo.addOrderBy(MapAttrAttr.GroupID, MapAttrAttr.Idx); // qo.addOrderBy(MapAttrAttr.Idx); return(qo.DoQuery()); }
void btn_Click(object sender, EventArgs e) { GEEntitys rpts = (GEEntitys)BP.DA.ClassFactory.GetEns(this.EnsName); GEEntity rpt = (GEEntity)rpts.GetNewEntity; Flow fl = new Flow(this.FK_Flow); Button btn = (Button)sender; if (btn.ID == "Btn_Excel") { QueryObject qo = new QueryObject(rpts); qo.AddWhere(WorkAttr.Rec, WebUser.No); qo.addAnd(); if (BP.SystemConfig.AppCenterDBType == DBType.Access) { qo.AddWhere("Mid(RDT,1,10) >='" + this.DT_F + "' AND Mid(RDT,1,10) <='" + this.DT_T + "' "); } else { qo.AddWhere("" + BP.SystemConfig.AppCenterDBSubstringStr + "(RDT,1,10) >='" + this.DT_F + "' AND " + BP.SystemConfig.AppCenterDBSubstringStr + "(RDT,1,10) <='" + this.DT_T + "' "); } this.Pub2.BindPageIdx(qo.GetCount(), this.PageSize, this.PageIdx, "?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName); qo.DoQuery(); try { //this.ExportDGToExcel(ens.ToDataTableDescField(), this.HisEn.EnDesc); this.ExportDGToExcel(rpts.ToDataTableDesc(), fl.Name); } catch (Exception ex) { try { this.ExportDGToExcel(rpts.ToDataTableDescField(), fl.Name); } catch { this.ToErrorPage("数据没有正确导出可能的原因之一是:系统管理员没正确的安装Excel组件,请通知他,参考安装说明书解决。@系统异常信息:" + ex.Message); } } return; } this.Session["DF"] = this.Pub1.GetTextBoxByID("TB_F").Text; this.Session["DT"] = this.Pub1.GetTextBoxByID("TB_T").Text; this.Response.Redirect("FlowSearchMyWork.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName, true); }
/// <summary> /// 工作者 /// </summary> /// <param name="workId">工作者ID</param> /// <param name="flowNo">流程编号</param> public GenerWorkerLists(Int64 workId, string flowNo) { if (workId == 0) { return; } Flow fl = new Flow(flowNo); QueryObject qo = new QueryObject(this); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Flow, flowNo); qo.DoQuery(); }
/// <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(); }
/// <summary> /// 初始化工具栏 /// </summary> private void InitToolsBar() { string toolsDefault = ""; //保存 toolsDefault += "<a id=\"save\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-save'\" onclick=\"EventFactory('save')\">保存</a>"; //轨迹 toolsDefault += "<a id=\"Track\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-flowmap'\" onclick=\"EventFactory('showchart')\">轨迹</a>"; ////查询 //toolsDefault += "<a id=\"Search\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-search'\" onclick=\"EventFactory('search')\">查询</a>"; //扩展工具,显示位置为工具栏类型 NodeToolbars extToolBars = new NodeToolbars(); QueryObject info = new QueryObject(extToolBars); info.AddWhere(NodeToolbarAttr.FK_Node, this.FK_Node); info.addAnd(); info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Toolbar); info.DoQuery(); foreach (NodeToolbar item in extToolBars) { string url = ""; if (string.IsNullOrEmpty(item.Url)) { continue; } string urlExt = this.RequestParas; url = item.Url; if (url.Contains("?")) { url += urlExt; } else { url += "?" + urlExt; } toolsDefault += "<a target=\"" + item.Target + "\" href=\"" + url + "\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-new'\">" + item.Title + "</a>"; } //关闭 toolsDefault += "<a id=\"closeWin\" href=\"#\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-no'\" onclick=\"EventFactory('closeWin')\">关闭</a>"; //添加内容 this.toolBars.InnerHtml = toolsDefault; }
/// <summary> /// 初始化Home /// </summary> /// <returns></returns> public string Home_Init() { Hashtable ht = new Hashtable(); ht.Add("UserNo", BP.Web.WebUser.No); ht.Add("UserName", BP.Web.WebUser.Name); //系统名称. ht.Add("SysName", BP.Sys.SystemConfig.SysName); ht.Add("CustomerName", BP.Sys.SystemConfig.CustomerName); ht.Add("Todolist_EmpWorks", BP.WF.Dev2Interface.Todolist_EmpWorks); ht.Add("Todolist_Runing", BP.WF.Dev2Interface.Todolist_Runing); ht.Add("Todolist_Sharing", BP.WF.Dev2Interface.Todolist_Sharing); ht.Add("Todolist_CCWorks", BP.WF.Dev2Interface.Todolist_CCWorks); ht.Add("Todolist_Apply", BP.WF.Dev2Interface.Todolist_Apply); //申请下来的任务个数. ht.Add("Todolist_Draft", BP.WF.Dev2Interface.Todolist_Draft); //草稿数量. ht.Add("Todolist_Complete", BP.WF.Dev2Interface.Todolist_Complete); //完成数量. ht.Add("UserDeptName", WebUser.FK_DeptName); //我发起 MyStartFlows myStartFlows = new MyStartFlows(); QueryObject obj = new QueryObject(myStartFlows); obj.AddWhere(MyStartFlowAttr.Starter, WebUser.No); obj.addAnd(); //运行中\已完成\挂起\退回\转发\加签\批处理\ obj.addLeftBracket(); obj.AddWhere("WFState=2 or WFState=3 or WFState=4 or WFState=5 or WFState=6 or WFState=8 or WFState=10"); obj.addRightBracket(); obj.DoQuery(); ht.Add("Todolist_MyStartFlow", myStartFlows.Count); //我参与 MyJoinFlows myFlows = new MyJoinFlows(); obj = new QueryObject(myFlows); obj.AddWhere("Emps like '%" + WebUser.No + "%'"); obj.DoQuery(); ht.Add("Todolist_MyFlow", myFlows.Count); return(BP.Tools.Json.ToJsonEntityModel(ht)); }
void btn_Click(object sender, EventArgs e) { Button btn = (Button)sender; if (btn.ID == "Btn_Excel") { Node nd = new Node(this.FK_Node); Works wks = nd.HisWorks; QueryObject qo = new QueryObject(wks); qo.AddWhere(WorkAttr.Rec, WebUser.No); qo.addAnd(); qo.AddWhere(BP.Sys.SystemConfig.AppCenterDBSubstringStr + "(RDT,1,10) >='" + this.DT_F + "' AND " + BP.Sys.SystemConfig.AppCenterDBSubstringStr + "(RDT,1,10) <='" + this.DT_T + "' "); this.Pub2.BindPageIdx(qo.GetCount(), this.PageSize, this.PageIdx, "FlowSearch.aspx?FK_Node=" + this.FK_Node); qo.DoQuery(); try { //this.ExportDGToExcel(ens.ToDataTableDescField(), this.HisEn.EnDesc); this.ExportDGToExcel(wks.ToDataTableDesc(), nd.Name); } catch (Exception ex) { try { this.ExportDGToExcel(wks.ToDataTableDescField(), nd.Name); } catch (Exception ex1) { this.ToErrorPage("数据没有正确导出可能的原因之一是:系统管理员没正确的安装Excel组件,请通知他,参考安装说明书解决。@系统异常信息:" + ex.Message + ex1.Message); } } return; } this.Session["DF"] = this.Pub1.GetTextBoxByID("TB_F").Text; this.Session["DT"] = this.Pub1.GetTextBoxByID("TB_T").Text; this.Response.Redirect("FlowSearch.aspx?FK_Node=" + this.FK_Node, true); }
/// <summary> /// 取得目录实体与子实体关联的key /// 如果关联不上就返回null. /// </summary> /// <param name="cateEns">目录实体</param> /// <param name="subEns">子实体</param> /// <returns>关联的键</returns> public static string GetRefSubEnKey(string cateEns, string subEns) { //return "FK_Dept"; SysEnsRefs ens = new SysEnsRefs(); QueryObject qo = new QueryObject(ens); qo.AddWhere(EnsRefAttr.CateEns, cateEns); qo.addAnd(); qo.AddWhere(EnsRefAttr.SubEns, subEns); int i = qo.DoQuery(); if (i == 0) { return(null); } SysEnsRef en = (SysEnsRef)ens[0]; return(en.RefSubEnKey); //return ens[0].GetValStringByKey(EnsRefAttr.RefSubEnKey); }
public string GenerWorkNode(string fk_flow, int fk_node, Int64 workID, Int64 fid, string userNo) { try { Emp emp = new Emp(userNo); BP.Web.WebUser.SignInOfGener(emp); MapData md = new MapData(); md.No = "ND" + fk_node; if (md.RetrieveFromDBSources() == 0) { throw new Exception("装载错误,该表单ID=" + md.No + "丢失,请修复一次流程重新加载一次."); } DataSet myds = md.GenerHisDataSet(); // 节点数据. Node nd = new Node(fk_node); myds.Tables.Add(nd.ToDataTableField("WF_Node")); //节点标签数据. BtnLab btnLab = new BtnLab(fk_node); myds.Tables.Add(btnLab.ToDataTableField("WF_BtnLab")); // 流程数据. Flow fl = new Flow(fk_flow); myds.Tables.Add(fl.ToDataTableField("WF_Flow")); //.工作数据放里面去, 放进去前执行一次装载前填充事件. BP.WF.Work wk = nd.HisWork; wk.OID = workID; wk.RetrieveFromDBSources(); wk.ResetDefaultVal(); // 执行一次装载前填充. string msg = md.FrmEvents.DoEventNode(FrmEventList.FrmLoadBefore, wk); if (string.IsNullOrEmpty(msg) == false) { return(msg); } myds.Tables.Add(wk.ToDataTableField("Main")); #region 获取明细表数据,并把它加入dataset里. if (md.MapDtls.Count > 0) { foreach (MapDtl dtl in md.MapDtls) { GEDtls dtls = new GEDtls(dtl.No); QueryObject qo = null; try { qo = new QueryObject(dtl); switch (dtl.DtlOpenType) { case DtlOpenType.ForEmp: // 按人员来控制. qo.AddWhere(GEDtlAttr.RefPK, workID); qo.addAnd(); qo.AddWhere(GEDtlAttr.Rec, WebUser.No); break; case DtlOpenType.ForWorkID: // 按工作ID来控制 qo.AddWhere(GEDtlAttr.RefPK, workID); break; case DtlOpenType.ForFID: // 按流程ID来控制. qo.AddWhere(GEDtlAttr.FID, workID); break; } } catch { dtls.GetNewEntity.CheckPhysicsTable(); } DataTable dtDtl = qo.DoQueryToTable(); dtDtl.TableName = dtl.No; //修改明细表的名称. myds.Tables.Add(dtDtl); //加入这个明细表. } } #endregion //把流程信息表发送过去. GenerWorkFlow gwf = new GenerWorkFlow(); gwf.WorkID = workID; myds.Tables.Add(gwf.ToDataTableField("WF_GenerWorkFlow")); if (gwf.WFState == WFState.Forward) { //如果是转发. BP.WF.ForwardWorks fws = new ForwardWorks(); fws.Retrieve(ForwardWorkAttr.WorkID, workID, ForwardWorkAttr.FK_Node, fk_node); myds.Tables.Add(fws.ToDataTableField("WF_ForwardWork")); } if (gwf.WFState == WFState.ReturnSta) { //如果是退回. ReturnWorks rts = new ReturnWorks(); rts.Retrieve(ReturnWorkAttr.WorkID, workID, ReturnWorkAttr.ReturnToNode, fk_node); myds.Tables.Add(rts.ToDataTableField("WF_ForwardWork")); } if (gwf.WFState == WFState.HungUp) { //如果是挂起. HungUps hups = new HungUps(); hups.Retrieve(HungUpAttr.WorkID, workID, HungUpAttr.FK_Node, fk_node); myds.Tables.Add(hups.ToDataTableField("WF_HungUp")); } //放入track信息. Paras ps = new Paras(); ps.SQL = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + BP.SystemConfig.AppCenterDBVarStr + "WorkID"; ps.Add("WorkID", workID); DataTable dt = DBAccess.RunSQLReturnTable(ps); dt.TableName = "Track"; myds.Tables.Add(dt); //写入数据. myds.WriteXml("c:\\sss.xml"); //转化成它所能识别的格式. return(Silverlight.DataSetConnector.Connector.ToXml(myds)); } catch (Exception ex) { Log.DebugWriteError(ex.StackTrace); return("@生成工作FK_Flow=" + fk_flow + ",FK_Node=" + fk_node + ",WorkID=" + workID + ",FID=" + fid + "错误,错误信息:" + ex.Message); } }
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="workId">工作ID</param> /// <param name="nodeId">节点ID</param> /// <param name="isWithEmpExts">是否包含为分配的人员</param> public GenerWorkerLists(Int64 workId, int nodeId, bool isWithEmpExts) { QueryObject qo = new QueryObject(this); qo.addLeftBracket(); qo.AddWhere(GenerWorkerListAttr.WorkID, workId); qo.addOr(); qo.AddWhere(GenerWorkerListAttr.FID, workId); qo.addRightBracket(); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId); int i = qo.DoQuery(); if (isWithEmpExts == false) { return; } if (i == 0) { throw new Exception("@系统错误,工作人员丢失请与管理员联系。NodeID=" + nodeId + " WorkID=" + workId); } RememberMe rm = new RememberMe(); rm.FK_Emp = BP.Web.WebUser.No; rm.FK_Node = nodeId; if (rm.RetrieveFromDBSources() == 0) { return; } GenerWorkerList wl = (GenerWorkerList)this[0]; string[] emps = rm.Emps.Split('@'); foreach (string emp in emps) { if (emp == null || emp == "") { continue; } if (this.GetCountByKey(GenerWorkerListAttr.FK_Emp, emp) >= 1) { continue; } GenerWorkerList mywl = new GenerWorkerList(); mywl.Copy(wl); mywl.IsEnable = false; mywl.FK_Emp = emp; WF.Port.WFEmp myEmp = new Port.WFEmp(emp); mywl.FK_EmpText = myEmp.Name; try { mywl.Insert(); } catch { mywl.Update(); continue; } this.AddEntity(mywl); } return; }
protected void Page_Load(object sender, EventArgs e) { Node nd = new Node(this.FK_Node); Work wk = nd.HisWork; wk.OID = this.WorkID; wk.Retrieve(); if (nd.HisNodeWorkType == NodeWorkType.WorkHL || nd.HisNodeWorkType == NodeWorkType.WorkFHL) { } else { this.AddFieldSetRed("err", "当前的节点(" + nd.Name + ")非合流点,您不能查看子线程."); return; } GenerWorkerLists wls = new GenerWorkerLists(); QueryObject qo = new QueryObject(wls); qo.AddWhere(GenerWorkerListAttr.FID, wk.OID); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.IsEnable, 1); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.IsPass, "!=", -2); int i = qo.DoQuery(); if (i == 1) { wls.Clear(); qo.clear(); qo.AddWhere(GenerWorkerListAttr.FID, wk.OID); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.IsEnable, 1); qo.addAnd(); qo.AddWhere(GenerWorkerListAttr.IsPass, "!=", -2); qo.DoQuery(); } //如果没有子流程就不让它显示 if (wls.Count > 0) { this.AddTable("border=0"); this.AddTR(); this.AddTDTitle("IDX"); this.AddTDTitle("节点"); this.AddTDTitle("处理人"); this.AddTDTitle("名称"); this.AddTDTitle("部门"); this.AddTDTitle("状态"); this.AddTDTitle("应完成日期"); this.AddTDTitle("实际完成日期"); this.AddTDTitle(""); this.AddTREnd(); bool is1 = false; int idx = 0; foreach (GenerWorkerList wl in wls) { idx++; is1 = this.AddTR(is1); this.AddTDIdx(idx); this.AddTD(wl.FK_NodeText); this.AddTD(wl.FK_Emp); this.AddTD(wl.FK_EmpText); this.AddTD(wl.FK_DeptT); if (wl.IsPass) { this.AddTD("已完成"); this.AddTD(wl.SDT); this.AddTD(wl.RDT); } else { this.AddTD("<font color=red>未完成</font>"); this.AddTD(wl.SDT); this.AddTD(); } if (wl.IsPass == false) { if (nd.ThreadKillRole == ThreadKillRole.ByHand) { this.AddTD("<a href=\"javascript:DoDelSubFlow('" + wl.FK_Flow + "','" + wl.WorkID + "')\"><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Btn/Delete.gif' border=0/>终止</a>"); } else { this.AddTD(); } } else { this.AddTD("<a href=\"javascript:WinOpen('" + BP.WF.Glo.CCFlowAppPath + "WF/FHLFlow.aspx?WorkID=" + wl.WorkID + "&FID=" + wl.FID + "&FK_Flow=" + nd.FK_Flow + "&FK_Node=" + this.FK_Node + "','po9')\">打开</a>"); } this.AddTREnd(); } this.AddTableEnd(); } }
private string GetFlowFormTree() { string flowId = getUTF8ToString("flowId"); string nodeId = getUTF8ToString("nodeId"); //add root BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree(); root.No = "01"; root.ParentNo = "0"; root.Name = "目录"; root.NodeType = "root"; appFlowFormTree.Clear(); appFlowFormTree.AddEntity(root); #region 添加表单及文件夹 //节点表单 FrmNodes frmNodes = new FrmNodes(); QueryObject qo = new QueryObject(frmNodes); qo.AddWhere(FrmNodeAttr.FK_Node, nodeId); qo.addAnd(); qo.AddWhere(FrmNodeAttr.FK_Flow, flowId); qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); //文件夹 SysFormTrees formTrees = new SysFormTrees(); formTrees.RetrieveAll(SysFormTreeAttr.Name); //所有表单集合 MapDatas mds = new MapDatas(); mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application); foreach (FrmNode frmNode in frmNodes) { foreach (MapData md in mds) { if (frmNode.FK_Frm != md.No) { continue; } foreach (SysFormTree formTree in formTrees) { if (md.FK_FormTree != formTree.No) { continue; } if (!appFlowFormTree.Contains("No", formTree.No)) { BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree(); nodeFolder.No = formTree.No; nodeFolder.ParentNo = root.No; nodeFolder.Name = formTree.Name; nodeFolder.NodeType = "folder"; appFlowFormTree.AddEntity(nodeFolder); } } //检查必填项 bool IsNotNull = false; FrmFields formFields = new FrmFields(); QueryObject obj = new QueryObject(formFields); obj.AddWhere(FrmFieldAttr.FK_Node, nodeId); obj.addAnd(); obj.AddWhere(FrmFieldAttr.FK_MapData, md.No); obj.addAnd(); obj.AddWhere(FrmFieldAttr.IsNotNull, "1"); obj.DoQuery(); if (formFields != null && formFields.Count > 0) { IsNotNull = true; } BP.WF.Template.FlowFormTree nodeForm = new BP.WF.Template.FlowFormTree(); nodeForm.No = md.No; nodeForm.ParentNo = md.FK_FormTree; nodeForm.Name = md.Name; nodeForm.NodeType = IsNotNull ? "form|1" : "form|0"; appFlowFormTree.AddEntity(nodeForm); } } #endregion //扩展工具,显示位置为表单树类型 NodeToolbars extToolBars = new NodeToolbars(); QueryObject info = new QueryObject(extToolBars); info.AddWhere(NodeToolbarAttr.FK_Node, nodeId); info.addAnd(); info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Tree); info.DoQuery(); foreach (NodeToolbar item in extToolBars) { string url = ""; if (string.IsNullOrEmpty(item.Url)) { continue; } url = item.Url; BP.WF.Template.FlowFormTree formTree = new BP.WF.Template.FlowFormTree(); formTree.No = item.OID.ToString(); formTree.ParentNo = "01"; formTree.Name = item.Title; formTree.NodeType = "tools|0"; if (!string.IsNullOrEmpty(item.Target) && item.Target.ToUpper() == "_BLANK") { formTree.NodeType = "tools|1"; } formTree.Url = url; appFlowFormTree.AddEntity(formTree); } TansEntitiesToGenerTree(appFlowFormTree, root.No, ""); return(appendMenus.ToString()); }