From 330002911a64ea58d6834b64228870228eb75391 Mon Sep 17 00:00:00 2001
From: qin <a@163.com>
Date: 星期四, 20 三月 2025 16:12:33 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0

---
 WinFrmUI/IBox.WinFrmUI/Form/IBoxFormControll.cs |  465 ++++++++++++++++++++++++---------------------------------
 1 files changed, 195 insertions(+), 270 deletions(-)

diff --git a/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormControll.cs b/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormControll.cs
index ddca6a9..da16b96 100644
--- a/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormControll.cs
+++ b/WinFrmUI/IBox.WinFrmUI/Form/IBoxFormControll.cs
@@ -1,8 +1,11 @@
 锘縰sing PBS.Model;
+using PBS.Vmo;
 using System.Data;
 using System.IO;
 using Yw;
 using Yw.WinFrmUI;
+using Yw.Untity;
+using Yw.Service;
 
 namespace IBox.WinFrmUI
 {
@@ -38,8 +41,32 @@
         public event EventHandler<string> SendData;
         private void SendText(string content)
         {
-            //BluetoothHelper.GetInstance().SendData(content);
-            SendData?.Invoke(null, content);
+            if (SendData != null)
+            {
+                SendData?.Invoke(null, content);
+
+            }
+            else
+            {
+                if (IBoxHelper.Ping())
+                {
+                    var smsg = content.Split(new string[] { IBoxHelper.paramCode }, StringSplitOptions.RemoveEmptyEntries);
+                    if (smsg.Length < 2)
+                    {
+                        return;
+                    }
+                    switch (smsg[0].Trim())
+                    {
+                        case IBoxHelper.datadownloadCode:
+                            IBoxHelper.HttpPost(content);
+                            break;
+                    }
+                }
+                else
+                {
+                    MessageBoxHelper.ShowWarning("缃戠粶杩炴帴澶辫触锛岃妫�鏌ョ綉缁�");
+                }
+            }
         }
 
         private void SetOrder(string order)
@@ -57,274 +84,199 @@
                     break;
             }
         }
-        private Model.Facilities _facilities = null;
-        private BLL.EquipmentEChartMapping _bll = new BLL.EquipmentEChartMapping();
-        private BLL.EChart _bllEChart = new BLL.EChart();
-        private BLL.Equipment _bllEquipment = new BLL.Equipment();
-        private Model.Kit _kit = null;
-        private BLL.EquipmentTypeEChartMapping _equipmentTypeEChartMappingBLL = new BLL.EquipmentTypeEChartMapping();
-        public IBoxFormControll(Facility facilities)
+        private FacilityVmo _facilities = null;
+        private IBoxControllViewModel boxControllViewModel = null;
+        public IBoxFormControll(IBoxControllViewModel ibox)
         {
             this.PageTitle.Caption = "鏅鸿兘鎺у埗";
-            _facilities = facilities;
+            _facilities = ibox.facilities;
+            boxControllViewModel = ibox;
             InitializeComponent();
-            this.treeListCtrl1.FocusedChangedEvent += EquipmentTreeListCtrl1_FocusedChangedEvent;
+            //this.treeListCtrl1.FocusedChangedEvent += EquipmentTreeListCtrl1_FocusedChangedEvent;
             InitDataSource();
         }
-        private string filePath = "Data\\AnalyData_{0}.json";
+        //private string filePath = "Data\\AnalyData_{0}.json";
         private void InitDataSource()
         {
-            var f = new BLL.Facilities().GetByID(this._facilities.ID);
-            if (f != null)
-            {
-                var kid = long.Parse(f.CompletePlant);
-                var kit = new BLL.Kit().GetByID(kid);
-                _kit = kit;
-                this.treeListCtrl1.SetBindingData(kid);
-            }
-            this._SelectedBuild = new Basic.Build()
+            var f = _facilities;
+            this._SelectedBuild = new Build()
             {
                 factoryName = f.Name,
-                绯荤粺鏈�澶ф祦閲� = f.WaterHeight,
+                绯荤粺鏈�澶ф祦閲� = f.MaxWaterDemand.Value,
                 Type = 浜屼緵鍒嗗尯Type.鍔犲帇渚涙按,
                 ID = f.ID.ToString(),
-                鐢ㄦ埛鍘嬪姏闇�姹� = int.Parse(f.WaterPressure.ToString()),
+                鐢ㄦ埛鍘嬪姏闇�姹� = int.Parse(f.TerminalPressure.ToString()),
                 灞傛暟 = double.Parse(f.Floor.ToString()),
                 灞傞珮 = double.Parse(f.FloorHeight.ToString()),
-                姣忓眰鎴锋暟 = double.Parse(f.FloorHouseHolds.ToString())
             };
-            ShowChart();
+            //ShowChart();
         }
 
