Пример #1
0
        public void BindWap()
        {
            this.Pub1.AddFieldSet("<a href='Home.aspx' ><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Home.gif' >Home</a>");
            Flows fls = new Flows();

            fls.RetrieveAll();
            FlowSorts fss = new FlowSorts();

            fss.RetrieveAll();

            this.Pub1.AddUL();
            foreach (FlowSort fs in fss)
            {
                this.Pub1.AddBR(fs.Name);
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }
                    string src2 = BP.WF.Glo.CCFlowAppPath + "WF/Rpt/Search.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt&FK_Flow=" + fl.No + "&IsWap=1";
                    this.Pub1.AddLi("<a href='" + src2 + "' >" + fl.Name + "</a>");
                }
            }
            this.Pub1.AddULEnd();
            this.Pub1.AddFieldSetEnd();
        }
Пример #2
0
    public void BindLeft()
    {
        FlowSorts sorts = new FlowSorts();

        sorts.RetrieveAll();
        Flows fls = new Flows();

        fls.Retrieve(FlowAttr.FlowType, (int)FlowAppType.PRJ);

        foreach (FlowSort fs in sorts)
        {
            this.Pub1.AddB(fs.Name);
            this.Pub1.AddBR();
            this.Pub1.AddUL();
            foreach (Flow fl in fls)
            {
                if (fl.FK_FlowSort != fs.No)
                {
                    continue;
                }

                if (this.FK_Flow == fl.No)
                {
                    this.Pub1.AddLi("<a href='NodeAccess.aspx?FK_Flow=" + fl.No + "&FK_Prj=" + this.FK_Prj + "' ><b>" + fl.Name + "</b></a>");
                }
                else
                {
                    this.Pub1.AddLi("<a href='NodeAccess.aspx?FK_Flow=" + fl.No + "&FK_Prj=" + this.FK_Prj + "' >" + fl.Name + "</a>");
                }
            }
            this.Pub1.AddULEnd();
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            BP.WF.Flows fls = new BP.WF.Flows();
            fls.RetrieveAll();

            FlowSorts ens = new FlowSorts();

            ens.RetrieveAll();

            DataTable dt = BP.WF.Dev2Interface.DB_GenerCanStartFlowsOfDataTable(BP.Web.WebUser.No);

            int     cols      = 3; //定义显示列数 从0开始。
            decimal widthCell = 100 / cols;

            this.Pub1.AddTable("width=100% border=0");
            int  idx = -1;
            bool is1 = false;

            string timeKey = "s" + this.Session.SessionID + DateTime.Now.ToString("yyMMddHHmmss");

            foreach (FlowSort en in ens)
            {
                if (en.ParentNo == "0" ||
                    en.ParentNo == "" ||
                    en.No == "")
                {
                    continue;
                }

                idx++;
                if (idx == 0)
                {
                    is1 = this.Pub1.AddTR(is1);
                }

                this.Pub1.AddTDBegin("width='" + widthCell + "%' border=0 valign=top");
                //输出类别.
                //this.Pub1.AddFieldSet(en.Name);
                this.Pub1.AddB(en.Name);
                this.Pub1.AddUL();

                #region 输出流程。
                foreach (Flow fl in fls)
                {
                    if (fl.FlowAppType == FlowAppType.DocFlow)
                    {
                        continue;
                    }

                    if (fl.FK_FlowSort != en.No)
                    {
                        continue;
                    }

                    bool isHaveIt = false;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["No"].ToString() != fl.No)
                        {
                            continue;
                        }
                        isHaveIt = true;
                        break;
                    }

                    this.Pub1.AddLi(" <a  href=\"javascript:WinOpen('/WF/Rpt/Search.aspx?RptNo=ND" + int.Parse(fl.No) + "MyRpt&FK_Flow=" + fl.No + "');\" >" + fl.Name + "</a> ");
                }
                #endregion 输出流程。

                this.Pub1.AddULEnd();

                this.Pub1.AddTDEnd();
                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTREnd();
                }
            }

            while (idx != -1)
            {
                idx++;
                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTD();
                    this.Pub1.AddTREnd();
                }
                else
                {
                    this.Pub1.AddTD();
                }
            }
            this.Pub1.AddTableEnd();
        }
