chenn
2025-03-28 9dba1b6adc0bbb4aa8cc531f4e6d822bf1a56be3
WinFrmUI/DPumpHydr.WinFrmUI.Volute/¶ÏÃæÉè¼Æ/ctrlSectionBundleInfo.cs
@@ -171,25 +171,31 @@
        ViewModel.GeomBaseInfo _geomBaseInfo = null;
        public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
        {
            _sectionBundleInfo= sectionBundle_info;
            _sectionBundleInfo = sectionBundle_info;
        }
        /// <summary>
        /// æ˜¾ç¤ºç•Œé¢
        /// </summary>
        /// <param name="base_info">基本参数</param>
        /// <param name="geom_info">基圆参数</param>
        /// <param name="step_direction">前进/后退</param>
        /// <param name="isRefreshModel">是否需要覆盖断面参数</param>
        public void ShowPage(
            ViewModel.HdrBaseInfo base_info,
            ViewModel.GeomBaseInfo geom_info,
            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = true)
            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = false)
        {
            if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.后退)
            {
                return;
            }
            if(_hdrBaseInfo == null && _geomBaseInfo == null)
            if (_hdrBaseInfo == null && _geomBaseInfo == null)
            {
                _hdrBaseInfo = base_info;
                _geomBaseInfo = geom_info;
            }
            if (isRefreshModel )
            if (!isRefreshModel)
            {
                return;
            }
@@ -207,7 +213,7 @@
            else
            {
                if (Math.Abs(_sectionBundleInfo.BaseWidth - _geomBaseInfo.B3) < 1 &&
                    Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1 )
                    Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1)
                {
                    _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
@@ -245,8 +251,6 @@
            }
            RefreshAllSectPara(_sectionBundleInfo);
            RefreshShape(_sectionBundleInfo);
        }
@@ -370,13 +374,13 @@
                error = "请输入必填项!";
                isOk = false;
            }
            if (string.IsNullOrEmpty(skyTextBox断面y18.Text) || (!RBtn矩形.Checked && double.Parse(skyTextBox断面y18.Text) == 0)|| double.Parse(skyTextBox断面y18.Text) < 0)
            if (string.IsNullOrEmpty(skyTextBox断面y18.Text) || (!RBtn矩形.Checked && double.Parse(skyTextBox断面y18.Text) == 0) || double.Parse(skyTextBox断面y18.Text) < 0)
            {
                error = "请输入必填项!";
                isOk = false;
            }
            if (string.IsNullOrEmpty(skyTextBox断面r18.Text) || (!RBtn矩形.Checked && double.Parse(skyTextBox断面r18.Text) == 0)|| double.Parse(skyTextBox断面y18.Text) < 0)
            if (string.IsNullOrEmpty(skyTextBox断面r18.Text) || (!RBtn矩形.Checked && double.Parse(skyTextBox断面r18.Text) == 0) || double.Parse(skyTextBox断面y18.Text) < 0)
            {
                error = "请输入必填项!";
                isOk = false;
@@ -463,7 +467,22 @@
                int index = Convert.ToInt32(lastChar);
                if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text))
                {
                    result = _sectionBundleInfo.GaMa_Left[index];
                    skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
                }else if(result>45)
                {
                    MessageBox.Show("请输入小于45度的角度");
                    skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
                }
                else
                {
                    //var initialR = _sectionBundleInfo.CalInitialR(_hdrBaseInfo, _geomBaseInfo);
                    var height = _sectionBundleInfo.CalcHeight(_geomBaseInfo, index, result, _sectionBundleInfo.R_Left[index]);
                    var R = _sectionBundleInfo.CheckChamferR(height, index, result, _sectionBundleInfo.R_Left[index]);
                    SkyTextBox controlh1 = this.Controls.Find($"skyTextBox断面H1{index}", true).FirstOrDefault() as SkyTextBox;
                    SkyTextBox controlr1 = this.Controls.Find($"skyTextBox断面r1{index}", true).FirstOrDefault() as SkyTextBox;
                    controlh1.Text = height.ToString();
                    controlr1.Text = R.ToString();
                }
            }
        }
@@ -478,7 +497,7 @@
                {
                    skytextBox.Text = _sectionBundleInfo.GaMa_Right[index].ToString();
                }
                if (string.IsNullOrEmpty(skytextBox.Text))
                if (string.IsNullOrEmpty(skytextBox.Text) || Convert.ToDouble(skytextBox.Text) == 0)
                {
                    MessageBox.Show("r不合理!请重新输入");
                }
