|
@ -17,6 +17,7 @@ import org.nl.acs.log.service.DeviceExecuteLogService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppService; |
|
|
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
|
import org.nl.acs.opc.DeviceAppServiceImpl; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
import org.nl.modules.system.service.ParamService; |
|
|
|
|
|
import org.nl.modules.system.util.CodeUtil; |
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
import org.nl.modules.wql.util.SpringContextHolder; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -62,7 +63,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
}; |
|
|
}; |
|
|
log.info("下发删除AGV指令--{}", Bytes2HexString(b)); |
|
|
log.info("下发删除AGV指令--{}", Bytes2HexString(b)); |
|
|
|
|
|
|
|
|
// NDCSocketConnectionAutoRun.write(b);
|
|
|
OneNDCSocketConnectionAutoRun.write(b); |
|
|
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); |
|
|
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -174,9 +175,9 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
log.info("下发AGV作业指令--{}", str1); |
|
|
log.info("下发AGV作业指令--{}", str1); |
|
|
if (StrUtil.equals(agv_system_type,"2")){ |
|
|
if (StrUtil.equals(agv_system_type, "2")) { |
|
|
//TwoNDCSocketConnectionAutoRun.write(b);
|
|
|
//TwoNDCSocketConnectionAutoRun.write(b);
|
|
|
} else if (StrUtil.equals(agv_system_type,"3")){ |
|
|
} else if (StrUtil.equals(agv_system_type, "3")) { |
|
|
//TwoNDC2SocketConnectionAutoRun.write(b);
|
|
|
//TwoNDC2SocketConnectionAutoRun.write(b);
|
|
|
} |
|
|
} |
|
|
System.out.println("下发agv指令数据:" + Bytes2HexString(b)); |
|
|
System.out.println("下发agv指令数据:" + Bytes2HexString(b)); |
|
@ -297,6 +298,50 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
return b; |
|
|
return b; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public boolean createChargingTaskToNDC(String carno) { |
|
|
|
|
|
|
|
|
|
|
|
byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno)); |
|
|
|
|
|
byte carlow = (byte) IntToHexLow(Integer.parseInt(carno)); |
|
|
|
|
|
|
|
|
|
|
|
String instcode = CodeUtil.getNewCode("INSTRUCT_NO"); |
|
|
|
|
|
byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); |
|
|
|
|
|
byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode)); |
|
|
|
|
|
|
|
|
|
|
|
String str = "十进制下发:"; |
|
|
|
|
|
String str1 = "十六进制下发:"; |
|
|
|
|
|
str += "carno:" + (Integer.parseInt(carno)); |
|
|
|
|
|
str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF); |
|
|
|
|
|
|
|
|
|
|
|
str += "/instcode:" + (instcode); |
|
|
|
|
|
str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println(str); |
|
|
|
|
|
System.out.println(str1); |
|
|
|
|
|
|
|
|
|
|
|
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, |
|
|
|
|
|
(byte) 0X00, (byte) 0X08, |
|
|
|
|
|
(byte) 0X00, (byte) 0X0C, |
|
|
|
|
|
(byte) 0X00, (byte) 0X01, |
|
|
|
|
|
(byte) 0X00, (byte) 0X71, |
|
|
|
|
|
(byte) 0X00, (byte) 0X08, |
|
|
|
|
|
(byte) 0X64, (byte) 0X80, |
|
|
|
|
|
(byte) 0X00, (byte) 0X01, |
|
|
|
|
|
(byte) instcodehigh, (byte) instcodelow, |
|
|
|
|
|
(byte) carhigh, (byte) carlow |
|
|
|
|
|
}; |
|
|
|
|
|
log.info("下发AGV充电任务--{}", str1); |
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
OneNDCSocketConnectionAutoRun.write(b); |
|
|
|
|
|
} catch (Exception e){ |
|
|
|
|
|
e.getMessage(); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
System.out.println("下发agv充电任务数据:" + Bytes2HexString(b)); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
String hexToString(int i) { |
|
|
String hexToString(int i) { |
|
|
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase(); |
|
|
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase(); |
|
|
} |
|
|
} |
|
|