Пример #4
0
        /// <summary>
        /// 工作流查询
        /// </summary>
        /// <returns></returns>
        private string FlowSearchMethod()
        {
            FlowSorts fss = new FlowSorts();

            fss.RetrieveAll();
            Flows fls = new Flows();

            fls.RetrieveAll();
            StringBuilder appFlow = new StringBuilder();

            appFlow.Append("{");
            appFlow.Append("\"rows\":[");

            foreach (FlowSort fs in fss)
            {
                if (appFlow.Length == 9)
                {
                    appFlow.Append("{");
                }
                else
                {
                    appFlow.Append(",{");
                }
                if (fs.ParentNo == "0")
                {
                    appFlow.Append(string.Format("\"No\":\"{0}\",\"Name\":\"{1}\",\"NumOfBill\":\"{2}\",\"_parentId\":null,\"state\":\"open\",\"Element\":\"sort\"", fs.No, fs.Name, "0"));
                }
                else
                {
                    appFlow.Append(string.Format("\"No\":\"{0}\",\"Name\":\"{1}\",\"NumOfBill\":\"{2}\",\"_parentId\":\"{3}\",\"state\":\"open\",\"Element\":\"sort\"", fs.No, fs.Name, "0", fs.ParentNo));
                }
                appFlow.Append("}");
            }

            foreach (FlowSort fs in fss)
            {
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }

                    if (appFlow.Length == 9)
                    {
                        appFlow.Append("{");
                    }
                    else
                    {
                        appFlow.Append(",{");
                    }

                    appFlow.Append(string.Format("\"No\":\"{0}\",\"Name\":\"{1}\",\"NumOfBill\":\"{2}\",\"_parentId\":\"{3}\",\"Element\":\"flow\"", fl.No, fl.Name, fl.NumOfBill, fl.FK_FlowSort));
                    appFlow.Append("}");
                }
            }
            appFlow.Append("]");
            appFlow.Append(",\"total\":" + fls.Count + fss.Count + "");
            appFlow.Append("}");
            return(appFlow.ToString());
        }
Пример #5
0
        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");
        }
Пример #7
0
        /// <summary>
        /// 树节点管理
        /// </summary>
        public string Do()
        {
            string doWhat = getUTF8ToString("doWhat");
            string para1  = getUTF8ToString("para1");
            // 如果admin账户登陆时有错误发生,则返回错误信息
            var result = LetAdminLogin("CH", true);

            if (string.IsNullOrEmpty(result) == false)
            {
                return(result);
            }

            switch (doWhat)
            {
            case "GetFlowSorts":        //获取所有流程类型
                try
                {
                    FlowSorts flowSorts = new FlowSorts();
                    flowSorts.RetrieveAll(FlowSortAttr.Idx);
                    return(BP.Tools.Entitis2Json.ConvertEntitis2GenerTree(flowSorts, "0"));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSameLevelFrmSort":     //创建同级别的 表单树 目录.
                SysFormTree frmSort = null;
                try
                {
                    var para = para1.Split(',');
                    frmSort = new SysFormTree(para[0]);
                    string sameNodeNo = frmSort.DoCreateSameLevelNode().No;
                    frmSort      = new SysFormTree(sameNodeNo);
                    frmSort.Name = para[1];
                    frmSort.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFormSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSubLevelFrmSort":     //创建子级别的 表单树 目录.
                SysFormTree frmSortSub = null;
                try
                {
                    var para = para1.Split(',');
                    frmSortSub = new SysFormTree(para[0]);
                    string sameNodeNo = frmSortSub.DoCreateSubNode().No;
                    frmSortSub      = new SysFormTree(sameNodeNo);
                    frmSortSub.Name = para[1];
                    frmSortSub.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewSubLevelFrmSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSameLevelFlowSort":      //创建同级别的 流程树 目录.
                FlowSort fs = null;
                try
                {
                    var para = para1.Split(',');
                    fs = new FlowSort(para[0].Replace("F", ""));    //传入的编号多出F符号,需要替换掉
                    string sameNodeNo = fs.DoCreateSameLevelNode().No;
                    fs      = new FlowSort(sameNodeNo);
                    fs.Name = para[1];
                    fs.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSameLevelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSubFlowSort":     //创建子级别的 流程树 目录.
                try
                {
                    var      para        = para1.Split(',');
                    FlowSort fsSub       = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    string   subNodeNo   = fsSub.DoCreateSubNode().No;
                    FlowSort subFlowSort = new FlowSort(subNodeNo);
                    subFlowSort.Name = para[1];
                    subFlowSort.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + subFlowSort.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSubFlowSort Branch has a error , para:\t" + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "EditFlowSort":     //编辑表单树.
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    fs.Name = para[1];
                    fs.Save();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewFlow":     //创建新流程.
                try
                {
                    string[] ps = para1.Split(',');
                    if (ps.Length != 6)
                    {
                        throw new Exception("@创建流程参数错误");
                    }

                    string fk_floSort = ps[0];                                       //类别编号.
                    fk_floSort = fk_floSort.Replace("F", "");                        //传入的编号多出F符号,需要替换掉

                    string         flowName      = ps[1];                            // 流程名称.
                    DataStoreModel dataSaveModel = (DataStoreModel)int.Parse(ps[2]); //数据保存方式。
                    string         pTable        = ps[3];                            // 物理表名。
                    string         flowMark      = ps[4];                            // 流程标记.
                    string         flowVer       = ps[5];                            // 流程版本

                    string FK_Flow = BP.BPMN.Glo.NewFlow(fk_floSort, flowName, dataSaveModel, pTable, flowMark, flowVer);
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = new { no = FK_Flow, name = flowName } }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlow":     //删除流程.
                try
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(
                               new { success = true, msg = WorkflowDefintionManager.DeleteFlowTemplete(para1) }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlowSort":
                try
                {
                    string   FK_FlowSort = para1.Replace("F", "");
                    string   forceDel    = getUTF8ToString("force");
                    FlowSort delfs       = new FlowSort();
                    delfs.No = FK_FlowSort;
                    //强制删除,不需判断是否含有子项。
                    if (forceDel == "true")
                    {
                        delfs.DeleteFlowSortSubNode_Force();
                        delfs.Delete();
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                    }

                    //判断是否包含子类别
                    if (delfs.HisSubFlowSorts != null && delfs.HisSubFlowSorts.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "havesubsorts", msg = "此类别下包含子类别。" }));
                    }

                    //判断是否包含工作流程
                    if (delfs.HisFlows != null && delfs.HisFlows.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "haveflows", msg = "此类别下包含流程。" }));
                    }

                    //执行删除
                    delfs.Delete();
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

            case "SetBUnit":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node nd = new BP.WF.Node(int.Parse(para1));
                        nd.IsTask = !nd.IsBUnit;
                        nd.Update();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

            case "GetSettings":
                return(SystemConfig.AppSettings[para1]);

            case "SaveFlowFrm":      //保存流程表单.
                Entity en = null;
                try
                {
                    AtPara ap     = new AtPara(para1);
                    string enName = ap.GetValStrByKey("EnName");
                    string pk     = ap.GetValStrByKey("PKVal");
                    en = ClassFactory.GetEn(enName);
                    en.ResetDefaultVal();
                    if (en == null)
                    {
                        throw new Exception("无效的类名:" + enName);
                    }

                    if (string.IsNullOrEmpty(pk) == false)
                    {
                        en.PKVal = pk;
                        en.RetrieveFromDBSources();
                    }

                    foreach (string key in ap.HisHT.Keys)
                    {
                        if (key == "PKVal")
                        {
                            continue;
                        }
                        en.SetValByKey(key, ap.HisHT[key].ToString().Replace('^', '@'));
                    }
                    en.Save();
                    return(en.PKVal as string);
                }
                catch (Exception ex)
                {
                    if (en != null)
                    {
                        en.CheckPhysicsTable();
                    }
                    return("Error:" + ex.Message);
                }

            case "ChangeNodeType":
                var p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点类型参数错误");
                    }

                    //var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID='{2}'";
                    var sql = "UPDATE WF_Node SET RunModel={0} WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "ChangeNodeIcon":
                p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点图标参数错误");
                    }

                    var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            default:
                throw new Exception("@没有约定的执行标记:" + doWhat);
            }
        }
