浏览代码

B08增加一个参数区分补元和套口

Void_F 7 月之前
父节点
当前提交
2ece65fed5

+ 22 - 10
Assets/Scripts/HttpHelper.cs

@@ -63,7 +63,7 @@ public class HttpHelper : MonoBehaviour
         if (GlobalData.pageIndex == PageIndex.Page1 || GlobalData.pageIndex == PageIndex.Page2)
         {
             //可以并行,无需等待
-            InitGCYWData();
+            InitGCYWData(0);
         }
     }
     public async Task InitYZTData()
@@ -874,13 +874,17 @@ public class HttpHelper : MonoBehaviour
         www.Dispose();
         return result;
     }
-
-    public async Task InitGCYWData()
+    /// <summary>
+    /// 0 补元 1套口
+    /// </summary>
+    /// <param name="type"></param>
+    public async Task InitGCYWData(int type)
     {
+        GlobalData.B08_Type = type;
         string jsonStr;
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_dataStatis);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_dataStatis,type);
             Debug.Log("API_B08_dataStatis" + jsonStr);
             GlobalData.B08DataStatis = JsonConvert.DeserializeObject<B08_dataStatis>(jsonStr);
         }
@@ -891,7 +895,7 @@ public class HttpHelper : MonoBehaviour
 
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_inspectResult);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_inspectResult,type);
             Debug.Log("API_B08_inspectResult" + jsonStr);
             GlobalData.B08InspectResult = JsonConvert.DeserializeObject<B08_inspectResult>(jsonStr);
         }
@@ -902,7 +906,7 @@ public class HttpHelper : MonoBehaviour
 
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_projectExamine);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_projectExamine,type);
             Debug.Log("API_B08_projectExamine" + jsonStr);
             GlobalData.B08ProjectExamine = JsonConvert.DeserializeObject<B08_projectExamine>(jsonStr);
         }
@@ -913,7 +917,7 @@ public class HttpHelper : MonoBehaviour
 
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_event);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_event,type);
             Debug.Log("API_B08_event" + jsonStr);
             GlobalData.B08Event = JsonConvert.DeserializeObject<B08_event>(jsonStr);
         }
@@ -924,7 +928,7 @@ public class HttpHelper : MonoBehaviour
 
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_questionStatis);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_questionStatis,type);
             Debug.Log("API_B08_questionStatis" + jsonStr);
             GlobalData.B08QuestionStatis = JsonConvert.DeserializeObject<B08_questionStatis>(jsonStr);
         }
@@ -935,7 +939,7 @@ public class HttpHelper : MonoBehaviour
 
         try
         {
-            jsonStr = await B08_API_data(ServerAddress.API_B08_inspectType);
+            jsonStr = await B08_API_data(ServerAddress.API_B08_inspectType,type);
             Debug.Log("API_B08_inspectType" + jsonStr);
             GlobalData.B08InspectType = JsonConvert.DeserializeObject<B08_inspectType>(jsonStr);
         }
@@ -945,8 +949,16 @@ public class HttpHelper : MonoBehaviour
         }
     }
 
