210 lines
6.0 KiB
C#
210 lines
6.0 KiB
C#
using BjData;
|
||
using EData;
|
||
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using Newtonsoft.Json;
|
||
//============================================================
|
||
//支持中文,文件使用UTF-8编码
|
||
//@author YangHua
|
||
//@create 20230916
|
||
//@company Adam
|
||
//
|
||
//@description:
|
||
//============================================================
|
||
namespace Adam
|
||
{
|
||
public class ExamusersController : MonoSingleton<ExamusersController>
|
||
{
|
||
|
||
//private string url;
|
||
|
||
public Root root = new Root();
|
||
public DataItem currentEC = new DataItem();
|
||
|
||
private void Start()
|
||
{
|
||
string json = FileUtil.ReadFromLocal("Local/通用数据接口.json");
|
||
root = JsonConvert.DeserializeObject<Root>(json);
|
||
}
|
||
|
||
|
||
public DataItem GetDateItemByUserID(string userNub)
|
||
{
|
||
DataItem temp = new DataItem();
|
||
if (root != null)
|
||
{
|
||
for (int i = 0; i < root.data.Count; i++)
|
||
{
|
||
if (root.data[i].user_no.Contains(userNub))
|
||
temp = root.data[i];
|
||
}
|
||
}
|
||
return temp;
|
||
}
|
||
|
||
// Use this for initialization
|
||
public void Init(string userNub)
|
||
{
|
||
//url = WebIPAdress.Instance.dicAdresses["通用数据接口"];
|
||
//string _url = url + userNub;
|
||
//root = await AsyncWebReq.Get<Root>(_url);
|
||
|
||
currentEC = GetDateItemByUserID(userNub);
|
||
|
||
GlobalFlag.biaojiData = BiaoJiData();
|
||
GlobalFlag.Beilv = currentEC.Beilv;
|
||
GlobalFlag.dcw = currentEC.DCW;
|
||
GlobalFlag.userState = currentEC.UserState;
|
||
GlobalFlag.changeValue = currentEC.ChangeValue;
|
||
GlobalFlag.isChange = currentEC.IsChange;
|
||
GlobalFlag.oneA = GetOneABC(currentEC.A1);
|
||
GlobalFlag.oneB = GetOneABC(currentEC.B1);
|
||
GlobalFlag.oneC = GetOneABC(currentEC.C1);
|
||
GetPVW();
|
||
GetPVWNum();
|
||
GetRunRl();
|
||
GetUserType();
|
||
}
|
||
|
||
|
||
public float GetOneABC(string abc)
|
||
{
|
||
float result = 0;
|
||
if (!string.IsNullOrEmpty(abc))
|
||
{
|
||
result = float.Parse(abc);
|
||
}
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 场景数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetSceneInfo()
|
||
{
|
||
string sceneInfo = currentEC.BiaoType + "_" + currentEC.Scene;
|
||
return sceneInfo;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 场景是否正确
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public bool GetSceneState()
|
||
{
|
||
return root.state;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取光伏容量
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public void GetPVW()
|
||
{
|
||
GlobalFlag.pvw = currentEC.PVW;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 光伏板数量
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public void GetPVWNum()
|
||
{
|
||
GlobalFlag.pvwNum = currentEC.PVNumber;
|
||
}
|
||
|
||
///// <summary>
|
||
///// 获取倍率
|
||
///// </summary>
|
||
///// <returns></returns>
|
||
//public int GetBeiLv()
|
||
//{
|
||
// int bl = currentEC.Beilv;
|
||
// return bl;
|
||
//}
|
||
|
||
/// <summary>
|
||
/// 获取运行容量
|
||
/// </summary>
|
||
public void GetRunRl()
|
||
{
|
||
if (!string.IsNullOrEmpty(currentEC.RunRL) && !string.IsNullOrWhiteSpace(currentEC.RunRL))
|
||
GlobalFlag.runRL = int.Parse(currentEC.RunRL);
|
||
//GlobalFlag.runRL = 8;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 用户状态
|
||
/// </summary>
|
||
public void GetUserType()
|
||
{
|
||
if (currentEC.UserState != null)
|
||
GlobalFlag.userType = currentEC.UserState;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取表记类型
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string WarnningType()
|
||
{
|
||
string type = currentEC.WarningType;
|
||
return type;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 表记数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public List<ttpData.JfpgItem> GetTTPDs()
|
||
{
|
||
List<ttpData.JfpgItem> temps = new List<ttpData.JfpgItem>();
|
||
for (int i = 0; i < currentEC.jfpg.Count; i++)
|
||
{
|
||
ttpData.JfpgItem temp = new ttpData.JfpgItem();
|
||
temp.rdj = currentEC.jfpg[i].rdj;
|
||
temp.AA1 = currentEC.jfpg[i].AA1;
|
||
temp.AV1 = currentEC.jfpg[i].AV1;
|
||
temp.BA1 = currentEC.jfpg[i].BA1;
|
||
temp.BV1 = currentEC.jfpg[i].BV1;
|
||
temp.CA1 = currentEC.jfpg[i].CA1;
|
||
temp.CV1 = currentEC.jfpg[i].CV1;
|
||
|
||
temp.AA2 = currentEC.jfpg[i].AA2;
|
||
temp.AV2 = currentEC.jfpg[i].AV2;
|
||
temp.BA2 = currentEC.jfpg[i].BA2;
|
||
temp.BV2 = currentEC.jfpg[i].BV2;
|
||
temp.CA2 = currentEC.jfpg[i].CA2;
|
||
temp.CV2 = currentEC.jfpg[i].CV2;
|
||
|
||
temp.AA3 = currentEC.jfpg[i].AA3;
|
||
temp.AV3 = currentEC.jfpg[i].AV3;
|
||
temp.BA3 = currentEC.jfpg[i].BA3;
|
||
temp.BV3 = currentEC.jfpg[i].BV3;
|
||
temp.CA3 = currentEC.jfpg[i].CA3;
|
||
temp.CV3 = currentEC.jfpg[i].CV3;
|
||
temp.type = currentEC.jfpg[i].type;
|
||
temps.Add(temp);
|
||
}
|
||
|
||
return temps;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 表记状态
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public BiaoJIData BiaoJiData()
|
||
{
|
||
BiaoJIData temp = new BiaoJIData();
|
||
temp.userState = currentEC.UserState;
|
||
temp.warningType = currentEC.WarningType;
|
||
temp.onSite = currentEC.OnSite;
|
||
temp.selectInfo = currentEC.SelectCatch;
|
||
return temp;
|
||
}
|
||
|
||
}
|
||
}
|