private void RefreshTimer_Tick(object sender, EventArgs e) { TengDa.Communication.APPBLL.comp = this.comTepy.SelectedIndex; var fixtureFurnaceList = fixtureFurnaceMainDB.GetAllData().OrderBy(x => x.FFMNumber).ToList(); for (int i = 0; i < fixtureFurnaceList.Count(); i++) { if (fixtureFurnaceList[i].FFMCreateType == 1)//给炉子赋值 { TengDa.UserControls.OvenView ov = FindChild <OvenView>(this.canvas, "button" + fixtureFurnaceList[i].FFMId); OvenViewModel model = null; if (ov != null) { model = ov.DataContext as OvenViewModel; if ((int)fixtureFurnaceList[i].FFMState == 2) { model.TipInfo = string.Format("报警信息:{0}", "测试报警数据1"); } model.ImgSource = GetAlarmPath((int)fixtureFurnaceList[i].FFMState); // } if (model != null) { RefreshFixtureFurnaceDetail(model, fixtureFurnaceList[i].FFMId); } } else if (fixtureFurnaceList[i].FFMCreateType == 2)//上下料平台赋值 { TengDa.UserControls.MachinePlatform mp = FindChild <MachinePlatform>(this.canvas, "button" + fixtureFurnaceList[i].FFMId); MachinePlatformModel model = null; if (mp != null) { model = mp.DataContext as MachinePlatformModel; if ((int)fixtureFurnaceList[i].FFMState == 2) { model.TipInfo = string.Format("报警信息:{0}", "测试报警数据"); } model.ImgSource = GetAlarmPath((int)fixtureFurnaceList[i].FFMState); // } if (model != null) { RefreshMachine(model, fixtureFurnaceList[i].FFMId); } } } //机器人运行状态 var RobotStateList = robotStateInfoDB.GetAllData().FirstOrDefault(); if (RobotStateList != null) { ChangeImgAddress(1, Convert.ToInt32(RobotStateList.RSIPosition) * 2, Convert.ToInt32(RobotStateList.RSIMoveState)); } }
void RefreshMachine(MachinePlatformModel model, int FFMID = 0) { try { var fixtureFurnaceDetailList = fixtureFurnaceDetailDB.GetAllDataByFFDID(FFMID); for (int i = 0; i < fixtureFurnaceDetailList.Count(); i++) { if (fixtureFurnaceDetailList[i].FFDNumber % 2 == 0)//右边按钮赋值 { model.TempBtnData[Convert.ToInt32(fixtureFurnaceDetailList[i].FFDLayer) - 1].MainBtnInfo.TempNum = fixtureFurnaceDetailList[i].CABarCode; //model.TempBtnData[Convert.ToInt32(fixtureFurnaceDetailListByNumber[i].FFDLayer) -1].AheadBtnInfo = SetButtonState(Convert.ToInt32(fixtureFurnaceDetailListByNumber[i].FFDState), fixtureFurnaceDetailListByNumber[i].CABarCode); } else//左边按钮赋值 { model.TempBtnData[Convert.ToInt32(fixtureFurnaceDetailList[i].FFDLayer) - 1].MainBtnInfo.TempNum = fixtureFurnaceDetailList[i].CABarCode; model.TempBtnData[Convert.ToInt32(fixtureFurnaceDetailList[i].FFDLayer) - 1].MainBtnInfo.ToolTipText = fixtureFurnaceDetailList[i].CABarCode; //model.TempBtnData[Convert.ToInt32(fixtureFurnaceDetailListByNumber[i].FFDLayer) - 1].BackBtnInfo = SetButtonState(Convert.ToInt32(fixtureFurnaceDetailListByNumber[i].FFDState), fixtureFurnaceDetailListByNumber[i].CABarCode); } } } catch { } }