调度修改
This commit is contained in:
@@ -30,7 +30,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class ScheduleThread {
|
public class ScheduleThread {
|
||||||
|
|
||||||
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
|
public CustomThread<PlcSsjRead> plcSsjReadCustomThread;
|
||||||
public CustomThread<PlcDdjRead> plcDdjReadCustomThread;
|
public CustomThread<PlcDdjRead> plcDdj1ReadCustomThread;
|
||||||
|
public CustomThread<PlcDdjRead> plcDdj2ReadCustomThread;
|
||||||
|
|
||||||
public CustomThread<Floor1BothWayInSsjThread> floor1BothWayInSsjCustomThread;
|
public CustomThread<Floor1BothWayInSsjThread> floor1BothWayInSsjCustomThread;
|
||||||
public CustomThread<Floor1BothWayOutSsjThread> floor1BothWayOutSsjCustomThread;
|
public CustomThread<Floor1BothWayOutSsjThread> floor1BothWayOutSsjCustomThread;
|
||||||
@@ -102,28 +103,27 @@ public class ScheduleThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//plc输送机读取线程
|
|
||||||
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo("127.0.0.1", 102));
|
|
||||||
Thread plcSsjReadThread = new Thread(plcSsjRead);
|
|
||||||
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
|
|
||||||
|
|
||||||
//plc堆垛机读取现场
|
|
||||||
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) {
|
||||||
switch (msgDdj.getId()){
|
switch (msgDdj.getId()){
|
||||||
case 1:
|
case 1:
|
||||||
msgDdj.setPlcDbReadAddress("DB41.0");
|
msgDdj.setPlcDbReadAddress("DB41.0");
|
||||||
|
PlcDdjRead plcDdjRead1 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||||
|
Thread plcDdjReadThread1 = new Thread(plcDdjRead1);
|
||||||
|
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread1, plcDdjRead1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||||
|
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.2", 102));
|
||||||
|
Thread plcDdjReadThread2 = new Thread(plcDdjRead2);
|
||||||
|
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
|
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
|
||||||
}
|
}
|
||||||
PlcDdjRead plcDdjRead = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
|
||||||
Thread plcDdjReadThread = new Thread(plcDdjRead);
|
|
||||||
plcDdjReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread, plcDdjRead);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,8 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void startAllThread() {
|
public void startAllThread() {
|
||||||
plcSsjReadCustomThread.getThread().start();
|
plcSsjReadCustomThread.getThread().start();
|
||||||
plcDdjReadCustomThread.getThread().start();
|
plcDdj1ReadCustomThread.getThread().start();
|
||||||
|
plcDdj2ReadCustomThread.getThread().start();
|
||||||
isRun = true;
|
isRun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +157,8 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void stopAllThread() {
|
public void stopAllThread() {
|
||||||
plcSsjReadCustomThread.runnable.isRun = false;
|
plcSsjReadCustomThread.runnable.isRun = false;
|
||||||
plcDdjReadCustomThread.runnable.isRun = false;
|
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||||
|
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||||
plcReadInit();
|
plcReadInit();
|
||||||
isRun = false;
|
isRun = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,15 @@ public class Ddj1Thread implements Runnable {
|
|||||||
//正常下发
|
//正常下发
|
||||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0) {
|
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5 && ddj.getSbzt() == 0) {
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueueRunningParam = new DdjDeviceExecutionQueue();
|
||||||
|
ddjDeviceExecutionQueueRunningParam.setDdjxf("1");
|
||||||
|
ddjDeviceExecutionQueueRunningParam.setDevId(ddj.getId());
|
||||||
|
List<DdjDeviceExecutionQueue> ddjDeviceExecutionRunningQueues = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionQueueRunningParam);
|
||||||
|
if (CollUtil.isNotEmpty(ddjDeviceExecutionRunningQueues)) {
|
||||||
|
log.error("堆垛机有正在执行的任务 {}" , ddjDeviceExecutionRunningQueues.get(0).getRwh());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//对堆垛机执行队列中无已下发队列
|
//对堆垛机执行队列中无已下发队列
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueueParam = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueueParam = new DdjDeviceExecutionQueue();
|
||||||
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
ddjDeviceExecutionQueueParam.setDdjxf("0");
|
||||||
|
|||||||
Reference in New Issue
Block a user