rev ndc驱动

This commit is contained in:
2023-05-30 18:33:41 +08:00
parent b97fe6683e
commit c02894484d
18 changed files with 111 additions and 150 deletions

View File

@@ -15,9 +15,11 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -33,23 +35,22 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@Slf4j @Slf4j
@Component @Component
public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Autowired
private ParamService paramService;
@Autowired
private InstructionService instructionService;
@Autowired
private TaskService taskService;
@Autowired
private NDCAgvService ndcAgvService;
@Autowired
private DeviceAppService deviceAppService;
Socket s; private Socket socket;
String ip = "192.168.46.225"; private static DataOutputStream dos;
int port = 1234; private static DataInputStream dis;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
String[] ERROR = new String[]{
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
"抬叉停止"};
boolean bConnected = true;
public NDCSocketConnectionAutoRun() { public NDCSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
} }
@Override @Override
@@ -65,37 +66,30 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Override @Override
public void autoRun() throws IOException { public void autoRun() throws IOException {
try { try {
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); String ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); int port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class); socket = new Socket(ip, port);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); byte[] bytes = new byte[1024];
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); dos = new DataOutputStream(socket.getOutputStream());
ip = paramService.findByCode(AcsConfig.AGVURL).getValue(); dis = new DataInputStream(socket.getInputStream());
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue()); int len;
byte[] b = new byte[1028]; int[] arr;
s = new Socket(ip, port); StringBuffer sb;
dos = new DataOutputStream(s.getOutputStream()); while ((len = dis.read(bytes)) != -1) {
dis = new DataInputStream(s.getInputStream()); arr = new int[len];
sb = new StringBuffer();
while (bConnected) { for (int i = 0; i < len; i++) {
int count = dis.read(b); int temp = bytes[i];
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) if (temp < 0)
temp += 256; temp += 256;
arr[i] = temp; arr[i] = temp;
StringBuffer bs1 = new StringBuffer("0"); StringBuffer bs1 = new StringBuffer("0");
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); sb.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
} }
if (arr[8] * 256 + arr[9] == 0x73) { if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null; byte[] data = null;
System.out.println("接收agv上报信息" + bs); System.out.println("接收agv上报信息" + sb);
//执行阶段 //执行阶段
int phase = arr[16] * 256 + arr[17]; int phase = arr[16] * 256 + arr[17];
// agv任务号 // agv任务号
@@ -114,7 +108,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
insts = instructionService.findByLinkNum(String.valueOf(ikey)); insts = instructionService.findByLinkNum(String.valueOf(ikey));
} }
log.info("接收agv上报信息" + bs); log.info("接收agv上报信息" + sb);
log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
Device device = null; Device device = null;
// //
@@ -147,12 +141,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code()); log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
} }
// for (Instruction inst : insts) {
// inst.setInstruction_status("1");
// inst.setAgv_jobno(String.valueOf(index));
// instructionService.update(inst);
// log.info("修改指令执行信息成功,指令号:{}", inst.getInstruction_code());
// }
} }
} }
if (flag) { if (flag) {
@@ -161,10 +149,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
} }
} else if (phase == 0x1A) { } else if (phase == 0x1A) {
//任务完毕无车id及状态
// for (Instruction inst : insts) {
// instructionService.finish(inst.getInstruction_id());
// }
instructionService.finishByLinkNum(String.valueOf(ikey)); instructionService.finishByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x30) { } else if (phase == 0x30) {
@@ -196,21 +180,15 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
System.out.println("agv上报不是0073类型动作不处理"); System.out.println("agv上报不是0073类型动作不处理");
} }
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("双工Agv链接异常");
log.info("双工AGV链接异常");
log.error("agv连接出现异常:{}", JSON.toJSONString(e)); log.error("agv连接出现异常:{}", JSON.toJSONString(e));
if (ObjectUtil.isNotEmpty(s)) { if (ObjectUtil.isNotEmpty(socket)) {
s.close(); socket.close();
} }
System.out.println(e.getMessage());
e.printStackTrace();
} finally { } finally {
} }
} }
@@ -218,7 +196,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public void stop() { public void stop() {
super.after(); super.after();
try { try {
s.close(); socket.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -232,9 +210,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.write(b); dos.write(b);
dos.flush(); dos.flush();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block throw new BadRequestException(e.getMessage());
e.printStackTrace();
} }
} }
} }

View File

