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 { //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(json); // Init(); //} 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() { //url = WebIPAdress.Instance.dicAdresses["通用数据接口"]; //string _url = url + userNub; //root = await AsyncWebReq.Get(_url); //currentEC = GetDateItemByUserID(null); 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; } /// /// 场景数据 /// /// public string GetSceneInfo() { string sceneInfo = currentEC.BiaoType + "_" + currentEC.Scene; return sceneInfo; } /// /// 场景是否正确 /// /// public bool GetSceneState() { return root.state; } /// /// 获取光伏容量 /// /// public void GetPVW() { GlobalFlag.pvw = currentEC.PVW; } /// /// 光伏板数量 /// /// public void GetPVWNum() { GlobalFlag.pvwNum = currentEC.PVNumber; } ///// ///// 获取倍率 ///// ///// //public int GetBeiLv() //{ // int bl = currentEC.Beilv; // return bl; //} /// /// 获取运行容量 /// public void GetRunRl() { if (!string.IsNullOrEmpty(currentEC.RunRL) && !string.IsNullOrWhiteSpace(currentEC.RunRL)) GlobalFlag.runRL = int.Parse(currentEC.RunRL); //GlobalFlag.runRL = 8; } /// /// 用户状态 /// public void GetUserType() { if (currentEC.UserState != null) GlobalFlag.userType = currentEC.UserState; } /// /// 获取表记类型 /// /// public string WarnningType() { string type = currentEC.WarningType; return type; } /// /// 表记数据 /// /// public List GetTTPDs() { List temps = new List(); 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; } /// /// 表记状态 /// /// public BiaoJIData BiaoJiData() { BiaoJIData temp = new BiaoJIData(); temp.warningType = UIManager.Instance.messageData.stubtype; temp.oneWayAA = UIManager.Instance.messageData.electriccurrent; temp.oneWayAV = UIManager.Instance.messageData.voltage; temp.N = UIManager.Instance.messageData.zerosequencecurrent; temp.AA = UIManager.Instance.messageData.aphasecurrent; temp.BA = UIManager.Instance.messageData.bphasecurrent; temp.CA = UIManager.Instance.messageData.cphasecurrent; temp.AV = UIManager.Instance.messageData.aphasevoltage; temp.BV = UIManager.Instance.messageData.bphasevoltage; temp.CV = UIManager.Instance.messageData.cphasevoltage; return temp; } } }