lixiaojun
2024-09-20 39d2183cdaf8ce1ee77e36fed5a447b2d8d897a1
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -261,7 +261,87 @@
        //自动匹配
        private void barBtnAllAutoMatching_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_hydroInfo == null)
            {
                return;
            }
            var input = new AssetsAutoMatchingInputViewModel();
            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,这里不是long CurveDbId
                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,这里是string 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,这里是string 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,这里是string 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,这里是string DbId
            //    DbLocked = x.DbLocked,
            //    ModelType = x.ModelType,
            //    Caliber = x.Diameter.ToString(),//这里是数值
            //    Material = x.Material
            //}).ToList();
            input.ValveMatchingModels = _hydroInfo.Pipes?.Select(x => new ValveMatchingViewModel()
            {
                ID = x.ID,
                Name = x.Name,
                Code = x.Code,
                // Dbid=x.DbId,这里是string DbId
                DbLocked = x.DbLocked,
                ModelType = x.ModelType,
                Caliber = x.Diameter.ToString(),//这里是数值
                Material = x.Material//怎么没有阀门类型
            }).ToList();
            //既然入参和出参已经保持一致了,就不能叫做InputViewModel了,有歧义
            //这里可以先是窗体,调试好,后面改成控件
            var dlg = new AssetsAutoMatchingMainDlg();
            dlg.SetBindingData(input);
            // dlg.SetBindingData();
            dlg.RelaodEvent += (rhs) =>
            {