Пример #8
0
        public void BindWap_bak()
        {
            this.Pub1.AddFieldSet("<img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Home.gif' ><a href='Home.aspx' >Home</a>");
            Flows fls = new Flows();

            fls.RetrieveAll();
            bool is1 = false;

            FlowSorts fss = new FlowSorts();

            fss.RetrieveAll();

            string search     = "查询";
            string dtl        = "明细";
            string bill       = "单据";
            string nodeSearch = "节点";
            string FX         = "分析";

            this.Pub1.Add("<table width='100%' border=0 >");
            foreach (FlowSort fs in fss)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDTitle(fs.Name);
                this.Pub1.AddTREnd();
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }

                    is1 = this.Pub1.AddTR(is1);
                    this.Pub1.AddTDBegin();

                    this.Pub1.Add(fl.Name);
                    this.Pub1.AddBR();

                    if (fl.NumOfBill == 0)
                    {
                        this.Pub1.Add("--");
                    }
                    else
                    {
                        string src = "" + BP.WF.Glo.CCFlowAppPath + "WF/Comm/Search.aspx?EnsName=BP.WF.Bills&FK_Flow=" + fl.No;
                        this.Pub1.Add("<a href=\"javascript:WinOpen('" + src + "');\"  >" + bill + "</a>");
                    }


                    string src1 = "" + BP.WF.Glo.CCFlowAppPath + "WF/Comm/Search.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt";
                    this.Pub1.Add("-<a href=\"javascript:WinOpen('" + src1 + "');\" >" + search + "</a>");
                    this.Pub1.Add("-<a href=\"javascript:Dtl('" + fl.No + "');\" >" + dtl + "</a>");

                    src1 = BP.WF.Glo.CCFlowAppPath + "WF/Comm/Group.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt";
                    this.Pub1.Add("-<a href=\"javascript:WinOpen('" + src1 + "');\" >" + FX + "</a>");

                    this.Pub1.Add("-<a href='FlowSearch.aspx?FK_Flow=" + fl.No + "'>" + nodeSearch + "</a>");
                    this.Pub1.AddTDEnd();
                    this.Pub1.AddTREnd();
                }
            }
            this.Pub1.AddTableEnd();
            this.Pub1.AddFieldSetEnd();
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = "查询与分析";
            switch (this.DoType)
            {
            case "Bill":
                this.BindBill();
                return;

            case "MyWork":
                this.BindMyWork();
                return;

            default:
                break;
            }

            if (this.FK_Flow != null)
            {
                if (WebUser.IsWap)
                {
                    this.BindFlowWap();
                }
                else
                {
                    this.BindFlow();
                }
                return;
            }

            if (this.FK_Node != 0)
            {
                return;
            }

            if (WebUser.IsWap)
            {
                BindWap();
                return;
            }

            int colspan = 5;

            this.Pub1.AddTable("width='90%' align=left");
            if (WebUser.IsWap)
            {
                this.Pub1.AddCaptionLeftTX2("<img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Home.gif' ><a href='Home.aspx' >Home</a> - <img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Search.gif' >-流程查询");
            }
            else
            {
                this.Pub1.AddCaptionLeftTX2("<div style='float:left'><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Search.gif' >流程查询/分析</div><div style='float:right'><a href=\"javascript:WinOpen('KeySearch.aspx',900,900); \">关键字查询</a>|<a href=\"javascript:WinOpen('" + BP.WF.Glo.CCFlowAppPath + "WF/Comm/Search.aspx?EnsName=BP.WF.Data.GenerWorkFlowViews',900,900); \">综合查询</a>|<a href=\"javascript:WinOpen('" + BP.WF.Glo.CCFlowAppPath + "WF/Comm/Group.aspx?EnsName=BP.WF.Data.GenerWorkFlowViews',900,900); \">综合分析</a>|<a href=\"javascript:WinOpen('" + BP.WF.Glo.CCFlowAppPath + "WF/Comm/Search.aspx?EnsName=BP.WF.WorkFlowDeleteLogs',900,900); \">删除日志</a></div>");
            }

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("序");
            this.Pub1.AddTDTitle("width='70%'", "流程名称");
            this.Pub1.AddTDTitle("单据");
            this.Pub1.AddTDTitle("流程查询-分析");
            this.Pub1.AddTREnd();

            Flows fls = new Flows();

            fls.RetrieveAll();
            FlowSorts fss = new FlowSorts();

            fss.RetrieveAll();
            string search = "查询";
            string FX     = "分析";
            int    idx    = 1;
            int    gIdx   = 0;

            foreach (FlowSort fs in fss)
            {
                if (fs.ParentNo == "0" ||
                    fs.ParentNo == "" ||
                    fs.No == "0")
                {
                    continue;
                }

                gIdx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDB("colspan=" + colspan + " class=TRSum onclick=\"GroupBarClick('" + gIdx + "')\" ", "<div style='text-align:left; float:left' ><img src='./Style/Min.gif' alert='Min' id='Img" + gIdx + "'   border=0 />&nbsp;<b>" + fs.Name + "</b>");
                this.Pub1.AddTREnd();
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }

                    this.Pub1.AddTR("ID='" + gIdx + "_" + idx + "'");
                    this.Pub1.AddTDIdx(idx++);

                    if (WebUser.IsWap == false)
                    {
                        this.Pub1.AddTD("width='60%'", "<a href=\"javascript:WinOpen('/WorkOpt/OneWork/ChartTrack.aspx?FK_Flow=" + fl.No + "&DoType=Chart','sd');\"  >" + fl.Name + "</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD(fl.Name);
                    }

                    if (fl.NumOfBill == 0)
                    {
                        this.Pub1.AddTD("无");
                    }
                    else
                    {
                        //string src = BP.WF.Glo.CCFlowAppPath + "WF/Rpt/Bill.aspx?EnsName=BP.WF.Bills&FK_Flow=" + fl.No;
                        // this.Pub1.AddTD("<a href=\"javascript:WinOpen('" + src + "');\"  ><img src='" + BP.WF.Glo.CCFlowAppPath + "WF/Img/Btn/Word.gif' border=0/>" + bill + "</a>");
                    }
                    this.Pub1.AddTDBegin();
                    string src2 = BP.WF.Glo.CCFlowAppPath + "WF/Rpt/Search.aspx?RptNo=ND" + int.Parse(fl.No) + "MyRpt&FK_Flow=" + fl.No;
                    this.Pub1.Add("<a href=\"javascript:WinOpen('" + src2 + "');\" >" + search + "</a>");
                    src2 = BP.WF.Glo.CCFlowAppPath + "WF/Rpt/Group.aspx?FK_Flow=" + fl.No + "&DoType=Dept";
                    this.Pub1.Add(" - <a href=\"javascript:WinOpen('" + src2 + "');\" >" + FX + "</a>");
                    this.Pub1.AddTDEnd();
                    this.Pub1.AddTREnd();
                }
            }
            this.Pub1.AddTableEnd();
        }
