|
@ -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; |
|
|
|
|
|
|
|
@ -223,4 +224,48 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
return AGVDeviceStatus; |
|
|
return AGVDeviceStatus; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@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; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|