yangyin
2025-03-23 977ef9de17c3b83727fa92fe8178ab6486425ada
WinFrmUI/DPumpHydr.WinFrmUI.Volute/¶ÏÃæÉè¼Æ/ctrlSectionBundleInfo.cs
@@ -171,7 +171,7 @@
        ViewModel.GeomBaseInfo _geomBaseInfo = null;
        public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
        {
            _sectionBundleInfo= sectionBundle_info;
            _sectionBundleInfo = sectionBundle_info;
        }
@@ -184,12 +184,12 @@
            {
                return;
            }
            if(_hdrBaseInfo == null && _geomBaseInfo == null)
            if (_hdrBaseInfo == null && _geomBaseInfo == null)
            {
                _hdrBaseInfo = base_info;
                _geomBaseInfo = geom_info;
            }
            if (isRefreshModel )
            if (isRefreshModel)
            {
                return;
            }
@@ -207,7 +207,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;
@@ -246,7 +246,7 @@
            RefreshAllSectPara(_sectionBundleInfo);
            RefreshShape(_sectionBundleInfo);
        }
@@ -370,13 +370,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 +463,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, initialR[index]);
                    var R = _sectionBundleInfo.CheckChamferR(height, index, result, initialR[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();
                }
            }
        }
@@ -507,7 +522,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 +530,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不合理!请重新输入");
@@ -544,7 +559,7 @@
                    controlr1.BackColor = Color.White;
                }
            }
            return isreasonable;
        }
@@ -706,7 +721,7 @@
                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();
                    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)
@@ -757,7 +772,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 +808,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();
                }
            }
        }
    }
}