private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("알람을 추가하시겠습니까?", "", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                return;

            int alarmCode = 0;
            if (int.TryParse(textBoxCode.Text, out alarmCode) == false)
                return;

            if (FALibrary.Alarm.FAAlarmManager.Instance.Items.ContainsKey(alarmCode))
            {
                MessageBox.Show("같은 코드의 알람이 존재합니다.");
                return;
            }

            if (comboBoxStatus.SelectedIndex < 0)
            {
                MessageBox.Show("상태를 선택해주세요");
                return;
            }

            if (comboBoxType.SelectedIndex < 0)
            {
                MessageBox.Show("타입을 선택해주세요");
                return;
            }

            FAAlarm alarm = new FAAlarm();
            alarm.AlarmNo = alarmCode;
            alarm.AlarmName = textBoxName.Text;
            alarm.Solution = textBoxSolution.Text;
            alarm.Description = textBoxDescription.Text;
            alarm.ImagePath = textBoxImagePath.Text;
            alarm.Type = comboBoxType.SelectedIndex;
            alarm.Status = comboBoxStatus.SelectedIndex;

            FALibrary.Alarm.FAAlarmManager.Instance.Items.Add(alarmCode, alarm);

            try
            {
                Equipment.EquipmentManager.Instance.SaveAlarmList();
            }
            catch
            {
            }
        }
        public static FAAlarm GetAlarm(int alarmNo, string defaultAlarmName)
        {
            FAAlarm alarm = new FAAlarm();

            if (FAAlarmManager.Instance.Items.ContainsKey(alarmNo) == true)
            {
                FAAlarmManager.Instance.Items[alarmNo].CopyTo(alarm);
            }
            else
            {
                alarm.AlarmNo = alarmNo;
                alarm.AlarmName = defaultAlarmName;
                alarm.Solution = "UNDEFINED ALARM. PLEASE DEFINE ALARM NO." + alarmNo.ToString();
            }

            return alarm;
        }
        public AlarmDefineControl()
        {
            InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this) == false)
            {
                Equipment.MainEquipment.Instance.AlarmResourceManager.OnLoadAlarmList +=
                    delegate
                    {
                        AlarmList = FALibrary.Alarm.FAAlarmManager.Instance.Items;
                    };

                Alarm = new FAAlarm();

                AlarmList = FALibrary.Alarm.FAAlarmManager.Instance.Items;
            }
        }
Ejemplo n.º 4
0
        private void SendAlarmToECServer(FAAlarm alarm)
        {
            //Equipment.MainEquipment mainEquip = Equipment.EquipmentManager.Instance.MainEquip;

            //string lotID = Manager.ConfigManager.Instance.Config.DefaultLotID;
            //string partID = Manager.ConfigManager.Instance.Config.DefaultPartID;

            //string currentLotID = mainEquip.InterfaceUnit.ECPart.ECInfo.LotID;
            //string currentPartID = mainEquip.InterfaceUnit.ECPart.ECInfo.PartNo;

            //if (currentLotID != null && currentLotID.Trim() != "" && currentLotID.Length != 0)
            //    lotID = currentLotID;

            //if (currentPartID != null && currentPartID.Trim() != "" && currentPartID.Length != 0)
            //    partID = currentPartID;

            //try
            //{
            //    mainEquip.InterfaceUnit.ECPart.SendAlarmRaiseInfo(Manager.ConfigManager.Instance.Config.EquipmentID,
            //        lotID,
            //        partID,
            //        alarm.AlarmNo.ToString(),
            //        alarm.AlarmName);

            //    _lastAlarmLotID = lotID;
            //    _lastAlarmPartID = partID;
            //}
            //catch
            //{
            //}
        }
