调度代码修改
This commit is contained in:
@@ -109,31 +109,31 @@ public class ScheduleThread {
|
||||
break;
|
||||
case 2:
|
||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||
PlcDdjRead plcDdjRead2 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.2", 102));
|
||||
Thread plcDdjReadThread2 = new Thread(plcDdjRead2);
|
||||
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead2);
|
||||
break;
|
||||
case 3:
|
||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||
PlcDdjRead plcDdjRead3 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||
PlcDdjRead plcDdjRead3 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.3", 102));
|
||||
Thread plcDdjReadThread3 = new Thread(plcDdjRead3);
|
||||
plcDdj3ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread3, plcDdjRead3);
|
||||
break;
|
||||
case 4:
|
||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||
PlcDdjRead plcDdjRead4 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||
PlcDdjRead plcDdjRead4 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.4", 102));
|
||||
Thread plcDdjReadThread4 = new Thread(plcDdjRead4);
|
||||
plcDdj4ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread4, plcDdjRead4);
|
||||
break;
|
||||
case 5:
|
||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||
PlcDdjRead plcDdjRead5 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||
PlcDdjRead plcDdjRead5 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.5", 102));
|
||||
Thread plcDdjReadThread5 = new Thread(plcDdjRead5);
|
||||
plcDdj5ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread5, plcDdjRead5);
|
||||
break;
|
||||
case 6:
|
||||
msgDdj.setPlcDbReadAddress("DB42.0");
|
||||
PlcDdjRead plcDdjRead6 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.1", 102));
|
||||
PlcDdjRead plcDdjRead6 = new PlcDdjRead(ddjList, new PlcConnectInfo("127.0.0.6", 102));
|
||||
Thread plcDdjReadThread6 = new Thread(plcDdjRead6);
|
||||
plcDdj6ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread6, plcDdjRead6);
|
||||
break;
|
||||
@@ -148,11 +148,11 @@ public class ScheduleThread {
|
||||
public void startAllThread() {
|
||||
plcSsjReadCustomThread.getThread().start();
|
||||
plcDdj1ReadCustomThread.getThread().start();
|
||||
/*plcDdj2ReadCustomThread.getThread().start();
|
||||
plcDdj2ReadCustomThread.getThread().start();
|
||||
plcDdj3ReadCustomThread.getThread().start();
|
||||
plcDdj4ReadCustomThread.getThread().start();
|
||||
plcDdj5ReadCustomThread.getThread().start();
|
||||
plcDdj6ReadCustomThread.getThread().start();*/
|
||||
plcDdj6ReadCustomThread.getThread().start();
|
||||
isRun = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class PlcDdjRead extends Thread {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣 " + e.getMessage());
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -96,9 +96,9 @@ public class PlcDdjRead extends Thread {
|
||||
siemensS7Net.setPort(this.port);
|
||||
siemensS7Net.setRack((byte) 0);
|
||||
siemensS7Net.setSlot((byte) 1);
|
||||
|
||||
OperateResult connect = siemensS7Net.ConnectServer();
|
||||
if (connect.IsSuccess) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "连接成功 ");
|
||||
setIsConnect(true);
|
||||
readWriteNet = siemensS7Net;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class PlcDdjRead extends Thread {
|
||||
void reConnect() {
|
||||
closeServer();
|
||||
ConnectServer();
|
||||
log.info("重新连接 SSJ-PLC");
|
||||
log.info("重新连接 Ddj-PLC");
|
||||
}
|
||||
|
||||
void closeServer() {
|
||||
|
||||
@@ -28,8 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.TaskStatusCode.*;
|
||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_2;
|
||||
import static com.ruoyi.common.TaskType.DDJ_RWLX_3;
|
||||
import static com.ruoyi.common.TaskType.*;
|
||||
|
||||
@Slf4j
|
||||
public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
@@ -272,7 +271,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
||||
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||
ddjDeviceExecutionQueue.setRwlx(1);
|
||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_1);
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
ddjDeviceExecutionQueue.setMlfs(3);
|
||||
ddjDeviceExecutionQueue.setSpare1("0");
|
||||
@@ -293,10 +292,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
//完成作业
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
||||
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
||||
//完成队列
|
||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
||||
}else {
|
||||
if (ddjDeviceExecutionQueue.getRwlx()==2 || ddjDeviceExecutionQueue.getRwlx()==3 ){
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||
if (ObjUtil.isNotNull(mydoJob)){
|
||||
//回传完成信号
|
||||
@@ -305,6 +301,17 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 3 && ddj.getJdbz() == 5) {
|
||||
Long rwh = ddj.getRwh();
|
||||
//完成作业
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||
if (ObjUtil.isNotNull(ddjDeviceExecutionQueue)){
|
||||
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
||||
//完成队列
|
||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
第二部分
|
||||
@@ -392,6 +399,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
}
|
||||
//正常下发
|
||||
if (ddj.getYxxf() == 1 && ddj.getCzfs() == 5) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionRunningQueueParam = new DdjDeviceExecutionQueue();
|
||||
ddjDeviceExecutionRunningQueueParam.setDdjxf("1");
|
||||
List<DdjDeviceExecutionQueue> ddjDeviceExecutionQueues1 = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueList(ddjDeviceExecutionRunningQueueParam);
|
||||
if (CollUtil.isNotEmpty(ddjDeviceExecutionQueues1)){
|
||||
log.info("正在执行任务 {}", ddjDeviceExecutionQueues1.get(0).getRwh());
|
||||
return;
|
||||
}
|
||||
|
||||
if (ddj.getSbzt() == 0) {
|
||||
//无货待机 只查询入库取货扫码或者出库队列
|
||||
ArrayList<Integer> rwlxList = new ArrayList<>();
|
||||
|
||||
@@ -4,27 +4,23 @@ import com.ruoyi.job.domain.MydoJob;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 堆垛机线程接口
|
||||
* 定义堆垛机线程必须实现的方法
|
||||
*/
|
||||
public interface DdjThreadInterface {
|
||||
|
||||
|
||||
/**
|
||||
* 获取参数映射
|
||||
* @param trayCode 托盘代码
|
||||
* @return 参数映射
|
||||
*/
|
||||
HashMap<String, Object> getParamMap(String trayCode);
|
||||
|
||||
|
||||
/**
|
||||
* 获取出库任务参数
|
||||
* @return 出库任务参数
|
||||
*/
|
||||
MydoJob getOutJobParam();
|
||||
|
||||
|
||||
/**
|
||||
* 初始化设备
|
||||
*/
|
||||
void init();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user