opt:优化

This commit is contained in:
zds
2025-03-14 20:01:33 +08:00
parent e1fdf21977
commit 4e4033fbe0
2 changed files with 28 additions and 9 deletions

View File

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

View File

@@ -176,5 +176,10 @@ public class ItemProtocol {
return list;
}
@Override
public String toString() {
return "";
}
}