This commit is contained in:
2023-06-08 14:39:39 +08:00
6 changed files with 53 additions and 19 deletions

View File

@@ -248,10 +248,15 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
}
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
agvNdcTwoDeviceDriver.processSocket(arr);
if(ObjectUtil.isNotEmpty(device)){
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
agvNdcTwoDeviceDriver.processSocket(arr);
}
} else {
log.info("当前phase"+ phase +"未找到对应设备");
}
}
if (!ObjectUtil.isEmpty(data)) {
write(data);

View File

@@ -75,6 +75,9 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
String alarm = "";
String task_id = "";
Boolean iserror = false;
Boolean hasGoods = false;
@Override
public void setDeviceStatus(JSONObject data) {
String flag = data.getString("option");
@@ -108,6 +111,8 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
jo.put("alarm", alarm);
jo.put("task_id", task_id);
jo.put("isOnline", this.getIsonline());
jo.put("isError",this.getIserror());
jo.put("hasGoods", this.getHasGoods());
return jo;
}
}

View File

@@ -29,4 +29,7 @@ public class DeviceStatusData {
//任务号
String taskId;
//楼层
String floor;
}

View File

@@ -667,7 +667,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "存在任务id为"+taskDto.getTask_id()+"相同的任务号:" + task_code);
json.put("message", "存在相同的任务号:" + task_code);
errArr.add(json);
continue;
}
@@ -677,7 +677,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", "已存在任务id"+vehicle_dto.getTask_id()+"托盘号:" + vehicle_code);
json.put("message", "已存在任务编号"+vehicle_dto.getTask_code()+"托盘号:" + vehicle_code);
errArr.add(json);
continue;
}

View File

@@ -89,20 +89,24 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
// }
// }
Server server = (Server)this.servers.get(code);
boolean needcreate = false;
String groupName = code;
if (server == null) {
needcreate = true;
} else {
try {
group = server.findGroup(groupName);
} catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) {
log.error(code, var13);
needcreate = true;
}
}
// Server server = (Server)this.servers.get(code);
// boolean needcreate = false;
// String groupName = code;
// if (server == null) {
// needcreate = true;
// } else {
// try {
// group = server.findGroup(groupName);
// } catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) {
// log.error(code, var13);
// needcreate = true;
// }
// }
boolean needcreate = false;
needcreate = true;
String groupName = code;
Server server = null;
if (needcreate) {
OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code);
if (dto == null) {

View File

@@ -1,5 +1,6 @@
package org.nl.modules.quartz.task;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.basedriver.device_status.DeviceStatusDeviceDriver;
@@ -10,6 +11,7 @@ import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
import org.nl.modules.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -46,6 +48,7 @@ public class QueryLKDeviceStatus {
DeviceStatusData deviceStatusData=deviceStatusDataList.get(i);
String deviceId="LK" + deviceStatusData.getDeviceId();
PackageDriver(deviceStatusData, deviceId);
}
//提升机
Resp<DeviceStatusResponse> tsjResp = acsToLiKuService.queryTsjDeviceStatus(deviceStatusRequest);
@@ -64,13 +67,27 @@ public class QueryLKDeviceStatus {
deviceStatusDeviceDriver.setDevice_id(deviceId);
deviceStatusDeviceDriver.setX(deviceStatusData.getX());
deviceStatusDeviceDriver.setY(deviceStatusData.getY());
deviceStatusDeviceDriver.setMap_id(deviceStatusData.getMapId());
if(!ObjectUtil.isEmpty(deviceStatusData.getMapId())) {
deviceStatusDeviceDriver.setMap_id(deviceStatusData.getMapId());
}else if (!ObjectUtil.isEmpty(deviceStatusData.getFloor())){
deviceStatusDeviceDriver.setMap_id(deviceStatusData.getFloor());
}
deviceStatusDeviceDriver.setPower(deviceStatusData.getPower());
deviceStatusDeviceDriver.setPallet(deviceStatusData.getPallet());
deviceStatusDeviceDriver.setLoad(deviceStatusData.getLoad());
deviceStatusDeviceDriver.setAlarm(deviceStatusData.getAlarm());
deviceStatusDeviceDriver.setTask_id(deviceStatusData.getTaskId());
deviceStatusDeviceDriver.setIsonline(true);
if(!"0".equals(deviceStatusData.getAlarm())) {
deviceStatusDeviceDriver.setIserror(true);
}else{
deviceStatusDeviceDriver.setIserror(false);
}
if(!"0".equals(deviceStatusData.getLoad())) {
deviceStatusDeviceDriver.setHasGoods(true);
}else{
deviceStatusDeviceDriver.setHasGoods(false);
}
}
}
}