|
@ -26,6 +26,7 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl; |
|
|
import org.nl.acs.log.LokiLog; |
|
|
import org.nl.acs.log.LokiLog; |
|
|
import org.nl.acs.log.LokiLogType; |
|
|
import org.nl.acs.log.LokiLogType; |
|
|
import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
|
|
|
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.task.service.TaskService; |
|
|
import org.nl.acs.task.service.TaskService; |
|
@ -44,7 +45,7 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Data |
|
|
@Data |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
|
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver { |
|
|
public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor { |
|
|
|
|
|
|
|
|
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); |
|
|
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); |
|
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); |
|
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); |
|
@ -59,6 +60,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
int weight = 0; |
|
|
int weight = 0; |
|
|
String device_code = ""; |
|
|
String device_code = ""; |
|
|
int phase = 0; |
|
|
int phase = 0; |
|
|
|
|
|
private Instruction instruction; |
|
|
|
|
|
|
|
|
int x = 0; //x坐标
|
|
|
int x = 0; //x坐标
|
|
|
int y = 0; //y坐标
|
|
|
int y = 0; //y坐标
|
|
@ -96,7 +98,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); |
|
|
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); |
|
|
} |
|
|
} |
|
|
if (ikey != 0) { |
|
|
if (ikey != 0) { |
|
|
inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); |
|
|
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) { |
|
|
|
|
|
inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); |
|
|
|
|
|
this.instruction = inst; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
if (!ObjectUtil.isEmpty(link_inst)) { |
|
|
if (!ObjectUtil.isEmpty(link_inst)) { |
|
|
link_flag = true; |
|
|
link_flag = true; |
|
@ -154,6 +159,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (ObjectUtil.isEmpty(device)){ |
|
|
|
|
|
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
@ -218,6 +227,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (ObjectUtil.isEmpty(device)){ |
|
|
|
|
|
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
@ -281,6 +294,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (ObjectUtil.isEmpty(device)){ |
|
|
|
|
|
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
@ -345,6 +362,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
if (ObjectUtil.isEmpty(device)){ |
|
|
|
|
|
log.info(agvaddr + "对应设备号{},对应的设备信息为空!",device_code); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
//校验agv上报站点编号与指令起始点相同
|
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
@ -388,6 +409,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
agvaddr_copy = agvaddr; |
|
|
agvaddr_copy = agvaddr; |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
|
|
|
} 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; |
|
|
|
|
|
last_status = status; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!ObjectUtil.isEmpty(data)) { |
|
|
if (!ObjectUtil.isEmpty(data)) { |
|
@ -399,4 +436,29 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public JSONObject getDeviceStatusName() throws Exception { |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
//agv编码
|
|
|
|
|
|
jo.put("device_code", this.getDevice().getDevice_code()); |
|
|
|
|
|
String status_name = this.status == 1 ? "UNAVAILABLE" : this.status == 2 ? "EXECUTING" : this.status == 4 ? "IDLE" : this.status == 5 ? "CHARGING" : this.status == 6 ? "ERROR" : "UNKNOWN"; |
|
|
|
|
|
//agv状态
|
|
|
|
|
|
jo.put("device_status", status_name); |
|
|
|
|
|
//电量
|
|
|
|
|
|
jo.put("electricity", this.getElectric_qty()); |
|
|
|
|
|
//任务号
|
|
|
|
|
|
jo.put("transportOrder", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code()); |
|
|
|
|
|
//x坐标
|
|
|
|
|
|
jo.put("positionX", this.getX()); |
|
|
|
|
|
//y坐标
|
|
|
|
|
|
jo.put("positionY", this.getY()); |
|
|
|
|
|
//角度
|
|
|
|
|
|
jo.put("positionAngle", this.getAngle()); |
|
|
|
|
|
return jo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void setDeviceStatus(JSONObject data) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|