|
|
@ -1,6 +1,9 @@ |
|
|
|
package org.nl.acs.auto.run; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.acs.AcsConfig; |
|
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
@ -188,10 +191,56 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { |
|
|
|
} |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
|
|
|
|
} else if (phase == 0x50) {//进入区域
|
|
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
|
String device_code1 = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
if (ObjectUtil.isEmpty(device_code1)) { |
|
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
|
logServer.deviceExecuteLog(device_code1, "", "", agvaddr + "对应设备号为空"); |
|
|
|
return; |
|
|
|
} |
|
|
|
JSONArray req = new JSONArray(); |
|
|
|
JSONObject map = new JSONObject(); |
|
|
|
map.put("status", "5"); |
|
|
|
map.put("device_code", device_code1); |
|
|
|
map.put("vehicle_code", ""); |
|
|
|
map.put("task_code", ""); |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
logServer.deviceExecuteLog(device_code1, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
|
} else { |
|
|
|
log.error("请求开门失败,详细原因请查看acs请求wms日志"); |
|
|
|
// log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
|
|
|
} |
|
|
|
} else if (phase == 0x51) {//离开区域
|
|
|
|
agvaddr = arr[18] * 256 + arr[19]; |
|
|
|
String device_code2 = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
if (ObjectUtil.isEmpty(device_code2)) { |
|
|
|
log.info(agvaddr + "对应设备号为空!"); |
|
|
|
logServer.deviceExecuteLog(device_code2, "", "", agvaddr + "对应设备号为空"); |
|
|
|
return; |
|
|
|
} |
|
|
|
JSONArray req = new JSONArray(); |
|
|
|
JSONObject map = new JSONObject(); |
|
|
|
map.put("status", "6"); |
|
|
|
map.put("device_code", device_code2); |
|
|
|
map.put("vehicle_code", ""); |
|
|
|
map.put("task_code", ""); |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
logServer.deviceExecuteLog(device_code2, "", "", "agvphase:" + phase + "反馈:" + data); |
|
|
|
} else { |
|
|
|
log.error("请求关门失败,详细原因请查看acs请求wms日志"); |
|
|
|
//log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
|
|
|
} |
|
|
|
} else { |
|
|
|
//上报异常信息
|
|
|
|
//(不需要WCS反馈)
|
|
|
|
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x50 || phase == 0x51 ) { |
|
|
|
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) { |
|
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); |
|
|
|
} else { |
|
|
|
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); |
|
|
|