| | |
| | | |
| | | #endregion |
| | | |
| | | #region 自定义标签 |
| | | #region 业务计算自定义标签 |
| | | |
| | | /// <summary> |
| | | /// 设置自定义标签 |
| | | /// 显示业务计算自定义标签 |
| | | /// </summary> |
| | | public async Task SetCustomLabels(List<CustomLabel> obj) |
| | | public async Task SetLogicCalcuCustomLabels(CalcuResult calcuResult) |
| | | { |
| | | if (_bimfaceInteropContainer == null) |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceInteropContainer.SetCustomLabels(obj); |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | await _bimfaceInteropContainer?.ClearLogicCalcuCustomLabels(); |
| | | return; |
| | | } |
| | | var obj = new List<CustomLabel>(); |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | allParterList?.ForEach(x => |
| | | { |
| | | if (x is Yw.Model.HydroPumpInfo pump) |
| | | { |
| | | var hz = pump.RatedHz * pump.SpeedRatio; |
| | | var calcuPump = calcuResult.LinkList.Find(x => x.Id == pump.Code); |
| | | var calcuPumpStart = calcuResult.NodeList.Find(x => x.Id == pump.StartCode); |
| | | var calcuPumpEnd = calcuResult.NodeList.Find(x => x.Id == pump.EndCode); |
| | | var pumpCustomLabel = new CustomLabel(); |
| | | pumpCustomLabel.Id = pump.Code; |
| | | pumpCustomLabel.Data = new List<CustomLabelItem>() |
| | | { |
| | | new CustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(pump.LinkStatus),Unit=string.Empty}, |
| | | new CustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty}, |
| | | new CustomLabelItem(){ Name="流量",Value=Math.Round(calcuPump.Flow,1).ToString(),Unit="m³/h"}, |
| | | new CustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStart.Head,4).ToString(),Unit="m"}, |
| | | new CustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEnd.Head,4).ToString(),Unit="m"}, |
| | | }; |
| | | obj.Add(pumpCustomLabel); |
| | | } |
| | | else if (x is Yw.Model.HydroEmitterInfo emitter) |
| | | { |
| | | var calcuEmitter = calcuResult.NodeList.Find(x => x.Id == emitter.Code); |
| | | var emitterCustomLabel = new CustomLabel(); |
| | | emitterCustomLabel.Id = emitter.Code; |
| | | emitterCustomLabel.Data = new List<CustomLabelItem>() |
| | | { |
| | | new CustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.Demand,1).ToString(),Unit="m³/h"}, |
| | | new CustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.Head,4).ToString(),Unit="m"} |
| | | }; |
| | | obj.Add(emitterCustomLabel); |
| | | } |
| | | }); |
| | | await _bimfaceInteropContainer?.SetLogicCalcuCustomLabels(obj); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 清除自定义标签 |
| | | /// 清除业务计算自定义标签 |
| | | /// </summary> |
| | | public async Task ClearCustomLabels() |
| | | public async Task ClearLogicCalcuCustomLabels() |
| | | { |
| | | if (_bimfaceInteropContainer == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceInteropContainer.ClearCustomLabels(); |
| | | await _bimfaceInteropContainer?.ClearLogicCalcuCustomLabels(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 自定义标签 |
| | | |
| | | /// <summary> |
| | | /// 显示计算自定义标签 |
| | | /// </summary> |
| | | public async Task ShowCalcuCustomLabels(CalcuResult calcuResult) |
| | | { |
| | | var hydroInfo = _hydroInfoFunc?.Invoke(); |
| | | if (hydroInfo == null) |
| | | { |
| | | return; |
| | | } |
| | | if (calcuResult == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!calcuResult.Succeed) |
| | | { |
| | | await _bimfaceInteropContainer.ClearCustomLabels(); |
| | | return; |
| | | } |
| | | var obj = new List<CustomLabel>(); |
| | | var allParterList = hydroInfo.GetAllParters(); |
| | | allParterList?.ForEach(x => |
| | | { |
| | | if (x is Yw.Model.HydroPumpInfo pump) |
| | | { |
| | | var hz = pump.RatedHz * pump.SpeedRatio; |
| | | var calcuPump = calcuResult.LinkList.Find(x => x.Id == pump.Code); |
| | | var calcuPumpStart = calcuResult.NodeList.Find(x => x.Id == pump.StartCode); |
| | | var calcuPumpEnd = calcuResult.NodeList.Find(x => x.Id == pump.EndCode); |
| | | var pumpCustomLabel = new CustomLabel(); |
| | | pumpCustomLabel.Id = pump.Code; |
| | | pumpCustomLabel.Data = new List<CustomLabelItem>() |
| | | { |
| | | new CustomLabelItem(){ Name="状态",Value=HydroLinkStatusHelper.GetStatusName(pump.LinkStatus),Unit=string.Empty}, |
| | | new CustomLabelItem(){ Name="频率",Value=hz.ToString(),Unit=string.Empty}, |
| | | new CustomLabelItem(){ Name="流量",Value=Math.Round(calcuPump.Flow,1).ToString(),Unit="m³/h"}, |
| | | new CustomLabelItem(){ Name="进口压力",Value=Math.Round(calcuPumpStart.Head,4).ToString(),Unit="m"}, |
| | | new CustomLabelItem(){ Name="出口压力",Value=Math.Round(calcuPumpEnd.Head,4).ToString(),Unit="m"}, |
| | | }; |
| | | obj.Add(pumpCustomLabel); |
| | | } |
| | | else if (x is Yw.Model.HydroEmitterInfo emitter) |
| | | { |
| | | var calcuEmitter = calcuResult.NodeList.Find(x => x.Id == emitter.Code); |
| | | var emitterCustomLabel = new CustomLabel(); |
| | | emitterCustomLabel.Id = emitter.Code; |
| | | emitterCustomLabel.Data = new List<CustomLabelItem>() |
| | | { |
| | | new CustomLabelItem(){ Name="流量",Value=Math.Round(calcuEmitter.Demand,1).ToString(),Unit="m³/h"}, |
| | | new CustomLabelItem(){ Name="压力",Value=Math.Round(calcuEmitter.Head,4).ToString(),Unit="m"} |
| | | }; |
| | | obj.Add(emitterCustomLabel); |
| | | } |
| | | }); |
| | | if (_bimfaceInteropContainer == null) |
| | | { |
| | | return; |
| | | } |
| | | await _bimfaceInteropContainer.SetCustomLabels(obj); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 标注 |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |