/// <summary> /// 显示所有信标数据 /// </summary> /// <param name="Beacon"></param> /// <param name="arr"></param> public ObservableCollection <MapTag> TagManagement(long UTC) { MySqlDataReader data = IO_AGVMapService.RataTableBLL(UTC); ObservableCollection <MapTag> tags = new ObservableCollection <MapTag>(); while (data.Read()) { MapTag tag = new MapTag(); tag.TagName = data["TagName"].ToString(); tag.NextTag = data["NextTag"].ToString(); tag.NextTagColor = data["NextTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.PreLeftTag = data["PreLeftTag"].ToString(); tag.PreLeftTagColor = data["PreLeftTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.PreRightTag = data["PreRightTag"].ToString(); tag.PreRightTagColor = data["PreRightTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.PreTag = data["PreTag"].ToString(); tag.PreTagColor = data["PreTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.NextLeftTag = data["NextLeftTag"].ToString(); tag.NextLeftTagColor = data["NextLeftTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.NextRightTag = data["NextRightTag"].ToString(); tag.NextRightTagColor = data["NextRightTag"].ToString() != "N/A" ? new SolidColorBrush(Colors.Blue) : new SolidColorBrush(Colors.Black); tag.Speed = MainInfo.agvSpeed[Convert.ToInt32(data["Speed"].ToString())]; tag.SpeedColor = Convert.ToInt32(data["Speed"].ToString()) != 0 && Convert.ToInt32(data["Speed"].ToString()) != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black); tag.SpeedRev = MainInfo.agvSpeed[Convert.ToInt32(data["SpeedRev"].ToString())]; tag.SpeedRevColor = Convert.ToInt32(data["SpeedRev"].ToString()) != 0 && Convert.ToInt32(data["SpeedRev"].ToString()) != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black); tag.StopTime = data["StopTime"].ToString(); tag.Pbs = MainInfo.agvPbs[Convert.ToInt32(data["Pbs"].ToString())]; tag.PbsColor = Convert.ToInt32(data["Pbs"].ToString()) != 16 && Convert.ToInt32(data["Pbs"].ToString()) != 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black); tag.PbsRev = MainInfo.agvPbs[Convert.ToInt32(data["PbsRev"].ToString())]; tag.PbsRevColor = Convert.ToInt32(data["PbsRev"].ToString()) != 16 && Convert.ToInt32(data["PbsRev"].ToString()) != 0 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black); tag.TagTerminal = data["TagTerminal"] is DBNull ? "" : data["TagTerminal"].ToString(); if (CheckColumnName(data, "PreTurnSpeed")) { tag.PreTurnSpeed = MainInfo.agvSpeed[data.GetInt32("PreTurnSpeed")]; tag.PreTurnSpeedColor = (data.GetInt32("PreTurnSpeed") != 0 && data.GetInt32("PreTurnSpeed") != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black)); tag.RevTurnSpeed = MainInfo.agvSpeed[data.GetInt32("RevTurnSpeed")]; tag.RevTurnSpeedColor = (data.GetInt32("RevTurnSpeed") != 0 && data.GetInt32("RevTurnSpeed") != 10 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black)); tag.PreTurnPBS = MainInfo.agvPbs[data.GetInt32("PreTurnPBS")]; tag.PreTurnPBSColor = (data.GetInt32("PreTurnPBS") != 0 && data.GetInt32("PreTurnPBS") != 16 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black)); tag.RevTurnPBS = MainInfo.agvPbs[data.GetInt32("RevTurnPBS")]; tag.RevTurnPBSColor = (data.GetInt32("RevTurnPBS") != 0 && data.GetInt32("RevTurnPBS") != 16 ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Black)); } else { tag.PreTurnSpeed = MainInfo.agvSpeed[0]; tag.PreTurnSpeedColor = new SolidColorBrush(Colors.Black); tag.RevTurnSpeed = MainInfo.agvSpeed[0]; tag.RevTurnSpeedColor = new SolidColorBrush(Colors.Black); tag.PreTurnPBS = MainInfo.agvPbs[0]; tag.PreTurnPBSColor = new SolidColorBrush(Colors.Black); tag.RevTurnPBS = MainInfo.agvPbs[0]; tag.RevTurnPBSColor = new SolidColorBrush(Colors.Black); } tags.Add(tag); } data.Close(); return(tags); }