using Module.Plc.ModbusTcp.Tool; using RS.BLL; using RS.Common; using RS.Model; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace MorClient.UserFrmFrame { public partial class FrmDisplayCotOrDev : Form { // 更新状态栏委托 private delegate void PrintSysTime(); //委托事件 private PrintSysTime DgRealSysTimeValue; BRecipeWoekManage bRecipeWoekManage = new BRecipeWoekManage(); /// /// 采集线程列表 /// private List collectThreadList = new List(); //采集线程集合 public FrmDisplayCotOrDev() { InitializeComponent(); } public FrmDisplayCotOrDev(string str) { InitializeComponent(); nowDisplayCotOrDevLocation = str; this.Text = str; } static string nowDisplayCotOrDevLocation = ""; public void GetNowDisplayCotOrDevLocation(string str) { nowDisplayCotOrDevLocation = str; } //uiLabel3 4 6 15 14 7 11 public void ShowFrmContent() { //int recipeAllStep1 = 0; //int recipeAllStep2 = 0; //int recipeAllStep3 = 0; //int recipeAllStep4 = 0; //if (Common.stationCS1.flowerstate == 7) //{ // recipeAllStep1 = bRecipeWoekManage.recipeAllStep(publicProgram.scrA1, "SCR1"); // recipeAllStep2 = bRecipeWoekManage.recipeAllStep(publicProgram.scrA2, "SCR2"); // recipeAllStep3 = bRecipeWoekManage.recipeAllStep(publicProgram.scrA3, "SCR3"); // recipeAllStep4 = bRecipeWoekManage.recipeAllStep(publicProgram.scrA4, "SCR4"); //} //else if (Common.stationCS1.flowerstate == 8) //{ // recipeAllStep1 = bRecipeWoekManage.recipeAllStep(publicProgram.scrB1, "SCR1"); // recipeAllStep2 = bRecipeWoekManage.recipeAllStep(publicProgram.scrB2, "SCR2"); // recipeAllStep3 = bRecipeWoekManage.recipeAllStep(publicProgram.scrB3, "SCR3"); // recipeAllStep4 = bRecipeWoekManage.recipeAllStep(publicProgram.scrB4, "SCR4"); //} //switch (nowDisplayCotOrDevLocation) //{ // case "SCR1": // uiLabel3.Text = Common.stationInfo_scr1.recipeName; // uiLabel4.Text = Common.stationInfo_scr1.executionSteps.ToString() + "/" + recipeAllStep1.ToString(); // uiLabel7.Text = String.Format("{0:F1}", Common.commonClass_scr1_mainShaft.F_ActualVelocity.ToString()); // uiLabel14.Text = String.Format("{0:F2}", Common.commonClass_scr1_flush.F_ActualPosition.ToString()); // uiLabel15.Text = String.Format("{0:F2}", Common.commonClass_scr1_scrubUpDown.F_ActualPosition); // uiLabel9.Text = String.Format("{0:F2}", Common.commonClass_scr1_scrubLeftRight.F_ActualPosition); // uiLabel11.Text = String.Format("{0:F1}", (Common.stationInfo_scr1.recipeNowTime / 1000).ToString()); // pictureBox1.Image = Common.outputSingal.do1_05 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox2.Image = Common.outputSingal.do1_06 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox3.Image = Common.outputSingal.do1_10 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // break; // case "SCR2": // uiLabel3.Text = Common.stationInfo_scr2.recipeName; // uiLabel15.Text = String.Format("{0:F2}", Common.commonClass_scr2_scrubUpDown.F_ActualPosition); // uiLabel9.Text = String.Format("{0:F2}", Common.commonClass_scr2_scrubLeftRight.F_ActualPosition); // uiLabel4.Text = Common.stationInfo_scr2.executionSteps.ToString() + "/" + recipeAllStep2.ToString(); // uiLabel14.Text = String.Format("{0:F2}", Common.commonClass_scr2_flush.F_ActualPosition.ToString()); // uiLabel7.Text = String.Format("{0:F1}", Common.commonClass_scr2_mainShaft.F_ActualVelocity.ToString()); // uiLabel11.Text = String.Format("{0:F1}", (Common.stationInfo_scr2.recipeNowTime / 1000).ToString()); // pictureBox1.Image = Common.outputSingal.do2_01 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox2.Image = Common.outputSingal.do2_02 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox3.Image = Common.outputSingal.do2_06 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // break; // case "SCR3": // uiLabel3.Text = Common.stationInfo_scr3.recipeName; // uiLabel15.Text = String.Format("{0:F2}", Common.commonClass_scr3_scrubUpDown.F_ActualPosition); // uiLabel9.Text = String.Format("{0:F2}", Common.commonClass_scr3_scrubLeftRight.F_ActualPosition); // uiLabel4.Text = Common.stationInfo_scr3.executionSteps.ToString() + "/" + recipeAllStep3.ToString(); // uiLabel14.Text = String.Format("{0:F2}", Common.commonClass_scr3_flush.F_ActualPosition.ToString()); // uiLabel7.Text = String.Format("{0:F1}", Common.commonClass_scr3_mainShaft.F_ActualVelocity.ToString()); // uiLabel11.Text = String.Format("{0:F1}", (Common.stationInfo_scr3.recipeNowTime / 1000).ToString()); // pictureBox1.Image = Common.outputSingal.do2_13 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox2.Image = Common.outputSingal.do2_14 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox3.Image = Common.outputSingal.do3_02 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // break; // case "SCR4": // uiLabel3.Text = Common.stationInfo_scr4.recipeName; // uiLabel15.Text = String.Format("{0:F2}", Common.commonClass_scr4_scrubUpDown.F_ActualPosition); // uiLabel9.Text = String.Format("{0:F2}", Common.commonClass_scr4_scrubLeftRight.F_ActualPosition); // uiLabel4.Text = Common.stationInfo_scr4.executionSteps.ToString() + "/" + recipeAllStep4.ToString(); // uiLabel14.Text = String.Format("{0:F2}", Common.commonClass_scr4_flush.F_ActualPosition.ToString()); // uiLabel11.Text = String.Format("{0:F1}", (Common.stationInfo_scr4.recipeNowTime / 1000).ToString()); // uiLabel7.Text = String.Format("{0:F1}", Common.commonClass_scr4_mainShaft.F_ActualVelocity.ToString()); // pictureBox1.Image = Common.outputSingal.do3_09 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox2.Image = Common.outputSingal.do3_10 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // pictureBox3.Image = Common.outputSingal.do3_14 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; // break; //} } private void FrmDisplayCotOrDev_Load(object sender, EventArgs e) { #region 实时系统时间 DgRealSysTimeValue = new PrintSysTime(PrintRealSysTime); //开始显示实时系统时间线程 Thread printRealTimeThread = new Thread(StartPrintRealTime); printRealTimeThread.IsBackground = true; printRealTimeThread.Start(); collectThreadList.Add(printRealTimeThread); #endregion 实时系统时间 } /// /// 显示实时系统时间 /// private void PrintRealSysTime() { int recipeAllStep1 = 0; int recipeAllStep2 = 0; int recipeAllStep3 = 0; int recipeAllStep4 = 0; int recipeAllTime1 = 0; int recipeAllTime2 = 0; int recipeAllTime3 = 0; int recipeAllTime4 = 0; RecipeWork recipeWork1 = bRecipeWoekManage.GetTotalWorkRecipe(publicProgram.scrLastName);//查配方 recipeAllStep1 = bRecipeWoekManage.recipeAllStep(recipeWork1.scrOneRecipeName, "SCR1"); recipeAllStep2 = bRecipeWoekManage.recipeAllStep(recipeWork1.scrTwoRecipeName, "SCR2"); recipeAllStep3 = bRecipeWoekManage.recipeAllStep(recipeWork1.scrTreRecipeName, "SCR3"); recipeAllStep4 = bRecipeWoekManage.recipeAllStep(recipeWork1.scrFouRecipeName, "SCR4"); recipeAllTime1 = bRecipeWoekManage.selAllTime(recipeWork1.scrOneRecipeName, "SCR1"); recipeAllTime2 = bRecipeWoekManage.selAllTime(recipeWork1.scrTwoRecipeName, "SCR2"); recipeAllTime3 = bRecipeWoekManage.selAllTime(recipeWork1.scrTreRecipeName, "SCR3"); recipeAllTime4 = bRecipeWoekManage.selAllTime(recipeWork1.scrFouRecipeName, "SCR4"); switch (nowDisplayCotOrDevLocation) { case "SCR1": uiLabel3.Text = recipeWork1.scrOneRecipeName; uiLabel4.Text = Common.stationInfo_scr1.executionSteps.ToString() + "/" + recipeAllStep1.ToString(); uiLabel7.Text = (Common.commonClass_scr1_mainShaft.F_ActualVelocity / 6).ToString("N1"); uiLabel14.Text = Common.commonClass_scr1_flush.F_ActualPosition.ToString("N2"); uiLabel15.Text = Common.commonClass_scr1_scrubUpDown.F_ActualPosition.ToString("N2"); uiLabel9.Text =Common.commonClass_scr1_scrubLeftRight.F_ActualPosition.ToString("N2"); uiLabel11.Text = ((double)Common.stationInfo_scr1.recipeNowTime / 1000).ToString("N1") + "/" +recipeAllTime1.ToString("N1"); pictureBox1.Image = Common.outputSingal.do1_05 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox2.Image = Common.outputSingal.do1_06 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox3.Image = Common.outputSingal.do1_10 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; break; case "SCR2": uiLabel3.Text = recipeWork1.scrTwoRecipeName; uiLabel15.Text = Common.commonClass_scr2_scrubUpDown.F_ActualPosition.ToString("N2"); uiLabel9.Text = Common.commonClass_scr2_scrubLeftRight.F_ActualPosition.ToString("N2"); uiLabel4.Text = Common.stationInfo_scr2.executionSteps.ToString() + "/" + recipeAllStep2.ToString(); uiLabel14.Text = Common.commonClass_scr2_flush.F_ActualPosition.ToString("N2"); uiLabel7.Text = (Common.commonClass_scr2_mainShaft.F_ActualVelocity/6).ToString("N1"); uiLabel11.Text = ((double)Common.stationInfo_scr2.recipeNowTime / 1000).ToString("N1") + "/" + recipeAllTime2.ToString("N1"); ; pictureBox1.Image = Common.outputSingal.do2_01 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox2.Image = Common.outputSingal.do2_02 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox3.Image = Common.outputSingal.do2_06 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; break; case "SCR3": uiLabel3.Text = recipeWork1.scrTreRecipeName; uiLabel15.Text = Common.commonClass_scr3_scrubUpDown.F_ActualPosition.ToString("N2"); uiLabel9.Text = Common.commonClass_scr3_scrubLeftRight.F_ActualPosition.ToString("N2"); uiLabel4.Text = Common.stationInfo_scr3.executionSteps.ToString() + "/" + recipeAllStep3.ToString(); uiLabel14.Text = Common.commonClass_scr3_flush.F_ActualPosition.ToString("N2"); uiLabel7.Text = (Common.commonClass_scr3_mainShaft.F_ActualVelocity/6).ToString("N1"); uiLabel11.Text = ((double)Common.stationInfo_scr3.recipeNowTime / 1000).ToString("N1") + "/" + recipeAllTime3.ToString("N1"); ; pictureBox1.Image = Common.outputSingal.do2_13 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox2.Image = Common.outputSingal.do2_14 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox3.Image = Common.outputSingal.do3_02 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; break; case "SCR4": uiLabel3.Text = recipeWork1.scrFouRecipeName; uiLabel15.Text = Common.commonClass_scr4_scrubUpDown.F_ActualPosition.ToString("N2"); uiLabel9.Text = Common.commonClass_scr4_scrubLeftRight.F_ActualPosition.ToString("N2"); uiLabel4.Text = Common.stationInfo_scr4.executionSteps.ToString() + "/" + recipeAllStep4.ToString(); uiLabel14.Text = Common.commonClass_scr4_flush.F_ActualPosition.ToString("N2"); uiLabel11.Text = ((double)Common.stationInfo_scr4.recipeNowTime / 1000).ToString("N1") + "/" + recipeAllTime4.ToString("N1"); ; uiLabel7.Text = (Common.commonClass_scr4_mainShaft.F_ActualVelocity / 6).ToString("N1"); pictureBox1.Image = Common.outputSingal.do3_09 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox2.Image = Common.outputSingal.do3_10 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; pictureBox3.Image = Common.outputSingal.do3_14 ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; //pictureBox4.Image = Common.commonClass_scr1_valve.F_BlowQi ? WindowsFormsApp1.Properties.Resources.Status_Green : WindowsFormsApp1.Properties.Resources.Status_Gray; break; } } /// /// 开始显示实时系统时间 /// private void StartPrintRealTime() { while (true) { if (this.IsHandleCreated) { uiLabel1.Invoke(DgRealSysTimeValue, null); } Thread.Sleep(500); } } } }