Shuxia Ning
2024-12-05 1e9a72970e30b74b8f0cb7c74e2bec9df1aa1d22
WinFrmUI/HStation.WinFrmUI.PhartRelation.Core/02-valve-main/XhsValveMainPhartPanel.cs
@@ -1,4 +1,6 @@
namespace HStation.WinFrmUI.PhartRelation
using Yw.DAL.PostgreSql;
namespace HStation.WinFrmUI.PhartRelation
{
    public partial class XhsValveMainPhartPanel : DocumentPage
    {
@@ -29,12 +31,10 @@
        }
        //选择曲线变换事件
        private void XhsValveMainPhartListCtrl1_FocusedChangedEvent(Vmo.XhsValveMainPhartMappingExtensions obj)
        private void XhsValveMainPhartListCtrl1_FocusedChangedEvent(Vmo.AssetsValveCoefficientVmo obj)
        {
            _xhs_phart_diagram_ex_std_dto = obj;
            InitChart(_xhs_phart_diagram_ex_std_dto);
            this.xtrPerform2dChart1.SetBindingData(obj.MinorLossCurve);
        }
        #region 图表
@@ -65,12 +65,11 @@
            List<Yw.Geometry.Point2d> points_ql = null;
            points_ql = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 12, null);
            var cubic_spline_ql = new Yw.Geometry.CubicSpline2d(points_ql);
            var disp_paras = diagram.DispParas;
            var is_calc_disp_paras = string.IsNullOrWhiteSpace(disp_paras);
            this.xtrPerform2dChart1.SetBindingData(cubic_spline_ql, disp_paras, is_calc_disp_paras);
            this.xtrPerform2dChart1.SetBindingData(cubic_spline_ql.ToDbString(), disp_paras, is_calc_disp_paras);
        }
        //清空图表数据
@@ -86,62 +85,32 @@
        //Excel 导入
        private void barBtnImportByExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new Yw.WinFrmUI.Phart.ImportValvePerform2dByExcelDlg();
            dlg.ReloadDataEvent += async (other_name, ql) =>
            {
                var bol = await Import(other_name, ql);
            dlg.ReloadDataEvent += async (pt_list_json) =>
            {
                var bol = await Import(pt_list_json);
                return bol;
            };
            dlg.ShowDialog();
        }
        // 导入
        private async Task<bool> Import(string other_name, Yw.Geometry.CubicSpline2d ql)
        private async Task<bool> Import(string pt_list_json)
        {
            if (_valve_main_id < 1)
            {
                XtraMessageBox.Show("ValveMain is null!");
                return false;
            }
            var input = new Vmo.XhsValveMainPhartMappingExtensions();
            input.MainID = _valve_main_id;
            input.Importance = 0;
            input.OtherName = other_name;
            input.Diagram = new Vmo.PhartDiagramExGraphList()
            {
                DiagramType = HStation.PhartRelation.eDiagramType.Feat,
                Name = other_name,
                GraphList = new List<Vmo.PhartGraph>()
                {
                    new ()
                    {
                        Name = other_name,
                        GeometryStyle=  HStation.PhartRelation.eGeometryStyle.FeatCurve,
                        GraphType= HStation.PhartRelation.eGraphType.ValveQL,
                        GeometryInfo=ql.ToDbString()
                    }
                }
            };
            var mapping_id = await _bll_ex.Insert(input);
            if (mapping_id < 1)
            {
                return false;
            }
            var xhs_phart_diagram_ex_std_dto = await _bll_ex.GetByID(mapping_id);
            this.xhsValveMainPhartListCtrl1.Add(xhs_phart_diagram_ex_std_dto);
            return true;
            var bll = new BLL.AssetsValveCoefficient();
            var model = new Vmo.AssetsValveCoefficientVmo();
            model.MainID = _valve_main_id;
            model.MinorLossCurve = pt_list_json;
            return await bll.Insert(model) > 0;
        }
        #endregion 导入
        #region 操作
@@ -174,9 +143,8 @@
            points_ql = PhartPerformCurveHelper.GetFeatPointList(graph_ql.GraphType, graph_ql.GeometryInfo, 12, null);
            ql = new Yw.Geometry.CubicSpline2d(points_ql);
            var dlg = new Yw.WinFrmUI.Phart.ValvePerform2dEditDlg();
            dlg.SetBindingData(ql);
            var dlg = new Yw.WinFrmUI.Phart.ValveEditDlg();
            dlg.SetBindingData(ql.ToDbString());
            dlg.ReloadDataEvent += async (new_ql) =>
            {
                graph_ql.GeometryInfo = new_ql.ToDbString();
@@ -274,6 +242,5 @@
        #endregion 删除
        #endregion 操作
    }
}