rev ndc驱动
This commit is contained in:
@@ -15,9 +15,11 @@ import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
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.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -33,23 +35,22 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
@Slf4j
|
||||
@Component
|
||||
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;
|
||||
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;
|
||||
|
||||
private Socket socket;
|
||||
private static DataOutputStream dos;
|
||||
private static DataInputStream dis;
|
||||
|
||||
public NDCSocketConnectionAutoRun() {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,37 +66,30 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
@Override
|
||||
public void autoRun() throws IOException {
|
||||
try {
|
||||
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
byte[] b = new byte[1028];
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
|
||||
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];
|
||||
String ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
int port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
socket = new Socket(ip, port);
|
||||
byte[] bytes = new byte[1024];
|
||||
dos = new DataOutputStream(socket.getOutputStream());
|
||||
dis = new DataInputStream(socket.getInputStream());
|
||||
int len;
|
||||
int[] arr;
|
||||
StringBuffer sb;
|
||||
while ((len = dis.read(bytes)) != -1) {
|
||||
arr = new int[len];
|
||||
sb = new StringBuffer();
|
||||
for (int i = 0; i < len; i++) {
|
||||
int temp = bytes[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));
|
||||
sb.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
|
||||
}
|
||||
|
||||
if (arr[8] * 256 + arr[9] == 0x73) {
|
||||
byte[] data = null;
|
||||
System.out.println("接收agv上报信息:" + bs);
|
||||
System.out.println("接收agv上报信息:" + sb);
|
||||
//执行阶段
|
||||
int phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
@@ -114,7 +108,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
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);
|
||||
Device device = null;
|
||||
//
|
||||
@@ -147,12 +141,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
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) {
|
||||
@@ -161,10 +149,6 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
}
|
||||
} else if (phase == 0x1A) {
|
||||
//任务完毕(无车id及状态
|
||||
// for (Instruction inst : insts) {
|
||||
// instructionService.finish(inst.getInstruction_id());
|
||||
// }
|
||||
instructionService.finishByLinkNum(String.valueOf(ikey));
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else if (phase == 0x30) {
|
||||
@@ -196,21 +180,15 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
System.out.println("agv上报不是0073类型动作,不处理");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("双工Agv链接异常");
|
||||
log.info("双工AGV链接异常");
|
||||
log.error("agv连接出现异常:{}", JSON.toJSONString(e));
|
||||
if (ObjectUtil.isNotEmpty(s)) {
|
||||
s.close();
|
||||
if (ObjectUtil.isNotEmpty(socket)) {
|
||||
socket.close();
|
||||
}
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +196,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
public void stop() {
|
||||
super.after();
|
||||
try {
|
||||
s.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -232,9 +210,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dos.write(b);
|
||||
dos.flush();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
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.opc.Device;
|
||||
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.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -29,23 +33,21 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
@Autowired
|
||||
private ParamService paramService;
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
@Autowired
|
||||
private NDCAgvService ndcAgvService;
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
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;
|
||||
private Socket socket;
|
||||
private static DataOutputStream dos;
|
||||
private static DataInputStream dis;
|
||||
|
||||
|
||||
public OneNDCSocketConnectionAutoRun() {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,40 +62,27 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
@Override
|
||||
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 {
|
||||
|
||||
byte[] b = new byte[1028];
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("OneAgv链接成功");
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
if (count == -1) {
|
||||
break;
|
||||
}
|
||||
int[] arr = new int[count];
|
||||
StringBuffer bs = new StringBuffer();
|
||||
|
||||
String ip = paramService.findByCode(AcsConfig.ONEAGVURL).getValue();
|
||||
int port = Integer.parseInt(paramService.findByCode(AcsConfig.ONEAGVPORT).getValue());
|
||||
socket = new Socket(ip, port);
|
||||
dos = new DataOutputStream(socket.getOutputStream());
|
||||
dis = new DataInputStream(socket.getInputStream());
|
||||
byte[] bytes = new byte[1024];
|
||||
int count;
|
||||
int[] arr;
|
||||
StringBuffer bs;
|
||||
while ((count = dis.read(bytes)) != -1) {
|
||||
arr = new int[count];
|
||||
bs = new StringBuffer();
|
||||
for (int i = 0; i < count; i++) {
|
||||
int temp = b[i];
|
||||
int temp = bytes[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));
|
||||
}
|
||||
|
||||
//System.out.println("收到请求参数:" + bs);
|
||||
boolean flag = false;
|
||||
if (arr[8] * 256 + arr[9] == 0x73) {
|
||||
byte[] data = null;
|
||||
System.out.println("接收agv上报信息:" + bs);
|
||||
@@ -114,28 +103,20 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
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) {
|
||||
for (Instruction inst : insts) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
if (ObjectUtil.isNotEmpty(insts)) {
|
||||
for (Instruction inst : insts) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
|
||||
} else if (phase == 0x0A) {
|
||||
|
||||
// for (Instruction inst : insts) {
|
||||
// instructionService.finish(inst.getInstruction_id());
|
||||
// }
|
||||
instructionService.finishByLinkNum(String.valueOf(ikey));
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
@@ -143,10 +124,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
data = ndcAgvService.sendAgvOneModeInst(143, index, 0);
|
||||
|
||||
} else if (phase == 0xFF) {
|
||||
|
||||
// for (Instruction inst : insts) {
|
||||
// instructionService.cancelNoSendAgv(inst.getInstruction_id());
|
||||
// }
|
||||
instructionService.cancelByLinkNum(String.valueOf(ikey));
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
} else if (phase == 0x50) {
|
||||
@@ -176,18 +153,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("OneAgv链接异常");
|
||||
if (ObjectUtil.isNotEmpty(s)) {
|
||||
s.close();
|
||||
log.error("agv连接出现异常:{}", JSON.toJSONString(e));
|
||||
if (ObjectUtil.isNotEmpty(socket)) {
|
||||
socket.close();
|
||||
}
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +167,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
public void stop() {
|
||||
super.after();
|
||||
try {
|
||||
s.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -209,8 +181,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dos.write(b);
|
||||
dos.flush();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.basedriver.hailiang_one;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
@@ -8,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class MonitoringLargeScreenData {
|
||||
//存储倒料位剩余物料个数并返库MES
|
||||
public static ConcurrentHashMap<String, Integer> deviceNumData = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, Map<String, Integer>> deviceNumData = new ConcurrentHashMap<>();
|
||||
//存储工单数量并反馈MES
|
||||
public static ConcurrentHashMap<String, Integer> orderData = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@@ -140,7 +140,10 @@ public class HailiangCleaningMachineStorageStationDeviceDriver extends AbstractO
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号is_open:" + last_is_open + "->" + is_open);
|
||||
}
|
||||
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);
|
||||
}
|
||||
if (full_number != last_full_number) {
|
||||
|
||||
@@ -296,6 +296,7 @@ public class EalingMachineDeviceDriver extends AbstractOpcDeviceDriver implement
|
||||
public void issuedOrderFinish(String autoFinish) {
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
this.writing("to_order_compel_finished", "1");
|
||||
this.writing("to_confirm_finished", "1");
|
||||
} else {
|
||||
this.writing("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -671,6 +671,7 @@ public class HailiangEngravingMachineDeviceDriver extends AbstractOpcDeviceDrive
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
map.put("to_order_compel_finished", "1");
|
||||
map.put("to_confirm_finished", "1");
|
||||
} else {
|
||||
map.put("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
message = "未联机";
|
||||
//有报警
|
||||
} else {
|
||||
// this.setIsonline(true);
|
||||
// this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
}
|
||||
@@ -325,6 +325,7 @@ public class HailiangOldSpecialDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
map.put("to_order_compel_finished", "1");
|
||||
map.put("to_confirm_finished", "1");
|
||||
} else {
|
||||
map.put("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
|
||||
message = "";
|
||||
|
||||
//满料位满足联机,有货,有工单时向MES申请任务
|
||||
if (mode == 1 && move == 1 && order > 0 && !requireSucess) {
|
||||
if (mode == 1 && move == 1 && order > 0 && full_number > 0 && !requireSucess) {
|
||||
boolean flag = apply_task();
|
||||
this.noApplyTaskMessage = null;
|
||||
if (flag) {
|
||||
@@ -204,7 +204,7 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
|
||||
|
||||
//agv到达取货位
|
||||
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取货就绪
|
||||
this.writing("to_agv_ready", "1");
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
|
||||
@@ -223,9 +223,6 @@ public class HailiangOldSpecialFullStationDeviceDriver extends AbstractOpcDevice
|
||||
if (move == 0) {
|
||||
notFeedAgvMessage += "光电信号无货,";
|
||||
}
|
||||
if (full_number == 0) {
|
||||
notFeedAgvMessage += "满框数量为0,";
|
||||
}
|
||||
if (inst == null) {
|
||||
notFeedAgvMessage += "AGV指令为空,";
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -141,7 +142,9 @@ public class HailiangOldSpecialPourStationDeviceDriver extends AbstractOpcDevice
|
||||
|
||||
if (storage_stock_num != last_storage_stock_num) {
|
||||
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) {
|
||||
requireSucess = false;
|
||||
|
||||
@@ -643,6 +643,7 @@ public class HailiangPackerStationDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
map.put("to_order_compel_finished", "1");
|
||||
map.put("to_confirm_finished", "1");
|
||||
} else {
|
||||
map.put("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -299,6 +299,7 @@ public class HailiangSpecialDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
map.put("to_order_compel_finished", "1");
|
||||
map.put("to_confirm_finished", "1");
|
||||
} else {
|
||||
map.put("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
message = "";
|
||||
|
||||
//工作模式联机、满料位有货、工单号大于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();
|
||||
this.noApplyTaskMessage = null;
|
||||
if (flag) {
|
||||
@@ -206,7 +206,7 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
|
||||
//agv到达取货点
|
||||
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取货就绪
|
||||
this.writing("to_agv_ready", "1");
|
||||
inst.setExecute_status(InstActionEnum.EXECUTE_TO_GET.getCode());
|
||||
@@ -225,9 +225,6 @@ public class HailiangSpecialFullStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
if (move == 0) {
|
||||
notFeedAgvMessage += "光电信号无货,";
|
||||
}
|
||||
if (full_number == 0) {
|
||||
notFeedAgvMessage += "满框数量为0,";
|
||||
}
|
||||
if (inst == null) {
|
||||
notFeedAgvMessage += "AGV指令为空,";
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -142,7 +143,9 @@ public class HailiangSpecialPourStationDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
if (storage_stock_num != last_storage_stock_num) {
|
||||
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) {
|
||||
requireSucess = false;
|
||||
|
||||
@@ -418,6 +418,7 @@ public class HailiangStackingStationDriver extends AbstractOpcDeviceDriver imple
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
map.put("to_compel_finish", "1");
|
||||
map.put("to_confirm_finished", "1");
|
||||
} else {
|
||||
map.put("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -210,6 +210,7 @@ public class UnboxingMachineDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
public void issuedOrderFinish(String autoFinish) {
|
||||
if (StrUtil.equals(autoFinish, WorkerOrderEnum.FORCEFINISH.getCode())) {
|
||||
this.writing("to_order_compel_finished", "1");
|
||||
this.writing("to_confirm_finished", "1");
|
||||
} else {
|
||||
this.writing("to_confirm_finished", "1");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface AcsToWmsService {
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
HttpResponse feedDeviceNum(Map<String, Integer> map);
|
||||
HttpResponse feedDeviceNum(Map<String, Map<String,Integer>> map);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
result = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.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) {
|
||||
log.error("acs向mes反馈工单状态失败,请求路径:{},请求参数:{},失败原因:{}", url, JSON.toJSONString(param), e.getMessage());
|
||||
}
|
||||
@@ -148,10 +148,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
@Override
|
||||
public HttpResponse feedOrderRealQty(JSONObject param) {
|
||||
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
log.info("acs开始向mes反馈当前设备工单生产数量,请求参数:{}", JSON.toJSONString(param));
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("feedOrderRealQty");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
@@ -175,11 +175,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedDeviceNum(Map<String, Integer> map) {
|
||||
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
|
||||
public HttpResponse feedDeviceNum(Map<String, Map<String, Integer>> map) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
log.info("acs开始向mes反馈设备数量,请求参数:{}", JSON.toJSONString(map));
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("feedDeviceNum");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
|
||||
@@ -520,6 +520,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
|
||||
if (ObjectUtil.isNotEmpty(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());
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.add(feed_jo);
|
||||
|
||||
Reference in New Issue
Block a user