-    public async Task<string> B08_API_data(string cmdUrl)
+    public async Task<string> B08_API_data(string cmdUrl,int type)
     {
+        if (type == 0)
+        {
+            cmdUrl += "1794245918999351298";
+        }
+        else
+        {
+            cmdUrl += "1798366756789653505";
+        }
         UnityWebRequest www = new UnityWebRequest(cmdUrl, "Get");
         www.downloadHandler = new DownloadHandlerBuffer();
         www.SetRequestHeader("Content-Type", "application/json");

+ 1 - 0
Assets/Scripts/UI/Data/GlobalData.cs

@@ -80,6 +80,7 @@ public class GlobalData
     public static B08_event B08Event;
     public static B08_questionStatis B08QuestionStatis;
     public static B08_inspectType B08InspectType;
+    public static int B08_Type = -1;
     #endregion   
     
     /// <summary>

+ 6 - 6
Assets/Scripts/UI/Tools/ServerAddress.cs

@@ -82,12 +82,12 @@ public class ServerAddress
 
     public static string API_TextureUploadPath = YZTServerAddress + "/upload";
 
-    public static string API_B08_dataStatis = "http://111.4.141.191:9080/open/dataStatis";
-    public static string API_B08_inspectResult = "http://111.4.141.191:9080/open/inspectResult";
-    public static string API_B08_projectExamine = "http://111.4.141.191:9080/open/projectExamine";
-    public static string API_B08_event = "http://111.4.141.191:9080/open/event";
-    public static string API_B08_questionStatis = "http://111.4.141.191:9080/open/questionStatis";
-    public static string API_B08_inspectType = "http://111.4.141.191:9080/open/inspectType";
+    public static string API_B08_dataStatis = "http://111.4.141.191:9080/open/dataStatis?projectId=";
+    public static string API_B08_inspectResult = "http://111.4.141.191:9080/open/inspectResult?projectId=";
+    public static string API_B08_projectExamine = "http://111.4.141.191:9080/open/projectExamine?projectId=";
+    public static string API_B08_event = "http://111.4.141.191:9080/open/event?projectId=";
+    public static string API_B08_questionStatis = "http://111.4.141.191:9080/open/questionStatis?projectId=";
+    public static string API_B08_inspectType = "http://111.4.141.191:9080/open/inspectType?projectId=";
     
     /// <summary>
     /// 获取站点水位信息(折线图和信息列表)

+ 38 - 38
Assets/Scripts/UI/UIView/GCYW/GCYWLayer.cs

@@ -62,12 +62,12 @@ public class GCYWLayer : YZTRootLayer
     private Button checkPathButton;
     private Text checkPathButtonText;
     private bool showCheckPath = false;
-    
+
     private Button BuYuanDataButton;
     private Button TaoKouDataButton;
     private CanvasGroup button_CG1;
     private CanvasGroup button_CG2;
-    
+
     private void Awake()
     {
         Init();
@@ -90,10 +90,10 @@ public class GCYWLayer : YZTRootLayer
         _tuFaShiJian_Slider = this.transform.Find("ShuJuTongJi/TuFaShiJian/slider").GetComponent<MPImage>();
 
         wenTiTongJiBarChart = this.transform.Find("ShuJuTongJi/XunJianTongJi/BarChart").GetComponent<BarChart>();
-        
-        gongChengGuanLiChart=this.transform.Find("GongChengGuanLi/GuanLiJianCha").GetComponent<PieChart>();
-        gongChengGuanLiChartCount=this.transform.Find("GongChengGuanLi/GuanLiJianCha/count/numText").GetComponent<Text>();
-        fenJiKaoPingChart=this.transform.Find("GongChengGuanLi/FenJiKaoPing").GetComponent<PieChart>();
+
+        gongChengGuanLiChart = this.transform.Find("GongChengGuanLi/GuanLiJianCha").GetComponent<PieChart>();
+        gongChengGuanLiChartCount = this.transform.Find("GongChengGuanLi/GuanLiJianCha/count/numText").GetComponent<Text>();
+        fenJiKaoPingChart = this.transform.Find("GongChengGuanLi/FenJiKaoPing").GetComponent<PieChart>();
 
         TFSJ_DaiChuLiNumTex = this.transform.Find("TuFaShiJian/DaiChuLi/count").GetComponent<Text>();
         TFSJ_DaiYanShouNumTex = this.transform.Find("TuFaShiJian/DaiYanShou/count").GetComponent<Text>();
@@ -119,46 +119,41 @@ public class GCYWLayer : YZTRootLayer
         checkPathButton = this.transform.Find("CheckPathButton").GetComponent<Button>();
         checkPathButtonText = checkPathButton.GetComponentInChildren<Text>();
         checkPathButton.onClick.AddListener(CheckPathChange);
-        
+
         BuYuanDataButton = this.transform.Find("BuYuanButton").GetComponent<Button>();
         button_CG1 = BuYuanDataButton.GetComponent<CanvasGroup>();
-        BuYuanDataButton.onClick.AddListener(() =>
-        {
-            ChangeData(0);
-        });
+        BuYuanDataButton.onClick.AddListener(() => { ChangeData(0); });
         TaoKouDataButton = this.transform.Find("TaoKouButton").GetComponent<Button>();
         button_CG2 = TaoKouDataButton.GetComponent<CanvasGroup>();
-        TaoKouDataButton.onClick.AddListener(() =>
-        {
-            ChangeData(1);
-        });
+        TaoKouDataButton.onClick.AddListener(() => { ChangeData(1); });
     }
 
-    private void ChangeData(int type)
+    private async void ChangeData(int type)
     {
         //切换补元、套口数据
         StaticLod.instance.OnFoucusStatic(type);
-        button_CG1.alpha = type==0?1.0f:0.4f;
-        button_CG2.alpha = type==1?1.0f:0.4f;
+        button_CG1.alpha = type == 0 ? 1.0f : 0.4f;
+        button_CG2.alpha = type == 1 ? 1.0f : 0.4f;
         showCheckPath = false;
         ActionInstance._Instance.SetCheckPathActive(showCheckPath);
         string textStr = showCheckPath ? "隐藏" : "显示";
         checkPathButtonText.text = $"巡检路线({textStr})";
-    }
 
-    private async void OnEnable()
-    {
-        if (GlobalData.B08DataStatis != null && GlobalData.B08DataStatis.data == null)
+        if (GlobalData.B08_Type != type)
         {
-            await HttpHelper._Instance.InitGCYWData();
-          
+            await HttpHelper._Instance.InitGCYWData(type);
         }
+
         SetShuJuTongJiData();
         SetXunJianBarChart();
         SetGongChengGuanLiChart();
         SetTFSJ_Data();
         SetWTZG_Data();
         SetXJLE_Data();
+    }
+
+    private async void OnEnable()
+    {
         ChangeData(0);
     }
 
@@ -186,6 +181,7 @@ public class GCYWLayer : YZTRootLayer
             tempDatas[i].data.Add(i);
             tempDatas[i].data.Add(tempData.data.question[i].value);
         }
