rev:修改设备UI查询,错误代码解析。
This commit is contained in:
@@ -115,26 +115,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String old_device_code = null;
|
||||
String emptyNum = null;
|
||||
String device_code = null;
|
||||
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setDevice_code(this.device_code);
|
||||
// request.setType("3");
|
||||
// request.setState("故障");
|
||||
// acsToWmsService.notify(request);
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
// if (phase == 0x67) {
|
||||
// //故障信息
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setDevice_code(this.device_code);
|
||||
// request.setType("3");
|
||||
// request.setState("故障");
|
||||
// acsToWmsService.notify(request);
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// }
|
||||
TaskDto task = new TaskDto();
|
||||
|
||||
if(ObjectUtil.isNotEmpty(inst)){
|
||||
task = taskService.findById(inst.getTask_id());
|
||||
}
|
||||
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x02) {
|
||||
|
||||
@@ -785,10 +785,10 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
|
||||
new ApplyLabelingAndBindingRequest();
|
||||
// JSONObject device_json =
|
||||
// WQLObject.getWQLObject("acs_storage_cell")
|
||||
// .query("storage_code ='" + this.device_code + "'")
|
||||
// .uniqueResult(0);
|
||||
// JSONObject device_json =
|
||||
// WQLObject.getWQLObject("acs_storage_cell")
|
||||
// .query("storage_code ='" + this.device_code + "'")
|
||||
// .uniqueResult(0);
|
||||
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper).eq(StorageCell::getStorage_code,this.device_code).one();
|
||||
String start_point_code = null;
|
||||
if (!ObjectUtil.isEmpty(storageCell)) {
|
||||
|
||||
@@ -115,11 +115,11 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
if (state != last_state) {
|
||||
//固化室状态变更后通知lms更新固化室状态
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setState(String.valueOf(state));
|
||||
request.setDevice_code(this.devicecode);
|
||||
request.setType("1");
|
||||
acsToWmsService.notify(request);
|
||||
// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
// request.setState(String.valueOf(state));
|
||||
// request.setDevice_code(this.devicecode);
|
||||
// request.setType("1");
|
||||
// acsToWmsService.notify(request);
|
||||
}
|
||||
last_action = action;
|
||||
last_mode = mode;
|
||||
|
||||
@@ -128,6 +128,8 @@ public class ItemProtocol {
|
||||
return "0";
|
||||
}
|
||||
|
||||
|
||||
//保湿间
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_x0, "系统状态", "400001"));
|
||||
|
||||
@@ -1,43 +1,23 @@
|
||||
package org.nl.acs.device_driver.tianneng.guhuashi;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.acs.utils.ReadUtil;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import static org.nl.common.utils.StringUtils.handleErrorCode;
|
||||
|
||||
/**
|
||||
* 检测站点驱动
|
||||
@@ -195,6 +175,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//todo 错误码转换
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(VD7046));
|
||||
//有故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("否"));
|
||||
acsToWmsService.notify(request);
|
||||
}else if(VD7046 != last_VD7046) {
|
||||
log.info("固化室{}反馈固化室发生异常,开始通知lms", devicecode);
|
||||
@@ -203,6 +185,11 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
//todo 错误码转换
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(VD7046));
|
||||
//String ghsErrorCode = "10001000000010000001000010001000";
|
||||
String ghsErrorMessages = handleErrorCode(String.valueOf(VD7046), AcsDefineEnum.GHS_ERROR_STATUS);
|
||||
request.setState(ghsErrorMessages);
|
||||
//有故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("是"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.data.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
@@ -164,12 +165,24 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
}
|
||||
//todo 错误码转换
|
||||
if (error != last_error ) {
|
||||
|
||||
if (error != last_error && error == 0) {
|
||||
log.info("输送线{}反馈输送线恢复正常,开始通知lms", device_code);
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.device_code);
|
||||
request.setType("3");
|
||||
request.setState(String.valueOf(error));
|
||||
//无故障
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("否"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
else if (error != last_error ) {
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.device_code);
|
||||
request.setType("3");
|
||||
//todo 错误码转换
|
||||
request.setState(String.valueOf(error));
|
||||
request.setCurrent_status(AcsDefineEnum.IS_NOTANDYES.code("是"));
|
||||
acsToWmsService.notify(request);
|
||||
}
|
||||
} catch (Exception var17) {
|
||||
|
||||
@@ -118,6 +118,7 @@ public class ItemProtocol {
|
||||
|
||||
}
|
||||
|
||||
//涂板线,未对接
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package org.nl.acs.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* acs状态枚举
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2024-01-31
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum AcsDefineEnum {
|
||||
|
||||
//固化室错误码
|
||||
GHS_ERROR_STATUS(MapOf.of("排湿风机变频故障", "1", "主变频器故障", "2", "低水位报警", "3", "低气压报警", "4", "温度异常报警", "5", "湿度异常报警", "6",
|
||||
"电动门运行故障", "7", "前门安全气缸限位故障", "8", "前门压紧气缸限位故障", "9", "后门安全气缸限位故障", "10", "后门压紧气缸限位故障", "11", "热风机运行失败",
|
||||
"12", "燃烧器故障", "13", "高压泵故障", "14", "循环风机过载", "15", "温度1比较值超限", "16", "温度2比较值超限", "17",
|
||||
"高压泵运行故障", "18", "热风进风口开未到位故障", "19", "热风出风口开未到位故障", "20", "湿度1比较值超限", "21", "湿度2比较值超限", "22")),
|
||||
|
||||
|
||||
//是否
|
||||
IS_NOTANDYES(MapOf.of("否", "0", "是", "1"));
|
||||
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public Long longCode(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return Long.valueOf(code);
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
|
||||
public String check1(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
|
||||
public String getErrorMessage(String code) {
|
||||
for (Map.Entry<String, String> entry : this.code.entrySet()) {
|
||||
if (entry.getValue().equals(code)) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.acs.enums;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2022/11/29 2:55 下午
|
||||
*/
|
||||
public class MapOf implements Serializable {
|
||||
|
||||
public static <K> HashMap of(K... key) {
|
||||
HashMap map = new HashMap<>();
|
||||
for (int i = 0; i < (key.length & ~1); i = i + 2) {
|
||||
map.put(key[i], key[i + 1]);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,12 @@ public class FeedBackTaskStatusRequest extends BaseRequest {
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
|
||||
/**
|
||||
* 当前状态
|
||||
*/
|
||||
private String current_status;
|
||||
|
||||
/**
|
||||
* 动作 1请求取货 2取货完成 3请求放货 4放货完成
|
||||
*/
|
||||
|
||||
@@ -326,7 +326,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
|
||||
log.info("feedbackOrderStatus----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
@@ -334,7 +333,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
//System.out.println(msg);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -238,6 +238,10 @@ public class InstructionMybatis extends CommonModel<InstructionMybatis> implemen
|
||||
@ApiModelProperty(value = "AGV系统类型")
|
||||
private String agv_system_type;
|
||||
|
||||
@ApiModelProperty(value = "lms任务id")
|
||||
private String ext_task_id;
|
||||
|
||||
|
||||
public void copyFrom(Instruction source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.instruction.service.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -343,9 +344,12 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String next_parent_code;
|
||||
|
||||
/**
|
||||
* AGV系统类型
|
||||
*/
|
||||
|
||||
private String agv_system_type;
|
||||
|
||||
|
||||
/**
|
||||
* lms任务id
|
||||
*/
|
||||
private String ext_task_id;
|
||||
}
|
||||
|
||||
@@ -372,6 +372,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
|
||||
dto.setRoute_plan_code(task.getRoute_plan_code());
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||
dto.setPriority(task.getPriority());
|
||||
}
|
||||
@@ -411,7 +412,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setCompound_inst_data(task.getCompound_task_data());
|
||||
}
|
||||
}
|
||||
|
||||
//todo 增加lms任务id
|
||||
dto.setExt_task_id(task.getExt_task_id());
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_time(now);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.acs.instruction.service.mapper;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.common.base.CommonMapper;
|
||||
@@ -13,9 +15,5 @@ import org.springframework.stereotype.Repository;
|
||||
*/
|
||||
@Repository
|
||||
public interface InstructionMapper extends CommonMapper<InstructionMybatis> {
|
||||
List<Instruction> getByTaskId(@Param("task_id")String task_id);
|
||||
// List<Instruction> getallbyinstruction_statusAndis_delete();
|
||||
|
||||
|
||||
|
||||
List<Map<String, Object>> getTaskFromInstruction(@Param("deviceCodes") List<String> deviceCodes);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nl.basjes.parse.useragent.UserAgent;
|
||||
import nl.basjes.parse.useragent.UserAgentAnalyzer;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.enums.AcsDefineEnum;
|
||||
import org.nl.config.ElAdminProperties;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
|
||||
@@ -28,9 +30,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
@@ -252,4 +252,26 @@ public class StringUtils {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String handleErrorCode(String errorCode, AcsDefineEnum deviceEnum) {
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
// if (errorCode.length() != 32) {
|
||||
// throw new RuntimeException("错误代码必须是32位!");
|
||||
// }
|
||||
for (int i = 0; i < errorCode.length(); i++) {
|
||||
char bit = errorCode.charAt(i);
|
||||
if (bit == '1') {
|
||||
String errorNumber = String.valueOf(i + 1);
|
||||
String errorMessage = deviceEnum.getErrorMessage(errorNumber);
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(errorMessage)) {
|
||||
errorMessages.add(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(errorMessages)) {
|
||||
return String.join(", ", errorMessages);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,8 @@ public class AutoCreateInst {
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
//todo lms任务id
|
||||
instdto.setExt_task_id(acsTask.getExt_task_id());
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.nl.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -13,8 +13,7 @@ import org.nl.acs.device_driver.tianneng.baoshijian.BaoshijianSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site.SiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.site_status.SiteStatusDeviceDriver;
|
||||
import org.nl.acs.device_driver.tianneng.tubanxian.TubanxianSiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
@@ -23,6 +22,8 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 自动同步设备状态
|
||||
@@ -41,6 +42,8 @@ public class SyncDeviceStatus {
|
||||
@Resource
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
@Resource
|
||||
private InstructionService instructionService;
|
||||
|
||||
public void run() throws Exception {
|
||||
rgv();
|
||||
@@ -53,6 +56,25 @@ public class SyncDeviceStatus {
|
||||
HttpResponse response = agvService.queryAgvDeviceStatus("1");
|
||||
//查询AGV指令列表
|
||||
JSONArray jsonArray = JSONArray.parseArray(response.body());
|
||||
List<String> task_codes = jsonArray.stream()
|
||||
.map(r -> ((JSONObject) r).getString("task_code"))
|
||||
.collect(Collectors.toList());
|
||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getInstruction_code, task_codes));
|
||||
if (ObjectUtil.isNotEmpty(instructionList)) {
|
||||
Map<String, String> taskCodeToTaskIdMap = instructionList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
InstructionMybatis::getInstruction_code,
|
||||
InstructionMybatis::getTask_id
|
||||
));
|
||||
jsonArray.forEach(r -> {
|
||||
JSONObject Item = (JSONObject) r;
|
||||
Item.put("task_id", "");
|
||||
String taskId = taskCodeToTaskIdMap.get(Item.getString("task_code"));
|
||||
if (taskId != null) {
|
||||
Item.put("task_id", taskId);
|
||||
}
|
||||
});
|
||||
}
|
||||
redisUtils.set("RGV", jsonArray);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程查询浙大RGV设备状态失败{}{}", e, e.getMessage());
|
||||
@@ -65,25 +87,25 @@ public class SyncDeviceStatus {
|
||||
JSONArray baoshijian = new JSONArray();
|
||||
JSONArray guhuashi = new JSONArray();
|
||||
JSONArray site = new JSONArray();
|
||||
JSONArray AGV = new JSONArray();
|
||||
log.info("自动线程开始查询AGV设备状态");
|
||||
JSONArray agv = new JSONArray();
|
||||
log.info("自动线程开始查询agv设备状态");
|
||||
List<Device> deviceList = deviceAppService.findAllDevice();
|
||||
for (Device device : deviceList) {
|
||||
if (device.getDeviceDriver() instanceof BaoshijianSiteDeviceDriver) {
|
||||
BaoshijianSiteDeviceDriver baoshijianSiteDeviceDriver=(BaoshijianSiteDeviceDriver)device.getDeviceDriver();
|
||||
BaoshijianSiteDeviceDriver baoshijianSiteDeviceDriver = (BaoshijianSiteDeviceDriver) device.getDeviceDriver();
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode());
|
||||
json2.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json2.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json2);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW01");
|
||||
json.put("move",baoshijianSiteDeviceDriver.getX1());
|
||||
json.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode() + "DJW01");
|
||||
json.put("move", baoshijianSiteDeviceDriver.getX1());
|
||||
json.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json);
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode()+"DJW02");
|
||||
json1.put("move",baoshijianSiteDeviceDriver.getX2()==1?0:1);
|
||||
json.put("mode",baoshijianSiteDeviceDriver.getX0());
|
||||
json1.put("device_code", baoshijianSiteDeviceDriver.getDeviceCode() + "DJW02");
|
||||
json1.put("move", baoshijianSiteDeviceDriver.getX2() == 1 ? 0 : 1);
|
||||
json.put("mode", baoshijianSiteDeviceDriver.getX0());
|
||||
baoshijian.add(json1);
|
||||
} else if (device.getDeviceDriver() instanceof GuhuashiSiteDeviceDriver) {
|
||||
GuhuashiSiteDeviceDriver guhuashiSiteDeviceDriver=(GuhuashiSiteDeviceDriver)device.getDeviceDriver();
|
||||
@@ -97,16 +119,18 @@ public class SyncDeviceStatus {
|
||||
json.put("humidity_setting", guhuashiSiteDeviceDriver.getVW7014());
|
||||
//湿度显示
|
||||
json.put("humidity", guhuashiSiteDeviceDriver.getVW7016());
|
||||
//阶段累加时间
|
||||
//运行时间
|
||||
json.put("total_running_time", guhuashiSiteDeviceDriver.getVW7038());
|
||||
json.put("current_stage", guhuashiSiteDeviceDriver.getVW7042());
|
||||
//固化阶段
|
||||
json.put("executing_stage_num", guhuashiSiteDeviceDriver.getVW7044());
|
||||
//当前阶段需固化时间
|
||||
json.put("required_time", guhuashiSiteDeviceDriver.getVW7018());
|
||||
//固化工艺 0-固化;1-干燥;
|
||||
json.put("craft",guhuashiSiteDeviceDriver.getVW7036());
|
||||
json.put("device_statue", guhuashiSiteDeviceDriver.getVW7058());
|
||||
json.put("front_door", guhuashiSiteDeviceDriver.getVW70004()==0?1:0);
|
||||
json.put("back_door", guhuashiSiteDeviceDriver.getVW7010());
|
||||
json.put("error", guhuashiSiteDeviceDriver.getVD7046());
|
||||
//正在执行的阶段数 0-固化;1-干燥;
|
||||
json.put("current_stage",guhuashiSiteDeviceDriver.getVW7036());
|
||||
guhuashi.add(json);
|
||||
} else if (device.getDeviceDriver() instanceof SiteStatusDeviceDriver) {
|
||||
SiteStatusDeviceDriver siteStatusDeviceDriver=(SiteStatusDeviceDriver)device.getDeviceDriver();
|
||||
@@ -140,13 +164,37 @@ public class SyncDeviceStatus {
|
||||
json.put("positionX", agvNdcOneDeviceDriver.getX());
|
||||
json.put("positionY", agvNdcOneDeviceDriver.getY());
|
||||
json.put("positionAngle", agvNdcOneDeviceDriver.getAngle());
|
||||
AGV.add(json);
|
||||
agv.add(json);
|
||||
}
|
||||
}
|
||||
redisUtils.set("baoshijian", baoshijian);
|
||||
redisUtils.set("guhuashi", guhuashi);
|
||||
redisUtils.set("site", site);
|
||||
redisUtils.set("AGV", AGV);
|
||||
if (ObjectUtil.isNotEmpty(agv)) {
|
||||
List<String> deviceCodes = agv.stream()
|
||||
.map(r -> {
|
||||
String deviceCode = ((JSONObject) r).getString("device_code");
|
||||
return deviceCode.substring(deviceCode.length() - 1);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
List<InstructionMybatis> instructionList = instructionService.list(new LambdaQueryWrapper<InstructionMybatis>().in(InstructionMybatis::getCarno, deviceCodes));
|
||||
if (ObjectUtil.isNotEmpty(instructionList)) {
|
||||
Map<String, String> taskCodeToTaskIdMap = instructionList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
InstructionMybatis::getInstruction_code,
|
||||
InstructionMybatis::getTask_id
|
||||
));
|
||||
agv.forEach(r -> {
|
||||
JSONObject Item = (JSONObject) r;
|
||||
String taskId = taskCodeToTaskIdMap.get(Item.getString("task_code"));
|
||||
Item.put("task_id", "");
|
||||
if (taskId != null) {
|
||||
Item.put("task_id", taskId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
redisUtils.set("agv", agv);
|
||||
log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime);
|
||||
} catch (Exception e) {
|
||||
log.error("自动线程开始查询AGV设备状态失败{}{}", e, e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user