opt:增加返回点功能。

This commit is contained in:
2024-05-12 13:51:13 +08:00
parent 7b9c11f011
commit 4662007fe9
3 changed files with 66 additions and 27 deletions

View File

@@ -15,7 +15,7 @@
*/
package org.nl.agv.service.impl;
import cn.hutool.core.date.StopWatch;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import cn.hutool.core.date.DateUtil;
@@ -37,6 +37,7 @@ import org.nl.modules.common.exception.BadRequestException;
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.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
@@ -58,6 +59,10 @@ import static org.nl.common.utils.LangUtils.getLanguage;
@RequiredArgsConstructor
@EnableScheduling
public class TaskServiceServiceImpl implements TaskService {
@Value("${spring.profiles.active}")
private String isProd;
public static JSONObject pointJson = new JSONObject();
/**
@@ -68,31 +73,68 @@ public class TaskServiceServiceImpl implements TaskService {
JSONObject returnjo = new JSONObject();
try {
String rest_pointcode = "";
ServiceResponse response = sendToAgvUtil.send("GetStationFloorIndexTable");
String result_info = JSONObject.parseObject(response.toString()).getString("ROS_String_Output");
if (StringUtils.isBlank(result_info)) {
returnjo.put("code", "1");
returnjo.put("result", null);
return returnjo;
}
String[] split = result_info.split("\\n");
for (int i = 0; i < split.length; i++) {
String row = split[i];
String[] rowArr = row.split("\\s+");
pointJson.put(rowArr[3], rowArr[4].contains("<") ? "" : rowArr[4]);
}
JSONArray arr = new JSONArray();
for (Object key : pointJson.keySet()) {
String value = (String) pointJson.get(key);
System.out.println("Key = " + key + ", Value = " + value);
JSONObject row = new JSONObject();
row.put("point_code", key);
row.put("point_name", value);
row.put("code_name", key + "-" + value);
if (StrUtil.equals("休息", value)) {
rest_pointcode = (String) key;
if ("prod".equals(isProd)) {
ServiceResponse response = sendToAgvUtil.send("GetStationFloorIndexTable");
String result_info = JSONObject.parseObject(response.toString()).getString("ROS_String_Output");
if (StringUtils.isBlank(result_info)) {
returnjo.put("code", "1");
returnjo.put("result", null);
return returnjo;
}
String[] split = result_info.split("\\n");
for (String row : split) {
String[] rowArr = row.split("\\s+");
pointJson.put(rowArr[3], rowArr[4].contains("<") ? "" : rowArr[4]);
}
for (String key : pointJson.keySet()) {
String value = (String) pointJson.get(key);
//System.out.println("Key = " + key + ", Value = " + value);
JSONObject row = new JSONObject();
row.put("point_code", key);
row.put("point_name", value);
row.put("code_name", key + "-" + value);
if (StrUtil.equals("休息", value)) {
rest_pointcode = key;
}
arr.add(row);
}
} else {
JSONObject row = new JSONObject();
row.put("point_code", "1");
row.put("point_name", "点位1");
row.put("code_name", "点位1");
JSONObject row1 = new JSONObject();
row1.put("point_code", "2");
row1.put("point_name", "点位2");
row1.put("code_name", "点位2");
JSONObject row2 = new JSONObject();
row2.put("point_code", "3");
row2.put("point_name", "点位3");
row2.put("code_name", "点位3");
JSONObject row3 = new JSONObject();
row3.put("point_code", "4");
row3.put("point_name", "点位4");
row3.put("code_name", "点位4");
JSONObject row4 = new JSONObject();
row4.put("point_code", "5");
row4.put("point_name", "二楼中间层休息点位与茶水间的充电桩交叉点1");
row4.put("code_name", "二楼中间层休息点位与茶水间的充电桩交叉点1");
JSONObject row5 = new JSONObject();
row5.put("point_code", "6");
row5.put("point_name", "二楼中间层休息点位充电桩1");
row5.put("code_name", "二楼中间层休息点位充电桩1");
JSONObject row6 = new JSONObject();
row6.put("point_code", "7");
row6.put("point_name", "一楼休息点位充电桩2");
row6.put("code_name", "一楼休息点位充电桩2");
arr.add(row);
arr.add(row1);
arr.add(row2);
arr.add(row3);
arr.add(row4);
arr.add(row5);
arr.add(row6);
}
returnjo.put("code", "1");
returnjo.put("desc", LangUtils.getMsgLanguage("QuerySuccess", null));
@@ -176,7 +218,7 @@ public class TaskServiceServiceImpl implements TaskService {
if (ObjectUtil.isNotEmpty(taskrow)) {
seq_num = taskrow.getInteger("seq_num") + 1;
}
if(StringUtils.isNotBlank(jsonObject.get("next_point_code"))) {
if (StringUtils.isNotBlank(jsonObject.get("next_point_code"))) {
taskjo.put("next_point_code2", jsonObject.get("next_point_code"));
}
taskjo.put("task_type", type);

View File

@@ -93,7 +93,6 @@ public class SendHomeWebSocketServer {
}
public Session getSession() {
Integer d = 1;
return session;
}
// 发送消息,在定时任务中会调用此方法

View File

@@ -1527,13 +1527,11 @@ public class WQLObject implements Serializable, Cloneable {
this.wo.addParam(whereArgNames.get(i), whereArgs[i]);
}
rb = this.wo.process();
} catch (WDKException e) {
throw e;
} catch (Exception e) {
throw new WDKException("wqlobject delete exception", e);
}
return rb;
}