add:业务逻辑开发

This commit is contained in:
2025-11-07 10:08:48 +08:00
parent a8684a7c14
commit bf567dbf6f
22 changed files with 1412 additions and 1290 deletions

View File

@@ -27,11 +27,10 @@ public interface NDCAgvService {
/**
* 下发任务
* @param agv_system_type
* @param inst
* @throws Exception
*/
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) throws Exception;
public void sendAgvInstToNDC(Instruction inst) throws Exception;
/**
* 一号agv指令

View File

@@ -7,7 +7,6 @@ import lombok.extern.slf4j.Slf4j;
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.TwoNDCSocketConnectionAutoRun;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.service.DeviceService;
@@ -79,16 +78,12 @@ public class NDCAgvServiceImpl implements NDCAgvService {
@Override
public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
log.info("sendAgvInstToNDC 指令下发NDC:" + "inst_code:" + inst.getInstruction_code() + ",agv_system_type:" + agv_system_type + ",agv_inst_type:" + inst.getAgv_inst_type() +
",priority:" + inst.getPriority() + ",startAddress:" + inst.getStart_point_code() +
",nextAddress:" + inst.getNext_point_code());
public void sendAgvInstToNDC(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 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());
@@ -128,130 +123,12 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str += "优先级 /priority:" + (priority);
str1 += "优先级 /priority:" + hexToString(prioritylow & 0xFF);
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);
log.info("下发AGV作业指令--{}", str);
log.info("下发agv指令数据--{}", Bytes2HexString(b));
if (StrUtil.equals(agv_system_type, "2")) {
TwoNDCSocketConnectionAutoRun.write(b);
}
} else {
String instcode = inst.getInstruction_code();
int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height());
int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height());
//默认取货放货高度都为0
//int type = Integer.parseInt(inst.getInstruction_type());
int type = 4;
if (startHeight != 0 && nextHeight != 0) {
//取货放货高度都不为0
type = 1;
} else if (startHeight != 0 && nextHeight == 0) {
//取货高度不为0 放货高度为0
type = 2;
} else if (startHeight == 0 && nextHeight != 0) {
//取货高度为0 放货高度不为0
type = 3;
}
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);
byte typelow = (byte) IntToHexLow(type);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
byte fhdlow = (byte) IntToHexLow(nextAddress);
byte prioritylow = (byte) IntToHexLow(priority);
byte shhigh = (byte) IntToHexHigh(startHeight);
byte shlow = (byte) IntToHexLow(startHeight);
byte nhhigh = (byte) IntToHexHigh(nextHeight);
byte nhlow = (byte) IntToHexLow(nextHeight);
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) 0X16,
(byte) 0X00, (byte) 0X18,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X14,
(byte) 0X01, prioritylow,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
@@ -259,14 +136,14 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow,
(byte) shhigh, (byte) shlow,
(byte) nhhigh, (byte) nhlow
(byte) qhdhigh2, (byte) qhdlow2,
(byte) fhdhigh2, (byte) fhdlow2,
(byte) 0X00, (byte) 0X00
};
TwoNDCSocketConnectionAutoRun.write(b);
log.info("下发AGV作业指令 --{}", str1);
log.info("下发AGV作业指令--{}", str);
log.info("下发agv指令数据--{}", Bytes2HexString(b));
OneNDCSocketConnectionAutoRun.write(b);
}
}
}
@@ -492,7 +369,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
log.info("下发AGV充电任务--{}", str1);
try {
OneNDCSocketConnectionAutoRun.write(b);
// OneNDCSocketConnectionAutoRun.write(b);
} catch (Exception e) {
log.error("下发充电任务失败{}{}", e, e.getMessage());
}

View File

@@ -1,274 +1,274 @@
package org.nl.acs.auto.run;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.enums.InstructionStatusEnum;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Date;
import java.util.List;
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
/**
* Demo class
*
* @author zhoujj
* @date 2023/12/06
*/
@Slf4j
@Component
public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
Socket s;
String ip = "192.168.46.225";
int port = 1234;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
String[] ERROR = new String[]{
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
"抬叉停止"};
boolean bConnected = true;
boolean isReConnect = false;
@Autowired
ISysParamService paramService;
@Autowired
AutoRunService autoRunService;
@Autowired
LuceneExecuteLogService luceneExecuteLogService;
public OneNDCSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
}
@Override
public String getCode() {
return OneNDCSocketConnectionAutoRun.class.getSimpleName();
}
@Override
public String getName() {
return "NDC在线连接";
}
@Override
public void autoRun() throws IOException {
System.out.println("NDCAgv链接开始");
ISysParamService ISysParamService = SpringContextHolder.getBean(SysParamServiceImpl.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);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
ip = paramService.findByCode(AcsConfig.AGVURL2).getValue();
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
try {
byte[] b = new byte[1024];
s = new Socket(ip, port);
dos = new DataOutputStream(s.getOutputStream());
dis = new DataInputStream(s.getInputStream());
System.out.println("NDCAgv链接成功");
log.info("NDCAgv链接成功");
while (bConnected) {
int count = dis.read(b);
if (count == -1) {
break;
}
int[] arr = new int[count];
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) {
int temp = b[i];
if (temp < 0) {
temp += 256;
}
arr[i] = temp;
StringBuffer bs1 = new StringBuffer("0");
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
}
boolean flag = false;
if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null;
System.out.println("接收agv上报信息" + bs);
//执行阶段
int phase = arr[16] * 256 + arr[17];
// agv任务号
int index = arr[12] * 256 + arr[13];
/**
* 任务号
*/
int ikey = arr[26] * 256 + arr[27];
//站点号
int agvaddr = arr[18] * 256 + arr[19];
//车号
int carno = arr[20];
Instruction link_inst = null;
Instruction inst = null;
List<Instruction> insts = null;
boolean link_flag = false;
Device agv_device = null;
if (carno != 0) {
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
}
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
if (ObjectUtil.isEmpty(inst)) {
inst = instructionService.findByCode(String.valueOf(ikey));
}
}
if (!ObjectUtil.isEmpty(link_inst)) {
link_flag = true;
}
log.info("接收agv上报信息" + bs);
log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
Device device = null;
String device_code = null;
//package org.nl.acs.auto.run;
//
//import cn.hutool.core.util.ObjectUtil;
//import lombok.extern.slf4j.Slf4j;
//import org.nl.acs.AcsConfig;
//import org.nl.acs.agv.server.NDCAgvService;
//import org.nl.acs.common.base.CommonFinalParam;
//import org.nl.acs.device.domain.Device;
//import org.nl.acs.device.service.DeviceService;
//import org.nl.acs.device_driver.agv.ndcone.AgvNdcOneDeviceDriver;
//import org.nl.acs.ext.wms.service.AcsToWmsService;
//import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
//import org.nl.acs.instruction.domain.Instruction;
//import org.nl.acs.instruction.enums.InstructionStatusEnum;
//import org.nl.acs.instruction.service.InstructionService;
//import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
//import org.nl.acs.log.service.DeviceExecuteLogService;
//import org.nl.acs.opc.DeviceAppService;
//import org.nl.config.lucene.service.LuceneExecuteLogService;
//import org.nl.system.service.param.ISysParamService;
//import org.nl.config.SpringContextHolder;
//import org.nl.system.service.param.impl.SysParamServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.io.DataInputStream;
//import java.io.DataOutputStream;
//import java.io.IOException;
//import java.net.Socket;
//import java.util.Date;
//import java.util.List;
//
//import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
///**
// * Demo class
// *
// * @author zhoujj
// * @date 2023/12/06
// */
//@Slf4j
//@Component
//public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
//
// Socket s;
// String ip = "192.168.46.225";
// int port = 1234;
// static DataOutputStream dos;
// static DataInputStream dis;
// private int recordTimeOut = 10000;
// private Date recordTime;
// String[] ERROR = new String[]{
// "货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
// "停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
// "抬叉停止"};
// boolean bConnected = true;
//
// boolean isReConnect = false;
//
// @Autowired
// ISysParamService paramService;
// @Autowired
// AutoRunService autoRunService;
// @Autowired
// LuceneExecuteLogService luceneExecuteLogService;
//
//
// public OneNDCSocketConnectionAutoRun() {
// this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
// }
// @Override
// public String getCode() {
// return OneNDCSocketConnectionAutoRun.class.getSimpleName();
// }
// @Override
// public String getName() {
// return "NDC在线连接";
// }
//
// @Override
// public void autoRun() throws IOException {
// System.out.println("NDCAgv链接开始");
// ISysParamService ISysParamService = SpringContextHolder.getBean(SysParamServiceImpl.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);
// DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
// ip = paramService.findByCode(AcsConfig.AGVURL2).getValue();
// port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
//
//
// try {
// byte[] b = new byte[1024];
// s = new Socket(ip, port);
// dos = new DataOutputStream(s.getOutputStream());
// dis = new DataInputStream(s.getInputStream());
// System.out.println("NDCAgv链接成功");
// log.info("NDCAgv链接成功");
// while (bConnected) {
// int count = dis.read(b);
//
// if (count == -1) {
// break;
// }
//
// int[] arr = new int[count];
// StringBuffer bs = new StringBuffer();
//
// for (int i = 0; i < count; i++) {
// int temp = b[i];
// if (temp < 0) {
// temp += 256;
// }
// arr[i] = temp;
// StringBuffer bs1 = new StringBuffer("0");
// bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
// }
//
// boolean flag = false;
// if (arr[8] * 256 + arr[9] == 0x73) {
// byte[] data = null;
// System.out.println("接收agv上报信息" + bs);
// //执行阶段
// int phase = arr[16] * 256 + arr[17];
// // agv任务号
// int index = arr[12] * 256 + arr[13];
// /**
// * 任务号
// */
// int ikey = arr[26] * 256 + arr[27];
// //站点号
// int agvaddr = arr[18] * 256 + arr[19];
// //车号
// int carno = arr[20];
// Instruction link_inst = null;
// Instruction inst = null;
// List<Instruction> insts = null;
// boolean link_flag = false;
// Device agv_device = null;
// if (carno != 0) {
// agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
// }
// if (ikey != 0) {
// inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
// if (ObjectUtil.isEmpty(inst)) {
// inst = instructionService.findByCode(String.valueOf(ikey));
// }
// }
// if (!ObjectUtil.isEmpty(link_inst)) {
// link_flag = true;
// }
// log.info("接收agv上报信息" + bs);
// log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
// Device device = null;
// String device_code = null;
//
//
// //
// AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
//
// //开始任务/上报订单号
// if (phase == 0x01) {
// if (!ObjectUtil.isEmpty(inst)) {
// inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
// inst.setAgv_jobno(String.valueOf(index));
// inst.setSend_status(CommonFinalParam.ONE);
// instructionService.update(inst);
// }
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
// }
// //任务完毕
// //无车id及状态
// else if (phase == 0x0A) {
// if (!ObjectUtil.isEmpty(inst)) {
// instructionService.finish(inst.getInstruction_id());
// } else {
// log.warn("指令号:{},未反馈wms任务完成因为agv上报指令号查询指令为空!");
// }
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
// log.info("指令号:{},已反馈agv任务完成!");
// }
// //请求删除任务
// //(需要WCS反馈)
// else if (phase == 0x30) {
// data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0);
// }
// //任务删除确认
// //(需要WCS反馈)
// else if (phase == 0xFF) {
//
// if (!ObjectUtil.isEmpty(inst)) {
// if (!ObjectUtil.isEmpty(inst)) {
// instructionService.cancelNOSendAgv(inst.getInstruction_id());
// }
// }
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
//
// } else {
// //上报异常信息
// //不需要WCS反馈
// if (phase == 0x67) {
// device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
// } else {
// device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
// }
// if (ObjectUtil.isNotEmpty(device)) {
// if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
// agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
// agvNdcOneDeviceDriver.processSocket(arr);
// }
// }
//
// }
// if (!ObjectUtil.isEmpty(data)) {
// write(data);
// }
//
// } else {
// System.out.println("agv上报不是0073类型动作不处理");
// }
// }
//
// } catch (Exception e) {
// System.out.println("Agv链接异常");
// log.info("Agv链接异常");
// log.error("agv连接出现异常:{}", e);
// if (ObjectUtil.isNotEmpty(s)) {
// s.close();
// }
// System.out.println(e.getMessage());
// e.printStackTrace();
//
// } finally {
//
//
// }
//
// }
//
//
// @Override
// public void stop() {
// super.after();
// try {
// s.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
//
// public static void write(byte[] b) {
// try {
// log.info("下发agv数据:" + Bytes2HexString(b));
// System.out.println("下发agv数据:" + Bytes2HexString(b));
// dos.write(b);
// dos.flush();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// try {
// Thread.sleep(5000L);
// log.info("再次下发agv数据:" + Bytes2HexString(b));
// System.out.println("再次下发agv数据:" + Bytes2HexString(b));
// dos.write(b);
// dos.flush();
// } catch (Exception e1) {
// e1.printStackTrace();
// }
//
// }
// }
//}
//
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
//开始任务/上报订单号
if (phase == 0x01) {
if (!ObjectUtil.isEmpty(inst)) {
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
inst.setAgv_jobno(String.valueOf(index));
inst.setSend_status(CommonFinalParam.ONE);
instructionService.update(inst);
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
//任务完毕
//无车id及状态
else if (phase == 0x0A) {
if (!ObjectUtil.isEmpty(inst)) {
instructionService.finish(inst.getInstruction_id());
} else {
log.warn("指令号:{},未反馈wms任务完成因为agv上报指令号查询指令为空!");
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
log.info("指令号:{},已反馈agv任务完成!");
}
//请求删除任务
//(需要WCS反馈)
else if (phase == 0x30) {
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0);
}
//任务删除确认
//(需要WCS反馈)
else if (phase == 0xFF) {
if (!ObjectUtil.isEmpty(inst)) {
if (!ObjectUtil.isEmpty(inst)) {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
}
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else {
//上报异常信息
//不需要WCS反馈
if (phase == 0x67) {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
} else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
}
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
agvNdcOneDeviceDriver.processSocket(arr);
}
}
}
if (!ObjectUtil.isEmpty(data)) {
write(data);
}
} else {
System.out.println("agv上报不是0073类型动作不处理");
}
}
} catch (Exception e) {
System.out.println("Agv链接异常");
log.info("Agv链接异常");
log.error("agv连接出现异常:{}", e);
if (ObjectUtil.isNotEmpty(s)) {
s.close();
}
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
}
}
@Override
public void stop() {
super.after();
try {
s.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void write(byte[] b) {
try {
log.info("下发agv数据:" + Bytes2HexString(b));
System.out.println("下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
try {
Thread.sleep(5000L);
log.info("再次下发agv数据:" + Bytes2HexString(b));
System.out.println("再次下发agv数据:" + Bytes2HexString(b));
dos.write(b);
dos.flush();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}

View File

@@ -83,7 +83,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Override
public String getName() {
return "2楼1区域AGV系统";
return "NDC_AGV系统";
}
@Override
@@ -97,7 +97,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
try {
log.info("2楼1区域AGV系统链接开始");
log.info("NDC_AGV系统链接开始");
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
// byte[] b = new byte[1024];
@@ -112,14 +112,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
socket = new Socket();
socket.connect(socketAddress, 5 * 1000);
socket.setKeepAlive(true);//长链接
socket.setSoTimeout(30000);//读取超时时间
socket.setSoTimeout(300000);//读取超时时间
dos = new DataOutputStream(socket.getOutputStream());
dis = new DataInputStream(socket.getInputStream());
while (socket.isConnected()) {
System.out.println("当前socket状态" + socket.isConnected());
int count = dis.read(b);
// System.out.println("当前count值"+count);
if (count == -1) {
log.error("agv连接出现异常:服务端被关闭");
if (ObjectUtil.isNotEmpty(socket)) {
@@ -205,11 +205,10 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.update(inst);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
}
flag = true;
}
//任务完毕
//无车id及状态
else if (phase == 0x14) {
else if (phase == 0x12) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
} else {
@@ -248,6 +247,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x4D) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x50) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
@@ -321,8 +322,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dict.setPara3("充电桩空闲");
dictService.updateDetail(dict);
}
}
else {
} else {
//上报异常信息
//不需要WCS反馈
if (phase == 0x67 || phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {

View File

@@ -15,9 +15,6 @@ public class StandardInspectSiteDevice extends AbstractDriverService {
public JSONObject getDeviceInfo(Device device) {
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
JSONObject jo = super.getCommonDeviceInfo(standardInspectSiteDevicedriver, 0, 0);
jo.put("error", standardInspectSiteDevicedriver.getError());
jo.put("isError", standardInspectSiteDevicedriver.getIserror());
jo.put("container", standardInspectSiteDevicedriver.getContainer());
jo.put("message", standardInspectSiteDevicedriver.getMessage());
return jo;
}

View File

@@ -999,8 +999,6 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.setMaterial(material_type);
standardInspectSiteDeviceDriver.setBatch(batch);
device.setMaterial_type(material_type);
device.setBatch(batch);
}else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {

View File

@@ -8,7 +8,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
@@ -449,7 +448,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (!ObjectUtil.isEmpty(data)) {
phase = 0;
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
OneNDCSocketConnectionAutoRun.write(data);
// OneNDCSocketConnectionAutoRun.write(data);
}
}

View File

@@ -36,17 +36,13 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.system.service.dict.ISysDictService;
import org.nl.system.service.dict.dao.Dict;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import java.time.LocalTime;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor;
/**
@@ -161,7 +157,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
device_code = old_device_code;
}
}
device = deviceAppService.findDeviceByCode(device_code);
//普通站点
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
@@ -223,6 +218,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
instructionService.update(inst);
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -233,6 +229,24 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 不允许取货")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -243,7 +257,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 取货完毕
//(Itype=1/2/3,需要WCS反馈Phase)
else if (phase == 0x05) {
@@ -293,7 +306,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -306,6 +319,24 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 取货完成不允许离开")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -316,7 +347,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 到达放货点
//Itype=1/2/3,需要WCS反馈
else if (phase == 0x07) {
@@ -356,6 +386,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -367,6 +398,24 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 到达放货点不允许放货")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -377,8 +426,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//放货完成
//(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x09) {
@@ -418,6 +465,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -430,6 +478,24 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 放货完成不允许离开")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -440,7 +506,336 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//上传AGV电量
//到达取货点2
else if (phase == 0x0B) {
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);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
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 + "对应设备号为空!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(agvaddr + "对应设备号为空")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 到达取货点不允许取货")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//取货2完毕
else if (phase == 0x0D) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
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 + "对应设备号为空!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("对应设备号为空" + device_code)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 取货完毕,不允许离开")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//到达放货点2
else if (phase == 0x0F) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
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;
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getMode() > 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + "工作模式为" + standardInspectSiteDeviceDriver.getMode() + ", 到达放货点不允许放货")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//放货2完毕
else if (phase == 0x11) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
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;
}
//TODO 检测站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("设备:" + device.getDevice_code() + "光电信号为" + standardInspectSiteDeviceDriver.getMove() + ", 放货完成不允许离开")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//上传x坐标
else if (phase == 0x70) {
//x坐标
x = ikey;
@@ -450,7 +845,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (phase == 0x71) {
}
//上报y坐标
else if (phase == 0x71) {
//y坐标
y = ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -459,7 +856,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (phase == 0x72) {
}
//上报角度
else if (phase == 0x72) {
//车辆角度
angle = ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -468,7 +867,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (phase == 0x73) {
}
//上报电量
else if (phase == 0x73) {
log.info("接收agv上报信息,phase == 0x73" + phase);
//agv电量
electric_qty = ikey;
@@ -525,7 +926,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
}
} else if (phase == 0x74) {
}
//上报车状态
else if (phase == 0x74) {
//三色灯状态
status = ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
@@ -559,23 +962,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
last_status = status;
} //进入区域phase值
else if (phase == 0x50) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "自动门开门")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//离开区域phase值
else if (phase == 0x51) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "自动门关门")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//上报异常信息
//不需要WCS反馈
else if (phase == 0x67) {
@@ -619,12 +1005,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
// if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
// TwoNDCSocketConnectionAutoRun.write(data);
// }
// else if (StrUtil.equals(inst.getAgv_system_type(), "3")) {
// TwoNDC2SocketConnectionAutoRun.write(data);
// }
if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
TwoNDCSocketConnectionAutoRun.write(data);
}

View File

@@ -11,17 +11,10 @@ import java.util.List;
@Data
public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_action = "action";
public static String item_error = "error";
public static String item_mix_code = "mix_code";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
/*public static String item_material_type = "material_type";
public static String item_barcode = "barcode";*/
private StandardInspectSiteDeviceDriver driver;
@@ -38,54 +31,29 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
public int getMix_code() {
return this.getOpcIntegerValue(item_mix_code);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
}
public int getToTarget() {
return this.getOpcIntegerValue(item_to_target);
}
public int getToTask() {
return this.getOpcIntegerValue(item_to_task);
}
/**
*是否有货
*/
public int hasGoods(int move) {
return move;
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return -1;
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_mix_code, "终点", "DB600.B3"));
return list;
}

View File

@@ -186,8 +186,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
void create(Instruction dto) throws Exception;
/**
* 创建2
*
@@ -367,6 +365,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
/**
* 根据终点查询指令
*
* @param devicecode
* @return
*/
@@ -501,7 +500,10 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
List<Instruction> findByNextCode(String nextDeviceCode);
List<Instruction> findReadyIns();
List<Instruction> findReadyIns2();
Instruction findByStarCodeAndExcute(String deviceCode);
void cancelInstAndTaskByDeviceCode(String device_code) throws Exception;
}

View File

@@ -456,12 +456,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (ObjectUtils.isEmpty(shortPathsList)) {
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
}
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
}
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
ndcAgvService.sendAgvInstToNDC( dto);
}
//判断是否是仙工AGV
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
@@ -647,7 +647,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type());
try {
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
ndcAgvService.sendAgvInstToNDC( dto);
dto.setSend_status("1");
} catch (Exception e) {
dto.setSend_status("2");
@@ -1193,7 +1193,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
//
// } else
//1=XZ 2=NDC
if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.TWO)) {
if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.ONE)) {
// NDC agv指令不当场取消指令,需要等agv上报
if ("1".equals(entity.getSend_status())) {
ndcAgvService.deleteAgvInstToNDC(BeanUtil.copyProperties(entity, Instruction.class));
@@ -1201,7 +1201,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
flag = true;
}
} else if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.ONE)
} else if (ObjectUtil.isNotEmpty(entity.getAgv_system_type()) && entity.getAgv_system_type().equals(CommonFinalParam.TWO)
&& !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
@@ -2071,4 +2071,17 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
@Override
@Transactional(rollbackFor = Exception.class)
public void cancelInstAndTaskByDeviceCode(String device_code) throws Exception {
List<Instruction> instructionList = Optional.ofNullable(this.instructions)
.orElse(new ArrayList<>())
.stream()
.filter(instruction -> instruction.getStart_device_code().equals(device_code) || instruction.getNext_device_code().equals(device_code))
.collect(Collectors.toList());
for (Instruction instruction : instructionList) {
taskService.cancelAndInst(instruction.getTask_id());
}
}
}

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20220102CG\noblelift
*/
@@ -14,7 +15,7 @@ public enum AgvSystemTypeEnum {
* 二期一楼AGV任务
* 一期1楼叉车NDC系统
*/
One_NDC_System_Type("1", "1", "一期1楼叉车NDC系统"),
One_NDC_System_Type("1", "1", "叉车NDC系统"),
/**
* 二期二楼NDC系统
* 一期2楼NDC系统
@@ -45,6 +46,7 @@ public enum AgvSystemTypeEnum {
/**
* 构造方法
*
* @param index
* @param code
* @param name

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author 20220102CG\noblelift
*/
@@ -13,8 +14,8 @@ public enum TaskTypeEnum {
/**
* 任务类型
*/
Raw_Foil_AGV_Task("1", "1", "生箔AGV任务"),
Cutting_AGV_Task("2", "2", "分切AGV任务"),
TWO_AGV_Task("1", "1", "两点AGV任务"),
FOUR_AGV_Task("2", "2", "四点AGV任务"),
Standard_AGV_Task("3", "3", "普通AGV任务"),
Forklift_AGV_Task("4", "4", "叉车AGV任务"),
Conveyor_Task("5", "5", "输送线任务"),
@@ -52,6 +53,7 @@ public enum TaskTypeEnum {
/**
* 构造方法
*
* @param index
* @param code
* @param name

View File

@@ -1139,29 +1139,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
instdto.setAgv_action_type(acsTask.getAgv_action_type());
if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) {
// task_type
//1、生箔 Itype=1:取空,取满,放空,放满;
//2、分切 Itype=3取满、取空、放满、放空
//3、普通任务 Itype=2:取货、放货;
//4、叉车任务
//5、输送任务
//6、行架
//7、立库
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
instdto.setAgv_inst_type(CommonFinalParam.ONE);
} 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 if (StrUtil.equals(task_type, "8")) {
instdto.setAgv_inst_type("2");
} else {
log.info("未找到对应的AGV指令类型任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
}
} else {
instdto.setAgv_inst_type("4");
}
instructionservice.create2(instdto);
acsTask.setTask_status(CommonFinalParam.ONE);
this.update(acsTask);

View File

@@ -57,12 +57,6 @@ public class AutoCreateInst {
List<TaskDto> list = taskserver.queryAllByStatus("0");
for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i);
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.AGV_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue;
}
if (StrUtil.equals(acsTask.getTask_type(), TaskTypeEnum.Truss_Task.getIndex()) && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue;
}
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
String task_type = acsTask.getTask_type();
@@ -147,9 +141,6 @@ public class AutoCreateInst {
Instruction instdto = new Instruction();
instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID());
if (acsTask.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())){
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
}
instdto.setRoute_plan_code(route_plan_code);
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
@@ -182,34 +173,6 @@ public class AutoCreateInst {
instdto.setStart_height(start_height);
instdto.setNext_height(next_height);
instdto.setAgv_action_type(agvActionType);
//判断agv系统
//1、1楼叉车系统
//2、2楼1区域AGV系统
//3、2楼2区域AGV系统 -已废弃
if (StrUtil.equals(agv_system_type, CommonFinalParam.TWO)) {
// task_type
//1、生箔 Itype=1:取空,取满,放空,放满;
//2、分切 Itype=3取满、取空、放满、放空
//3、普通任务 Itype=2:取货、放货;
//4、叉车任务
//5、输送任务
//6、行架
//7、立库
if (StrUtil.equals(task_type, CommonFinalParam.ONE)) {
instdto.setAgv_inst_type(CommonFinalParam.ONE);
} 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 if (StrUtil.equals(task_type, "8")) {
instdto.setAgv_inst_type("2");
} else {
log.info("未找到对应的AGV指令类型任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type());
continue;
}
} else {
instdto.setAgv_inst_type("4");
}
try {
instructionService.create(instdto);
} catch (Exception e) {

View File

@@ -10,11 +10,11 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3307}/${DB_NAME:hhck_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:huaHaiCK_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:123456}
password: ${DB_PWD:password}
# 初始连接数
initial-size: 5
# 最小连接数

View File

@@ -89,10 +89,13 @@ https://juejin.cn/post/6844903775631572999
<logger name="org.redisson" level="ERROR" additivity="true">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.nl.modules.wql" level="ERROR" additivity="true">
<logger name="org.springframework.data" level="ERROR" additivity="true">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.springframework.data" level="ERROR" additivity="true">
<logger name="org.jinterop" level="ERROR" additivity="true">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.openscada" level="ERROR" additivity="true">
<appender-ref ref="asyncFileAppender"/>
</logger>
</springProfile>

View File

@@ -0,0 +1,114 @@
<template>
<!--agv双工位-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-col :span="12">
<el-form-item label="扫码器ip" label-width="150px" prop="x">
<el-input v-model.trim="form.ip_address" />
</el-form-item>
</el-col>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig
} from '@/api/acs/device/driverConfig'
import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
export default {
name: 'StandardScanner',
mixins: [crud],
props: {
parentForm: {
type: Object,
required: true
}
},
data() {
return {
form: {
scannerIP: ''
},
rules: {
}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
})
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
})
},
methods: {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -101,7 +101,7 @@
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="检验有货">
<el-form-item label="检验有货" label-width="150px">
<el-switch v-model="form.inspect_in_stocck" />
</el-form-item>
</el-col>
@@ -119,7 +119,7 @@
<el-row>
<el-col :span="8">
<el-form-item label="呼叫">
<el-form-item label="呼叫" label-width="150px">
<el-switch v-model="form.apply_task" />
</el-form-item>
</el-col>
@@ -128,13 +128,18 @@
<el-switch v-model="form.manual_create_task" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否自动补空" label-width="150px">
<el-switch v-model="form.apply_empty" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-form-item label="放满设备" prop="device_code" label-width="150px">
<el-select
v-model="form.link_device_code"
v-model="form.fmDeviceList"
filterable
multiple
placeholder="请选择"
@@ -149,11 +154,11 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="关联三色灯" prop="device_code" label-width="100px">
<el-form-item label="产线补空设备" prop="device_code" label-width="150px">
<el-select
v-model="form.link_three_lamp"
v-model="form.cxBkDeviceList"
filterable
clearable
multiple
placeholder="请选择"
>
<el-option
@@ -166,8 +171,20 @@
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否需要光电" label-width="150px">
<el-switch v-model="form.input_move" />
<el-form-item label="人工补空设备" prop="device_code" label-width="150px">
<el-select
v-model="form.rgBkDeviceList"
filterable
multiple
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>

View File

@@ -104,12 +104,11 @@
<el-table
v-loading="crud.loading"
:data="crud.data"
highlight-current-row
style="width: 100%"
highlight-current-row style="width: 100%"
row-key="opc_id"
border
default-expand-all
:tree-props="{children: 'children', has_children: 'has_children'}"
:default-expand-all="true"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
@select="crud.selectChange"
@select-all="crud.selectAllChange"
@selection-change="crud.selectionChangeHandler"
@@ -232,6 +231,25 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
[CRUD.HOOK.afterRefresh]() {
this.crud.data = this.processTreeData(this.crud.data);
},
processTreeData(data) {
if (!data || !Array.isArray(data)) return data;
return data.map(item => {
if (item.hasOwnProperty('hasChildren')) {
item.hasChildren = item.hasChildren === "1" || item.hasChildren === 1 || item.hasChildren === true;
} else if (item.children && item.children.length > 0) {
item.hasChildren = true;
} else {
item.hasChildren = false;
}
if (item.children && Array.isArray(item.children)) {
item.children = this.processTreeData(item.children);
}
return item;
});
},
handleClick(row, flag) {
// flag为0是新增flag为1是编辑flag为2是删除
// 如果是父类操作

View File

@@ -504,7 +504,7 @@ import CRUD, { crud, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
hasgoods
import deviceCrud from '@/api/acs/device/device'
import routeCurd from '@/api/acs/route/routePlan'
import { getDicts } from '@/views/system/dict/dict'
import i18n from '@/i18n'
@@ -633,7 +633,7 @@ export default {
to_x2: null,
to_y2: null,
to_z2: null,
agv_system_type: '',
agv_system_type: '1',
interactionJson: null
},
taskStatus: {