From 34fe00834737d35eedfeb41361c4d85ab0e0f10b Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期五, 25 十月 2024 17:02:06 +0800
Subject: [PATCH] 增加蜗壳参数导出功能、修改部分界面代码

---
 WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_StepInfo.cs |  151 +++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 123 insertions(+), 28 deletions(-)

diff --git a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_StepInfo.cs b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_StepInfo.cs
index 3103fab..ff69fac 100644
--- a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_StepInfo.cs
+++ b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_StepInfo.cs
@@ -6,6 +6,7 @@
 using System.Text;
 using System.Linq;
 using DPumpHydr.WinFrmUI.Volute.ViewModel;
+using System.Security.Policy;
 
 namespace DPumpHydr.WinFrmUI.Volute
 {
@@ -57,18 +58,27 @@
         ViewModel.HdrBaseInfo _hdrBaseInfo = null;
         ViewModel.GeomBaseInfo _geomBaseInfo = null;
         ViewModel.SectionBaseInfo _sectionBaseInfo = null;
+        ViewModel.SectionShapePara _sectionShapePara = null;
+        DPumpHydr.WinFrmUI.Volute.TreeStepNode next_step = null;
+        int index;
         /// <summary>
         /// 涓嬩竴姝ユ牳蹇�
         /// </summary>
         /// <returns></returns>
         private bool GoNextStepCore()
         {
-            var next_step = (from x in _allStepNodes
-                             where x.ID > _currentStepID
-                             orderby x.ID
-                             select x).FirstOrDefault();
-            if (next_step == null)
-                return false;
+            if (_currentStepID != Step_ID_Section18_Dim || index>8 || index<=1)
+            {
+                index = 9;
+                next_step = (from x in _allStepNodes
+                                 where x.ID > _currentStepID
+                                 orderby x.ID
+                                 select x).FirstOrDefault();
+                if (next_step == null)
+                    return false;
+            }
+            
+            //绗竴姝ヨ繘琛屼笅涓�姝ョ偣鍑�
             if(_currentStepID == Step_ID_Hdr_Base_Info)
             {
                 string error_info;
@@ -84,8 +94,9 @@
                 {
                     _geomBaseInfo = new ViewModel.GeomBaseInfo();
                 }
-                _geomBaseInfo.Calc(hdrBaseInfo);
+                _geomBaseInfo.Calc(_hdrBaseInfo);
             }
+            //绗簩姝ヨ繘琛屼笅涓�姝ョ偣鍑�
             if (_currentStepID == Step_ID_Geom_Base_Info)
             {
                 string error_info;
@@ -102,43 +113,103 @@
                 }
                 _sectionBaseInfo.CalcV3(_hdrBaseInfo, _geomBaseInfo);
                 _sectionBaseInfo.CalcArea(_hdrBaseInfo, _geomBaseInfo, _sectionBaseInfo.V3);
-                _sectionBaseInfo.IntialShapeType(_hdrBaseInfo, _geomBaseInfo, eSectionShapeType.瀵圭О);
+                _sectionBaseInfo.IntialShapeType(_hdrBaseInfo, _geomBaseInfo, _sectionBaseInfo.ShapeType);
             }
-            //if (_currentStepID == Step_ID_Section18_Base)
-            //{
-            //    string error_info;
-            //    var geomBaseInfo = _ctrlGeomBaseInfo.GetBindingData(out error_info);
-            //    if (geomBaseInfo == null)
-            //    {
-            //        MessageBox.Show(error_info);
-            //        return false;
-            //    }
-            //    _geomBaseInfo = geomBaseInfo;
-            //}
+            //绗笁姝ヨ繘琛屼笅涓�姝ョ偣鍑�
+            if (_currentStepID == Step_ID_Section18_Base)
+            {
+                
+                string error_info;
+                var sectionBaseInfo = _ctrlSectionBaseInfo.GetBindingData(out error_info);
+                if (sectionBaseInfo == null)
+                {
+                    MessageBox.Show(error_info);
+                    return false;
+                }
+                _sectionBaseInfo = sectionBaseInfo;
+                _sectionBaseInfo.InitialAllParameters(_hdrBaseInfo, _geomBaseInfo);
+                index--;
+                if (_sectionShapePara == null)
+                {
+                    _sectionShapePara = new ViewModel.SectionShapePara();
+                }
+                _sectionShapePara.Initialparameters(index, _sectionBaseInfo);
+            }
+            //1-8鏂潰杩涜涓嬩竴姝ョ偣鍑�
+            if (_currentStepID == Step_ID_Section18_Dim)
+            {
+                string error_info;
+                var sectionShapeInfo18 = _ctrlSectionShapeInfo18.GetBindingData(out error_info);
+                if (sectionShapeInfo18 == null)
+                {
+                    MessageBox.Show(error_info);
+                    return false;
+                }
+                _sectionShapePara = sectionShapeInfo18;
+                _sectionShapePara.CalcHeightByArea(_sectionBaseInfo.ShapeType);
+                _sectionBaseInfo.EditSingleShape(_sectionShapePara, index);
+                if(index != 9)
+                {
+                    index--;
+                }
+                _sectionShapePara.Initialparameters(index, _sectionBaseInfo);
+            }
             SetParasCtrl(next_step.ID);
  
             return true;
         }
