add 反馈设备状态
This commit is contained in:
@@ -65,7 +65,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
};
|
||||
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
|
||||
|
||||
// NDCSocketConnectionAutoRun.write(b);
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) fhghigh, (byte) fhglow
|
||||
};
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
log.info("下发agv指令数据{}" ,Bytes2HexString(b));
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
@@ -167,7 +168,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) 0X00, (byte) 0X6D,
|
||||
(byte) 0X00, (byte) 0X06,
|
||||
(byte) indexhigh, (byte) indexlow,
|
||||
(byte) 0X01, (byte) 0X12,
|
||||
(byte) 0X01, (byte) 0X14,
|
||||
(byte) phasehigh, (byte) phaselow
|
||||
};
|
||||
|
||||
|
||||
@@ -187,8 +187,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x67) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 ) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
|
||||
@@ -379,6 +379,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else if (phase == 0x51) {//离开交通灯区域
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
} else if (phase == 0x67) {//agv异常
|
||||
// if (ikey == 0) {
|
||||
// this.setErrorInfo(ikey, "0", "正常");
|
||||
// } else {
|
||||
// Map<String, String> error = ErrorUtil.getAgvErrorMsg(ikey);
|
||||
// String code = error.get("code");
|
||||
// String info = error.get("info");
|
||||
// this.setErrorInfo(ikey, code, info);
|
||||
// }
|
||||
// if (error != last_error) {
|
||||
// DeviceErrorLogDto dto = new DeviceErrorLogDto();
|
||||
// dto.setDevice_code(this.getDevice().getDevice_code());
|
||||
// dto.setError_code(String.valueOf(error_code));
|
||||
// dto.setError_info(error_message);
|
||||
// deviceErrorLogService.create(dto);
|
||||
// }
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
last_error = error;
|
||||
} else if (phase == 0x70) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (phase == 0x71) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (phase == 0x72) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (phase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
} else if (phase == 0x74) {
|
||||
//三色灯状态
|
||||
status = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
@@ -360,22 +360,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
|
||||
if (!StrUtil.equals(task.getAgv_system_type(), "0")
|
||||
&& ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
} else {
|
||||
// Boolean result = createLkInst(task.getStorage_task_type(),dto);
|
||||
Resp resp = acsToLiKuService.sendInst(task.getStorage_task_type(), dto);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -445,6 +445,12 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
task_code = CodeUtil.getNewCode("TASK_NO");
|
||||
task_code = "-" + task_code;
|
||||
}
|
||||
if(ObjectUtil.isEmpty(dto.getStart_height())){
|
||||
dto.setStart_height("0");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(dto.getNext_height())){
|
||||
dto.setNext_height("0");
|
||||
}
|
||||
String start_point_code = dto.getStart_point_code();
|
||||
String next_point_code = dto.getNext_point_code();
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
@@ -492,15 +498,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
// if (nextdevice.getDeviceDriver() instanceof
|
||||
// StandardOrdinarySiteDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver)
|
||||
// nextdevice.getDeviceDriver();
|
||||
// if (nextdevice.getHas_goods() != 0) {
|
||||
// throw new Exception("任务终点需满足无货!");
|
||||
// }
|
||||
// }
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONObject jo2 = new JSONObject();
|
||||
if (!StrUtil.isEmpty(dto.getMaterial())) {
|
||||
@@ -538,12 +535,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
|
||||
wo.insert(json);
|
||||
synchronized (TaskServiceImpl.class) {
|
||||
System.out.println("-------------------" + dto.getTask_code());
|
||||
System.out.println("-------------1" + tasks.size());
|
||||
|
||||
tasks.add(dto);
|
||||
System.out.println("-------------2" + tasks.size());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,41 +36,74 @@ public class ToAgvDevice {
|
||||
for (AgvDto agvDto : agv_map.values()) {
|
||||
row.put("device_code", agvDto.getName());
|
||||
row.put("energyLevel", agvDto.getEnergyLevel());
|
||||
if (agvDto.getState().equals("UNKNOWN")) {
|
||||
// 车状态:
|
||||
// 1:关机
|
||||
// 2:运行中
|
||||
// 3:交通管制
|
||||
// 4:任务等待
|
||||
// 5:充电中
|
||||
// 6:故障中
|
||||
// 7:低电量
|
||||
if (agvDto.getState().equals("1")) {
|
||||
row.put("device_status", "UNKNOWN");
|
||||
row.put("status_name", "关机");
|
||||
} else if (agvDto.getState().equals("2")) {
|
||||
row.put("device_status", "EXECUTING");
|
||||
row.put("status_name", "有任务");
|
||||
row.put("flag", "1");
|
||||
}
|
||||
if (agvDto.getState().equals("UNAVAILABLE")) {
|
||||
row.put("status_name", "网络异常");
|
||||
row.put("flag", "1");
|
||||
}
|
||||
if (agvDto.getState().equals("ERROR")) {
|
||||
row.put("status_name", "机器错误");
|
||||
row.put("flag", "1");
|
||||
}
|
||||
if (agvDto.getState().equals("IDLE")) {
|
||||
} else if (agvDto.getState().equals("3")) {
|
||||
// row.put("device_status", "EXECUTING");
|
||||
// row.put("status_name", "交通管制");
|
||||
} else if (agvDto.getState().equals("4")) {
|
||||
row.put("device_status", "IDLE");
|
||||
row.put("status_name", "空闲");
|
||||
row.put("flag", "0");
|
||||
}
|
||||
if (agvDto.getState().equals("EXECUTING")) {
|
||||
row.put("status_name", "运行中");
|
||||
row.put("flag", "0");
|
||||
}
|
||||
if (agvDto.getState().equals("CHARGING")) {
|
||||
row.put("status_name", "充电中");
|
||||
row.put("flag", "0");
|
||||
} else if (agvDto.getState().equals("5")) {
|
||||
row.put("device_status", "CHARGING");
|
||||
row.put("status_name", "充电");
|
||||
} else if (agvDto.getState().equals("6")) {
|
||||
row.put("device_status", "ERROR");
|
||||
row.put("status_name", "故障");
|
||||
} else if (agvDto.getState().equals("7")) {
|
||||
// row.put("device_status", "ERROR");
|
||||
// row.put("status_name", "低电量");
|
||||
}
|
||||
|
||||
|
||||
// if (agvDto.getState().equals("UNKNOWN")) {
|
||||
// row.put("status_name", "有任务");
|
||||
// row.put("status_name", "有任务");
|
||||
// row.put("flag", "1");
|
||||
// }
|
||||
// if (agvDto.getState().equals("UNAVAILABLE")) {
|
||||
// row.put("status_name", "网络异常");
|
||||
// row.put("flag", "1");
|
||||
// }
|
||||
// if (agvDto.getState().equals("ERROR")) {
|
||||
// row.put("status_name", "机器错误");
|
||||
// row.put("flag", "1");
|
||||
// }
|
||||
// if (agvDto.getState().equals("IDLE")) {
|
||||
// row.put("status_name", "空闲");
|
||||
// row.put("flag", "0");
|
||||
// }
|
||||
// if (agvDto.getState().equals("EXECUTING")) {
|
||||
// row.put("status_name", "运行中");
|
||||
// row.put("flag", "0");
|
||||
// }
|
||||
// if (agvDto.getState().equals("CHARGING")) {
|
||||
// row.put("status_name", "充电中");
|
||||
// row.put("flag", "0");
|
||||
// }
|
||||
row.put("transportOrder", agvDto.getTransportOrder());
|
||||
row.put("positionX", agvDto.getPositionX());
|
||||
row.put("positionY", agvDto.getPositionY());
|
||||
row.put("positionAngle", agvDto.getPositionAngle());
|
||||
agv_rows.add(row);
|
||||
}
|
||||
json.put("agv_rows", agv_rows);
|
||||
SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
|
||||
WebSocketServer.sendInfo(deviceInfo, "toAgvDevice_data");
|
||||
// json.put("agv_rows", agv_rows);
|
||||
// SocketMsg deviceInfo = new SocketMsg(json, MsgType.INFO);
|
||||
// WebSocketServer.sendInfo(deviceInfo, "toAgvDevice_data");
|
||||
|
||||
// acsToWmsService.feedbackAgv(row);
|
||||
acsToWmsService.feedbackAgv(agv_rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_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:wzgj_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:weidaqi}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:P@ssw0rd}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
password: ${DB_PWD:password}
|
||||
password: ${DB_PWD:123456}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
|
||||
@@ -11,7 +11,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME: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:weidaqi}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
Reference in New Issue
Block a user