+
         tempSeries[0].data.Clear();
         tempSeries[0].data.AddRange(tempDatas);
 
@@ -197,10 +193,11 @@ public class GCYWLayer : YZTRootLayer
             tempDatas_1[i].data.Add(i);
             tempDatas_1[i].data.Add(tempData.data.events[i].value);
         }
+
         tempSeries[1].data.Clear();
         tempSeries[1].data.AddRange(tempDatas_1);
     }
-    
+
     public void SetGongChengGuanLiChart()
     {
         B08_projectExamine tempData = GlobalData.B08ProjectExamine;
@@ -217,11 +214,12 @@ public class GCYWLayer : YZTRootLayer
             tempDatas[i].name = tempData.data.type1[i].key;
             tempCount += tempData.data.type1[i].value;
         }
+
         tempSeries[0].data.Clear();
         tempSeries[0].data.AddRange(tempDatas);
 
         gongChengGuanLiChartCount.text = tempCount.ToString();
-        
+
         var tempSeries_1 = fenJiKaoPingChart.series;
         SerieData[] tempDatas_1 = new SerieData[tempData.data.type2.Length];
         for (int i = 0; i < tempDatas_1.Length; i++)
@@ -232,6 +230,7 @@ public class GCYWLayer : YZTRootLayer
             tempDatas_1[i].data.Add(tempData.data.type2[i].value);
             tempDatas_1[i].name = tempData.data.type2[i].key;
         }
+
         tempSeries_1[0].data.Clear();
         tempSeries_1[0].data.AddRange(tempDatas_1);
     }
@@ -243,13 +242,14 @@ public class GCYWLayer : YZTRootLayer
         TFSJ_DaiChuLiNumTex.text = tempData.data.waitHandle.ToString();
         TFSJ_DaiYanShouNumTex.text = tempData.data.waitAccept.ToString();
         TFSJ_YiChuLiNumTex.text = tempData.data.hasHandle.ToString();
