private void btnResetConfig_Click(object sender, EventArgs e)
        {
            PanelAlertMessage.BackColor = Color.Gray;
            lbAlertMessage.Text         = "RESET TIME";
            lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;

            //reset data and save to local
            IdleTimer.Stop();
            RuningTimer.Stop();
            SettingTimer.Stop();
            DowntimeTimer.Stop();

            countSettingtimes  = new TimeSpan(0);
            countIdletimes     = new TimeSpan(0);
            countDownTimetimes = new TimeSpan(0);
            countRunningtimes  = new TimeSpan(0);

            txtRunningTimes.Text = "00h:00m:00s";
            txtSettingTimes.Text = "00h:00m:00s";
            txtDownTimes.Text    = "00h:00m:00s";
            txtIdleTimes.Text    = "00h:00m:00s";


            Properties.Settings.Default.RunningTimes = countRunningtimes;
            Properties.Settings.Default.DownTimes    = countDownTimetimes;
            Properties.Settings.Default.SettingTimes = countSettingtimes;

            Properties.Settings.Default.Save();

            planQty         = 0;
            expectValue     = 0;
            totalInputValue = 0;
            totalPassValue  = 0;
            yieldValue      = 0.0;
            OEEValue        = 0.0;

            expectRatio = 0;
            qtyPerInput = 0;

            txtQtyPlan.Text   = planQty.ToString();
            txtQtyExpect.Text = expectValue.ToString();
            txtQtyInput.Text  = totalInputValue.ToString();
            btnQtyPass.Text   = totalPassValue.ToString();
            txtQtyYield.Text  = yieldValue.ToString("N2") + "%";
            txtOEEvalue.Text  = OEEValue.ToString("N3") + "%";

            tikerTime                   = DateTime.Now.TimeOfDay;
            countIdletimes              = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
            bbcountIdletimes            = countIdletimes;
            PanelAlertMessage.BackColor = Color.DarkOrange;
            IdleTimer.Start();
        }
        private void btnMachineError_Click(object sender, EventArgs e)
        {
            txtMessage.Text = "Machine is error";

            tikerTime = DateTime.Now.TimeOfDay;
            RuningTimer.Stop();
            IdleTimer.Stop();
            SettingTimer.Stop();

            PanelAlertMessage.BackColor = Color.Crimson;
            bbcountDownTimetimes        = countDownTimetimes;
            DowntimeTimer.Start();
        }
        private void btnTrial_Click(object sender, EventArgs e)
        {
            txtMessage.Text = "Machine is trial";

            tikerTime = DateTime.Now.TimeOfDay;
            RuningTimer.Stop();
            IdleTimer.Stop();
            DowntimeTimer.Stop();

            PanelAlertMessage.BackColor = Color.DeepSkyBlue;
            bbcountSettingtimes         = countSettingtimes;
            SettingTimer.Start();
        }
Exemplo n.º 4
0
 public bool PreFilterMessage(ref Message m)
 {
     if (m.Msg == WM_MOUSEMOVE)                  // mouse move is high volume
     {
         return(false);
     }
     if (!IdleTimer.Enabled)                     // idling?
     {
         return(false);                          // No
     }
     if (Array.BinarySearch(Messages, m.Msg) >= 0)
     {
         IdleTimer.Stop();
     }
     return(false);
 }
        private void btnExit_Click(object sender, EventArgs e)
        {
            IdleTimer.Stop();
            currentTimer.Stop();
            RuningTimer.Stop();
            SettingTimer.Stop();
            DowntimeTimer.Stop();
            updateChartTimer.Stop();

            Properties.Settings.Default.RunningTimes = countRunningtimes;
            Properties.Settings.Default.DownTimes    = countDownTimetimes;
            Properties.Settings.Default.SettingTimes = countSettingtimes;

            Properties.Settings.Default.Save();

            Close();
        }
        public async Task BeginInit()
        {
            //todo _comm.RegisterUri("meditech", OnUri);

            try
            {
                var response = await _core.HttpClient.GetObjectAsync <GetMeditechSettingsResponse>("meditech/get_settings/");

                if (response.Success)
                {
                    _settings = response.Result;
                    Timeout   = response.Result.Timeout;
                    _timer?.Stop();
                    _timer       = new IdleTimer(TimeSpan.FromSeconds(Timeout));
                    _timer.Tick += _timer_Elapsed;
                }
            }
            catch
            {
            }
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            // job detail from server
            if (txtJobNo.Text != "")
            {
                txtBarcode.Enabled = false;
                txtMessage.Text    = "Machine is running";

                tikerTime = DateTime.Now.TimeOfDay;
                IdleTimer.Stop();
                SettingTimer.Stop();
                DowntimeTimer.Stop();

                PanelAlertMessage.BackColor = Color.LimeGreen;
                bbcountRunningtimes         = countRunningtimes;
                RuningTimer.Start();
            }
            else
            {
                MessageBox.Show("Please scan barcode or key job number before start");
            }
        }
