|
|
@@ -36,6 +36,13 @@ public class DeviceTrendPanel : MonoBehaviour
|
|
|
|
|
|
public string dataName;
|
|
|
|
|
|
+ private GongChengType currentGongChengType;
|
|
|
+
|
|
|
+ public Text fanweiText;
|
|
|
+ public Text leijiText;
|
|
|
+ public Text pingjiaText;
|
|
|
+
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
rect = this.GetComponent<RectTransform>();
|
|
|
@@ -98,6 +105,76 @@ public class DeviceTrendPanel : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public async void SetPingJiaText(string valueType)
|
|
|
+ {
|
|
|
+
|
|
|
+ var ids=GCJKLayer._Instance.GetAllDevicesOfType_id(currentGongChengType);
|
|
|
+
|
|
|
+ List<float> rangeValues = new List<float>();
|
|
|
+ List<float> currentValues = new List<float>();
|
|
|
+ for (int i = 0; i < ids.Count; i++)
|
|
|
+ {
|
|
|
+ string getJsonStr =
|
|
|
+ await HttpHelper._Instance.GetDeviceTrend(currentType, _gid, _sid, startDateStr, endDateStr);
|
|
|
+ DeviceTrendRequest requestData = JsonConvert.DeserializeObject<DeviceTrendRequest>(getJsonStr);
|
|
|
+ if (requestData is { data: { Length: > 0 } })
|
|
|
+ {
|
|
|
+ float.TryParse(requestData.data[0].r1,out var valueS);
|
|
|
+ float.TryParse(requestData.data[^1].r1,out var valueE);
|
|
|
+ rangeValues.Add(valueS-valueE);
|
|
|
+ currentValues.Add(valueE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rangeValues.Sort();
|
|
|
+ currentValues.Sort();
|
|
|
+
|
|
|
+ string deviceTypeName = "";
|
|
|
+ switch (currentGongChengType)
|
|
|
+ {
|
|
|
+ case GongChengType.shuiWei:
|
|
|
+ deviceTypeName = "水位计";
|
|
|
+ break;
|
|
|
+ case GongChengType.shenYaJi:
|
|
|
+ deviceTypeName = "渗压计";
|
|
|
+ break;
|
|
|
+ case GongChengType.jingLiShuiZhunYi:
|
|
|
+ deviceTypeName = "静力水准仪";
|
|
|
+ break;
|
|
|
+ case GongChengType.wenDu:
|
|
|
+ deviceTypeName = "温度";
|
|
|
+ break;
|
|
|
+ case GongChengType.yinZhangXianYi:
|
|
|
+ deviceTypeName = "引张线仪";
|
|
|
+ break;
|
|
|
+ case GongChengType.chuiXianZuoBiaoYi:
|
|
|
+ deviceTypeName = "垂线坐标仪";
|
|
|
+ break;
|
|
|
+ case GongChengType.tuYaLiJi:
|
|
|
+ deviceTypeName = "土压力计";
|
|
|
+ break;
|
|
|
+ case GongChengType.yingLiJi:
|
|
|
+ deviceTypeName = "应力计";
|
|
|
+ break;
|
|
|
+ case GongChengType.sanXiangWeiCuoJi:
|
|
|
+ deviceTypeName = "三向位错计";
|
|
|
+ break;
|
|
|
+ case GongChengType.erXiangCeFengJi:
|
|
|
+ deviceTypeName = "二向测缝计";
|
|
|
+ break;
|
|
|
+ case GongChengType.weiYiJi:
|
|
|
+ deviceTypeName = "位移计";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ fanweiText.text = rangeValues.Count > 1 ? $"{rangeValues[0]}<color=#A5BFE2>~</color>{rangeValues[^1]} {valueType}" : "-<color=#A5BFE2>~</color>-";
|
|
|
+ leijiText.text = currentValues.Count > 1 ? $"{currentValues[0]}<color=#A5BFE2>~</color>{currentValues[^1]} {valueType}" : "-<color=#A5BFE2>~</color>-";
|
|
|
+ string leijiMin = currentValues.Count > 1 ? currentValues[0].ToString(CultureInfo.InvariantCulture) : "-";
|
|
|
+ string leijiMax = currentValues.Count > 1 ? currentValues[^1].ToString(CultureInfo.InvariantCulture) : "-";
|
|
|
+ string fanweiMin = rangeValues.Count > 1 ? rangeValues[0].ToString(CultureInfo.InvariantCulture) : "-";
|
|
|
+ string fanweiMax = rangeValues.Count > 1 ? rangeValues[^1].ToString(CultureInfo.InvariantCulture) : "-";
|
|
|
+ pingjiaText.text = $"截至到{endDateStr}止,{(currentType==0?"补元退洪闸":"套口进洪闸")}的{deviceTypeName}的累计变化量为{leijiMin}到{leijiMax}{valueType}之间,范围变化量在{fanweiMin}到{fanweiMax}{valueType}之间。";
|
|
|
+ }
|
|
|
+
|
|
|
public void OnDrag()
|
|
|
{
|
|
|
var mousePos = Input.mousePosition;
|
|
|
@@ -113,7 +190,6 @@ public class DeviceTrendPanel : MonoBehaviour
|
|
|
GetTrend(getJsonStr);
|
|
|
}
|
|
|
|
|
|
- private GongChengType currentGongChengType;
|
|
|
|
|
|
public async Task Show(string _name, GongChengType type, string gid, string sid)
|
|
|
{
|
|
|
@@ -187,6 +263,9 @@ public class DeviceTrendPanel : MonoBehaviour
|
|
|
/// </summary>
|
|
|
public void GetTrend(string jsonStr)
|
|
|
{
|
|
|
+ pingjiaText.text = "...";
|
|
|
+ fanweiText.text = "-<color=#A5BFE2>~</color>-";
|
|
|
+ leijiText.text = "-<color=#A5BFE2>~</color>-";
|
|
|
try
|
|
|
{
|
|
|
Debug.Log("GetTrend requestData:" + jsonStr);
|
|
|
@@ -269,12 +348,15 @@ public class DeviceTrendPanel : MonoBehaviour
|
|
|
tempSeries[0].data.Clear();
|
|
|
tempSeries[0].data.AddRange(tempDatas);
|
|
|
StartCoroutine(CreatList(requestData,typeText));
|
|
|
+
|
|
|
+ SetPingJiaText(typeText);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
Debug.LogError(e.ToString());
|
|
|
throw;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
IEnumerator CreatList(DeviceTrendRequest deviceData,string unit)
|