更新
This commit is contained in:
@@ -11,6 +11,7 @@ import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
@@ -74,6 +75,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
|
||||
@@ -129,6 +131,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
@@ -209,6 +214,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} catch (Exception e) {
|
||||
System.out.println("OneAgv链接异常");
|
||||
log.info("OneAgv链接异常");
|
||||
log.error("agv连接出现异常:{}", e);
|
||||
logServer.deviceExecuteLog("1","","","agv异常"+e.getMessage());
|
||||
logServer.deviceExecuteLog("1","","","agv异常" + e);
|
||||
if(ObjectUtil.isNotEmpty(s)){
|
||||
s.close();
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
|
||||
@@ -228,6 +228,9 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
public Instruction findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
JSONObject json = wo.query("instruction_code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(json)){
|
||||
return null;
|
||||
}
|
||||
final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
return obj;
|
||||
}
|
||||
@@ -1191,8 +1194,15 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
@Override
|
||||
public Instruction findByDeviceCodeFromCache(String devicecode) {
|
||||
|
||||
for (int i = 0; i < this.instructions.size(); i++) {
|
||||
Instruction inst = instructions.get(i);
|
||||
List<Instruction> instructionList = instructions;
|
||||
Collections.sort(instructionList, new Comparator<Instruction>() {
|
||||
@Override
|
||||
public int compare(Instruction o1, Instruction o2) {
|
||||
return o1.getCreate_time().compareTo(o2.getCreate_time());
|
||||
}
|
||||
});
|
||||
for (int i = 0; i < instructionList.size(); i++) {
|
||||
Instruction inst = instructionList.get(i);
|
||||
if (StrUtil.equals(devicecode, inst.getStart_device_code()) && inst.getInstruction_status().equals("0")) {
|
||||
return inst;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user