Ejemplo n.º 5
0
        private bool IsRankingData(FAAlarm alarm)
        {
            Equipment.MainEquipment mainEquip = Equipment.EquipmentManager.Instance.MainEquip;

            if (mainEquip.LastAlarm != null)
            {
                if ((DateTime.Now - mainEquip.StartedTime).TotalSeconds > Manager.ConfigManager.Instance.Config.JamDelay)
                {
                    return true;
                }
            }
            else
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 6
0
        private bool IsAbleSendAlarm(FAAlarm alarm, bool rankingData)
        {
            Equipment.MainEquipment mainEquip = Equipment.EquipmentManager.Instance.MainEquip;

            if (mainEquip.TestMode) return false;

            return false;
        }
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            var resource = Manager.StringResourceManager.Instance.Resource.GUI.ConfigResource.AlarmDefine;
            if (MessageBox.Show(resource.AreYouSureYouWantToAddThisAlarm, "", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                return;

            int alarmCode = 0;
            if (int.TryParse(textBoxCode.Text, out alarmCode) == false)
                return;

            if (FALibrary.Alarm.FAAlarmManager.Instance.Items.ContainsKey(alarmCode))
            {
                MessageBox.Show(resource.TheAlarmCodeYouHaveEnteredAlreadyExists);
                return;
            }

            if (comboBoxStatus.SelectedIndex < 0)
            {
                MessageBox.Show(resource.PleaseSelectAStatus);
                return;
            }

            if (comboBoxType.SelectedIndex < 0)
            {
                MessageBox.Show(resource.PleaseSelectAType);
                return;
            }

            FAAlarm alarm = new FAAlarm();
            alarm.AlarmNo = alarmCode;
            alarm.AlarmName = textBoxName.Text;
            alarm.Solution = textBoxSolution.Text;
            alarm.Description = textBoxDescription.Text;
            alarm.ImagePath = textBoxImagePath.Text;
            alarm.Type = comboBoxType.SelectedIndex;
            alarm.Status = comboBoxStatus.SelectedIndex;

            FALibrary.Alarm.FAAlarmManager.Instance.Items.Add(alarmCode, alarm);
            listViewAlarmList.ItemsSource = null;
            listViewAlarmList.ItemsSource = FALibrary.Alarm.FAAlarmManager.Instance.Items.Values;

            try
            {
                Equipment.EquipmentManager.Instance.SaveAlarmList();
            }
            catch(Exception ex)
            {
                Manager.LogManager.Instance.WriteSystemLog(ex.ToString());
            }
        }
        private void listViewAlarmList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Alarm = new FAAlarm();

            object item = listViewAlarmList.SelectedItem;
            if (item != null && item is FAAlarm)
            {
                (item as FAAlarm).CopyTo(Alarm);
            }

            BindingUtility.SetBindingObject(comboBoxStatus, BindingMode.TwoWay, Alarm, ComboBox.SelectedIndexProperty, "Status");
            BindingUtility.SetBindingObject(textBoxCode, BindingMode.OneWay, Alarm, TextBox.TextProperty, "AlarmNo");
            BindingUtility.SetBindingObject(textBoxName, BindingMode.TwoWay, Alarm, TextBox.TextProperty, "AlarmName");
            BindingUtility.SetBindingObject(comboBoxType, BindingMode.TwoWay, Alarm, ComboBox.SelectedIndexProperty, "Type");
            BindingUtility.SetBindingObject(textBoxSolution, BindingMode.TwoWay, Alarm, TextBox.TextProperty, "Solution");
            BindingUtility.SetBindingObject(textBoxDescription, BindingMode.TwoWay, Alarm, TextBox.TextProperty, "Description");
            BindingUtility.SetBindingObject(textBoxImagePath, BindingMode.OneWay, Alarm, TextBox.TextProperty, "ImagePath");
            SetImage(Alarm.ImagePath);
        }
Ejemplo n.º 9
0
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            var msg = Utility.UtilityClass.GetStringResource(this, "AreYouSureYouWantToAddThisAlarm", "Are You Sure You Want To Add This Alarm");

            if (MessageBox.Show(msg, "", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
                return;

            int alarmCode = 0;
            if (int.TryParse(textBoxCode.Text, out alarmCode) == false)
                return;

            if (FALibrary.Alarm.FAAlarmManager.Instance.Items.ContainsKey(alarmCode))
            {
                msg = Utility.UtilityClass.GetStringResource(this, "TheAlarmCodeYouHaveEnteredAlreadyExists", "The Alarm Code You Have Entered Already Exists");
                MessageBox.Show(msg);
                return;
            }

            if (comboBoxStatus.SelectedIndex < 0)
            {
                msg = Utility.UtilityClass.GetStringResource(this, "PleaseSelectAStatus", "Please Select A Status");
                MessageBox.Show(msg);
                return;
            }

            if (comboBoxType.SelectedIndex < 0)
            {
                msg = Utility.UtilityClass.GetStringResource(this, "PleaseSelectAType", "Please Select A Type");
                MessageBox.Show(msg);
                return;
            }

            FAAlarm alarm = new FAAlarm();
            alarm.AlarmNo = alarmCode;
            alarm.AlarmName = textBoxName.Text;
            alarm.Solution = textBoxSolution.Text;
            alarm.Description = textBoxDescription.Text;
            alarm.ImagePath = textBoxImagePath.Text;
            alarm.Type = comboBoxType.SelectedIndex;
            alarm.Status = comboBoxStatus.SelectedIndex;

            FALibrary.Alarm.FAAlarmManager.Instance.Items.Add(alarmCode, alarm);

            UpdateAlarmList();
        }
Ejemplo n.º 10
0
        private void AddAlarmOfMachine(FAMachine machine, string preName)
        {
            foreach (var propInfo in machine.GetType().GetProperties())
            {
                foreach (var attr in Attribute.GetCustomAttributes(propInfo, typeof(FAAttribute), false))
                {
                    FAAttribute faAttr = (FAAttribute)attr;
                    if (faAttr.GroupName == "Alarm")
                    {
                        int alarmNo = (int)propInfo.GetValue(machine, null);

                        if (alarmNo == 0) continue;

                        if (FAAlarmManager.Instance.Items.ContainsKey(alarmNo) == false)
                        {
                            try
                            {
                                DefaultAlarmInfo alarmInfo = (DefaultAlarmInfo)Attribute.GetCustomAttribute(propInfo, typeof(DefaultAlarmInfo), false);

                                FAAlarm alarm = new FAAlarm();
                                alarm.AlarmNo = alarmNo;
                                alarm.AlarmName = "[" + preName.Trim() + "] " + propInfo.Name;
                                alarm.Description = "[" + preName.Trim() + "] " + propInfo.Name;
                                if (alarmInfo != null)
                                {
                                    alarm.Type = alarmInfo.AlarmType;
                                    alarm.Status = alarmInfo.AlarmStatus;
                                    alarm.Solution = "[" + preName.Trim() + "] " + alarmInfo.AlarmSolution;
                                }

                                FAAlarmManager.Instance.Items.Add(alarmNo, alarm);
                            }
                            catch
                            {
                            }
                        }

                        break;
                    }
                }
            }
        }
Ejemplo n.º 11
0
 private void EventHandlerLoadAlarmList(object sender, EventArgs e)
 {
     Dispatcher.Invoke(
         new Action(
             delegate()
             {
                 listViewAlarmList.ItemsSource = null;
                 listViewAlarmList.ItemsSource = FALibrary.Alarm.FAAlarmManager.Instance.Items.Values;
                 Alarm = null;
             }));
 }
Ejemplo n.º 12
0
        protected bool IsRankingData(FAAlarm alarm)
        {
            if (LastAlarm != null)
            {
                if ((DateTime.Now - StartedTime).TotalSeconds > Equipment.Config.JamDelay)
                {
                    return true;
                }
            }
            else
            {
                return true;
            }

            return false;
        }
 private void EventHandlerLoadAlarmList(object sender, EventArgs e)
 {
     listViewAlarmList.ItemsSource = null;
     listViewAlarmList.ItemsSource = FALibrary.Alarm.FAAlarmManager.Instance.Items.Values;
     Alarm = null;
 }
        private bool RemoveAlarm(FAAlarm alarm)
        {
            if (SelectedItem == null) return false;

            if (AlarmList.ContainsKey(SelectedItem.AlarmNo) == true)
            {
                AlarmList.Remove(SelectedItem.AlarmNo);
                return true;
            }

            return false;
        }
        private bool AddAlarm(FAAlarm alarm)
        {
            if (FAAlarmManager.Instance.Items.ContainsKey(alarm.AlarmNo) == true)
            {
                var msg = Utility.UtilityClass.GetStringResource(this, "TheAlarmCodeYouHaveEnteredAlreadyExists", "The Alarm Code You Have Entered Already Exists");

                MessageBox.Show(msg);
                return false;
            }

            FAAlarm copiedAlarm = new FAAlarm();
            alarm.CopyTo(copiedAlarm);
            FAAlarmManager.Instance.Items.Add(alarm.AlarmNo, copiedAlarm);
            return true;
        }
        private void SendAlarmToECServer(FAAlarm alarm)
        {
            Equipment.MainEquipment mainEquip = Equipment.EquipmentManager.Instance.MainEquip;

            string lotID = Manager.ConfigManager.Instance.Config.DefaultLotID;
            string partID = Manager.ConfigManager.Instance.Config.DefaultPartID;

            string currentLotID = mainEquip.InterfaceUnit.ECPart.ECInfo.LotID;
            string currentPartID = mainEquip.InterfaceUnit.ECPart.ECInfo.PartNo;

            if (currentLotID != null && currentLotID.Trim() != "" && currentLotID.Length != 0)
                lotID = currentLotID;

            if (currentPartID != null && currentPartID.Trim() != "" && currentPartID.Length != 0)
                partID = currentPartID;

            try
            {
                mainEquip.InterfaceUnit.ECPart.SendAlarmRaiseInfo(Manager.ConfigManager.Instance.Config.EquipmentID,
                    lotID,
                    partID,
                    alarm.AlarmNo.ToString(),
                    alarm.AlarmName);

                _lastAlarmLotID = lotID;
                _lastAlarmPartID = partID;
            }
            catch
            {
            }
        }
        private bool IsAbleSendAlarm(FAAlarm alarm, bool rankingData)
        {
            Equipment.MainEquipment mainEquip = Equipment.EquipmentManager.Instance.MainEquip;

            if (mainEquip.TestMode) return false;

            bool sendAlarm = false;
            if (ConfigManager.Instance.Config.SendAlarmDataToServer)
                if (alarm.Status == ConfigClasses.GlobalConst.ALARM_STATUS_ALARM)
                    sendAlarm = true;

            if (ConfigManager.Instance.Config.SendWarningDataToServer)
                if (alarm.Status == ConfigClasses.GlobalConst.ALARM_STATUS_WARNING)
                    sendAlarm = true;

            if (rankingData == true && sendAlarm)
                if (mainEquip.InterfaceUnit.ECPart != null)
                    return true;

            return false;
        }
 public void CopyTo(FAAlarm alarm)
 {
     alarm.AlarmNo = this.AlarmNo;
     alarm.AlarmName = this.AlarmName;
     alarm.Description = this.Description;
     alarm.Solution = this.Solution;
     alarm.ImagePath = this.ImagePath;
     alarm.Status = this.Status;
     alarm.Type = this.Type;
 }