2024-02-21 02:24:56 +00:00
|
|
|
|
using _20230724_MBJC_upperpc.Common;
|
|
|
|
|
|
using _20230724_MBJC_upperpc.Models;
|
2024-01-19 05:04:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace _20230724_MBJC_upperpc.ViewModels
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BeaconViewModel : NotifyBase
|
|
|
|
|
|
{
|
2024-01-22 05:36:57 +00:00
|
|
|
|
private BeaconModel beacon;
|
|
|
|
|
|
|
|
|
|
|
|
public BeaconModel Beacon
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return beacon; }
|
|
|
|
|
|
set { beacon = value; this.DoNotify(); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-19 05:04:06 +00:00
|
|
|
|
|
|
|
|
|
|
private int model_Visibility = 1;
|
|
|
|
|
|
|
|
|
|
|
|
public int Model_Visibility
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return model_Visibility; }
|
|
|
|
|
|
set { model_Visibility = value; this.DoNotify(); }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-21 02:24:56 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 生成告警信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void DoFresh()
|
|
|
|
|
|
{
|
2024-02-23 07:28:58 +00:00
|
|
|
|
float Beacon_JD = 0;
|
|
|
|
|
|
float Beacon_WD = 0;
|
|
|
|
|
|
float Beacon_JL = 0;
|
|
|
|
|
|
float Beacon_HG = 0;
|
|
|
|
|
|
float Beacon_HG_DIS = 0;
|
|
|
|
|
|
float Beacon_FY = 0;
|
|
|
|
|
|
float Beacon_FY_DIS = 0;
|
|
|
|
|
|
float Beacon_PH = 0;
|
|
|
|
|
|
float Beacon_PH_DIS = 0;
|
2024-02-21 02:24:56 +00:00
|
|
|
|
|
2024-02-23 07:28:58 +00:00
|
|
|
|
//从配置文件中取得对应的阈值文件
|
2024-02-21 02:24:56 +00:00
|
|
|
|
if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon1")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon1_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon1_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon1_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon1_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon1_FY"));
|
2024-02-23 07:28:58 +00:00
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon1_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon1_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon1_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon1_PH_DIS"));
|
2024-02-21 02:24:56 +00:00
|
|
|
|
}
|
2024-02-23 07:28:58 +00:00
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon2")))
|
2024-02-21 02:24:56 +00:00
|
|
|
|
{
|
2024-02-23 07:28:58 +00:00
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon2_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon2_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon2_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon2_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon2_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon2_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon2_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon2_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon2_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon3")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon3_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon3_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon3_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon3_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon3_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon3_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon3_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon3_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon3_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon4")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon4_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon4_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon4_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon4_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon4_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon4_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon4_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon4_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon4_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon5")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon5_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon5_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon5_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon5_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon5_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon5_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon5_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon5_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon5_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon6")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon6_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon6_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon6_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon6_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon6_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon6_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon6_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon6_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon6_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon7")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon7_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon7_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon7_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon7_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon7_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon7_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon7_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon7_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon7_PH_DIS"));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Beacon.ID == int.Parse(tools.GetAppSetting("Beacon8")))
|
|
|
|
|
|
{
|
|
|
|
|
|
Beacon_JD = Convert.ToSingle(tools.GetAppSetting("Beacon8_JD"));
|
|
|
|
|
|
Beacon_WD = Convert.ToSingle(tools.GetAppSetting("Beacon8_WD"));
|
|
|
|
|
|
Beacon_JL = Convert.ToSingle(tools.GetAppSetting("Beacon8_JL"));
|
|
|
|
|
|
Beacon_HG = Convert.ToSingle(tools.GetAppSetting("Beacon8_HG"));
|
|
|
|
|
|
Beacon_FY = Convert.ToSingle(tools.GetAppSetting("Beacon8_FY"));
|
|
|
|
|
|
Beacon_PH = Convert.ToSingle(tools.GetAppSetting("Beacon8_PH"));
|
|
|
|
|
|
Beacon_HG_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon8_HG_DIS"));
|
|
|
|
|
|
Beacon_FY_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon8_FY_DIS"));
|
|
|
|
|
|
Beacon_PH_DIS = Convert.ToSingle(tools.GetAppSetting("Beacon8_PH_DIS"));
|
2024-02-21 02:24:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-23 07:28:58 +00:00
|
|
|
|
//阈值状态包括 偏差的值 偏差值的百分比 偏差值百分比的颜色 百分之0到百分之75是绿色 百分之75到百分之99是黄色,百分之100及以上是红色
|
|
|
|
|
|
|
|
|
|
|
|
//计算后的经纬度偏移距离
|
|
|
|
|
|
double py = tools.GetDistanceTo(Beacon_JD, Beacon_WD, Beacon.Beacon_JD, Beacon.Beacon_WD);
|
|
|
|
|
|
//经纬度计算距离便宜百分比
|
|
|
|
|
|
float py_bfb = (float)py / Beacon_JL;
|
|
|
|
|
|
//
|
2024-02-21 02:24:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-19 05:04:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|