private void item_init(DeviceTreeItemViewModel parent) { T_Item = new T1_Item(); T_Item.CardNum = -1; T_Item.SlotNum = -1; T_Item.CHNum = -1; T_Item.Guid = T_Organization.Guid; T_Item.Name = T_Organization.Name; T_Item.Code = T_Organization.Code; //T_Item.CardNum //T_Item.SlotNum //T_Item.CHNum T_Item.T_Device_Guid = parent.T_Organization.Guid; T_Item.T_Device_Code = parent.T_Organization.Code; //T_Item.Remarks T_Item.Create_Time = T_Organization.Create_Time; T_Item.Modify_Time = T_Organization.Modify_Time; T_Item.Sort_No = T_Organization.Sort_No; T_Item.Is_Disabled = T_Organization.Is_Disabled; //T_Item.IP //T_Item.Identifier; //T_Item.ServerIP; //T_Item.ItemType; //T_Item.SlaveIdentifier; if (T_Item.CHNum == -1) { IsPaired = false; } else { IsPaired = true; } T_Organization.NodeType = 2; }
//得到硬件中指定通道 public IChannel GetHardwareChannel(IList <ServerTreeItemViewModel> servers, T1_Item item) { if (servers == null || servers.Count == 0) { return(null); } foreach (var server in servers) { if (server.ServerIP == item.ServerIP) //服务器IP匹配20180306 { foreach (var maincard in server.Children) { if ((maincard as MainCardTreeItemViewModel).MainControlCardIP == item.IP) { if ((item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) || (item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo)) { var cards = (maincard as MainCardTreeItemViewModel).WirelessReceiveCard.TransmissionCard; return(GetHardwareChannel(cards, item.SlaveIdentifier, item.SlotNum.Value, item.CHNum.Value));//htzk123ICard } else { var cards = (maincard as MainCardTreeItemViewModel).WireMatchingCard; return(GetHardwareChannel(cards, item.CardNum.Value, item.SlotNum.Value, item.CHNum.Value));//htzk123ICard } } } } } return(null); }
public ItemTreeItemViewModel(T1_Item item) { T_Item = item; T_Organization = new T1_Organization(); if (item != null) { T_Organization.Name = item.Name; T_Organization.Guid = item.Guid; T_Organization.Code = item.Code; T_Organization.Parent_Guid = item.T_Device_Guid; T_Organization.Parent_Code = item.T_Device_Code; } }
//复制到回收站 public ItemTreeItemViewModel RecycledItemTreeItem(ItemTreeItemViewModel old) { T_Organization = new T1_Organization(); T_Organization.id = old.T_Organization.id; T_Organization.Name = old.T_Item.TempData.Name; T_Organization.Code = old.T_Organization.Code; T_Organization.Guid = old.T_Organization.Guid; T_Organization.Level = old.T_Organization.Level; T_Organization.Sort_No = old.T_Organization.Sort_No; T_Organization.Create_Time = old.T_Organization.Create_Time; T_Organization.Modify_Time = old.T_Item.TempData.Modify_Time; T_Organization.Is_Disabled = true; T_Organization.Parent_Code = old.T_Organization.Parent_Code; T_Organization.Parent_Guid = old.T_Organization.Parent_Guid; T_Organization.Parent_Level = old.T_Organization.Parent_Level; T_Organization.Remarks = old.T_Organization.Remarks; T_Organization.NodeType = old.T_Organization.NodeType; T_Item = new T1_Item(); T_Item.id = old.T_Item.id; T_Item.CardNum = old.T_Item.CardNum; T_Item.SlotNum = old.T_Item.SlotNum; T_Item.CHNum = old.T_Item.CHNum; T_Item.Guid = old.T_Item.Guid; T_Item.Name = old.T_Item.TempData.Name; T_Item.Code = old.T_Item.Code; T_Item.T_Device_Guid = old.T_Item.T_Device_Guid; T_Item.T_Device_Code = old.T_Item.T_Device_Code; T_Item.Remarks = old.T_Item.Remarks; T_Item.Create_Time = old.T_Item.Create_Time; T_Item.Modify_Time = old.T_Item.TempData.Modify_Time; T_Item.Sort_No = old.T_Item.Sort_No; T_Item.Is_Disabled = true; T_Item.IP = old.T_Item.IP; T_Item.Identifier = old.T_Item.Identifier; T_Item.ServerIP = old.T_Item.ServerIP;//废弃ServerIP,但数据库不允许为空,依旧填充//改为初始化时候填充,覆盖数据库的ServerIP。 T_Item.ItemType = old.T_Item.ItemType; T_Item.SlaveIdentifier = old.T_Item.SlaveIdentifier; T_Item.ChannelHDID = old.T_Item.ChannelHDID; IsPaired = false; IsExpanded = true; return(this); }
public void RecoverBind(T1_Item t_item) { T_Item = t_item; IsPaired = true; //InitSignal(); }
//查找服务树上的通道 public ChannelTreeItemViewModel GetChannel(IList <ServerTreeItemViewModel> servers, T1_Item item) { if (servers == null || servers.Count == 0) { return(null); } if ((item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) || (item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo)) { var channels = GetChannels(servers, WireType.Wireless); ChannelTreeItemViewModel channel = (from p in channels where (p.Parent.Parent.Parent.Parent as MainCardTreeItemViewModel).MainControlCardIP == item.IP && (p.Parent.Parent as TransmissionCardTreeItemViewModel).SlaveIdentifier == item.SlaveIdentifier && (p.Parent as SlotTreeItemViewModel).SlotNum == item.SlotNum && p.CHNum == item.CHNum && p.ServerIP == item.ServerIP//服务器IP匹配20180306 select p).FirstOrDefault(); return(channel); } else { var channels = GetChannels(servers, WireType.Wire); ChannelTreeItemViewModel channel = (from p in channels where (p.Parent.Parent.Parent as MainCardTreeItemViewModel).MainControlCardIP == item.IP && (p.Parent.Parent as WireMatchingCardTreeItemViewModel).CardNum == item.CardNum && (p.Parent as SlotTreeItemViewModel).SlotNum == item.SlotNum && p.CHNum == item.CHNum && p.ServerIP == item.ServerIP//服务器IP匹配20180306 select p).FirstOrDefault(); return(channel); } }