输送机读取数据初始化
This commit is contained in:
@@ -111,7 +111,13 @@ public class ScheduleThread {
|
|||||||
ConcurrentHashMap<String, MsgDdj> ddjList = new ConcurrentHashMap<>();
|
ConcurrentHashMap<String, MsgDdj> ddjList = new ConcurrentHashMap<>();
|
||||||
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
|
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
|
||||||
for (MsgDdj msgDdj : msgDdjs) {
|
for (MsgDdj msgDdj : msgDdjs) {
|
||||||
ddjList.put("ddj"+msgDdj.getId(), msgDdj);
|
switch (msgDdj.getId()){
|
||||||
|
case 1:
|
||||||
|
msgDdj.setPlcDbReadAddress("DB40.0");
|
||||||
|
case 2:
|
||||||
|
msgDdj.setPlcDbReadAddress("DB41.0");
|
||||||
|
}
|
||||||
|
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
|
||||||
}
|
}
|
||||||
PlcDdjRead plcDdjRead = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
PlcDdjRead plcDdjRead = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||||
Thread plcDdjReadThread = new Thread(plcDdjRead);
|
Thread plcDdjReadThread = new Thread(plcDdjRead);
|
||||||
|
|||||||
@@ -52,16 +52,16 @@ public class PlcSsjRead implements Runnable {
|
|||||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||||
switch (ssjDevice.getType()) {
|
switch (ssjDevice.getType()) {
|
||||||
case "1":
|
case "1":
|
||||||
readPlcOutSsj(ssjDevice);
|
readPlcLineSsj(ssjDevice);
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
readPlcPickSsj(ssjDevice);
|
readPlcInOutSsj(ssjDevice);
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
readPlcInSsj(ssjDevice);
|
readPlcOtherSsj(ssjDevice);
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
readPlcOtherSsj(ssjDevice);
|
readPlcRoadWaySsj(ssjDevice);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,9 +92,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||||
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
||||||
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||||
ssjDevice.setTrayCode(ParseUtil.optString(10, ddsx1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
*
|
*
|
||||||
* @param ssjDevice
|
* @param ssjDevice
|
||||||
*/
|
*/
|
||||||
private void readPlcInSsj(DeviceSsj ssjDevice) {
|
private void readPlcRoadWaySsj(DeviceSsj ssjDevice) {
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
||||||
String ddsx1 = "0";
|
String ddsx1 = "0";
|
||||||
if (read2.IsSuccess) {
|
if (read2.IsSuccess) {
|
||||||
@@ -112,7 +110,6 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
||||||
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||||
ssjDevice.setTrayCode(ParseUtil.optString(12, ddsx1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,16 +118,15 @@ public class PlcSsjRead implements Runnable {
|
|||||||
*
|
*
|
||||||
* @param ssjDevice
|
* @param ssjDevice
|
||||||
*/
|
*/
|
||||||
private void readPlcPickSsj(DeviceSsj ssjDevice) {
|
private void readPlcInOutSsj(DeviceSsj ssjDevice) {
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
||||||
String ddsx1 = "0";
|
String ddsx1 = "0";
|
||||||
if (read2.IsSuccess) {
|
if (read2.IsSuccess) {
|
||||||
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
ddsx1 = SoftBasic.ByteToHexString(read2.Content);
|
||||||
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
ssjDevice.setKx(ParseUtil.optInt(0, ddsx1));
|
||||||
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
ssjDevice.setDw(ParseUtil.optInt(2, ddsx1));
|
||||||
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||||
ssjDevice.setTrayCode(ParseUtil.optString(10, ddsx1));
|
ssjDevice.setException(ParseUtil.optInt(8, ddsx1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +135,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
*
|
*
|
||||||
* @param ssjDevice
|
* @param ssjDevice
|
||||||
*/
|
*/
|
||||||
private void readPlcOutSsj(DeviceSsj ssjDevice) {
|
private void readPlcLineSsj(DeviceSsj ssjDevice) {
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("20"));
|
||||||
String ddsx1 = "0";
|
String ddsx1 = "0";
|
||||||
if (read2.IsSuccess) {
|
if (read2.IsSuccess) {
|
||||||
@@ -149,6 +145,7 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
ssjDevice.setRkqq(ParseUtil.optInt(4, ddsx1));
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
ssjDevice.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
||||||
ssjDevice.setTrayCode(ParseUtil.optString(10, ddsx1));
|
ssjDevice.setTrayCode(ParseUtil.optString(10, ddsx1));
|
||||||
|
ssjDevice.setTraySize(ParseUtil.optInt(14, ddsx1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,9 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="sbzt != null">sbzt = #{sbzt},</if>
|
<if test="sbzt != null">sbzt = #{sbzt},</if>
|
||||||
<if test="czfs != null">czfs = #{czfs},</if>
|
<if test="czfs != null">czfs = #{czfs},</if>
|
||||||
<if test="yxxf != null">yxxf = #{yxxf},</if>
|
<if test="yxxf != null">yxxf = #{yxxf},</if>
|
||||||
<if test="yph != null">yp = #{yph},</if>
|
<if test="yph != null">yph = #{yph},</if>
|
||||||
<if test="ylh != null">yl = #{ylh},</if>
|
<if test="ylh != null">ylh = #{ylh},</if>
|
||||||
<if test="ych != null">yc = #{ych},</if>
|
<if test="ych != null">ych = #{ych},</if>
|
||||||
<if test="mbph != null">mbp = #{mbph},</if>
|
<if test="mbph != null">mbp = #{mbph},</if>
|
||||||
<if test="mblh != null">mbl = #{mblh},</if>
|
<if test="mblh != null">mbl = #{mblh},</if>
|
||||||
<if test="mbch != null">mbc = #{mbch},</if>
|
<if test="mbch != null">mbc = #{mbch},</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user