Пример #10
0
        public void BindWap_bak()
        {
            this.Pub1.AddFieldSet("<img src='/WF/Img/Home.gif' ><a href='Home.aspx' >Home</a>");
            string sql = "SELECT FK_Flow FROM WF_Node ";
            Flows  fls = new Flows();

            fls.RetrieveAll();
            int  i   = 0;
            bool is1 = false;

            string    fk_sort = null;
            FlowSorts fss     = new FlowSorts();

            fss.RetrieveAll();

            string open       = "打开";
            string search     = "查询";
            string dtl        = "明细";
            string bill       = "单据";
            string nodeSearch = "节点";
            string FX         = "分析";

            this.Pub1.Add("<table width='100%' border=0 >");
            foreach (FlowSort fs in fss)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDTitle(fs.Name);
                this.Pub1.AddTREnd();
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }

                    is1 = this.Pub1.AddTR(is1);
                    this.Pub1.AddTDBegin();

                    this.Pub1.Add(fl.Name);
                    this.Pub1.AddBR();

                    if (fl.NumOfBill == 0)
                    {
                        this.Pub1.Add("--");
                    }
                    else
                    {
                        string src = "/WF/Comm/PanelEns.aspx?EnsName=BP.WF.Bills&FK_Flow=" + fl.No;
                        this.Pub1.Add("<a href=\"javascript:WinOpen('" + src + "');\"  >" + bill + "</a>");
                    }


                    string src1 = "/WF/Comm/PanelEns.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt";
                    this.Pub1.Add("-<a href=\"javascript:WinOpen('" + src1 + "');\" >" + search + "</a>");
                    this.Pub1.Add("-<a href=\"javascript:Dtl('" + fl.No + "');\" >" + dtl + "</a>");

                    src1 = this.Request.ApplicationPath + "/Comm/GroupEnsMNum.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt";
                    this.Pub1.Add("-<a href=\"javascript:WinOpen('" + src1 + "');\" >" + FX + "</a>");

                    this.Pub1.Add("-<a href='FlowSearch" + this.PageSmall + ".aspx?FK_Flow=" + fl.No + "'>" + nodeSearch + "</a>");
                    this.Pub1.AddTDEnd();
                    this.Pub1.AddTREnd();
                }
            }
            this.Pub1.AddTableEnd();
            this.Pub1.AddFieldSetEnd();
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = "查询与分析";
            switch (this.DoType)
            {
            case "Bill":
                this.BindBill();
                return;

            case "MyWork":
                this.BindMyWork();
                return;

            default:
                break;
            }

            if (this.FK_Flow != null)
            {
                if (WebUser.IsWap)
                {
                    this.BindFlowWap();
                }
                else
                {
                    this.BindFlow();
                }
                return;
            }

            if (this.FK_Node != 0)
            {
                return;
            }

            if (WebUser.IsWap)
            {
                BindWap();
                return;
            }

            int colspan = 5;

            if (this.PageSmall != "")
            {
                this.Pub1.AddBR();
            }

            this.Pub1.AddTable("border=1px width='960px'");
            if (WebUser.IsWap)
            {
                this.Pub1.AddCaption("<img src='/WF/Img/Home.gif' ><a href='Home.aspx' >Home</a> - <img src='/WF/Img/Search.gif' > -  流程查询");
            }
            else
            {
                this.Pub1.AddCaptionLeft("<img src='/WF/Img/Search.gif' > <b>流程查询-分析</b> <span style='float:right'><a href=\"javascript:WinOpen('KeySearch.aspx',900,900); \">关键字查询</a> | <a href=\"javascript:WinOpen('/WF/Comm/PanelEns.aspx?EnsName=BP.WF.FlowDatas',900,900); \">综合查询</a> | <a href=\"javascript:WinOpen('/WF/Comm/GroupEnsMNum.aspx?EnsName=BP.WF.FlowDatas',900,900); \">综合分析</a> ");
            }

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("序");
            this.Pub1.AddTDTitle("width='70%'", "流程名称");
            this.Pub1.AddTDTitle("单据");
            this.Pub1.AddTDTitle("流程查询-分析");
            this.Pub1.AddTREnd();

            string sql = "";
            Flows  fls = new Flows();

            fls.RetrieveAll();
            FlowSorts fss = new FlowSorts();

            fss.RetrieveAll();
            string open       = "打开";
            string search     = "查询";
            string dtl        = "明细";
            string bill       = "单据";
            string nodeSearch = "节点";
            string FX         = "分析";
            string myWork     = "我的工作";
            string BPR        = "成本分析";
            int    idx        = 1;
            int    gIdx       = 0;

            foreach (FlowSort fs in fss)
            {
                gIdx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDB("colspan=" + colspan + " class=Sum onclick=\"GroupBarClick('" + gIdx + "')\" ", "<div style='text-align:left; float:left' ><img src='./Style/Min.gif' alert='Min' id='Img" + gIdx + "'   border=0 />&nbsp;<b>" + fs.Name + "</b>");
                this.Pub1.AddTREnd();
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != fs.No)
                    {
                        continue;
                    }

                    this.Pub1.AddTR("ID='" + gIdx + "_" + idx + "'");
                    this.Pub1.AddTDIdx(idx++);

                    if (WebUser.IsWap == false)
                    {
                        this.Pub1.AddTD("width='60%'", "<a href=\"javascript:WinOpen('Chart.aspx?FK_Flow=" + fl.No + "&DoType=Chart','sd');\"  >" + fl.Name + "</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD(fl.Name);
                    }

                    if (fl.NumOfBill == 0)
                    {
                        this.Pub1.AddTD("无");
                    }
                    else
                    {
                        string src = this.Request.ApplicationPath + "WF/Rpt/Bill.aspx?EnsName=BP.WF.Bills&FK_Flow=" + fl.No;
                        this.Pub1.AddTD("<a href=\"javascript:WinOpen('" + src + "');\"  ><img src='/WF/Img/Btn/Word.gif' border=0/>" + bill + "</a>");
                    }
                    this.Pub1.AddTDBegin();
                    string src2 = this.Request.ApplicationPath + "WF/Rpt/Search.aspx?EnsName=ND" + int.Parse(fl.No) + "Rpt&FK_Flow=" + fl.No;
                    this.Pub1.Add("<a href=\"javascript:WinOpen('" + src2 + "');\" >" + search + "</a>");
                    src2 = this.Request.ApplicationPath + "WF/Rpt/Group.aspx?FK_Flow=" + fl.No + "&DoType=Dept";
                    this.Pub1.Add(" - <a href=\"javascript:WinOpen('" + src2 + "');\" >" + FX + "</a>");
                    this.Pub1.AddTDEnd();
                    this.Pub1.AddTREnd();
                }
            }
            this.Pub1.AddTRSum();
            this.Pub1.AddTD("colspan=" + colspan, "&nbsp;");
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
Пример #12
0
        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);
        }
