/// <summary> /// 载入区域和文字 /// </summary> /// <param name="Times"></param> public void WidgetLoad(long Times, bool Widgetevent) { string Key = $" Widget_{Times}"; DataTable Data = CachePlant.GetResult(Key, () => { return(IO_AGVMapService.GetWidget(Times.ToString())); }); int Indexs = 0; foreach (DataRow item in Data.Rows) { if (item["WidgetNo"].ToString().Substring(0, 2).Equals("AR")) { NewArea((new Point() { X = Convert.ToDouble(item["X"].ToString()) * 10, Y = Convert.ToDouble(item["Y"].ToString()) * 10 }), item["Name"].ToString(), Indexs, item["BackColor"].ToString(), item["ForeColor"].ToString(), item["BorderColor"].ToString(), Convert.ToDouble(item["FontSize"].ToString()), Convert.ToDouble(item["Width"].ToString()) * 10, Convert.ToDouble(item["Height"].ToString()) * 10, true, item["FontPosition"].ToString(), Widgetevent); Indexs++; index = Indexs; } else if (item["WidgetNo"].ToString().Substring(0, 2).Equals("TE")) { FontNew((new Point() { X = Convert.ToDouble(item["X"].ToString()) * 10, Y = Convert.ToDouble(item["Y"].ToString()) * 10 }), item["Name"].ToString(), Indexs, Convert.ToDouble(item["FontSize"].ToString()), item["ForeColor"].ToString(), true, Widgetevent); Indexs++; TextInx = Indexs; } } TextInx++; index++; }
/// <summary> /// 加载所有Tag /// </summary> /// <param name="painti"></param> public void LoadTag(long Times, bool Tagevent) { string Key = $"Tag_{Times}"; DataTable Data = CachePlant.GetResult(Key, () => { return(IO_AGVMapService.RataTable(Times.ToString())); }); foreach (DataRow item in Data.Rows) { int id = Convert.ToInt32(item["TagName"].ToString()); TagCreate(new Point() { X = (Convert.ToDouble(item["X"].ToString()) * 10) - 19, Y = (Convert.ToDouble(item["Y"].ToString()) * 10) - 11.5 }, Convert.ToInt32(item["TagName"].ToString()), true, Tagevent); } }
/// <summary> /// 删除地图 /// </summary> /// <param name="gs"></param> /// <returns></returns> public bool Delete_Map(List <Ga_Map> gs) { try { foreach (Ga_Map item in gs) { long UTCTime = UTC.ConvertDateTimeLong(Convert.ToDateTime(item.CreateTime)); IO_AGVMapService.RemoveMap(UTCTime); CachePlant.Remove(UTCTime.ToString()); //移除缓存 } return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 载入线路 /// </summary> /// <param name="Times"></param> public void LoadLine(long Times) { string Key = $"Line_{Times}"; DataTable Data = CachePlant.GetResult(Key, () => { return(IO_AGVMapService.LinelistArrer(Times.ToString())); }); foreach (DataRow item in Data.Rows) { if (Convert.ToInt32(item["LineStyel"].ToString()) == 1) { GetCircuitType = (CircuitType.Line); } else if (Convert.ToInt32(item["LineStyel"].ToString()) == 2) { GetCircuitType = (CircuitType.Broken); } else { GetCircuitType = (CircuitType.Semicircle); } Pairsarray.Add(new WirePoint() { TagID = Convert.ToInt32(item["Tag1"].ToString().Substring(2)), SetPoint = new Point() { X = Convert.ToDouble(item["StartX"].ToString()) * 10, Y = Convert.ToDouble(item["StartY"].ToString()) * 10 } }); Pairsarray.Add(new WirePoint() { TagID = Convert.ToInt32(item["Tag2"].ToString().Substring(2)), SetPoint = new Point() { X = Convert.ToDouble(item["EndX"].ToString()) * 10, Y = Convert.ToDouble(item["EndY"].ToString()) * 10 } }); AddLine(); Pairsarray.Clear(); } }