-        private void ShowChart()
-        {
-            var file = string.Format(filePath, _facilities.ID.ToString());
-            var path = Path.Combine(Directory.GetCurrentDirectory(), file);
-            if (!File.Exists(path))
-            {
-                MessageBoxHelper.ShowInfo("璇峰厛杩涜绯荤粺鏇茬嚎鎿嶄綔!");
-                return;
-            }
-            else
-            {
-                SetResult(path);
-            }
-        }
+        //private void ShowChart()
+        //{
+        //    var file = string.Format(filePath, _facilities.ID.ToString());
+        //    var path = Path.Combine(Directory.GetCurrentDirectory(), file);
+        //    if (!File.Exists(path))
+        //    {
+        //        MessageBoxHelper.ShowInfo("璇峰厛杩涜绯荤粺鏇茬嚎鎿嶄綔!");
+        //        return;
+        //    }
+        //    else
+        //    {
+        //        SetResult(path);
+        //    }
+        //}
 
-        private void SetResult(string path)
-        {
-            var content = new Eventech.Common.FileHelper().ReadFile(path);
-            var result = JsonHelper.Json2Object<List<Result>>(content);
-            AddPoints(result);
-            ShowPressPoints();
-        }
-        private List<Result> _res;
+        //private void SetResult(string path)
+        //{
+        //    var content =  FileHelper.ReadFile(path);
+        //    var result = JsonHelper.Json2Object<List<Result>>(content);
+        //    AddPoints(result);
+        //    ShowPressPoints();
+        //}
+        //private List<Result> _res;
         private Build _SelectedBuild;
