|
@ -2,19 +2,23 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone; |
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
import org.nl.acs.AcsConfig; |
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; |
|
|
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; |
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
import org.nl.acs.device_driver.DeviceDriver; |
|
|
import org.nl.acs.device_driver.DeviceDriver; |
|
|
|
|
|
import org.nl.acs.device_driver.basedriver.lubei_conveyor.LubeiConveyorDeviceDriver; |
|
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; |
|
|
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; |
|
|
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.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; |
|
|
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; |
|
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver; |
|
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver; |
|
|
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.impl.AcsToWmsServiceImpl; |
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
import org.nl.acs.history.ErrorUtil; |
|
|
import org.nl.acs.history.ErrorUtil; |
|
|
import org.nl.acs.history.service.DeviceErrorLogService; |
|
|
import org.nl.acs.history.service.DeviceErrorLogService; |
|
@ -27,6 +31,10 @@ import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
import org.nl.acs.monitor.DeviceStageMonitor; |
|
|
import org.nl.acs.monitor.DeviceStageMonitor; |
|
|
import org.nl.acs.opc.Device; |
|
|
import org.nl.acs.opc.Device; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
|
|
|
import org.nl.acs.opc.DeviceManageDto; |
|
|
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
|
|
import org.nl.acs.task.service.dto.TaskDto; |
|
|
|
|
|
import org.nl.modules.lucene.service.dto.LuceneLogDto; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
import org.nl.modules.system.service.impl.ParamServiceImpl; |
|
|
import org.nl.modules.system.service.impl.ParamServiceImpl; |
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
@ -68,6 +76,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
int error = 0; |
|
|
int error = 0; |
|
|
int last_error = 0; |
|
|
int last_error = 0; |
|
|
String error_message = ""; |
|
|
String error_message = ""; |
|
|
|
|
|
boolean flag = false; |
|
|
|
|
|
|
|
|
private synchronized void setErrorInfo(int error, String error_code, String error_message) { |
|
|
private synchronized void setErrorInfo(int error, String error_code, String error_message) { |
|
|
this.error = error; |
|
|
this.error = error; |
|
@ -92,6 +101,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
//车号
|
|
|
//车号
|
|
|
int carno = arr[20]; |
|
|
int carno = arr[20]; |
|
|
|
|
|
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno); |
|
|
Instruction link_inst = null; |
|
|
Instruction link_inst = null; |
|
|
List<Instruction> insts = null; |
|
|
List<Instruction> insts = null; |
|
@ -133,8 +143,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
StandardStorageDeviceDriver standardStorageDeviceDriver; |
|
|
StandardStorageDeviceDriver standardStorageDeviceDriver; |
|
|
//
|
|
|
//
|
|
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; |
|
|
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; |
|
|
|
|
|
//将车号写入DeviceManageDto
|
|
|
|
|
|
DeviceManageDto deviceManageDto = new DeviceManageDto(); |
|
|
|
|
|
deviceManageDto.setCarno(carno); |
|
|
|
|
|
|
|
|
|
|
|
LubeiConveyorDeviceDriver lubeiConveyorDeviceDriver; |
|
|
|
|
|
boolean is_feedback = false; |
|
|
|
|
|
TaskService taskService = SpringContextHolder.getBean("taskServiceImpl"); |
|
|
|
|
|
AcsToWmsZDService acsToWmsZDService = SpringContextHolder.getBean("acsToWmsZDServiceImpl"); |
|
|
|
|
|
TaskDto task = taskService.findByCode(inst.getTask_code()); |
|
|
|
|
|
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); |
|
|
//分配 车id
|
|
|
//分配 车id
|
|
|
//(不需要WCS反馈)
|
|
|
//(不需要WCS反馈)
|
|
|
if (phase == 0x02) { |
|
|
if (phase == 0x02) { |
|
@ -145,11 +163,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
//到达取货点
|
|
|
//到达取货点
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x03) { |
|
|
} else if (phase == 0x03) { |
|
|
|
|
|
log.info("==================AGV请求取货=================="); |
|
|
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
|
|
|
log.info("未找到指令:" + ikey); |
|
|
|
|
|
log.info("{},{}", device_code, "未找到指令 [" + ikey + "]"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
if (agvaddr == 0) { |
|
|
if (agvaddr == 0) { |
|
|
agvaddr = agvaddr_copy; |
|
|
agvaddr = agvaddr_copy; |
|
|
} |
|
|
} |
|
|
if (agvaddr < 1) { |
|
|
if (agvaddr < 1) { |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); |
|
|
log.info("{},{}", device_code, "agv地址参数有误,phase:" + phase); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
@ -170,43 +194,70 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
log.info("{},{}", device_code, "未找到关联编号对应的指令" + ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase); |
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
standardOrdinarySiteDeviceDriver.setIndex(index); |
|
|
jo.put("carId", carno); |
|
|
standardOrdinarySiteDeviceDriver.setInst(inst); |
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
} |
|
|
jo.put("feedbackStatus", "applyTake"); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { |
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); |
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
if (siemensConveyorDeviceDriver.getMove() == 1) { |
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
if (responseCode == 0) { |
|
|
} else { |
|
|
is_feedback = true; |
|
|
log.info("请求取货条件不满足待机有货"); |
|
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode); |
|
|
} |
|
|
} |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { |
|
|
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { |
|
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
if (siemensConveyorDeviceDriver.getMove() == 1) { |
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
|
|
|
jo.put("carId", carno); |
|
|
|
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
|
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,申请取货 请求结果{}", responseCode); |
|
|
|
|
|
} |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
} else { |
|
|
|
|
|
log.info("请求取货条件不满足待机有货"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
//
|
|
|
} |
|
|
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
|
|
|
|
|
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
|
|
|
|
|
// if (siemensConveyorDeviceDriver.getMove() == 1) {
|
|
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// log.info("请求取货条件不满足待机有货");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
|
|
|
|
|
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
|
|
|
|
|
// if (siemensConveyorDeviceDriver.getMove() == 1) {
|
|
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// log.info("请求取货条件不满足待机有货");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
|
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
//取货完毕
|
|
|
//取货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x05) { |
|
|
} else if (phase == 0x05) { |
|
@ -243,40 +294,58 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
if (StrUtil.equals(inst.getStart_device_code(), device_code)) { |
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
jo.put("carId", carno); |
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
standardOrdinarySiteDeviceDriver.setAgvphase(phase); |
|
|
jo.put("feedbackStatus", "takeFinish"); |
|
|
standardOrdinarySiteDeviceDriver.setIndex(index); |
|
|
log.info("请求参数:{}", jo); |
|
|
standardOrdinarySiteDeviceDriver.setInst(inst); |
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,取货完成 请求结果{}", responseCode); |
|
|
} |
|
|
} |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { |
|
|
} |
|
|
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
if (siemensConveyorDeviceDriver.getTo_command() == 2) { |
|
|
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { |
|
|
log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command()); |
|
|
JSONObject jo = new JSONObject(); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
} else { |
|
|
jo.put("carId", carno); |
|
|
log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command()); |
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
List list = new ArrayList(); |
|
|
jo.put("feedbackStatus", "takeFinish"); |
|
|
Map map = new HashMap(); |
|
|
log.info("请求参数:{}", jo); |
|
|
map.put("code", "to_command"); |
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
map.put("value", "2"); |
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
list.add(map); |
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
siemensConveyorDeviceDriver.writing(list); |
|
|
if (responseCode == 0) { |
|
|
siemensConveyorDeviceDriver.writing(list); |
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,取货完成 请求结果{}", responseCode); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
|
|
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
//
|
|
|
|
|
|
// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
|
|
|
|
|
// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
|
|
|
|
|
// if (siemensConveyorDeviceDriver.getTo_command() == 2) {
|
|
|
|
|
|
// log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
|
|
|
|
|
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command());
|
|
|
|
|
|
// List list = new ArrayList();
|
|
|
|
|
|
// Map map = new HashMap();
|
|
|
|
|
|
// map.put("code", "to_command");
|
|
|
|
|
|
// map.put("value", "2");
|
|
|
|
|
|
// list.add(map);
|
|
|
|
|
|
// siemensConveyorDeviceDriver.writing(list);
|
|
|
|
|
|
// siemensConveyorDeviceDriver.writing(list);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(data)) { |
|
|
if (ObjectUtil.isNotEmpty(data)) { |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); |
|
|
} |
|
|
} |
|
@ -308,24 +377,53 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
|
|
|
jo.put("carId", carno); |
|
|
|
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
|
|
|
jo.put("feedbackStatus", "applyPut"); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
|
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,申请放货 请求结果{}", responseCode); |
|
|
|
|
|
} |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
|
|
} |
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
|
|
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
|
|
|
jo.put("carId", carno); |
|
|
|
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
|
|
|
jo.put("feedbackStatus", "applyPut"); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
|
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,申请放货 请求结果{}", responseCode); |
|
|
|
|
|
} |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (StrUtil.equals(inst.getNext_device_code(), device_code)) { |
|
|
|
|
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
if (flag) { |
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
log.info("==================允许AGV放货=================="); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
log.info("{},{}", device_code,"允许AGV放货。"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
|
|
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//放货完毕
|
|
|
//放货完毕
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
} else if (phase == 0x09) { |
|
|
} else if (phase == 0x09) { |
|
@ -360,18 +458,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (StrUtil.equals(inst.getNext_device_code(), device_code)) { |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); |
|
|
jo.put("carId", carno); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
|
|
|
jo.put("feedbackStatus", "putFinish"); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
|
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,放货完成 请求结果{}", responseCode); |
|
|
} |
|
|
} |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
} |
|
|
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
|
|
|
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("taskCode", task.getTask_code()); |
|
|
|
|
|
jo.put("carId", carno); |
|
|
|
|
|
jo.put("taskType ", task.getTask_type()); |
|
|
|
|
|
jo.put("feedbackStatus", "putFinish"); |
|
|
|
|
|
log.info("请求参数:{}", jo); |
|
|
|
|
|
HttpResponse result = acsToWmsZDService.taskFeedback(jo); |
|
|
|
|
|
JSONObject response = JSONObject.parseObject(result.body()); |
|
|
|
|
|
int responseCode = response.getInteger("responseCode"); |
|
|
|
|
|
if (responseCode == 0) { |
|
|
|
|
|
is_feedback = true; |
|
|
|
|
|
log.info("请求ZDwcs成功,放货完成 请求结果{}", responseCode); |
|
|
|
|
|
} |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//到达位置点
|
|
|
//到达位置点
|
|
@ -418,6 +537,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} else if (phase == 0x74) { |
|
|
} else if (phase == 0x74) { |
|
|
//三色灯状态
|
|
|
//三色灯状态
|
|
|
status = ikey; |
|
|
status = ikey; |
|
|
|
|
|
//将小车状态写入DeviceManageDto
|
|
|
|
|
|
deviceManageDto.setStatus(status); |
|
|
} |
|
|
} |
|
|
if (!ObjectUtil.isEmpty(data)) { |
|
|
if (!ObjectUtil.isEmpty(data)) { |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); |
|
|