duheng
2024-12-04 ca1ccd0dd9f2d6936368f07d14a2b29b309fd151
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/04-scheme/01-add/01-set/02-valve/SetSchemeValveListCtrl.cs
@@ -29,6 +29,7 @@
        /// 水力点击事件
        /// </summary>
        public event Action<Yw.Model.HydroParterInfo> HydroClickEvent;
        /// <summary>
        /// 水力改变事件
        /// </summary>
@@ -61,8 +62,10 @@
        //水力信息
        private Yw.Model.HydroModelInfo _hydroInfo = null;
        //所有列表
        private List<HydroValveViewModel> _allList = null;
        //所有绑定列表
        private List<HydroValveViewModel> _allBindingList = null;
@@ -226,80 +229,77 @@
        //设置
        private void SelectChange()
        {
            if (_hydroInfo == null)
            {
                XtraMessageBox.Show("无水力信息");
                return;
            }
            Search();
            var row = this.gridView1.GetFocusedRow() as HydroValveViewModel;
            if (row == null)
            {
                XtraMessageBox.Show("无可设置阀门数据");
                return;
            }
            /* if (_hydroInfo == null)
             {
                 XtraMessageBox.Show("无水力信息");
                 return;
             }
             Search();
             var row = this.gridView1.GetFocusedRow() as HydroValveViewModel;
             if (row == null)
             {
                 XtraMessageBox.Show("无可设置阀门数据");
                 return;
             }
            var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
            var dlg = new ValveSingleMatchingDlg();
            dlg.SetBindingData(input);
            dlg.ReloadDataEvent += (output) =>
            {
                var bol = AssetsMatchingParasHelper.Apply(_hydroInfo, output);
                if (bol)
                {
                    UpdateProperty();
                }
            };
            dlg.ShowDialog();
             var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
             var dlg = new ValveSingleMatchingDlg();
             dlg.SetBindingData(input);
             dlg.ReloadDataEvent += (output) =>
             {
                 var bol = AssetsMatchingParasHelper.Apply(_hydroInfo, output);
                 if (bol)
                 {
                     UpdateProperty();
                 }
             };
             dlg.ShowDialog();*/
        }
        //单元格点击
        private void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            var row = this.gridView1.GetRow(e.RowHandle) as HydroValveViewModel;
            if (row == null)
            {
                return;
            }
            /*  var row = this.gridView1.GetRow(e.RowHandle) as HydroValveViewModel;
              if (row == null)
              {
                  return;
              }
            if (e.Column == this.colSelect)
            {
                var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
                var dlg = new ValveSingleMatchingDlg();
                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 });
              if (e.Column == this.colSelect)
              {
                  var input = AssetsMatchingParasHelper.Create(_hydroInfo, row.Vmo, null);
                  var dlg = new ValveSingleMatchingDlg();
                  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.Valve;
                        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.MinorLoss}",AfterValue=$"{output.MatchingMinorLoss}"},
                        new() {Name="阀门类型",BeforeValue=$"{output.ValveType}",AfterValue=$"{output.MatchingValveType}"},
                        };
                        this.HydroRecordChangedEvent?.Invoke(record);
                    }
                };
                dlg.ShowDialog();
            }
            else
            {
                this.HydroClickEvent?.Invoke(row.Vmo);
            }
                          var record = new SetSchemeParterRecord();
                          record.Name = row.Vmo.Name;
                          record.Code = row.Vmo.Code;
                          record.Catalog = Yw.Hydro.ParterCatalog.Valve;
                          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.MinorLoss}",AfterValue=$"{output.MatchingMinorLoss}"},
                          new() {Name="阀门类型",BeforeValue=$"{output.ValveType}",AfterValue=$"{output.MatchingValveType}"},
                          };
                          this.HydroRecordChangedEvent?.Invoke(record);
                      }
                  };
                  dlg.ShowDialog();
              }
              else
              {
                  this.HydroClickEvent?.Invoke(row.Vmo);
              }*/
        }
    }
}
}