@@ -1,6 +1,7 @@
package org.nl.acs.auto.run; package org.nl.acs.auto.run;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.NDCAgvService;
@@ -11,9 +12,12 @@ import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl; import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.opc.Device; import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.DataInputStream; import java.io.DataInputStream;
@@ -29,23 +33,21 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
@Slf4j @Slf4j
@Component @Component
public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Autowired
private ParamService paramService;
@Autowired
private InstructionService instructionService;
@Autowired
private NDCAgvService ndcAgvService;
@Autowired
private DeviceAppService deviceAppService;
Socket s; private Socket socket;
String ip = "192.168.46.225"; private static DataOutputStream dos;
int port = 1234; private static DataInputStream dis;
static DataOutputStream dos;
static DataInputStream dis;
private int recordTimeOut = 10000;
private Date recordTime;
String[] ERROR = new String[]{
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
"抬叉停止"};
boolean bConnected = true;
public OneNDCSocketConnectionAutoRun() { public OneNDCSocketConnectionAutoRun() {
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
} }
@Override @Override
@@ -60,40 +62,27 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
@Override @Override
public void autoRun() throws IOException { public void autoRun() throws IOException {
System.out.println("OneAgv链接开始");
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
try { try {
String ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
byte[] b = new byte[1028]; int port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
s = new Socket(ip, port); socket = new Socket(ip, port);
dos = new DataOutputStream(s.getOutputStream()); dos = new DataOutputStream(socket.getOutputStream());
dis = new DataInputStream(s.getInputStream()); dis = new DataInputStream(socket.getInputStream());
System.out.println("OneAgv链接成功"); byte[] bytes = new byte[1024];
while (bConnected) { int count;
int count = dis.read(b); int[] arr;
if (count == -1) { StringBuffer bs;
break; while ((count = dis.read(bytes)) != -1) {
} arr = new int[count];
int[] arr = new int[count]; bs = new StringBuffer();
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
int temp = b[i]; int temp = bytes[i];
if (temp < 0) if (temp < 0)
temp += 256; temp += 256;
arr[i] = temp; arr[i] = temp;
StringBuffer bs1 = new StringBuffer("0"); StringBuffer bs1 = new StringBuffer("0");
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
} }
//System.out.println("收到请求参数:" + bs);
boolean flag = false;
if (arr[8] * 256 + arr[9] == 0x73) { if (arr[8] * 256 + arr[9] == 0x73) {
byte[] data = null; byte[] data = null;
System.out.println("接收agv上报信息" + bs); System.out.println("接收agv上报信息" + bs);
@@ -114,28 +103,20 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
log.info("接收agv上报信息" + bs); log.info("接收agv上报信息" + bs);
log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); log.info("接收agv上报信息" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
Device device = null; Device device = null;
String device_code = null;
//
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
//开始任务/上报订单号 //开始任务/上报订单号
if (phase == 0x01) { if (phase == 0x01) {
for (Instruction inst : insts) { if (ObjectUtil.isNotEmpty(insts)) {
inst.setInstruction_status("1"); for (Instruction inst : insts) {
inst.setAgv_jobno(String.valueOf(index)); inst.setInstruction_status("1");
inst.setSend_status("1"); inst.setAgv_jobno(String.valueOf(index));
instructionService.update(inst); inst.setSend_status("1");
instructionService.update(inst);
}
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} }
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else if (phase == 0x0A) { } else if (phase == 0x0A) {
// for (Instruction inst : insts) {
// instructionService.finish(inst.getInstruction_id());
// }
instructionService.finishByLinkNum(String.valueOf(ikey)); instructionService.finishByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
@@ -143,10 +124,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
data = ndcAgvService.sendAgvOneModeInst(143, index, 0); data = ndcAgvService.sendAgvOneModeInst(143, index, 0);
} else if (phase == 0xFF) { } else if (phase == 0xFF) {
// for (Instruction inst : insts) {
// instructionService.cancelNoSendAgv(inst.getInstruction_id());
// }
instructionService.cancelByLinkNum(String.valueOf(ikey)); instructionService.cancelByLinkNum(String.valueOf(ikey));
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else if (phase == 0x50) { } else if (phase == 0x50) {
@@ -176,18 +153,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("OneAgv链接异常"); log.error("agv连接出现异常:{}", JSON.toJSONString(e));
if (ObjectUtil.isNotEmpty(s)) { if (ObjectUtil.isNotEmpty(socket)) {
s.close(); socket.close();
} }
System.out.println(e.getMessage());
e.printStackTrace();
} finally { } finally {
} }
} }
@@ -195,7 +167,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
public void stop() { public void stop() {
super.after(); super.after();
try { try {
s.close(); socket.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -209,8 +181,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
dos.write(b); dos.write(b);
dos.flush(); dos.flush();
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block throw new BadRequestException(e.getMessage());
e.printStackTrace();
} }
} }

View File

@@ -1,5 +1,6 @@
package org.nl.acs.device_driver.basedriver.hailiang_one; package org.nl.acs.device_driver.basedriver.hailiang_one;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
@@ -8,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
public class MonitoringLargeScreenData { public class MonitoringLargeScreenData {
//存储倒料位剩余物料个数并返库MES //存储倒料位剩余物料个数并返库MES
public static ConcurrentHashMap<String, Integer> deviceNumData = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Map<String, Integer>> deviceNumData = new ConcurrentHashMap<>();
//存储工单数量并反馈MES //存储工单数量并反馈MES
public static ConcurrentHashMap<String, Integer> orderData = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String, Integer> orderData = new ConcurrentHashMap<>();
} }

View File

@@ -140,7 +140,10 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open" + last_is_open + "->" + is_open); logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open" + last_is_open + "->" + is_open);
} }
if (silo_weight != last_silo_weight) { if (silo_weight != last_silo_weight) {
MonitoringLargeScreenData.deviceNumData.put(this.device_code, this.getSilo_weight()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getFull_number());
feedNumMap.put("weight", this.getSilo_weight());
MonitoringLargeScreenData.deviceNumData.put(this.device_code, feedNumMap);
logServer.deviceExecuteLog(this.device_code, "", "", "信号silo_weight" + last_silo_weight + "->" + silo_weight); logServer.deviceExecuteLog(this.device_code, "", "", "信号silo_weight" + last_silo_weight + "->" + silo_weight);
} }
if (full_number != last_full_number) { if (full_number != last_full_number) {

View File

@@ -296,6 +296,7 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
public void issuedOrderFinish(String autoFinish) { public void issuedOrderFinish(String autoFinish) {
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
this.writing("to_order_compel_finished", "1"); this.writing("to_order_compel_finished", "1");
this.writing("to_confirm_finished", "1");
} else { } else {
this.writing("to_confirm_finished", "1"); this.writing("to_confirm_finished", "1");
} }

View File

@@ -671,6 +671,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -246,7 +246,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
message = "未联机"; message = "未联机";
//有报警 //有报警
} else { } else {
// this.setIsonline(true); // this.setIsonline(true);
this.setIserror(false); this.setIserror(false);
message = ""; message = "";
} }
@@ -325,6 +325,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -180,7 +180,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
message = ""; message = "";
//满料位满足联机有货有工单时向MES申请任务 //满料位满足联机有货有工单时向MES申请任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) { if (mode == 1 && move == 1 && order > 0 && full_number > 0 && !requireSucess) {
boolean flag = apply_task(); boolean flag = apply_task();
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -204,7 +204,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
//agv到达取货位 //agv到达取货位
if (agvphase == 0x03 || agvphase == 0x07) { if (agvphase == 0x03 || agvphase == 0x07) {
if (mode == 1 && move == 1 && full_number > 0 && ObjectUtil.isNotEmpty(inst)) { if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst)) {
//下发取货位agv取货就绪 //下发取货位agv取货就绪
this.writing("to_agv_ready", "1"); this.writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -223,9 +223,6 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
if (move == 0) { if (move == 0) {
notFeedAgvMessage += "光电信号无货,"; notFeedAgvMessage += "光电信号无货,";
} }
if (full_number == 0) {
notFeedAgvMessage += "满框数量为0,";
}
if (inst == null) { if (inst == null) {
notFeedAgvMessage += "AGV指令为空,"; notFeedAgvMessage += "AGV指令为空,";
} }

View File

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@@ -141,7 +142,9 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
if (storage_stock_num != last_storage_stock_num) { if (storage_stock_num != last_storage_stock_num) {
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getStorage_stock_num());
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), feedNumMap);
} }
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) { if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false; requireSucess = false;

View File

@@ -643,6 +643,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -299,6 +299,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_order_compel_finished", "1"); map.put("to_order_compel_finished", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -182,7 +182,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
message = ""; message = "";
//工作模式联机、满料位有货、工单号大于0 就申请agv任务 //工作模式联机、满料位有货、工单号大于0 就申请agv任务
if (mode == 1 && move == 1 && order > 0 && !requireSucess) { if (mode == 1 && move == 1 && full_number > 0 && order > 0 && !requireSucess) {
boolean flag = apply_task(); boolean flag = apply_task();
this.noApplyTaskMessage = null; this.noApplyTaskMessage = null;
if (flag) { if (flag) {
@@ -206,7 +206,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
//agv到达取货点 //agv到达取货点
if (agvphase == 0x03 || agvphase == 0x07) { if (agvphase == 0x03 || agvphase == 0x07) {
if (mode == 1 && move == 1 && full_number > 0 && ObjectUtil.isNotEmpty(inst)) { if (mode == 1 && move == 1 && ObjectUtil.isNotEmpty(inst)) {
//下发取货位agv取货就绪 //下发取货位agv取货就绪
this.writing("to_agv_ready", "1"); this.writing("to_agv_ready", "1");
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode()); inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
@@ -225,9 +225,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
if (move == 0) { if (move == 0) {
notFeedAgvMessage += "光电信号无货,"; notFeedAgvMessage += "光电信号无货,";
} }
if (full_number == 0) {
notFeedAgvMessage += "满框数量为0,";
}
if (inst == null) { if (inst == null) {
notFeedAgvMessage += "AGV指令为空,"; notFeedAgvMessage += "AGV指令为空,";
} }

View File

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@@ -142,7 +143,9 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
} }
if (storage_stock_num != last_storage_stock_num) { if (storage_stock_num != last_storage_stock_num) {
if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { if (order > 0 && this.itemProtocol.getIsonline() && ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), this.getStorage_stock_num()); Map<String, Integer> feedNumMap = new HashMap<>();
feedNumMap.put("qty", this.getStorage_stock_num());
MonitoringLargeScreenData.deviceNumData.put(this.getDevice().getExtraValue().get("link_device_code").toString(), feedNumMap);
} }
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) { if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("min_num")) && storage_stock_num == Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) && Integer.parseInt(String.valueOf(this.getDevice().getExtraValue().get("min_num"))) != -1) {
requireSucess = false; requireSucess = false;

View File

@@ -418,6 +418,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
map.put("to_compel_finish", "1"); map.put("to_compel_finish", "1");
map.put("to_confirm_finished", "1");
} else { } else {
map.put("to_confirm_finished", "1"); map.put("to_confirm_finished", "1");
} }

View File

@@ -210,6 +210,7 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
public void issuedOrderFinish(String autoFinish) { public void issuedOrderFinish(String autoFinish) {
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) { if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
this.writing("to_order_compel_finished", "1"); this.writing("to_order_compel_finished", "1");
this.writing("to_confirm_finished", "1");
} else { } else {
this.writing("to_confirm_finished", "1"); this.writing("to_confirm_finished", "1");
} }

View File

@@ -52,7 +52,7 @@ public interface AcsToWmsService {
* @param map * @param map
* @return * @return
*/ */
HttpResponse feedDeviceNum(Map<String, Integer> map); HttpResponse feedDeviceNum(Map<String, Map<String,Integer>> map);
/** /**

View File

@@ -106,7 +106,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
result = HttpRequest.post(url) result = HttpRequest.post(url)
.body(JSON.toJSONString(param)) .body(JSON.toJSONString(param))
.execute(); .execute();
log.info("acs向mes反馈工单状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(param), JSON.toJSONString(result)); log.info("acs向mes反馈工单状态成功,请求路径:{},请求参数:{},响应参数:{}", url, JSON.toJSONString(param), JSON.toJSONString(result.body()));
} catch (Exception e) { } catch (Exception e) {
log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage()); log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage());
} }
@@ -148,10 +148,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override @Override
public HttpResponse feedOrderRealQty(JSONObject param) { public HttpResponse feedOrderRealQty(JSONObject param) {
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedOrderRealQty"); AddressDto addressDto = addressService.findByCode("feedOrderRealQty");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();
@@ -175,11 +175,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} }
@Override @Override
public HttpResponse feedDeviceNum(Map<String, Integer> map) { public HttpResponse feedDeviceNum(Map<String, Map<String, Integer>> map) {
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("feedDeviceNum"); AddressDto addressDto = addressService.findByCode("feedDeviceNum");
String methods_url = addressDto.getMethods_url(); String methods_url = addressDto.getMethods_url();

View File

@@ -520,6 +520,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) { if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) {
feed_jo.put("vehicle_code", dto.getVehicle_code()); feed_jo.put("vehicle_code", dto.getVehicle_code());
} }
if (ObjectUtil.isNotEmpty(dto.getWeight())) {
feed_jo.put("weight", dto.getWeight());
}
feed_jo.put("ext_param", dto.getExt_param()); feed_jo.put("ext_param", dto.getExt_param());
JSONArray ja = new JSONArray(); JSONArray ja = new JSONArray();
ja.add(feed_jo); ja.add(feed_jo);