@@ -507,7 +526,7 @@
            SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBox断面y1{index}", true).FirstOrDefault() as SkyTextBox;
            SkyTextBox controlh1 = this.Controls.Find($"skyTextBox断面H1{index}", true).FirstOrDefault() as SkyTextBox;
            if (string.IsNullOrEmpty(controlr1.Text))
                return true ;
                return true;
            if (string.IsNullOrEmpty(controlGaMa1.Text))
                return true;
            if (string.IsNullOrEmpty(controlh1.Text))
@@ -515,7 +534,7 @@
            if (RBtn矩形.Checked)
            {
                if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1|| _sectionBundleInfo.BaseWidth- (Convert.ToDouble(controlr1.Text)*2) < 1)
                if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1 || _sectionBundleInfo.BaseWidth - (Convert.ToDouble(controlr1.Text) * 2) < 1)
                {
                    controlr1.BackColor = Color.OrangeRed;
                    MessageBox.Show("r不合理!请重新输入");
@@ -534,7 +553,7 @@
                var c = _sectionBundleInfo.R_out / 1000;
                var TopWidth = _sectionBundleInfo.BaseWidth + (2 * x);
                var Slash = (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) - (Math.Sin(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text))) / Math.Cos(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180);
                if ((!RBtn矩形.Checked && (TopWidth < c || Slash < c)) || Convert.ToDouble(controlr1.Text) == 0)
                if ((!RBtn矩形.Checked && (TopWidth < c || Slash < c - 0.1))) //
                {
                    controlr1.BackColor = Color.OrangeRed;
                    MessageBox.Show("r不合理!请重新输入");
@@ -544,7 +563,7 @@
                    controlr1.BackColor = Color.White;
                }
            }
            return isreasonable;
        }
@@ -703,14 +722,14 @@
                SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
                controly1.Enabled = true;
                if (controly1 != null)
                    controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString();
                if (controly2 != null)
                    controly2.Text = Math.Round( _sectionBundleInfo.R_Left[sect_index],1).ToString();
                if (control断面面积 != null)
                    control断面面积.Text = Math.Round(_sectionBundleInfo.Area[sect_index], 1).ToString();
                if (controH1 != null)
                    controH1.Text = Math.Round(_sectionBundleInfo.H[sect_index], 1).ToString();
                if (controly2 != null)
                    controly2.Text = Math.Round(_sectionBundleInfo.R_Left[sect_index], 1).ToString();
                if (controly1 != null)
                    controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString();
            }
        }
@@ -757,7 +776,7 @@
                        SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
                        controly1.Enabled = false;
                    }
                        return;
                    return;
                }
                //for (var sect_index = 1; sect_index <= 8; sect_index++)
                //{
@@ -793,5 +812,32 @@
                RefreshShape(Rec_sectionBundleInfo);
            }
        }
        private void skyTextBox断面H11_TextChanged(object sender, EventArgs e)
        {
            if (sender is SkyTextBox skytextBox)
            {
                string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString();
                int index = Convert.ToInt32(lastChar);
                if (!double.TryParse(skytextBox.Text, out double resultH) && !string.IsNullOrEmpty(skytextBox.Text))
                {
                    resultH = _sectionBundleInfo.H[index];
                    skytextBox.Text = _sectionBundleInfo.H[index].ToString();
                }
                else
                {
                    SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBox断面y1{index}", true).FirstOrDefault() as SkyTextBox;
                    SkyTextBox controlr1 = this.Controls.Find($"skyTextBox断面r1{index}", true).FirstOrDefault() as SkyTextBox;
                    if (!double.TryParse(controlGaMa1.Text, out double resultGame) && !string.IsNullOrEmpty(controlGaMa1.Text))
                    {
                        resultH = _sectionBundleInfo.GaMa_Left[index];
                    }
                    var R = _sectionBundleInfo.HCalR(_geomBaseInfo, index, resultGame, resultH);
                    R = _sectionBundleInfo.CheckChamferR(resultH, index, resultH, R);
                    skytextBox.Text = resultH.ToString();
                    controlr1.Text = R.ToString();
                }
            }
        }
    }
}