-        public void AddPoints(List<Result> res)
-        {
-            _res = res;
-            List<PointF> nums = res.Select(o => new PointF((float)o.Demand, (float)o.ObjFunctionValue)).ToList();
-            var chartDatas = nums.Select(p => new PointF(p.X, p.Y + _SelectedBuild.鐢ㄦ埛鍘嬪姏闇�姹� + (float)_facilities.MaxHeight)).ToList();
-            if (chartDatas == null || chartDatas.Count == 0) return;
+        //public void AddPoints(List<Result> res)
+        //{
+        //    _res = res;
+        //    List<PointF> nums = res.Select(o => new PointF((float)o.Demand, (float)o.ObjFunctionValue)).ToList();
+        //    var chartDatas = nums.Select(p => new PointF(p.X, p.Y + _SelectedBuild.鐢ㄦ埛鍘嬪姏闇�姹� + (float)_facilities.MaxHeight)).ToList();
+        //    if (chartDatas == null || chartDatas.Count == 0) return;
 
-            // 璁$畻澶氶」寮忓湪鐐� x 澶勭殑鍙栧��
-            // 璁$畻鎷熷悎鏇茬嚎涓婄殑鐐�
-            var curve = new CurveFitHelper(chartDatas, 2);
-            //List<PointF> fitPoints = curve.GetFitCurve(100);
-            List<List<PointF>> confidencePoints = curve.GetConfidenceCurve(100);
+        //    // 璁$畻澶氶」寮忓湪鐐� x 澶勭殑鍙栧��
+        //    // 璁$畻鎷熷悎鏇茬嚎涓婄殑鐐�
+        //    var curve = new CurveFitHelper(chartDatas, 2);
+        //    //List<PointF> fitPoints = curve.GetFitCurve(100);
+        //    List<List<PointF>> confidencePoints = curve.GetConfidenceCurve(100);
 
-            //_SelectedPump.娴侀噺鍘嬮檷骞冲潎.Data = fitPoints;
-            //_SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data = chartDatas;
-            _SelectedBuild.Datasets.Clear();
-            _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data = chartDatas;
-            _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.Data = confidencePoints[0];
-            _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.Data = confidencePoints[1];
-        }
-        public void ShowPressPoints()
-        {
-            this.chart1.ChartAreas.Clear();
-            this.chart1.ChartAreas.Add(new ChartArea());
-            chart1.Series.Clear();
-            chart1.Series.Add("鏁版嵁");
-            chart1.Series.Add("骞冲潎");
-            chart1.Series["骞冲潎"].ChartType = SeriesChartType.Line;
-            chart1.Series["骞冲潎"].BorderWidth = 2;
-            chart1.Series.Add("涓婇檺");
-            chart1.Series["涓婇檺"].ChartType = SeriesChartType.Line;
-            chart1.Series["涓婇檺"].BorderWidth = 2;
-            chart1.Series.Add("涓嬮檺");
-            chart1.Series["涓嬮檺"].ChartType = SeriesChartType.Line;
-            chart1.Series["涓嬮檺"].BorderWidth = 2;
-            chart1.Series.Add("娉靛嚭鍙i潤鍘嬬嚎");
-            chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].ChartType = SeriesChartType.Line;
-            chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].BorderWidth = 2;
-            chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].Color = Color.Green;
+        //    //_SelectedPump.娴侀噺鍘嬮檷骞冲潎.Data = fitPoints;
+        //    //_SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data = chartDatas;
+        //    _SelectedBuild.Datasets.Clear();
+        //    _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data = chartDatas;
+        //    _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.Data = confidencePoints[0];
+        //    _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.Data = confidencePoints[1];
+        //}
+        //public void ShowPressPoints()
+        //{
+        //    this.chart1.ChartAreas.Clear();
+        //    this.chart1.ChartAreas.Add(new ChartArea());
+        //    chart1.Series.Clear();
+        //    chart1.Series.Add("鏁版嵁");
+        //    chart1.Series.Add("骞冲潎");
+        //    chart1.Series["骞冲潎"].ChartType = SeriesChartType.Line;
+        //    chart1.Series["骞冲潎"].BorderWidth = 2;
+        //    chart1.Series.Add("涓婇檺");
+        //    chart1.Series["涓婇檺"].ChartType = SeriesChartType.Line;
+        //    chart1.Series["涓婇檺"].BorderWidth = 2;
+        //    chart1.Series.Add("涓嬮檺");
+        //    chart1.Series["涓嬮檺"].ChartType = SeriesChartType.Line;
+        //    chart1.Series["涓嬮檺"].BorderWidth = 2;
+        //    chart1.Series.Add("娉靛嚭鍙i潤鍘嬬嚎");
+        //    chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].ChartType = SeriesChartType.Line;
+        //    chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].BorderWidth = 2;
+        //    chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"].Color = Color.Green;
 
