更新
This commit is contained in:
@@ -83,7 +83,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
@Override
|
||||
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||
String instcode = inst.getInstruction_code();
|
||||
int type = Integer.parseInt(inst.getAgv_inst_type());
|
||||
int priority = Integer.parseInt(inst.getPriority()) + 128;
|
||||
@@ -91,115 +90,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
int startAddress2 = deviceService.queryAddressBydeviceCode(inst.getStart_point_code2());
|
||||
int nextAddress2 = deviceService.queryAddressBydeviceCode(inst.getNext_point_code2());
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte typehigh = (byte) IntToHexHigh(type);
|
||||
byte typelow = (byte) IntToHexLow(type);
|
||||
byte qhdhigh = (byte) IntToHexHigh(startAddress);
|
||||
byte qhdlow = (byte) IntToHexLow(startAddress);
|
||||
byte qhdhigh2 = (byte) IntToHexHigh(startAddress2);
|
||||
byte qhdlow2 = (byte) IntToHexLow(startAddress2);
|
||||
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
byte fhdlow = (byte) IntToHexLow(nextAddress);
|
||||
byte fhdhigh2 = (byte) IntToHexHigh(nextAddress2);
|
||||
byte fhdlow2 = (byte) IntToHexLow(nextAddress2);
|
||||
byte prioritylow = (byte) IntToHexLow(priority);
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
|
||||
str += "/type:" + (type);
|
||||
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
|
||||
str += "/qhd:" + (startAddress);
|
||||
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "/fhd:" + (nextAddress);
|
||||
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
|
||||
str += "/qhd2:" + (startAddress2);
|
||||
str1 += "/qhd2:" + hexToString(qhdhigh2 & 0xFF) + hexToString(qhdlow2 & 0xFF);
|
||||
str += "/fhd2:" + (nextAddress2);
|
||||
str1 += "/fhd2:" + hexToString(fhdhigh2 & 0xFF) + hexToString(fhdlow2 & 0xFF);
|
||||
|
||||
str += "/priority:" + (priority);
|
||||
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
|
||||
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
byte[] b = new byte[]{};
|
||||
if (type == 1) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) qhdhigh2, (byte) qhdlow2,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
};
|
||||
} else if (type == 2) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) 0X00, (byte) 0X00,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) 0X00, (byte) 0X00
|
||||
};
|
||||
} else if (type == 3) {
|
||||
b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X16,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) 0X00, (byte) 0X71,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
(byte) 0X01, prioritylow,
|
||||
(byte) 0X00, (byte) 0X01,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) ikeyhigh, (byte) ikeylow,
|
||||
(byte) typehigh, (byte) typelow,
|
||||
(byte) qhdhigh, (byte) qhdlow,
|
||||
(byte) qhdhigh2, (byte) qhdlow2,
|
||||
(byte) fhdhigh, (byte) fhdlow,
|
||||
(byte) fhdhigh2, (byte) fhdlow2
|
||||
};
|
||||
}
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
if (StrUtil.equals(agv_system_type,"2")){
|
||||
TwoNDCSocketConnectionAutoRun.write(b);
|
||||
} else if (StrUtil.equals(agv_system_type,"3")){
|
||||
TwoNDC2SocketConnectionAutoRun.write(b);
|
||||
}
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
} else {
|
||||
|
||||
String instcode = inst.getInstruction_code();
|
||||
int type = Integer.parseInt(inst.getInstruction_type());
|
||||
int priority = Integer.parseInt(inst.getPriority()) + 128;
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
|
||||
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
|
||||
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
|
||||
|
||||
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
|
||||
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
|
||||
byte typehigh = (byte) IntToHexHigh(type);
|
||||
@@ -209,26 +99,20 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
|
||||
byte fhdlow = (byte) IntToHexLow(nextAddress);
|
||||
byte prioritylow = (byte) IntToHexLow(priority);
|
||||
|
||||
String str = "十进制下发:";
|
||||
String str1 = "十六进制下发:";
|
||||
str += "ikey:" + (Integer.parseInt(instcode));
|
||||
str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
|
||||
|
||||
str += "/type:" + (type);
|
||||
str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
|
||||
|
||||
str += "/qhd:" + (startAddress);
|
||||
str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
|
||||
str += "/fhd:" + (nextAddress);
|
||||
str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
|
||||
|
||||
str += "/priority:" + (priority);
|
||||
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
|
||||
|
||||
System.out.println(str);
|
||||
System.out.println(str1);
|
||||
|
||||
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
|
||||
(byte) 0X00, (byte) 0X08,
|
||||
(byte) 0X00, (byte) 0X12,
|
||||
@@ -248,7 +132,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] sendAgvOneModeInst(int phase, int index, int result) {
|
||||
|
||||
@@ -160,20 +160,18 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x0A) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
log.info("指令号:{},已反馈agv任务完成!");
|
||||
}
|
||||
//请求删除任务
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0x30) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0);
|
||||
|
||||
}
|
||||
//任务删除确认
|
||||
//(需要WCS反馈)
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -23,6 +26,8 @@ import org.nl.acs.log.LokiLogType;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.impl.TaskServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -43,6 +48,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@@ -163,27 +169,43 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (siemensConveyorDeviceDriver.getMove() == 1) {
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
// }
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "3")
|
||||
|| StrUtil.equals(instruction_type, "5")
|
||||
|| StrUtil.equals(instruction_type, "9")
|
||||
|| StrUtil.equals(instruction_type, "11")
|
||||
|| StrUtil.equals(instruction_type, "13")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "1");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
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());
|
||||
} else {
|
||||
log.info("请求取货条件不满足待机有货");
|
||||
log.warn("指令号:{},acs请求wms取货申请成功,wms不允许agv申请取货,未反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs不需要请求wms取货申请,已反馈agv允许取货", inst.getInstruction_code());
|
||||
}
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
//取货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x05) {
|
||||
@@ -223,38 +245,41 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
|
||||
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if(siemensConveyorDeviceDriver.getTo_command() == 2){
|
||||
log.info("取货完成请求离开,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command());
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "2")
|
||||
|| StrUtil.equals(instruction_type, "3")
|
||||
|| StrUtil.equals(instruction_type, "4")
|
||||
|| StrUtil.equals(instruction_type, "5")
|
||||
|| StrUtil.equals(instruction_type, "6")
|
||||
|| StrUtil.equals(instruction_type, "8")
|
||||
|| StrUtil.equals(instruction_type, "9")
|
||||
|| StrUtil.equals(instruction_type, "10")
|
||||
|| StrUtil.equals(instruction_type, "11")
|
||||
|| StrUtil.equals(instruction_type, "13")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "2");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
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());
|
||||
} else {
|
||||
log.info("取货完成请求离开下发输送信号,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command());
|
||||
List list = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", "2");
|
||||
list.add(map);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
siemensConveyorDeviceDriver.writing(list);
|
||||
log.warn("指令号:{},acs反馈wms取货完成成功,wms不允许agv取货完成,未反馈agv取货完成", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code());
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs不需要反馈wms取货完成,已反馈agv取货完成", inst.getInstruction_code());
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
//到达放货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x07) {
|
||||
@@ -289,22 +314,34 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "2")
|
||||
|| StrUtil.equals(instruction_type, "4")
|
||||
|| StrUtil.equals(instruction_type, "8")) {
|
||||
JSONArray req = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("vehicle_code", inst.getVehicle_code());
|
||||
map.put("status", "3");
|
||||
map.put("device_code", inst.getStart_point_code());
|
||||
map.put("task_code", inst.getTask_code());
|
||||
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());
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请成功,wms不允许agv申请放货,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
} else {
|
||||
log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
} else {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
log.info("指令号:{},acs不需要请求wms放货申请,已反馈agv允许放货", inst.getInstruction_code());
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
@@ -341,23 +378,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
}
|
||||
//到达位置点
|
||||
//(需要WCS反馈)
|
||||
|
||||
@@ -105,4 +105,11 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> liKuApplyTaskRequest(@RequestBody LiKuApplyTaskRequest param) {
|
||||
return new ResponseEntity<>(acstowmsService.liKuApplyTaskRequest(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/feedAgvTaskStatus")
|
||||
@Log(value = "反馈AGV取放货状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
||||
@ApiOperation("反馈AGV取放货状态")
|
||||
public ResponseEntity<Object> feedAgvTaskStatus(@RequestBody JSONArray from) {
|
||||
return new ResponseEntity<>(acstowmsService.feedAgvTaskStatus(from), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,4 +104,12 @@ public interface AcsToWmsService {
|
||||
|
||||
// 输送线有货变成无货时向lms请求
|
||||
HttpResponse shipDeviceUpdate(JSONObject param);
|
||||
|
||||
/**
|
||||
* 反馈AGV取放货状态
|
||||
*
|
||||
* @param from
|
||||
* @return
|
||||
*/
|
||||
HttpResponse feedAgvTaskStatus(JSONArray from);
|
||||
}
|
||||
|
||||
@@ -529,4 +529,28 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedAgvTaskStatus(JSONArray from) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("feedAgvTaskStatus");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("feedAgvTaskStatus----请求参数{}", from);
|
||||
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(from))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("feedAgvTaskStatus----返回参数{}", result);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
//System.out.println(msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
response.setStatus(200);
|
||||
response.setMessage("success");
|
||||
@@ -305,7 +304,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> putPlusPullAction(String param) {
|
||||
try {
|
||||
@@ -457,7 +455,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
try {
|
||||
@@ -581,14 +578,14 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
route_plan_code = "normal";
|
||||
}
|
||||
|
||||
if( StrUtil.equals(task_type,"5") && taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", "已存在相同的起点终点未执行的输送任务");
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
// if( StrUtil.equals(task_type,"5") && taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("task_code", task_code);
|
||||
// json.put("ext_task_id", ext_task_id);
|
||||
// json.put("message", "已存在相同的起点终点未执行的输送任务");
|
||||
// errArr.add(json);
|
||||
// continue;
|
||||
// }
|
||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||
if (taskDto != null) {
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -646,6 +643,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("storage_task_type", storage_task_type);
|
||||
if (StrUtil.isEmpty(agv_system_type)) {
|
||||
agv_system_type = "1";
|
||||
}
|
||||
jo.put("agv_system_type", agv_system_type);
|
||||
jo.put("oven_time", (int) Math.ceil(oven_time));
|
||||
jo.put("remark", remark);
|
||||
@@ -658,45 +658,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
|
||||
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
|
||||
try {
|
||||
// task_type=7 则是立库任务需要下刻下发
|
||||
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
|
||||
// taskService.create(task_dto);
|
||||
// try{
|
||||
// taskService.createInst(task_dto.getTask_id());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// JSONObject json = new JSONObject();
|
||||
// json.put("task_code", task_code);
|
||||
// json.put("ext_task_id", ext_task_id);
|
||||
// json.put("message", "创建指令失败:"+e.getMessage());
|
||||
// errArr.add(json);
|
||||
// }
|
||||
|
||||
//创建临时指令 不创建、不生成
|
||||
//等立库反馈成功才能创建任务和指令
|
||||
Instruction inst = taskService.createTemporaryInst(task_dto);
|
||||
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst);
|
||||
|
||||
if(StrUtil.equals(resp.result,"true")){
|
||||
//创建任务和指令
|
||||
taskService.create(task_dto);
|
||||
inst.setSend_status("1");
|
||||
taskService.createInst(inst);
|
||||
|
||||
} else {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_code", task_code);
|
||||
json.put("ext_task_id", ext_task_id);
|
||||
json.put("message", resp.getComment());
|
||||
json.put("code", resp.code);
|
||||
json.put("data", data);
|
||||
errArr.add(json);
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
taskService.create(task_dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
JSONObject json = new JSONObject();
|
||||
@@ -727,7 +689,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -342,11 +342,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
|
||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||
}
|
||||
|
||||
try {
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
|
||||
@@ -70,16 +70,26 @@ import java.util.stream.Collectors;
|
||||
public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
List<TaskDto> tasks = new CopyOnWriteArrayList<>();
|
||||
|
||||
@Autowired DeviceAppService deviceAppService;
|
||||
@Autowired RouteLineService routelineserver;
|
||||
@Autowired AcsToWmsService acstowmsService;
|
||||
@Autowired TaskFeedbackService taskFeedbackService;
|
||||
@Autowired ParamService paramService;
|
||||
@Autowired XianGongAgvService agvService;
|
||||
@Autowired RouteLineService routeLineService;
|
||||
@Autowired DeviceAssignedService deviceAssignedService;
|
||||
@Autowired InstructionService instructionService;
|
||||
@Autowired StorageCellService storageCellService;
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
RouteLineService routelineserver;
|
||||
@Autowired
|
||||
AcsToWmsService acstowmsService;
|
||||
@Autowired
|
||||
TaskFeedbackService taskFeedbackService;
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
@Autowired
|
||||
XianGongAgvService agvService;
|
||||
@Autowired
|
||||
RouteLineService routeLineService;
|
||||
@Autowired
|
||||
DeviceAssignedService deviceAssignedService;
|
||||
@Autowired
|
||||
InstructionService instructionService;
|
||||
@Autowired
|
||||
StorageCellService storageCellService;
|
||||
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
@@ -144,7 +154,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
public Map<String, Object> queryAllByCache(Map whereJson, Pageable page) {
|
||||
|
||||
|
||||
|
||||
this.reload();
|
||||
String task_code = (String) whereJson.get("task_code");
|
||||
String vehicle_code = (String) whereJson.get("vehicle_code");
|
||||
@@ -472,12 +481,15 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
dto.setMaterial(startdevice.getMaterial_type());
|
||||
if (StrUtil.equals(createTaskCheck, "1")) {
|
||||
// 判断起点为输送设备
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||
}
|
||||
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
}
|
||||
} else {
|
||||
// 判断起点为输送设备
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {}
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {
|
||||
}
|
||||
|
||||
if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {
|
||||
// if (nextdevice.getDeviceDriver() instanceof
|
||||
@@ -817,7 +829,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
boolean flag = false;
|
||||
try {
|
||||
body = acstowmsService.feedbackTaskStatusToWms(ja);
|
||||
log.info("任务号:{},反馈wms任务状态完成成功,响应信息:{}!", entity.getTask_code(), body.body());
|
||||
} catch (Exception e) {
|
||||
log.error("任务号:{},反馈wms任务状态失败,原因:{}!", entity.getTask_code(), e.getMessage());
|
||||
flag = true;
|
||||
message = e.getMessage();
|
||||
e.printStackTrace();
|
||||
@@ -1256,7 +1270,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTaskByClick(JSONObject json) {}
|
||||
public void createTaskByClick(JSONObject json) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkAllowCreate(String devicecode) {
|
||||
|
||||
@@ -139,29 +139,8 @@ public class AutoCreateInst {
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统
|
||||
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, "1")) {
|
||||
instdto.setAgv_inst_type("1");
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "2")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
|
||||
Reference in New Issue
Block a user