Exemplo n.º 8
0
        // sets CurrentAction, PreviousAction, ImagePath
        // should be called often
        public void Advance(float x, float y)
        {
            // detect movement
            var action = DetectMovement(x, y);

            // detect if we are idle
            if (IdleTimer.ElapsedMilliseconds > IdleLimit)
            {
                action = ChangeAction(MotionAction.Idle);
                IdleTimer.Stop();
            }

            // get the relevant image
            ImageSet set = default(ImageSet);

            if (!ImageSets.TryGetValue(CurrentAction, out set))
            {
                throw new Exception("Failed to get images for action : " + CurrentAction);
            }
            var index = ImageIndex % set.Images.Length;

            Image = set.Images[index].Image;

            // advance
            if (ImageTimer.ElapsedMilliseconds > set.PerImageLimit)
            {
                if (index == 0)
                {
                    ImageIndex = 1;
                }
                else
                {
                    ImageIndex++;
                }
                ImageTimer.Stop(); ImageTimer.Reset(); ImageTimer.Start();
            }
        }
        private void updateChartTimer_Tick(object sender, EventArgs e)
        {
            if ((DateTime.Now.TimeOfDay >= endTime) && (DateTime.Now.TimeOfDay > startTime))
            {
                if (resetDone == false)
                {
                    resetDone = true;
                    //startTime =startTime.Subtract(new TimeSpan(1, 0, 0, 0));
                    txtMessage.Text = "Stop all process because now is reset data time !!!";
                    //send data to server



                    //reset data and save to local
                    IdleTimer.Stop();
                    RuningTimer.Stop();
                    SettingTimer.Stop();
                    DowntimeTimer.Stop();

                    countSettingtimes  = new TimeSpan(0);
                    countIdletimes     = new TimeSpan(0);
                    countDownTimetimes = new TimeSpan(0);
                    countRunningtimes  = new TimeSpan(0);

                    txtRunningTimes.Text = "00h:00m:00s";
                    txtSettingTimes.Text = "00h:00m:00s";
                    txtDownTimes.Text    = "00h:00m:00s";
                    txtIdleTimes.Text    = "00h:00m:00s";


                    Properties.Settings.Default.RunningTimes = countRunningtimes;
                    Properties.Settings.Default.DownTimes    = countDownTimetimes;
                    Properties.Settings.Default.SettingTimes = countSettingtimes;

                    Properties.Settings.Default.Save();

                    lbAlertMessage.Text         = "RESET TIME";
                    PanelAlertMessage.BackColor = Color.Gray;
                    lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;
                }
                else
                {
                    lbAlertMessage.Text         = "END PROCESS TIME";
                    PanelAlertMessage.BackColor = Color.DarkOrange;
                    lbAlertMessage.Left         = (PanelAlertMessage.Width - lbAlertMessage.Width) / 2;
                    txtMessage.Text             = "Now is End of Process time";
                }
            }
            else if ((DateTime.Now.TimeOfDay < endTime) && (DateTime.Now.TimeOfDay > startTime))
            {
                TimeSpan countAlltime = countSettingtimes + countIdletimes + countDownTimetimes + countRunningtimes;

                if (countSettingtimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[0].SetValueY((double)(countSettingtimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countIdletimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[1].SetValueY((double)(countIdletimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countDownTimetimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[2].SetValueY((double)(countDownTimetimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }
                if (countRunningtimes.TotalSeconds > 0)
                {
                    chart1.Series[0].Points[3].SetValueY((double)(countRunningtimes.TotalSeconds * 100 / (countAlltime.TotalSeconds)));
                }

                calYieldandOEE();


                chart1.Refresh();

                resetDone = false;

                if (!DowntimeTimer.Enabled && !SettingTimer.Enabled && !RuningTimer.Enabled && !IdleTimer.Enabled)
                {
                    txtMessage.Text             = "Please key or scan job barcode before start process";
                    tikerTime                   = DateTime.Now.TimeOfDay;
                    countIdletimes              = tikerTime - startTime - countRunningtimes - countDownTimetimes - countSettingtimes;
                    bbcountIdletimes            = countIdletimes;
                    PanelAlertMessage.BackColor = Color.DarkOrange;
                    IdleTimer.Start();
                }
            }
        }