Example #1
0
        /// <summary>
        /// 测试
        /// </summary>
        public void Test()
        {
            AkThresholdModel model = new AkThresholdModel()
            {
                DataDate        = "20180311",
                CreateTime      = "2018-03-12 15:03:04 111",
                UpdateTime      = "2018-03-12 15:03:04 111",
                ThresholdValue  = 10,
                PeriodNum       = 14,
                PeriodStartDate = "20180226",
                PeriodEndDate   = "20180311"
            };

            //AkThreshold akThreshold = new AkThreshold();
            //var ak1 = AkThreshold.GetThreshold();
            //var ak2 = AkThreshold.Save(model);


            AkRemindModel model1 = new AkRemindModel()
            {
                Tasktime = "2018-03-12 15:03:04 111",

                PeriodNum = 14,
                IsRemind  = 1,
                HasRemind = -1
            };

            AkRemind akRemind = new AkRemind();
            //var akRemind1 = akRemind.Insert(model1);
            //var akRemind2 = akRemind.ResetHasRemind(true, 1);
        }
Example #2
0
        //UDP发送分线提醒方法
        //MainWindow.mainWindow.SendMess();
        /// <summary>
        /// 开始计算
        /// </summary>
        public void Start()
        {
            AkThreshold akThreshold = new AkThreshold();

            ///上一次任务执行的时间
            string lastTaskTime = string.Empty;

            while (true)
            {
                //清除日志
                clearLog();

                //@1.读取系统配置信息
                AkConfig.ReadParam();

                //AkConfig.SysParam = new AkSystemParamModel();
                //AkConfig.SysParam.TaskTime = 300;

                //@2.间隔时间,单位 ms
                int waitetime = AkTask.WatiTime(lastTaskTime);
                Thread.Sleep(waitetime);

                lastTaskTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                LogHelper.Info("开始任务时间 = ", lastTaskTime);

                //@3.线程跑阀值
                akThreshold.Excute(lastTaskTime);

                //@4是否分线提醒
                bool bl = new AkRemind().Remind();

                if (bl)
                {
                    MainWindow.mainWindow.SendMess("分线提醒");
                    LogHelper.Info("分线提醒: ", DateTime.Now.ToLongTimeString());
                }
                else
                {
                    MainWindow.mainWindow.SendMess("不分线提醒");
                    LogHelper.Info("不分线提醒: ", DateTime.Now.ToLongTimeString());
                }
                LogHelper.Info(string.Empty, string.Empty);
            }
        }