|
|
@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.Data; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.acs.AcsConfig; |
|
|
|
import org.nl.acs.agv.server.NDCAgvService; |
|
|
|
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; |
|
|
|
import org.nl.acs.device.service.DeviceService; |
|
|
@ -96,9 +97,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(inst)) {
|
|
|
|
// inst = instructionService.findByCode(String.valueOf(ikey));
|
|
|
|
// }
|
|
|
|
} |
|
|
|
if (!ObjectUtil.isEmpty(link_inst)) { |
|
|
|
link_flag = true; |
|
|
@ -168,7 +169,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} else { |
|
|
|
Object reqWms = device.getExtraValue().get("reqWms"); |
|
|
|
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { |
|
|
|
JSONArray req = new JSONArray(); |
|
|
@ -185,7 +188,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
log.warn("指令号:{},acs请求wms取货申请失败,wms不允许agv取货,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); |
|
|
@ -193,6 +196,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
//取货完毕
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x05) { |
|
|
@ -230,6 +234,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} else { |
|
|
|
Object reqWms = device.getExtraValue().get("reqWms"); |
|
|
|
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { |
|
|
|
JSONArray req = new JSONArray(); |
|
|
@ -244,16 +251,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
JSONObject resp = JSONObject.parseObject(httpResponse.body()); |
|
|
|
if (resp.getInteger("status") == 200) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); |
|
|
|
log.info("指令号:{},acs反馈wms取货完成离开成功,wms允许agv取货完成离开,已反馈agv取货完成离开", inst.getInstruction_code()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成离开失败,wms不允许agv取货完成离开,未反馈agv取货完成离开", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); |
|
|
|
log.warn("指令号:{},acs反馈wms取货完成离开失败,连接被拒绝,未反馈agv取货完成离开", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
//到达放货点
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x07) { |
|
|
@ -287,6 +295,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到关联编号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} else { |
|
|
|
Object reqWms = device.getExtraValue().get("reqWms"); |
|
|
|
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { |
|
|
|
JSONArray req = new JSONArray(); |
|
|
@ -303,7 +315,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
log.warn("指令号:{},acs请求wms放货申请失败,wms不允许agv放货,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
@ -311,6 +323,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//放货完毕
|
|
|
|
//(需要WCS反馈)
|
|
|
|
} else if (phase == 0x09) { |
|
|
@ -345,6 +359,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
log.info("未找到编号{}对应的指令", ikey); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} else { |
|
|
|
Object reqWms = device.getExtraValue().get("reqWms"); |
|
|
|
if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { |
|
|
|
JSONArray req = new JSONArray(); |
|
|
@ -356,15 +373,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
|
req.add(map); |
|
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); |
|
|
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { |
|
|
|
JSONObject resp = JSONObject.parseObject(httpResponse.body()); |
|
|
|
if (resp.getInteger("status") == 200) { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code()); |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); |
|
|
|
log.warn("指令号:{},acs请求wms放货完成离开失败,wms不允许agv放货完成离开,未反馈agv放货完成离开", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
log.warn("指令号:{},acs请求wms放货完成离开失败,连接被拒绝,未反馈agv放货完成离开", inst.getInstruction_code()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//到达位置点
|
|
|
|
//(需要WCS反馈)
|
|
|
|
else if (phase == 0x64) {//param,agv货位id待定
|
|
|
|