opt:修改车辆首页信息,车辆信息,故障信息。
This commit is contained in:
@@ -17,9 +17,16 @@ public enum VehicleOperateEnum{
|
|||||||
OFF("关机", "1"),
|
OFF("关机", "1"),
|
||||||
SCREEN("显示屏控制", "2"),
|
SCREEN("显示屏控制", "2"),
|
||||||
TCS("TCS控制", "3"),
|
TCS("TCS控制", "3"),
|
||||||
RC("RC控制", "4"),
|
SCHE("SCHE控制", "4"),
|
||||||
JOY("Joy控制", "5"),
|
RC("RC控制", "5"),
|
||||||
OTHER("其他", "6");
|
JOY("Joy控制", "6"),
|
||||||
|
QUITNOW("退出", "7"),
|
||||||
|
REBORNINIT("软启动", "8"),
|
||||||
|
STARTCHECK("跳过起点", "9"),
|
||||||
|
REBOOT("重启", "10"),
|
||||||
|
FULL("全屏", "11"),
|
||||||
|
SKIPPLATE("跳过检测", "12"),
|
||||||
|
OTHER("其他", "13");
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.nl.agv.rest;
|
package org.nl.agv.rest;
|
||||||
|
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -27,13 +26,14 @@ import java.util.Map;
|
|||||||
@RequestMapping("/api/vehicle")
|
@RequestMapping("/api/vehicle")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public class VehicleInfoController {
|
public class VehicleInfoController{
|
||||||
private final VehicleInfoService vehicleInfoService;
|
private final VehicleInfoService vehicleInfoService;
|
||||||
|
|
||||||
@PostMapping("/queryRestPoint")
|
@PostMapping("/queryRestPoint")
|
||||||
@Log("车辆信息查询初始化坐标")
|
@Log("车辆信息查询初始化坐标")
|
||||||
@ApiOperation("车辆信息查询初始化坐标")
|
@ApiOperation("车辆信息查询初始化坐标")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> getIP(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> getIP(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.queryRestPoint(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.queryRestPoint(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,14 +41,15 @@ public class VehicleInfoController {
|
|||||||
@Log("初始化坐标确定")
|
@Log("初始化坐标确定")
|
||||||
@ApiOperation("初始化坐标确定")
|
@ApiOperation("初始化坐标确定")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> restCoordinate(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> restCoordinate(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.restCoordinate(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.restCoordinate(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/Shut_down")
|
@PostMapping("/Shut_down")
|
||||||
@Log("关机")
|
@Log("关机")
|
||||||
@ApiOperation("关机")
|
@ApiOperation("关机")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> Shut_down(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> Shut_down(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.Shut_down(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.Shut_down(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,56 +57,58 @@ public class VehicleInfoController {
|
|||||||
@Log("查询车辆控制按钮状态")
|
@Log("查询车辆控制按钮状态")
|
||||||
@ApiOperation("查询车辆控制按钮状态")
|
@ApiOperation("查询车辆控制按钮状态")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> queryControlStatus(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> queryControlStatus(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.queryControlStatus(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.queryControlStatus(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @PostMapping("/skipStartPoint")
|
||||||
|
// @Log("跳过起点")
|
||||||
|
// @ApiOperation("跳过起点")
|
||||||
|
// //@PreAuthorize("@el.check('sect:list')")
|
||||||
|
// public ResponseEntity<Object> skipStartPoint(@RequestBody Map<String,String> whereJson) {
|
||||||
|
// return new ResponseEntity<>(vehicleInfoService.skipStartPoint(whereJson), HttpStatus.OK);
|
||||||
|
// }
|
||||||
|
|
||||||
@PostMapping("/skipStartPoint")
|
// @PostMapping("/softStart")
|
||||||
@Log("跳过起点")
|
// @Log("软启动")
|
||||||
@ApiOperation("跳过起点")
|
// @ApiOperation("软启动")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
// //@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> skipStartPoint(@RequestBody Map<String, String> whereJson) {
|
// public ResponseEntity<Object> softStart(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.skipStartPoint(whereJson), HttpStatus.OK);
|
// return new ResponseEntity<>(vehicleInfoService.softStart(whereJson), HttpStatus.OK);
|
||||||
}
|
// }
|
||||||
@PostMapping("/softStart")
|
|
||||||
@Log("软启动")
|
// @PostMapping("/quitNow")
|
||||||
@ApiOperation("软启动")
|
// @Log("退出")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
// @ApiOperation("退出")
|
||||||
public ResponseEntity<Object> softStart(@RequestBody Map<String, String> whereJson) {
|
// //@PreAuthorize("@el.check('sect:list')")
|
||||||
return new ResponseEntity<>(vehicleInfoService.softStart(whereJson), HttpStatus.OK);
|
// public ResponseEntity<Object> quitNow(@RequestBody Map<String,String> whereJson) {
|
||||||
}
|
// return new ResponseEntity<>(vehicleInfoService.quitNow(whereJson), HttpStatus.OK);
|
||||||
@PostMapping("/quitNow")
|
// }
|
||||||
@Log("退出")
|
|
||||||
@ApiOperation("退出")
|
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
|
||||||
public ResponseEntity<Object> quitNow(@RequestBody Map<String, String> whereJson) {
|
|
||||||
return new ResponseEntity<>(vehicleInfoService.quitNow(whereJson), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/queryVehicleStatus")
|
@PostMapping("/queryVehicleStatus")
|
||||||
@Log("查询车辆状态")
|
@Log("查询车辆状态")
|
||||||
@ApiOperation("查询车辆状态")
|
@ApiOperation("查询车辆状态")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> queryVehicleStatus(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> queryVehicleStatus(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.queryVehicleStatus(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.queryVehicleStatus(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/querrySensor")
|
@PostMapping("/querrySensor")
|
||||||
@Log("查询传感器状态")
|
@Log("查询传感器状态")
|
||||||
@ApiOperation("查询传感器状态")
|
@ApiOperation("查询传感器状态")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> querrySensor(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> querrySensor(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.querrySensor(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.querrySensor(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/queryAgv_Status")
|
@PostMapping("/queryAgv_Status")
|
||||||
@Log("查询agv状态")
|
@Log("查询agv状态")
|
||||||
@ApiOperation("查询agv状态")
|
@ApiOperation("查询agv状态")
|
||||||
//@PreAuthorize("@el.check('sect:list')")
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
public ResponseEntity<Object> queryAgv_Status(@RequestBody Map<String, String> whereJson) {
|
public ResponseEntity<Object> queryAgv_Status(@RequestBody Map<String,String> whereJson) {
|
||||||
return new ResponseEntity<>(vehicleInfoService.queryAgv_Status(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(vehicleInfoService.queryAgv_Status(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,17 @@ import jline.internal.Log;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.agv.service.ErrorService;
|
import org.nl.agv.service.ErrorService;
|
||||||
|
import org.nl.agv.unit.sendToAgvUtil;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhanghouying
|
* @author zhanghouying
|
||||||
@@ -39,8 +44,44 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ErrorServiceImpl implements ErrorService{
|
public class ErrorServiceImpl implements ErrorService{
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> querryError(Map<String,String> jsonObject) {
|
public Map<String,Object> querryError(Map<String,String> jsonObject) {
|
||||||
|
String error_status = "无故障";
|
||||||
|
try {
|
||||||
|
List<String> errorCodeList = new ArrayList<>();
|
||||||
|
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
||||||
|
int Warning_Code = debugInfoJson.getInteger("Warning_Code");
|
||||||
|
Warning_Code = 754529;
|
||||||
|
JSONArray result = new JSONArray();
|
||||||
|
for (int bitPosition = 0; bitPosition < 28; bitPosition++) {
|
||||||
|
if ((Warning_Code >> bitPosition) % 2 == 1) {
|
||||||
|
error_status = "有故障";
|
||||||
|
String error_code = "bit" + bitPosition;
|
||||||
|
errorCodeList.add(error_code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_agv_error");
|
||||||
|
String errorCodes = errorCodeList.stream().collect(Collectors.joining("', '", "'", "'"));
|
||||||
|
result = wo.query("error_code in ("+errorCodes+") order by error_code").getResultJSONArray(0);
|
||||||
|
JSONObject returnjo = new JSONObject();
|
||||||
|
returnjo.put("code", "1");
|
||||||
|
returnjo.put("desc", "查询成功");
|
||||||
|
returnjo.put("result", result);
|
||||||
|
returnjo.put("error_status", error_status);
|
||||||
|
return returnjo;
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
Log.error("通信失败:" + e.getMessage());
|
||||||
|
throw new BadRequestException(e.getMessage() == null ? "通信失败,请检查系统参数中的Ros连接信息" : e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
public Map<String,Object> querryError1(Map<String,String> jsonObject) {
|
||||||
String error_status = "无故障";
|
String error_status = "无故障";
|
||||||
try {
|
try {
|
||||||
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
||||||
@@ -53,87 +94,55 @@ public class ErrorServiceImpl implements ErrorService{
|
|||||||
if(Warning_Code % 2 == 1) {
|
if(Warning_Code % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "barrier";
|
error_code = "barrier";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//bit1 起点报警 startPoint
|
//bit1 起点报警 startPoint
|
||||||
if((Warning_Code >> 2) % 2 == 1) {
|
if((Warning_Code >> 2) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "startPoint";
|
error_code = "startPoint";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//bit2 急停开关报警 stop
|
//bit2 急停开关报警 stop
|
||||||
if((Warning_Code >> 10) % 2 == 1) {
|
if((Warning_Code >> 10) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "stop";
|
error_code = "stop";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//bit3 触边开关报警 touchSwith
|
//bit3 触边开关报警 touchSwith
|
||||||
if((ObstacleTouchState >> 1) % 2 == 1) {
|
if((ObstacleTouchState >> 1) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "touchSwith";
|
error_code = "touchSwith";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//bit0 速度异常 speedError
|
//bit0 速度异常 speedError
|
||||||
if((Warning_Code >> 6) % 2 == 1) {
|
if((Warning_Code >> 6) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "speedError";
|
error_code = "speedError";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
} //bit0 定位异常 locationError
|
} //bit0 定位异常 locationError
|
||||||
if((Warning_Code >> 7) % 2 == 1) {
|
if((Warning_Code >> 7) % 2 == 1) {
|
||||||
error_status = "是";
|
error_status = "是";
|
||||||
error_code = "startPoint";
|
error_code = "startPoint";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//bit0 路径异常 wayError
|
//bit0 路径异常 wayError
|
||||||
if((Warning_Code >> 8) % 2 == 1) {
|
if((Warning_Code >> 8) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "wayError";
|
error_code = "wayError";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
//电池异常 batteryError
|
//电池异常 batteryError
|
||||||
if((Warning_Code >> 11) % 2 == 1) {
|
if((Warning_Code >> 11) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "batteryError";
|
error_code = "batteryError";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
row.put("error_content", debugInfoJson.getString("PWR_Warn"));
|
row.put("error_content", debugInfoJson.getString("PWR_Warn"));
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
@@ -141,11 +150,7 @@ public class ErrorServiceImpl implements ErrorService{
|
|||||||
if((Warning_Code >> 24) % 2 == 1) {
|
if((Warning_Code >> 24) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "CURTIS";
|
error_code = "CURTIS";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
row.put("error_content", debugInfoJson.getString("Curtis_Warning_Code_Speed"));
|
row.put("error_content", debugInfoJson.getString("Curtis_Warning_Code_Speed"));
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
@@ -153,11 +158,7 @@ public class ErrorServiceImpl implements ErrorService{
|
|||||||
if((Warning_Code >> 19) % 2 == 1) {
|
if((Warning_Code >> 19) % 2 == 1) {
|
||||||
error_status = "有故障";
|
error_status = "有故障";
|
||||||
error_code = "CAN";
|
error_code = "CAN";
|
||||||
JSONObject row = WQL
|
JSONObject row = WQL.getWO("QAGVERROR").addParam("flag", "1").addParam("error_code", error_code).process().uniqueResult(0);
|
||||||
.getWO("QAGVERROR")
|
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("error_code", error_code)
|
|
||||||
.process().uniqueResult(0);
|
|
||||||
row.put("error_content", debugInfoJson.getString("VehicleCtrl_CAN_Err_Info"));
|
row.put("error_content", debugInfoJson.getString("VehicleCtrl_CAN_Err_Info"));
|
||||||
ja.add(row);
|
ja.add(row);
|
||||||
}
|
}
|
||||||
@@ -170,7 +171,7 @@ public class ErrorServiceImpl implements ErrorService{
|
|||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
Log.error("通信失败:" + e.getMessage());
|
Log.error("通信失败:" + e.getMessage());
|
||||||
throw new BadRequestException( e.getMessage()==null?"通信失败,请检查系统参数中的Ros连接信息":e.getMessage());
|
throw new BadRequestException(e.getMessage() == null ? "通信失败,请检查系统参数中的Ros连接信息" : e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.agv.service.impl;
|
package org.nl.agv.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -55,15 +56,18 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
public void qeryDebuggerInfo() {
|
public void qeryDebuggerInfo() {
|
||||||
try {
|
try {
|
||||||
Map<String,String> urlInfo = RosUtil.getRosHostInfo();
|
Map<String,String> urlInfo = RosUtil.getRosHostInfo();
|
||||||
String result1 = HttpUtil.get(urlInfo.get("javaUrl"));
|
String result1 = HttpUtil.get("http://localhost:8011/api/pcsIfPurchaseorder/queryApt");
|
||||||
|
//String result1 = HttpUtil.get(urlInfo.get("javaUrl"));
|
||||||
JSONObject json = JSONObject.parseObject(result1);
|
JSONObject json = JSONObject.parseObject(result1);
|
||||||
JSONObject jo = JSONObject.parseObject(json.getString("Msg_DisplayState"));
|
JSONObject jo = JSONObject.parseObject(json.getString("Msg_DisplayState"));
|
||||||
debugInfoJson.put("Msg_Timestamp", jo
|
debugInfoJson.put("Msg_Timestamp", jo.getJSONObject("header").getJSONObject("stamp").getString("sec"));
|
||||||
.getJSONObject("header")
|
|
||||||
.getJSONObject("stamp")
|
|
||||||
.getString("sec"));
|
|
||||||
debugInfoJson.put("AGV_ID", jo.getString("AGV_ID"));
|
debugInfoJson.put("AGV_ID", jo.getString("AGV_ID"));
|
||||||
debugInfoJson.put("Sys_Mode", jo.getString("Sys_Mode"));
|
debugInfoJson.put("Sys_Mode", jo.getString("Sys_Mode"));
|
||||||
|
debugInfoJson.put("screen", jo.getString("Remote_Or_HMI_Ctrl"));
|
||||||
|
debugInfoJson.put("tcs", jo.getString("CAD_Or_TCS_Ctrl"));
|
||||||
|
debugInfoJson.put("sche", jo.getString("Sche_JSON_Sche_Enable"));
|
||||||
|
debugInfoJson.put("rc", jo.getString("VehicleCtrlRealRCEnable"));
|
||||||
|
debugInfoJson.put("joy", jo.getString("VehicleCtrlRealJoyEnable"));
|
||||||
debugInfoJson.put("VehicleCtrlExpThrottle", jo.getString("VehicleCtrlExpThrottle"));
|
debugInfoJson.put("VehicleCtrlExpThrottle", jo.getString("VehicleCtrlExpThrottle"));
|
||||||
debugInfoJson.put("Warning_Code", jo.getString("Warning_Code"));
|
debugInfoJson.put("Warning_Code", jo.getString("Warning_Code"));
|
||||||
debugInfoJson.put("Car_Global_rx", jo.getString("Car_Global_rx"));
|
debugInfoJson.put("Car_Global_rx", jo.getString("Car_Global_rx"));
|
||||||
@@ -108,17 +112,12 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
debugInfoJson.put("Env_SoftwareVersion", jo.getString("Env_SoftwareVersion"));
|
debugInfoJson.put("Env_SoftwareVersion", jo.getString("Env_SoftwareVersion"));
|
||||||
String PathFollow_Enable = jo.getString("PathFollow_Enable");
|
String PathFollow_Enable = jo.getString("PathFollow_Enable");
|
||||||
if(StrUtil.equals("0", PathFollow_Enable)) {
|
if(StrUtil.equals("0", PathFollow_Enable)) {
|
||||||
JSONObject taskjo = WQLObject
|
JSONObject taskjo = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete='0'and task_status='01'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete='0'and task_status='01'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isNotEmpty(taskjo)) {
|
if(ObjectUtil.isNotEmpty(taskjo)) {
|
||||||
taskjo.put("task_status", "02");
|
taskjo.put("task_status", "02");
|
||||||
taskjo.put("task_status_name", "任务完成");
|
taskjo.put("task_status_name", "任务完成");
|
||||||
taskjo.put("update_time", DateUtil.now());
|
taskjo.put("update_time", DateUtil.now());
|
||||||
WQLObject
|
WQLObject.getWQLObject("ST_TASK_INFO").update(taskjo);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.update(taskjo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debugInfoJson.put("PathFollow_Enable", PathFollow_Enable);
|
debugInfoJson.put("PathFollow_Enable", PathFollow_Enable);
|
||||||
@@ -138,10 +137,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
JSONObject jo = JSONObject.parseObject(message.toString());
|
JSONObject jo = JSONObject.parseObject(message.toString());
|
||||||
debugInfoJson.put("Msg_Timestamp", jo
|
debugInfoJson.put("Msg_Timestamp", jo.getJSONObject("header").getJSONObject("stamp").getString("secs"));
|
||||||
.getJSONObject("header")
|
|
||||||
.getJSONObject("stamp")
|
|
||||||
.getString("secs"));
|
|
||||||
debugInfoJson.put("AGV_ID", jo.getString("AGV_ID"));
|
debugInfoJson.put("AGV_ID", jo.getString("AGV_ID"));
|
||||||
debugInfoJson.put("Sys_Mode", jo.getString("Sys_Mode"));
|
debugInfoJson.put("Sys_Mode", jo.getString("Sys_Mode"));
|
||||||
debugInfoJson.put("VehicleCtrlExpThrottle", jo.getString("VehicleCtrlExpThrottle"));
|
debugInfoJson.put("VehicleCtrlExpThrottle", jo.getString("VehicleCtrlExpThrottle"));
|
||||||
@@ -188,17 +184,12 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
debugInfoJson.put("Env_SoftwareVersion", jo.getString("Env_SoftwareVersion"));
|
debugInfoJson.put("Env_SoftwareVersion", jo.getString("Env_SoftwareVersion"));
|
||||||
String PathFollow_Enable = jo.getString("PathFollow_Enable");
|
String PathFollow_Enable = jo.getString("PathFollow_Enable");
|
||||||
if(StrUtil.equals("false", PathFollow_Enable)) {
|
if(StrUtil.equals("false", PathFollow_Enable)) {
|
||||||
JSONObject taskjo = WQLObject
|
JSONObject taskjo = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete='0'and task_status='01'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete='0'and task_status='01'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isNotEmpty(taskjo)) {
|
if(ObjectUtil.isNotEmpty(taskjo)) {
|
||||||
taskjo.put("task_status", "02");
|
taskjo.put("task_status", "02");
|
||||||
taskjo.put("task_status_name", "任务完成");
|
taskjo.put("task_status_name", "任务完成");
|
||||||
taskjo.put("update_time", DateUtil.now());
|
taskjo.put("update_time", DateUtil.now());
|
||||||
WQLObject
|
WQLObject.getWQLObject("ST_TASK_INFO").update(taskjo);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.update(taskjo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debugInfoJson.put("PathFollow_Enable", PathFollow_Enable);
|
debugInfoJson.put("PathFollow_Enable", PathFollow_Enable);
|
||||||
@@ -226,13 +217,13 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
//手自动是Sys_Mode 3 REMA手动 4自动 5 IO手持方式的手动,这个车不装
|
//手自动是Sys_Mode 3 REMA手动 4自动 5 IO手持方式的手动,这个车不装
|
||||||
String automatic_status = debugInfoJson.getString("Sys_Mode");
|
String automatic_status = debugInfoJson.getString("Sys_Mode");
|
||||||
if(StrUtil.equals(automatic_status, "3")) {
|
if(StrUtil.equals(automatic_status, "3")) {
|
||||||
automatic_status_name = "REMA手动";
|
agvrun_status_name = "REMA手动";
|
||||||
}
|
}
|
||||||
if(StrUtil.equals(automatic_status, "4")) {
|
if(StrUtil.equals(automatic_status, "4")) {
|
||||||
automatic_status_name = "自动";
|
agvrun_status_name = "自动";
|
||||||
}
|
}
|
||||||
if(StrUtil.equals(automatic_status, "5")) {
|
if(StrUtil.equals(automatic_status, "5")) {
|
||||||
automatic_status_name = "IO手持方式的手动";
|
agvrun_status_name = "IO手持方式的手动";
|
||||||
}
|
}
|
||||||
result.put("agvrun_status", agvrun_status);
|
result.put("agvrun_status", agvrun_status);
|
||||||
result.put("agvrun_status_name", agvrun_status_name);
|
result.put("agvrun_status_name", agvrun_status_name);
|
||||||
@@ -245,42 +236,36 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object>queryHomePage(Map<String,String> jsonObject) {
|
public Map<String,Object> queryHomePage(Map<String,String> jsonObject) {
|
||||||
String button_code = "";
|
String button_code = "";
|
||||||
String button_name = "";
|
String button_name = "";
|
||||||
|
String agvrun_status_name = "";
|
||||||
|
String automatic_status_name = "";
|
||||||
|
String device_info = "";
|
||||||
|
String task_name = "";
|
||||||
Integer electric = 0;
|
Integer electric = 0;
|
||||||
|
String speed = "";
|
||||||
|
String error_name = "正常运行";
|
||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
JSONObject row = new JSONObject();
|
JSONObject row = new JSONObject();
|
||||||
try {
|
try {
|
||||||
JSONObject tasking = WQLObject
|
JSONObject tasking = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_status='01' and task_type='1'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_status='01' and task_type='1'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
// 1 无任务 2 有任务未执行 3 执行中
|
// 1 无任务 2 有任务未执行 3 执行中
|
||||||
String task_status = "";
|
String task_status = "";
|
||||||
//1确认完成 2确认完成继续下个任务 3继续搬运,4返回休息点
|
//1确认完成 2确认完成继续下个任务 3继续搬运,4返回休息点
|
||||||
String date = DateUtil.today();
|
String date = DateUtil.today();
|
||||||
JSONObject today_task = WQLObject
|
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and date='" + date + "'and task_type='1'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(tasking == null) {
|
if(tasking == null) {
|
||||||
task_status = "无任务";
|
task_status = "无任务";
|
||||||
}
|
}
|
||||||
JSONObject tasked = WQLObject
|
JSONObject tasked = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_status='00'and task_type='1'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_status='00'and task_type='1'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(tasked != null) {
|
if(tasked != null) {
|
||||||
task_status = "有任务未执行";
|
task_status = "有任务未执行";
|
||||||
}
|
}
|
||||||
if(tasking != null) {
|
if(tasking != null) {
|
||||||
task_status = "执行中";
|
task_status = "执行中";
|
||||||
|
task_name = "任务号:" + tasking.getString("task_code") + "-" + "目标点:" + tasking.getString("next_point_code");
|
||||||
}
|
}
|
||||||
JSONObject unManFinishTask = WQLObject
|
JSONObject unManFinishTask = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_status='02' and is_manualfinished='0'and task_type='1'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_status='02' and is_manualfinished='0'and task_type='1'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(unManFinishTask != null && tasked == null) {
|
if(unManFinishTask != null && tasked == null) {
|
||||||
button_code = "1";
|
button_code = "1";
|
||||||
button_name = "确认完成";
|
button_name = "确认完成";
|
||||||
@@ -298,62 +283,90 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
button_code = "4";
|
button_code = "4";
|
||||||
button_name = "返回休息点";
|
button_name = "返回休息点";
|
||||||
//假如所有的任务都完成,包括返回休息点的任务,且最后一个完成任务的时间是返回休息电的任务也不显示
|
//假如所有的任务都完成,包括返回休息点的任务,且最后一个完成任务的时间是返回休息电的任务也不显示
|
||||||
JSONObject doingtaskjo = WQLObject
|
JSONObject doingtaskjo = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 ", "update_time desc").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
if(doingtaskjo != null && doingtaskjo.getString("task_type").equals("2")) {
|
||||||
.query("is_delete= 0 ", "update_time desc")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(doingtaskjo != null && doingtaskjo
|
|
||||||
.getString("task_type")
|
|
||||||
.equals("2")) {
|
|
||||||
button_code = "";
|
button_code = "";
|
||||||
button_name = "";
|
button_name = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//假如有执行中的任务,则不显示
|
//假如有执行中的任务,则不显示
|
||||||
JSONObject doingtaskjo = WQLObject
|
JSONObject doingtaskjo = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_status='01' and is_manualfinished='0'").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_status='01' and is_manualfinished='0'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(doingtaskjo != null) {
|
if(doingtaskjo != null) {
|
||||||
button_code = "";
|
button_code = "";
|
||||||
button_name = "";
|
button_name = "";
|
||||||
}
|
}
|
||||||
if(debugInfoJson.size() > 0) {
|
|
||||||
//假如电量低于30 ,则返回休息电
|
|
||||||
electric = debugInfoJson.getInteger("PWR_Percent");
|
|
||||||
if(electric < 30) {
|
|
||||||
button_code = "4";
|
|
||||||
button_name = "返回休息点";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String task_num = "待执行0";
|
String task_num = "待执行0";
|
||||||
//分母 今天所有的任务,分子今天未完成的任务
|
//分母 今天所有的任务,分子今天未完成的任务
|
||||||
JSONArray alltaskja = WQLObject
|
JSONArray alltaskja = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_type='1' and date ='" + date + "'").getResultJSONArray(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_type='1' and date ='" + date + "'")
|
|
||||||
.getResultJSONArray(0);
|
|
||||||
if(alltaskja.size() > 0) {
|
if(alltaskja.size() > 0) {
|
||||||
JSONArray todaytaskja = WQLObject
|
JSONArray todaytaskja = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_type='1' and date ='" + date + "' and task_status='00'").getResultJSONArray(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_type='1' and date ='" + date + "' and task_status='00'")
|
|
||||||
.getResultJSONArray(0);
|
|
||||||
String alltask_num = String.valueOf(alltaskja.size());
|
String alltask_num = String.valueOf(alltaskja.size());
|
||||||
String todaytask_num = String.valueOf(todaytaskja.size());
|
String todaytask_num = String.valueOf(todaytaskja.size());
|
||||||
task_num = "待执行" + todaytask_num + "/" + alltask_num;
|
task_num = "待执行" + todaytask_num + "/" + alltask_num;
|
||||||
}
|
}
|
||||||
|
if(debugInfoJson.size() > 0) {
|
||||||
|
//车辆运行还是待机是PathFollow_Enable 1为运行 0为待机
|
||||||
|
String agvrun_status = debugInfoJson.getString("PathFollow_Enable");
|
||||||
|
if(StrUtil.equals(agvrun_status, "1")) {
|
||||||
|
automatic_status_name = "运行";
|
||||||
|
}
|
||||||
|
if(StrUtil.equals(agvrun_status, "0")) {
|
||||||
|
automatic_status_name = "待机";
|
||||||
|
}
|
||||||
|
//手自动是Sys_Mode 3 REMA手动 4自动 5 IO手持方式的手动,这个车不装
|
||||||
|
String automatic_status = debugInfoJson.getString("Sys_Mode");
|
||||||
|
if(StrUtil.equals(automatic_status, "3")) {
|
||||||
|
agvrun_status_name = "REMA手动";
|
||||||
|
}
|
||||||
|
if(StrUtil.equals(automatic_status, "4")) {
|
||||||
|
agvrun_status_name = "自动";
|
||||||
|
}
|
||||||
|
if(StrUtil.equals(automatic_status, "5")) {
|
||||||
|
agvrun_status_name = "IO手持方式的手动";
|
||||||
|
}
|
||||||
|
//速度
|
||||||
|
speed = debugInfoJson.getString("Speedm_Tmp") == null ? "0" : debugInfoJson.getString("Speedm_Tmp");
|
||||||
|
row.put("speed", speed + "m/s");
|
||||||
|
//agv状态枚举
|
||||||
|
row.put("agvrun_status", agvrun_status);
|
||||||
|
//agv状态名称,1为运行 0为待机
|
||||||
|
row.put("agvrun_status_name", agvrun_status_name);
|
||||||
|
//agv操纵枚举
|
||||||
|
row.put("automatic_status", automatic_status);
|
||||||
|
//agv操纵名称,3 REMA手动 4自动
|
||||||
|
row.put("automatic_status_name", automatic_status_name);
|
||||||
|
//假如电量低于30 ,则返回休息电
|
||||||
|
electric = debugInfoJson.getInteger("PWR_Percent");
|
||||||
|
//电量
|
||||||
|
row.put("electric", electric);
|
||||||
|
if(electric < 30) {
|
||||||
|
button_code = "4";
|
||||||
|
button_name = "返回休息点";
|
||||||
|
}
|
||||||
|
String Env_CustomName = debugInfoJson.getString("Env_CustomName");
|
||||||
|
String Env_VehicleType = debugInfoJson.getString("Env_VehicleType");
|
||||||
|
//设备名称
|
||||||
|
device_info = Env_CustomName + Env_VehicleType;
|
||||||
|
}
|
||||||
ErrorServiceImpl errorServiceImpl = new ErrorServiceImpl();
|
ErrorServiceImpl errorServiceImpl = new ErrorServiceImpl();
|
||||||
//todo 此处检查
|
//todo 此处检查
|
||||||
Map error = errorServiceImpl.querryError(null);
|
Map error = errorServiceImpl.querryError(null);
|
||||||
String Env_CustomName = debugInfoJson.getString("Env_CustomName");
|
JSONArray errorResult = JSONArray.parseArray(JSON.toJSONString(error.get("result")));
|
||||||
String Env_VehicleType = debugInfoJson.getString("Env_VehicleType");
|
if(errorResult.size() > 0) {
|
||||||
String device_info = Env_CustomName + Env_VehicleType;
|
error_name = errorResult.getJSONObject(0).getString("error_name");
|
||||||
|
}
|
||||||
|
//row.put("agv_error", (String) error.get("error_status"));
|
||||||
|
//故障信息
|
||||||
|
row.put("error_name", error_name);
|
||||||
|
//设备信息
|
||||||
row.put("device_info", device_info);
|
row.put("device_info", device_info);
|
||||||
|
//任务状态
|
||||||
row.put("task_status", task_status);
|
row.put("task_status", task_status);
|
||||||
|
//当前任务
|
||||||
|
row.put("task_name", task_name);
|
||||||
row.put("task_num", task_num);
|
row.put("task_num", task_num);
|
||||||
row.put("agv_error", (String) error.get("error_status"));
|
|
||||||
row.put("button_code", button_code);
|
row.put("button_code", button_code);
|
||||||
row.put("button_name", button_name);
|
row.put("button_name", button_name);
|
||||||
row.put("electric", electric);
|
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("desc", "操作成功");
|
returnjo.put("desc", "操作成功");
|
||||||
returnjo.put("result", row);
|
returnjo.put("result", row);
|
||||||
@@ -361,7 +374,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
Log.error("通信失败:" + e.getMessage());
|
Log.error("通信失败:" + e.getMessage());
|
||||||
throw new BadRequestException( e.getMessage()==null?"通信失败,请检查系统参数中的Ros连接信息":e.getMessage());
|
throw new BadRequestException(e.getMessage() == null ? "通信失败,请检查系统参数中的Ros连接信息" : e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,9 +385,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
String button_code = (String) jsonObject.get("button_code");
|
String button_code = (String) jsonObject.get("button_code");
|
||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
if(StrUtil.equals(button_code, "1")) {
|
if(StrUtil.equals(button_code, "1")) {
|
||||||
JSONObject taskjo = taskTable
|
JSONObject taskjo = taskTable.query("is_delete='0' and task_status='02' and task_type ='1' and is_manualfinished='0'").uniqueResult(0);
|
||||||
.query("is_delete='0' and task_status='02' and task_type ='1' and is_manualfinished='0'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isEmpty(taskjo)) {
|
if(ObjectUtil.isEmpty(taskjo)) {
|
||||||
throw new BadRequestException("未找到任务");
|
throw new BadRequestException("未找到任务");
|
||||||
}
|
}
|
||||||
@@ -382,9 +393,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
taskTable.update(taskjo);
|
taskTable.update(taskjo);
|
||||||
}
|
}
|
||||||
if(StrUtil.equals(button_code, "2")) {
|
if(StrUtil.equals(button_code, "2")) {
|
||||||
JSONObject taskjo = taskTable
|
JSONObject taskjo = taskTable.query("is_delete='0' and task_status='02' and task_type ='1' and is_manualfinished='0'").uniqueResult(0);
|
||||||
.query("is_delete='0' and task_status='02' and task_type ='1' and is_manualfinished='0'")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isEmpty(taskjo)) {
|
if(ObjectUtil.isEmpty(taskjo)) {
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("desc", "未找到任务");
|
returnjo.put("desc", "未找到任务");
|
||||||
@@ -393,9 +402,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
taskjo.put("is_manualfinished", "1");
|
taskjo.put("is_manualfinished", "1");
|
||||||
taskTable.update(taskjo);
|
taskTable.update(taskjo);
|
||||||
//下发下一个任务
|
//下发下一个任务
|
||||||
JSONObject nexttaskjo = taskTable
|
JSONObject nexttaskjo = taskTable.query("is_delete='0' and task_status='00' and task_type ='1' ", "seq_num").uniqueResult(0);
|
||||||
.query("is_delete='0' and task_status='00' and task_type ='1' ", "seq_num")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isEmpty(nexttaskjo)) {
|
if(ObjectUtil.isEmpty(nexttaskjo)) {
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("desc", "未找到任务");
|
returnjo.put("desc", "未找到任务");
|
||||||
@@ -409,9 +416,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
//改变任务的状态
|
//改变任务的状态
|
||||||
nexttaskjo.put("task_status", "01");
|
nexttaskjo.put("task_status", "01");
|
||||||
nexttaskjo.put("task_status_name", "执行中");
|
nexttaskjo.put("task_status_name", "执行中");
|
||||||
WQLObject
|
WQLObject.getWQLObject("ST_TASK_INFO").update(nexttaskjo);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.update(nexttaskjo);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
@@ -420,9 +425,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StrUtil.equals(button_code, "3")) {
|
if(StrUtil.equals(button_code, "3")) {
|
||||||
JSONObject nexttaskjo = taskTable
|
JSONObject nexttaskjo = taskTable.query("is_delete='0' and task_status='00' and task_type ='1' ", "seq_num").uniqueResult(0);
|
||||||
.query("is_delete='0' and task_status='00' and task_type ='1' ", "seq_num")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isEmpty(nexttaskjo)) {
|
if(ObjectUtil.isEmpty(nexttaskjo)) {
|
||||||
throw new BadRequestException("未找到任务");
|
throw new BadRequestException("未找到任务");
|
||||||
}
|
}
|
||||||
@@ -435,9 +438,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
//改变任务的状态
|
//改变任务的状态
|
||||||
nexttaskjo.put("task_status", "01");
|
nexttaskjo.put("task_status", "01");
|
||||||
nexttaskjo.put("task_status_name", "执行中");
|
nexttaskjo.put("task_status_name", "执行中");
|
||||||
WQLObject
|
WQLObject.getWQLObject("ST_TASK_INFO").update(nexttaskjo);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.update(nexttaskjo);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
@@ -448,18 +449,13 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
if(StrUtil.equals(button_code, "4")) {
|
if(StrUtil.equals(button_code, "4")) {
|
||||||
TaskServiceServiceImpl taskServiceServiceImpl = new TaskServiceServiceImpl();
|
TaskServiceServiceImpl taskServiceServiceImpl = new TaskServiceServiceImpl();
|
||||||
//查询有没有正在执行的任务,假如有不能返回生成任务
|
//查询有没有正在执行的任务,假如有不能返回生成任务
|
||||||
JSONObject doingtaskjo = WQLObject
|
JSONObject doingtaskjo = WQLObject.getWQLObject("ST_TASK_INFO").query("is_delete= 0 and task_status='01' ").uniqueResult(0);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.query("is_delete= 0 and task_status='01' ")
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(ObjectUtil.isNotEmpty(doingtaskjo)) {
|
if(ObjectUtil.isNotEmpty(doingtaskjo)) {
|
||||||
returnjo.put("code", "0");
|
returnjo.put("code", "0");
|
||||||
returnjo.put("desc", "有正在执行的任务,不能生产返回休息点的任务");
|
returnjo.put("desc", "有正在执行的任务,不能生产返回休息点的任务");
|
||||||
return returnjo;
|
return returnjo;
|
||||||
}
|
}
|
||||||
String rest_pointcode = (String) taskServiceServiceImpl
|
String rest_pointcode = (String) taskServiceServiceImpl.queryPoint(new HashMap<>()).get("rest_pointcode");
|
||||||
.queryPoint(new HashMap<>())
|
|
||||||
.get("rest_pointcode");
|
|
||||||
JSONObject taskjo = new JSONObject();
|
JSONObject taskjo = new JSONObject();
|
||||||
taskjo.put("task_uuid", IdUtil.simpleUUID());
|
taskjo.put("task_uuid", IdUtil.simpleUUID());
|
||||||
taskjo.put("task_code", CodeUtil.getNewCode("TASK_NO"));
|
taskjo.put("task_code", CodeUtil.getNewCode("TASK_NO"));
|
||||||
@@ -488,9 +484,7 @@ public class HomeServiceImpl implements HomeService{
|
|||||||
returnjo.put("desc", TaskSendBackStatusEnum.getName(resultflag));
|
returnjo.put("desc", TaskSendBackStatusEnum.getName(resultflag));
|
||||||
return returnjo;
|
return returnjo;
|
||||||
}
|
}
|
||||||
WQLObject
|
WQLObject.getWQLObject("ST_TASK_INFO").insert(taskjo);
|
||||||
.getWQLObject("ST_TASK_INFO")
|
|
||||||
.insert(taskjo);
|
|
||||||
}
|
}
|
||||||
returnjo.put("code", "1");
|
returnjo.put("code", "1");
|
||||||
returnjo.put("desc", "操作成功");
|
returnjo.put("desc", "操作成功");
|
||||||
|
|||||||
@@ -15,22 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.agv.service.impl;
|
package org.nl.agv.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import edu.wpi.rail.jrosbridge.Ros;
|
|
||||||
import edu.wpi.rail.jrosbridge.services.ServiceResponse;
|
|
||||||
import jline.internal.Log;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.esotericsoftware.minlog.Log;
|
||||||
|
import edu.wpi.rail.jrosbridge.services.ServiceResponse;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.agv.enu.VehicleOperateEnum;
|
import org.nl.agv.enu.VehicleOperateEnum;
|
||||||
import org.nl.agv.unit.RosUtil;
|
|
||||||
import org.nl.agv.service.VehicleInfoService;
|
import org.nl.agv.service.VehicleInfoService;
|
||||||
import org.nl.agv.unit.sendToAgvUtil;
|
import org.nl.agv.unit.sendToAgvUtil;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
|
||||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -87,28 +83,61 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
return returnjo;
|
return returnjo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryControlStatus(Map<String,String> jsonObject) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> Shut_down(Map<String,String> jsonObject) {
|
public Map<String,Object> Shut_down(Map<String,String> jsonObject) {
|
||||||
ServiceResponse response = new ServiceResponse();
|
ServiceResponse response = new ServiceResponse();
|
||||||
// 1-关机、2-显示屏控制、3-TCS控制、4-RC控制、5-Joy控制
|
// 1-关机、2-显示屏控制、3-TCS控制、4-RC控制、5-Joy控制
|
||||||
if(ObjectUtil.isNotEmpty(jsonObject)) {
|
if(ObjectUtil.isNotEmpty(jsonObject)) {
|
||||||
String enable = "0".equals(jsonObject.get("bool")) ? "(false)" : "(true)";
|
String enable = "0".equals(jsonObject.get("bool")) ? "false#" : "true#";
|
||||||
VehicleOperateEnum status = VehicleOperateEnum.getType(jsonObject.get("type"));
|
VehicleOperateEnum status = VehicleOperateEnum.getType(jsonObject.get("type"));
|
||||||
switch(status) {
|
switch(status) {
|
||||||
|
//关机
|
||||||
case OFF:
|
case OFF:
|
||||||
response = sendToAgvUtil.send("PowerOff");
|
response = sendToAgvUtil.send("PowerOff");
|
||||||
break;
|
break;
|
||||||
case SCREEN:
|
case SCREEN:
|
||||||
response = sendToAgvUtil.send("HMI_Ctrl_Enable" + enable);
|
response = sendToAgvUtil.send("Remote_Or_HMI_Ctrl:" + enable);
|
||||||
break;
|
break;
|
||||||
case TCS:
|
case TCS:
|
||||||
response = sendToAgvUtil.send("TCS_Ctrl_Enable" + enable);
|
response = sendToAgvUtil.send("CAD_Or_TCS_Ctrl:" + enable);
|
||||||
|
break;
|
||||||
|
case SCHE:
|
||||||
|
response = sendToAgvUtil.send("Sche_JSON_Sche_Enable:" + enable);
|
||||||
break;
|
break;
|
||||||
case RC:
|
case RC:
|
||||||
response = sendToAgvUtil.send("HMI_RCCtrl_Enable" + enable);
|
response = sendToAgvUtil.send("VehicleCtrlRealRCEnable:" + enable);
|
||||||
break;
|
break;
|
||||||
case JOY:
|
case JOY:
|
||||||
response = sendToAgvUtil.send("HMI_joyCtrl_Enable" + enable);
|
response = sendToAgvUtil.send("VehicleCtrlRealJoyEnable:" + enable);
|
||||||
|
break;
|
||||||
|
//退出
|
||||||
|
case QUITNOW:
|
||||||
|
response = sendToAgvUtil.send("QuitNow");
|
||||||
|
break;
|
||||||
|
//软启动(任务重置)
|
||||||
|
case REBORNINIT:
|
||||||
|
response = sendToAgvUtil.send("HMIRebornInitNow");
|
||||||
|
break;
|
||||||
|
//跳过起点
|
||||||
|
case STARTCHECK:
|
||||||
|
response = sendToAgvUtil.send("HMIStartCheckNow");
|
||||||
|
break;
|
||||||
|
//重启
|
||||||
|
case REBOOT:
|
||||||
|
response = sendToAgvUtil.send("PowerReboot");
|
||||||
|
break;
|
||||||
|
//全屏
|
||||||
|
case FULL:
|
||||||
|
response = sendToAgvUtil.send("FullScreenNow");
|
||||||
|
break;
|
||||||
|
//跳过托盘检测
|
||||||
|
case SKIPPLATE:
|
||||||
|
response = sendToAgvUtil.send("SkipPlateCheckNow");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -204,26 +233,15 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
returnjo.put("desc", "查询成功!");
|
returnjo.put("desc", "查询成功!");
|
||||||
returnjo.put("result", row);
|
returnjo.put("result", row);
|
||||||
return returnjo;
|
return returnjo;
|
||||||
} catch(Exception e) {
|
}
|
||||||
|
catch(Exception e) {
|
||||||
Log.error("通信失败:" + e.getMessage());
|
Log.error("通信失败:" + e.getMessage());
|
||||||
throw new BadRequestException( e.getMessage()==null?"通信失败,请检查系统参数中的Ros连接信息":e.getMessage());
|
throw new BadRequestException(e.getMessage() == null ? "通信失败,请检查系统参数中的Ros连接信息" : e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String,Object> queryControlStatus(Map<String,String> jsonObject) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> querrySensor(Map<String,String> jsonObject) {
|
public Map<String,Object> querrySensor(Map<String,String> jsonObject) {
|
||||||
|
|
||||||
//急停按钮
|
//急停按钮
|
||||||
String stopButton_status = "0";
|
String stopButton_status = "0";
|
||||||
//避障减速
|
//避障减速
|
||||||
@@ -241,12 +259,7 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
//ObstacleTouchState bit4 为导航雷达pfr2000或NAV350 防护触发信号 1 触发 0 未触发
|
//ObstacleTouchState bit4 为导航雷达pfr2000或NAV350 防护触发信号 1 触发 0 未触发
|
||||||
JSONObject returnjo = new JSONObject();
|
JSONObject returnjo = new JSONObject();
|
||||||
JSONObject row = new JSONObject();
|
JSONObject row = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
||||||
int ObstacleTouchState = debugInfoJson.getInteger("ObstacleTouchState");
|
int ObstacleTouchState = debugInfoJson.getInteger("ObstacleTouchState");
|
||||||
int ObstacleDetectState = debugInfoJson.getInteger("ObstacleDetectState");
|
int ObstacleDetectState = debugInfoJson.getInteger("ObstacleDetectState");
|
||||||
@@ -286,9 +299,10 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
returnjo.put("desc", "查询成功!");
|
returnjo.put("desc", "查询成功!");
|
||||||
returnjo.put("result", row);
|
returnjo.put("result", row);
|
||||||
return returnjo;
|
return returnjo;
|
||||||
} catch(Exception e) {
|
}
|
||||||
|
catch(Exception e) {
|
||||||
Log.error("通信失败:" + e.getMessage());
|
Log.error("通信失败:" + e.getMessage());
|
||||||
throw new BadRequestException( e.getMessage()==null?"通信失败,请检查系统参数中的Ros连接信息":e.getMessage());
|
throw new BadRequestException(e.getMessage() == null ? "通信失败,请检查系统参数中的Ros连接信息" : e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,9 +314,10 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
String inLineStatus_name;
|
String inLineStatus_name;
|
||||||
String UpdateStatus;
|
String UpdateStatus;
|
||||||
String UpdateStatus_name;
|
String UpdateStatus_name;
|
||||||
String Update_Sch = HomeServiceImpl.debugInfoJson.getString("Update_Sch");
|
JSONObject debugInfoJson = HomeServiceImpl.debugInfoJson;
|
||||||
String Auto_In_Line_State = HomeServiceImpl.debugInfoJson.getString("Auto_In_Line_State");
|
String Update_Sch = debugInfoJson.getString("Update_Sch");
|
||||||
if(StrUtil.equals("true", Auto_In_Line_State)) {
|
String Auto_In_Line_State = debugInfoJson.getString("Auto_In_Line_State");
|
||||||
|
if(StrUtil.equals("0", Auto_In_Line_State)) {
|
||||||
inLineStatus = "0";
|
inLineStatus = "0";
|
||||||
inLineStatus_name = "正常";
|
inLineStatus_name = "正常";
|
||||||
}
|
}
|
||||||
@@ -318,6 +333,11 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
|||||||
UpdateStatus = "0";
|
UpdateStatus = "0";
|
||||||
UpdateStatus_name = "更新中";
|
UpdateStatus_name = "更新中";
|
||||||
}
|
}
|
||||||
|
row.put("screenStatus", debugInfoJson.getString("Remote_Or_HMI_Ctrl"));
|
||||||
|
row.put("tcsStatus", debugInfoJson.getString("CAD_Or_TCS_Ctrl"));
|
||||||
|
row.put("scheStatus", debugInfoJson.getString("Sche_JSON_Sche_Enable"));
|
||||||
|
row.put("rcStatus", debugInfoJson.getString("VehicleCtrlRealRCEnable"));
|
||||||
|
row.put("joyStatus", debugInfoJson.getString("VehicleCtrlRealJoyEnable"));
|
||||||
row.put("inLineStatus", inLineStatus);
|
row.put("inLineStatus", inLineStatus);
|
||||||
row.put("inLineStatus_name", inLineStatus_name);
|
row.put("inLineStatus_name", inLineStatus_name);
|
||||||
row.put("UpdateStatus", UpdateStatus);
|
row.put("UpdateStatus", UpdateStatus);
|
||||||
|
|||||||
@@ -91,3 +91,18 @@ ENDIF
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
ST_AGV_ERROR as agv
|
||||||
|
WHERE
|
||||||
|
1=1
|
||||||
|
OPTION 输入.error_code <> ""
|
||||||
|
agv.error_code = 输入.error_code
|
||||||
|
ENDOPTION
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
Reference in New Issue
Block a user