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