public TyeEncodeDeviceEntityNode(TyeEncodeDeviceEntity tyeEncodeDeviceEntity) { this.TyeEncodeDeviceEntity = tyeEncodeDeviceEntity; this.ID = tyeEncodeDeviceEntity.ID; this.ParentID = tyeEncodeDeviceEntity.ParentID; this.Code = tyeEncodeDeviceEntity.Code; this.Name = tyeEncodeDeviceEntity.Name; this.NamePY = tyeEncodeDeviceEntity.NamePY; }
/// <summary> 获取测试数据 </summary> DefectMenuEntity GetEntity() { DefectMenuEntity entity = new DefectMenuEntity(); entity.PHMCodes = "A"; // Message:数据采集方式 List <TyeBaseDatacollecttypeEntity> tyeEncodeCategoryconfigEntities = new List <TyeBaseDatacollecttypeEntity>(); for (int i = 0; i < 20; i++) { TyeBaseDatacollecttypeEntity tyeEncodeCategoryconfigEntity = new TyeBaseDatacollecttypeEntity(); //tyeEncodeCategoryconfigEntity.ID = i.ToString(); tyeEncodeCategoryconfigEntity.Code = "Data" + i.ToString(); tyeEncodeCategoryconfigEntity.Name = "N00" + i.ToString(); tyeEncodeCategoryconfigEntities.Add(tyeEncodeCategoryconfigEntity); } entity.DataAcquisitionMode = tyeEncodeCategoryconfigEntities; List <TyeBaseRailwaystationEntity> RailwaySsequences = new List <TyeBaseRailwaystationEntity>(); for (int i = 0; i < 20; i++) { TyeBaseRailwaystationEntity tyeEncodeCategoryconfigEntity = new TyeBaseRailwaystationEntity(); //tyeEncodeCategoryconfigEntity.ID = i.ToString(); tyeEncodeCategoryconfigEntity.Code = "Data" + i.ToString(); tyeEncodeCategoryconfigEntity.Name = "N00" + i.ToString(); RailwaySsequences.Add(tyeEncodeCategoryconfigEntity); } entity.RailwaySsequence = RailwaySsequences; List <TyeBaseLineEntity> tyeBaseLineEntities = new List <TyeBaseLineEntity>(); for (int i = 0; i < 10; i++) { TyeBaseLineEntity tyeBaseLineEntity = new TyeBaseLineEntity(); tyeBaseLineEntity.ID = i.ToString(); tyeBaseLineEntity.LineCode = "Line" + i.ToString(); tyeBaseLineEntity.LineName = "LN00" + i.ToString(); tyeBaseLineEntities.Add(tyeBaseLineEntity); } entity.DedicatedLine = tyeBaseLineEntities; List <TyeBaseSiteEntity> tyeBaseSiteEntities = new List <TyeBaseSiteEntity>(); for (int i = 0; i < 10; i++) { TyeBaseSiteEntity tyeBaseSiteEntity = new TyeBaseSiteEntity(); tyeBaseSiteEntity.ID = i.ToString(); tyeBaseSiteEntity.SiteCode = "Site" + i.ToString(); tyeBaseSiteEntity.SiteName = "SN00" + i.ToString(); tyeBaseSiteEntities.Add(tyeBaseSiteEntity); } entity.DedicatedStation = tyeBaseSiteEntities; List <TyeBaseDepartmentEntity> responsibilityworkarea = new List <TyeBaseDepartmentEntity>(); for (int i = 0; i < 10; i++) { TyeBaseDepartmentEntity tyeBaseSiteEntity = new TyeBaseDepartmentEntity(); tyeBaseSiteEntity.ID = i.ToString(); tyeBaseSiteEntity.Code = "Site" + i.ToString(); tyeBaseSiteEntity.Name = "SN00" + i.ToString(); responsibilityworkarea.Add(tyeBaseSiteEntity); } List <TyeBasePillarEntity> basicunit = new List <TyeBasePillarEntity>(); for (int i = 0; i < 10; i++) { TyeBasePillarEntity tyeBaseSiteEntity = new TyeBasePillarEntity(); tyeBaseSiteEntity.ID = i.ToString(); tyeBaseSiteEntity.PoleMarkCode = "Site" + i.ToString(); //tyeBaseSiteEntity. = "SN00" + i.ToString(); basicunit.Add(tyeBaseSiteEntity); } entity.BasicUnit = basicunit; entity.ResponsibilityWorkArea = responsibilityworkarea; entity.ResponsibilityWorkshop = responsibilityworkarea; ObservableCollection <TyeEncodeDeviceEntity> tyeEncodeDeviceEntities = new ObservableCollection <TyeEncodeDeviceEntity>(); for (int i = 0; i < 3000; i++) { TyeEncodeDeviceEntity tyeEncodeDeviceEntity = new TyeEncodeDeviceEntity(); tyeEncodeDeviceEntity.ID = i.ToString(); tyeEncodeDeviceEntity.Code = "Defect" + i.ToString(); tyeEncodeDeviceEntity.Name = "DN00" + i.ToString(); tyeEncodeDeviceEntity.NamePY = "PY" + i.ToString(); //tyeEncodeDeviceEntity.Name = "名称" + (i + 50).ToString(); //tyeEncodeDeviceEntity.Code = "编码:" + (i + 100).ToString(); //tyeEncodeDeviceEntity.NamePY = "拼音:" + (i + 150).ToString(); tyeEncodeDeviceEntities.Add(tyeEncodeDeviceEntity); } entity.DefectOrMarkCodes = tyeEncodeDeviceEntities; List <DefectCommonUsed> defectCommonUseds = new List <DefectCommonUsed>(); for (int i = 0; i < 50; i++) { DefectCommonUsed defectCommonUsed = new DefectCommonUsed(); defectCommonUsed.ID = i.ToString(); defectCommonUsed.Name = "名称" + (i + 50).ToString(); defectCommonUsed.Code = "编码:" + (i + 100).ToString(); defectCommonUsed.NamePY = "拼音:" + (i + 150).ToString(); defectCommonUsed.Describletion = i.ToString().PadLeft(3, '0') + " " + defectCommonUsed.Name + " " + defectCommonUsed.Code + defectCommonUsed.NamePY + (50 - i).ToString() + "次"; defectCommonUsed.CountUse = i; defectCommonUsed.OrderNo = i; defectCommonUseds.Add(defectCommonUsed); } ObservableCollection <TyeEncodeDeviceEntity> defectOrMarkCodes = new ObservableCollection <TyeEncodeDeviceEntity>(); for (int i = 0; i < 3000; i++) { TyeEncodeDeviceEntity defectOrMarkCode = new TyeEncodeDeviceEntity(); defectOrMarkCode.ID = i.ToString(); defectOrMarkCode.Name = "DN00" + i.ToString(); defectOrMarkCode.Code = "CommonHistoricalDefectsOrMark" + i.ToString(); defectOrMarkCode.NamePY = "NamePY" + i.ToString(); defectOrMarkCode.OrderNo = i; defectOrMarkCodes.Add(defectOrMarkCode); } entity.CommonHistoricalDefectsOrMark = defectCommonUseds; TyeAdminUserEntity tyeAdminUserEntity = new TyeAdminUserEntity(); tyeAdminUserEntity.ID = "1"; tyeAdminUserEntity.Name = "王杰结"; entity.tyeAdminUserEntity = tyeAdminUserEntity; entity.KmLog = "K102+123"; entity.DetectionVehicles = "川A213213"; entity.DetectDate = DateTime.Now; return(entity); }
/// <summary> 绑定命令 </summary> public void RelayMethod(object obj) { string command = obj.ToString(); // Do:保存 if (command == "btn_sumit") { if (this.SelectDefectOrMarkCodes == null) { MessageBox.Show("请先选择缺陷类别!"); return; } this.SumitClick?.Invoke(); } // Do:取消 else if (command == "btn_cancel") { this.CancelClick?.Invoke(); } // Do:初始化 else if (command == "init") { this.FilterMatch += (l, k) => { if (this.DefectMenuEntity.CommonHistoricalDefectsOrMark == null) { return(false); } TyeEncodeDeviceEntity defectCommonUsed = l as TyeEncodeDeviceEntity; if (defectCommonUsed == null) { return(false); } if (string.IsNullOrEmpty(k)) { return(true); } // Message:匹配字段的规则 Func <string, string, bool> match = (m, n) => { if (string.IsNullOrEmpty(m)) { return(false); } return(m.Contains(n)); }; // Message:匹配缺陷样本搜索规则 return(match(defectCommonUsed.Code, k) || match(defectCommonUsed.Name, k) || match(defectCommonUsed.NamePY, k)); }; // // Message:更新PHMCodes // this.Codes.CollectionChanged += (l, k) => //{ // this.PHMCodes = this.Codes.ToList().Aggregate((m, n) => m + " " + n); //}; } // Do:Reset else if (command == "btn_clear") { this.Reset(); } }