private void AddChild(GrpFieldSluSglCtrl.GrpFieldSluSglItem para) { var para1 = new List <EquSluSgl.ParaSluCtrl>(); foreach (var f in para.CtrlLst) { var para2 = Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Get(para.FieldId, f); para1.Add(para2); } para1 = (from t in para1 orderby t.OrderId select t).ToList(); foreach (var f in para1) { this.ChildItems.Add(new CtrlNodeItem(FileId, f.CtrlId)); } }
protected void SaveRtuToXml(GrpFieldSluSglCtrl.GrpFieldSluSglItem cnt) { try { if (!Directory.Exists(Xmlfilepath)) { Directory.CreateDirectory(Xmlfilepath); } if (cnt == null) { return; } string path = Xmlfilepath + "\\" + cnt.FieldId + "-" + cnt.GrpId; Wlst.Cr.CoreOne.Seridata.ClassToFileStream.SaveAsXml(path, cnt); } catch (Exception ex) { Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("终端数据写入本地文本异常:" + ex); } }
// private int SluId; public TreeItemGrplViewModel(object targetInfomation, int sluId, bool isGrp) { SluId = sluId; _isGroup = isGrp; if (!isGrp) { var terminalInfomation = targetInfomation as EquSluSgl.ParaSluCtrl; if (terminalInfomation == null) { this.NodeName = "加载出错"; } else { this.NodeName = terminalInfomation.CtrlName; this.NodeType = TreeNodeType.SluNode; this.NodeId = terminalInfomation.CtrlId; } } else { var groupInfomatioin = targetInfomation as GrpFieldSluSglCtrl.GrpFieldSluSglItem; if (groupInfomatioin == null) { this.NodeName = "加载出错"; } else { GrpInfo = groupInfomatioin; this.NodeName = groupInfomatioin.GrpName; this.NodeType = TreeNodeType.IsGrp; this.NodeId = groupInfomatioin.GrpId; } } LabNameVisi = Visibility.Visible; TxbNameVisi = Visibility.Hidden; BackUpName = ""; }
public void Initialize() { Services.SluSglInfoHold.MySlef.OnInit(); //Services.SluSglFieldHold.MySlef.OnInit(); Services.SluSglFieldGrpHold.MySlef.OnInit(); Services.TimeInfos.MySelf.OnInit(); Services.SluSglCtrlDataHold.MySlef.OnInit(); //Services.EquipmentDataInfoHold.MySlef.InitStart(); //AreaInfoHold.MySlef.InitStartService(); //Services.ServicesGrpSingleInfoHold.InitLoad(); //ServicesGrpMulitInfoHold.MySlef.InitSvr(); //ServicesGrpMultiInfoHoldNew.InitLoad(); //Services.RunningInfoHold.InitServices(); //Services.RtuSxxRuleInstancesHold.Myself.InitLoad(); return; var tmp = new GrpFieldSluSglCtrl.GrpFieldSluSglItem() { CtrlLst = new List <int>(), FieldId = 10, GrpName = "x1", GrpId = 1, Order = 1 }; for (int i = 8000001; i < 8000021; i++) { tmp.CtrlLst.Add(i); } Services.SluSglFieldGrpHold.MySlef.Info.TryAdd(new Tuple <int, int>(10, 1), tmp); var tmpfiled = new EquSluSgl.ParaFieldSluSgl() { AreaId = 0, CtrlLst = new List <EquSluSgl.ParaSluCtrl>(), DtUpdate = DateTime.Now.Ticks, FieldId = 10, FieldName = "xr", PhyId = 10, }; foreach (var f in tmp.CtrlLst) { tmpfiled.CtrlLst.Add(new EquSluSgl.ParaSluCtrl() { BarCodeId = f, CtrlGisX = 0, CtrlGisY = 0, CtrlId = f, CtrlName = "N" + f, DtUpdate = DateTime.Now.Ticks, IsAutoOpenLightWhenElec2 = false, IsAutoOpenLightWhenElec3 = false, IsAutoOpenLightWhenElec4 = false, IsUsed = true, IsAlarmAuto = true, IsAutoOpenLightWhenElec1 = false, OrderId = 0, }); } Services.SluSglInfoHold.MySlef.Info.TryAdd(10, tmpfiled); }