opt:单任务版本

This commit is contained in:
2024-11-12 10:02:23 +08:00
parent 4662007fe9
commit 624b2c0483
8 changed files with 278 additions and 8 deletions

View File

@@ -56,4 +56,12 @@ public class HomeController {
return new ResponseEntity<>(homeService.clickSave(whereJson), HttpStatus.OK);
}
// @PostMapping("/testInfoJsonMethod")
// @Log("首页确定按钮")
// @ApiOperation("首页确定按钮")
// //@PreAuthorize("@el.check('sect:list')")
// public ResponseEntity<Object> testInfoJsonMethod(@RequestBody Map<String, String> whereJson) {
// return new ResponseEntity<>(homeService.testInfoJsonMethod(whereJson), HttpStatus.OK);
// }
}

View File

@@ -40,7 +40,7 @@ public class TaskController {
@ApiOperation("选择站点确认")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> confirmPoint(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(taskService.confirmPoint(whereJson), HttpStatus.OK);
return new ResponseEntity<>(taskService.confirmSinglePoint(whereJson), HttpStatus.OK);
}
@PostMapping("/queryTaskList")
@Log("查询任务列表")
@@ -50,6 +50,14 @@ public class TaskController {
return new ResponseEntity<>(taskService.queryTaskList(whereJson), HttpStatus.OK);
}
@PostMapping("/querySingleTask")
@Log("查询当前任务")
@ApiOperation("查询当前任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> querySingleTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(taskService.querySingleTask(whereJson), HttpStatus.OK);
}
@PostMapping("/deleteTask")
@Log("删除任务列表")
@ApiOperation("删除任务列表")
@@ -57,6 +65,15 @@ public class TaskController {
public ResponseEntity<Object> deleteTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(taskService.deleteTask(whereJson), HttpStatus.OK);
}
@PostMapping("/deleteSingleTask")
@Log("删除单任务列表")
@ApiOperation("删除单任务列表")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> deleteSingleTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(taskService.deleteSingleTask(whereJson), HttpStatus.OK);
}
@PostMapping("/updateTask")
@Log("调整任务顺序")
@ApiOperation("调整任务顺序")

View File

