void timer1_Tick(object sender, EventArgs e) { if (status != 1 || status == 2) { return; } timer1.Stop(); entity1 = new AndonAlertEntity() { ANDON_ALERT_CONTENT = afterandonBtntext, ANDON_ALERT_TIME = DateTime.Now, ANDON_TYPE_CODE = "A", ANSWER_FLAG = "N", COMPANY_CODE = LoginInfo.CompanyInfo.COMPANY_CODE, EMPLOYEE_CODE = LoginInfo.UserInfo.USER_ID, LOCATION_CODE = LoginInfo.StationInfo.RMES_ID, PLINE_CODE = LoginInfo.ProductLineInfo.RMES_ID, REPORT_FLAG = "Y", STOP_FLAG = "1", TEAM_CODE = LoginInfo.TeamInfo.TEAM_CODE }; AndonFactory.SaveAndonAlert(entity1); btnAndon.Text = afterandonBtntext; btnAndon.BackColor = Color.MediumVioletRed; status = 2; //throw new NotImplementedException(); }
//private void Init() //{ // List<AndonAlertEntity> andon = AndonFactory.GetByTime(); // for (int i = 0; i < andon.Count; i++) // { // if (GridAndon.Rows.Count < andon.Count) // GridAndon.Rows.Add(); // StationEntity Stationen = StationFactory.GetByPrimaryKey(andon[i].LOCATION_CODE); // LocationEntity location = LocationFactory.GetByMasterKey(Stationen.RMES_ID); // GridAndon.Rows[i].Cells[0].Value = andon[i].ANDON_ALERT_TIME.ToString("MM/dd/HH:mm"); // GridAndon.Rows[i].Cells[1].Value = Stationen.STATION_NAME; // // GridAndon.Rows[i].Cells[2].Value = location.LOCATION_NAME; // GridAndon.Rows[i].Cells[3].Value = andon[i].ANDON_ALERT_CONTENT.Substring(3, 4); // } //} private void Init() { //textBox.Text = "123"; List <AndonAlertEntity> andon = AndonFactory.GetByTime(); string string1 = "";//, string2, string3; string string2 = ""; string string3 = ""; string string4 = ""; string str1 = ""; string[] str = new string[] { "", "", "" }; for (int i = 0; i < andon.Count; i++) { StationEntity Stationen = StationFactory.GetByPrimaryKey(andon[i].LOCATION_CODE); LocationEntity location = LocationFactory.GetByMasterKey(Stationen.RMES_ID); TeamEntity team = TeamFactory.GetByTeamCode(andon[i].TEAM_CODE); string1 = andon[i].ANDON_ALERT_TIME.ToString("MM/dd/HH:mm"); string2 = Stationen.STATION_NAME; string3 = team.TEAM_NAME; string4 = andon[i].ANDON_ALERT_CONTENT.ToString(); str[i] = string1 + " ," + string2 + string3 + string4; str1 = str1 + str[i] + "\r\n"; textBox.Text = str1; } }
public void BroadCasting() { for (int i = 0; i < RMESID.Count; i++) { //RMESID[i] = item1[i].SubItems[2].Text; List <AndonAlertEntity> AEntity = AndonFactory.GetByPline(RMESID[i]); foreach (AndonAlertEntity en in AEntity) { BroadCastFactory cast = new BroadCastFactory(en); List <string> listcall = cast.speaking(); if (listcall != null) { foreach (string sss in listcall) { strToVoice(sss); strToVoice(sss); //lib.Volume = 100; } en.REPORT_FLAG = "N"; AndonFactory.Update(en); } else { continue; } } } }
public void doWork() { while (!stopThread) { for (int i = 0; i < RMESID.Count; i++) { //RMESID[i] = item1[i].SubItems[2].Text; this.musicplay(); List <AndonAlertEntity> AEntity = AndonFactory.GetByPline(RMESID[i]); //{ axWindowsMediaPlayer1.settings.volume = 5; } //else axWindowsMediaPlayer1.settings.volume = 60; } this.BroadCasting(); // MessageBox.Show("Hello, Chen Jun"); Thread.Sleep(5000); //this.requeststop(); } // Thread.Sleep(5000); }
private void btnAndon_Click(object sender, EventArgs e) { switch (status) { case 0: // normal status int menuheight = ctmenuAndon.Height; ctmenuAndon.Width = btnAndon.Width; ctmenuAndon.Show(btnAndon, new Point(0, 0)); break; case 1: // prepare andon call, can be canceled timer1.Stop(); status = 0; entity1 = null; btnAndon.Text = currentBtnText; btnAndon.BackColor = SystemColors.Control; label1.Visible = false; break; case 2: // calling, can be canceled, but it should be canceld by others who has the privilage. timer1.Stop(); status = 0; entity1.ANSWER_FLAG = "Y"; entity1.ANDON_ANSWER_TIME = DateTime.Now; entity1.REPORT_FLAG = "N"; entity1.MATERIAL_CODE = "-1"; AndonFactory.SaveAndonAlert(entity1); entity1 = null; btnAndon.BackColor = SystemColors.Control; btnAndon.Text = currentBtnText; label1.Visible = false; break; default: status = 0; timer1.Stop(); entity1 = null; break; } }