Commit f8c178a3 authored by wanghao's avatar wanghao

1 给层单独设置 上电 断电 命令

parent 19078cc7
...@@ -72,6 +72,14 @@ public class TStoreyInfoController extends BaseController ...@@ -72,6 +72,14 @@ public class TStoreyInfoController extends BaseController
return tStoreyInfoService.powerOn(tStoreyInfo); return tStoreyInfoService.powerOn(tStoreyInfo);
} }
/**
* 给设备上电
*/
@GetMapping(value = "/powerOutage")
public AjaxResult powerOutage(TStoreyInfo tStoreyInfo) {
return tStoreyInfoService.powerOutage(tStoreyInfo);
}
/** /**
* 获取老化层信息详细信息 * 获取老化层信息详细信息
*/ */
......
...@@ -41,6 +41,8 @@ public interface ITStoreyInfoService ...@@ -41,6 +41,8 @@ public interface ITStoreyInfoService
public AjaxResult powerOn(TStoreyInfo tStoreyInfo); public AjaxResult powerOn(TStoreyInfo tStoreyInfo);
public AjaxResult powerOutage(TStoreyInfo tStoreyInfo);
/** /**
* 新增老化层信息 * 新增老化层信息
* *
......
...@@ -169,6 +169,39 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService ...@@ -169,6 +169,39 @@ public class TStoreyInfoServiceImpl implements ITStoreyInfoService
return tStoreyInfoMapper.queryByDepartmentId(fEquipmentId); return tStoreyInfoMapper.queryByDepartmentId(fEquipmentId);
} }
/**
* 给设备断电
* @param tStoreyInfo t
* @return r
*/
@Override
public AjaxResult powerOutage(TStoreyInfo tStoreyInfo) {
if(tStoreyInfo.getfEquipmentId() == null || tStoreyInfo.getfStoreyCode() == null) {
return AjaxResult.error("参数异常!!!");
}
TEquipmentInfo tEquipmentInfo = equipmentInfoMapper.selectTEquipmentInfoById(tStoreyInfo.getfEquipmentId());
String registerOffset = tStoreyInfo.getfStoreyCode().split("-")[1];
try {
ModbusMaster master = Modbus4jUtils.getMaster(tEquipmentInfo.getfPowerOutageIp(), tEquipmentInfo.getfPowerOutagePort());
Boolean aBoolean = Modbus4jUtils.readCoilStatus(master, 1, Integer.parseInt(registerOffset));
if(aBoolean) {
Modbus4jUtils.writeCoil(master, 1, Integer.parseInt(registerOffset), false);
tStoreyInfo.setfStatus("0");
tStoreyInfo.setfAgingStartTime(null);
tStoreyInfoMapper.updateTStoreyInfo(tStoreyInfo);
}
return AjaxResult.success();
} catch (ModbusInitException | ModbusTransportException | ErrorResponseException e) {
throw new RuntimeException(e);
}
}
/** /**
* 给设备上电 * 给设备上电
* @param tStoreyInfo t * @param tStoreyInfo t
......
...@@ -68,3 +68,11 @@ export function PowerOn(query) { ...@@ -68,3 +68,11 @@ export function PowerOn(query) {
params: query params: query
}) })
} }
export function PowerOutage( query) {
return request({
url: '/storey/powerOutage',
method: 'get',
params: query
})
}
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
</template> </template>
<script> <script>
import { listStorey, getStorey, delStorey, addStorey, updateStorey, exportStorey,PowerOn } from "@/api/storey/storey"; import { listStorey, getStorey, delStorey, addStorey, updateStorey, exportStorey,PowerOn,PowerOutage } from "@/api/storey/storey";
export default { export default {
name: "Info", name: "Info",
...@@ -340,7 +340,17 @@ export default { ...@@ -340,7 +340,17 @@ export default {
}, },
// 断电 // 断电
handlePowerOutage(row) { handlePowerOutage(row) {
const fIp = row.fIp;
this.$confirm('是否确认给设备IP为"' + fIp + '"的设备断电?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return PowerOutage(row);
}).then(() => {
this.getList();
this.msgSuccess("上电成功");
}).catch(() => {});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
......
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