opt:添加PDA,修改任务逻辑等。
This commit is contained in:
@@ -13,6 +13,8 @@ import org.nl.acs.AcsConfig;
|
|||||||
import org.nl.acs.agv.AgvUtil;
|
import org.nl.acs.agv.AgvUtil;
|
||||||
import org.nl.acs.agv.server.XianGongAgvService;
|
import org.nl.acs.agv.server.XianGongAgvService;
|
||||||
import org.nl.acs.agv.server.dto.AgvDto;
|
import org.nl.acs.agv.server.dto.AgvDto;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||||
@@ -79,6 +81,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
if (StrUtil.isBlank(address)) {
|
if (StrUtil.isBlank(address)) {
|
||||||
throw new BadRequestException("请求失败,地址为空!");
|
throw new BadRequestException("请求失败,地址为空!");
|
||||||
}
|
}
|
||||||
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||||
|
if (StrUtil.equals(hasWms, "1")){
|
||||||
//请求取货
|
//请求取货
|
||||||
if (address.contains("INGET")) {
|
if (address.contains("INGET")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
@@ -100,70 +104,77 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//取货完成
|
//取货完成
|
||||||
if (address.contains("OUTGET")) {
|
if (address.contains("OUTGET")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "takeFinish");
|
jo.put("feedbackStatus", "takeFinish");
|
||||||
log.info("取货完成请求参数:{}", jo);
|
log.info("取货完成请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("status",200);
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
return jo2;
|
return jo2;
|
||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("上位系统不允许取货完成离开");
|
throw new BadRequestException("上位系统不允许取货完成离开");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// //取货完成离开
|
// //取货完成离开
|
||||||
// else if (StrUtil.equals(type, "05") && address.endsWith("OUT")) {
|
// else if (StrUtil.equals(type, "05") && address.endsWith("OUT")) {
|
||||||
// is_feedback = true;
|
// is_feedback = true;
|
||||||
// }
|
// }
|
||||||
//请求放货
|
//请求放货
|
||||||
if (address.contains("INPUT")) {
|
if (address.contains("INPUT")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "applyPut");
|
jo.put("feedbackStatus", "applyPut");
|
||||||
log.info("请求放货请求参数:{}", jo);
|
log.info("请求放货请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("status",200);
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
return jo2;
|
return jo2;
|
||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("上位系统不允许请求放货");
|
throw new BadRequestException("上位系统不允许请求放货");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//放货完成
|
//放货完成
|
||||||
if (address.contains("OUTPUT")) {
|
if (address.contains("OUTPUT")) {
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("taskCode", task.getTask_code());
|
jo.put("taskCode", task.getTask_code());
|
||||||
jo.put("carId", inst.getCarno());
|
jo.put("carId", inst.getCarno());
|
||||||
jo.put("taskType ", task.getTask_type());
|
jo.put("taskType ", task.getTask_type());
|
||||||
jo.put("feedbackStatus", "putFinish");
|
jo.put("feedbackStatus", "putFinish");
|
||||||
log.info("放货完成请求参数:{}", jo);
|
log.info("放货完成请求参数:{}", jo);
|
||||||
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo);
|
||||||
JSONObject response = JSONObject.parseObject(result.body());
|
JSONObject response = JSONObject.parseObject(result.body());
|
||||||
int responseCode = response.getInteger("responseCode");
|
int responseCode = response.getInteger("responseCode");
|
||||||
if (responseCode == 0) {
|
if (responseCode == 0) {
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("status",200);
|
jo2.put("status",200);
|
||||||
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode);
|
||||||
return jo2;
|
return jo2;
|
||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("上位系统不允许放货完成离开");
|
throw new BadRequestException("上位系统不允许放货完成离开");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
}else {
|
||||||
|
//不请求上位,没有光电 默认通过请求
|
||||||
|
JSONObject jo2 = new JSONObject();
|
||||||
|
jo2.put("status",200);
|
||||||
|
log.info("不请求上位,没有光电,默认通过请求");
|
||||||
|
return jo2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@LokiLog(type = LokiLogType.AGV)
|
@LokiLog(type = LokiLogType.AGV)
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* @author ls
|
||||||
|
* @date 2023/12/6 16:04
|
||||||
|
*/
|
||||||
|
package org.nl.acs.common.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommonFinalParam {
|
||||||
|
|
||||||
|
public static final String DELETE = "0";
|
||||||
|
/**
|
||||||
|
* 分隔符
|
||||||
|
*/
|
||||||
|
private final String BARRE = "-";
|
||||||
|
private final String POINT = ".";
|
||||||
|
|
||||||
|
public static final String ZERO = "0";
|
||||||
|
public static final String ONE = "1";
|
||||||
|
|
||||||
|
public static final String TWO = "2";
|
||||||
|
|
||||||
|
public static final String THREE = "3";
|
||||||
|
public static final String FOUR = "4";
|
||||||
|
public static final String FIVE = "5";
|
||||||
|
public static final String SIX = "6";
|
||||||
|
public static final String SEVEN = "7";
|
||||||
|
public static final String EIGHT = "8";
|
||||||
|
public static final String NINE = "9";
|
||||||
|
public static final String TEN = "10";
|
||||||
|
public static final String ELEVEN = "11";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无货
|
||||||
|
*/
|
||||||
|
public static final int DEVICE_MOVE_ZERO = 0;
|
||||||
|
/**
|
||||||
|
* 设备联机等待
|
||||||
|
*/
|
||||||
|
public static final int DEVICE_MODE_TWO = 2;
|
||||||
|
/**
|
||||||
|
* 成功状态
|
||||||
|
*/
|
||||||
|
public static final int STATUS_OPEN = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动作信号
|
||||||
|
*/
|
||||||
|
public static final int ACTION_ONE = 1;
|
||||||
|
public static final int ACTION_TWO = 2;
|
||||||
|
public static final int ACTION_THREE = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请任务type类型
|
||||||
|
*/
|
||||||
|
public static final String TYPE_ONE = "1";
|
||||||
|
public static final String TYPE_TWO = "2";
|
||||||
|
public static final String TYPE_THREE = "3";
|
||||||
|
public static final String TYPE_FOUR = "4";
|
||||||
|
public static final String TYPE_FIVE = "5";
|
||||||
|
public static final String TYPE_SIX = "6";
|
||||||
|
public static final String TYPE_SEVEN = "7";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切割点符号
|
||||||
|
*/
|
||||||
|
public static final String DOT = ".";
|
||||||
|
/**
|
||||||
|
* 切割横杠符号
|
||||||
|
*/
|
||||||
|
public static final String HYPHEN_ = "-";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动门
|
||||||
|
*/
|
||||||
|
public static final String DOORS = "doors";
|
||||||
|
}
|
||||||
@@ -370,7 +370,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
//设备基础信息表【acs_device】
|
//设备基础信息表【acs_device】
|
||||||
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' and region = '" + region + "'", "device_code").getResultJSONArray(0);
|
JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' and region = '" + region + "'", "device_code").getResultJSONArray(0);
|
||||||
//acs_device_extra
|
//acs_device_extra
|
||||||
WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
// WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra");
|
||||||
JSONArray result = new JSONArray();
|
JSONArray result = new JSONArray();
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
JSONObject obj = arr.getJSONObject(i);
|
||||||
@@ -379,28 +379,28 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
|
|||||||
json.put("device_code", obj.getString("device_code"));
|
json.put("device_code", obj.getString("device_code"));
|
||||||
json.put("device_name", obj.getString("device_name"));
|
json.put("device_name", obj.getString("device_name"));
|
||||||
|
|
||||||
JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
|
// JSONArray extraArr = extraTab.query("device_id = '" + obj.getString("device_id") + "'").getResultJSONArray(0);
|
||||||
for (int m = 0; m < extraArr.size(); m++) {
|
// for (int m = 0; m < extraArr.size(); m++) {
|
||||||
JSONObject jsonObject = extraArr.getJSONObject(m);
|
// JSONObject jsonObject = extraArr.getJSONObject(m);
|
||||||
String extra_code = jsonObject.getString("extra_code");
|
// String extra_code = jsonObject.getString("extra_code");
|
||||||
//定点作业:自动创建任务
|
// //定点作业:自动创建任务
|
||||||
if ("auto_create_task".equals(extra_code)) {
|
// if ("auto_create_task".equals(extra_code)) {
|
||||||
json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
|
// json.put("auto_create_task", jsonObject.getBoolean("extra_value"));
|
||||||
}
|
// }
|
||||||
//呼叫
|
// //呼叫
|
||||||
if ("apply_task".equals(extra_code)) {
|
// if ("apply_task".equals(extra_code)) {
|
||||||
json.put("apply_task", jsonObject.getBoolean("extra_value"));
|
// json.put("apply_task", jsonObject.getBoolean("extra_value"));
|
||||||
}
|
// }
|
||||||
//响应
|
// //响应
|
||||||
if ("manual_create_task".equals(extra_code)) {
|
// if ("manual_create_task".equals(extra_code)) {
|
||||||
json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
|
// json.put("manual_create_task", jsonObject.getBoolean("extra_value"));
|
||||||
}
|
// }
|
||||||
//清除
|
// //清除
|
||||||
if ("auto_clean_task".equals(extra_code)) {
|
// if ("auto_clean_task".equals(extra_code)) {
|
||||||
json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
|
// json.put("auto_clean_task", jsonObject.getBoolean("extra_value"));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
result.add(json);
|
result.add(json);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.nl.acs.device.service.DeviceService;
|
|||||||
import org.nl.acs.device.service.StorageCellService;
|
import org.nl.acs.device.service.StorageCellService;
|
||||||
import org.nl.acs.device.service.dto.DeviceAssignedDto;
|
import org.nl.acs.device.service.dto.DeviceAssignedDto;
|
||||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||||
|
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
import org.nl.acs.ext.wms.service.AcsToWmsZDService;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
@@ -430,7 +431,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(TaskDto dto) throws Exception {
|
public void create(TaskDto dto) throws Exception {
|
||||||
dto = foramte(dto);
|
// dto = foramte(dto);
|
||||||
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
|
if (!StrUtil.isEmpty(dto.getVehicle_code())) {
|
||||||
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
|
TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code());
|
||||||
if (vehicle_dto != null) {
|
if (vehicle_dto != null) {
|
||||||
@@ -450,9 +451,13 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
}
|
}
|
||||||
String start_point_code = dto.getStart_point_code();
|
String start_point_code = dto.getStart_point_code();
|
||||||
String next_point_code = dto.getNext_point_code();
|
String next_point_code = dto.getNext_point_code();
|
||||||
String start_device_code = dto.getStart_device_code();
|
// String start_device_code = dto.getStart_device_code();
|
||||||
String next_device_code = dto.getNext_device_code();
|
// String next_device_code = dto.getNext_device_code();
|
||||||
|
String start_device_code = dto.getStart_point_code();
|
||||||
|
String next_device_code = dto.getNext_point_code();
|
||||||
String route_plan_code = dto.getRoute_plan_code();
|
String route_plan_code = dto.getRoute_plan_code();
|
||||||
|
dto.setStart_device_code(start_point_code);
|
||||||
|
dto.setNext_device_code(next_point_code);
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_by(currentUsername);
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_by(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
@@ -871,12 +876,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
|||||||
log.info("请求ZDwcs成功,任务取消 请求结果{}",responseCode);
|
log.info("请求ZDwcs成功,任务取消 请求结果{}",responseCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<RouteLineDto> shortPathsList =
|
// List<RouteLineDto> shortPathsList =
|
||||||
routeLineService.getShortPathLines(
|
// routeLineService.getShortPathLines(
|
||||||
entity.getStart_device_code(),
|
// entity.getStart_device_code(),
|
||||||
entity.getNext_device_code(),
|
// entity.getNext_device_code(),
|
||||||
entity.getRoute_plan_code());
|
// entity.getRoute_plan_code());
|
||||||
String type = shortPathsList.get(0).getType();
|
// String type = shortPathsList.get(0).getType();
|
||||||
// != 0 为agv任务
|
// != 0 为agv任务
|
||||||
// if (!StrUtil.equals(type, "0")) {
|
// if (!StrUtil.equals(type, "0")) {
|
||||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package org.nl.hand.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HeadDto implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始设备编码
|
||||||
|
*/
|
||||||
|
private String start_device_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标设备编码
|
||||||
|
*/
|
||||||
|
private String next_device_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
|
private String task_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料类型
|
||||||
|
*/
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package org.nl.hand.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HeadInstDto implements Serializable {
|
||||||
|
/**
|
||||||
|
* 关键字 可为载具号、指令号、agv车号
|
||||||
|
*/
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始设备编码
|
||||||
|
*/
|
||||||
|
private String start_devicecode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标设备编码
|
||||||
|
*/
|
||||||
|
private String next_devicecode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指令uuid
|
||||||
|
*/
|
||||||
|
private String inst_uuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
* 1 指令撤销
|
||||||
|
* 2 重新下发
|
||||||
|
* 3 强制完成
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package org.nl.hand.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HeadTaskDto implements Serializable {
|
||||||
|
/**
|
||||||
|
* 关键字 可为载具号、指令号、agv车号
|
||||||
|
*/
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始设备编码
|
||||||
|
*/
|
||||||
|
private String start_devicecode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标设备编码
|
||||||
|
*/
|
||||||
|
private String next_devicecode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务uuid
|
||||||
|
*/
|
||||||
|
private String task_uuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
* 1 重新生成
|
||||||
|
* 2 强制完成
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
private String task_id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package org.nl.hand.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RegionDto implements Serializable {
|
||||||
|
/**
|
||||||
|
* 区域编号
|
||||||
|
*/
|
||||||
|
private String region_code;
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package org.nl.hand.rest;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.modules.logging.annotation.Log;
|
||||||
|
import org.nl.hand.dto.HeadDto;
|
||||||
|
import org.nl.hand.dto.HeadInstDto;
|
||||||
|
import org.nl.hand.dto.HeadTaskDto;
|
||||||
|
import org.nl.hand.dto.RegionDto;
|
||||||
|
import org.nl.hand.service.HandService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "手持接口")
|
||||||
|
@RequestMapping("api/hand")
|
||||||
|
@Slf4j
|
||||||
|
public class HandController {
|
||||||
|
@Autowired
|
||||||
|
private HandService handService;
|
||||||
|
|
||||||
|
@PostMapping("/queryArea")
|
||||||
|
@Log("查询区域")
|
||||||
|
@ApiOperation("查询区域")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> queryArea() {
|
||||||
|
return new ResponseEntity<>(handService.queryArea(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryPointByArea")
|
||||||
|
@Log("根据区域编码查点位")
|
||||||
|
@ApiOperation("根据区域编码查点位")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> queryPointByArea(@RequestBody RegionDto dto) {
|
||||||
|
String region_code = dto.getRegion_code();
|
||||||
|
return new ResponseEntity<>(handService.queryPointByArea(region_code), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryBusinessProcesses")
|
||||||
|
@Log("查询任务流程")
|
||||||
|
@ApiOperation("查询任务流程")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> queryBusinessProcesses() {
|
||||||
|
return new ResponseEntity<>(handService.queryBusinessProcesses(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/callTask")
|
||||||
|
@Log("手持创建任务")
|
||||||
|
@ApiOperation("手持创建任务")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> callTask(@RequestBody HeadDto dto) {
|
||||||
|
return new ResponseEntity<>(handService.callTask(dto), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/insts")
|
||||||
|
@Log("查询未完成指令")
|
||||||
|
@ApiOperation("查询未完成指令")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> queryInst(@RequestBody HeadInstDto dto) {
|
||||||
|
return new ResponseEntity<>(handService.queryInst(dto), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/inst")
|
||||||
|
@Log("指令操作")
|
||||||
|
@ApiOperation("指令操作")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> instOpt(@RequestBody HeadInstDto dto) throws Exception {
|
||||||
|
return new ResponseEntity<>(handService.instOpt(dto), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tasks")
|
||||||
|
@Log("查询未完成指令")
|
||||||
|
@ApiOperation("查询未完成指令")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> querytasks(@RequestBody HeadTaskDto dto, HttpServletRequest request ) {
|
||||||
|
request.getHeader("Accept-Language");
|
||||||
|
return new ResponseEntity<>(handService.querytasks(dto), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/taskoperation")
|
||||||
|
@Log("指令操作")
|
||||||
|
@ApiOperation("指令操作")
|
||||||
|
@SaIgnore
|
||||||
|
//@PreAuthorize("@el.check('sect:list')")
|
||||||
|
public ResponseEntity<Object> taskOperation(@RequestBody HeadTaskDto dto) throws Exception {
|
||||||
|
return new ResponseEntity<>(handService.taskOperation(dto), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.nl.hand.service;
|
||||||
|
|
||||||
|
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.hand.dto.HeadDto;
|
||||||
|
import org.nl.hand.dto.HeadInstDto;
|
||||||
|
import org.nl.hand.dto.HeadTaskDto;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 16:45
|
||||||
|
*/
|
||||||
|
public interface HandService {
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> queryPointByArea(String region_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手持创建任务
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> callTask(HeadDto dto);
|
||||||
|
|
||||||
|
Map<String, Object> queryArea();
|
||||||
|
|
||||||
|
Map<String, Object> queryBusinessProcesses();
|
||||||
|
|
||||||
|
Map<String, Object> queryInst(HeadInstDto dto);
|
||||||
|
|
||||||
|
Map<String, Object> instOpt(HeadInstDto dto) throws Exception;
|
||||||
|
|
||||||
|
Map<String, Object> querytasks(HeadTaskDto dto);
|
||||||
|
|
||||||
|
Map<String, Object> taskOperation(HeadTaskDto dto);
|
||||||
|
}
|
||||||
@@ -0,0 +1,474 @@
|
|||||||
|
package org.nl.hand.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.agv.server.NDCAgvService;
|
||||||
|
import org.nl.acs.common.base.CommonFinalParam;
|
||||||
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||||
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
|
import org.nl.hand.dto.HeadDto;
|
||||||
|
import org.nl.hand.dto.HeadInstDto;
|
||||||
|
import org.nl.hand.dto.HeadTaskDto;
|
||||||
|
import org.nl.hand.service.HandService;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.system.service.DictDetailService;
|
||||||
|
import org.nl.modules.system.service.DictService;
|
||||||
|
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||||
|
import org.nl.modules.system.service.dto.DictDto;
|
||||||
|
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : dsh
|
||||||
|
* @create 2025/2/6 19:01
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class HandServiceImpl implements HandService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceService deviceService;
|
||||||
|
@Autowired
|
||||||
|
private TaskService taskserver;
|
||||||
|
@Resource
|
||||||
|
private DictService dictService;
|
||||||
|
@Autowired
|
||||||
|
private DictDetailService dictDetailService;
|
||||||
|
@Autowired
|
||||||
|
private InstructionService instructionService;
|
||||||
|
@Autowired
|
||||||
|
NDCAgvService ndcAgvService;
|
||||||
|
@Autowired
|
||||||
|
DeviceAppService deviceAppService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryPointByArea(String region_code) {
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
if (StrUtil.isEmpty(region_code)) {
|
||||||
|
throw new BadRequestException("区域编码不能为空!");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// //根据区域编码查询所有设备
|
||||||
|
JSONArray list = deviceService.selectDeviceListByRegion(region_code);
|
||||||
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
|
throw new BadRequestException("没有查询到设备");
|
||||||
|
}
|
||||||
|
// for (int i = 0; i < list.size(); i++) {
|
||||||
|
// JSONObject jo = new JSONObject();
|
||||||
|
// Object device = list.get(i);
|
||||||
|
// String device_id = device.getDevice_id();
|
||||||
|
// String device_code = device.getDevice_code();
|
||||||
|
// String device_name = device.getDevice_name();
|
||||||
|
// jo.put("device_id", device_id);
|
||||||
|
// jo.put("device_code", device_code);
|
||||||
|
// jo.put("device_name", device_name);
|
||||||
|
// data.add(jo);
|
||||||
|
// }
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
resultJson.put("message", "200");
|
||||||
|
resultJson.put("data", list);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> callTask(HeadDto dto) {
|
||||||
|
JSONArray errArr = new JSONArray();
|
||||||
|
String start_device_code = dto.getStart_device_code();
|
||||||
|
String next_device_code = dto.getNext_device_code();
|
||||||
|
String task_type = dto.getTask_type();
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(start_device_code)) {
|
||||||
|
throw new BadRequestException("起点不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(next_device_code)) {
|
||||||
|
throw new BadRequestException("终点不能为空");
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(task_type)) {
|
||||||
|
throw new BadRequestException("任务类型不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// String start_device_code2 = "";
|
||||||
|
// String next_device_code2 = "";
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
// if (StrUtil.equals(task_type, CommonFinalParam.TYPE_ONE)) {
|
||||||
|
// String s = start_device_code.substring(start_device_code.length() - 1);
|
||||||
|
// if (StrUtil.equals("K", s)) {
|
||||||
|
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "M";
|
||||||
|
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "M";
|
||||||
|
// jo.put("start_device_code2", start_device_code2);
|
||||||
|
// jo.put("next_device_code2", next_device_code2);
|
||||||
|
// jo.put("start_point_code2", start_device_code2);
|
||||||
|
// jo.put("next_point_code2", next_device_code2);
|
||||||
|
// }else{
|
||||||
|
// throw new BadRequestException("起点设备名称不符");
|
||||||
|
// }
|
||||||
|
// } else if (StrUtil.equals(task_type, CommonFinalParam.TYPE_TWO)) {
|
||||||
|
// String s = start_device_code.substring(start_device_code.length() - 1);
|
||||||
|
// String n = next_device_code.substring(next_device_code.length() - 1);
|
||||||
|
// if (StrUtil.equals("M", s) && StrUtil.equals("M", n)) {
|
||||||
|
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "K";
|
||||||
|
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||||
|
// jo.put("start_device_code2", start_device_code2);
|
||||||
|
// jo.put("next_device_code2", next_device_code2);
|
||||||
|
// jo.put("start_point_code2", start_device_code2);
|
||||||
|
// jo.put("next_point_code2", next_device_code2);
|
||||||
|
// }else if(StrUtil.equals("S", n) && StrUtil.equals("M", s)){
|
||||||
|
// start_device_code2 = next_device_code.substring(0, next_device_code.length() - 1) + "X";
|
||||||
|
// next_device_code2 = start_device_code.substring(0, start_device_code.length() - 1) + "K";
|
||||||
|
// jo.put("start_device_code2", start_device_code2);
|
||||||
|
// jo.put("next_device_code2", next_device_code2);
|
||||||
|
// jo.put("start_point_code2", start_device_code2);
|
||||||
|
// jo.put("next_point_code2", next_device_code2);
|
||||||
|
// }else{
|
||||||
|
// throw new BadRequestException("起点设备名称不符");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// Device startDevice = deviceAppService.findDeviceByCode(start_device_code2);
|
||||||
|
// Device nextDevice = deviceAppService.findDeviceByCode(next_device_code2);
|
||||||
|
// if(StrUtil.isAllNotEmpty(start_device_code2,next_device_code2) && ObjectUtil.isAllEmpty(startDevice,nextDevice)){
|
||||||
|
// throw new BadRequestException("起点终点设备不存在");
|
||||||
|
// }
|
||||||
|
jo.put("start_device_code", start_device_code);
|
||||||
|
jo.put("next_device_code", next_device_code);
|
||||||
|
jo.put("start_point_code", start_device_code);
|
||||||
|
jo.put("next_point_code", next_device_code);
|
||||||
|
jo.put("task_type", task_type);
|
||||||
|
jo.put("agv_system_type", "1");
|
||||||
|
jo.put("priority", "1");
|
||||||
|
|
||||||
|
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||||
|
try {
|
||||||
|
taskserver.create(task_dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("message", e.getMessage());
|
||||||
|
errArr.add(json);
|
||||||
|
throw new RuntimeException(e.getMessage());
|
||||||
|
}
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
if (ObjectUtil.isEmpty(errArr)) {
|
||||||
|
resultJson.put("message", "操作成功");
|
||||||
|
resultJson.put("data", data);
|
||||||
|
} else {
|
||||||
|
resultJson.put("message", "操作失败");
|
||||||
|
resultJson.put("data", data);
|
||||||
|
}
|
||||||
|
// JSONObject resultJson = new JSONObject();
|
||||||
|
// resultJson.put("message", "操作成功");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryArea() {
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
List<DictDetailDto> list = dictDetailService.getDictByName("region_type");
|
||||||
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
|
throw new BadRequestException("没找到区域");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
DictDetailDto dict = list.get(i);
|
||||||
|
String region_id = dict.getId().toString();
|
||||||
|
String region_code = dict.getValue();
|
||||||
|
String region_name = dict.getLabel();
|
||||||
|
jo.put("region_id", region_id);
|
||||||
|
jo.put("region_code", region_code);
|
||||||
|
jo.put("region_name", region_name);
|
||||||
|
data.add(jo);
|
||||||
|
}
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
resultJson.put("message", "查询成功!");
|
||||||
|
resultJson.put("data", data);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryBusinessProcesses() {
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
DictQueryCriteria dictQueryCriteria = new DictQueryCriteria();
|
||||||
|
dictQueryCriteria.setBlurry("BusinessProcesses_");
|
||||||
|
List<DictDto> dictDtos = dictService.queryAll(dictQueryCriteria);
|
||||||
|
if (CollectionUtil.isEmpty(dictDtos)) {
|
||||||
|
throw new BadRequestException("没找到业务流程");
|
||||||
|
}
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
resultJson.put("message", "查询成功!");
|
||||||
|
resultJson.put("data", dictDtos);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryInst(HeadInstDto dto) {
|
||||||
|
//查询未完成的指令
|
||||||
|
// String key = dto.getKeyword();
|
||||||
|
// String start_point = dto.getStart_devicecode();
|
||||||
|
// String next_point = dto.getNext_devicecode();
|
||||||
|
//
|
||||||
|
// List<InstructionMybatis> list;
|
||||||
|
// if (StrUtil.isEmpty(key)&&StrUtil.isEmpty(start_point)&&StrUtil.isEmpty(next_point)){
|
||||||
|
// list = instructionService.lambdaQuery()
|
||||||
|
// .orderByDesc(InstructionMybatis::getCreate_time)
|
||||||
|
// .list();
|
||||||
|
// }else {
|
||||||
|
// list = instructionService.lambdaQuery()
|
||||||
|
// .like(InstructionMybatis::getStart_device_code, start_point)
|
||||||
|
// .like(InstructionMybatis::getNext_device_code, next_point)
|
||||||
|
// .ne(InstructionMybatis::getInstruction_status, "2")
|
||||||
|
// .eq(InstructionMybatis::getInstruction_code, key)
|
||||||
|
// .or()
|
||||||
|
// .eq(InstructionMybatis::getCarno, key)
|
||||||
|
// .or()
|
||||||
|
// .eq(InstructionMybatis::getVehicle_code, key)
|
||||||
|
// .orderByDesc(InstructionMybatis::getCreate_time)
|
||||||
|
// .list();
|
||||||
|
// }
|
||||||
|
// if (CollectionUtil.isEmpty(list)){
|
||||||
|
// throw new BadRequestException(LangProcess.msg("error_no_ins"));
|
||||||
|
// }
|
||||||
|
// JSONArray data = new JSONArray();
|
||||||
|
// for (int i = 0; i < list.size(); i++) {
|
||||||
|
// Device deviceCodeStart = deviceAppService.findDeviceByCode(list.get(i).getStart_device_code());
|
||||||
|
// Device deviceCodeEnd = deviceAppService.findDeviceByCode(list.get(i).getNext_device_code());
|
||||||
|
//
|
||||||
|
// JSONObject inst = new JSONObject();
|
||||||
|
// inst.put("inst_uuid",list.get(i).getInstruction_id());
|
||||||
|
// inst.put("task_no",list.get(i).getTask_code());
|
||||||
|
// inst.put("instruction_code",list.get(i).getInstruction_code());
|
||||||
|
// inst.put("start_devicecode",list.get(i).getStart_device_code());
|
||||||
|
// inst.put("start_en_devicecode",deviceCodeStart.getEn_device_name());
|
||||||
|
// inst.put("start_ko_devicecode",deviceCodeStart.getKo_device_name());
|
||||||
|
// inst.put("next_devicecode",list.get(i).getNext_device_code());
|
||||||
|
// inst.put("next_en_devicecode",deviceCodeEnd.getEn_device_name());
|
||||||
|
// inst.put("next_ko_devicecode",deviceCodeEnd.getKo_device_name());
|
||||||
|
// inst.put("inst_status",list.get(i).getInstruction_status());
|
||||||
|
// inst.put("carrier",list.get(i).getVehicle_code());
|
||||||
|
// inst.put("inst_step",list.get(i).getExecute_message());
|
||||||
|
// inst.put("priority",list.get(i).getPriority());
|
||||||
|
// inst.put("create_time",list.get(i).getCreate_time());
|
||||||
|
// inst.put("carno",list.get(i).getCarno());
|
||||||
|
// data.add(inst);
|
||||||
|
// }
|
||||||
|
// JSONObject resultJson = new JSONObject();
|
||||||
|
// resultJson.put("message", LangProcess.msg("universal_directives_message1"));
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> instOpt(HeadInstDto dto) throws Exception {
|
||||||
|
// JSONObject resultJson = new JSONObject();
|
||||||
|
// JSONArray data = new JSONArray();
|
||||||
|
// String type = dto.getType();
|
||||||
|
// String inst_uuid = dto.getInst_uuid();
|
||||||
|
// InstructionMybatis instruction= instructionService.lambdaQuery()
|
||||||
|
// .eq(InstructionMybatis::getInstruction_id, inst_uuid)
|
||||||
|
// .one();
|
||||||
|
// if(instruction==null){
|
||||||
|
// resultJson.put("message", "未找到该指令!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// if (StrUtil.equals(instruction.getInstruction_status(),"2")||
|
||||||
|
// StrUtil.equals(instruction.getInstruction_status(),"3")){
|
||||||
|
// resultJson.put("message", "指令已完成或已取消,无法操作!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* 1 指令撤销
|
||||||
|
// 2 重新下发
|
||||||
|
// 3 强制完成*/
|
||||||
|
// if ("1".equals(type)){
|
||||||
|
// try {
|
||||||
|
// if (StrUtil.isEmpty(instruction.getAgv_jobno())){
|
||||||
|
// instructionService.cancelNOSendAgv(inst_uuid);
|
||||||
|
// }else {
|
||||||
|
// ndcAgvService.deleteAgvInstToNDC(BeanUtil.copyProperties(instruction, Instruction.class));
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// resultJson.put("message", "下发agv失败!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// }else if ("2".equals(type)){
|
||||||
|
// try {
|
||||||
|
// ndcAgvService.sendAgvInstToNDC(instruction.getAgv_system_type(),BeanUtil.copyProperties(instruction, Instruction.class));
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// resultJson.put("message", "下发agv失败!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// }else if ("3".equals(type)){
|
||||||
|
// try {
|
||||||
|
// instructionService.finish(inst_uuid);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// resultJson.put("message", e.getMessage());
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// resultJson.put("message", "操作成功");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> querytasks(HeadTaskDto dto) {
|
||||||
|
String key = dto.getKeyword();
|
||||||
|
String start_point = dto.getStart_devicecode();
|
||||||
|
String next_point = dto.getNext_devicecode();
|
||||||
|
|
||||||
|
List<TaskDto> list = taskserver.queryAllUnfinished(new HashMap());;
|
||||||
|
// if (StrUtil.isEmpty(key)&&StrUtil.isEmpty(start_point)&&StrUtil.isEmpty(next_point)){
|
||||||
|
// list = taskserver.queryAllUnfinished(new HashMap());
|
||||||
|
// }else {
|
||||||
|
// list = taskserver.lambdaQuery()
|
||||||
|
//// .like(Task::getStart_device_code, start_point)
|
||||||
|
//// .like(Task::getNext_device_code, next_point)
|
||||||
|
// .lt(Task::getTask_status, "2")
|
||||||
|
// .eq(Task::getTask_code, key)
|
||||||
|
// .or()
|
||||||
|
// .eq(Task::getVehicle_code, key)
|
||||||
|
// .or()
|
||||||
|
// .eq(Task::getTask_id, key)
|
||||||
|
// .orderByDesc(Task::getCreate_time)
|
||||||
|
// .list();
|
||||||
|
// }
|
||||||
|
if (CollectionUtil.isEmpty(list)){
|
||||||
|
throw new BadRequestException("没有任务");
|
||||||
|
}
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
// Device deviceCodeStart = deviceAppService.findDeviceByCode(list.get(i).getStart_device_code());
|
||||||
|
// Device deviceCodeEnd = deviceAppService.findDeviceByCode(list.get(i).getNext_device_code());
|
||||||
|
|
||||||
|
JSONObject task = new JSONObject();
|
||||||
|
task.put("task_uuid", list.get(i).getTask_id());
|
||||||
|
task.put("task_no", list.get(i).getTask_code());
|
||||||
|
task.put("start_devicecode", list.get(i).getStart_device_code());
|
||||||
|
task.put("next_devicecode", list.get(i).getNext_device_code());
|
||||||
|
task.put("task_status", list.get(i).getTask_status());
|
||||||
|
task.put("priority", list.get(i).getPriority());
|
||||||
|
task.put("create_time", list.get(i).getCreate_time());
|
||||||
|
task.put("carrier", list.get(i).getVehicle_code());
|
||||||
|
data.add(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
resultJson.put("message", "universal_directives_message1");
|
||||||
|
resultJson.put("data", data);
|
||||||
|
return resultJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> taskOperation(HeadTaskDto dto) {
|
||||||
|
// JSONObject resultJson = new JSONObject();
|
||||||
|
// JSONArray data = new JSONArray();
|
||||||
|
// String type = dto.getType();
|
||||||
|
// String task_uuid = dto.getTask_uuid();
|
||||||
|
// if (StrUtil.isEmpty(type)){
|
||||||
|
// throw new BadRequestException("操作类型不能为空!");
|
||||||
|
// }
|
||||||
|
// if (StrUtil.isEmpty(task_uuid)){
|
||||||
|
// throw new BadRequestException("id不能为空!");
|
||||||
|
// }
|
||||||
|
// TaskDto taskDto = taskserver.findById(task_uuid);
|
||||||
|
// if (BeanUtil.isEmpty(taskDto)){
|
||||||
|
// throw new BadRequestException("任务为空!");
|
||||||
|
// }
|
||||||
|
// String task_code = taskDto.getTask_code();
|
||||||
|
// String start_device_code = taskDto.getStart_device_code();
|
||||||
|
// String next_device_code = taskDto.getNext_device_code();
|
||||||
|
// String task_id = taskDto.getTask_id();
|
||||||
|
//
|
||||||
|
// if(StrUtil.equals(taskDto.getTask_status(),"2")||StrUtil.equals(taskDto.getTask_status(),"3")){
|
||||||
|
// resultJson.put("message", "任务已完成或已取消,无法操作");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// if ("1".equals(type)){
|
||||||
|
// //重新生成指令
|
||||||
|
// Instruction instdto = new Instruction();
|
||||||
|
// instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||||
|
// instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
|
||||||
|
// instdto.setRemark(taskDto.getRemark());
|
||||||
|
// instdto.setMaterial(taskDto.getMaterial());
|
||||||
|
// instdto.setTask_id(task_id);
|
||||||
|
// instdto.setTask_code(task_code);
|
||||||
|
// instdto.setVehicle_code(taskDto.getVehicle_code());
|
||||||
|
// String now = DateUtil.now();
|
||||||
|
// instdto.setCreate_time(now);
|
||||||
|
// instdto.setCreate_by("auto");
|
||||||
|
// instdto.setStart_point_code(taskDto.getStart_point_code());
|
||||||
|
// instdto.setNext_point_code(taskDto.getNext_point_code());
|
||||||
|
// instdto.setStart_device_code(start_device_code);
|
||||||
|
// instdto.setNext_device_code(next_device_code);
|
||||||
|
// instdto.setInstruction_status("0");
|
||||||
|
// InstructionMybatis instructionMybatis = instructionService.lambdaQuery()
|
||||||
|
// .eq(InstructionMybatis::getStart_device_code, start_device_code)
|
||||||
|
// .eq(InstructionMybatis::getNext_device_code, next_device_code)
|
||||||
|
// .lt(InstructionMybatis::getInstruction_status, "2")
|
||||||
|
// .eq(InstructionMybatis::getTask_id,task_uuid)
|
||||||
|
// .one();
|
||||||
|
// if (BeanUtil.isNotEmpty(instructionMybatis)){
|
||||||
|
// resultJson.put("message", task_code + ":该任务已存在待完成指令!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// try{
|
||||||
|
// instructionService.create(instdto);
|
||||||
|
// } catch (Exception e){
|
||||||
|
// resultJson.put("message", e.getMessage());
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// instdto.setExecute_code(start_device_code);
|
||||||
|
// }else if ("2".equals(type)){
|
||||||
|
// //强制完成
|
||||||
|
// Instruction instruction = instructionService.findByTaskid(task_uuid, "instruction_status <2 ");
|
||||||
|
// if (instruction!=null){
|
||||||
|
// resultJson.put("message", "有指令未完成!");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
// return resultJson;
|
||||||
|
// }
|
||||||
|
// TaskIdAndStatusDTO taskIdAndStatusDTO = new TaskIdAndStatusDTO();
|
||||||
|
// taskIdAndStatusDTO.setTask_id(task_uuid);
|
||||||
|
// taskIdAndStatusDTO.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||||
|
// taskserver.finish(taskIdAndStatusDTO);
|
||||||
|
// }
|
||||||
|
// resultJson.put("message", "操作成功");
|
||||||
|
// resultJson.put("data", data);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,9 +6,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zdlb_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nldy_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:root}
|
password: ${DB_PWD:123456}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ spring:
|
|||||||
freemarker:
|
freemarker:
|
||||||
check-template-location: false
|
check-template-location: false
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
|||||||
|
|
||||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||||
VUE_APP_BASE_API = 'http://172.18.10.14:8011'
|
VUE_APP_BASE_API = 'http://127.0.0.1:8011'
|
||||||
# 如果接口是 http 形式, wss 需要改为 ws
|
# 如果接口是 http 形式, wss 需要改为 ws
|
||||||
VUE_APP_WS_API = 'ws://172.18.10.14:8011'
|
VUE_APP_WS_API = 'ws://127.0.0.1:8011'
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
"name": "eladmin-web",
|
"name": "eladmin-web",
|
||||||
"version": "2.6.0",
|
"version": "2.6.0",
|
||||||
"description": "EL-ADMIN 前端源码",
|
"description": "EL-ADMIN 前端源码",
|
||||||
"author": "Zheng Jie",
|
"author": "dsh",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"dev2": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
"dev2": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
|
|||||||
Reference in New Issue
Block a user