Пример #13
0
        public void AthFlows()
        {
            FlowSorts sorts = new FlowSorts();

            sorts.RetrieveAll();
            Flows fls = new Flows();

            fls.RetrieveAll();

            BP.WF.Port.WFEmp emp = new BP.WF.Port.WFEmp(WebUser.No);

            this.AddTable();
            this.AddCaptionLeft("授权流程范围");
            this.AddTR();
            this.AddTDTitle("IDX");
            this.AddTDTitle("类别");
            this.AddTDTitle("流程");
            this.AddTREnd();
            int i = 0;

            foreach (FlowSort sort in sorts)
            {
                i++;
                this.AddTRSum();
                this.AddTDIdx(i);
                this.AddTDB(sort.Name);
                CheckBox cbAll = new CheckBox();
                cbAll.Text = "选择类别下全部";
                cbAll.ID   = "CB_d" + sort.No;
                this.AddTD(cbAll);
                this.AddTREnd();

                string ctlIDs = "";
                foreach (Flow fl in fls)
                {
                    if (fl.FK_FlowSort != sort.No)
                    {
                        continue;
                    }

                    i++;
                    this.AddTR();
                    this.AddTDIdx(i);
                    this.AddTD("");
                    CheckBox cb = new CheckBox();
                    cb.ID   = "CB_" + fl.No;
                    cb.Text = fl.Name;
                    if (emp.AuthorFlows.Contains(fl.No))
                    {
                        cb.Checked = true;
                    }
                    ctlIDs += cb.ID + ",";
                    this.AddTD(cb);
                    this.AddTREnd();
                }
                cbAll.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";
            }

            this.AddTR();
            this.AddTDTitle("");
            Button btnSaveAthFlows = new Button();

            btnSaveAthFlows.CssClass = "Btn";
            btnSaveAthFlows.ID       = "Btn_Save";
            btnSaveAthFlows.Text     = "Save";
            btnSaveAthFlows.Click   += new EventHandler(btnSaveAthFlows_Click);
            this.Add(btnSaveAthFlows);
            this.AddTD("colspan=2", btnSaveAthFlows);
            this.AddTREnd();
            this.AddTableEnd();
        }
