|
@ -9,6 +9,8 @@ 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.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; |
|
|
|
|
|
import org.nl.acs.ext.wms.service.AcsToWmsService; |
|
|
|
|
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; |
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
|
import org.nl.acs.instruction.domain.Instruction; |
|
|
import org.nl.acs.instruction.service.InstructionService; |
|
|
import org.nl.acs.instruction.service.InstructionService; |
|
|
import org.nl.acs.instruction.service.impl.InstructionServiceImpl; |
|
|
import org.nl.acs.instruction.service.impl.InstructionServiceImpl; |
|
@ -20,6 +22,7 @@ import org.nl.system.service.dict.dao.Dict; |
|
|
import org.nl.system.service.lucene.LuceneExecuteLogService; |
|
|
import org.nl.system.service.lucene.LuceneExecuteLogService; |
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
|
|
|
import org.nl.system.service.param.impl.SysParamServiceImpl; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@ -28,6 +31,7 @@ import java.io.DataOutputStream; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.net.Socket; |
|
|
import java.net.Socket; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; |
|
|
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; |
|
|
|
|
|
|
|
@ -71,12 +75,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
|
|
|
|
|
|
public void autoRun() throws IOException { |
|
|
public void autoRun() throws IOException { |
|
|
System.out.println("NDCAgv链接开始"); |
|
|
System.out.println("NDCAgv链接开始"); |
|
|
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); |
|
|
ISysParamService ISysParamService = (ISysParamService)SpringContextHolder.getBean(SysParamServiceImpl.class); |
|
|
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class); |
|
|
InstructionService instructionService = (InstructionService)SpringContextHolder.getBean(InstructionServiceImpl.class); |
|
|
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); |
|
|
NDCAgvService NDCAgvService = (NDCAgvService)SpringContextHolder.getBean(NDCAgvService.class); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); |
|
|
DeviceAppService deviceAppService = (DeviceAppService)SpringContextHolder.getBean(DeviceAppService.class); |
|
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); |
|
|
DeviceService deviceService = (DeviceService)SpringContextHolder.getBean(DeviceService.class); |
|
|
TaskService taskService = SpringContextHolder.getBean(TaskService.class); |
|
|
DeviceExecuteLogService logServer = (DeviceExecuteLogService)SpringContextHolder.getBean(DeviceExecuteLogService.class); |
|
|
|
|
|
TaskService 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()); |
|
|
|
|
|
|
|
@ -124,7 +129,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
int station = arr[25]; |
|
|
int station = arr[25]; |
|
|
Instruction link_inst = null; |
|
|
Instruction link_inst = null; |
|
|
Instruction inst = null; |
|
|
Instruction inst = null; |
|
|
|
|
|
List<Instruction> insts = null; |
|
|
boolean link_flag = false; |
|
|
boolean link_flag = false; |
|
|
|
|
|
Device agv_device = null; |
|
|
|
|
|
if (carno != 0) { |
|
|
|
|
|
deviceAppService.findDeviceByCode(String.valueOf(carno)); |
|
|
|
|
|
} |
|
|
if (ikey != 0) { |
|
|
if (ikey != 0) { |
|
|
inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); |
|
|
inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
|
if (ObjectUtil.isEmpty(inst)) { |
|
@ -139,20 +149,23 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
Device device = null; |
|
|
Device device = null; |
|
|
String device_code = null; |
|
|
String device_code = null; |
|
|
String old_device_code = null; |
|
|
String old_device_code = null; |
|
|
|
|
|
log.info("接收agv上报信息,agvaddr != 0,开始device:"+device); |
|
|
if (agvaddr != 0) { |
|
|
if (agvaddr != 0) { |
|
|
|
|
|
//SSX02
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
|
|
String[] point; |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
String[] point = old_device_code.split("-"); |
|
|
point = old_device_code.split("-"); |
|
|
device_code = point[0]; |
|
|
device_code = point[0]; |
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
String[] point = old_device_code.split("\\."); |
|
|
point = old_device_code.split("\\."); |
|
|
device_code = point[0]; |
|
|
device_code = point[0]; |
|
|
} else { |
|
|
} else { |
|
|
device_code = old_device_code; |
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
} |
|
|
} |
|
|
log.info("接收agv上报信息,agvaddr != 0,device:"+device); |
|
|
log.info("接收agv上报信息,agvaddr != 0,结束device:"+device); |
|
|
//
|
|
|
//
|
|
|
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; |
|
|
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; |
|
|
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; |
|
|
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; |
|
@ -266,6 +279,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
} else { |
|
|
} else { |
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); |
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); |
|
|
}*/ |
|
|
}*/ |
|
|
|
|
|
log.info("接收agv上报信息,进入else phase,开始device:"+device); |
|
|
if (phase == 0x67) { |
|
|
if (phase == 0x67) { |
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); |
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); |
|
|
} else if (phase == 0x73) { |
|
|
} else if (phase == 0x73) { |
|
|