private void DoHomingError(ObjectModule.Local.Event ge) { try { ge.PART_ID = "NA"; ge.SLOT_NO = "NA"; AlarmWindow aw = new AlarmWindow(ge); if ((bool)aw.ShowDialog()) { StaticRes.Global.IsOnProgress = false; StaticRes.Global.Transaction_Continue = true; this.btn_startHoming.IsEnabled = false; this.btn_stopHoming.IsEnabled = true; this.btn_Close.IsEnabled = false; x.Start_Home(true); } else { StaticRes.Global.Transaction_Continue = false; if (StaticRes.Global.Process_Code.Homing != "H000") { StaticRes.Global.Need_Homing = true; } StaticRes.Global.Process_Code.Homing = "H000"; backClick(); this.Close(); StaticRes.Global.Need_Homing = true; } } catch (Exception ee) { MessageBox.Show(ee.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static bool Insert(ObjectModule.Local.Event lh) { try { string sql = @"insert into Event (EVENT_TYPE,EVENT_NAME,EVENT_MESSAGE,DEPARTMENT,SLOT_NO,PROCESS_CODE,PART_ID,USER_ID,UPDATED_TIME,WEEK,MONTH,YEAR) VALUES (@EVENT_TYPE,@EVENT_NAME,@EVENT_MESSAGE,@DEPARTMENT,@SLOT_NO,@PROCESS_CODE,@PART_ID,@USER_ID,@UPDATED_TIME,@WEEK,@MONTH,@YEAR)"; System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sql); cmd.Parameters.Add("@EVENT_TYPE", System.Data.SqlDbType.VarChar).Value = lh.EVENT_TYPE; cmd.Parameters.Add("@EVENT_NAME", System.Data.SqlDbType.VarChar).Value = lh.EVENT_NAME; cmd.Parameters.Add("@EVENT_MESSAGE", System.Data.SqlDbType.VarChar).Value = lh.EVENT_MESSAGE; cmd.Parameters.Add("@DEPARTMENT", System.Data.SqlDbType.VarChar).Value = lh.DEPARTMENT; cmd.Parameters.Add("@SLOT_NO", System.Data.SqlDbType.VarChar).Value = lh.SLOT_NO; cmd.Parameters.Add("@PROCESS_CODE", System.Data.SqlDbType.VarChar).Value = lh.PROCESS_CODE; cmd.Parameters.Add("@PART_ID", System.Data.SqlDbType.VarChar).Value = lh.PART_ID; cmd.Parameters.Add("@USER_ID", System.Data.SqlDbType.VarChar).Value = lh.USER_ID; cmd.Parameters.Add("@UPDATED_TIME", System.Data.SqlDbType.DateTime).Value = lh.UPDATED_TIME; cmd.Parameters.Add("@WEEK", System.Data.SqlDbType.Int).Value = lh.WEEK; cmd.Parameters.Add("@MONTH", System.Data.SqlDbType.Int).Value = lh.MONTH; cmd.Parameters.Add("@YEAR", System.Data.SqlDbType.Int).Value = lh.YEAR; return(Common.DB.SqlDB.SetData(cmd, StaticRes.Local)); } catch (SqlException ee) { throw ee; } }
void Timer(object sender, EventArgs e) { try { //同步mix process bar EMS.Transaction.Mix mixPage = Singleton.MixSingleton.GetInstance; if (mixPage.onGoing && mixPage.Visibility == Visibility.Hidden) { this.pbMainwindowMixing.Value = mixPage.runningTime / mixPage.mixTime * 100; this.pbMainwindowMixing.Visibility = Visibility.Visible; } else { this.pbMainwindowMixing.Visibility = Visibility.Collapsed; } //同步mix process bar txt_clock.Text = System.DateTime.Now.ToString(); string Event_Name = string.Empty; if (HardwareControl.IO_Control.X001_Emergency_Stop_and_Check(ref Event_Name)) { ObjectModule.Local.Event ge = new ObjectModule.Local.Event(); ge.EVENT_TYPE = StaticRes.Global.Event_Type.Alarm; ge.PROCESS_CODE = "Main Page"; ge.EVENT_NAME = Event_Name; ge.USER_ID = "NA"; ge.SLOT_NO = "NA"; ge.PART_ID = "NA"; ge.DEPARTMENT = "NA"; new EMS.AlarmWindow(ge).ShowDialog(); } } catch { } }
public AlarmWindow(ObjectModule.Local.Event ge) { InitializeComponent(); try { tm.Tick += new EventHandler(Timer); tm.Interval = TimeSpan.FromSeconds(0.5); tm.Start(); //***** Display Error information and picture txt_error.Text = StaticRes.Global.CurrentLanguageRes[ge.EVENT_NAME + "_Description"].ToString(); txt_ts.Text = StaticRes.Global.CurrentLanguageRes[ge.EVENT_NAME + "_TroubleShooting"].ToString(); ge.EVENT_NAME = ge.EVENT_NAME; ge.EVENT_TYPE = "Alarm"; ge.EVENT_MESSAGE = txt_error.Text; ge.MONTH = System.DateTime.Now.Month; ge.WEEK = Logic.Common.weekofyear(System.DateTime.Now); ge.YEAR = System.DateTime.Now.Year; ge.UPDATED_TIME = System.DateTime.Now; ge.USER_ID = StaticRes.Global.Current_User.USER_ID; if (ge.USER_ID == null) { ge.USER_ID = "NA"; } ge.DEPARTMENT = StaticRes.Global.Current_User.DEPARTMENT; if (ge.DEPARTMENT == null) { ge.DEPARTMENT = "NA"; } this.image.Source = new BitmapImage(new Uri(@"\Resources\Image\" + ge.EVENT_NAME + ".jpg", UriKind.Relative)); HardwareControl.IO_Control.Alarm_Tower_Light_Setting(); Common.Reports.LogFile.Log("Error : " + txt_error.Text + " ; Process:" + ge.PROCESS_CODE + " ; Part_ID:" + ge.PART_ID + " ; User ID:" + ge.USER_ID); if (ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_top_cover_not_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_top_cover_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_5cc_cap_not_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_10cc_cap_not_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_30cc_cap_not_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_5cc_cap_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_10cc_cap_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_30cc_cap_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Emergency_stop && ge.EVENT_NAME != StaticRes.Global.Error_List.Please_homing_first && ge.EVENT_NAME != StaticRes.Global.Error_List.Lower_air_pressure && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_not_present && ge.EVENT_NAME != StaticRes.Global.Error_List.Syringe_present) { if (ge.EVENT_NAME == StaticRes.Global.CommonError.Error_Name && StaticRes.Global.CommonError.Job == ge.PROCESS_CODE) { TimeSpan st = System.DateTime.Now - StaticRes.Global.CommonError.Error_Time; if (st.TotalMinutes > 3) { DataProvider.Local.Event.Insert(ge); } } else { DataProvider.Local.Event.Insert(ge); } } StaticRes.Global.CommonError.Error_Name = ge.EVENT_NAME; StaticRes.Global.CommonError.Error_Time = System.DateTime.Now; StaticRes.Global.CommonError.Job = ge.PROCESS_CODE; } catch (Exception ff) { MessageBox.Show(ff.Message); } }
void x_HomeError(ObjectModule.Local.Event ge) { this.Dispatcher.Invoke(new HomingError(DoHomingError), new object[1] { ge }); }