+
         /// <summary>
         /// 涓婁竴姝ユ牳蹇�
         /// </summary>
         /// <returns></returns>
         private bool GoPrevStepCore()
-        {
+        {   
+            //bool IsChanges = true;
+            //if (_currentStepID == Step_ID_Section18_Base && _ctrlSectionBaseInfo.IsParameterChange())
+            //{
+            //    IsChanges = false;
+            //}
+            //if(IsChanges)
+            //{
+            //    DialogResult result = MessageBox.Show("宸茬粡淇敼杩囩殑鏁版嵁闇�瑕佷繚瀛樺悧锛�", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
+            //    if (result == DialogResult.OK)
+            //    {
+            //        string error_info = "";
+            //        var hdrBaseInfo = _ctrlSectionBaseInfo.GetBindingData(out error_info);
+            //        if (hdrBaseInfo == null)
+            //        {
+            //            MessageBox.Show(error_info);
+            //            return false;
+            //        }
+            //    }
+            //}
             if (_currentStepID == Step_ID_Hdr_Base_Info)
                 return false;
-
+            if(_currentStepID == Step_ID_Section18_Dim && index >=1 &&index < 8)
+            {
+                index++;
+                _sectionShapePara.Initialparameters(index, _sectionBaseInfo);
+                SetParasCtrl(Step_ID_Section18_Dim);
+                return true;
+            }
+            if(_currentStepID == Step_ID_Outflow_Style)
+            {
+                index = 1;
+                _sectionShapePara.Initialparameters(index, _sectionBaseInfo);
+            }
             var prev_step = (from x in _allStepNodes
-                             where x.ID < _currentStepID
-                             orderby x.ID
-                             select x).LastOrDefault();
+                                where x.ID < _currentStepID
+                                orderby x.ID
+                                select x).LastOrDefault();
             if (prev_step == null)
                 return false;
 
-            SetParasCtrl(prev_step.ID);
-   
+                SetParasCtrl(prev_step.ID);
+
             return true;
         }
+
         /// <summary>
         /// 鐢熸垚绗嚑姝ユ帶浠�
         /// </summary>
@@ -182,6 +253,7 @@
                 this.panelParas.Controls.Add(_ctrlSectionBaseInfo);
                 _ctrlSectionBaseInfo.SetBindingData(_sectionBaseInfo);
             }
+            //绗洓姝�
             if (step_id == Step_ID_Section18_Dim)
             {
                 if (_ctrlSectionShapeInfo18 == null)
@@ -190,9 +262,9 @@
                     _ctrlSectionShapeInfo18.Name = "ctrlSectionShapeInfo18";
                     _ctrlSectionShapeInfo18.Dock = DockStyle.Right;
                 }
-                   
                 this.panelParas.Controls.Clear();
                 this.panelParas.Controls.Add(_ctrlSectionShapeInfo18);
+                _ctrlSectionShapeInfo18.SetBindingData(_sectionShapePara);
             }
 
 
@@ -227,8 +299,31 @@
 
             this._currentStepID = step_id;
         }
-     
         
+        /// <summary>
+        /// 铚楀3鍙傛暟瀵煎嚭
+        /// </summary>
+        public void VoluteDeriveArgument()
+        {
+            if(_sectionBaseInfo == null )
+            {
+                MessageBox.Show("鎮ㄨ繕娌℃湁瀹屾垚瀹氫箟鍙傛暟锛佽瀹氫箟瀹屾垚鍚庡湪杩涜瀵煎嚭锛侊紙鑷冲皯瀹屾垚绗笁姝ワ級");
+                return;
+            }
+            if(_currentStepID <= 21)
+            {
+                DialogResult result = MessageBox.Show("纭畾涓嶈繘琛屽悗缁柇闈㈠弬鏁扮殑璋冩暣锛屼娇鐢ㄥ垵濮嬭绠楀悗鐨勫弬鏁板悧锛�","鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
+                if (result == DialogResult.Cancel)
+                {
+                    return;
+                }
+            }
+            ViewModel.SectionShapePara VoluteArgument = new ViewModel.SectionShapePara();
+            string json = VoluteArgument.DeriveArgument(_sectionBaseInfo);
+            string filePath = Path.Combine(@"C:\Users\THL\Desktop", $"铚楀3鍙傛暟.json");
+            File.WriteAllText(filePath, json);
+        }
+
         #region 鍒濆鍖栨楠ゅ垪琛�
 
         /// <summary>

--
Gitblit v1.9.3