|
@@ -1,12 +1,6 @@
|
|
|
package com.ruoyi.web.controller.warewms.test;
|
|
|
|
|
|
-import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
-import com.ruoyi.hard.modbus.tcp.AutoDoorClient;
|
|
|
-import com.ruoyi.hard.modbus.tcp.ButtonBoxClient;
|
|
|
import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@@ -20,102 +14,4 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/api/modbus")
|
|
|
public class ModbusTestController {
|
|
|
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AutoDoorClient autoDoorClient;
|
|
|
- @Autowired
|
|
|
- private ButtonBoxClient buttonBoxClient;
|
|
|
-
|
|
|
- /**
|
|
|
- * 写保持寄存器 开门
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("发送开门")
|
|
|
- @PostMapping("/sendOpen")
|
|
|
- public Boolean sendOpen(Boolean con) {
|
|
|
- return autoDoorClient.sendOpen(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 写保持寄存器 关门
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("发送关门")
|
|
|
- @PostMapping("/sendClose")
|
|
|
- public Boolean sendClose(Boolean con) {
|
|
|
- return autoDoorClient.sendClose(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 读保持寄存器 查询开门状态
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("查询开门状态")
|
|
|
- @PostMapping("/readOpenSts")
|
|
|
- public AjaxResult readOpenSts(Boolean con) {
|
|
|
- return autoDoorClient.readOpenSts(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 读保持寄存器 查询关门门状态
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("查询关门状态")
|
|
|
- @PostMapping("/readCloseSts")
|
|
|
- public AjaxResult readCloseSts(Boolean con) {
|
|
|
- return autoDoorClient.readCloseSts(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 写保持寄存器 开门清除标记
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("发送开门清除标记")
|
|
|
- @PostMapping("/sendOpenClear")
|
|
|
- public Boolean sendOpenClear(Boolean con) {
|
|
|
- return autoDoorClient.sendOpenClear(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 写保持寄存器 关门清除标记
|
|
|
- *
|
|
|
- * @param con true代表靠马路的自动门 false墙里面的自动门
|
|
|
- */
|
|
|
- @ApiOperation("发送关门清除标记")
|
|
|
- @PostMapping("/sendCloseClear")
|
|
|
- public Boolean sendCloseClear(Boolean con) {
|
|
|
- return autoDoorClient.sendCloseClear(con);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 读按钮盒
|
|
|
- */
|
|
|
- @ApiOperation("读按钮盒")
|
|
|
- @PostMapping("/btnR")
|
|
|
- public void btnR(int slaveId, int offset, int len) {
|
|
|
- buttonBoxClient.read(slaveId, offset, len);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 读按钮盒Num
|
|
|
- */
|
|
|
- @ApiOperation("读按钮盒Num")
|
|
|
- @PostMapping("/btnRNum")
|
|
|
- public void btnRNum(int slaveId, int offset) {
|
|
|
- buttonBoxClient.readNum(slaveId, offset);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 写按钮盒
|
|
|
- */
|
|
|
- @ApiOperation("写按钮盒")
|
|
|
- @PostMapping("/btnW")
|
|
|
- public Boolean btnW(int slaveId, int offset, int value) {
|
|
|
- return buttonBoxClient.write(slaveId, offset, value);
|
|
|
- }
|
|
|
}
|