Ejemplo n.º 1
0
 public void On_Status_Changed(string Type, string Message)
 {
     switch (Type.ToUpper())
     {
     case "EFEM":
         NodeStatusUpdate.UpdateCurrentState(Message);
         break;
     }
 }
Ejemplo n.º 2
0
        public static void UpdateAlarmList(List <AlarmInfo> AlarmList)
        {
            try
            {
                Form         form = Application.OpenForms["FormAlarm"];
                DataGridView AlarmList_gv;



                if (form == null)
                {
                    return;
                }


                AlarmList_gv = form.Controls.Find("AlarmList_gv", true).FirstOrDefault() as DataGridView;
                if (AlarmList_gv == null)
                {
                    return;
                }

                if (AlarmList_gv.InvokeRequired)
                {
                    UpdateAlarm ph = new UpdateAlarm(UpdateAlarmList);

                    AlarmList_gv.BeginInvoke(ph, AlarmList);
                }
                else
                {
                    //JobList_gv.DataSource = null;
                    AlarmList_gv.DataSource = AlarmList.ToList();

                    //Conn_gv.Refresh();
                    AlarmList_gv.ClearSelection();
                    AlarmList_gv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    NodeStatusUpdate.UpdateCurrentState(FormMain.RouteCtrl.EqpState);
                    if (AlarmList.Count() != 0)
                    {
                        form.Visible = true;
                    }
                    else
                    {
                        form.Visible = false;
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error("UpdateAlarmList: Update fail." + e.Message + "\n" + e.StackTrace);
            }
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if ((DataTable)lsbCondition.DataSource == null || ((DataTable)lsbCondition.DataSource).Rows.Count == 0)
            {
                MessageBox.Show("The grid data does not exist.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            if (lsbCondition.SelectedIndex < 0)
            {
                MessageBox.Show("Choose the condition.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                return;
            }

            //權限檢查
            using (var form = new FormConfirm("是否儲存變更?"))
            {
                var result = form.ShowDialog();
                if (result != DialogResult.OK)
                {
                    MessageBox.Show("Cancel.", "Notice");
                    return;
                }
            }

            string strSql = string.Empty;
            Dictionary <string, object> keyValues = new Dictionary <string, object>();

            try
            {
                strSql = "UPDATE config_signal_tower " +
                         "SET red = @red, " +
                         "orange = @orange, " +
                         "green = @green, " +
                         "blue = @blue, " +
                         "buzzer1 = @buzzer1, " +
                         "buzzer2 = @buzzer2, " +
                         "update_user = @update_user, " +
                         "update_time = NOW() " +
                         "WHERE eqp_status  =  @eqp_status " +
                         "AND is_alarm = @is_alarm ";

                Form  form   = Application.OpenForms["FormMain"];
                Label Signal = form.Controls.Find("lbl_login_id", true).FirstOrDefault() as Label;

                keyValues.Add("@red", cmbRad.Text.ToString());
                keyValues.Add("@orange", cmbYellow.Text.ToString());
                keyValues.Add("@green", cmbGreen.Text.ToString());
                keyValues.Add("@blue", cmbBlue.Text.ToString());
                keyValues.Add("@buzzer1", cmbBuzzer1.Text.ToString());
                keyValues.Add("@buzzer2", cmbBuzzer2.Text.ToString());
                keyValues.Add("@update_user", Signal.Text);
                keyValues.Add("@eqp_status", lsbCondition.Text.Split('-')[0].ToString());
                keyValues.Add("@is_alarm", Convert.ToUInt64(lsbCondition.SelectedValue.ToString()));

                dBUtil.ExecuteNonQuery(strSql, keyValues);

                MessageBox.Show("Done it.", "Save", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                Adam.Util.SanwaUtil.addActionLog("Adam.Menu.SystemSetting", "FormSignalTower", Signal.Text);

                UpdateList();

                txbEqpStatus.Text          = string.Empty;
                txbIsAlarm.Text            = string.Empty;
                cmbBlue.SelectedIndex      = -1;
                cmbGreen.SelectedIndex     = -1;
                cmbRad.SelectedIndex       = -1;
                cmbYellow.SelectedIndex    = -1;
                cmbBuzzer1.SelectedIndex   = -1;
                cmbBuzzer2.SelectedIndex   = -1;
                lsbCondition.SelectedIndex = -1;
                //改設定後套用
                NodeStatusUpdate.InitialSetting();
                NodeStatusUpdate.UpdateCurrentState(FormMain.RouteCtrl.EqpState);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
        }