Esempio n. 1
0
 public void AddAlarmWindow(AlarmWindow _alarmWindow)
 {
     try
     {
         _alarmWindows.Add(_alarmWindow);
     }
     catch (Exception ex)
     {
         ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs
         {
             Methode = MethodBase.GetCurrentMethod(),
             Error   = ex
         });
     }
 }
Esempio n. 2
0
        public void FireAlarm(StreamerData data)
        {
            if (lastAlarmWindow != null && !lastAlarmWindow.IsClosed)
            {
                return;
            }

            lastAlarmWindow = new AlarmWindow();
            lastAlarmWindow.InitWithStreamerData(data);
            if (data.PreventPopup || (PreventPopupAllCheckBox.IsChecked.HasValue && PreventPopupAllCheckBox.IsChecked.Value))
            {
                return;
            }
            lastAlarmWindow.Show();
        }
        private void faxService_EinsatzCreated(object sender, EinsatzCreatedEventArgs e)
        {
            if (e == null || e.Einsatz == null)
            {
                return;
            }

            var _tempTime = e.Einsatz.AlarmTime;
            //Set new AlarmTime if AMS was activ in the last 5min
            var _pagerMessages = ServiceLocator.Current.GetInstance <MainPagersViewModel>()
                                 .PagerMessages.OrderByDescending(a => a.Time).ToList();

            if (_pagerMessages != null)
            {
                foreach (var _message in _pagerMessages)
                {
                    //Stop if time is longer ago then 5 minutes
                    if ((DateTime.Now - _message.Time).Minutes > 5)
                    {
                        break;
                    }

                    //Change time only if prio
                    if (_message.Priority)
                    {
                        e.Einsatz.AlarmTime = _message.Time;
                    }
                }

                //Logging
                if (e.Einsatz.AlarmTime != _tempTime)
                {
                    Logger.WriteDebug(MethodBase.GetCurrentMethod(),
                                      "Einsatz -> AlarmTime changed to " + e.Einsatz.AlarmTime);
                }
            }

            //Show Window
            var _alarmWindow = new AlarmWindow(e.Einsatz);

            _alarmWindow.Topmost = IsAdminMode ? false : true;
            _alarmWindow.Show();
        }