-        TFSJ_completeText.text = $"{float.Parse(tempData.data.completeRate)*100.0f:0}%";
-        TFSJ_completeSlider.fillAmount =float.Parse(tempData.data.completeRate);
+        TFSJ_completeText.text = $"{float.Parse(tempData.data.completeRate) * 100.0f:0}%";
+        TFSJ_completeSlider.fillAmount = float.Parse(tempData.data.completeRate);
 
         for (int i = 0; i < TFSJ_eventItems.Count; i++)
         {
             Destroy(TFSJ_eventItems[i]);
         }
+
         TFSJ_eventItems.Clear();
         for (int i = 0; i < tempData.data.list.Count; i++)
         {
@@ -257,10 +257,10 @@ public class GCYWLayer : YZTRootLayer
             tempObj.Init(tempData.data.list[i]);
             TFSJ_eventItems.Add(tempObj.gameObject);
         }
-        
-        _tuFaShiJian_Count_Text.text = $"{tempData.data.waitHandle+tempData.data.waitAccept+tempData.data.hasHandle}";
-        _tuFaShiJian_Vlaue_Text.text = $"{float.Parse(tempData.data.completeRate)*100.0f:0}%";
-        _tuFaShiJian_Slider.fillAmount =float.Parse(tempData.data.completeRate);
+
+        _tuFaShiJian_Count_Text.text = $"{tempData.data.waitHandle + tempData.data.waitAccept + tempData.data.hasHandle}";
+        _tuFaShiJian_Vlaue_Text.text = $"{float.Parse(tempData.data.completeRate) * 100.0f:0}%";
+        _tuFaShiJian_Slider.fillAmount = float.Parse(tempData.data.completeRate);
     }
 
     public void SetWTZG_Data()
@@ -269,13 +269,14 @@ public class GCYWLayer : YZTRootLayer
         WTZG_DaiChuLiNumTex.text = tempData.data.waitHandle.ToString();
         WTZG_DaiYanShouNumTex.text = tempData.data.waitAccept.ToString();
         WTZG_YiChuLiNumTex.text = tempData.data.hasHandle.ToString();
-        WTZG_completeText.text = $"{float.Parse(tempData.data.completeRate)*100.0f:0}%";
-        WTZG_completeSlider.fillAmount =float.Parse(tempData.data.completeRate);
+        WTZG_completeText.text = $"{float.Parse(tempData.data.completeRate) * 100.0f:0}%";
+        WTZG_completeSlider.fillAmount = float.Parse(tempData.data.completeRate);
 
         for (int i = 0; i < WTZG_eventItems.Count; i++)
         {
             Destroy(WTZG_eventItems[i]);
         }
+
         WTZG_eventItems.Clear();
         for (int i = 0; i < tempData.data.list.Count; i++)
         {
@@ -283,9 +284,9 @@ public class GCYWLayer : YZTRootLayer
             tempObj.Init(tempData.data.list[i]);
             WTZG_eventItems.Add(tempObj.gameObject);
         }
-        
-        _zhengGaiWenTi_Count_Text.text =$"{tempData.data.waitHandle+tempData.data.waitAccept+tempData.data.hasHandle}";
-        _zhengGaiWenTi_Vlaue_Text.text = $"{float.Parse(tempData.data.completeRate)*100.0f:0}%";
+
+        _zhengGaiWenTi_Count_Text.text = $"{tempData.data.waitHandle + tempData.data.waitAccept + tempData.data.hasHandle}";
+        _zhengGaiWenTi_Vlaue_Text.text = $"{float.Parse(tempData.data.completeRate) * 100.0f:0}%";
         _zhengGaiWenTi_Slider.fillAmount = float.Parse(tempData.data.completeRate);
     }
 
@@ -307,5 +308,4 @@ public class GCYWLayer : YZTRootLayer
         string textStr = showCheckPath ? "隐藏" : "显示";
         checkPathButtonText.text = $"巡检路线({textStr})";
     }
-    
 }