|
@@ -21,18 +21,40 @@ class OpcDataController extends Controller
|
|
'hoist' => 7
|
|
'hoist' => 7
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ protected $localConf = [
|
|
|
|
+ 'jinjiaqu' => [
|
|
|
|
+ 'ventilation_zb' => 1,
|
|
|
|
+ 'ventilation_bb' => 2,
|
|
|
|
+ 'pump_zy' => 3,
|
|
|
|
+ 'pump_690' => 4,
|
|
|
|
+ 'compressed_air' => 5,
|
|
|
|
+ 'belt_13' => 6,
|
|
|
|
+ 'hoist' => 7
|
|
|
|
+ ],
|
|
|
|
+
|
|
|
|
+ 'shicaocun' => [
|
|
|
|
+ 'fan_1' => 1,
|
|
|
|
+ 'fan_2' => 2,
|
|
|
|
+ 'pump_zy' => 3,
|
|
|
|
+ 'pump_690' => 4,
|
|
|
|
+ 'compressed_air' => 5,
|
|
|
|
+ 'belt_13' => 6,
|
|
|
|
+ 'hoist' => 7
|
|
|
|
+ ],
|
|
|
|
+ ];
|
|
|
|
+
|
|
public function getData(Request $request)
|
|
public function getData(Request $request)
|
|
{
|
|
{
|
|
$getDataType = $request->system_type; // 获取需要的数据
|
|
$getDataType = $request->system_type; // 获取需要的数据
|
|
$getMineCode = $request->mine_code; // 矿分类
|
|
$getMineCode = $request->mine_code; // 矿分类
|
|
$dataArr = array(); // 返回数据数组
|
|
$dataArr = array(); // 返回数据数组
|
|
|
|
|
|
- $opcConnectName = 'mysql_opc_jinjiaqu';
|
|
|
|
|
|
+ $opcConnectName = 'mysql_opc_'.$getMineCode;
|
|
|
|
|
|
$opcDB = DB::connection($opcConnectName);
|
|
$opcDB = DB::connection($opcConnectName);
|
|
|
|
|
|
- if (array_key_exists($getDataType, $this->opcConf)) {
|
|
|
|
- $groupId = $this->opcConf[$getDataType];
|
|
|
|
|
|
+ if (array_key_exists($getDataType, $this->localConf[$getMineCode])) {
|
|
|
|
+ $groupId = $this->localConf[$getMineCode][$getDataType];
|
|
$sqlStr = "
|
|
$sqlStr = "
|
|
select t1.dev_type_id,
|
|
select t1.dev_type_id,
|
|
t1.dev_type_name,
|
|
t1.dev_type_name,
|
|
@@ -82,6 +104,15 @@ class OpcDataController extends Controller
|
|
// 提升机
|
|
// 提升机
|
|
$result = $this->getHoistData($dbResult);
|
|
$result = $this->getHoistData($dbResult);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
|
|
+ case 'fan_1':
|
|
|
|
+ // 风机1
|
|
|
|
+ $result = $this->getFanData($dbResult);
|
|
|
|
+ break;
|
|
|
|
+ case 'fan_2':
|
|
|
|
+ // 风机1
|
|
|
|
+ $result = $this->getFanData($dbResult);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
return response()->json($result);
|
|
return response()->json($result);
|
|
}
|
|
}
|