Пример #14
0
        /// <summary>
        /// 时效分析
        /// </summary>
        public void BindTimes()
        {
            if (this.Request.QueryString["FK_Node"] != null)
            {
                this.BindTimesND();
                return;
            }
            if (this.Request.QueryString["FK_Flow"] != null)
            {
                this.BindTimesFlow();
                return;
            }

            FlowSorts sorts = new FlowSorts();

            sorts.RetrieveAll();

            Flows fls = new Flows();

            fls.RetrieveAll();

            Nodes nds = new Nodes();

            nds.RetrieveAll();

            this.AddTable();

            //  this.AddCaptionLeft("第1步:选择要分析的流程");
            //  this.AddTR();
            ////  this.AddTDTitle("ID");
            //  this.AddTDTitle("流程类别");
            //  this.AddTDTitle("流程/流程");
            // // this.AddTDTitle("操作");
            //  this.AddTDTitle("工作数");
            //  this.AddTDTitle("平均用天");
            //  this.AddTREnd();

            foreach (FlowSort sort in sorts)
            {
                this.AddTRSum();
                this.AddTDB(sort.Name);
                this.AddTD("");
                this.AddTD();
                this.AddTD();
                this.AddTD();
                this.AddTD();

                this.AddTREnd();

                foreach (Flow fl in fls)
                {
                    if (sort.No != fl.FK_FlowSort)
                    {
                        continue;
                    }

                    this.AddTRSum();
                    this.AddTD();
                    this.AddTDB(fl.Name);
                    //  this.AddTD("<a href='"+this.PageID+".aspx?DoType=Times&FK_Flow=" + fl.No + "'>分析</a>");
                    this.AddTD("工作数");
                    this.AddTD("平均天" + fl.AvgDay.ToString("0.00"));

                    this.AddTD("我参与的工作数");
                    this.AddTD("工作总数");

                    this.AddTREnd();

                    decimal avgDay = 0;
                    foreach (BP.WF.Node nd in nds)
                    {
                        if (nd.FK_Flow != fl.No)
                        {
                            continue;
                        }

                        this.AddTR();
                        this.AddTD();
                        this.AddTD(nd.Name);
                        //  this.AddTD("<a href='"+this.PageID+".aspx?DoType=Times&FK_Node=" + nd.NodeID + "'>分析</a>");
                        string sql = "";

                        sql = "SELECT  COUNT(*) FROM ND" + nd.NodeID;

                        try
                        {
                            int num = DBAccess.RunSQLReturnValInt(sql);
                            this.AddTD(num);
                        }
                        catch
                        {
                            nd.CheckPhysicsTable();
                            this.AddTD("无效");
                        }

                        sql = "SELECT AVG( DateDiff(d, cast(RDT as datetime),  cast(CDT as datetime) ) ) FROM ND" + nd.NodeID;
                        try
                        {
                            decimal day = DBAccess.RunSQLReturnValDecimal(sql, 0, 2);
                            avgDay += day;
                            this.AddTD(day.ToString("0.00"));
                        }
                        catch
                        {
                            nd.CheckPhysicsTable();
                            this.AddTD("无效");
                        }

                        // day = DBAccess.RunSQLReturnValDecimal(sql, 0, 2);
                        //this.AddTD(DBAccess.RunSQLReturnValInt(""));
                        this.AddTD("无效");

                        this.AddTREnd();
                    }

                    if (avgDay != fl.AvgDay)
                    {
                        fl.AvgDay = avgDay;
                        fl.Update();
                    }
                }
            }
            this.AddTableEnd();
        }
