| | |
| | | using HStation.WinFrmUI.Xhs; |
| | | using HStation.WinFrmUI.PhartRelation; |
| | | using HStation.WinFrmUI.Xhs; |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | this.hydroParterPropertyCtrl1.GetHydroInfoEvent += HydroParterPropertyCtrl1_GetHydroInfoEvent; |
| | | this.hydroParterPropertyCtrl1.SelectCurveEvent += HydroParterPropertyCtrl1_SelectCurveEvent; |
| | | this.hydroParterPropertyCtrl1.SelectPatternEvent += HydroParterPropertyCtrl1_SelectPatternEvent; |
| | | this.hydroParterPropertyCtrl1.PropertyValueChangedEvent += HydroParterPropertyCtrl1_PropertyValueChangedEvent; |
| | | this.hydroParterPropertyCtrl1.PropertyValueChangingEvent += HydroParterPropertyCtrl1_PropertyValueChangingEvent; |
| | | this.hydroParterPropertyCtrl1.MatchingDbEvent += HydroParterPropertyCtrl1_MatchingDbEvent; |
| | | this.hydroParterPropertyCtrl1.BlinkLinkParterEvent += HydroParterPropertyCtrl1_BlinkLinkParterEvent; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 强调连接组件事件 |
| | | /// 第一个参数为组件Code |
| | | /// 第二个参数为连接组件Code |
| | | /// </summary> |
| | | public event Action<string, string> BlinkLinkParterEvent; |
| | | |
| | | //水力信息方法 |
| | | private Func<Yw.Model.HydroModelInfo> _hydroInfoFunc = null; |
| | | private Func<List<IHydroCalcuResult>> _allHydroCalcuResultListFunc = null; |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// 初始化数据 |
| | | /// </summary> |
| | | public void SetBindingData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc) |
| | | public void InitialData(Func<Yw.Model.HydroModelInfo> hydroInfoFunc, Func<List<IHydroCalcuResult>> allHydroCalcuResultListFunc) |
| | | { |
| | | _hydroInfoFunc = hydroInfoFunc; |
| | | _allHydroCalcuResultListFunc = allHydroCalcuResultListFunc; |
| | | this.hydroParterPropertyCtrl1.InitialData(hydroInfoFunc); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 更新计算属性 |
| | | /// </summary> |
| | | public void UpdateCalcuProperty(Yw.WinFrmUI.IHydroCalcuProperty rhs) |
| | | public void UpdateCalcuProperty(Yw.WinFrmUI.IHydroCalcuResult rhs) |
| | | { |
| | | var vm = this.hydroParterPropertyCtrl1.SelectedObject; |
| | | if (vm == null) |
| | |
| | | this.hydroParterPropertyCtrl1.UpdateRows(); |
| | | } |
| | | |
| | | //获取水力信息事件 |
| | | private Yw.Model.HydroModelInfo HydroParterPropertyCtrl1_GetHydroInfoEvent() |
| | | //查看曲线 |
| | | private void HydroParterPropertyCtrl1_ViewCurveEvent(Yw.Model.HydroParterInfo parterInfo, string curveType) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | return hydroInfo; |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | switch (curveType) |
| | | { |
| | | case Yw.WinFrmUI.HydroCurve.Pump: |
| | | { |
| | | var pumpInfo = parterInfo as Yw.Model.HydroPumpInfo; |
| | | var curveqh = hydroInfo.Curves?.Find(x => x.Code == pumpInfo.CurveQH); |
| | | if (curveqh == null) |
| | | { |
| | | return; |
| | | } |
| | | var pumpId = string.IsNullOrEmpty(pumpInfo.DbId) ? 0 : Convert.ToInt64(pumpInfo.DbId); |
| | | var curveId = string.IsNullOrEmpty(curveqh.DbId) ? 0 : Convert.ToInt64(curveqh.DbId); |
| | | var speedRatio = pumpInfo.SpeedRatio; |
| | | var dlg = new PumpPerform2dViewDlg(); |
| | | dlg.SetBindingData(pumpId, curveId, speedRatio); |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | |
| | | case Yw.WinFrmUI.HydroCurve.Valve: |
| | | { |
| | | } |
| | | break; |
| | | |
| | | default: break; |
| | | } |
| | | } |
| | | |
| | | //选择曲线 |
| | | private bool HydroParterPropertyCtrl1_SelectCurveEvent(HydroParterPropertyViewModel propViewModel, string curveType) |
| | | private bool HydroParterPropertyCtrl1_SetCurveEvent(HydroParterPropertyViewModel propViewModel, string curveType) |
| | | { |
| | | switch (curveType) |
| | | { |
| | |
| | | } |
| | | var pumpInfo = hydroInfo.Pumps?.Find(x => x.Code == propViewModel.Code); |
| | | |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo); |
| | | var dlg = new PumpMainCurveChoiceDlg(); |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo, _allHydroCalcuResultListFunc?.Invoke()); |
| | | var dlg = new PumpSingleMatchingDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | |
| | | } |
| | | |
| | | //选择模式 |
| | | private bool HydroParterPropertyCtrl1_SelectPatternEvent(HydroParterPropertyViewModel propViewModel, string patternType) |
| | | private bool HydroParterPropertyCtrl1_SetPatternEvent(HydroParterPropertyViewModel propViewModel, string patternType) |
| | | { |
| | | switch (patternType) |
| | | { |
| | |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | //匹配Db |
| | | private bool HydroParterPropertyCtrl1_MatchingDbEvent(HydroParterPropertyViewModel propertyViewModel) |
| | | { |
| | | var bol = false; |
| | | if (propertyViewModel == null) |
| | | { |
| | | return bol; |
| | | } |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return bol; |
| | | } |
| | | var catalog = Yw.WinFrmUI.HydroParterCatalogHelper.GetCatalogCode(propertyViewModel.Catalog); |
| | | switch (catalog) |
| | | { |
| | | case Yw.Hydro.ParterCatalog.Pump://水泵 |
| | | { |
| | | var pumpInfo = hydroInfo.Pumps?.Find(x => x.Code == propertyViewModel.Code); |
| | | if (pumpInfo == null) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, pumpInfo, _allHydroCalcuResultListFunc?.Invoke()); |
| | | if (string.IsNullOrEmpty(pumpInfo.DbId)) |
| | | { |
| | | var dlg = new PumpSingleMatchingDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters()); |
| | | } |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | var dlg = new PumpFullInfoViewDlg(); |
| | | dlg.SetBindindData(input); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | if (bol) |
| | | { |
| | | propertyViewModel.UpdateProperty(pumpInfo, hydroInfo.GetAllParters()); |
| | | } |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Valve://阀门 |
| | | { |
| | | var valveInfo = hydroInfo.Valves?.Find(x => x.Code == propertyViewModel.Code); |
| | | if (valveInfo == null) |
| | | { |
| | | break; |
| | | } |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, valveInfo, _allHydroCalcuResultListFunc?.Invoke()); |
| | | var dlg = new ValveSingleMatchingDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.ReloadDataEvent += (rhs) => |
| | | { |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, rhs); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Pipe://管道 |
| | | { |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Elbow://弯头 |
| | | { |
| | | var elbowInfo = hydroInfo.Elbows?.Find(x => x.Code == propertyViewModel.Code); |
| | | if (elbowInfo == null) |
| | | { |
| | | break; |
| | | } |
| | | var input = AssetsMatchingParasHelper.Create(hydroInfo, elbowInfo, _allHydroCalcuResultListFunc?.Invoke()); |
| | | var dlg = new ElbowSingMatchingDlg(); |
| | | dlg.SetBindingData(input); |
| | | dlg.ReloadDataEvent += (output) => |
| | | { |
| | | bol = AssetsMatchingParasHelper.Apply(hydroInfo, output); |
| | | }; |
| | | dlg.ShowDialog(); |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Threelink://三通 |
| | | { |
| | | } |
| | | break; |
| | | case Yw.Hydro.ParterCatalog.Fourlink://四通 |
| | | { |
| | | } |
| | | break; |
| | | default: break; |
| | | } |
| | | return bol; |
| | | } |
| | | |
| | | //强调连接组件 |
| | | private void HydroParterPropertyCtrl1_BlinkLinkParterEvent(string code, string linkCode) |
| | | { |
| | | if (string.IsNullOrEmpty(code)) |
| | | { |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(linkCode)) |
| | | { |
| | | return; |
| | | } |
| | | this.BlinkLinkParterEvent?.Invoke(code, linkCode); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |