堆垛机信号读取
This commit is contained in:
@@ -3,9 +3,10 @@ package com.ruoyi.schedule;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.device.ssj.service.IDeviceSsjService;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.CustomThread;
|
||||
import com.ruoyi.common.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.common.domain.CustomThread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.Ddj1Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.ddj.Ddj2Thread;
|
||||
import com.ruoyi.schedule.scheduleTask.ssj.floor1.Floor1SsjInOutThread;
|
||||
@@ -25,7 +26,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Slf4j
|
||||
public class ScheduleThread {
|
||||
|
||||
public CustomThread<PlcRead> customThread;
|
||||
public CustomThread<PlcSsjRead> customSsjThread;
|
||||
public CustomThread<PlcDdjRead> customDdjThread;
|
||||
@Autowired
|
||||
private IDeviceSsjService deviceSsjService;
|
||||
|
||||
@@ -88,19 +90,25 @@ public class ScheduleThread {
|
||||
list.put(deviceSsj.getDeviceCode(), deviceSsj);
|
||||
}
|
||||
|
||||
ConcurrentHashMap<String, MsgDdj> list2 = new ConcurrentHashMap<>();
|
||||
|
||||
//plc读取线程
|
||||
PlcRead plcRead = new PlcRead(list,list2, ssjPlcConnectInfo);
|
||||
Thread plcReadThread = new Thread(plcRead);
|
||||
customThread = new CustomThread<PlcRead>(plcReadThread, plcRead);
|
||||
//plc输送机读取线程
|
||||
PlcSsjRead plcSsjRead = new PlcSsjRead(list, ssjPlcConnectInfo);
|
||||
Thread plcSsjReadThread = new Thread(plcSsjRead);
|
||||
customSsjThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
|
||||
//plc堆垛机读取现场
|
||||
ConcurrentHashMap<String, MsgDdj> list2 = new ConcurrentHashMap<>();
|
||||
PlcDdjRead plcDdjRead = new PlcDdjRead(list2, ssjPlcConnectInfo);
|
||||
Thread plcDdjReadThread = new Thread(plcDdjRead);
|
||||
customDdjThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始线程
|
||||
*/
|
||||
public void startAllThread() {
|
||||
customThread.getThread().start();
|
||||
customSsjThread.getThread().start();
|
||||
customDdjThread.getThread().start();
|
||||
isRun = true;
|
||||
}
|
||||
|
||||
@@ -131,7 +139,8 @@ public class ScheduleThread {
|
||||
* 停止线程
|
||||
*/
|
||||
public void stopAllThread() {
|
||||
customThread.runnable.isRun = false;
|
||||
customDdjThread.runnable.isRun = false;
|
||||
customSsjThread.runnable.isRun = false;
|
||||
plcReadInit();
|
||||
isRun = false;
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.ruoyi.schedule.plcRead.ddj;
|
||||
|
||||
public class IsoTcpClientDDJ1 extends Thread {
|
||||
|
||||
|
||||
/// <20>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
|
||||
public static int WritetoDDJ(String address, byte[] tsak) {
|
||||
/*int a = 0;
|
||||
if (readWriteNet != null) {
|
||||
a = HslRead.WriteResultRender(readWriteNet.Write(address, tsak), address);
|
||||
}
|
||||
return a;*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.ruoyi.schedule.plcRead.ddj;
|
||||
|
||||
import HslCommunication.BasicFramework.SoftBasic;
|
||||
import HslCommunication.Core.Net.IReadWriteNet;
|
||||
import HslCommunication.Core.Types.OperateResult;
|
||||
import HslCommunication.Core.Types.OperateResultExOne;
|
||||
import HslCommunication.Profinet.Siemens.SiemensPLCS;
|
||||
import HslCommunication.Profinet.Siemens.SiemensS7Net;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.ruoyi.common.domain.HslRead;
|
||||
import com.ruoyi.common.domain.PlcConnectInfo;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.util.ParseUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
public class PlcDdjRead extends Thread {
|
||||
public static ConcurrentHashMap<String, MsgDdj> deviceDdjMap;
|
||||
public volatile boolean isRun = true;
|
||||
|
||||
public SiemensS7Net siemensS7Net = null;
|
||||
public static IReadWriteNet readWriteNet = null;
|
||||
private String ip;
|
||||
private int port;
|
||||
private boolean success = false;
|
||||
|
||||
public PlcDdjRead(ConcurrentHashMap<String, MsgDdj> deviceDdjMap, PlcConnectInfo plcConnectInfo) {
|
||||
this.deviceDdjMap = deviceDdjMap;
|
||||
this.ip = plcConnectInfo.getIp();
|
||||
this.port = plcConnectInfo.getPort();
|
||||
}
|
||||
|
||||
public static int WriteToSSJ(String address, byte[] data) {
|
||||
int a = 0;
|
||||
if (readWriteNet != null) {
|
||||
a = HslRead.WriteResultRender(readWriteNet.Write(address, data), address);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (isRun) {
|
||||
try {
|
||||
if (IsConnect()) {
|
||||
for (String key : deviceDdjMap.keySet()) {
|
||||
MsgDdj msgDdj = deviceDdjMap.get(key);
|
||||
if (msgDdj != null) {
|
||||
readPlcDdj(msgDdj);
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
} else {
|
||||
reConnect();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6>쳣<EFBFBD><ECB3A3><EFBFBD>˳<EFBFBD>ѭ<EFBFBD><D1AD>
|
||||
Thread.currentThread().interrupt(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>־
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣 " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void readPlcDdj(MsgDdj msgDdj) {
|
||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(msgDdj.getPlcDbReadAddress(), Convert.toShort("38"));
|
||||
String ddsx = "0";
|
||||
if (read2.IsSuccess) {
|
||||
ddsx = SoftBasic.ByteToHexString(read2.Content);
|
||||
msgDdj.setCzfs(ParseUtil.optInt(0, ddsx));
|
||||
msgDdj.setSbzt(ParseUtil.optInt(2, ddsx));
|
||||
msgDdj.setRwh(Convert.toLong(ParseUtil.optDInt(4, ddsx)));
|
||||
msgDdj.setHczt(ParseUtil.optInt(8, ddsx));
|
||||
msgDdj.setJdbz(ParseUtil.optInt(10, ddsx));
|
||||
msgDdj.setYph(ParseUtil.optInt(12, ddsx));
|
||||
msgDdj.setYlh(ParseUtil.optInt(14, ddsx));
|
||||
msgDdj.setYch(ParseUtil.optInt(16, ddsx));
|
||||
msgDdj.setMbph(ParseUtil.optInt(18, ddsx));
|
||||
msgDdj.setMblh(ParseUtil.optInt(20, ddsx));
|
||||
msgDdj.setMbch(ParseUtil.optInt(22, ddsx));
|
||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConnectServer() {
|
||||
siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500);
|
||||
try {
|
||||
siemensS7Net.setIpAddress(this.ip);
|
||||
siemensS7Net.setPort(this.port);
|
||||
siemensS7Net.setRack((byte) 0);
|
||||
siemensS7Net.setSlot((byte) 1);
|
||||
|
||||
OperateResult connect = siemensS7Net.ConnectServer();
|
||||
if (connect.IsSuccess) {
|
||||
setIsConnect(true);
|
||||
readWriteNet = siemensS7Net;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD> " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setIsConnect(boolean bflag) {
|
||||
if (!success) {
|
||||
success = bflag;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean IsConnect() {
|
||||
if (success) {
|
||||
return success;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void reConnect() {
|
||||
closeServer();
|
||||
ConnectServer();
|
||||
log.info("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SSJ-PLC");
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
if (readWriteNet != null) {
|
||||
readWriteNet.ConnectClose();
|
||||
}
|
||||
setIsConnect(false);
|
||||
}
|
||||
|
||||
/// <20>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
|
||||
public static int WritetoDDJ(String address, byte[] tsak) {
|
||||
/*int a = 0;
|
||||
if (readWriteNet != null) {
|
||||
a = HslRead.WriteResultRender(readWriteNet.Write(address, tsak), address);
|
||||
}
|
||||
return a;*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,17 @@ import HslCommunication.Profinet.Siemens.SiemensPLCS;
|
||||
import HslCommunication.Profinet.Siemens.SiemensS7Net;
|
||||
import com.ruoyi.device.ddj.domain.MsgDdj;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.HslRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.domain.PlcConnectInfo;
|
||||
import com.ruoyi.common.domain.HslRead;
|
||||
import com.ruoyi.common.domain.PlcConnectInfo;
|
||||
import com.ruoyi.schedule.plcRead.util.ParseUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.Offset;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
public class PlcRead implements Runnable {
|
||||
public class PlcSsjRead implements Runnable {
|
||||
|
||||
public static ConcurrentHashMap<String, DeviceSsj> deviceSsjMap;
|
||||
public static ConcurrentHashMap<String, MsgDdj> deviceDdjMap;
|
||||
public volatile boolean isRun = true;
|
||||
|
||||
public SiemensS7Net siemensS7Net = null;
|
||||
@@ -29,9 +27,8 @@ public class PlcRead implements Runnable {
|
||||
private int port;
|
||||
private boolean success = false;
|
||||
|
||||
public PlcRead(ConcurrentHashMap<String, DeviceSsj> deviceMap1,ConcurrentHashMap<String, MsgDdj> deviceMap2, PlcConnectInfo plcConnectInfo) {
|
||||
this.deviceSsjMap = deviceMap1;
|
||||
this.deviceDdjMap = deviceMap2;
|
||||
public PlcSsjRead(ConcurrentHashMap<String, DeviceSsj> deviceSsjMap, PlcConnectInfo plcConnectInfo) {
|
||||
this.deviceSsjMap = deviceSsjMap;
|
||||
this.ip = plcConnectInfo.getIp();
|
||||
this.port = plcConnectInfo.getPort();
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CustomThread<T> {
|
||||
public Thread thread;
|
||||
public T runnable;
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import HslCommunication.BasicFramework.SoftBasic;
|
||||
import HslCommunication.Core.Net.IReadWriteNet;
|
||||
import HslCommunication.Core.Types.OperateResult;
|
||||
import HslCommunication.Core.Types.OperateResultExOne;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class HslRead {
|
||||
|
||||
private static SimpleDateFormat dateFormat = new SimpleDateFormat("[HH:mm:ss] ");
|
||||
|
||||
/**
|
||||
* 将结果信息显示出来,在界面里进行显示
|
||||
* @param result 等待显示的结果信息
|
||||
* @param x
|
||||
* @param address 读取的地址数据
|
||||
* @param textBox 显示结果的文本框
|
||||
* @param scrollPane 支持滚动条的控件
|
||||
* @param <T> 类型对象
|
||||
* @return
|
||||
* @return
|
||||
* @return
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public static <T> T ReadResultRender(OperateResultExOne<T> result ) {
|
||||
|
||||
T x = null ;
|
||||
if (result.IsSuccess) {
|
||||
if (result.Content.getClass().isArray()) {
|
||||
|
||||
} else {
|
||||
x= (T) result.Content;
|
||||
}
|
||||
} else {
|
||||
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
dateFormat.format(new Date()) + "] Read Failed\r\nReason:" + result.ToMessageShowString(),
|
||||
"Result",
|
||||
JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static int WriteResultRender(OperateResult result, String address ) { //void
|
||||
int x=0;
|
||||
if (result.IsSuccess) {
|
||||
// JOptionPane.showMessageDialog(
|
||||
// null,
|
||||
// dateFormat.format(new Date()) + "[" + address + "] Write Success",
|
||||
// "Result",
|
||||
// JOptionPane.PLAIN_MESSAGE);
|
||||
x=1;
|
||||
} else {
|
||||
// JOptionPane.showMessageDialog(
|
||||
// null,
|
||||
// dateFormat.format(new Date()) + "[" + address + "] Write Failed\r\nReason:" + result.ToMessageShowString(),
|
||||
// "Result",
|
||||
// JOptionPane.WARNING_MESSAGE);
|
||||
x=2;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
public static void BulkReadRenderResult(IReadWriteNet readWrite, JTextField addTextBox, JTextField lengthTextBox, JTextArea resultTextBox ) {
|
||||
try {
|
||||
OperateResultExOne<byte[]> read = readWrite.Read(addTextBox.getText(), Short.parseShort(lengthTextBox.getText()));
|
||||
if (read.IsSuccess) {
|
||||
resultTextBox.setText("Result:" + SoftBasic.ByteToHexString(read.Content));
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "Read Failed:" + read.ToMessageShowString(), "Result", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(null, "Read Failed:" + ex.getMessage(), "Result", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetPanelEnabled(JPanel panel, boolean enable) {
|
||||
Component[] components = panel.getComponents();
|
||||
|
||||
//System.out.println("Component Length:" + components.length);
|
||||
for (Component component : components) {
|
||||
if (component instanceof JPanel) {
|
||||
SetPanelEnabled((JPanel) component, enable);
|
||||
} else {
|
||||
component.setEnabled(enable);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String IpAddressInputWrong = "IpAddress input wrong";
|
||||
public static String PortInputWrong = "Port input wrong";
|
||||
public static String SlotInputWrong = "Slot input wrong";
|
||||
public static String BaudRateInputWrong = "Baud rate input wrong";
|
||||
public static String DataBitsInputWrong = "Data bit input wrong";
|
||||
public static String StopBitInputWrong = "Stop bit input wrong";
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class PlcConnectInfo {
|
||||
|
||||
private String ip;
|
||||
private Integer port;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.ruoyi.schedule.plcRead.ssj.domain;
|
||||
|
||||
/**
|
||||
* 发送数据的实体类
|
||||
* @num 长度
|
||||
* @num2 值
|
||||
*/
|
||||
public class SendData {
|
||||
private static final int DINT = 4;
|
||||
private static final int INT = 2;
|
||||
private int num;
|
||||
private int num2;
|
||||
|
||||
public SendData(int num, int num2) {
|
||||
this.num = num;
|
||||
this.num2 = num2;
|
||||
}
|
||||
|
||||
public SendData(int num, String num2) {
|
||||
this.num = num;
|
||||
this.num2 = Integer.parseInt(num2);
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public int getNum2() {
|
||||
return num2;
|
||||
}
|
||||
|
||||
public void setNum2(int num2) {
|
||||
this.num2 = num2;
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ import com.ruoyi.job.service.IMydoJobService;
|
||||
import com.ruoyi.queue.ddj.domain.DdjDeviceExecutionQueue;
|
||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueFinishService;
|
||||
import com.ruoyi.queue.ddj.service.IDdjDeviceExecutionQueueService;
|
||||
import com.ruoyi.schedule.plcRead.ddj.IsoTcpClientDDJ1;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import com.ruoyi.schedule.plcRead.util.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -48,7 +48,8 @@ public class Ddj1Thread implements Runnable {
|
||||
apiService = SpringUtils.getBean(IApiService.class);
|
||||
ddjDeviceExecutionQueueService = SpringUtils.getBean(IDdjDeviceExecutionQueueService.class);
|
||||
ddjDeviceExecutionQueueFinishService = SpringUtils.getBean(IDdjDeviceExecutionQueueFinishService.class);
|
||||
log.info("初始化服务 {},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService);
|
||||
mydoJobService = SpringUtils.getBean(IMydoJobService.class);
|
||||
log.info("初始化服务 {},{},{},{}", apiService, ddjDeviceExecutionQueueService, ddjDeviceExecutionQueueFinishService,mydoJobService);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,8 +61,8 @@ public class Ddj1Thread implements Runnable {
|
||||
if ("ddj".equals(type)) {
|
||||
for (String ddjCode : ddjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceDdjMap.containsKey(ddjCode)) {
|
||||
ddjTask(PlcRead.deviceDdjMap.get(ddjCode));
|
||||
if (PlcDdjRead.deviceDdjMap.containsKey(ddjCode)) {
|
||||
ddjTask(PlcDdjRead.deviceDdjMap.get(ddjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ddjCode);
|
||||
}
|
||||
@@ -213,7 +214,7 @@ public class Ddj1Thread implements Runnable {
|
||||
* @param rwh 作业单号
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void InvalidMydoJob(Long rwh, Long id) {
|
||||
private void InvalidMydoJob(Long rwh, Integer id) {
|
||||
mydoJobService.InvalidMydoJob(rwh, id);
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ public class Ddj1Thread implements Runnable {
|
||||
* @param rwh 作业单号
|
||||
* @param id 作业单id
|
||||
*/
|
||||
private void ddjTaskFinish(Long rwh, Long id) {
|
||||
private void ddjTaskFinish(Long rwh, Integer id) {
|
||||
mydoJobService.ddjTaskFinish(rwh, id);
|
||||
}
|
||||
|
||||
@@ -233,7 +234,7 @@ public class Ddj1Thread implements Runnable {
|
||||
*
|
||||
* @param queue 堆垛机执行的队列
|
||||
*/
|
||||
private int issuedDDJTask(Long devId, DdjDeviceExecutionQueue queue) {
|
||||
private int issuedDDJTask(Integer devId, DdjDeviceExecutionQueue queue) {
|
||||
int taskNo = Convert.toInt(queue.getRwh());
|
||||
int yph = Convert.toInt(queue.getYph());
|
||||
int ylh = Convert.toInt(queue.getYlh());
|
||||
@@ -246,9 +247,9 @@ public class Ddj1Thread implements Runnable {
|
||||
int jym = Tools.getJYM(taskNo, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc);
|
||||
byte[] sendData = Tools.sendDataToDevice(taskNo, null, yph, ylh, ych, mbph, mblh, mbch, mlfs, xfwc, jym);
|
||||
if (devId==1){
|
||||
return IsoTcpClientDDJ1.WritetoDDJ("DB61.0", sendData);
|
||||
return PlcDdjRead.WritetoDDJ("DB61.0", sendData);
|
||||
}else {
|
||||
return IsoTcpClientDDJ1.WritetoDDJ("DB61.0", sendData);
|
||||
return PlcDdjRead.WritetoDDJ("DB61.0", sendData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -58,8 +58,8 @@ public class Ddj2Thread implements Runnable {
|
||||
//正常入库 尾箱回流 物料入库 空料箱入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -58,8 +58,8 @@ public class Floor1SsjInOutThread implements Runnable {
|
||||
//正常入库 尾箱回流 物料入库 空料箱入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -51,8 +51,8 @@ public class Floor1SsjRoadWayThread implements Runnable {
|
||||
//退料入库 其它入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
@@ -65,8 +65,8 @@ public class Floor1SsjRoadWayThread implements Runnable {
|
||||
case "out":
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
outDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
outDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.ruoyi.job.domain.MydoJob;
|
||||
import com.ruoyi.queue.agv.domain.AgvQueue;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -58,8 +58,8 @@ public class Floor2SsjInOutThread implements Runnable {
|
||||
//正常入库 尾箱回流 物料入库 空料箱入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.ruoyi.api.service.IApiService;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.queue.agv.service.IAgvQueueService;
|
||||
import com.ruoyi.device.ssj.domain.DeviceSsj;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcRead;
|
||||
import com.ruoyi.schedule.plcRead.ssj.PlcSsjRead;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,8 +45,8 @@ public class Floor2SsjRoadWayThread implements Runnable {
|
||||
//生产线入库
|
||||
for (String ssjCode : ssjCodeList.get(type)) {
|
||||
try {
|
||||
if (PlcRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcRead.deviceSsjMap.get(ssjCode));
|
||||
if (PlcSsjRead.deviceSsjMap.containsKey(ssjCode)) {
|
||||
inDispatch(PlcSsjRead.deviceSsjMap.get(ssjCode));
|
||||
} else {
|
||||
log.error("设备不存在 ssjCode{}", ssjCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user