|
@ -1,12 +1,14 @@ |
|
|
package org.nl.acs.auto.run; |
|
|
package org.nl.acs.auto.run; |
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.nl.acs.AcsConfig; |
|
|
import org.nl.acs.AcsConfig; |
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
import org.nl.acs.device.domain.Device; |
|
|
import org.nl.acs.device.domain.Device; |
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; |
|
|
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; |
|
|
|
|
|
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; |
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
@ -80,7 +82,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); |
|
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); |
|
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); |
|
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); |
|
|
TaskService taskService=SpringContextHolder.getBean(TaskService.class); |
|
|
TaskService taskService = SpringContextHolder.getBean(TaskService.class); |
|
|
ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); |
|
|
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); |
|
|
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); |
|
|
|
|
|
|
|
@ -147,10 +149,24 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); |
|
|
log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); |
|
|
Device device = null; |
|
|
Device device = null; |
|
|
String device_code = null; |
|
|
String device_code = null; |
|
|
|
|
|
String old_device_code = null; |
|
|
|
|
|
if (agvaddr != 0) { |
|
|
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
|
|
|
String[] point = old_device_code.split("-"); |
|
|
|
|
|
device_code = point[0]; |
|
|
|
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
|
|
|
String[] point = old_device_code.split("\\."); |
|
|
|
|
|
device_code = point[0]; |
|
|
|
|
|
} else { |
|
|
|
|
|
device_code = old_device_code; |
|
|
|
|
|
} |
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; |
|
|
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; |
|
|
|
|
|
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; |
|
|
|
|
|
|
|
|
//开始任务/上报订单号
|
|
|
//开始任务/上报订单号
|
|
|
if (phase == 0x01) { |
|
|
if (phase == 0x01) { |
|
@ -177,10 +193,31 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
else if (phase == 0x30) { |
|
|
else if (phase == 0x30) { |
|
|
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0); |
|
|
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0); |
|
|
|
|
|
} //进入区域
|
|
|
|
|
|
else if (phase == 0x50) { |
|
|
|
|
|
//开门
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { |
|
|
|
|
|
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); |
|
|
|
|
|
standardAutodoorDeviceDriver.OpenOrClose("1"); |
|
|
|
|
|
if (standardAutodoorDeviceDriver.getAction() == 1) { |
|
|
|
|
|
standardAutodoorDeviceDriver.OpenOrClose("1"); |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//离开区域
|
|
|
|
|
|
else if (phase == 0x51) { |
|
|
|
|
|
//关门
|
|
|
|
|
|
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { |
|
|
|
|
|
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); |
|
|
|
|
|
standardAutodoorDeviceDriver.OpenOrClose("2"); |
|
|
|
|
|
if (standardAutodoorDeviceDriver.getAction() == 2) { |
|
|
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//任务删除确认
|
|
|
//任务删除确认
|
|
|
//(需要WCS反馈)
|
|
|
//(需要WCS反馈)
|
|
|
else if (phase == 0xFF) { |
|
|
}else if (phase == 0xFF) { |
|
|
|
|
|
|
|
|
if (!ObjectUtil.isEmpty(inst)) { |
|
|
if (!ObjectUtil.isEmpty(inst)) { |
|
|
if (!ObjectUtil.isEmpty(inst)) { |
|
|
if (!ObjectUtil.isEmpty(inst)) { |
|
@ -216,15 +253,11 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
System.out.println("Agv链接异常"); |
|
|
System.out.println("OneAgv链接异常"); |
|
|
log.info("Agv链接异常"); |
|
|
log.info("OneAgv链接异常"); |
|
|
log.error("agv连接出现异常:{}", e); |
|
|
log.error("agv连接出现异常:{}", e); |
|
|
// logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage());
|
|
|
logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage()); |
|
|
// logServer.deviceExecuteLog("1", "", "", "agv异常" + e);
|
|
|
logServer.deviceExecuteLog("1", "", "", "agv异常" + e); |
|
|
// LuceneLogDto logDto = new LuceneLogDto();
|
|
|
|
|
|
// logDto.setContent("agv异常" + e.getMessage());
|
|
|
|
|
|
// logDto.setDevice_code("1001");
|
|
|
|
|
|
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(s)) { |
|
|
if (ObjectUtil.isNotEmpty(s)) { |
|
|
s.close(); |
|
|
s.close(); |
|
|
} |
|
|
} |
|
@ -233,7 +266,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
|
|
|
|
|
|
} finally { |
|
|
} finally { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|