Пример #15
0
        public override object Do()
        {
            string    msg   = "";
            FlowSorts sorts = new FlowSorts();

            sorts.ClearTable();

            DirectoryInfo dirInfo = new DirectoryInfo(SystemConfig.PathOfData + "\\FlowDemo\\Flow\\");

            DirectoryInfo[] dirs = dirInfo.GetDirectories();
            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, 2);
                fs.Name = dir.Name.Substring(3);
                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();
                }
            }

            // 调度表单文件。
            FrmSorts fss = new FrmSorts();

            fss.ClearTable();

            string frmPath = SystemConfig.PathOfData + "\\FlowDemo\\Form\\";

            dirInfo = new DirectoryInfo(frmPath);
            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;
                }
                FrmSort fs = new FrmSort();
                fs.No   = item.Name.Substring(0, 2);
                fs.Name = item.Name.Substring(3);
                fs.Insert();

                foreach (string f in fls)
                {
                    try
                    {
                        msg += "@开始调度表单模板文件:" + f;
                        System.IO.FileInfo info = new System.IO.FileInfo(f);
                        if (info.Extension != ".xml")
                        {
                            continue;
                        }

                        DataSet ds = new DataSet();
                        ds.ReadXml(f);

                        MapData md = MapData.ImpMapData(ds, false);
                        md.FK_FrmSort = fs.No;
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        msg += "@调度失败" + ex.Message;
                    }
                }
            }

            BP.DA.Log.DefaultLogWriteLineInfo(msg);
            return(msg);
        }