-            chart1.Series.Add("鏈�楂樻ゼ灞傛爣楂�");
-            chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].ChartType = SeriesChartType.Line;
-            chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].BorderWidth = 2;
-            chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].Color = Color.Yellow;
-            if (chart1.ChartAreas.Count > 0)
-            {
-                chart1.ChartAreas[0].AxisY.Enabled = AxisEnabled.True;
-                //chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True;
-                chart1.ChartAreas[0].AxisX.Enabled = AxisEnabled.True;
-                chart1.ChartAreas[0].AxisX.LabelStyle.Format = "0";
-                chart1.ChartAreas[0].AxisY.LabelStyle.Format = "0";
-                chart1.ChartAreas[0].AxisX.Title = "绯荤粺娴侀噺(m鲁/h)";
-                chart1.ChartAreas[0].AxisY.Title = "娉靛悗鍘嬪姏(m)";
-                chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.False;
-            }
-            //chart1.ChartAreas[0].AxisX.Minimum = double.NaN;
+        //    chart1.Series.Add("鏈�楂樻ゼ灞傛爣楂�");
+        //    chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].ChartType = SeriesChartType.Line;
+        //    chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].BorderWidth = 2;
+        //    chart1.Series["鏈�楂樻ゼ灞傛爣楂�"].Color = Color.Yellow;
+        //    if (chart1.ChartAreas.Count > 0)
+        //    {
+        //        chart1.ChartAreas[0].AxisY.Enabled = AxisEnabled.True;
+        //        //chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True;
+        //        chart1.ChartAreas[0].AxisX.Enabled = AxisEnabled.True;
+        //        chart1.ChartAreas[0].AxisX.LabelStyle.Format = "0";
+        //        chart1.ChartAreas[0].AxisY.LabelStyle.Format = "0";
+        //        chart1.ChartAreas[0].AxisX.Title = "绯荤粺娴侀噺(m鲁/h)";
+        //        chart1.ChartAreas[0].AxisY.Title = "娉靛悗鍘嬪姏(m)";
+        //        chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.False;
+        //    }
+        //    //chart1.ChartAreas[0].AxisX.Minimum = double.NaN;
 
-            //chart1.ChartAreas[0].AxisY.Minimum = double.NaN;
-            var nums = _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data;
-            if (nums.Count == 0) return;
-            _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.CurveFit();
-            var fitPoints = _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.FittedCurve;
-            _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.CurveFit();
-            _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.CurveFit();
-            List<List<PointF>> confidencePoints = new List<List<PointF>>() { _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve, _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.FittedCurve };
-            var chartDatas = nums.ToList();
-            double yMin = double.MaxValue;
-            double yMax = double.MinValue;
-            float xMin = float.MaxValue;
-            float xMax = float.MinValue;
-            if (nums == null || nums.Count == 0) return;
-            this.chart1.Series[0].ChartType = SeriesChartType.Point;
-            //double x = double.Parse(textBox_current_TotalDemand.Text);
-            float x_Avg = 0;
-            float x_Sum = 0;
-            nums.ForEach(y =>
-            {
-                this.chart1.Series["鏁版嵁"].Points.AddXY(y.X, y.Y);
-                x_Sum += (y.X);
-                if (yMin > y.Y) yMin = y.Y;
-                if (yMax < y.Y) yMax = y.Y;
-                if (xMin > y.X) xMin = y.X;
-                if (xMax < y.X) xMax = y.X;
-            });
-            x_Avg = x_Sum / nums.Count;
+        //    //chart1.ChartAreas[0].AxisY.Minimum = double.NaN;
+        //    var nums = _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.Data;
+        //    if (nums.Count == 0) return;
+        //    _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.CurveFit();
+        //    var fitPoints = _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.FittedCurve;
+        //    _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.CurveFit();
+        //    _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.CurveFit();
+        //    List<List<PointF>> confidencePoints = new List<List<PointF>>() { _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve, _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.FittedCurve };
+        //    var chartDatas = nums.ToList();
+        //    double yMin = double.MaxValue;
+        //    double yMax = double.MinValue;
+        //    float xMin = float.MaxValue;
+        //    float xMax = float.MinValue;
+        //    if (nums == null || nums.Count == 0) return;
+        //    //this.chart1.Series[0].ChartType = SeriesChartType.Point;
+        //    //double x = double.Parse(textBox_current_TotalDemand.Text);
+        //    float x_Avg = 0;
+        //    float x_Sum = 0;
+        //    nums.ForEach(y =>
+        //    {
+        //        this.chart1.Series["鏁版嵁"].Points.AddXY(y.X, y.Y);
+        //        x_Sum += (y.X);
+        //        if (yMin > y.Y) yMin = y.Y;
+        //        if (yMax < y.Y) yMax = y.Y;
+        //        if (xMin > y.X) xMin = y.X;
+        //        if (xMax < y.X) xMax = y.X;
+        //    });
+        //    x_Avg = x_Sum / nums.Count;
 
