|
|
@@ -1,7 +1,7 @@
|
|
|
<?php
|
|
|
include("./connect_sql.php");
|
|
|
-$json = file_get_contents('../../r03/display_info.json');
|
|
|
-$display_info = json_decode($json, true);
|
|
|
+$json = file_get_contents('../../r03/equipment_list.json');
|
|
|
+$equipment_list = json_decode($json, true);
|
|
|
$type = "";
|
|
|
$normal_count = 0;
|
|
|
$abnormal_count = 0;
|
|
|
@@ -11,7 +11,7 @@ $wellTBA = [];
|
|
|
if (isset($_GET["type"])) {
|
|
|
$type = $_GET["type"];
|
|
|
}
|
|
|
-$key = array_search($type, array_column($display_info, 'type'));
|
|
|
+
|
|
|
switch ($type) {
|
|
|
case "SIS":
|
|
|
case "SID":
|
|
|
@@ -52,15 +52,18 @@ switch ($type) {
|
|
|
|
|
|
$fetchResult = sqlsrv_query($conn, $sql);
|
|
|
while ($row = sqlsrv_fetch_array($fetchResult, SQLSRV_FETCH_NUMERIC)) {
|
|
|
- array_push($wellTBA,$row);
|
|
|
- $abnormal_count++;
|
|
|
+ if (in_array($row[0], $equipment_list[$type])) {
|
|
|
+ array_push($wellTBA, $row);
|
|
|
+ $abnormal_count++;
|
|
|
+ }
|
|
|
}
|
|
|
$all_count = 0;
|
|
|
-$sql = "SELECT [EquipmentID] FROM [BIMMonitor].[dbo].[{$type}_Data] GROUP BY [EquipmentID];";
|
|
|
+/*$sql = "SELECT [EquipmentID] FROM [BIMMonitor].[dbo].[{$type}_Data] GROUP BY [EquipmentID];";
|
|
|
$fetchResult = sqlsrv_query($conn, $sql);
|
|
|
while ($row = sqlsrv_fetch_array($fetchResult, SQLSRV_FETCH_NUMERIC)) {
|
|
|
$all_count++;
|
|
|
-}
|
|
|
+}*/
|
|
|
+$all_count = count($equipment_list[$type]);
|
|
|
$normal_count = $all_count - $abnormal_count;
|
|
|
if ($fetchResult === false) {
|
|
|
if (($errors = sqlsrv_errors()) != null) {
|