Esempio n. 4
0
 private void DoWeightError(Event et)
 {
     try
     {
         et.USER_ID         = StaticRes.Global.Current_User.USER_ID;
         et.DEPARTMENT      = StaticRes.Global.Current_User.DEPARTMENT;
         et.PART_ID         = this.txt_partID.Text;
         et.SLOT_NO         = "Slot-" + this.txt_slotID.Text + ",Index" + this.txt_slotIndex.Text;
         btn_load.IsEnabled = true;
         CloseComPort();
         Common.Reports.LogFile.Log("Close COM");
         AlarmWindow aw = new AlarmWindow(et);
         if ((bool)aw.ShowDialog())
         {
             btn_close.IsEnabled                   = false;
             btn_stop.IsEnabled                    = true;
             btn_load.IsEnabled                    = false;
             btn_openScrapBin.IsEnabled            = false;
             StaticRes.Global.IsOnProgress         = false;
             StaticRes.Global.Transaction_Continue = true;
             InitComPort();
             Common.Reports.LogFile.Log("Open COM");
             Weighting.Start_Weight(int.Parse(txt_capacity.Text), true, string.Empty, string.Empty, false, txt_emptySyringeWeight.Text);
         }
         else
         {
             Common.Reports.LogFile.Log("Terminate in loading process , user : "******"L000")
             {
                 StaticRes.Global.Need_Homing = true;
             }
             StaticRes.Global.Transaction_Continue = false;
             StaticRes.Global.Process_Code.Loading = "L000";
             backClick();
             this.Close();
         }
     }
     catch (Exception ee)
     {
         Common.Reports.LogFile.Log("Terminate in loading process , user :"******"Message", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 5
0
        private void DoError(Event ge)
        {
            try
            {
                ge.USER_ID                    = StaticRes.Global.Current_User.USER_ID;
                ge.DEPARTMENT                 = StaticRes.Global.Current_User.DEPARTMENT;
                ge.PART_ID                    = this.txt_partID.Text;
                ge.SLOT_NO                    = "S" + this.txt_slotID.Text + "L" + this.txt_slotIndex.Text;
                btn_unload.IsEnabled          = true;
                StaticRes.Global.IsOnProgress = false;
                CloseComPort();
                Common.Reports.LogFile.Log("Close COM");

                AlarmWindow aw = new AlarmWindow(ge);
                if ((bool)aw.ShowDialog())
                {
                    InitComPort();
                    Common.Reports.LogFile.Log("Open COM");
                    btn_unload.IsEnabled                  = false;
                    StaticRes.Global.IsOnProgress         = false;
                    StaticRes.Global.Transaction_Continue = true;
                    unload.Start_UnLoad(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
                }
                else
                {
                    Common.Reports.LogFile.Log("Terminate in unload process , user : "******"U000")
                    {
                        StaticRes.Global.Need_Homing = true;
                    }
                    StaticRes.Global.Process_Code.Unloading = "U000";
                    backClick();
                    this.Close();
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 6
0
 private void DoError(Event et)
 {
     try
     {
         et.USER_ID         = StaticRes.Global.Current_User.USER_ID;
         et.DEPARTMENT      = StaticRes.Global.Current_User.DEPARTMENT;
         et.PART_ID         = this.txt_partID.Text;
         et.SLOT_NO         = "Slot-" + this.txt_slotID.Text + ",Index" + this.txt_slotIndex.Text;
         btn_load.IsEnabled = true;
         CloseComPort();
         Common.Reports.LogFile.Log("Close COM");
         AlarmWindow aw = new AlarmWindow(et);
         if ((bool)aw.ShowDialog())
         {
             btn_close.IsEnabled                   = false;
             btn_stop.IsEnabled                    = true;
             btn_load.IsEnabled                    = false;
             btn_openScrapBin.IsEnabled            = false;
             StaticRes.Global.IsOnProgress         = false;
             StaticRes.Global.Transaction_Continue = true;
             InitComPort();
             Common.Reports.LogFile.Log("Open COM");
             load.Start_Load(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
         }
         else
         {
             Common.Reports.LogFile.Log("Terminate in loading process , user : "******"L000")
             {
                 StaticRes.Global.Need_Homing = true;
             }
             StaticRes.Global.Transaction_Continue = false;
             StaticRes.Global.Process_Code.Loading = "L000";
             backClick();
             this.Close();
         }
     }
     catch
     {
     }
 }
Esempio n. 7
0
 private void DoComplete(bool complete)
 {
     try
     {
         if (complete)
         {
             #region Update Server Database
             while (!Logic.Transaction.Remove.Local_Update(txt_partID.Text, txt_slotID.Text, txt_slotIndex.Text, txt_mcID.Text, STATUS, START_WEIGHT,
                                                           CURRENT_WEIGHT, txt_sapcode.Text, THAWING_TIME, txt_readyTime.Text, txt_expiryTime.Text, DESCRIPTION, BATCH_NO, CAPACITY, txt_remark.Text))
             {
                 Event ge = new Event();
                 ge.EVENT_NAME   = StaticRes.Global.Error_List.Update_database_failed;
                 ge.PROCESS_CODE = "Update DB";
                 ge.SLOT_NO      = "S" + txt_slotID.Text + "L" + txt_slotIndex.Text;
                 AlarmWindow pp = new AlarmWindow(ge);
                 pp.ShowDialog();
             }
             #endregion
             Common.Reports.LogFile.Log("Remove successful - Part ID:" + this.txt_partID.Text + " ; Sapcode:" + txt_mcID.Text + " ; MC ID:" + txt_mcID.Text + " by user " + txt_userID.Text);
             MessageBox.Show("Remove Successful !!\n移除成功!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
             StaticRes.Global.Transaction_Continue = false;
             this.dg_list.ItemsSource = Logic.Transaction.Remove.Bin_withMaterial().DefaultView;
             kb_UndoClick();
             pb.Value = 0;
         }
         else
         {
             if (MessageBox.Show("Please take out material from slot , then press 'OK' !!\n请把料取出后,点击‘OK’!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk) == MessageBoxResult.OK)
             {
                 StaticRes.Global.IsOnProgress         = false;
                 StaticRes.Global.Transaction_Continue = true;
                 unload.Start_UnLoad(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
             }
         }
     }
     catch (Exception ee)
     {
         Common.Reports.LogFile.Log("Remove page error when complete , error : " + ee.Message);
         MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 8
0
        public void RemoveAlarmWindow(AlarmWindow _alarmWindow)
        {
            try
            {
                _alarmWindows.Remove(_alarmWindow);

                //Check if all alarmWindows closed to add delay time
                if (_alarmWindows.Count == 0 && Settings.Default.Monitor_AlarmDelayTime.TotalSeconds > 0)
                {
                    _timeWindowElapsed = DateTime.Now.Add(Settings.Default.Monitor_AlarmDelayTime);
                }
            }
            catch (Exception ex)
            {
                ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs
                {
                    Methode = MethodBase.GetCurrentMethod(),
                    Error   = ex
                });
            }
        }
Esempio n. 9
0
 private void DoComplete(bool complete)
 {
     try
     {
         if (complete)
         {
             #region Update Database
             while (!Logic.Transaction.Load.Local_Update(txt_slotID.Text, txt_slotIndex.Text, txt_batchNo.Text,
                                                         txt_sapcode.Text, txt_description.Text, txt_partID.Text, txt_thawingTime.Text, txt_readyTime.Text,
                                                         txt_expiryTime.Text, this.txt_mfExpiryDate.Text, txt_weighing.Text, txt_capacity.Text, txt_emptySyringeWeight.Text))
             {
                 Event et = new Event();
                 et.EVENT_NAME = StaticRes.Global.Error_List.Update_database_failed;
                 AlarmWindow pp = new AlarmWindow(et);
                 pp.ShowDialog();
             }
             Common.Reports.LogFile.Log("Load successful - Part ID:" + this.txt_partID.Text + " ; Sapcode:" + txt_sapcode.Text + " by user " + txt_userID.Text);
             MessageBox.Show("Loading Successful !!\n存料成功!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
             StaticRes.Global.Transaction_Continue = false;
             kb_UndoClick();
             pb.Value = 0;
             #endregion
         }
         else
         {
             if (MessageBox.Show("Please put material into slot !!\n请把料放入槽中!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk) == MessageBoxResult.OK)
             {
                 StaticRes.Global.IsOnProgress         = false;
                 StaticRes.Global.Transaction_Continue = true;
                 load.Start_Load(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
             }
         }
     }
     catch (Exception ee)
     {
         Common.Reports.LogFile.Log("Loading page error when complete thread : " + ee.Message);
         MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 10
0
 private void DoWeightError(Event et)
 {
     try
     {
         et.USER_ID           = StaticRes.Global.Current_User.USER_ID;
         et.DEPARTMENT        = StaticRes.Global.Current_User.DEPARTMENT;
         et.PART_ID           = this.txt_partID.Text;
         et.SLOT_NO           = "Slot-" + this.txt_slotID.Text + ",Index" + this.txt_slotIndex.Text;
         btn_return.IsEnabled = true;
         AlarmWindow aw = new AlarmWindow(et);
         if ((bool)aw.ShowDialog())
         {
             btn_close.IsEnabled                   = false;
             btn_stop.IsEnabled                    = true;
             btn_return.IsEnabled                  = false;
             StaticRes.Global.IsOnProgress         = false;
             StaticRes.Global.Transaction_Continue = true;
             Weighting.Start_Weight(int.Parse(txt_capacity.Text), false, txt_scrapWeight.Text, txt_expiryTime.Text, (bool)cb_forceScrap.IsChecked, txt_syringeWeight.Text);
         }
         else
         {
             Common.Reports.LogFile.Log("Terminate in return process , user : "******"R000")
             {
                 StaticRes.Global.Need_Homing = true;
             }
             StaticRes.Global.Transaction_Continue   = false;
             StaticRes.Global.Process_Code.Returning = "R000";
             backClick();
             this.Close();
         }
     }
     catch (Exception ee)
     {
         Common.Reports.LogFile.Log("Terminate in Returning process , user :"******"Message", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 11
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(sender is Button b))
            {
                return;
            }
            if (!(b.Tag is Guid g))
            {
                return;
            }

            if (AlarmWindow != null && !AlarmWindow.Tag.ToString().Equals("Closed"))
            {
                AlarmWindow.Topmost = true;
                AlarmWindow.Topmost = false;
                AlarmWindow.Focus();
            }
            else
            {
                AlarmWindow        = new AlarmWindow();
                AlarmWindow.TaskId = g;
                AlarmWindow.Show();
            }
        }
Esempio n. 12
0
        private void DoComplete(bool complete)
        {
            try
            {
                if (complete)
                {
                    #region Update Server Database
                    while (!Logic.Transaction.Unload.Local_Update(txt_partID.Text, txt_slotID.Text, txt_slotIndex.Text, txt_mcID.Text,
                                                                  txt_locID.Text, txt_status.Text, txt_startWeight.Text, txt_currentWeight.Text, txt_sapcode.Text, txt_thawingTime.Text,
                                                                  txt_readyTime.Text, txt_expiryTime.Text, txt_description.Text, txt_batchNo.Text, txt_capacity.Text, txt_lotID.Text,
                                                                  txt_mesDevice.Text))
                    {
                        Event ge = new Event();
                        ge.EVENT_NAME   = StaticRes.Global.Error_List.Update_database_failed;
                        ge.PROCESS_CODE = "Update DB";
                        ge.SLOT_NO      = "S" + txt_slotID.Text + "L" + txt_slotIndex.Text;
                        AlarmWindow pp = new AlarmWindow(ge);
                        pp.ShowDialog();
                    }
                    #endregion

                    if (StaticRes.Global.Hardware_Connection)
                    {
                        if (StaticRes.Global.System_Setting.Print_Label_After_Unload == "True")
                        {
                            do
                            {
                                Logic.Print.EMS(txt_partID.Text, txt_mcID.Text, txt_expiryTime.Text, txt_thawingTime.Text, txt_readyTime.Text, txt_sapcode.Text);
                            }while (MessageBox.Show(this, "Do you receive the label ?!\n你有保存这个号码吗?!", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No);
                        }
                    }
                    Common.Reports.LogFile.Log("Unload successful - Part ID:" + this.txt_partID.Text + " ; Sapcode:" + txt_sapcode.Text + " ; MC ID:" + txt_mcID.Text + " by user " + txt_userID.Text);
                    MessageBox.Show("Unloading Successful !!\n取料成功!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    StaticRes.Global.Transaction_Continue = false;
                    kb_UndoClick();
                    pb.Value = 0;



                    #region  自动跳转mix page.
                    //if (MessageBox.Show("Do you need to mix immediately?\n要立即搅拌吗?", "Message", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    //{
                    //    Transaction.Mix mixPage = EMS.Singleton.MixSingleton.GetInstance;

                    //    if (mixPage.onGoing)
                    //    {
                    //        MessageBox.Show("Mixer is running, please wait!\n搅拌机正在运行, 请等待!");
                    //    }
                    //    else
                    //    {
                    //        mixPage.userID = StaticRes.Global.Current_User.USER_ID;
                    //        mixPage.userGroup = StaticRes.Global.Current_User.USER_GROUP;
                    //        mixPage.userName = StaticRes.Global.Current_User.USER_NAME;
                    //        mixPage.department = StaticRes.Global.Current_User.DEPARTMENT;

                    //        mixPage.txt_partID_input.Text = _partID;
                    //        mixPage.validation();
                    //    }

                    //    btn_close_Click(null, null);

                    //    System.Threading.Thread.Sleep(100);
                    //    mixPage.ShowWindow();
                    //}
                    #endregion
                }
                else
                {
                    //2020 05 13 add slot detect logic. if need to check in GUI side
                    if (StaticRes.Global.Process_Code.Unloading == "U050")
                    {
                        StaticRes.Global.IsOnProgress         = false;
                        StaticRes.Global.Transaction_Continue = true;
                        //compare the slot ID and label

                        unload.Start_UnLoad(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
                    }
                    else
                    {
                        if (MessageBox.Show("Please take out material from slot , then press 'OK' !!\n请取出物料再点击‘OK’!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk) == MessageBoxResult.OK)
                        {
                            StaticRes.Global.IsOnProgress         = false;
                            StaticRes.Global.Transaction_Continue = true;
                            unload.Start_UnLoad(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text));
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                Common.Reports.LogFile.Log("Unload page error when complete , error : " + ee.Message);
                MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 13
0
        private void DoComplete(bool complete)
        {
            try
            {
                this.btn_return.IsEnabled     = false;
                StaticRes.Global.IsOnProgress = false;
                if (complete)
                {
                    string status = cbb_returnType.Text;
                    string remark = string.Empty;
                    if (cbb_remark.Text.Length == 0)
                    {
                        remark = "";
                    }
                    else
                    {
                        remark = cbb_remark.Text;
                    }
                    //if (StaticRes.Global.updata)
                    //{
                    #region Update Server Database
                    if (cb_forceScrap.IsChecked == true)
                    {
                        status = StaticRes.Global.Status.Scrap;
                    }
                    while (!Logic.Transaction.Return.Local_Update(status, txt_batchNo.Text, txt_capacity.Text, txt_weighing.Text, txt_startWeight.Text, txt_description.Text,
                                                                  txt_partID.Text, txt_sapcode.Text, txt_slotID.Text, txt_slotIndex.Text, remark, txt_thawingTime.Text, txt_readyTime.Text, txt_expiryTime.Text, txt_equipID.Text))
                    {
                        Event ge = new Event();
                        ge.EVENT_NAME   = StaticRes.Global.Error_List.Update_database_failed;
                        ge.PROCESS_CODE = "Update DB";
                        ge.SLOT_NO      = "S" + txt_slotID.Text + "L" + txt_slotIndex.Text;
                        AlarmWindow pp = new AlarmWindow(ge);
                        pp.ShowDialog();
                    }
                    #endregion
                    // }
                    Common.Reports.LogFile.Log("Return successful, Part ID : " + txt_partID.Text + " ; Sapcode : " + txt_sapcode.Text + " ; Weighing : " + txt_weighing.Text + " ; Batch No : " + txt_batchNo.Text + " ; User ID : " + txt_userID.Text);
                    if (status == StaticRes.Global.Status.Scrap)
                    {
                        MessageBox.Show("Scrap Successful !!\n报废成功!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    }
                    else
                    {
                        MessageBox.Show("Return Successful !!\n还料成功!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    }

                    StaticRes.Global.Transaction_Continue = false;
                    kb_UndoClick();
                    pb.Value = 0;
                }
                else
                {
                    if (MessageBox.Show("Please put material into slot , then press 'OK' !!\n请把料放入槽中,点击‘OK’!!", "Message", MessageBoxButton.OK, MessageBoxImage.Asterisk) == MessageBoxResult.OK)
                    {
                        StaticRes.Global.IsOnProgress         = false;
                        StaticRes.Global.Transaction_Continue = true;
                        x.Start_Return(int.Parse(txt_slotID.Text), int.Parse(txt_slotIndex.Text), true);
                    }
                }
            }
            catch (Exception ee)
            {
                Common.Reports.LogFile.Log("Return page error when complete thread : " + ee.Message);
                MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }