using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HStation.WinFrmUI { /// /// 资产匹配参数辅助类 /// public class AssetsMatchingParasHelper { //创建资产自动匹配ViewModel public static AssetsAutoMatchingViewModel Create(Yw.Model.HydroModelInfo hydroInfo) { var input = new AssetsAutoMatchingViewModel(); input.PumpMatchingModels = hydroInfo.Pumps?.Select(x => new PumpMatchingViewModel() { ID = x.ID, Code = x.Code, Name = x.Name, DbId = x.DbId, DbLocked = x.DbLocked, ChartDbID = hydroInfo.Curves?.Find(t => t.Code == x.CurveQH)?.DbId, ModelType = x.ModelType, RatedP = x.RatedP, RatedH = x.RatedH, RatedN = x.RatedN, RatedQ = x.RatedQ, }).ToList(); input.ElbowsMatchingModels = hydroInfo.Elbows?.Select(x => new ElbowsMatchingViewModel() { ID = x.ID, Name = x.Name, Code = x.Code, Dbid = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, Caliber = x.Caliber, Material = x.Material }).ToList(); input.ThreeLinkMatchingModels = hydroInfo.Threelinks?.Select(x => new ThreeLinkMatchingViewModel() { ID = x.ID, Name = x.Name, Code = x.Code, DbId = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, Caliber = x.Caliber, Material = x.Material }).ToList(); input.FourLinkMatchingModels = hydroInfo.Fourlinks?.Select(x => new FourLinkMatchingViewModel() { ID = x.ID, Name = x.Name, Code = x.Code, Dbid = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, Caliber = x.Caliber, Material = x.Material }).ToList(); input.PipeLineMatchingModels = hydroInfo.Pipes?.Select(x => new PipeLineMatchingViewModel() { ID = x.ID, Name = x.Name, Code = x.Code, DbId = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, Caliber = x.Diameter,//这里是数值 Material = x.Material }).ToList(); input.ValveMatchingModels = hydroInfo.Pipes?.Select(x => new ValveMatchingViewModel() { ID = x.ID, Name = x.Name, Code = x.Code, DbId = x.DbId, DbLocked = x.DbLocked, ModelType = x.ModelType, Caliber = x.Diameter,//这里是数值 Material = x.Material//怎么没有阀门类型 }).ToList(); return input; } //应用资产自动匹配ViewModel public static void Apply(Yw.Model.HydroModelInfo hydroInfo, AssetsAutoMatchingViewModel output) { } } }