Commit 8eadab49 authored by wanghao's avatar wanghao

1 批量读取 设备层状态

parent d3c955a8
...@@ -80,6 +80,14 @@ public class TStoreyInfoController extends BaseController ...@@ -80,6 +80,14 @@ public class TStoreyInfoController extends BaseController
return tStoreyInfoService.powerOutage(tStoreyInfo); return tStoreyInfoService.powerOutage(tStoreyInfo);
} }
/**
* 批量读取老化柜状态
*/
@GetMapping(value = "/batchReadingCabinetStatus")
public AjaxResult batchReadingCabinetStatus(String fEquipmentCode) {
return tStoreyInfoService.batchReadingCabinetStatus(fEquipmentCode);
}
/** /**
* 获取老化层信息详细信息 * 获取老化层信息详细信息
*/ */
......
...@@ -43,6 +43,8 @@ public interface ITStoreyInfoService ...@@ -43,6 +43,8 @@ public interface ITStoreyInfoService
public AjaxResult powerOutage(TStoreyInfo tStoreyInfo); public AjaxResult powerOutage(TStoreyInfo tStoreyInfo);
public AjaxResult batchReadingCabinetStatus(String fEquipmentCode);
/** /**
* 新增老化层信息 * 新增老化层信息
* *
......
package com.zehong.system.service.impl; package com.zehong.system.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import com.serotonin.modbus4j.ModbusMaster; import com.serotonin.modbus4j.ModbusMaster;
import com.serotonin.modbus4j.exception.ErrorResponseException; import com.serotonin.modbus4j.exception.ErrorResponseException;
...@@ -169,6 +166,32 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -169,6 +166,32 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
return tStoreyInfoMapper.queryByDepartmentId(fEquipmentId); return tStoreyInfoMapper.queryByDepartmentId(fEquipmentId);
} }
/**
* 批量读取设备状态
* @param fEquipmentCode f
* @return r
*/
@Override
public AjaxResult batchReadingCabinetStatus(String fEquipmentCode) {
TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoByCode(fEquipmentCode);
if(tEquipmentInfo == null) {
return AjaxResult.error("设备不存在!!!");
}
List<Integer> integers = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
try {
ModbusMaster master = Modbus4jUtils.getMaster(tEquipmentInfo.getfPowerOutageIp(), tEquipmentInfo.getfPowerOutagePort());
Map<Integer, Object> integerObjectMap = Modbus4jUtils.batchReadAgingCabinetStatus(master, integers);
return AjaxResult.success(integerObjectMap);
} catch (ModbusInitException | ModbusTransportException | ErrorResponseException e) {
throw new RuntimeException(e);
}
}
/** /**
* 给设备断电 * 给设备断电
* @param tStoreyInfo t * @param tStoreyInfo t
......
...@@ -76,3 +76,10 @@ export function PowerOutage( query) { ...@@ -76,3 +76,10 @@ export function PowerOutage( query) {
params: query params: query
}) })
} }
export function batchReadingCabinetStatus(fEquipmentCode) {
return request({
url: '/storey/batchReadingCabinetStatus/' + fEquipmentCode,
method: 'get'
})
}
...@@ -54,6 +54,15 @@ ...@@ -54,6 +54,15 @@
@click="handleExport" @click="handleExport"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-reading"
size="mini"
@click="handleReading"
>批量读取设备状态</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -175,7 +184,7 @@ ...@@ -175,7 +184,7 @@
</template> </template>
<script> <script>
import { listStorey, getStorey, delStorey, addStorey, updateStorey, exportStorey,PowerOn,PowerOutage } from "@/api/storey/storey"; import { listStorey, getStorey, delStorey, addStorey, updateStorey, exportStorey,PowerOn,PowerOutage ,batchReadingCabinetStatus} from "@/api/storey/storey";
export default { export default {
name: "Info", name: "Info",
...@@ -366,6 +375,23 @@ export default { ...@@ -366,6 +375,23 @@ export default {
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
handleReading() {
this.$prompt('请输入老化柜编号', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({ value }) => {
batchReadingCabinetStatus(value).then(response => {
if(response.code === 200) {
this.msgSuccess("msg = " + response.data);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消输入'
});
});
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment