diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java
new file mode 100644
index 0000000..6a4c339
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/AcsConfig.java
@@ -0,0 +1,70 @@
+package org.nl.acs;
+
+
+public interface AcsConfig {
+ //指令下发agv
+ String FORKAGV = "forkagv";
+ //单工指令下发agv
+ String ONEFORKAGV = "oneforkagv";
+ //同一站点运行最大任务数
+ String ONEPOINTMAXTASK = "onePointMaxTask";
+ //同一任务创建最大指令数
+ String MAXINSTNUMBER = "maxInstNumber";
+ //创建任务检查
+ String CREATETASKCHECK = "createTaskCheck";
+ //撤销任务检查
+ String CANCELTASKCHECK = "cancelTaskCheck";
+ //agv系统接口地址
+ String AGVURL = "agvurl";
+ //AGV系统端口
+ String AGVPORT = "agvport";
+ //rgv系统接口地址
+ String RGVURL = "rgvurl";
+ //RGV系统端口
+ String RGVPORT = "rgvport";
+ //指定AGV系统
+ String AGVTYPE = "agvType";
+ //WMS系统接口地址
+ String WMSURL = "wmsurl";
+ //WCS系统接口地址
+ String WCSURL = "wcsurl";
+
+ String HASOTHERSYSTEM = "hasOtherSystem";
+
+ String ERPURL = "erpurl";
+ //是否存在wms系统
+ String HASWMS = "hasWms";
+
+ //
+ String MESURL= "mesurl";
+ //lucene日志索引目录
+ String LUCENEURL = "luceneUrl";
+ //路由选择
+ String ROUTE = "route";
+ //忽略取放货校验
+ String IGNOREHASGOODS = "ignoreHasGoods";
+ //项目类型
+ String BUSINESSTYPE = "businessType";
+ //海亮贴标设备ip
+ String LETTERINGURL = "letteringUrl";
+ //海亮贴标设备
+ String LETTERINGPORT = "letteringPort";
+ //NDC断线重连reconnection
+ String NDC_RECONNECTION = "NDC_reconnection";
+ //自动清理日志保留时间
+ String AutoCleanDays = "AutoCleanDays";
+ //最大任务下发时间
+ String MAXSENDTASKTIME = "maxSendTaskTime";
+ //指令下发立库
+ String INSTSENDLK = "instSendLk";
+ /**
+ * 日志级别
+ */
+ String LOGLEVEL = "log_level";
+
+ String ELECTRIC ="electric";
+
+ String HAS_HK = "has_hk";
+
+ String HK_URL = "hk_url";
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/dto/AgvDto.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/dto/AgvDto.java
new file mode 100644
index 0000000..b9f541e
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/dto/AgvDto.java
@@ -0,0 +1,80 @@
+package org.nl.acs.agv.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author wangsong
+ */
+@Data
+public class AgvDto implements Serializable {
+
+ /**
+ * 名称
+ */
+ private String name;
+
+ /**
+ * 机器人当前的自身状态
+ *
+ * UNKNOWN:未知状态
+ * UNAVAILABLE:通信超时或者已断开连接
+ * ERROR:错误状态
+ * IDLE:空闲状态
+ * EXECUTING:正在执行运单
+ * CHARGING:正在充电
+ */
+ private String state;
+
+ /**
+ * 机器人的剩余电量值(单位:整数百分比)
+ */
+ private String energyLevel;
+
+ /**
+ *
+ */
+ private String energyLevelGood;
+
+ /**
+ * 机器人在 SRD 系统中的在线状态
+ *
+ * TO_BE_IGNORED:机器人处于离线状态,SRD 不会标识出机器人位置。
+ * TO_BE_NOTICED:机器人处于离线状态,SRD 标识出机器人的位置。
+ * TO_BE_RESPECTED:机器人处于在线状态,但不能接受新的运单。
+ * TO_BE_UTILIZED:机器人处于在线状态,可以接受并执行新的运单。
+ */
+ private String integrationLevel;
+
+ /**
+ * 机器人当前的运单执行状态
+ *
+ * UNAVAILABLE:无法执行任何运单和任务
+ * IDLE:空闲状态
+ * AWAITING_ORDER:机器人在等待运单中新的子任务
+ * PROCESSING_ORDER:机器人正在执行运单
+ */
+ private String procState;
+
+ /**
+ * 角度
+ */
+ private String positionAngle;
+
+ /**
+ * X坐标
+ */
+ private String positionX;
+
+ /**
+ * Y坐标
+ */
+ private String positionY;
+
+ /**
+ * 当前任务号
+ */
+ private String transportOrder;
+
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/impl/NDCAgvServiceImpl.java
new file mode 100644
index 0000000..0c19ba3
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/impl/NDCAgvServiceImpl.java
@@ -0,0 +1,311 @@
+package org.nl.acs.agv.impl;
+
+import cn.hutool.core.util.StrUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.nl.acs.AcsConfig;
+import org.nl.acs.agv.dto.AgvDto;
+import org.nl.acs.agv.service.NDCAgvService;
+import org.nl.acs.autoThread.autoRun.impl.ndcAuto.OneNDCSocketConnectionAutoRun;
+import org.nl.acs.device.device.service.DeviceAppService;
+import org.nl.acs.device.device.service.DeviceService;
+import org.nl.acs.device.device.service.impl.DeviceAppServiceImpl;
+import org.nl.acs.device.device.service.impl.DeviceServiceImpl;
+import org.nl.acs.log.LokiLog;
+import org.nl.acs.log.LokiLogType;
+import org.nl.acs.log.service.DeviceExecuteLogService;
+import org.nl.acs.task.instruction.domain.Instruction;
+import org.nl.common.db.CommonFinalParam;
+import org.nl.common.utils.CodeUtil;
+import org.nl.config.SpringContextHolder;
+import org.nl.extInterface.wms.service.AcsToWmsService;
+import org.nl.system.service.param.ISysParamService;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author 20220102CG\noblelift
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+@Lazy
+public class NDCAgvServiceImpl implements NDCAgvService {
+
+ private final DeviceAppService deviceAppService;
+ private final ISysParamService paramService;
+ private final AcsToWmsService acsToWmsService;
+
+ private final DeviceExecuteLogService logServer;
+
+ Map AGVDeviceStatus = new HashMap();
+
+ @LokiLog(type = LokiLogType.AGV)
+ @Override
+ public void deleteAgvInstToNDC(Instruction inst) throws Exception {
+ if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
+ int index = Integer.parseInt(inst.getAgv_jobno());
+
+ byte indexhigh = (byte) IntToHexHigh(index);
+ byte indexlow = (byte) IntToHexLow(index);
+
+ String str = "十进制下发:";
+ String str1 = "十六进制下发:";
+ str += "index:" + index;
+ str1 += "ikey:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF);
+ System.out.println(str);
+ System.out.println(str1);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X06,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X6E,
+ (byte) 0X00, (byte) 0X02,
+ (byte) indexhigh, (byte) indexlow,
+ };
+ log.info("下发删除AGV指令--{}", Bytes2HexString(b));
+ OneNDCSocketConnectionAutoRun.write(b);
+ log.info("删除AGV指令成功--{}", Bytes2HexString(b));
+ }
+
+ }
+
+
+ @LokiLog(type = LokiLogType.AGV)
+ @Override
+ public void sendAgvInstToNDC(String agv_system_type, Instruction inst) {
+ if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
+ String instcode = inst.getInstruction_code();
+ int type = Integer.parseInt(inst.getInstruction_type());
+ int priority = Integer.parseInt(inst.getPriority()) + 128;
+ DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
+ DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
+ int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code());
+ int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
+ byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
+ byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
+ byte typehigh = (byte) IntToHexHigh(type);
+ 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);
+ String str = "十进制下发:";
+ String str1 = "十六进制下发:";
+ str += "ikey:" + (Integer.parseInt(instcode));
+ str1 += "ikey:" + hexToString(ikeyhigh & 0xFF) + hexToString(ikeylow & 0xFF);
+ str += "/type:" + (type);
+ str1 += "/type:" + hexToString(typehigh & 0xFF) + hexToString(typelow & 0xFF);
+ str += "/qhd:" + (startAddress);
+ str1 += "/qhd:" + hexToString(qhdhigh & 0xFF) + hexToString(qhdlow & 0xFF);
+ str += "/fhd:" + (nextAddress);
+ str1 += "/fhd:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF);
+ str += "/priority:" + (priority);
+ str1 += "/priority:" + hexToString(prioritylow & 0xFF);
+ System.out.println(str);
+ System.out.println(str1);
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X12,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X71,
+ (byte) 0X00, (byte) 0X0E,
+ (byte) 0X01, prioritylow,
+ (byte) 0X00, (byte) 0X01,
+ (byte) ikeyhigh, (byte) ikeylow,
+ (byte) ikeyhigh, (byte) ikeylow,
+ (byte) typehigh, (byte) typelow,
+ (byte) qhdhigh, (byte) qhdlow,
+ (byte) fhdhigh, (byte) fhdlow
+ };
+ log.info("下发AGV作业指令--{}", str1);
+ log.info("下发AGV作业任务--{}", inst.getInstruction_code()+"-----"+Bytes2HexString(b));
+ OneNDCSocketConnectionAutoRun.write(b);
+ System.out.println("下发agv指令数据:" + Bytes2HexString(b));
+ }
+ }
+
+ @Override
+ public byte[] sendAgvOneModeInst(int phase, int index, int result, int startPoint, int nextPoint, int startHigh, int nextHigh) {
+ if (phase < 0 || index < 0) {
+ return null;
+ }
+ byte indexhigh = (byte) IntToHexHigh(index);
+ byte indexlow = (byte) IntToHexLow(index);
+ byte phasehigh = (byte) IntToHexHigh(phase);
+ byte phaselow = (byte) IntToHexLow(phase);
+ byte resulthigh = (byte) IntToHexHigh(result);
+ byte resultlow = (byte) IntToHexLow(result);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X0A,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X6D,
+ (byte) 0X00, (byte) 0X06,
+ (byte) indexhigh, (byte) indexlow,
+ (byte) 0X01, (byte) 0X12,
+ (byte) phasehigh, (byte) phaselow
+ };
+
+
+ log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
+
+ System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
+ return b;
+
+ }
+
+ @Override
+ public byte[] sendAgvTwoModeInst(int phase, int index, int result) {
+ return new byte[0];
+ }
+
+
+ @Override
+ public byte[] sendAgvOneModeInst(int phase, int index, int result) {
+ if (phase < 0 || index < 0) {
+ return null;
+ }
+
+ byte indexhigh = (byte) IntToHexHigh(index);
+ byte indexlow = (byte) IntToHexLow(index);
+ byte phasehigh = (byte) IntToHexHigh(phase);
+ byte phaselow = (byte) IntToHexLow(phase);
+ byte resulthigh = (byte) IntToHexHigh(result);
+ byte resultlow = (byte) IntToHexLow(result);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X0A,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X6D,
+ (byte) 0X00, (byte) 0X06,
+ (byte) indexhigh, (byte) indexlow,
+ (byte) 0X01, (byte) 0X12,
+ (byte) phasehigh, (byte) phaselow
+ };
+
+ log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
+
+ System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
+ return b;
+ }
+
+ @Override
+ public byte[] sendAgvOneModeInstDis(int phase, int index, String disPoint) {
+ if (phase < 0 || index < 0) {
+ return null;
+ }
+ DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
+ int disPointAddress = deviceService.queryAddressBydeviceCode(disPoint);
+
+ byte indexhigh = (byte) IntToHexHigh(index);
+ byte indexlow = (byte) IntToHexLow(index);
+ byte phasehigh = (byte) IntToHexHigh(phase);
+ byte phaselow = (byte) IntToHexLow(phase);
+ byte fhdhigh = (byte) IntToHexHigh(disPointAddress);
+ byte fhdlow = (byte) IntToHexLow(disPointAddress);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X0C,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X6D,
+ (byte) 0X00, (byte) 0X08,
+ (byte) indexhigh, (byte) indexlow,
+ (byte) 0X01, (byte) 0X12,
+ (byte) phasehigh, (byte) phaselow,
+ (byte) fhdhigh, (byte) fhdlow
+ };
+
+ log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF) + ",disPoint:" + hexToString(fhdhigh & 0xFF) + hexToString(fhdlow & 0xFF));
+
+ System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
+ return b;
+ }
+
+ @Override
+ public boolean createChargingTaskToNDC(String carno) {
+ byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno));
+ byte carlow = (byte) IntToHexLow(Integer.parseInt(carno));
+
+ String instcode = CodeUtil.getNewCode("INSTRUCT_NO");
+ byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
+ byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode));
+
+ String str = "十进制下发:";
+ String str1 = "十六进制下发:";
+ str += "carno:" + (Integer.parseInt(carno));
+ str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF);
+
+ str += "/instcode:" + (instcode);
+ str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF);
+
+ System.out.println(str);
+ System.out.println(str1);
+
+ byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X00, (byte) 0X0C,
+ (byte) 0X00, (byte) 0X01,
+ (byte) 0X00, (byte) 0X71,
+ (byte) 0X00, (byte) 0X08,
+ (byte) 0X64, (byte) 0X80,
+ (byte) 0X00, (byte) 0X01,
+ (byte) instcodehigh, (byte) instcodelow,
+ (byte) carhigh, (byte) carlow
+ };
+ log.info("下发AGV充电任务--{}", str1);
+
+ try {
+ OneNDCSocketConnectionAutoRun.write(b);
+ } catch (Exception e) {
+ e.getMessage();
+ return false;
+ }
+ System.out.println("下发agv充电任务数据:" + Bytes2HexString(b));
+ return true;
+ }
+
+ String hexToString(int i) {
+ return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
+ }
+
+
+ public static int IntToHexHigh(int b) {
+ int big = (b & 0xFF00) >> 8;
+ return big;
+ }
+
+ public static int IntToHexLow(int b) {
+ int little = b & 0xFF;
+ return little;
+ }
+
+
+ public static String Bytes2HexString(byte[] b) {
+ String ret = "";
+ for (int i = 0; i < b.length; i++) {
+ String hex = Integer.toHexString(b[i] & 0xFF);
+ if (hex.length() == 1) {
+ hex = '0' + hex;
+ }
+ ret += hex.toUpperCase();
+ }
+ return ret;
+ }
+
+
+ @LokiLog(type = LokiLogType.AGV)
+ @Override
+ public Map findAllAgvFromCache() {
+ return AGVDeviceStatus;
+ }
+
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/service/NDCAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/service/NDCAgvService.java
new file mode 100644
index 0000000..789606c
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/service/NDCAgvService.java
@@ -0,0 +1,84 @@
+package org.nl.acs.agv.service;
+
+
+import org.nl.acs.agv.dto.AgvDto;
+import org.nl.acs.task.instruction.domain.Instruction;
+
+import java.util.Map;
+
+/**
+ * @Author: lyd
+ * @Description:
+ * @Date: 2022-08-15
+ */
+public interface NDCAgvService {
+ /**
+ * 全部agv
+ * @return
+ */
+ Map findAllAgvFromCache();
+
+ /**
+ * 删除NDC任务
+ *
+ * @param inst
+ * @throws Exception
+ */
+ public void deleteAgvInstToNDC(Instruction inst) throws Exception;
+
+ /**
+ * 下发任务
+ * @param agv_system_type
+ * @param inst
+ * @throws Exception
+ */
+ public void sendAgvInstToNDC(String agv_system_type, Instruction inst) throws Exception;
+
+ /**
+ * 一号agv指令
+ * @param phase
+ * @param index
+ * @param result
+ * @param startPoint
+ * @param nextPoint
+ * @param startHigh
+ * @param nextHigh
+ * @return
+ */
+ public byte[] sendAgvOneModeInst(int phase, int index, int result, int startPoint, int nextPoint, int startHigh, int nextHigh);
+
+ /**
+ * 下发二号agv指令
+ * @param phase
+ * @param index
+ * @param result
+ * @return
+ */
+ public byte[] sendAgvTwoModeInst(int phase, int index, int result);
+
+ /**
+ * 下发一号agv指令
+ * @param phase
+ * @param index
+ * @param result
+ * @return
+ */
+ public byte[] sendAgvOneModeInst(int phase, int index, int result);
+
+ /**
+ * 下发一号agv指令(二次分配)
+ * @param phase
+ * @param index
+ * @param disPoint 新点位
+ * @return
+ */
+ public byte[] sendAgvOneModeInstDis(int phase, int index, String disPoint);
+
+ /**
+ * 下发充电任务
+ *
+ * @param carno
+ * @return
+ */
+ public boolean createChargingTaskToNDC(String carno);
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/OneNDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/OneNDCSocketConnectionAutoRun.java
new file mode 100644
index 0000000..f4ecba2
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/OneNDCSocketConnectionAutoRun.java
@@ -0,0 +1,341 @@
+package org.nl.acs.autoThread.autoRun.impl.ndcAuto;
+
+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.service.NDCAgvService;
+import org.nl.acs.autoThread.autoRun.AbstractAutoRunnable;
+import org.nl.acs.autoThread.service.AutoRunService;
+import org.nl.acs.device.device.service.DeviceAppService;
+import org.nl.acs.device.device.service.DeviceService;
+import org.nl.acs.device.device.service.entity.Device;
+import org.nl.acs.device.deviceDriver.service.defination.agvDefination.ndc.AgvNdcOneDeviceDriver;
+import org.nl.acs.log.service.DeviceExecuteLogService;
+import org.nl.acs.task.instruction.domain.Instruction;
+import org.nl.acs.task.instruction.enums.InstructionStatusEnum;
+import org.nl.acs.task.instruction.service.InstructionService;
+import org.nl.acs.task.instruction.service.impl.InstructionServiceImpl;
+import org.nl.common.db.CommonFinalParam;
+import org.nl.config.SpringContextHolder;
+import org.nl.config.lucene.service.LuceneExecuteLogService;
+import org.nl.extInterface.wms.service.AcsToWmsService;
+import org.nl.extInterface.wms.service.impl.AcsToWmsServiceImpl;
+import org.nl.system.service.param.ISysParamService;
+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.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.AGVURL).getValue();
+ port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).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 insts = null;
+ boolean link_flag = false;
+ Device agv_device = null;
+ String old_device_code = 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 if (phase == 0x50) {//进入区域
+ 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];
+ } else {
+ device_code = old_device_code;
+ }
+ }
+ device = deviceAppService.findDeviceByCode(device_code);
+ if (ObjectUtil.isEmpty(device_code)) {
+ log.info(agvaddr + "对应设备号为空!");
+ return;
+ }
+ } else if (phase == 0x51) {//离开区域
+
+ 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];
+ } else {
+ device_code = old_device_code;
+ }
+ }
+ device = deviceAppService.findDeviceByCode(device_code);
+ if (ObjectUtil.isEmpty(device_code)) {
+ log.info(agvaddr + "对应设备号为空!");
+ return;
+ }
+ } else if (phase == 0x4D) {
+ /*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];
+ } else {
+ device_code = old_device_code;
+ }
+ }
+ device = deviceAppService.findDeviceByCode(device_code);
+ if (ObjectUtil.isEmpty(device_code)) {
+ log.info(agvaddr + "对应设备号为空!");
+ return;
+ }*/
+ data = NDCAgvService.sendAgvOneModeInst(phase, index, 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();
+ try {
+ agvNdcOneDeviceDriver.processSocket(arr);
+ } catch (Exception e) {
+ log.error("处理phase:{},发生异常。异常信息:{}", phase, e.getMessage());
+ }
+ }
+ }
+
+ }
+ 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();
+ }
+
+ }
+ }
+}
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java
index 439e14b..68209cf 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/device/service/impl/DeviceServiceImpl.java
@@ -701,97 +701,6 @@ public class DeviceServiceImpl extends CommonServiceImpl i
@Override
public void changeDeviceStatus(JSONObject form) {
- String device_code = form.getString("device_code");
- if (StrUtil.contains(device_code, "-") && StrUtil.count(device_code, "-") == 2) {
- String[] point = device_code.split("-");
- device_code = point[0];
- }
- //需要数量
- String hasGoodStatus = form.getString("hasGoodStatus");
- if (StrUtil.isEmpty(hasGoodStatus)) {
- hasGoodStatus = "0";
- }
- String batch = form.getString("batch");
- String material_type = form.getString("material_type");
- String quantity = form.getString("quantity");
- String remark = form.getString("remark");
- String vehicle_code = form.getString("vehicle_code");
- String islock = form.getString("islock");
- String requireSucess = form.getString("requireSucess");
- String requireActionSucess = form.getString("requireActionSucess");
- String fullrequireSucess = form.getString("fullrequireSucess");
- if (device_code.indexOf(".") != -1) {
- device_code = device_code.substring(0, device_code.indexOf("."));
- }
- Device device = deviceAppService.findDeviceByCode(device_code);
- if (ObjectUtil.isEmpty(device)) {
- throw new BadRequestException(LangProcess.msg("error_isNull", device_code));
- }
- StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
- //检测站点
- StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
- if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
- standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
- if (!StrUtil.isEmpty(hasGoodStatus)) {
- device.setHas_goods(Integer.parseInt(hasGoodStatus));
- }
- if (StrUtil.isNotEmpty(material_type)) {
- standardOrdinarySiteDeviceDriver.setMaterial(material_type);
- device.setMaterial_type(material_type);
- } else {
- standardOrdinarySiteDeviceDriver.setMaterial("");
- device.setMaterial_type("");
- }
- if (StrUtil.isNotEmpty(quantity)) {
- standardOrdinarySiteDeviceDriver.setQty(quantity);
- device.setQuantity(quantity);
- } else {
- standardOrdinarySiteDeviceDriver.setQty("");
- device.setQuantity("");
- }
- if (StrUtil.isNotEmpty(remark)) {
- standardOrdinarySiteDeviceDriver.setRemark(remark);
- device.setRemark(remark);
- } else {
- standardOrdinarySiteDeviceDriver.setRemark("");
- device.setRemark("");
- }
- if (StrUtil.isNotEmpty(batch)) {
- standardOrdinarySiteDeviceDriver.setBatch(batch);
- device.setBatch(batch);
- } else {
- standardOrdinarySiteDeviceDriver.setBatch("");
- device.setBatch("");
- }
-//// WQLObject runpointwo = WQLObject.getWQLObject("acs_device_runpoint");
-//// JSONObject json = runpointwo.query("device_code ='" + device_code + "'").uniqueResult(0);
-//// DeviceRunpoint deviceRunpoint = new LambdaQueryChainWrapper<>(deviceRunpointMapper)
-//// .eq(DeviceRunpoint::getDevice_code, device_code)
-//// .one();
-// if (!ObjectUtil.isEmpty(deviceRunpoint)) {
-//// DeviceRunpointDto obj = json.toJavaObject(DeviceRunpointDto.class);
-//// deviceRunpoint.setHasgoods(hasGoodStatus);
-//// deviceRunpoint.setMaterial_type(material_type);
-//// deviceRunpoint.setBatch(batch);
-// device.setHas_goods(Integer.parseInt(hasGoodStatus));
-// device.setMaterial_type(material_type);
-// device.setRemark(remark);
-// device.setQuantity(quantity);
-// device.setBatch(batch);
-// device.setIslock(islock);
-//// JSONObject updatejson = (JSONObject) JSONObject.toJSON(obj);
-//// runpointwo.update(updatejson, "device_code = '" + device_code + "'");
-// LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
-// wrapper.eq(DeviceRunpoint::getDevice_code, device_code);
-// deviceRunpointMapper.delete(wrapper);
-// }
- } 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);
- }
}
public String formatNum(int x) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDefination.java
new file mode 100644
index 0000000..61dd50b
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDefination.java
@@ -0,0 +1,48 @@
+package org.nl.acs.device.deviceDriver.service.defination.agvDefination.ndc;
+
+import org.nl.acs.device.device.service.entity.Device;
+import org.nl.acs.device.device.service.enums.DeviceType;
+import org.nl.acs.device.deviceDriver.service.defination.DeviceDriverDefination;
+import org.nl.acs.device.deviceDriver.service.driver.DeviceDriver;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * NDC单工位AGV
+ */
+@Service
+public class AgvNdcOneDefination implements DeviceDriverDefination {
+ @Override
+ public String getDriverCode() {
+ return "agv_ndc_one";
+ }
+
+ @Override
+ public String getDriverName() {
+ return "NDC1楼AGV";
+ }
+
+ @Override
+ public String getDriverDescription() {
+ return "NDC1楼AGV";
+ }
+
+ @Override
+ public DeviceDriver getDriverInstance(Device device) {
+ return (new AgvNdcOneDeviceDriver()).init(device, this);
+ }
+
+ @Override
+ public Class extends DeviceDriver> getDeviceDriverType() {
+ return AgvNdcOneDeviceDriver.class;
+ }
+
+ @Override
+ public List getFitDeviceTypes() {
+ List types = new LinkedList();
+ types.add(DeviceType.agv);
+ return types;
+ }
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDeviceDriver.java
new file mode 100644
index 0000000..aad2db9
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/agvDefination/ndc/AgvNdcOneDeviceDriver.java
@@ -0,0 +1,412 @@
+package org.nl.acs.device.deviceDriver.service.defination.agvDefination.ndc;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.nl.acs.agv.service.NDCAgvService;
+import org.nl.acs.autoThread.autoRun.impl.ndcAuto.OneNDCSocketConnectionAutoRun;
+import org.nl.acs.device.device.service.DeviceAppService;
+import org.nl.acs.device.device.service.DeviceService;
+import org.nl.acs.device.device.service.entity.Device;
+import org.nl.acs.device.deviceDriver.service.defination.ordinaryDefination.AbstractStandardDeviceDriver;
+import org.nl.acs.device.deviceDriver.service.defination.ordinaryDefination.standardOrdinarySite.StandardOrdinarySiteDeviceDriver;
+import org.nl.acs.log.LokiLog;
+import org.nl.acs.log.LokiLogType;
+import org.nl.acs.log.service.DeviceExecuteLogService;
+import org.nl.acs.task.instruction.domain.Instruction;
+import org.nl.acs.task.instruction.service.InstructionService;
+import org.nl.acs.task.instruction.service.impl.InstructionServiceImpl;
+import org.nl.acs.task.task.service.TaskService;
+import org.nl.acs.task.task.service.dto.TaskDto;
+import org.nl.acs.task.task.service.impl.TaskServiceImpl;
+import org.nl.config.SpringContextHolder;
+import org.nl.config.lucene.service.LuceneExecuteLogService;
+import org.nl.config.thread.ThreadPoolExecutorUtil;
+import org.nl.extInterface.wms.service.AcsToWmsService;
+import org.nl.extInterface.wms.service.enums.WmsFeedbackStatusEnum;
+import org.nl.extInterface.wms.service.impl.AcsToWmsServiceImpl;
+import org.nl.system.service.param.ISysParamService;
+import org.nl.system.service.param.impl.SysParamServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * NDC单工位AGV
+ */
+@Slf4j
+@Data
+@RequiredArgsConstructor
+public class AgvNdcOneDeviceDriver extends AbstractStandardDeviceDriver {
+ LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
+ ISysParamService paramService = SpringContextHolder.getBean(SysParamServiceImpl.class);
+ InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
+ AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
+ TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
+ NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
+ DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
+ DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
+ DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
+ @Autowired
+ LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
+ @Autowired
+ TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
+ private final static ThreadPoolExecutor EXECUTOR = (ThreadPoolExecutor) ThreadPoolExecutorUtil.getPoll();
+ int agvaddr = 0;
+ int agvaddr_copy = 0;
+ int weight = 0;
+ String device_code = "";
+ int phase = 0;
+ boolean flag = false;
+ int x = 0; //x坐标
+ int y = 0; //y坐标
+ int angle = 0; //角度
+ int electric_qty = 0; //电量
+ int status = 0; //agv状态
+ int agv_status = 0; //车辆动作状态
+ int is_have = 0; //是否有货
+ int error = 0; //车辆故障
+
+ String transportOrder = "";
+ boolean isCharge = false;
+ String message = null;
+ String agv_message = "";
+
+ @LokiLog(type = LokiLogType.ACS_TO_LMS)
+ public synchronized void processSocket(int[] arr) throws Exception {
+ device_code = this.getDeviceCode();
+ byte[] data = null;
+ phase = arr[16] * 256 + arr[17];
+ // agv任务号
+ int index = arr[12] * 256 + arr[13];
+ //任务单号和其他状态信息
+ int ikey = arr[26] * 256 + arr[27];
+ //站点号
+ agvaddr = arr[18] * 256 + arr[19];
+ //车号
+ int carno = arr[20];
+ Instruction link_inst = null;
+ List insts = null;
+ Instruction inst = 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;
+ }
+ if (error != 0) {
+ //todo 反馈立库AGV故障信息
+ }
+ Device device = null;
+ String old_device_code = null;
+ String emptyNum = null;
+ String device_code = null;
+
+ if (phase == 0x67) {
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
+ }
+ TaskDto task = new TaskDto();
+
+ if (ObjectUtil.isNotEmpty(inst)) {
+ task = taskService.findById(inst.getTask_id());
+ }
+ //分配 车id
+ //(不需要WCS反馈)
+ if (phase == 0x02) {
+ inst.setCarno(String.valueOf(carno));
+ instructionService.update(inst);
+ transportOrder = inst.getTask_code();
+ //车辆分配任务时 状态为1 执行中
+ task.setTask_status("1");
+ task.setCarno(String.valueOf(carno));
+ taskserver.update(task);
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
+ //车辆状态归零
+ agv_status = 0;
+
+ // 二次分配处理
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ // 判断是否需要二次分配
+ if ("".equals(inst.getStart_device_code())) {
+ // 向WMS申请新点位
+ JSONObject response = acsToWmsService.taskRedirection(task.getTask_code(), inst.getStart_device_code());
+ if (response != null && response.getInteger("responseCode") == 0
+ && ObjectUtil.isNotEmpty(response.getString("locationNew"))) {
+ // 返回NDC更换新位置
+ data = ndcAgvService.sendAgvOneModeInstDis(phase, index, response.getString("locationNew"));
+ }
+ }
+ //(需要WCS反馈)
+ } 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;
+ }
+ //校验agv上报站点编号与指令起始点相同
+ if (ObjectUtil.isEmpty(inst)) {
+ log.info("未找到编号{}对应的指令", ikey);
+ logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
+ return;
+ }
+ // "========================================================================请求取货================================================================================="
+ agv_status = 1;
+ //到达普通站点
+ if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ // 请求wms是否可以取货
+ if (acsToWmsService.feedbackTask(inst, WmsFeedbackStatusEnum.APPLY_TAKE.getValue())) {
+ log.info("到达{}取货点开始取货", device_code + "指令号:" + ikey);
+ inst.setExecute_status("1");
+ instructionService.update(inst);
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ flag = true;
+ }
+ }
+
+ } else if (phase == 0x04) {
+ data = getData(data, index, inst, task);
+ //取货完毕
+ //(需要WCS反馈)
+ } 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;
+ }
+ //校验agv上报站点编号与指令起始点相同
+ if (ObjectUtil.isEmpty(inst)) {
+ log.info("未找到关联编号{}对应的指令", ikey);
+ logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
+ return;
+ }
+// "========================================================================取货完成================================================================================="
+ //反馈车辆动作
+ agv_status = 2;
+ //到达普通站点取货完成
+ if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ // 通知wms取货完成
+ if (acsToWmsService.feedbackTask(inst, WmsFeedbackStatusEnum.TAKE_FINISH.getValue())) {
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ log.info("agv进入" + device_code + "取货完成" + "指令号:" + ikey);
+ flag = true;
+ }
+ }
+ } else if (phase == 0x06) {
+ //到达放货点
+ // 二次分配处理
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ // 判断是否需要二次分配
+ if ("".equals(inst.getStart_device_code())) {
+ // 向WMS申请新点位
+ JSONObject response = acsToWmsService.taskRedirection(task.getTask_code(), inst.getStart_device_code());
+ if (response != null && response.getInteger("responseCode") == 0
+ && ObjectUtil.isNotEmpty(response.getString("locationNew"))) {
+ // 返回NDC更换新位置
+ data = ndcAgvService.sendAgvOneModeInstDis(phase, index, response.getString("locationNew"));
+ }
+ }
+ } else if (phase == 0x07) {
+ // 请求放货
+ 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) && !device_code.equals("0")) {
+ log.info(agvaddr + "对应设备号为空!");
+ return;
+ }
+ //校验agv上报站点编号与指令起始点相同
+ if (ObjectUtil.isEmpty(inst)) {
+ log.info("未找到关联编号{}对应的指令", ikey);
+ return;
+ }
+// "========================================================================请求放货================================================================================="
+ agv_status = 3;
+ //普通站点
+ if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ if (acsToWmsService.feedbackTask(inst, WmsFeedbackStatusEnum.APPLY_PUT.getValue())) {
+ log.info("到达{}放货点", device_code + "指令号:" + ikey);
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ flag = true;
+ }
+ }
+
+ //放货完毕
+ //(需要WCS反馈)
+ } else if (phase == 0x09) {
+ // 放货完成
+ 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;
+ }
+
+ //校验agv上报站点编号与指令起始点相同
+ if (ObjectUtil.isEmpty(inst)) {
+ log.info("未找到编号{}对应的指令", ikey);
+ return;
+ }
+ transportOrder = "";
+// "========================================================================放货完成================================================================================="
+ agv_status = 4;
+ //agv普通站点放货完成
+ if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
+ if (acsToWmsService.feedbackTask(inst, WmsFeedbackStatusEnum.PUT_FINISH.getValue())) {
+ log.info("{}放货完成", device_code + "指令号:" + ikey);
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
+ flag = true;
+ }
+ }
+ }
+ //到达位置点
+ //(需要WCS反馈)
+ else if (phase == 0x64) {//param,agv货位id待定
+ //1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
+ agvaddr = arr[18] * 256 + arr[19];
+ agvaddr_copy = agvaddr;
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
+ } else if (phase == 0x50) {//进入交通灯区域
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
+ } else if (phase == 0x51) {//离开交通灯区域
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
+ } else if (phase == 0x70) {
+ //x坐标
+ x = ikey;
+ } else if (phase == 0x71) {
+ //y坐标
+ y = ikey;
+ } else if (phase == 0x72) {
+ //车辆角度
+ angle = ikey;
+ } else if (phase == 0x73) {
+ //agv电量
+ electric_qty = ikey;
+ } else if (phase == 0x74) {
+ status = ikey;
+ } else if (phase == 0x75) {
+ is_have = ikey;
+ }
+ if (!ObjectUtil.isEmpty(data)) {
+ logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
+ OneNDCSocketConnectionAutoRun.write(data);
+ }
+ }
+
+ byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) {
+ data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
+ return data;
+ }
+
+ @Override
+ public JSONObject getDeviceStatusName() throws Exception {
+ return null;
+ }
+
+ @Override
+ public void setDeviceStatus(JSONObject data) {
+
+ }
+
+ @Override
+ public void execute() throws Exception {
+
+ }
+}
\ No newline at end of file
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/standardInspectSite/StandardInspectSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/standardInspectSite/StandardInspectSiteDeviceDriver.java
index 653fe79..9aecb07 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/standardInspectSite/StandardInspectSiteDeviceDriver.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/opcDefination/standardInspectSite/StandardInspectSiteDeviceDriver.java
@@ -153,7 +153,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver {
@Override
public void execute() {
- try {
+ /* try {
Thread.sleep(2000);
this.devicecode = this.getDevice().getDevice_code();
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
@@ -283,7 +283,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver {
} catch (Exception e) {
System.out.println("--交互异常---");
e.printStackTrace();
- }
+ }*/
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDefination.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDefination.java
index 0a0dbf9..0d1aab2 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDefination.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDefination.java
@@ -43,7 +43,7 @@ public class StandardOrdinarySiteDefination implements DeviceDriverDefination {
@Override
public List getFitDeviceTypes() {
List types = new LinkedList();
- types.add(DeviceType.conveyor);
+ types.add(DeviceType.station);
return types;
}
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDeviceDriver.java
index 8952889..d575be5 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDeviceDriver.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/deviceDriver/service/defination/ordinaryDefination/standardOrdinarySite/StandardOrdinarySiteDeviceDriver.java
@@ -1,25 +1,19 @@
package org.nl.acs.device.deviceDriver.service.defination.ordinaryDefination.standardOrdinarySite;
-import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ObjectUtils;
-import org.nl.acs.device.deviceDriver.service.defination.ordinaryDefination.AbstractStandardDeviceDriver;
-import org.nl.acs.device.storageMgt.service.dto.StorageCellDto;
-import org.nl.acs.device.storageMgt.service.impl.StorageCellServiceImpl;
import org.nl.acs.device.device.service.DeviceAppService;
+import org.nl.acs.device.deviceDriver.service.defination.ordinaryDefination.AbstractStandardDeviceDriver;
import org.nl.acs.task.TaskConfig;
import org.nl.acs.task.instruction.domain.Instruction;
import org.nl.acs.task.instruction.service.InstructionService;
import org.nl.config.SpringContextHolder;
-import org.nl.system.service.param.ISysParamService;
import org.nl.extInterface.agvKit.service.AcsToKitService;
import org.nl.extInterface.wms.service.AcsToWmsService;
-import org.nl.extInterface.wms.service.enums.WmsFeedbackStatusEnum;
+import org.nl.system.service.param.ISysParamService;
import java.util.Map;
@@ -74,7 +68,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractStandardDeviceDriv
@Override
public void execute() {
- try {
+ /* try {
Thread.sleep(2000);
if (this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
// 驱动按周期执行,当前直接 return 就会停留在等待态,下一轮继续请求 WMS 许可。
@@ -198,7 +192,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractStandardDeviceDriv
} catch (Exception ex) {
ex.printStackTrace();
log.info("设备执行失败" + ex.getMessage());
- }
+ }*/
}
@Override
@@ -214,7 +208,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractStandardDeviceDriv
}
@Override
- public void setDeviceInnerParam(Map innerParamss) {
+ public void setDeviceInnerParam(Map innerParamss) {
synchronized (lock) {
// 不允许设置和上次处理相同的taskId
final String taskId = innerParamss.get("taskId");
@@ -234,7 +228,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractStandardDeviceDriv
synchronized (lock) {
// 设置新任务
// 处理完成,更新状态
- if (Integer.valueOf(4).equals(agvphase)){
+ if (Integer.valueOf(4).equals(agvphase)) {
this.lastTakeInstCode = reqTakeInstCode;
}
this.reqTakeRequireSuccess = false;
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLog.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLog.java
new file mode 100644
index 0000000..b6a684d
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLog.java
@@ -0,0 +1,15 @@
+package org.nl.acs.log;
+
+import java.lang.annotation.*;
+
+/**
+ * @author: lyd
+ * @description: 自定义日志注解, 用作LOKI日志分类
+ * @Date: 2022/10/10
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+@Documented
+public @interface LokiLog {
+ LokiLogType type() default LokiLogType.DEFAULT;
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLogType.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLogType.java
new file mode 100644
index 0000000..a20940b
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/log/LokiLogType.java
@@ -0,0 +1,27 @@
+package org.nl.acs.log;
+
+/**
+ * @author: lyd
+ * @description:
+ * @Date: 2022/10/11
+ */
+public enum LokiLogType {
+ // 默认
+ DEFAULT("默认"),
+ // AGV接口日志
+ AGV("AGV接口日志"),
+ // ACS请求LMS
+ ACS_TO_LMS("ACS请求LMS"),
+ // ACS请求立库
+ ACS_TO_LK("ACS请求立库");
+
+ private String desc;
+
+ LokiLogType(String desc) {
+ this.desc = desc;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java
index 2f280ba..2c05c38 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/instruction/service/impl/InstructionServiceImpl.java
@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.ApplicationAutoInitial;
+import org.nl.acs.agv.service.NDCAgvService;
import org.nl.acs.task.instruction.domain.Instruction;
import org.nl.acs.task.instruction.domain.InstructionMybatis;
import org.nl.acs.task.instruction.enums.InstructionStatusEnum;
@@ -53,6 +54,7 @@ import org.nl.common.utils.FileUtil;
import org.nl.common.utils.PageUtil;
import org.nl.acs.task.instruction.service.InstructionService;
import org.nl.common.utils.SecurityUtils;
+import org.nl.config.MapOf;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.enums.LogLevelEnum;
import org.nl.config.lucene.service.LuceneExecuteLogService;
@@ -364,20 +366,8 @@ public class InstructionServiceImpl extends CommonServiceImpl instructionMybatis = instructionMapper.selectList(Wrappers.lambdaQuery(InstructionMybatis.class)
- .eq(InstructionMybatis::getTask_code, dto.getTask_code()));
- if (CollUtil.isNotEmpty(instructionMybatis) && instructionMybatis.stream().anyMatch(inst -> inst.getStart_device_code()
- .equals(start_device_code))) {
- return;
- }
- }
- String currentUsername = SecurityUtils.getCurrentNickName();
+ String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
dto.setRoute_plan_code(task.getRoute_plan_code());
@@ -394,13 +384,10 @@ public class InstructionServiceImpl extends CommonServiceImpl shortPathsList =
routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
- if (ObjectUtils.isEmpty(shortPathsList)) {
- throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
- }
- if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
- throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
- }
- if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(AgvSystemTypeEnum.Two_NDC_System_Type.getIndex()))
- {
- // 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
- if (!StrUtil.equals(task.getAgv_system_type(), "0")
- && ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
- if (StrUtil.isBlank(dto.getAgv_inst_type())) {
- String agv_system_type = task.getAgv_system_type();
- String task_type = task.getTask_type();
- if (!StrUtil.equals(agv_system_type, "1")) {
- dto.setAgv_inst_type("2");
-
- }
- dto.setAgv_system_type(task.getAgv_system_type());
- }
- try {
- if (StrUtil.isEmpty(dto.getAgv_inst_type()) || StrUtil.isEmpty(dto.getAgv_system_type())) {
- log.info("sendAgvInstToNDC 指令校验:" + dto.getInstruction_code() + ",inst_type:" + dto.getInstruction_type()
- + ",inst_system_type:" + dto.getAgv_system_type());
- }
- HttpResponse httpResponse = acsToKitService.genAgvSchedulingTask(dto, 3);
- log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type()
- + ",AGV指令类型:" + dto.getInstruction_type());
-
- } catch (Exception e) {
- dto.setSend_status("2");
- dto.setRemark(e.getMessage());
- e.printStackTrace();
- log.warn("下发AGV指令异常:" + e);
- LuceneLogDto logDto1 = LuceneLogDto.builder()
- .deviceCode(start_device_code)
- .content("下发AGV指令异常")
- .build();
- logDto1.setLogLevel((LogLevelEnum.ERROR));
- luceneExecuteLogService.deviceExecuteLog(logDto1);
- }
+ RouteLineDto route = null;
+ for (int i = 0; i < shortPathsList.size(); i++) {
+ RouteLineDto routeLineDto = shortPathsList.get(i);
+ String route_device = routeLineDto.getDevice_code();
+ String route_next_device = routeLineDto.getNext_device_code();
+ if (route_device.equals(dto.getStart_device_code())
+ && route_next_device.equals(dto.getNext_device_code())) {
+ route = routeLineDto;
+ break;
}
}
-
+ if (ObjectUtil.isEmpty(route)) {
+ throw new BadRequestException(LangProcess.msg("error_isNull", "route"));
+ }
+ // 下发ndc系统
+ if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
+ NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
+ ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
+ }
} catch (Exception e) {
dto.setSend_status("2");
- log.error(e.getMessage());
- throw e;
+ e.printStackTrace();
+ log.error("");
}
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
instructionMapper.insert(entity);
@@ -819,15 +782,15 @@ public class InstructionServiceImpl extends CommonServiceImpl
+
+
+
+
+
+
+
+ ${LOG_HOME}/ACS请求WMS/%d{yyyy-MM-dd}.%i.log
+
+ 15
+
+ 100MB
+
+ 2GB
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ ${log.charset}
+
+
+
+
+
+
+ 512
+
+
+
+
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/AgvNdcOneDeviceDriver.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/AgvNdcOneDeviceDriver.xml
new file mode 100644
index 0000000..a54b883
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/AgvNdcOneDeviceDriver.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+ ${LOG_HOME}/AGV驱动与NDC交互/%d{yyyy-MM-dd}.%i.log
+
+ 15
+
+ 100MB
+
+ 2GB
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ ${log.charset}
+
+
+
+
+
+
+ 512
+
+
+
+
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml
new file mode 100644
index 0000000..0397bdd
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCAgvServiceImpl.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+ ${LOG_HOME}/下发NDC/%d{yyyy-MM-dd}.%i.log
+
+ 15
+
+ 100MB
+
+ 2GB
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ ${log.charset}
+
+
+
+
+
+
+
+ 512
+
+
+
+
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml
new file mode 100644
index 0000000..e403a4d
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/NDCSocketConnectionAutoRun.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+ ${LOG_HOME}/NDC交互日志/%d{yyyy-MM-dd}.%i.log
+
+ 15
+
+ 100MBa
+
+ 2GB
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ ${log.charset}
+
+
+
+
+
+
+ 512
+
+
+
+
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/log/WmsToAcs.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/log/WmsToAcs.xml
new file mode 100644
index 0000000..8ed5e4a
--- /dev/null
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/log/WmsToAcs.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+ ${LOG_HOME}/WMS请求ACS/%d{yyyy-MM-dd}.%i.log
+
+ 15
+
+ 100MB
+
+ 2GB
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
+ ${log.charset}
+
+
+
+
+
+
+ 512
+
+
+
+
+
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
index b5abd40..982e0d5 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml
@@ -12,39 +12,55 @@ https://juejin.cn/post/6844903775631572999
nlAdmin
-
-
-
+ value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %blue(%msg%n)"/>
-
+
+
+
+
+
true
-
+
${log.pattern}
-
+
+
+
+
${LOG_HOME}/%d{yyyy-MM-dd}.%i.log
- 15
+ 30
- 200MB
+ 120MB
20GB
-
+
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
- ${log.charset}
+
+
+
+
+ DEBUG
+ ACCEPT
+ DENY
+
+
+
+
+
+ 512
@@ -53,21 +69,14 @@ https://juejin.cn/post/6844903775631572999
500
-
-
-
-
- 512
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
@@ -109,14 +110,11 @@ https://juejin.cn/post/6844903775631572999
-
-
-
@@ -131,6 +129,9 @@ https://juejin.cn/post/6844903775631572999
+
+
+
@@ -138,4 +139,27 @@ https://juejin.cn/post/6844903775631572999
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue b/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue
index e69de29..db13247 100644
--- a/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue
+++ b/acs2/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+ 指令相关:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+
+
+
+
+
+
+