duheng
2025-03-28 9be9ba4e159969fb5e32648c2c34e912ccc3ae6d
WinFrmUI/IBox.WinFrmUI/Form/IBoxFormEnergyAnalysis.cs
@@ -97,8 +97,43 @@
        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,IBoxHelper.startCode }, StringSplitOptions.RemoveEmptyEntries);
                    if (smsg.Length < 2)
                    {
                        return;
                    }
                    switch (smsg[0].Trim())
                    {
                        case IBoxHelper.getenergyanalyCode:
                            {
                                var order = IBoxHelper.HttpGet(content);
                                var result = IBoxHelper.GetContent(order);
                                if (!string.IsNullOrEmpty(result))
                                {
                                    var model = JsonHelper.Json2Object<List<PumpEnergyViewModel>>(result);
                                    BindData(model);
                                }
                                break;
                            }
                        default:
                            IBoxHelper.HttpGet(content);
                            break;
                    }
                }
                else
                {
                    MessageBoxHelper.ShowWarning("网络连接失败,请检查网络");
                }
            }
        }
        /// <summary>
        /// 查询
@@ -214,6 +249,14 @@
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            Check();
        }
        /// <summary>
        /// 校验
        /// </summary>
        public void Check()
        {
            var dlg = new AnalyDayForm();
            if (dlg.ShowDialog() == DialogResult.OK)
            {