Пример #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BP.WF.Flows fls = new BP.WF.Flows();
            fls.RetrieveAll();

            FlowSorts ens = new FlowSorts();

            ens.RetrieveAll();

            DataTable dt = BP.WF.Dev2Interface.DB_GenerCanStartFlowsOfDataTable(BP.Web.WebUser.No);

            int     cols      = 3; //定义显示列数 从0开始。
            decimal widthCell = 100 / cols;

            this.Pub1.AddTable("width=100% border=0");
            this.Pub1.AddCaptionMsg("发起流程");

            int  idx = -1;
            bool is1 = false;

            string timeKey = "s" + this.Session.SessionID + DateTime.Now.ToString("yyMMddHHmmss");

            foreach (FlowSort en in ens)
            {
                if (en.ParentNo == "0" ||
                    en.ParentNo == "" ||
                    en.No == "")
                {
                    continue;
                }

                idx++;
                if (idx == 0)
                {
                    is1 = this.Pub1.AddTR(is1);
                }

                this.Pub1.AddTDBegin("width='" + widthCell + "%' border=0 valign=top");
                //输出类别.
                //this.Pub1.AddFieldSet(en.Name);
                this.Pub1.AddB(en.Name);
                this.Pub1.AddUL();

                #region 输出流程。
                foreach (Flow fl in fls)
                {
                    if (fl.FlowAppType == FlowAppType.DocFlow)
                    {
                        continue;
                    }

                    if (fl.FK_FlowSort != en.No)
                    {
                        continue;
                    }

                    bool isHaveIt = false;
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["No"].ToString() != fl.No)
                        {
                            continue;
                        }
                        isHaveIt = true;
                        break;
                    }

                    string extUrl = "";
                    if (fl.IsBatchStart)
                    {
                        extUrl = "<div style='float:right;'><a href='/WF/BatchStart.aspx?FK_Flow=" + fl.No + "' >批量发起</a>|<a href='/WF/Rpt/Search.aspx?RptNo=ND" + int.Parse(fl.No) + "MyRpt&FK_Flow=" + fl.No + "'>查询</a>|<a href=\"javascript:WinOpen('/WF/Chart.aspx?FK_Flow=" + fl.No + "&DoType=Chart&T=" + timeKey + "','sd');\"  >图</a></div>";
                    }
                    else
                    {
                        extUrl = "<div style='float:right;'><a  href='/WF/Rpt/Search.aspx?RptNo=ND" + int.Parse(fl.No) + "MyRpt&FK_Flow=" + fl.No + "'>查询</a>|<a href=\"javascript:WinOpen('/WF/Chart.aspx?FK_Flow=" + fl.No + "&DoType=Chart&T=" + timeKey + "','sd');\"  >流程图</a></div>";
                    }

                    if (isHaveIt)
                    {
                        if (Glo.IsWinOpenStartWork == 1)
                        {
                            this.Pub1.AddLiB("<a href=\"javascript:WinOpenIt('MyFlow.aspx?FK_Flow=" + fl.No + "&FK_Node=" + int.Parse(fl.No) + "01&T=" + timeKey + "');\" >" + fl.Name + "</a> - " + extUrl);
                        }
                        else if (Glo.IsWinOpenStartWork == 2)
                        {
                            this.Pub1.AddLiB("<a href=\"javascript:WinOpenIt('/WF/OneFlow/MyFlow.aspx?FK_Flow=" + fl.No + "&FK_Node=" + int.Parse(fl.No) + "01&T=" + timeKey + "');\" >" + fl.Name + "</a> - " + extUrl);
                        }
                        else
                        {
                            this.Pub1.AddLiB("<a href='MyFlow.aspx?FK_Flow=" + fl.No + "&FK_Node=" + int.Parse(fl.No) + "01' >" + fl.Name + "</a> - " + extUrl);
                        }
                    }
                    else
                    {
                        this.Pub1.AddLi(fl.Name);
                    }
                }
                #endregion 输出流程。

                this.Pub1.AddULEnd();

                this.Pub1.AddTDEnd();
                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTREnd();
                }
            }

            while (idx != -1)
            {
                idx++;
                if (idx == cols - 1)
                {
                    idx = -1;
                    this.Pub1.AddTD();
                    this.Pub1.AddTREnd();
                }
                else
                {
                    this.Pub1.AddTD();
                }
            }
            this.Pub1.AddTableEnd();
        }