public void BindFrmLib() { this.Pub1.AddH2("表单库"); this.Pub1.AddTable("width=100% align=left"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("表单编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("物理表"); //this.Pub1.AddTDTitle("设计者"); //this.Pub1.AddTDTitle("设计单位"); //this.Pub1.AddTDTitle("联系方式"); this.Pub1.AddTREnd(); MapDatas mds = new MapDatas(); mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application); SysFormTrees fss = new SysFormTrees(); fss.RetrieveAll(); int idx = 0; foreach (SysFormTree fs in fss) { idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTD("colspan=6", "<b>" + fs.Name + "</b>"); this.Pub1.AddTREnd(); foreach (MapData md in mds) { if (md.FK_FrmSort != fs.No) { continue; } idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTD(md.No); this.Pub1.AddTDA("FlowFrms.aspx?ShowType=Frm&FK_MapData=" + md.No + "&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow, md.Name); this.Pub1.AddTD(md.PTable); //this.Pub1.AddTD(md.Designer); //this.Pub1.AddTD(md.DesignerUnit); //this.Pub1.AddTD(md.DesignerContact); this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD(); //this.Pub1.AddTD(); //this.Pub1.AddTDBegin("colspan=5"); //this.Pub1.AddTDEnd(); //this.Pub1.AddTREnd(); } } this.Pub1.AddTableEnd(); }
public void BindFrmSorts() { SysFormTrees fss = new SysFormTrees(); fss.RetrieveAll(); this.Pub1.AddH2("表单类别维护"); this.Pub1.AddHR(); this.Pub1.AddTable("align=left"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("序号"); this.Pub1.AddTDTitle("类别编号"); this.Pub1.AddTDTitle("类别名称"); this.Pub1.AddTREnd(); for (int i = 1; i <= 15; i++) { this.Pub1.AddTR(); this.Pub1.AddTDIdx(i); TextBox tb = new TextBox(); tb.Text = i.ToString().PadLeft(2, '0'); SysFormTree fs = fss.GetEntityByKey(SysFormTreeAttr.No, tb.Text) as SysFormTree; tb.ID = "TB_No_" + i; tb.Columns = 5; tb.ReadOnly = true; this.Pub1.AddTD(tb.Text); tb = new TextBox(); tb.ID = "TB_Name_" + i; tb.Columns = 40; if (fs != null) { tb.Text = fs.Name; } this.Pub1.AddTD(tb); this.Pub1.AddTREnd(); } Button btn = new Button(); btn.Text = "Save"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SaveFrmSort_Click); this.Pub1.Add(btn); this.Pub1.AddTR(); this.Pub1.AddTD("colspan=2", btn); this.Pub1.AddTD("要删除类别,请把文本框数据清空保存即可。"); this.Pub1.AddTREnd(); this.Pub1.AddTableEndWithHR(); }
private void AddChildNode(string parentNo, MapDatas mds, FrmNodes fns) { SysFormTrees formTrees = new SysFormTrees(); QueryObject objInfo = new QueryObject(formTrees); objInfo.AddWhere(SysFormTreeAttr.ParentNo, parentNo); objInfo.addOrderBy(SysFormTreeAttr.Name); objInfo.DoQuery(); int idx = 0; foreach (SysFormTree fs in formTrees) { idx++; foreach (MapData md in mds) { if (md.FK_FormTree != fs.No) { continue; } idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); CheckBox cb = new CheckBox(); cb.ID = "CB_" + md.No; cb.Text = md.No; cb.Checked = fns.Contains(FrmNodeAttr.FK_Frm, md.No); this.Pub1.AddTD(cb); this.Pub1.AddTD(md.Name); this.Pub1.AddTD(md.PTable); this.Pub1.AddTREnd(); } AddChildNode(fs.No, mds, fns); } }
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()); }
public override object Do() { string msg = ""; #region 检查数据文件是否完整. string path = "C:\\CCFlowTemplete"; if (System.IO.Directory.Exists(path) == false) { msg += "@错误:约定的目录不存在服务器" + path + ",请把从ccflow备份的文件放入" + path; } //PortTables. string file = path + "\\PortTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } //SysTables. file = path + "\\SysTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } //FlowTables. file = path + "\\FlowTables.xml"; if (System.IO.File.Exists(file) == false) { msg += "@错误:约定的文件不存在," + file; } #endregion 检查数据文件是否完整. #region 1 装载流程基础表数据. DataSet ds = new DataSet(); ds.ReadXml(path + "\\FlowTables.xml"); //流程类别. FlowSorts sorts = new FlowSorts(); sorts.ClearTable(); DataTable dt = ds.Tables["WF_FlowSort"]; // sorts = QueryObject.InitEntitiesByDataTable(sorts, dt, null) as FlowSorts; foreach (FlowSort item in sorts) { item.DirectInsert(); //插入数据. } #endregion 1 装载流程基础表数据. #region 2 组织结构. ds = new DataSet(); ds.ReadXml(path + "\\PortTables.xml"); //Port_Emp. Emps emps = new Emps(); emps.ClearTable(); dt = ds.Tables["Port_Emp"]; emps = QueryObject.InitEntitiesByDataTable(emps, dt, null) as Emps; foreach (Emp item in emps) { item.DirectInsert(); //插入数据. } //Depts. Depts depts = new Depts(); depts.ClearTable(); dt = ds.Tables["Port_Dept"]; depts = QueryObject.InitEntitiesByDataTable(depts, dt, null) as Depts; foreach (Dept item in depts) { item.DirectInsert(); //插入数据. } //Stations. Stations stas = new Stations(); stas.ClearTable(); dt = ds.Tables["Port_Station"]; stas = QueryObject.InitEntitiesByDataTable(stas, dt, null) as Stations; foreach (Station item in stas) { item.DirectInsert(); //插入数据. } //EmpDepts. EmpDepts eds = new EmpDepts(); eds.ClearTable(); dt = ds.Tables["Port_EmpDept"]; eds = QueryObject.InitEntitiesByDataTable(eds, dt, null) as EmpDepts; foreach (EmpDept item in eds) { item.DirectInsert(); //插入数据. } //EmpStations. EmpStations ess = new EmpStations(); ess.ClearTable(); dt = ds.Tables["Port_EmpStation"]; ess = QueryObject.InitEntitiesByDataTable(ess, dt, null) as EmpStations; foreach (EmpStation item in ess) { item.DirectInsert(); //插入数据. } #endregion 2 组织结构. #region 3 恢复系统数据. ds = new DataSet(); ds.ReadXml(path + "\\SysTables.xml"); //枚举Main. SysEnumMains sems = new SysEnumMains(); sems.ClearTable(); dt = ds.Tables["Sys_EnumMain"]; sems = QueryObject.InitEntitiesByDataTable(sems, dt, null) as SysEnumMains; foreach (SysEnumMain item in sems) { item.DirectInsert(); //插入数据. } //枚举. SysEnums ses = new SysEnums(); ses.ClearTable(); dt = ds.Tables["Sys_Enum"]; ses = QueryObject.InitEntitiesByDataTable(ses, dt, null) as SysEnums; foreach (SysEnum item in ses) { item.DirectInsert(); //插入数据. } ////Sys_FormTree. //BP.Sys.SysFormTrees sfts = new SysFormTrees(); //sfts.ClearTable(); //dt = ds.Tables["Sys_FormTree"]; //sfts = QueryObject.InitEntitiesByDataTable(sfts, dt, null) as SysFormTrees; //foreach (SysFormTree item in sfts) //{ // try // { // item.DirectInsert(); //插入数据. // } // catch // { // } //} #endregion 3 恢复系统数据. #region 4.备份表单相关数据. if (1 == 2) { string pathOfTables = path + "\\SFTables"; System.IO.Directory.CreateDirectory(pathOfTables); SFTables tabs = new SFTables(); tabs.RetrieveAll(); foreach (SFTable item in tabs) { if (item.No.Contains(".")) { continue; } string sql = "SELECT * FROM " + item.No; ds = new DataSet(); ds.Tables.Add(BP.DA.DBAccess.RunSQLReturnTable(sql)); ds.WriteXml(pathOfTables + "\\" + item.No + ".xml"); } } #endregion 4 备份表单相关数据. #region 5.恢复表单数据. //删除所有的流程数据. MapDatas mds = new MapDatas(); mds.RetrieveAll(); foreach (MapData fl in mds) { //if (fl.FK_FormTree.Length > 1 || fl.FK_FrmSort.Length > 1) // continue; fl.Delete(); //删除流程. } //清除数据. SysFormTrees fss = new SysFormTrees(); fss.ClearTable(); // 调度表单文件。 string frmPath = path + "\\Form"; DirectoryInfo dirInfo = new DirectoryInfo(frmPath); DirectoryInfo[] dirs = dirInfo.GetDirectories(); foreach (DirectoryInfo item in dirs) { if (item.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(item.FullName); if (fls.Length == 0) { continue; } SysFormTree fs = new SysFormTree(); fs.No = item.Name.Substring(0, item.Name.IndexOf('.')); fs.Name = item.Name.Substring(item.Name.IndexOf('.')); fs.ParentNo = "0"; fs.Insert(); foreach (string f in fls) { try { msg += "@开始调度表单模板文件:" + f; System.IO.FileInfo info = new System.IO.FileInfo(f); if (info.Extension != ".xml") { continue; } ds = new DataSet(); ds.ReadXml(f); MapData md = MapData.ImpMapData(ds, false); md.FK_FrmSort = fs.No; md.Update(); } catch (Exception ex) { msg += "@调度失败,文件:" + f + ",异常信息:" + ex.Message; } } } #endregion 5.恢复表单数据. #region 6.恢复流程数据. //删除所有的流程数据. Flows flsEns = new Flows(); flsEns.RetrieveAll(); foreach (Flow fl in flsEns) { fl.DoDelete(); //删除流程. } dirInfo = new DirectoryInfo(path + "\\Flow\\"); dirs = dirInfo.GetDirectories(); //删除数据. FlowSorts fsRoots = new FlowSorts(); fsRoots.ClearTable(); //生成流程树. FlowSort fsRoot = new FlowSort(); fsRoot.No = "99"; fsRoot.Name = "流程树"; fsRoot.ParentNo = "0"; fsRoot.DirectInsert(); foreach (DirectoryInfo dir in dirs) { if (dir.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(dir.FullName); if (fls.Length == 0) { continue; } FlowSort fs = new FlowSort(); fs.No = dir.Name.Substring(0, dir.Name.IndexOf('.')); fs.Name = dir.Name.Substring(3); fs.ParentNo = fsRoot.No; fs.Insert(); foreach (string filePath in fls) { msg += "@开始调度流程模板文件:" + filePath; Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo); msg += "@流程:" + myflow.Name + "装载成功。"; System.IO.FileInfo info = new System.IO.FileInfo(filePath); myflow.Name = info.Name.Replace(".xml", ""); if (myflow.Name.Substring(2, 1) == ".") { myflow.Name = myflow.Name.Substring(3); } myflow.DirectUpdate(); } } #endregion 6.恢复流程数据. BP.DA.Log.DefaultLogWriteLineInfo(msg); //删除多余的空格. BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField(); dts.Do(); //执行生成签名. GenerSiganture gs = new GenerSiganture(); gs.Do(); return(msg); }
/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { string path = this.GetValStrByKey("Path") + "_" + DateTime.Now.ToString("yy年MM月dd日HH时mm分"); if (System.IO.Directory.Exists(path)) { return("系统正在执行中,请稍后。"); } System.IO.Directory.CreateDirectory(path); System.IO.Directory.CreateDirectory(path + "\\Flow.流程模板"); System.IO.Directory.CreateDirectory(path + "\\Frm.表单模板"); Flows fls = new Flows(); fls.RetrieveAll(); FlowSorts sorts = new FlowSorts(); sorts.RetrieveAll(); // 生成流程模板。 foreach (FlowSort sort in sorts) { string pathDir = path + "\\Flow.流程模板\\" + sort.No + "." + sort.Name; System.IO.Directory.CreateDirectory(pathDir); foreach (Flow fl in fls) { fl.DoExpFlowXmlTemplete(pathDir); } } // 生成表单模板。 foreach (FlowSort sort in sorts) { string pathDir = path + "\\Frm.表单模板\\" + sort.No + "." + sort.Name; System.IO.Directory.CreateDirectory(pathDir); foreach (Flow fl in fls) { string pathFlowDir = pathDir + "\\" + fl.No + "." + fl.Name; System.IO.Directory.CreateDirectory(pathFlowDir); Nodes nds = new Nodes(fl.No); foreach (Node nd in nds) { MapData md = new MapData("ND" + nd.NodeID); System.Data.DataSet ds = md.GenerHisDataSet(); ds.WriteXml(pathFlowDir + "\\" + nd.NodeID + "." + nd.Name + ".Frm.xml"); } } } // 流程表单模板. SysFormTrees frmSorts = new SysFormTrees(); frmSorts.RetrieveAll(); foreach (SysFormTree sort in frmSorts) { string pathDir = path + "\\Frm.表单模板\\" + sort.No + "." + sort.Name; System.IO.Directory.CreateDirectory(pathDir); MapDatas mds = new MapDatas(); mds.Retrieve(MapDataAttr.FK_FrmSort, sort.No); foreach (MapData md in mds) { System.Data.DataSet ds = md.GenerHisDataSet(); ds.WriteXml(pathDir + "\\" + md.No + "." + md.Name + ".Frm.xml"); } } return("生成成功,请打开" + path + "。<br>如果您想共享出来请压缩后发送到template@ccflow.org"); }
/// <summary> /// 获取表单库所有表单 /// </summary> /// <returns></returns> public string BindForm_GenerForms() { //形成树 FlowFormTrees appendFormTrees = new FlowFormTrees(); //节点绑定表单 FrmNodes frmNodes = new FrmNodes(this.FK_Flow, this.FK_Node); //所有表单类别 SysFormTrees formTrees = new SysFormTrees(); formTrees.RetrieveAll(SysFormTreeAttr.Idx); //根节点 BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree(); root.Name = "表单库"; int i = root.Retrieve(FlowFormTreeAttr.ParentNo, 0); if (i != 0) { root.Name = "表单库"; root.No = "1"; root.NodeType = "root"; root.Insert(); } root.NodeType = "root"; appendFormTrees.AddEntity(root); foreach (SysFormTree formTree in formTrees) { //已经添加排除 if (appendFormTrees.Contains("No", formTree.No) == true) { continue; } //根节点排除 if (formTree.ParentNo.Equals("0")) { root.No = formTree.No; continue; } //文件夹 BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree(); nodeFolder.No = formTree.No; nodeFolder.ParentNo = formTree.ParentNo; nodeFolder.Name = formTree.Name; nodeFolder.NodeType = "folder"; if (formTree.ParentNo.Equals("0")) { nodeFolder.ParentNo = root.No; } appendFormTrees.AddEntity(nodeFolder); //表单 MapDatas mapS = new MapDatas(); mapS.RetrieveByAttr(MapDataAttr.FK_FormTree, formTree.No); if (mapS != null && mapS.Count > 0) { foreach (MapData map in mapS) { BP.WF.Template.FlowFormTree formFolder = new BP.WF.Template.FlowFormTree(); formFolder.No = map.No; formFolder.ParentNo = map.FK_FormTree; formFolder.Name = map.Name + "[" + map.No + "]"; formFolder.NodeType = "form"; appendFormTrees.AddEntity(formFolder); } } } string strCheckedNos = ""; //设置选中 foreach (FrmNode frmNode in frmNodes) { strCheckedNos += "," + frmNode.FK_Frm + ","; } //重置 appendMenus.Clear(); //生成数据 TansEntitiesToGenerTree(appendFormTrees, root.No, strCheckedNos); return(appendMenus.ToString()); }
public void SelectedFrm() { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); this.Pub1.AddTable("align=left"); this.Pub1.AddCaption("设置节点:(" + nd.Name + ")绑定的表单"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("表单编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("表/视图"); this.Pub1.AddTREnd(); MapDatas mds = new MapDatas(); QueryObject obj_mds = new QueryObject(mds); obj_mds.AddWhere(MapDataAttr.AppType, (int)AppType.Application); obj_mds.addOrderBy(MapDataAttr.Name); obj_mds.DoQuery(); SysFormTrees formTrees = new SysFormTrees(); QueryObject objInfo = new QueryObject(formTrees); objInfo.AddWhere(SysFormTreeAttr.ParentNo, "0"); objInfo.addOrderBy(SysFormTreeAttr.Name); objInfo.DoQuery(); int idx = 0; foreach (SysFormTree fs in formTrees) { idx++; this.Pub1.AddTRSum(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTD("colspan=4", fs.Name); this.Pub1.AddTREnd(); foreach (MapData md in mds) { if (md.FK_FormTree != fs.No) { continue; } idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); CheckBox cb = new CheckBox(); cb.ID = "CB_" + md.No; cb.Text = md.No; cb.Checked = fns.Contains(FrmNodeAttr.FK_Frm, md.No); this.Pub1.AddTD(cb); if (cb.Checked) { this.Pub1.AddTDB("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" ><b>" + md.Name + "</b></a>"); this.Pub1.AddTDB(md.PTable); } else { this.Pub1.AddTD("<a href=\"javascript:WinOpen('../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "');\" >" + md.Name + "</a>"); this.Pub1.AddTD(md.PTable); } this.Pub1.AddTREnd(); } AddChildNode(fs.No, mds, fns); } Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "保存并设置绑定方案属性"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SaveFlowFrms_Click); this.Pub1.AddTR(); this.Pub1.AddTD("colspan=4", btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
private string GetFlowFormTree() { //add root BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree(); root.No = "00"; root.ParentNo = "0"; root.Name = "目录"; root.NodeType = "root"; appFlowFormTree.Clear(); appFlowFormTree.AddEntity(root); #region 添加表单及文件夹 //节点表单 string tfModel = SystemConfig.AppSettings["TreeFrmModel"]; BP.WF.Node nd = new BP.WF.Node(this.FK_Node); FrmNodes frmNodes = new FrmNodes(); QueryObject qo = new QueryObject(frmNodes); qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node); qo.addAnd(); qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow); //如果配置了启用关键字段,一下会判断绑定的独立表单中的关键字段是否有数据,没有就不会被显示 // add by 海南 zqp if (tfModel == "1") { //针对合流点与分合流节点有效 //获取独立表单的字段 MapDatas mdes = new MapDatas(); string mypks = ""; if (nd.IsStartNode == false) { qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); foreach (FrmNode fn in frmNodes) { if (fn.HisFrmType == FrmType.Column4Frm || fn.HisFrmType == FrmType.FreeFrm) { mdes.Retrieve(MapDataAttr.No, fn.FK_Frm); //根据设置的关键字段是否有值,进行判断 foreach (MapData md in mdes) { Paras ps = new Paras(); ps.SQL = "SELECT " + fn.GuanJianZiDuan + " FROM " + md.PTable + " WHERE " + " OID=" + SystemConfig.AppCenterDBVarStr + "OID"; if (this.FID == 0) { ps.Add("OID", this.WorkID); } else { ps.Add("OID", this.FID); } try { DataTable dtmd = BP.DA.DBAccess.RunSQLReturnTable(ps); string dtVal = dtmd.Rows[0]["" + fn.GuanJianZiDuan + ""].ToString(); if (string.IsNullOrWhiteSpace(dtVal)) { mypks = mypks + "'" + md.No + "',"; } } catch (Exception ex) { mypks = mypks + "'" + md.No + "',"; } } } } mypks = mypks.TrimEnd(','); if (!string.IsNullOrWhiteSpace(mypks)) { //添加查询条件 qo = new QueryObject(frmNodes); qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node); qo.addAnd(); qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow); qo.addAnd(); qo.AddWhere(FrmNodeAttr.FK_Frm + " not in(" + mypks + ")"); qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); } } else { qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); } } else { qo.addOrderBy(FrmNodeAttr.Idx); qo.DoQuery(); } //文件夹 SysFormTrees formTrees = new SysFormTrees(); formTrees.RetrieveAll(SysFormTreeAttr.Name); //所有表单集合 MapDatas mds = new MapDatas(); mds.RetrieveInSQL("SELECT FK_Frm FROM WF_FrmNode WHERE FK_Node=" + this.FK_Node); foreach (FrmNode frmNode in frmNodes) { #region 增加判断是否启用规则. switch (frmNode.FrmEnableRole) { case FrmEnableRole.Allways: break; case FrmEnableRole.WhenHaveData: //判断是否有数据. MapData md = new MapData(frmNode.FK_Frm); if (DBAccess.RunSQLReturnValInt("SELECT COUNT(*) as Num FROM " + md.PTable + " WHERE OID=" + this.WorkID) == 0) { continue; } break; case FrmEnableRole.WhenHaveFrmPara: //判断是否有参数. string frms = this.Request.QueryString["Frms"]; if (frms != null && frms.Contains(frmNode.FK_Frm) == true) { /*包含这个表单.*/ } else { continue; } break; case FrmEnableRole.ByFrmFields: throw new Exception("@这种类型的判断,ByFrmFields 还没有完成。"); case FrmEnableRole.BySQL: // 按照SQL的方式. string mysql = frmNode.FrmEnableExp.Clone() as string; mysql = mysql.Replace("@OID", this.WorkID.ToString()); mysql = mysql.Replace("@WorkID", this.WorkID.ToString()); mysql = mysql.Replace("@NodeID", this.FK_Node.ToString()); mysql = mysql.Replace("@FK_Node", this.FK_Node.ToString()); mysql = mysql.Replace("@FK_Flow", this.FK_Flow); if (DBAccess.RunSQLReturnValFloat(mysql) <= 0) { continue; } break; case FrmEnableRole.Disable: // 如果禁用了,就continue出去.. continue; default: throw new Exception("@没有判断的规则." + frmNode.FrmEnableRole); } #endregion #region 检查是否有没有目录的表单? bool isHave = false; foreach (MapData md in mds) { if (md.FK_FormTree == "") { isHave = true; break; } } string treeNo = "0"; if (isHave && mds.Count == 1) { treeNo = "0"; } else if (isHave == true) { foreach (MapData md in mds) { if (md.FK_FormTree != "") { treeNo = md.FK_FormTree; break; } } } #endregion 检查是否有没有目录的表单? foreach (MapData md in mds) { if (frmNode.FK_Frm != md.No) { continue; } #warning 这里有错误, 如果是节点表单的话,就没有这个值,没有这个值就绑定不到表单树,代国强解决. if (md.FK_FormTree == "") { md.FK_FormTree = treeNo; } foreach (SysFormTree formTree in formTrees) { if (md.FK_FormTree != formTree.No) { continue; } if (appFlowFormTree.Contains("No", formTree.No) == false) { 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, this.FK_Node); 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"; nodeForm.IsEdit = Convert.ToString(Convert.ToInt32(frmNode.IsEdit)); appFlowFormTree.AddEntity(nodeForm); } } #endregion //扩展工具,显示位置为表单树类型 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.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()); }
public override object Do() { string msg = ""; #region 处理表单. // 调度表单文件。 SysFormTrees fss = new SysFormTrees(); fss.ClearTable(); //创建root. SysFormTree root = new SysFormTree(); root.No = "1"; root.Name = "表单库"; root.ParentNo = "0"; root.Insert(); string frmPath = SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Form\\"; DirectoryInfo dirInfo = new DirectoryInfo(frmPath); DirectoryInfo[] dirs = dirInfo.GetDirectories(); int i = 0; foreach (DirectoryInfo item in dirs) { if (item.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(item.FullName); if (fls.Length == 0) { continue; } SysFormTree fs = new SysFormTree(); fs.No = item.Name.Substring(0, 2); fs.Name = item.Name.Substring(3); fs.ParentNo = "1"; fs.Idx = i++; fs.Insert(); foreach (string f in fls) { System.IO.FileInfo info = new System.IO.FileInfo(f); if (info.Extension != ".xml") { continue; } msg += "@开始调度表单模板文件:" + f; BP.DA.Log.DefaultLogWriteLineInfo("@开始调度表单模板文件:" + f); DataSet ds = new DataSet(); ds.ReadXml(f); try { MapData md = MapData.ImpMapData(ds); md.FK_FrmSort = fs.No; md.FK_FormTree = fs.No; md.AppType = "0"; md.Update(); } catch (Exception ex) { BP.DA.Log.DefaultLogWriteLineInfo("@装载表单模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace); throw new Exception("@装载模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace); } } } #endregion 处理表单. #region 处理流程. FlowSorts sorts = new FlowSorts(); sorts.ClearTable(); dirInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\"); dirs = dirInfo.GetDirectories(); FlowSort fsRoot = new FlowSort(); fsRoot.No = "99"; fsRoot.Name = "流程树"; fsRoot.ParentNo = "0"; fsRoot.DirectInsert(); foreach (DirectoryInfo dir in dirs) { if (dir.FullName.Contains(".svn")) { continue; } string[] fls = System.IO.Directory.GetFiles(dir.FullName); if (fls.Length == 0) { continue; } FlowSort fs = new FlowSort(); fs.No = dir.Name.Substring(0, 3); fs.Name = dir.Name.Substring(3); fs.ParentNo = fsRoot.No; fs.Insert(); foreach (string filePath in fls) { msg += "\t\n@开始调度流程模板文件:" + filePath; BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath); Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo); msg += "\t\n@流程:[" + myflow.Name + "]装载成功。"; System.IO.FileInfo info = new System.IO.FileInfo(filePath); myflow.Name = info.Name.Replace(".xml", ""); if (myflow.Name.Substring(2, 1) == ".") { myflow.Name = myflow.Name.Substring(3); } myflow.DirectUpdate(); } //调度它的下一级目录. DirectoryInfo dirSubInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\" + dir.Name); DirectoryInfo[] myDirs = dirSubInfo.GetDirectories(); foreach (DirectoryInfo mydir in myDirs) { if (mydir.FullName.Contains(".svn")) { continue; } string[] myfls = System.IO.Directory.GetFiles(mydir.FullName); if (myfls.Length == 0) { continue; } // 流程类别. FlowSort subFlowSort = fs.DoCreateSubNode() as FlowSort; subFlowSort.Name = mydir.Name.Substring(3); subFlowSort.Update(); foreach (string filePath in myfls) { msg += "\t\n@开始调度流程模板文件:" + filePath; BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath); Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(subFlowSort.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo); msg += "\t\n@流程:" + myflow.Name + "装载成功。"; System.IO.FileInfo info = new System.IO.FileInfo(filePath); myflow.Name = info.Name.Replace(".xml", ""); if (myflow.Name.Substring(2, 1) == ".") { myflow.Name = myflow.Name.Substring(3); } myflow.DirectUpdate(); } } } //执行流程检查. Flows flsEns = new Flows(); flsEns.RetrieveAll(); foreach (Flow fl in flsEns) { fl.DoCheck(); } #endregion 处理流程. BP.DA.Log.DefaultLogWriteLineInfo(msg); //删除多余的空格. BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField(); dts.Do(); return(msg); }
/// <summary> /// 获取流程表单树 /// </summary> /// <returns></returns> private string GetFlowFormTree() { string flowId = getUTF8ToString("flowId"); string parentNo = getUTF8ToString("parentno"); string isFirstLoad = getUTF8ToString("isFirstLoad"); //获取子节点内容 SysFormTrees flowFormTrees = new SysFormTrees(); QueryObject objInfo = new QueryObject(flowFormTrees); objInfo.AddWhere("ParentNo", parentNo); objInfo.addOrderBy("Idx"); objInfo.DoQuery(); if (isFirstLoad == "true") { SysFormTree formTree = new SysFormTree("0"); StringBuilder appSend = new StringBuilder(); appSend.Append("["); appSend.Append("{"); appSend.Append("\"id\":\"0\""); appSend.Append(",\"text\":\"" + formTree.Name + "\""); appSend.Append(",iconCls:\"icon-0\""); appSend.Append(",\"children\":"); appSend.Append("["); //获取节点下的表单 SysForms sysForms = new SysForms(); QueryObject objFlowForms = new QueryObject(sysForms); objFlowForms.AddWhere(SysFormAttr.FK_FormTree, parentNo); objFlowForms.addOrderBy(SysFormAttr.Name); objFlowForms.DoQuery(); //添加子项文件夹 foreach (SysFormTree item in flowFormTrees) { //获取已选择项 FrmNodes flowForms = new FrmNodes(); QueryObject objFlowForm = new QueryObject(flowForms); objFlowForm.AddWhere("FK_Flow", flowId); objFlowForm.addAnd(); objFlowForm.AddWhere("FK_FlowFormTree", item.No); objFlowForm.DoQuery(); if (flowForms != null && flowForms.Count > 0) { } } //添加表单 foreach (SysForm sysForm in sysForms) { appSend.Append("{"); appSend.Append("\"id\":\"0\""); appSend.Append(",\"text\":\"" + formTree.Name + "\""); appSend.Append(",iconCls:\"icon-3\""); appSend.Append("},"); } appSend.Append("]"); appSend.Append("}"); appSend.Append("]"); return(appSend.ToString()); } return(""); }
public void BindFrm() { MapData md = new MapData(); if (string.IsNullOrEmpty(this.FK_MapData) == false) { md.No = this.FK_MapData; md.RetrieveFromDBSources(); this.Pub1.AddH2("表单属性" + md.Name); this.Pub1.AddHR(); } else { this.Pub1.AddH2("新建表单"); this.Pub1.AddHR(); } this.Pub1.AddTable("align=left"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("属性"); this.Pub1.AddTDTitle("采集"); this.Pub1.AddTDTitle("描述"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("表单名称"); TextBox tb = new TextBox(); tb.ID = "TB_Name"; tb.Text = md.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD("描述"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("表单编号"); tb = new TextBox(); tb.ID = "TB_No"; tb.Text = md.No; if (string.IsNullOrEmpty(md.No) == false) { tb.Attributes["readonly"] = "true"; } this.Pub1.AddTD(tb); this.Pub1.AddTD("也是表单ID."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("表单类型"); DDL ddl = new DDL(); ddl.ID = "DDL_FrmType"; ddl.BindSysEnum(MapDataAttr.FrmType, (int)md.HisFrmType); this.Pub1.AddTD(ddl); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("物理表/视图"); tb = new TextBox(); tb.ID = "TB_PTable"; tb.Text = md.No; this.Pub1.AddTD(tb); this.Pub1.AddTD("多个表单可以对应同一个表或视图<br>如果表不存在,ccflow会自动创建."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("类别"); ddl = new DDL(); ddl.ID = "DDL_FK_FrmSort"; SysFormTrees fss = new SysFormTrees(); fss.RetrieveAll(); ddl.Bind(fss, md.FK_FrmSort); this.Pub1.AddTD(ddl); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD("设计单位"); //tb = new TextBox(); //tb.ID = "TB_" + MapDataAttr.DesignerUnit; //tb.Text = md.DesignerUnit; //if (string.IsNullOrEmpty(tb.Text)) // tb.Text = BP.Sys.SystemConfig.DeveloperName; //tb.Columns = 60; //this.Pub1.AddTD("colspan=2", tb); //this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD("联系方式"); //tb = new TextBox(); //tb.ID = "TB_" + MapDataAttr.DesignerContact; //tb.Text = md.DesignerContact; //if (string.IsNullOrEmpty(tb.Text)) // tb.Text = BP.Sys.SystemConfig.ServiceTel + "," + BP.Sys.SystemConfig.ServiceMail; //tb.Columns = 60; //this.Pub1.AddTD("colspan=2", tb); //this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); this.Pub1.AddTDBegin(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "Save"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SaveFrm_Click); this.Pub1.Add(btn); if (string.IsNullOrEmpty(md.No) == false) { btn = new Button(); btn.ID = "Btn_Delete"; btn.Text = "Delete"; btn.CssClass = "Btn"; btn.Attributes["onclick"] = "return window.confirm('您确定要删除吗?')"; btn.Click += new EventHandler(btn_SaveFrm_Click); this.Pub1.Add(btn); } this.Pub1.AddTDEnd(); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); if (string.IsNullOrEmpty(md.No) == false) { this.Pub1.AddTR(); this.Pub1.AddTDBegin("colspan=3"); //// this.Pub1.Add("<a href='FlowFrms.aspx?ShowType=FrmLib&DoType=DelFrm&FK_Node=" + FK_Node + "&FK_MapData=" + md.No + "' ><img src='./Img/Btn/Delete.gif' border=0 />删除</a>"); //this.Pub1.Add("<a href='../MapDef/ViewFrm.aspx?DoType=Column4Frm&FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank ><img src='../Img/Btn/View.gif' border=0 />傻瓜表单预览</a>"); //this.Pub1.Add("<a href='../CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "&IsTest=1&WorkID=0' target=_blank ><img src='../Img/Btn/View.gif' border=0 />自由表单预览</a>"); //this.Pub1.Add("<a href='../MapDef/ViewFrm.aspx?DoType=dd&FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank ><img src='../Img/Btn/View.gif' border=0 />手机表单预览</a>"); //this.Pub1.Add("<a href='../CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank ><img src='../Img/Btn/View.gif' border=0 />启动自由表单设计器</a>"); //this.Pub1.Add("<a href='../MapDef/MapDef.aspx?PK=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank ><img src='../Img/Btn/View.gif' border=0 />启动傻瓜表单设计器</a>"); this.Pub1.Add("<a href='../CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank ><img src='../Img/Btn/View.gif' border=0 />启动自由表单设计器</a>"); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
public void BindFlowFrms() { FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node); this.Pub1.AddH2("流程表单绑定"); this.Pub1.AddTable("align=left"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("表单编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("物理表"); this.Pub1.AddTDTitle("权限"); this.Pub1.AddTREnd(); BP.WF.Node nd = new BP.WF.Node(this.FK_Node); MapDatas mds = new MapDatas(); QueryObject obj_mds = new QueryObject(mds); obj_mds.AddWhere(MapDataAttr.AppType, (int)AppType.Application); obj_mds.addOrderBy(MapDataAttr.Name); obj_mds.DoQuery(); //FrmSorts fss = new FrmSorts(); //fss.RetrieveAll(); SysFormTrees formTrees = new SysFormTrees(); QueryObject objInfo = new QueryObject(formTrees); objInfo.AddWhere(SysFormTreeAttr.ParentNo, "0"); objInfo.addOrderBy(SysFormTreeAttr.Name); objInfo.DoQuery(); int idx = 0; foreach (SysFormTree fs in formTrees) { idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTDB("colspan=4", fs.Name); this.Pub1.AddTREnd(); foreach (MapData md in mds) { if (md.FK_FormTree != fs.No) { continue; } idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); CheckBox cb = new CheckBox(); cb.ID = "CB_" + md.No; cb.Text = md.No; cb.Checked = fns.Contains(FrmNodeAttr.FK_Frm, md.No); this.Pub1.AddTD(cb); this.Pub1.AddTD("<a href='../MapDef/CCForm/Frm.aspx?FK_MapData=" + md.No + "&FK_Flow=" + this.FK_Flow + "' target=_blank>" + md.Name + "</a>"); this.Pub1.AddTD(md.PTable); if (cb.Checked) { this.Pub1.AddTD("<a href=\"javascript:WinField('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\">字段</a>|<a href=\"javascript:WinFJ('" + md.No + "','" + this.FK_Node + "','" + this.FK_Flow + "')\">附件</a>"); } else { this.Pub1.AddTD(); } //this.Pub1.AddTD(md.Designer); //this.Pub1.AddTD(md.DesignerUnit); //this.Pub1.AddTD(md.DesignerContact); this.Pub1.AddTREnd(); } AddChildNode(fs.No, mds, fns); } Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "Save"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_SaveFlowFrms_Click); this.Pub1.AddTR(); this.Pub1.AddTD("colspan=5", btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }