duheng
2024-12-05 4446901f8ecde9b6e593d871465e89662ad58965
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/03-pipe/SetSchemePipeListCtrl.cs
@@ -29,11 +29,16 @@
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
        /// <summary>
        /// 水力改变事件
        /// </summary>
        public event Action<List<HydroParterInfo>> HydroChangedEvent;
        /// <summary>
        /// 水力记录改变事件
        /// </summary>
        public event Action<SetSchemeParterRecord> HydroRecordChangedEvent;
        /// <summary>
        /// 显示查询面板
@@ -57,8 +62,10 @@
        //水力信息
        private Yw.Model.HydroModelInfo _hydroInfo = null;
        //所有列表
        private List<HydroPipeViewModel> _allList = null;
        //所有绑定列表
        private List<HydroPipeViewModel> _allBindingList = null;
@@ -67,7 +74,7 @@
        /// </summary>
        public void SetBindingData(HydroModelInfo hydroInfo)
        {
            _hydroInfo=hydroInfo;
            _hydroInfo = hydroInfo;
            _allList = new List<HydroPipeViewModel>();
            if (hydroInfo != null && hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
            {
@@ -83,7 +90,7 @@
        /// <summary>
        /// 绑定数据
        /// </summary>
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuResult> allCalcuResultList)
        public void SetBindingData(Yw.Model.HydroModelInfo hydroInfo, List<HydroCalcuVisualResult> allCalcuResultList)
        {
            _allList = new List<HydroPipeViewModel>();
            if (hydroInfo != null && hydroInfo.Pipes != null && hydroInfo.Pipes.Count > 0)
@@ -164,7 +171,7 @@
        /// <summary>
        /// 更新计算属性
        /// </summary>
        public void UpdateCalcuProperty(List<HydroCalcuResult> allCalcuResultList)
        public void UpdateCalcuProperty(List<HydroCalcuVisualResult> allCalcuResultList)
        {
            if (allCalcuResultList != null && allCalcuResultList.Count > 0)
            {
@@ -221,7 +228,7 @@
        //设置
        private void SelectChange()
        {
        {
            Search();
            var row = this.gridView1.GetFocusedRow() as HydroPipeViewModel;
            if (row == null)
@@ -229,45 +236,52 @@
                XtraMessageBox.Show("无可设置管道数据");
                return;
            }
        }
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as HydroPipeViewModel;
            if (row == null)
            {
                return;
            }
            /* var row = this.gridView1.GetRow(e.RowHandle) as HydroPipeViewModel;
             if (row == null)
             {
                 return;
             }
            if (e.Column == this.colSelect)
            {
                var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
                var dlg = new PipeSingMatchingDlg();
                dlg.SetBindingData(input);
                dlg.ReloadDataEvent += (output) =>
                {
                    var bol = AssetsMatchingParasHelper.Apply(_hydroInfo, output);
                    if (bol)
                    {
                        row.UpdateProperty();
                        this.gridView1.RefreshRow(e.RowHandle);
                        this.HydroChangedEvent?.Invoke(new List<Yw.Model.HydroParterInfo>() { row.Vmo });
                    }
                };
                dlg.ShowDialog();
            }
            else
            {
                this.HydroClickEvent?.Invoke(row.Vmo);
            }
             if (e.Column == this.colSelect)
             {
                 var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
                 var dlg = new SimulationPipeSingleMatchingDlg();
                 dlg.SetBindingData(input);
                 dlg.ReloadDataEvent += (output) =>
                 {
                     var bol = AssetsMatchingParasHelper.Apply(_hydroInfo, output);
                     if (bol)
                     {
                         row.UpdateProperty();
                         this.gridView1.RefreshRow(e.RowHandle);
                         this.HydroChangedEvent?.Invoke(new List<Yw.Model.HydroParterInfo>() { row.Vmo });
                         var record = new SetSchemeParterRecord();
                         record.Name = row.Vmo.Name;
                         record.Code = row.Vmo.Code;
                         record.Catalog = Yw.Hydro.ParterCatalog.Pipe;
                         record.MatchingModel = output;
                         record.Items = new List<SetSchemeParterRecordItem>() {
                         new() {Name="型号",BeforeValue=$"{output.ModelType}",AfterValue=$"{output.MatchingModelType}"},
                         new() {Name="材料",BeforeValue=$"{output.Material}",AfterValue=$"{output.MatchingMaterial}"},
                         new() {Name="直径(mm)",BeforeValue=$"{output.Diameter}",AfterValue=$"{output.MatchingDiameter}"},
                         new() {Name="粗糙系数",BeforeValue=$"{output.Roughness}",AfterValue=$"{output.MatchingRoughness}"},
                         new() {Name="局阻系数",BeforeValue=$"{output.MinorLoss}",AfterValue=$"{output.MatchingMinorLoss}"},
                         };
                         this.HydroRecordChangedEvent?.Invoke(record);
                     }
                 };
                 dlg.ShowDialog();
             }
             else
             {
                 this.HydroClickEvent?.Invoke(row.Vmo);
             }*/
        }
    }
}
}