@@ -36,6 +36,7 @@ public interface HomeService {
* @return Map<String, Object>
*/
Map<String, Object> clickSave(Map<String, String> jsonObject);
// Map<String, Object> testInfoJsonMethod(Map<String, String> jsonObject);
void qeryDebuggerInfo();

View File

@@ -25,6 +25,13 @@ public interface TaskService {
*/
Map<String, Object> confirmPoint(Map<String, String> jsonObject);
/**
* 选择站点确认
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> confirmSinglePoint(Map<String, String> jsonObject);
/**
* 查询任务列表
@@ -33,6 +40,13 @@ public interface TaskService {
* @return Map<String, Object>
*/
Map<String, Object> queryTaskList(Map<String, String> jsonObject);
/**
* 查询当前任务
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> querySingleTask(Map<String, String> jsonObject);
/**
* 删除任务列表
*
@@ -40,6 +54,13 @@ public interface TaskService {
* @return Map<String, Object>
*/
Map<String, Object> deleteTask(Map<String, String> jsonObject);
/**
* 删除单任务
*
* @param
* @return Map<String, Object>
*/
Map<String, Object> deleteSingleTask(Map<String, String> jsonObject);
/**
* 调整任务顺序
*

View File

@@ -38,6 +38,7 @@ import org.nl.agv.websocket.SendHomeWebSocketServer;
import org.nl.common.utils.LangUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -96,6 +97,12 @@ public class HomeServiceImpl implements HomeService {
//特定场景调试信息放入json其他地方直接调用
public static JSONObject debugInfoJsonQuick = new JSONObject();
@Autowired
private RedisUtils redisUtils;
private String testInfoJson = "{\"Msg_DisplayState\":{\"AGV_ID\":255,\"Auto_In_Line_State\":0,\"Bosch_Car_Global_Theta\":-90.19221757272916,\"Bosch_Car_Global_rx\":-1.0619603784858553,\"Bosch_Car_Global_ry\":0.0020978358374357303,\"Bosch_Loc_State\":-2,\"Bosch_No_Rec_State\":0,\"Bosch_raw_age\":0.01389455795288086,\"Bosch_raw_epoch\":1,\"Bosch_raw_locState\":-2,\"Bosch_raw_qw\":0.9999999908132869,\"Bosch_raw_qx\":0.0,\"Bosch_raw_qy\":0.0,\"Bosch_raw_qz\":0.00013554861104682667,\"Bosch_raw_timestamp\":1695633231.1093392,\"Bosch_raw_uniqueId\":0,\"Bosch_raw_x\":0.0008994877773440588,\"Bosch_raw_x_odo\":0.0008994877773440588,\"Bosch_raw_y\":0.0006906610801896382,\"Bosch_raw_y_odo\":0.0006906610801896382,\"Bosch_raw_yaw\":0.00027109722292381746,\"Bosch_raw_yaw_odo\":0.0006906610801896382,\"Bosch_raw_z\":0.0,\"CAD_Or_TCS_Ctrl\":0,\"Car_Global_Theta\":-90.19221757272916,\"Car_Global_rx\":-1.0619603784858553,\"Car_Global_ry\":0.0020978358374357303,\"CurNodeID\":11,\"Cur_Stop_Info1_Authorized_Pass\":1,\"Cur_Stop_Info1_High_Precious_Enable\":1,\"Cur_Stop_Info1_Reached_Stop\":0,\"Cur_Stop_Info1_Set_Patht\":0.0,\"Cur_Stop_Info1_Set_Pathx\":0.0,\"Cur_Stop_Info1_Set_Pathy\":0.0,\"Cur_Stop_Info1_Single_Request_Sch\":0,\"Cur_Stop_Info1_Single_Stop_Sch\":0,\"Cur_Stop_Info1_StopEndNode\":0,\"Cur_Stop_Info1_StopStartNode\":0,\"Cur_Stop_Info1_Stop_Endt\":0.0,\"Cur_Stop_Info1_Stop_Endx\":0.0,\"Cur_Stop_Info1_Stop_Endy\":0.0,\"Cur_Stop_Info1_Stop_Num\":0,\"Cur_Stop_Info2_Authorized_Pass\":1,\"Cur_Stop_Info2_High_Precious_Enable\":1,\"Cur_Stop_Info2_Reached_Stop\":0,\"Cur_Stop_Info2_Set_Patht\":0.0,\"Cur_Stop_Info2_Set_Pathx\":0.0,\"Cur_Stop_Info2_Set_Pathy\":0.0,\"Cur_Stop_Info2_Single_Request_Sch\":0,\"Cur_Stop_Info2_Single_Stop_Sch\":0,\"Cur_Stop_Info2_StopEndNode\":0,\"Cur_Stop_Info2_StopStartNode\":0,\"Cur_Stop_Info2_Stop_Endt\":0.0,\"Cur_Stop_Info2_Stop_Endx\":0.0,\"Cur_Stop_Info2_Stop_Endy\":0.0,\"Cur_Stop_Info2_Stop_Num\":0,\"Curtis_Warning_Code_Pump\":0,\"Curtis_Warning_Code_Speed\":82,\"Curtis_Warning_Code_Steer\":0,\"EndNode\":0,\"Env_CustomName\":\"NobleLift\",\"Env_HMIUseJavaApp\":\"true\",\"Env_LearnEnable\":\"true\",\"Env_Lu_ROS_IP2\":\"\",\"Env_SoftwareVersion\":\"[Version]Magic4.1[Info]2023_09_21_20_41_37_Lu_ROS_magic4_waypointab_v31\",\"Env_VehicleType\":\" PS10LMT\",\"Get_Nav350_Curr_Layer\":0,\"Language\":1022739087,\"LastAltitudeExpectValue_mm\":0,\"LastGantryXExpectValue_mm\":0,\"LastGantryYExpectValue_mm\":0,\"Lateral_Deviation_m\":0.0,\"License_Info\":\"EC060800FFFBEBBF 6B7685747EBC EC060800FFFBEBBF 6B7685747EBC 2021/8/26 13:46:47 2021/8/26 13:46:47 1 UserClass5 Magic4_1\",\"LindeAgwSteerCenterPivotPlateAng\":0,\"LindeAgwSteerErrorFlag\":0,\"LindeAgwSteerModeSelectorState\":0,\"LindeAgwTracLiftErrorFlag\":0,\"LindeAgwTracLiftModeSelectorState\":0,\"LindeDriveErrCode1\":0,\"LindeDriveErrCode2\":0,\"LindeDriveErrCode3\":0,\"LindeDriveErrCode4\":0,\"LindeLiftErrCode1\":0,\"LindeLiftErrCode2\":0,\"LindeLiftErrCode3\":0,\"LindeLiftErrCode4\":0,\"LindeSteerErrCode1\":0,\"LindeSteerErrCode2\":0,\"LindeSteerErrCode3\":0,\"LindeSteerErrCode4\":0,\"Login_Info\":\"\",\"Min_Dist\":0.0,\"MissionCompleteAltitude_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryX_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryY_mm_RemoteOrHMI_FB\":0,\"Navi_Method\":3,\"ObstacleDetectState\":0,\"ObstacleTouchState\":0,\"Out_Of_Path_Times\":0,\"PFC_Sch\":0,\"PFC_State\":\"[PathFollow_Control_Handle_WLANJSON][PathFollow_Schedule_WLANJSON=0]\\n\",\"PLC_Warning_Code\":0,\"PWR_Percent\":29,\"PWR_Warn\":0,\"PathFollow_Enable\":0,\"PathFollow_Expect_AltitudeCtrlEnable\":0,\"PathFollow_Expect_GantryXCtrlEnable\":0,\"PathFollow_Expect_GantryYCtrlEnable\":0,\"Plate_Check_Err_Code\":0,\"ReachState\":0,\"RealAutoChargeState\":0,\"Ref_std_rt\":0.0,\"Ref_std_rx\":0.0,\"Ref_std_ry\":0.0,\"Remote_Or_HMI_Ctrl\":1,\"SVreal_angle\":0.0,\"Sche_JSON_Sche_Enable\":1,\"Speedm_Tmp\":0.0,\"StartNode\":0,\"Sub_Warning_Code0\":0,\"Sys_Mode\":4,\"Task_Sch\":0,\"Task_State\":\"\",\"Update_Sch\":1,\"Update_State\":\"\",\"VehicleCtrlExpThrottle\":0,\"VehicleCtrlRealAltitude_mm\":998,\"VehicleCtrlRealCustomStateByte0\":0,\"VehicleCtrlRealCustomStateByte1\":0,\"VehicleCtrlRealCustomStateByte2\":0,\"VehicleCtrlRealCustomStateByte3\":0,\"VehicleCtrlRealGantryX_mm\":0,\"VehicleCtrlRealGantryY_mm\":0,\"VehicleCtrlRealJoyEnable\":0,\"VehicleCtrlRealRCEnable\":0,\"VehicleCtrl_CAN_Err_Info\":0,\"Vertical_Deviation_deg\":0.0,\"Warning_Code\":754529,\"header\":{\"frame_id\":\"\",\"seq\":1904,\"stamp\":{\"nsec\":160948865,\"sec\":1695633231}}}}";
public HomeServiceImpl(ThreadPoolExecutor pool) {
this.pool = pool;
}
@@ -252,7 +259,9 @@ public class HomeServiceImpl implements HomeService {
private void determineTaskNum(List<JSONObject> allTasks, HomeInfo homeInfo) {
long allTasksCount = allTasks.size();
// long allTasksCount = allTasks.size();
//单任务模式,显示一个任务
long allTasksCount = allTasks.stream().filter(task -> TaskStatusEnum.RUNNING.getCode().equals(task.getString("task_status")) && !TaskTypeEnum.REST.getCode().equals(task.getString("task_type"))).count();
long todayUnfinishedTasksCount = allTasks.stream().filter(task -> task.getString("task_status").equals(TaskStatusEnum.CREATE.getCode())).count();
homeInfo.setTask_num(LangUtils.getLanguage("PendingExecution", null) + " " + todayUnfinishedTasksCount + "/" + allTasksCount);
homeInfo.setZh_task_num(LangUtils.getLanguage("PendingExecution", "zh") + " " + todayUnfinishedTasksCount + "/" + allTasksCount);
@@ -494,6 +503,13 @@ public class HomeServiceImpl implements HomeService {
return returnjo;
}
// @Override
// public Map<String, Object> testInfoJsonMethod(Map<String, String> jsonObject) {
// JSONObject returnjo = new JSONObject();
// testInfoJson = "{\"Msg_DisplayState\":{\"AGV_ID\":255,\"Auto_In_Line_State\":0,\"Bosch_Car_Global_Theta\":-90.19221757272916,\"Bosch_Car_Global_rx\":-1.0619603784858553,\"Bosch_Car_Global_ry\":0.0020978358374357303,\"Bosch_Loc_State\":-2,\"Bosch_No_Rec_State\":0,\"Bosch_raw_age\":0.01389455795288086,\"Bosch_raw_epoch\":1,\"Bosch_raw_locState\":-2,\"Bosch_raw_qw\":0.9999999908132869,\"Bosch_raw_qx\":0.0,\"Bosch_raw_qy\":0.0,\"Bosch_raw_qz\":0.00013554861104682667,\"Bosch_raw_timestamp\":1695633231.1093392,\"Bosch_raw_uniqueId\":0,\"Bosch_raw_x\":0.0008994877773440588,\"Bosch_raw_x_odo\":0.0008994877773440588,\"Bosch_raw_y\":0.0006906610801896382,\"Bosch_raw_y_odo\":0.0006906610801896382,\"Bosch_raw_yaw\":0.00027109722292381746,\"Bosch_raw_yaw_odo\":0.0006906610801896382,\"Bosch_raw_z\":0.0,\"CAD_Or_TCS_Ctrl\":0,\"Car_Global_Theta\":-90.19221757272916,\"Car_Global_rx\":-1.0619603784858553,\"Car_Global_ry\":0.0020978358374357303,\"CurNodeID\":4,\"Cur_Stop_Info1_Authorized_Pass\":1,\"Cur_Stop_Info1_High_Precious_Enable\":1,\"Cur_Stop_Info1_Reached_Stop\":0,\"Cur_Stop_Info1_Set_Patht\":0.0,\"Cur_Stop_Info1_Set_Pathx\":0.0,\"Cur_Stop_Info1_Set_Pathy\":0.0,\"Cur_Stop_Info1_Single_Request_Sch\":0,\"Cur_Stop_Info1_Single_Stop_Sch\":0,\"Cur_Stop_Info1_StopEndNode\":0,\"Cur_Stop_Info1_StopStartNode\":0,\"Cur_Stop_Info1_Stop_Endt\":0.0,\"Cur_Stop_Info1_Stop_Endx\":0.0,\"Cur_Stop_Info1_Stop_Endy\":0.0,\"Cur_Stop_Info1_Stop_Num\":0,\"Cur_Stop_Info2_Authorized_Pass\":1,\"Cur_Stop_Info2_High_Precious_Enable\":1,\"Cur_Stop_Info2_Reached_Stop\":0,\"Cur_Stop_Info2_Set_Patht\":0.0,\"Cur_Stop_Info2_Set_Pathx\":0.0,\"Cur_Stop_Info2_Set_Pathy\":0.0,\"Cur_Stop_Info2_Single_Request_Sch\":0,\"Cur_Stop_Info2_Single_Stop_Sch\":0,\"Cur_Stop_Info2_StopEndNode\":0,\"Cur_Stop_Info2_StopStartNode\":0,\"Cur_Stop_Info2_Stop_Endt\":0.0,\"Cur_Stop_Info2_Stop_Endx\":0.0,\"Cur_Stop_Info2_Stop_Endy\":0.0,\"Cur_Stop_Info2_Stop_Num\":0,\"Curtis_Warning_Code_Pump\":0,\"Curtis_Warning_Code_Speed\":82,\"Curtis_Warning_Code_Steer\":0,\"EndNode\":0,\"Env_CustomName\":\"NobleLift\",\"Env_HMIUseJavaApp\":\"true\",\"Env_LearnEnable\":\"true\",\"Env_Lu_ROS_IP2\":\"\",\"Env_SoftwareVersion\":\"[Version]Magic4.1[Info]2023_09_21_20_41_37_Lu_ROS_magic4_waypointab_v31\",\"Env_VehicleType\":\" PS10LMT\",\"Get_Nav350_Curr_Layer\":0,\"Language\":1022739087,\"LastAltitudeExpectValue_mm\":0,\"LastGantryXExpectValue_mm\":0,\"LastGantryYExpectValue_mm\":0,\"Lateral_Deviation_m\":0.0,\"License_Info\":\"EC060800FFFBEBBF 6B7685747EBC EC060800FFFBEBBF 6B7685747EBC 2021/8/26 13:46:47 2021/8/26 13:46:47 1 UserClass5 Magic4_1\",\"LindeAgwSteerCenterPivotPlateAng\":0,\"LindeAgwSteerErrorFlag\":0,\"LindeAgwSteerModeSelectorState\":0,\"LindeAgwTracLiftErrorFlag\":0,\"LindeAgwTracLiftModeSelectorState\":0,\"LindeDriveErrCode1\":0,\"LindeDriveErrCode2\":0,\"LindeDriveErrCode3\":0,\"LindeDriveErrCode4\":0,\"LindeLiftErrCode1\":0,\"LindeLiftErrCode2\":0,\"LindeLiftErrCode3\":0,\"LindeLiftErrCode4\":0,\"LindeSteerErrCode1\":0,\"LindeSteerErrCode2\":0,\"LindeSteerErrCode3\":0,\"LindeSteerErrCode4\":0,\"Login_Info\":\"\",\"Min_Dist\":0.0,\"MissionCompleteAltitude_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryX_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryY_mm_RemoteOrHMI_FB\":0,\"Navi_Method\":3,\"ObstacleDetectState\":0,\"ObstacleTouchState\":0,\"Out_Of_Path_Times\":0,\"PFC_Sch\":0,\"PFC_State\":\"[PathFollow_Control_Handle_WLANJSON][PathFollow_Schedule_WLANJSON=0]\\n\",\"PLC_Warning_Code\":0,\"PWR_Percent\":29,\"PWR_Warn\":0,\"PathFollow_Enable\":0,\"PathFollow_Expect_AltitudeCtrlEnable\":0,\"PathFollow_Expect_GantryXCtrlEnable\":0,\"PathFollow_Expect_GantryYCtrlEnable\":0,\"Plate_Check_Err_Code\":0,\"ReachState\":0,\"RealAutoChargeState\":0,\"Ref_std_rt\":0.0,\"Ref_std_rx\":0.0,\"Ref_std_ry\":0.0,\"Remote_Or_HMI_Ctrl\":1,\"SVreal_angle\":0.0,\"Sche_JSON_Sche_Enable\":1,\"Speedm_Tmp\":0.0,\"StartNode\":0,\"Sub_Warning_Code0\":0,\"Sys_Mode\":4,\"Task_Sch\":0,\"Task_State\":\"\",\"Update_Sch\":1,\"Update_State\":\"\",\"VehicleCtrlExpThrottle\":0,\"VehicleCtrlRealAltitude_mm\":998,\"VehicleCtrlRealCustomStateByte0\":0,\"VehicleCtrlRealCustomStateByte1\":0,\"VehicleCtrlRealCustomStateByte2\":0,\"VehicleCtrlRealCustomStateByte3\":0,\"VehicleCtrlRealGantryX_mm\":0,\"VehicleCtrlRealGantryY_mm\":0,\"VehicleCtrlRealJoyEnable\":0,\"VehicleCtrlRealRCEnable\":0,\"VehicleCtrl_CAN_Err_Info\":0,\"Vertical_Deviation_deg\":0.0,\"Warning_Code\":754529,\"header\":{\"frame_id\":\"\",\"seq\":1904,\"stamp\":{\"nsec\":160948865,\"sec\":1695633231}}}}";
// return returnjo;
// }
@Override
public void qeryDebuggerInfo() {
Map<String, String> urlInfo = RosUtil.getRosHostInfo();
@@ -501,7 +517,7 @@ public class HomeServiceImpl implements HomeService {
if ("prod".equals(isProd)) {
result = HttpUtil.get(urlInfo.get("javaUrl"));
} else {
result = "{\"Msg_DisplayState\":{\"AGV_ID\":255,\"Auto_In_Line_State\":0,\"Bosch_Car_Global_Theta\":-90.19221757272916,\"Bosch_Car_Global_rx\":-1.0619603784858553,\"Bosch_Car_Global_ry\":0.0020978358374357303,\"Bosch_Loc_State\":-2,\"Bosch_No_Rec_State\":0,\"Bosch_raw_age\":0.01389455795288086,\"Bosch_raw_epoch\":1,\"Bosch_raw_locState\":-2,\"Bosch_raw_qw\":0.9999999908132869,\"Bosch_raw_qx\":0.0,\"Bosch_raw_qy\":0.0,\"Bosch_raw_qz\":0.00013554861104682667,\"Bosch_raw_timestamp\":1695633231.1093392,\"Bosch_raw_uniqueId\":0,\"Bosch_raw_x\":0.0008994877773440588,\"Bosch_raw_x_odo\":0.0008994877773440588,\"Bosch_raw_y\":0.0006906610801896382,\"Bosch_raw_y_odo\":0.0006906610801896382,\"Bosch_raw_yaw\":0.00027109722292381746,\"Bosch_raw_yaw_odo\":0.0006906610801896382,\"Bosch_raw_z\":0.0,\"CAD_Or_TCS_Ctrl\":0,\"Car_Global_Theta\":-90.19221757272916,\"Car_Global_rx\":-1.0619603784858553,\"Car_Global_ry\":0.0020978358374357303,\"CurNodeID\":11,\"Cur_Stop_Info1_Authorized_Pass\":1,\"Cur_Stop_Info1_High_Precious_Enable\":1,\"Cur_Stop_Info1_Reached_Stop\":0,\"Cur_Stop_Info1_Set_Patht\":0.0,\"Cur_Stop_Info1_Set_Pathx\":0.0,\"Cur_Stop_Info1_Set_Pathy\":0.0,\"Cur_Stop_Info1_Single_Request_Sch\":0,\"Cur_Stop_Info1_Single_Stop_Sch\":0,\"Cur_Stop_Info1_StopEndNode\":0,\"Cur_Stop_Info1_StopStartNode\":0,\"Cur_Stop_Info1_Stop_Endt\":0.0,\"Cur_Stop_Info1_Stop_Endx\":0.0,\"Cur_Stop_Info1_Stop_Endy\":0.0,\"Cur_Stop_Info1_Stop_Num\":0,\"Cur_Stop_Info2_Authorized_Pass\":1,\"Cur_Stop_Info2_High_Precious_Enable\":1,\"Cur_Stop_Info2_Reached_Stop\":0,\"Cur_Stop_Info2_Set_Patht\":0.0,\"Cur_Stop_Info2_Set_Pathx\":0.0,\"Cur_Stop_Info2_Set_Pathy\":0.0,\"Cur_Stop_Info2_Single_Request_Sch\":0,\"Cur_Stop_Info2_Single_Stop_Sch\":0,\"Cur_Stop_Info2_StopEndNode\":0,\"Cur_Stop_Info2_StopStartNode\":0,\"Cur_Stop_Info2_Stop_Endt\":0.0,\"Cur_Stop_Info2_Stop_Endx\":0.0,\"Cur_Stop_Info2_Stop_Endy\":0.0,\"Cur_Stop_Info2_Stop_Num\":0,\"Curtis_Warning_Code_Pump\":0,\"Curtis_Warning_Code_Speed\":82,\"Curtis_Warning_Code_Steer\":0,\"EndNode\":0,\"Env_CustomName\":\"NobleLift\",\"Env_HMIUseJavaApp\":\"true\",\"Env_LearnEnable\":\"true\",\"Env_Lu_ROS_IP2\":\"\",\"Env_SoftwareVersion\":\"[Version]Magic4.1[Info]2023_09_21_20_41_37_Lu_ROS_magic4_waypointab_v31\",\"Env_VehicleType\":\" PS10LMT\",\"Get_Nav350_Curr_Layer\":0,\"Language\":1022739087,\"LastAltitudeExpectValue_mm\":0,\"LastGantryXExpectValue_mm\":0,\"LastGantryYExpectValue_mm\":0,\"Lateral_Deviation_m\":0.0,\"License_Info\":\"EC060800FFFBEBBF 6B7685747EBC EC060800FFFBEBBF 6B7685747EBC 2021/8/26 13:46:47 2021/8/26 13:46:47 1 UserClass5 Magic4_1\",\"LindeAgwSteerCenterPivotPlateAng\":0,\"LindeAgwSteerErrorFlag\":0,\"LindeAgwSteerModeSelectorState\":0,\"LindeAgwTracLiftErrorFlag\":0,\"LindeAgwTracLiftModeSelectorState\":0,\"LindeDriveErrCode1\":0,\"LindeDriveErrCode2\":0,\"LindeDriveErrCode3\":0,\"LindeDriveErrCode4\":0,\"LindeLiftErrCode1\":0,\"LindeLiftErrCode2\":0,\"LindeLiftErrCode3\":0,\"LindeLiftErrCode4\":0,\"LindeSteerErrCode1\":0,\"LindeSteerErrCode2\":0,\"LindeSteerErrCode3\":0,\"LindeSteerErrCode4\":0,\"Login_Info\":\"\",\"Min_Dist\":0.0,\"MissionCompleteAltitude_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryX_mm_RemoteOrHMI_FB\":0,\"MissionCompleteGantryY_mm_RemoteOrHMI_FB\":0,\"Navi_Method\":3,\"ObstacleDetectState\":0,\"ObstacleTouchState\":0,\"Out_Of_Path_Times\":0,\"PFC_Sch\":0,\"PFC_State\":\"[PathFollow_Control_Handle_WLANJSON][PathFollow_Schedule_WLANJSON=0]\\n\",\"PLC_Warning_Code\":0,\"PWR_Percent\":29,\"PWR_Warn\":0,\"PathFollow_Enable\":0,\"PathFollow_Expect_AltitudeCtrlEnable\":0,\"PathFollow_Expect_GantryXCtrlEnable\":0,\"PathFollow_Expect_GantryYCtrlEnable\":0,\"Plate_Check_Err_Code\":0,\"ReachState\":0,\"RealAutoChargeState\":0,\"Ref_std_rt\":0.0,\"Ref_std_rx\":0.0,\"Ref_std_ry\":0.0,\"Remote_Or_HMI_Ctrl\":1,\"SVreal_angle\":0.0,\"Sche_JSON_Sche_Enable\":1,\"Speedm_Tmp\":0.0,\"StartNode\":0,\"Sub_Warning_Code0\":0,\"Sys_Mode\":4,\"Task_Sch\":0,\"Task_State\":\"\",\"Update_Sch\":1,\"Update_State\":\"\",\"VehicleCtrlExpThrottle\":0,\"VehicleCtrlRealAltitude_mm\":998,\"VehicleCtrlRealCustomStateByte0\":0,\"VehicleCtrlRealCustomStateByte1\":0,\"VehicleCtrlRealCustomStateByte2\":0,\"VehicleCtrlRealCustomStateByte3\":0,\"VehicleCtrlRealGantryX_mm\":0,\"VehicleCtrlRealGantryY_mm\":0,\"VehicleCtrlRealJoyEnable\":0,\"VehicleCtrlRealRCEnable\":0,\"VehicleCtrl_CAN_Err_Info\":0,\"Vertical_Deviation_deg\":0.0,\"Warning_Code\":754529,\"header\":{\"frame_id\":\"\",\"seq\":1904,\"stamp\":{\"nsec\":160948865,\"sec\":1695633231}}}}";
result = testInfoJson;
}
//String result = HttpUtil.get(urlInfo.get("javaUrl"));
JSONObject json = JSONObject.parseObject(result);
@@ -563,6 +579,38 @@ public class HomeServiceImpl implements HomeService {
debugInfoJson.put("VehicleCtrlRealRCEnable", jo.getString("VehicleCtrlRealRCEnable"));
debugInfoJson.put("VehicleCtrlRealJoyEnable", jo.getString("VehicleCtrlRealJoyEnable"));
debugInfoJson.put("CurNodeID", jo.getString("CurNodeID"));
//判断是否有任务
if (redisUtils.hasKey("currentTask")){
WQLObject taskTable = WQLObject.getWQLObject("ST_TASK_INFO");
JSONObject taskjo = taskTable.query("is_delete='0' and task_status='01' and task_type!='2' and is_manualfinished='0'").uniqueResult(0);
JSONObject currentTask = (JSONObject)redisUtils.get("currentTask");
boolean bo = false;
if (TaskTypeEnum.TAKE.getCode().equals(currentTask.getString("task_type")) || TaskTypeEnum.PUT.getCode().equals(currentTask.getString("task_type"))){
if ("0".equals(debugInfoJson.get("PathFollow_Enable")) && debugInfoJson.get("CurNodeID").equals(currentTask.getString("next_point_code2")) && taskjo.getString("step") != null){
bo = true;
}
}else{
if ("0".equals(debugInfoJson.get("PathFollow_Enable")) && debugInfoJson.get("CurNodeID").equals(currentTask.getString("next_point_code"))){
bo = true;
}
}
//判断任务是否完成
if (bo){
taskjo.put("is_manualfinished", "1");
String code = TaskStatusEnum.END.getCode();
taskjo.put("task_status", code);
String task_status_name = getLanguage(getMessageKey(code), null);
String en_task_status_name = getLanguage(getMessageKey(code), "en");
String zh_task_status_name = getLanguage(getMessageKey(code), "zh");
taskjo.put("task_status_name", task_status_name);
taskjo.put("en_task_status_name", en_task_status_name);
taskjo.put("zh_task_status_name", zh_task_status_name);
taskjo.put("update_time", DateUtil.now());
taskjo.put("update_by", SecurityUtils.getCurrentNickName());
taskTable.update(taskjo);
redisUtils.del("currentTask");
}
}
}
@@ -593,8 +641,8 @@ public class HomeServiceImpl implements HomeService {
if(TaskTypeEnum.TAKE.getCode().equals(taskjo.getString("task_type")) || TaskTypeEnum.PUT.getCode().equals(taskjo.getString("task_type"))) {
taskjo.put("step", "1");
}
taskjo.put("is_manualfinished", "1");
updateTaskStatus(taskjo, TaskStatusEnum.END);
// taskjo.put("is_manualfinished", "1");
updateTaskStatus(taskjo, null);
} else {
log.error("handleTaskStatus-createReturnTask-返程指令执行失败:{}", TaskSendBackStatusEnum.getName(resultflag));
}
@@ -694,7 +742,7 @@ public class HomeServiceImpl implements HomeService {
if (ObjectUtil.isNotEmpty(taskjo) && StrUtil.equals("0", debugInfoJson.getString("PathFollow_Enable")) && debugInfoJson.getString("CurNodeID").equals(taskjo.getString("next_point_code"))) {
//普通任务
if (TaskTypeEnum.COMMON.getCode().equals(taskjo.getString("task_type"))) {
updateTaskStatus(taskjo, TaskStatusEnum.END);
updateTaskStatus(taskjo, null);
if (StringUtils.isNotBlank(taskjo.getString("next_point_code2"))) {
createReturnTask(taskjo);
}

View File

@@ -27,6 +27,7 @@ import lombok.RequiredArgsConstructor;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.agv.enu.TaskSendBackStatusEnum;
import org.nl.agv.enu.TaskStatusEnum;
import org.nl.agv.enu.TaskTypeEnum;
import org.nl.agv.service.TaskService;
@@ -34,9 +35,11 @@ import org.nl.agv.unit.sendToAgvUtil;
import org.nl.common.utils.LangUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -60,6 +63,8 @@ import static org.nl.common.utils.LangUtils.getLanguage;
@EnableScheduling
public class TaskServiceServiceImpl implements TaskService {
@Autowired
private RedisUtils redisUtils;
@Value("${spring.profiles.active}")
private String isProd;
@@ -72,6 +77,8 @@ public class TaskServiceServiceImpl implements TaskService {
public Map<String, Object> queryPoint(Map<String, String> jsonObject) {
JSONObject returnjo = new JSONObject();
try {
//获取之前先清空。避免车辆底层站点已清除,显示屏还有遗留。
pointJson.clear();
String rest_pointcode = "";
JSONArray arr = new JSONArray();
if ("prod".equals(isProd)) {
@@ -270,6 +277,136 @@ public class TaskServiceServiceImpl implements TaskService {
}
}
/**
* 下发任务
*/
@Override
public Map<String, Object> confirmSinglePoint(Map<String, String> jsonObject) {
String point_code = jsonObject.get("point_code");
String type = jsonObject.get("type");
JSONObject returnjo = new JSONObject();
JSONObject taskjo = new JSONObject();
if (StringUtils.isBlank(point_code) || StringUtils.isBlank((type))) {
if (StringUtils.isBlank(point_code)) {
returnjo.put("desc", LangUtils.getMsgLanguage("PointValidation", null));
} else if (StringUtils.isBlank((type))) {
returnjo.put("desc", LangUtils.getMsgLanguage("TypeValidation", null));
} else {
returnjo.put("desc", LangUtils.getMsgLanguage("LocationValidation", null));
}
returnjo.put("code", "0");
return returnjo;
} else {
//目标点位只能为数字
if (!point_code.matches("\\d+")) {
returnjo.put("code", "0");
returnjo.put("desc", LangUtils.getMsgLanguage("MatchesLocation", null));
return returnjo;
}
if (point_code.equals(debugInfoJson.getString("CurNodeID"))) {
returnjo.put("code", "0");
returnjo.put("desc", LangUtils.getMsgLanguage("HasBeenReached", null));
return returnjo;
}
}
try {
String clearSchedule = "HMI_Ctrl_Clear_Auto_Mode_Schedule";
sendToAgvUtil.send(clearSchedule);
String instruct;
int seq_num = 1;
String task_status = "00";
String task_status_name = getLanguage("GenerateNotExecuted", null);
String en_task_status_name = getLanguage("GenerateNotExecuted", "en");
String zh_task_status_name = getLanguage("GenerateNotExecuted", "zh");
if (TaskTypeEnum.COMMON.getCode().equals(type)) {
taskjo.put("task_type_name", getLanguage("StandardTask", null));
taskjo.put("en_task_type_name", getLanguage("StandardTask", "en"));
taskjo.put("zh_task_type_name", getLanguage("StandardTask", "zh"));
} else if (TaskTypeEnum.TAKE.getCode().equals(type)) {
taskjo.put("task_type_name", getLanguage("PickupTask", null));
taskjo.put("en_task_type_name", getLanguage("PickupTask", "en"));
taskjo.put("zh_task_type_name", getLanguage("PickupTask", "zh"));
} else if (TaskTypeEnum.PUT.getCode().equals(type)) {
taskjo.put("task_type_name", getLanguage("UnloadTask", null));
taskjo.put("en_task_type_name", getLanguage("UnloadTask", "en"));
taskjo.put("zh_task_type_name", getLanguage("UnloadTask", "zh"));
} else if (TaskTypeEnum.REST.getCode().equals(type)) {
taskjo.put("task_type_name", getLanguage("ReturnTask", null));
taskjo.put("en_task_type_name", getLanguage("ReturnTask", "en"));
taskjo.put("zh_task_type_name", getLanguage("ReturnTask", "zh"));
}
//查询未完成的指令有多少条
// int num = WQL.getWO("QAGVERROR").addParam("flag", "3").process().uniqueResult(0).getInteger("num");
//查询最多的任务数量
// int max_task_num = WQLObject.getWQLObject("ST_SYSTEM_PARAM").query("1=1").uniqueResult(0).getInteger("max_task_num");
// if (num >= max_task_num) {
// returnjo.put("code", "1");
// returnjo.put("desc", LangUtils.getMsgLanguage("TaskCountExceedsMaximum", null));
// return returnjo;
// }
//查询未完成最大的顺序号
// JSONObject taskrow = WQLObject.getWQLObject("ST_TASK_INFO").query("is_manualfinished=0", "seq_num desc").uniqueResult(0);
// if (ObjectUtil.isNotEmpty(taskrow)) {
// seq_num = taskrow.getInteger("seq_num") + 1;
// }
// if (StringUtils.isNotBlank(jsonObject.get("next_point_code"))) {
// taskjo.put("next_point_code2", jsonObject.get("next_point_code"));
// }
taskjo.put("task_type", type);
taskjo.put("seq_num", type.equals(TaskTypeEnum.RETURN.getCode()) ? getSeqNum() : seq_num);
taskjo.put("task_uuid", IdUtil.simpleUUID());
taskjo.put("task_code", CodeUtil.getNewCode("TASK_NO"));
taskjo.put("next_point_code", point_code);
taskjo.put("is_delete", "0");
taskjo.put("date", DateUtil.today());
taskjo.put("create_time", DateUtil.now());
taskjo.put("is_agvfinished", "0");
taskjo.put("is_manualfinished", "0");
taskjo.put("create_by", SecurityUtils.getCurrentNickName());
//只有一条且是第一条下发给agv
if (type.equals(TaskTypeEnum.TAKE.getCode()) || type.equals(TaskTypeEnum.PUT.getCode())) {
//获取返程点
ServiceResponse send = sendToAgvUtil.send("HMIRouter:" + debugInfoJson.getString("CurNodeID") + ";" + point_code + ";#");
JSONObject resjo = JSONObject.parseObject(send.toString());
//todo 需要改回检查返回的路由信息resjo
String v2 = resjo.getString("ROS_String_Output");
String[] pointCode2 = v2.substring(v2.indexOf("Export_NodeIDPath:\n") + "Export_NodeIDPath:\n".length(), v2.indexOf(" \nExport_NodeIDPath_End")).split(" ");
String nextPoint = pointCode2[pointCode2.length - 2];
taskjo.put("next_point_code2", nextPoint);
}
// if (ObjectUtil.isEmpty(taskrow)) {
instruct = "HMIStepOrRTPathFollow:0;" + point_code + ";1#";
ServiceResponse send = sendToAgvUtil.send(instruct);
JSONObject resjo = JSONObject.parseObject(send.toString());
String resultflag = resjo.getString("result");
if (StrUtil.equals("0", resjo.getString("result"))) {
task_status = "01";
task_status_name = getLanguage("Executing", null);
en_task_status_name = getLanguage("Executing", "en");
zh_task_status_name = getLanguage("Executing", "zh");
}else {
returnjo.put("code", "1");
returnjo.put("desc", TaskSendBackStatusEnum.getName(resultflag));
return returnjo;
}
// JSONObject change = sendToAgvUtil.change(point_code);
// sendToAgvUtil.sendtask(change.getString("first"), change.getString("last"));
// }
taskjo.put("task_status", task_status);
taskjo.put("task_status_name", task_status_name);
taskjo.put("en_task_status_name", en_task_status_name);
taskjo.put("zh_task_status_name", zh_task_status_name);
WQLObject.getWQLObject("ST_TASK_INFO").insert(taskjo);
returnjo.put("code", "1");
returnjo.put("desc", LangUtils.getMsgLanguage("OperationSuccess", null));
redisUtils.set("currentTask",taskjo);
return returnjo;
} catch (Exception e) {
log.error("confirmPoint-下发任务失败:{}", e.getMessage());
throw new BadRequestException(e.getMessage() == null ? "confirmPoint:" + LangUtils.getMsgLanguage("CommunicationFail", null) : "confirmPoint:" + e.getMessage());
}
}
private static Integer getSeqNum() {
WQLObject taskTable = WQLObject.getWQLObject("ST_TASK_INFO");
@@ -303,6 +440,17 @@ public class TaskServiceServiceImpl implements TaskService {
return returnjo;
}
@Override
public Map<String, Object> querySingleTask(Map<String, String> jsonObject) {
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", LangUtils.getMsgLanguage("QuerySuccess", null));
//有任务记录返回result
if (redisUtils.hasKey("currentTask")){
returnjo.put("result", redisUtils.get("currentTask"));
}
return returnjo;
}
@Override
public Map<String, Object> deleteTask(Map<String, String> jsonObject) {
@@ -323,6 +471,33 @@ public class TaskServiceServiceImpl implements TaskService {
return returnjo;
}
@Override
public Map<String, Object> deleteSingleTask(Map<String, String> jsonObject) {
JSONObject returnjo = new JSONObject();
if (redisUtils.hasKey("currentTask")){
JSONObject currentTask = (JSONObject)redisUtils.get("currentTask");
WQLObject taskTable = WQLObject.getWQLObject("ST_TASK_INFO");
String sqlWhere = "task_code in (" + currentTask.getString("task_code") + ")";
taskTable.delete(sqlWhere);
//清除车辆上的任务
ServiceResponse response = sendToAgvUtil.send("HMIRebornInitNow");
// String code = "0".equals(response.toJsonObject().get("result").toString()) ? "1" : "0";
// if (("0").equals(code)){
// String desc = "0".equals(response.toJsonObject().get("result").toString()) ? LangUtils.getMsgLanguage("OperationSuccess", null) : LangUtils.getMsgLanguage("OperationFailed", null);
// returnjo.put("code", code);
// returnjo.put("desc", desc);
// }
redisUtils.del("currentTask");
returnjo.put("code", "1");
returnjo.put("desc", LangUtils.getMsgLanguage("DeletionSuccess", null));
}else {
returnjo.put("code", "0");
returnjo.put("desc", LangUtils.getMsgLanguage("TaskCodeEmpty", null));
return returnjo;
}
return returnjo;
}
@Override
public Map<String, Object> updateTask(Map<String, String> jsonObject) {
JSONObject returnjo = new JSONObject();

View File

@@ -426,8 +426,8 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper,SysMenu> imple
}
String pid = dict.getPara1();
List<SysMenu> menuDtoList = baseMapper.findSystemMenu(SecurityUtils.getCurrentUserId(), systemType);
//移除系统级菜单
menuDtoList.removeIf(a -> a.getMenuId().equals(pid));
//移除系统级菜单和隐藏菜单
menuDtoList.removeIf(a -> a.getMenuId().equals(pid) || a.getHidden());
List<MenuInfoDto> menuDtos = this.buildMenuDto(CopyUtil.copyList(menuDtoList, MenuInfoDto.class));
return menuDtos;
}