-            var dataPoints = this.chart1.Series[0].Points;
+        //    var dataPoints = this.chart1.Series[0].Points;
 
-            // 璁$畻澶氶」寮忓湪鐐� x 澶勭殑鍙栧��
-            // 璁$畻鎷熷悎鏇茬嚎涓婄殑鐐�
-            var waterpress = _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve.Select((d) => { return new PointF(d.X, (float)_facilities.MaxHeight + _SelectedBuild.鐢ㄦ埛鍘嬪姏闇�姹�); }).ToList();
+        //    // 璁$畻澶氶」寮忓湪鐐� x 澶勭殑鍙栧��
+        //    // 璁$畻鎷熷悎鏇茬嚎涓婄殑鐐�
+        //    var waterpress = _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve.Select((d) => { return new PointF(d.X, (float)_facilities.MaxHeight + _SelectedBuild.鐢ㄦ埛鍘嬪姏闇�姹�); }).ToList();
 
-            var maxheight = _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve.Select((d) => { return new PointF(d.X, (float)_facilities.MaxHeight); }).ToList();
-            AddSeries(chart1.Series["骞冲潎"], fitPoints);
-            AddSeries(chart1.Series["涓嬮檺"], confidencePoints[0]);
-            AddSeries(chart1.Series["涓婇檺"], confidencePoints[1]);
-            AddSeries(chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"], waterpress);
-            AddSeries(chart1.Series["鏈�楂樻ゼ灞傛爣楂�"], maxheight);
-            if (yMin > 0 && yMin < 10)
-            {
-                this.chart1.ChartAreas[0].AxisY.Minimum = 0;
-                this.chart1.ChartAreas[0].AxisY.Maximum = Math.Ceiling((yMax * 1.2) / 10) * 10;
-                this.chart1.ChartAreas[0].AxisY.Interval = (chart1.ChartAreas[0].AxisY.Maximum - chart1.ChartAreas[0].AxisY.Minimum) / 4;
-            }
-            else
-            {
-                this.chart1.ChartAreas[0].AxisY.Minimum = Math.Floor((yMin * 0.8) / 10) * 10;
-                this.chart1.ChartAreas[0].AxisY.Maximum = Math.Ceiling((yMax * 1.2) / 10) * 10;
-                chart1.ChartAreas[0].AxisX.IsLabelAutoFit = true;
-                //this.chart1.ChartAreas[0].AxisX.Minimum = double.NaN;
-                //this.chart1.ChartAreas[0].AxisX.Maximum = double.NaN;
-                this.chart1.ChartAreas[0].AxisY.Interval = (chart1.ChartAreas[0].AxisY.Maximum - chart1.ChartAreas[0].AxisY.Minimum) / 4;
-            }
-            if (xMin > 0 && xMin < 10)
-            {
-                this.chart1.ChartAreas[0].AxisX.Minimum = 0;
-                this.chart1.ChartAreas[0].AxisX.Maximum = Math.Ceiling(xMax);
-            }
-            else
-            {
-                this.chart1.ChartAreas[0].AxisX.Minimum = Math.Floor((xMin * 0.8) / 10) * 10;
-                this.chart1.ChartAreas[0].AxisX.Maximum = Math.Ceiling(xMax * 1.2);
-            }
-        }
+        //    var maxheight = _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve.Select((d) => { return new PointF(d.X, (float)_facilities.MaxHeight); }).ToList();
+        //    AddSeries(chart1.Series["骞冲潎"], fitPoints);
+        //    AddSeries(chart1.Series["涓嬮檺"], confidencePoints[0]);
+        //    AddSeries(chart1.Series["涓婇檺"], confidencePoints[1]);
+        //    AddSeries(chart1.Series["娉靛嚭鍙i潤鍘嬬嚎"], waterpress);
+        //    AddSeries(chart1.Series["鏈�楂樻ゼ灞傛爣楂�"], maxheight);
+        //    if (yMin > 0 && yMin < 10)
+        //    {
+        //        this.chart1.ChartAreas[0].AxisY.Minimum = 0;
+        //        this.chart1.ChartAreas[0].AxisY.Maximum = Math.Ceiling((yMax * 1.2) / 10) * 10;
+        //        this.chart1.ChartAreas[0].AxisY.Interval = (chart1.ChartAreas[0].AxisY.Maximum - chart1.ChartAreas[0].AxisY.Minimum) / 4;
+        //    }
+        //    else
+        //    {
+        //        this.chart1.ChartAreas[0].AxisY.Minimum = Math.Floor((yMin * 0.8) / 10) * 10;
+        //        this.chart1.ChartAreas[0].AxisY.Maximum = Math.Ceiling((yMax * 1.2) / 10) * 10;
+        //        chart1.ChartAreas[0].AxisX.IsLabelAutoFit = true;
+        //        //this.chart1.ChartAreas[0].AxisX.Minimum = double.NaN;
+        //        //this.chart1.ChartAreas[0].AxisX.Maximum = double.NaN;
+        //        this.chart1.ChartAreas[0].AxisY.Interval = (chart1.ChartAreas[0].AxisY.Maximum - chart1.ChartAreas[0].AxisY.Minimum) / 4;
+        //    }
+        //    if (xMin > 0 && xMin < 10)
+        //    {
+        //        this.chart1.ChartAreas[0].AxisX.Minimum = 0;
+        //        this.chart1.ChartAreas[0].AxisX.Maximum = Math.Ceiling(xMax);
+        //    }
+        //    else
+        //    {
+        //        this.chart1.ChartAreas[0].AxisX.Minimum = Math.Floor((xMin * 0.8) / 10) * 10;
+        //        this.chart1.ChartAreas[0].AxisX.Maximum = Math.Ceiling(xMax * 1.2);
+        //    }
+        //}
 
