Shuxia Ning
2024-12-17 907a1579fecf2c160852cf99b3ea77c08eb481cc
WinFrmUI/Yw.WinFrmUI.Hydro.Core/04-viewmodel/03-node/03-junction/00-core/HydroJunctionViewModel.cs
@@ -3,7 +3,7 @@
    /// <summary>
    /// 连接节点
    /// </summary>
    public class HydroJunctionViewModel : HydroNodeViewModel
    public class HydroJunctionViewModel : HydroNodeViewModel, IHydroCalcuJunctionResult
    {
        /// <summary>
        /// 
@@ -23,8 +23,6 @@
            this.UpdatePropStatus(nameof(this.Demand), rhs, nameof(rhs.Demand));
            this.DemandPattern = rhs.DemandPattern;
            this.UpdatePropStatus(nameof(this.DemandPattern), rhs, nameof(rhs.DemandPattern));
            this.Vmo = rhs;
        }
@@ -66,16 +64,33 @@
        [Category("数据")]
        [DisplayName("需水模式")]
        [Display(Name = "需水模式")]
        [IsHydroPatternPro(HydroPattern.Demand)]
        [HydroPatternPro(HydroPattern.Demand)]
        [PropertyOrder(2004)]
        [Browsable(false)]
        public virtual string DemandPattern { get; set; }
        /// <summary>
        /// 压力
        /// </summary>
        [Category("计算结果")]
        [DisplayName("压力")]
        [Display(Name = "压力(m)")]
        [DisplayUnit("m")]
        [HydroCalcuPro]
        [PropertyOrder(11002)]
        [ShowEditor(false)]
        [Browsable(true)]
        public virtual double? CalcuPr { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Browsable(false)]
        public new Yw.Model.HydroJunctionInfo Vmo { get; set; }
        public new Yw.Model.HydroJunctionInfo Vmo
        {
            get { return _vmo as Yw.Model.HydroJunctionInfo; }
            set { _vmo = value; }
        }
        /// <summary>
        /// 
@@ -93,7 +108,33 @@
            this.UpdatePropStatus(nameof(this.DemandPattern), this.Vmo, nameof(this.Vmo.DemandPattern));
        }
        /// <summary>
        ///
        /// </summary>
        public override void UpdateVmoProperty()
        {
            base.UpdateVmoProperty();
            this.Vmo.Elev = this.Elev;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Elev), this, nameof(this.Elev));
            this.Vmo.MinorLoss = this.MinorLoss;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.MinorLoss), this, nameof(this.MinorLoss));
            this.Vmo.Demand = this.Demand;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Demand), this, nameof(this.Demand));
            this.Vmo.DemandPattern = this.DemandPattern;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.DemandPattern), this, nameof(this.DemandPattern));
        }
        /// <summary>
        /// 更新计算属性
        /// </summary>
        public override void UpdateCalcuProperty(HydroCalcuVisualResult rhs)
        {
            base.UpdateCalcuProperty(rhs);
            if (rhs is HydroCalcuJunctionResult calcuJunctionResult)
            {
                this.CalcuPr = calcuJunctionResult.CalcuPr.HasValue ? Math.Round(calcuJunctionResult.CalcuPr.Value, 2) : null;
            }
        }
    }