private void DataConfig_Load(object sender, EventArgs e) { try { OPC = new OPCCreate(); productionType.Text = BussinessFacde.GetConfigXml("ProductionType"); materialType.Text = BussinessFacde.GetConfigXml("materialType"); //写入来料方式 materialWay.Text = BussinessFacde.GetConfigXml("materialWay"); //写入物料PN materialPn.Text = BussinessFacde.GetConfigXml("materialPn"); number.Text = BussinessFacde.GetConfigXml("TodayPlan"); speed.Text = BussinessFacde.GetConfigXml("Speed"); } catch { //关闭窗口 this.Dispose(); this.Close(); } }
/// <summary> /// 开启业务处理的线程 /// </summary> public void StartBussinessThread() { //开启页面跳转线程 String speed = BussinessFacde.GetConfigXml("Speed"); //获取配置的页面跳转速度 if (!String.IsNullOrEmpty(speed) && Convert.ToInt32(speed) > 0) //配置的速度不为空 { OverrideTimer tt = new OverrideTimer(); //将用户配置的时间转换为毫秒 int speedControl = Convert.ToInt32(speed) * 1000; tt.Interval = speedControl; tt.Elapsed += new System.Timers.ElapsedEventHandler(ChangePageBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } else //如果用户没有配置,则默认10秒切换页面 { OverrideTimer tt = new OverrideTimer(); //将用户配置的时间转换为毫秒 tt.Interval = 10000; tt.Elapsed += new System.Timers.ElapsedEventHandler(ChangePageBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } //开启地址监听线程,实时刷新看板数据 String stationText = BussinessFacde.GetConfigXml("Station"); if (!String.IsNullOrEmpty(stationText)) { String[] stationArray = stationText.Split(','); for (int i = 0; i < stationArray.Length; i++) { if (i < 8) //一个页面放8个工位的图片 { if (i < 4) { StationPenalControl spc = new StationPenalControl(); panel1.Controls.Add(spc); spc.Location = new Point(28 + 200 * i, 139); spc.LB_PanelStation.Text = "OP" + stationArray[i]; TimeSpan time = TimeSpan.Parse("00:00:00"); TimeHelper myTime = new TimeHelper(time, spc.LB_ErrorTimes); OverrideTimer tt = new OverrideTimer(); tt.MYTIME = myTime; tt.Spc = spc; tt.Type = "1"; tt.Station = stationArray[i]; tt.Interval = 1000; tt.Elapsed += new System.Timers.ElapsedEventHandler(ShowBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } else { StationPenalControl spc = new StationPenalControl(); spc.LB_PanelStation.Text = "OP" + stationArray[i]; panel1.Controls.Add(spc); spc.Location = new Point(28 + 200 * (i - 4), 139 * 2); TimeSpan time = TimeSpan.Parse("00:00:00"); TimeHelper myTime = new TimeHelper(time, spc.LB_ErrorTimes); OverrideTimer tt = new OverrideTimer(); tt.MYTIME = myTime; tt.Spc = spc; tt.Type = "1"; tt.Station = stationArray[i]; tt.Interval = 1000; tt.Elapsed += new System.Timers.ElapsedEventHandler(ShowBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } } else if (i >= 8 && i < 16) { if (i < 12) { StationPenalControl spc = new StationPenalControl(); panel16.Controls.Add(spc); spc.Location = new Point(28 + 200 * (i - 8), 139); spc.LB_PanelStation.Text = "OP" + stationArray[i]; TimeSpan time = TimeSpan.Parse("00:00:00"); TimeHelper myTime = new TimeHelper(time, spc.LB_ErrorTimes); OverrideTimer tt = new OverrideTimer(); tt.MYTIME = myTime; tt.Spc = spc; tt.Type = "1"; tt.Station = stationArray[i]; tt.Interval = 1000; tt.Elapsed += new System.Timers.ElapsedEventHandler(ShowBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } else { StationPenalControl spc = new StationPenalControl(); panel16.Controls.Add(spc); spc.Location = new Point(28 + 200 * (i - 12), 139 * 2); spc.LB_PanelStation.Text = "OP" + stationArray[i]; TimeSpan time = TimeSpan.Parse("00:00:00"); TimeHelper myTime = new TimeHelper(time, spc.LB_ErrorTimes); OverrideTimer tt = new OverrideTimer(); tt.MYTIME = myTime; tt.Spc = spc; tt.Type = "1"; tt.Station = stationArray[i]; tt.Interval = 1000; tt.Elapsed += new System.Timers.ElapsedEventHandler(ShowBusinessProcess); tt.Enabled = true; tt.AutoReset = false; } } // tt.Type = BussinessFacde.GetConfigXml("ProductionType"); // tt.Plan = BussinessFacde.GetConfigXml("TodayPlan"); } } //开启产品上产状态线程 OverrideTimer t1 = new OverrideTimer(); //将用户配置的时间转换为毫秒 t1.Interval = 2000; t1.Elapsed += new System.Timers.ElapsedEventHandler(showProductionState); t1.Enabled = true; t1.AutoReset = false; }