-        private void AddSeries(System.Windows.Forms.DataVisualization.Charting.Series serie, List<PointF> points)
-        {
-            if (points == null) return;
-            serie.Points.Clear();
-            foreach (var point in points)
-            {
-                serie.Points.AddXY(point.X, point.Y);
-            }
-        }
-        private void EquipmentTreeListCtrl1_FocusedChangedEvent(string objType, object obj)
-        {
-            this.curveExpressChart1.InitialChartData();
-            if (obj != null && objType == ISupply.ObjectType.Kit)
-            {
-                _kit = obj as Model.Kit;
-                var equipmentList = _bllEquipment.GetByKitIDAndCatalog(_kit.ID, ISupply.Equipment.Pump);
-                if (equipmentList != null && equipmentList.Any())
-                {
-                    var mappings = new List<Model.EquipmentEChartMapping>();
-                    foreach (var equipment in equipmentList)
-                    {
-                        var mapping = _bll.GetWorkingByEquipmentID(equipment.ID);
-                        if (mapping != null)
-                        {
-                            mappings.Add(mapping);
-                        }
-                    }
-                    if (mappings.Any())
-                    {
-                        var curveInfoList = new List<Model.PumpCurveInfo>();
-                        foreach (var mapping in mappings)
-                        {
-                            var chart = _bllEChart.GetPumpCurveInfoByID(mapping.EChartID);
-                            if (chart != null && chart.CurveInfoModel != null)
-                            {
-                                curveInfoList.Add(chart.CurveInfoModel);
-                            }
-                        }
-
-                        if (curveInfoList != null && curveInfoList.Any())
-                        {
-                            var theConnectCurve = new Curve.ParallelConnectionHelper();
-                            for (int i = 0; i < curveInfoList.Count; i++)
-                            {
-                                var chart = curveInfoList[i];
-                                var QH = chart.CurveQH;
-                                var QP = chart.CurveQP;
-                                var QE = Curve.PumpCalculateHelper.CalculateE(QH, QP);
-                                theConnectCurve.AddCurve(QH, QP);
-                            }
-                            var bol = theConnectCurve.CalculateParallel(out List<ISupply.Curve.CurvePoint> ConnectCurveQH,
-                                                                     out List<ISupply.Curve.CurvePoint> ConnectCurveQE,
-                                                                     out List<ISupply.Curve.CurvePoint> ConnectCurveQP);
-                            if (bol)
-                            {
-                                var curveExpressQH = ISupply.Curve.FitHelper.BuildCurveExpress(ConnectCurveQH);
-                                var curveExpressQE = ISupply.Curve.FitHelper.BuildCurveExpress(ConnectCurveQE);
-                                var curveExpressQP = ISupply.Curve.FitHelper.BuildCurveExpress(ConnectCurveQP);
-                                this.curveExpressChart1.SetBindingData(curveExpressQH,
-                                                              curveExpressQE,
-                                                             curveExpressQP);
-                            }
-                        }
-                    }
-                }
-            }
-            else if (obj != null && objType == ISupply.ObjectType.Equipment)
-            {
-                var equ = obj as Model.Equipment;
-                var _equipmentChartMappingEx = _equipmentTypeEChartMappingBLL.GetExByEquipmentTypeID(equ.TypeID);
-
-                SetBindingData(_equipmentChartMappingEx);
-            }
-        }
+        //private void AddSeries(System.Windows.Forms.DataVisualization.Charting.Series serie, List<PointF> points)
+        //{
+        //    if (points == null) return;
+        //    serie.Points.Clear();
+        //    foreach (var point in points)
+        //    {
+        //        serie.Points.AddXY(point.X, point.Y);
+        //    }
+        //}
+       
 
         private void SendDownloadData()
         {
-            var model = new IBoxControllViewModel();
+            var model = new IBoxControllDownloadViewModel();
             model.facilities = _facilities;
-            model.kit = _kit;
+            model.kit = boxControllViewModel.Package;
             model.娴侀噺鍘嬮檷涓嬮檺 = _SelectedBuild.娴侀噺鍘嬮檷涓嬮檺.FittedCurve;
             model.娴侀噺鍘嬮檷涓婇檺 = _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.FittedCurve;
             model.娴侀噺鍘嬮檷鏇茬嚎 = _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.FittedCurve;
@@ -332,20 +284,8 @@
             if (!_SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.IsFitted)
                  _SelectedBuild.娴侀噺鍘嬮檷鏇茬嚎.CurveFit();
             model.coefficients = _SelectedBuild.娴侀噺鍘嬮檷涓婇檺.coefficients;
-            //model.IsControll = checkEdit1.Checked;
-            var equipmentList = _bllEquipment.GetByKitIDAndCatalog(_kit.ID, ISupply.Equipment.Pump);
-            if (equipmentList != null && equipmentList.Any())
-            {
-                foreach (var item in equipmentList)
-                {
-                    var _equipmentChartMappingEx = _equipmentTypeEChartMappingBLL.GetExByEquipmentTypeID(item.TypeID);
-                    _equipmentChartMappingEx.EquipmentId = item.ID;
-                    _equipmentChartMappingEx.EquipmentOtherName = item.Name;
-                    _equipmentChartMappingEx.RatedParas = item.RatedParas;
-                    model.equations.Add(_equipmentChartMappingEx);
-                }
-            }
-            //FileHelper.Write("d:\\EboxData.txt", JsonHelper.Object2Json(model));
+            model.equations = boxControllViewModel.equations;
+            
             Thread.Sleep(500);
             SendText(startCode + datadownloadCode + paramCode + JsonHelper.Object2Json(model) + endCode);
         }
@@ -358,21 +298,6 @@
             //MessageBoxHelper.ShowInfo("鏁版嵁涓嬪彂鎴愬姛!");
         }
 
-
-
-        private void SetBindingData(Model.EquipmentTypeEChartMappingEx model)
-        {
-            this.curveExpressChart1.InitialChartData();
-            var curveInfo = model?.CurveInfo;
-            var coordParas = model?.CoordParas;
-            if (curveInfo != null)
-            {
-                var coordinateParas = ISupply.Curve.CurveCoordinate.ToModel(coordParas);
-                this.curveExpressChart1.SetBindingData(curveInfo.CurveQH,
-                                                            curveInfo.CurveQE,
-                                                            curveInfo.CurveQP,
-                                                            coordinateParas);
-            }
-        }
+        
     }
 }

--
Gitblit v1.9.3