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();
        }
示例#2
0
        /// <summary>
        /// 执行线程.
        /// </summary>
        public void RunIt()
        {
            BP.WF.Flows fls = new BP.WF.Flows();
            fls.RetrieveAll();

            HisScanSta = ScanSta.Working;
            while (true)
            {
                System.Threading.Thread.Sleep(20000);
                while (this.HisScanSta == ScanSta.Pause)
                {
                    System.Threading.Thread.Sleep(3000);
                    if (this.checkBox1.Checked)
                    {
                        Console.Beep();
                    }
                }

                this.SetText("********************************");

                this.SetText("扫描触发式自动发起流程表......");
                this.DoTask();

                this.SetText("扫描定时发起流程....");
                this.DoAutuFlows(fls);

                this.SetText("扫描消息表....");
                this.DoSendMsg();

                //this.SetText("向CCIM里发送消息...");
                //this.DoSendMsgOfCCIM();

                if (DateTime.Now.Hour < 18 && DateTime.Now.Hour > 8)
                {
                    /* 在工作时间段才可以执行此调度。 */
                    string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                    if (now.Contains(":13") || now.Contains(":33") || now.Contains(":53"))
                    {
                        this.SetText("检索自动节点任务....");
                        this.DoAutoNode();
                    }
                }

                System.Threading.Thread.Sleep(1000);
                switch (this.toolStripStatusLabel1.Text)
                {
                case "服务启动":
                    this.toolStripStatusLabel1.Text = "服务启动..";
                    break;

                case "服务启动..":
                    this.toolStripStatusLabel1.Text = "服务启动........";
                    break;

                case "服务启动....":
                    this.toolStripStatusLabel1.Text = "服务启动.............";
                    break;

                default:
                    this.toolStripStatusLabel1.Text = "服务启动";
                    break;
                }
            }
        }
示例#3
0
        /// <summary>
        /// 定时任务
        /// </summary>
        /// <param name="fls"></param>
        private void DoAutuFlows(BP.WF.Flows fls)
        {
            #region 自动启动流程
            foreach (BP.WF.Flow fl in fls)
            {
                if (fl.IsOK == false ||
                    fl.HisFlowRunWay == BP.WF.FlowRunWay.HandWork)
                {
                    continue;
                }

                if (DateTime.Now.ToString("HH:mm") == fl.Tag)
                {
                    continue;
                }

                if (fl.RunObj == null || fl.RunObj == "")
                {
                    string msg = "您设置自动运行流程错误,没有设置流程内容,流程编号:" + fl.No;
                    this.SetText(msg);
                    continue;
                }

                #region 判断当前时间是否可以运行它。
                string   nowStr   = DateTime.Now.ToString("yyyy-MM-dd,HH:mm");
                string[] strs     = fl.RunObj.Split('@'); //破开时间串。
                bool     IsCanRun = false;
                foreach (string str in strs)
                {
                    if (string.IsNullOrEmpty(str))
                    {
                        continue;
                    }
                    if (nowStr.Contains(str))
                    {
                        IsCanRun = true;
                    }
                }
                if (IsCanRun == false)
                {
                    continue;
                }

                // 设置时间.
                fl.Tag = DateTime.Now.ToString("HH:mm");
                #endregion 判断当前时间是否可以运行它。

                // 以此用户进入.
                switch (fl.HisFlowRunWay)
                {
                case BP.WF.FlowRunWay.SpecEmp:     //指定人员按时运行。
                    string RunObj = fl.RunObj;
                    string fk_emp = RunObj.Substring(0, RunObj.IndexOf('@'));

                    BP.Port.Emp emp = new BP.Port.Emp();
                    emp.No = fk_emp;
                    if (emp.RetrieveFromDBSources() == 0)
                    {
                        this.SetText("启动自动启动流程错误:发起人(" + fk_emp + ")不存在。");
                        continue;
                    }
                    BP.Web.WebUser.SignInOfGener(emp);
#warning 尚未实现。
                    //string info_send= BP.WF.Dev2Interface.Node_StartWork(fl.No,);
                    //this.SetText(info_send);
                    continue;

                case BP.WF.FlowRunWay.DataModel:     //按数据集合驱动的模式执行。
                    this.SetText("@开始执行数据驱动流程调度:" + fl.Name);
                    this.DTS_Flow(fl);
                    continue;

                default:
                    break;
                }
            }
            if (BP.Web.WebUser.No != "admin")
            {
                BP.Port.Emp empadmin = new BP.Port.Emp("admin");
                BP.Web.WebUser.SignInOfGener(empadmin);
            }
            #endregion 发送消息
        }
示例#4
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();
        }