更新
This commit is contained in:
@@ -14,14 +14,18 @@ public interface AcsConfig {
|
||||
String CREATETASKCHECK = "createTaskCheck";
|
||||
//撤销任务检查
|
||||
String CANCELTASKCHECK = "cancelTaskCheck";
|
||||
//二楼agv系统接口地址
|
||||
String AGVURL2 = "agvurl2";
|
||||
//一楼agv系统接口地址
|
||||
String AGVURL = "agvurl";
|
||||
//AGV系统端口
|
||||
String AGVPORT = "agvport";
|
||||
//二楼AGV系统端口
|
||||
//二楼1区agv系统接口地址
|
||||
String AGVURL2 = "agvurl2";
|
||||
//二楼1区AGV系统端口
|
||||
String AGVPORT2 = "agvport2";
|
||||
//二楼2区agv系统接口地址
|
||||
String AGVURL22 = "agvurl22";
|
||||
//二楼2区AGV系统端口
|
||||
String AGVPORT22 = "agvport22";
|
||||
//指定AGV系统
|
||||
String AGVTYPE = "agvType";
|
||||
//WMS系统接口地址
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface NDCAgvService {
|
||||
* @param inst
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendAgvInstToNDC(String type,Instruction inst) throws Exception;
|
||||
public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception;
|
||||
|
||||
public byte[] sendAgvOneModeInst(int phase, int index,int result);
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.dto.AgvDto;
|
||||
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.auto.run.TwoNDC2SocketConnectionAutoRun;
|
||||
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
@@ -80,9 +81,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
|
||||
@LokiLog(type = LokiLogType.AGV)
|
||||
@Override
|
||||
public void sendAgvInstToNDC(String agv_type, Instruction inst) {
|
||||
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
if (StrUtil.equals(agv_type, "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;
|
||||
@@ -183,7 +184,11 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
};
|
||||
}
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
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 {
|
||||
|
||||
@@ -239,11 +244,9 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
||||
(byte) fhdhigh, (byte) fhdlow
|
||||
};
|
||||
log.info("下发AGV作业指令--{}", str1);
|
||||
TwoNDCSocketConnectionAutoRun.write(b);
|
||||
OneNDCSocketConnectionAutoRun.write(b);
|
||||
System.out.println("下发agv指令数据:" + Bytes2HexString(b));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
public void autoRun() throws IOException {
|
||||
System.out.println("OneAgv链接开始");
|
||||
System.out.println("1楼NDCAgv链接开始");
|
||||
ParamService ParamService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@@ -83,7 +83,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("OneAgv链接成功");
|
||||
System.out.println("1楼NDCAgv链接成功");
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
|
||||
|
||||
@@ -2,14 +2,10 @@ package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDefination;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
@@ -32,12 +28,13 @@ import java.util.Date;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
Socket s;
|
||||
String ip = "127.0.0.1";
|
||||
String ip = "192.168.46.225";
|
||||
int port = 1234;
|
||||
static DataOutputStream dos;
|
||||
static DataInputStream dis;
|
||||
@@ -51,38 +48,39 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
boolean isReConnect = false;
|
||||
|
||||
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
@Autowired
|
||||
AutoRunService autoRunService;
|
||||
|
||||
|
||||
public NDCSocketConnectionAutoRun() {
|
||||
public TwoNDC2SocketConnectionAutoRun() {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return NDCSocketConnectionAutoRun.class.getSimpleName();
|
||||
return TwoNDC2SocketConnectionAutoRun.class.getSimpleName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "NDC在线连接";
|
||||
return "2楼2区域AGV系统";
|
||||
}
|
||||
|
||||
public void autoRun() {
|
||||
|
||||
try {
|
||||
System.out.println("OneAgv链接开始");
|
||||
System.out.println("2楼2区域AGV系统链接开始");
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL22).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT22).getValue());
|
||||
byte[] b = new byte[1028];
|
||||
s = new Socket(ip, port);
|
||||
System.out.println("Agv链接成功");
|
||||
System.out.println("2楼2区域AGV链接成功");
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
|
||||
@@ -157,7 +155,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
//任务完毕
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x14) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
@@ -64,29 +65,27 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "2楼NDC在线连接";
|
||||
return "2楼1区域AGV系统";
|
||||
}
|
||||
|
||||
public void autoRun() throws IOException {
|
||||
System.out.println("OneAgv链接开始");
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL2).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
|
||||
|
||||
public void autoRun() {
|
||||
|
||||
try {
|
||||
|
||||
byte[] b = new byte[1024];
|
||||
System.out.println("2楼1区域AGV系统链接开始");
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL2).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
|
||||
byte[] b = new byte[1028];
|
||||
s = new Socket(ip, port);
|
||||
System.out.println("2楼1区域Agv链接成功");
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("TwoAgv链接成功");
|
||||
log.info("TwoAgv链接成功");
|
||||
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
|
||||
@@ -106,7 +105,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
|
||||
}
|
||||
|
||||
//System.out.println("收到请求参数:" + bs);
|
||||
System.out.println("收到请求参数:" + bs);
|
||||
boolean flag = false;
|
||||
if (arr[8] * 256 + arr[9] == 0x73) {
|
||||
byte[] data = null;
|
||||
@@ -122,63 +121,80 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
Instruction inst = null;
|
||||
Device agv_device = null;
|
||||
if (carno != 0) {
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
}
|
||||
|
||||
log.info("接收agv上报信息:" + bs);
|
||||
log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
|
||||
Device device = null;
|
||||
String device_code = null;
|
||||
|
||||
String old_device_code = null;
|
||||
String emptyNum = null;
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
}
|
||||
|
||||
AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver;
|
||||
|
||||
//开始任务/上报订单号
|
||||
//开始任务
|
||||
if (phase == 0x01) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
|
||||
} else if (phase == 0x0A) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
} else if (phase == 0x30) {
|
||||
data = NDCAgvService.sendAgvTwoModeInst(143, index, 0);
|
||||
|
||||
} else if (phase == 0xFF) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.cancelNOSendAgv(inst.getInstruction_id());
|
||||
flag = true;
|
||||
}
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x14) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
break;
|
||||
}
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
} else if (phase == 0x50) {//离开区域
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
} else if (phase == 0x51) {//离开区域
|
||||
|
||||
data = NDCAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
}
|
||||
//请求删除任务
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0x30) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
break;
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0);
|
||||
}
|
||||
//任务删除确认
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0xFF) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
break;
|
||||
}
|
||||
instructionService.cancel(inst.getInstruction_id());
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else {
|
||||
|
||||
if (phase == 0x67) {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if(phase == 0x67){
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
|
||||
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcTwoDeviceDriver.processSocket(arr);
|
||||
}
|
||||
@@ -188,17 +204,12 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
} else {
|
||||
// System.out.println("agv上报不是0073类型动作,不处理");
|
||||
System.out.println("agv上报不是0073类型动作,不处理");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("TwoAgv链接异常");
|
||||
if (ObjectUtil.isNotEmpty(s)) {
|
||||
s.close();
|
||||
}
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
|
||||
} finally {
|
||||
|
||||
|
||||
Binary file not shown.
@@ -6,7 +6,8 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.auto.run.NDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.auto.run.TwoNDC2SocketConnectionAutoRun;
|
||||
import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
@@ -109,6 +110,34 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//到达取货点
|
||||
//(Itype=1/2/3,需要WCS反馈Phase)
|
||||
else if (phase == 0x03) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
@@ -119,6 +148,33 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// 取货完毕
|
||||
//(Itype=1/2/3,需要WCS反馈Phase)
|
||||
else if (phase == 0x05) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
@@ -128,12 +184,37 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
//到达取货点(Itype=1、3,需要WCS反馈)
|
||||
else if (phase == 0x08) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "1") || StrUtil.equals(instruction_type, "3")) {
|
||||
String agv_inst_type = inst.getAgv_inst_type();
|
||||
if (StrUtil.equals(agv_inst_type, "1") || StrUtil.equals(agv_inst_type, "3")) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
@@ -141,12 +222,38 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// 取货完毕
|
||||
//(Itype=1、3,需要WCS反馈)
|
||||
else if (phase == 0x0A) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "1") || StrUtil.equals(instruction_type, "3")) {
|
||||
String agv_inst_type = inst.getAgv_inst_type();
|
||||
if (StrUtil.equals(agv_inst_type, "1") || StrUtil.equals(agv_inst_type, "3")) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
@@ -161,9 +268,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
//上传称重数据
|
||||
if (StrUtil.equals(instruction_type, "1")) {
|
||||
weight = arr[18] * 256 + arr[19];
|
||||
inst.setWeight(String.valueOf(weight));
|
||||
instructionService.update(inst);
|
||||
weight = agvaddr;
|
||||
// inst.setWeight(String.valueOf(weight));
|
||||
// instructionService.update(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
@@ -171,6 +278,32 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// 到达放货点
|
||||
//(Itype=1/2/3,需要WCS反馈)
|
||||
else if (phase == 0x0C) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
@@ -181,6 +314,32 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//放货完成
|
||||
//(Itype=1/2/3,需要WCS反馈)
|
||||
else if (phase == 0x0E) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
@@ -191,12 +350,38 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//到达放货点
|
||||
//(Itype=1、3,需要WCS反馈)
|
||||
else if (phase == 0x10) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "1") || StrUtil.equals(instruction_type, "3")) {
|
||||
String agv_inst_type = inst.getAgv_inst_type();
|
||||
if (StrUtil.equals(agv_inst_type, "1") || StrUtil.equals(agv_inst_type, "3")) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
@@ -204,17 +389,43 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//放货完成
|
||||
//(Itype=1、3,需要WCS反馈)
|
||||
else if (phase == 0x12) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
device_code = point[0];
|
||||
} else if (StrUtil.contains(old_device_code, ".")) {
|
||||
String[] point = old_device_code.split("\\.");
|
||||
device_code = point[0];
|
||||
emptyNum = point[1];
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
String instruction_type = inst.getInstruction_type();
|
||||
if (StrUtil.equals(instruction_type, "1") || StrUtil.equals(instruction_type, "3")) {
|
||||
String agv_inst_type = inst.getAgv_inst_type();
|
||||
if (StrUtil.equals(agv_inst_type, "1") || StrUtil.equals(agv_inst_type, "3")) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
}
|
||||
//上传AGV电量
|
||||
//上传AGV电量
|
||||
else if (phase == 0x73) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
@@ -230,7 +441,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
region = arr[18] * 256 + arr[19];
|
||||
region = agvaddr;
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
@@ -241,23 +452,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
region = arr[18] * 256 + arr[19];
|
||||
region = agvaddr;
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
|
||||
}
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
else if (phase == 0x67) {
|
||||
else if (phase == 0x67) {
|
||||
//故障信息
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
if (agvaddr == 0) {
|
||||
|
||||
}
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
NDCSocketConnectionAutoRun.write(data);
|
||||
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
|
||||
TwoNDCSocketConnectionAutoRun.write(data);
|
||||
} else if (StrUtil.equals(inst.getAgv_system_type(), "3")) {
|
||||
TwoNDC2SocketConnectionAutoRun.write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplyLabelingAndBindingRequest extends BaseRequest {
|
||||
private String ext_task_id;
|
||||
private String device_code;
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplyLabelingAndBindingResponse extends BaseResponse {
|
||||
|
||||
|
||||
}
|
||||
@@ -64,15 +64,31 @@ public class CreateTaskRequest extends BaseRequest {
|
||||
String route_plan_code;
|
||||
|
||||
/**
|
||||
* 1、生箔;
|
||||
* 2、分切
|
||||
* 3、普通任务
|
||||
* 4、叉车任务
|
||||
* 5、输送任务
|
||||
* 6、行架
|
||||
* 7、立库
|
||||
* 任务类型
|
||||
*/
|
||||
String task_type;
|
||||
|
||||
/**
|
||||
* Agv系统类型
|
||||
* 1:1楼叉车系统
|
||||
* 2:2楼1区域AGV系统
|
||||
* 3:2楼2区域AGV系统
|
||||
*/
|
||||
String agv_system_type;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 扩展属性
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LiKuApplyTakResponse extends BaseResponse {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LiKuApplyTaskRequest extends BaseRequest {
|
||||
private String vehicle_code;
|
||||
private String device_code;
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -95,4 +97,18 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> applyOutCacheLineTask(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acstowmsService.applyOutCacheLineTask(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/applyLabelingAndBindingRequest")
|
||||
@Log("ACS系统申请贴标、捆扎")
|
||||
@ApiOperation("ACS系统申请贴标、捆扎")
|
||||
public ResponseEntity<Object> applyLabelingAndBindingRequest(@RequestBody ApplyLabelingAndBindingRequest param) {
|
||||
return new ResponseEntity<>(acstowmsService.applyLabelingAndBindingRequest(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/liKuApplyTaskRequest")
|
||||
@Log("立库申请任务")
|
||||
@ApiOperation("立库申请任务")
|
||||
public ResponseEntity<Object> liKuApplyTaskRequest(@RequestBody LiKuApplyTaskRequest param) {
|
||||
return new ResponseEntity<>(acstowmsService.liKuApplyTaskRequest(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ package org.nl.acs.ext.wms.service;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.data.LiKuApplyTakResponse;
|
||||
import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -122,4 +126,14 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
HttpResponse applyOutCacheLineTask(JSONObject param);
|
||||
|
||||
/**
|
||||
* ACS系统申请出库任务
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param);
|
||||
|
||||
LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest liKuApplyTaskRequest);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,12 @@ public interface WmsToAcsService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ACS系统在获取空的托盘号
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> querydevice(String whereJson);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.data.LiKuApplyTakResponse;
|
||||
import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
@@ -521,4 +525,56 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) {
|
||||
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = new ApplyLabelingAndBindingResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("ApplyLabelingAndBindingRequest----请求参数{}", param);
|
||||
try {
|
||||
String result = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("ApplyLabelingAndBindingResponse----返回参数{}", result);
|
||||
applyLabelingAndBindingResponse = JSONObject.toJavaObject(jsonObject, ApplyLabelingAndBindingResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
return JSONObject.toJavaObject(map, ApplyLabelingAndBindingResponse.class);
|
||||
}
|
||||
}
|
||||
return applyLabelingAndBindingResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest param) {
|
||||
LiKuApplyTakResponse liKuApplyTakResponse = new LiKuApplyTakResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("liKuApplyTask");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("LiKuApplyTaskRequest----请求参数{}", param);
|
||||
try {
|
||||
String result = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("LiKuApplyTakResponse----返回参数{}", result);
|
||||
liKuApplyTakResponse = JSONObject.toJavaObject(jsonObject, LiKuApplyTakResponse.class);
|
||||
} catch (Exception e) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("status", 400);
|
||||
map.put("message", e.getMessage());
|
||||
return JSONObject.toJavaObject(map, LiKuApplyTakResponse.class);
|
||||
}
|
||||
}
|
||||
return liKuApplyTakResponse;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -247,6 +247,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> querydevice(String whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateTaskResponse crateTask(String param) {
|
||||
JSONArray datas = JSONArray.parseArray(param);
|
||||
@@ -267,6 +272,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String vehicle_type = request.getVehicle_type();
|
||||
String route_plan_code = request.getRoute_plan_code();
|
||||
String task_type = request.getTask_type();
|
||||
String agv_system_type = request.getAgv_system_type();
|
||||
String remark = request.getRemark();
|
||||
Map<String,String> params = request.getParams();
|
||||
|
||||
@@ -374,6 +380,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("priority", priority);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("agv_system_type", agv_system_type);
|
||||
jo.put("remark", remark);
|
||||
jo.put("params", params);
|
||||
jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type));
|
||||
|
||||
@@ -383,14 +383,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
|
||||
if (ObjectUtil.isEmpty(route)) {
|
||||
throw new BadRequestException("未查询到相关路由!");
|
||||
}
|
||||
if (StrUtil.equals(route.getType(), "1")) {
|
||||
ZheDaAgvService zheDaAgvService = SpringContextHolder.getBean(ZheDaAgvService.class);
|
||||
HttpResponse result = zheDaAgvService.sendAgvInstToAgv(dto);
|
||||
if (ObjectUtils.isEmpty(result) || result.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
String agvType = paramService.findByCode("agvType").getValue();
|
||||
if (StrUtil.equals(agvType, "2")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -48,22 +48,37 @@ public class TaskDto implements Serializable {
|
||||
private String task_status;
|
||||
|
||||
/**
|
||||
* 任务优先级
|
||||
* 复合任务
|
||||
*/
|
||||
private String priority;
|
||||
private String compound_task;
|
||||
|
||||
/**
|
||||
* 复合任务数据
|
||||
*/
|
||||
private String compound_task_data;
|
||||
/**
|
||||
* 再次请求
|
||||
*/
|
||||
private String request_again;
|
||||
|
||||
private String request_again_success;
|
||||
/**
|
||||
* 关联编号
|
||||
*/
|
||||
private String link_num;
|
||||
|
||||
/**
|
||||
* 是否立刻下发
|
||||
*/
|
||||
private String is_send;
|
||||
private String material;
|
||||
private String quantity;
|
||||
|
||||
|
||||
/**
|
||||
* 任务优先级
|
||||
*/
|
||||
private String priority;
|
||||
|
||||
/**
|
||||
* 创建类型
|
||||
*/
|
||||
@@ -84,6 +99,7 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String execute_message;
|
||||
|
||||
|
||||
/**
|
||||
* 起始点位编码
|
||||
*/
|
||||
@@ -94,6 +110,26 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String start_device_code;
|
||||
|
||||
/**
|
||||
* 放货点位编码
|
||||
*/
|
||||
private String put_point_code;
|
||||
|
||||
/**
|
||||
* 放货设备编码
|
||||
*/
|
||||
private String put_device_code;
|
||||
|
||||
/**
|
||||
* 起始点位编码
|
||||
*/
|
||||
private String start_point_code2;
|
||||
|
||||
/**
|
||||
* 起始设备编码
|
||||
*/
|
||||
private String start_device_code2;
|
||||
|
||||
/**
|
||||
* 目标点位编码
|
||||
*/
|
||||
@@ -105,14 +141,15 @@ public class TaskDto implements Serializable {
|
||||
private String next_device_code;
|
||||
|
||||
/**
|
||||
* 放货点位编码
|
||||
* 目标点位编码
|
||||
*/
|
||||
private String put_point_code;
|
||||
private String next_point_code2;
|
||||
|
||||
/**
|
||||
* 放货设备编码
|
||||
* 目标设备编码
|
||||
*/
|
||||
private String put_device_code;
|
||||
private String next_device_code2;
|
||||
|
||||
|
||||
/**
|
||||
* 排
|
||||
@@ -210,15 +247,6 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 物料类型
|
||||
*/
|
||||
private String material;
|
||||
|
||||
/**
|
||||
* 物料数量
|
||||
*/
|
||||
private String quantity = "0";
|
||||
|
||||
/**
|
||||
* 物料重量
|
||||
@@ -226,26 +254,6 @@ public class TaskDto implements Serializable {
|
||||
private String weight;
|
||||
|
||||
|
||||
/**
|
||||
* 是否复合任务
|
||||
*/
|
||||
private String compound_task;
|
||||
|
||||
/**
|
||||
* 复合任务数据
|
||||
*/
|
||||
private String compound_task_data;
|
||||
|
||||
/**
|
||||
* 是否再次请求
|
||||
*/
|
||||
private String request_again = "0";
|
||||
|
||||
/**
|
||||
* 再次请求成功
|
||||
*/
|
||||
private String request_again_success;
|
||||
|
||||
/**
|
||||
* 空盘数量 =1 则从最上方取
|
||||
*/
|
||||
|
||||
@@ -335,6 +335,8 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
dto.setTask_code(task_code);
|
||||
dto.setRoute_plan_code(route_plan_code);
|
||||
dto.setTask_status("0");
|
||||
dto.setStart_device_code2(dto.getStart_point_code2());
|
||||
dto.setNext_device_code2(dto.getNext_point_code2());
|
||||
|
||||
if (StrUtil.isEmpty(dto.getPriority())) {
|
||||
dto.setPriority("1");
|
||||
@@ -845,7 +847,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
String compound_task = acsTask.getCompound_task();
|
||||
String next_point_code = acsTask.getNext_point_code();
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
|
||||
String start_point_code2 = acsTask.getStart_point_code2();
|
||||
String next_point_code2 = acsTask.getNext_point_code2();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
String task_type = acsTask.getTask_type();
|
||||
/**
|
||||
* 开始平均分解校验
|
||||
*/
|
||||
@@ -876,7 +881,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
}
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_type(acsTask.getTask_type());
|
||||
instdto.setInstruction_type(task_type);
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(acsTask.getRemark());
|
||||
@@ -896,6 +901,34 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
instdto.setStart_device_code2(start_point_code2);
|
||||
instdto.setNext_device_code2(next_point_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
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");
|
||||
}
|
||||
|
||||
instructionservice.create(instdto);
|
||||
}
|
||||
|
||||
@@ -41,24 +41,36 @@ public class AutoCreateInst {
|
||||
TaskDto acsTask = list.get(i);
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String vehiclecode = acsTask.getVehicle_code();
|
||||
String priority = acsTask.getPriority();
|
||||
String is_send = acsTask.getIs_send();
|
||||
|
||||
String start_device_code = acsTask.getStart_device_code();
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
|
||||
String start_point_code = acsTask.getStart_point_code();
|
||||
String put_point_code = acsTask.getPut_point_code();
|
||||
String put_device_code = acsTask.getPut_device_code();
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
|
||||
String put_device_code = acsTask.getPut_device_code();
|
||||
String put_point_code = acsTask.getPut_point_code();
|
||||
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
String next_point_code = acsTask.getNext_point_code();
|
||||
|
||||
if(StrUtil.equals(is_send,"0")){
|
||||
String start_point_code2 = acsTask.getStart_point_code2();
|
||||
String start_device_code2 = acsTask.getStart_device_code2();
|
||||
|
||||
String next_point_code2 = acsTask.getNext_point_code2();
|
||||
String next_device_code2 = acsTask.getNext_device_code2();
|
||||
|
||||
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
|
||||
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
}
|
||||
if(StrUtil.equals(acsTask.getTask_type(),"1") || StrUtil.equals(acsTask.getTask_type(),"2")){
|
||||
if (StrUtil.equals(task_type, "1") || StrUtil.equals(task_type, "2")) {
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
@@ -93,7 +105,7 @@ public class AutoCreateInst {
|
||||
}
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_type(acsTask.getTask_type());
|
||||
instdto.setInstruction_type(task_type);
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(acsTask.getRemark());
|
||||
@@ -105,16 +117,48 @@ public class AutoCreateInst {
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setPut_device_code(put_device_code);
|
||||
instdto.setPut_point_code(put_point_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
instdto.setStart_device_code2(start_device_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setNext_device_code2(next_device_code2);
|
||||
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.modules.quartz.task;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.auto.run.AutoRunService;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* NDC自动重连
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NdcAutoReconnection {
|
||||
|
||||
@Autowired
|
||||
ParamService paramService;
|
||||
|
||||
@Autowired
|
||||
AutoRunService autoRunService;
|
||||
|
||||
public void run(String threadCode) throws Exception {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.NDC_RECONNECTION).getValue().toString(), "1")) {
|
||||
String[] threadCodes = threadCode.split(",");
|
||||
for (String code : threadCodes) {
|
||||
if (!autoRunService.getThreadByCode(code).isAlive()) {
|
||||
autoRunService.startThread(code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,9 +127,11 @@
|
||||
<span v-if="scope.row.send_status=='2' ">失败</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_point_code" label="取货点" />
|
||||
<el-table-column prop="start_point_code" label="取货点1" />
|
||||
<el-table-column prop="put_point_code" label="倒料点" />
|
||||
<el-table-column prop="next_point_code" label="放货点" />
|
||||
<el-table-column prop="next_point_code" label="放货点1" />
|
||||
<el-table-column prop="start_point_code2" label="取货点2" />
|
||||
<el-table-column prop="next_point_code2" label="放货点2" />
|
||||
<el-table-column prop="carno" label="车号" />
|
||||
<el-table-column prop="compound_inst" label="复合指令">
|
||||
<template slot-scope="scope">
|
||||
|
||||
@@ -117,6 +117,23 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="agv系统">
|
||||
<el-select
|
||||
v-model="form.agv_system_type"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择"
|
||||
@change="isDisabled=false"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.agv_system_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="路由方案">
|
||||
<el-select
|
||||
v-model="form.route_plan_code"
|
||||
@@ -231,6 +248,36 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="起点2" prop="start_point_code2">
|
||||
<el-select
|
||||
v-model="form.start_point_code2"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="终点2" prop="next_point_code2">
|
||||
<el-select
|
||||
v-model="form.next_point_code2"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deviceList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_code"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优先级">
|
||||
<el-input v-model="form.priority" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
@@ -266,10 +313,12 @@
|
||||
{{ dict.label.task_type[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column prop="priority" label="任务优先级" />
|
||||
<el-table-column prop="start_point_code" label="取货点" width="120px" />
|
||||
<el-table-column prop="priority" label="任务优先级" width="120px" />
|
||||
<el-table-column prop="start_point_code" label="取货点1" width="120px" />
|
||||
<el-table-column prop="put_point_code" label="倒料点" />
|
||||
<el-table-column prop="next_point_code" label="放货点" width="120px" />
|
||||
<el-table-column prop="next_point_code" label="放货点1" width="120px" />
|
||||
<el-table-column prop="start_point_code2" label="取货点2" width="120px" />
|
||||
<el-table-column prop="next_point_code2" label="放货点2" width="120px" />
|
||||
<el-table-column prop="compound_task" label="复合任务">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.compound_task==='0' ">否</span>
|
||||
@@ -315,7 +364,7 @@ import { getDicts } from '@/api/system/dict'
|
||||
export default {
|
||||
name: 'Task',
|
||||
components: { pagination, crudOperation },
|
||||
dicts: ['task_status', 'task_type'],
|
||||
dicts: ['task_status', 'task_type', 'agv_system_type'],
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
|
||||
@@ -400,8 +449,11 @@ export default {
|
||||
task_status: null,
|
||||
priority: 1,
|
||||
start_point_code: null,
|
||||
start_point_code2: null,
|
||||
start_device_code: null,
|
||||
start_device_code2: null,
|
||||
next_point_code: null,
|
||||
next_point_code2: null,
|
||||
remark: null,
|
||||
material: null,
|
||||
route_plan_code: 'normal',
|
||||
@@ -410,7 +462,8 @@ export default {
|
||||
from_z: null,
|
||||
to_x: null,
|
||||
to_y: null,
|
||||
to_z: null
|
||||
to_z: null,
|
||||
agv_system_type: ''
|
||||
},
|
||||
rules: {
|
||||
start_point_code: [
|
||||
|
||||
Reference in New Issue
Block a user