修改信号读取
This commit is contained in:
@@ -90,10 +90,12 @@ public class ScheduleThread {
|
||||
for (DeviceSsj deviceSsj : deviceSsjs) {
|
||||
ssjList.put(deviceSsj.getDeviceCode(), deviceSsj);
|
||||
}
|
||||
|
||||
|
||||
String ipAddress = deviceSsjs.get(0).getIpAddress();
|
||||
String[] split = ipAddress.split(":");
|
||||
String ip = split[0];
|
||||
int port = Convert.toInt(split[1]);
|
||||
//plc输送机读取线程
|
||||
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo(deviceSsjs.get(0).getIpAddress(), Convert.toInt(deviceSsjs.get(0).getPort())));
|
||||
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo(ip, port));
|
||||
Thread plcSsjReadThread = new Thread(plcSsjRead);
|
||||
plcSsjReadCustomThread = new CustomThread<PlcSsjRead>(plcSsjReadThread, plcSsjRead);
|
||||
|
||||
@@ -167,12 +169,14 @@ public class ScheduleThread {
|
||||
*/
|
||||
public void stopAllThread() {
|
||||
plcSsjReadCustomThread.runnable.isRun = false;
|
||||
plcSsjReadCustomThread.thread.interrupt();
|
||||
plcDdj1ReadCustomThread.runnable.isRun = false;
|
||||
/* plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj1ReadCustomThread.thread.interrupt();
|
||||
plcDdj2ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj3ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj4ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj5ReadCustomThread.runnable.isRun = false;
|
||||
plcDdj6ReadCustomThread.runnable.isRun = false;*/
|
||||
plcDdj6ReadCustomThread.runnable.isRun = false;
|
||||
plcReadInit();
|
||||
isRun = false;
|
||||
}
|
||||
@@ -182,7 +186,9 @@ public class ScheduleThread {
|
||||
*/
|
||||
public void stopAllThread2() {
|
||||
monitoringCustomThread.runnable.isRun = false;
|
||||
monitoringCustomThread.thread.interrupt();
|
||||
ddj1CustomThread.runnable.isRun = false;
|
||||
ddj1CustomThread.thread.interrupt();
|
||||
/*ddj2CustomThread.runnable.isRun = false;
|
||||
ddj3CustomThread.runnable.isRun = false;
|
||||
ddj4CustomThread.runnable.isRun = false;
|
||||
|
||||
@@ -55,7 +55,6 @@ public class PlcDdjRead extends Thread {
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.info("********IP:" + this.ip + " port:" + this.port + "端口号 " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PlcSsjRead implements Runnable {
|
||||
for (String ssjCode : deviceSsjMap.keySet()) {
|
||||
DeviceSsj ssjDevice = deviceSsjMap.get(ssjCode);
|
||||
switch (ssjDevice.getType()) {
|
||||
case "1":
|
||||
/*case "1":
|
||||
readPlcLineSsj(ssjDevice);
|
||||
break;
|
||||
case "2":
|
||||
@@ -62,7 +62,7 @@ public class PlcSsjRead implements Runnable {
|
||||
break;
|
||||
case "3":
|
||||
readPlcOtherSsj(ssjDevice);
|
||||
break;
|
||||
break;*/
|
||||
case "4":
|
||||
readPlcRoadWaySsj(ssjDevice);
|
||||
break;
|
||||
@@ -109,10 +109,15 @@ public class PlcSsjRead implements Runnable {
|
||||
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.setDw(ParseUtil.optInt(0, ddsx1));
|
||||
ssjDevice.setKx(ParseUtil.optInt(2, ddsx1));
|
||||
ssjDevice.setTaskNo(ParseUtil.optDInt(4, ddsx1));
|
||||
ssjDevice.setSbzt(ParseUtil.optInt(8, ddsx1));
|
||||
ssjDevice.setRkqq(ParseUtil.optInt(10, ddsx1));
|
||||
ssjDevice.setHeight(ParseUtil.optInt(12, ddsx1));
|
||||
ssjDevice.setException(ParseUtil.optInt(14, ddsx1));
|
||||
ssjDevice.setJxdw(ParseUtil.optInt(16, ddsx1));
|
||||
ssjDevice.setSpare1(ParseUtil.optInt(18, ddsx1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
public boolean isRun = true;
|
||||
|
||||
@Override
|
||||
public abstract HashMap<String, Object> getParamMap(String trayCode);
|
||||
public abstract HashMap<String, Object> getParamMap(String trayCode,Integer height);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -168,7 +168,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
MydoJob inJob = null;
|
||||
if (CollUtil.isEmpty(mydoJobs)) {
|
||||
//请求wms获取任务 并生成队列
|
||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(getParamMap(ddj.getTrayCode()));
|
||||
AjaxResult result = apiService.selectMydoJobByTrayCodeAndEntranceId(getParamMap(ddj.getTrayCode(),ddj.getHeight()));
|
||||
if (result.isSuccess()) {
|
||||
inJob = BeanUtil.toBean(result.get("data"), MydoJob.class);
|
||||
inJob.setStatus(TASK_STATUS_CREATE);
|
||||
@@ -255,7 +255,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
private void generateInBoundPickQueue(MsgDdj ddj) {
|
||||
List<DeviceSsj> roadSsjList = ssjList.get("roadSsjList");
|
||||
for (DeviceSsj ssj : roadSsjList) {
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0) {
|
||||
if (ssj.getDw() == 1 && ssj.getTaskNo() > 0 && ssj.getHeight() > 0 && ssj.getRkqq()==1) {
|
||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(ssj.getTaskNo()), ddj.getId());
|
||||
if (ObjUtil.isNull(ddjQueue)) {
|
||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||
@@ -276,6 +276,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
ddjDeviceExecutionQueue.setScsj(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
ddjDeviceExecutionQueue.setMlfs(3);
|
||||
ddjDeviceExecutionQueue.setSpare1("0");
|
||||
ddjDeviceExecutionQueue.setSpare2(Convert.toStr(ssj.getHeight()));
|
||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||
}
|
||||
}
|
||||
@@ -298,6 +299,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
if (ObjUtil.isNotNull(mydoJob)){
|
||||
//回传完成信号
|
||||
ddjTaskFinish(rwh, ddj.getId(),1);
|
||||
ddj.setHeight(Convert.toInt(ddjDeviceExecutionQueue.getSpare2()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,6 +312,7 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
||||
if (ddjDeviceExecutionQueue.getRwlx()==1){
|
||||
//完成队列
|
||||
ddjTaskFinish(rwh, ddj.getId(),2);
|
||||
ddj.setHeight(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface DdjThreadInterface {
|
||||
* @param trayCode 托盘代码
|
||||
* @return 参数映射
|
||||
*/
|
||||
HashMap<String, Object> getParamMap(String trayCode);
|
||||
HashMap<String, Object> getParamMap(String trayCode,Integer height);
|
||||
|
||||
/**
|
||||
* 获取出库任务参数
|
||||
|
||||
@@ -19,6 +19,9 @@ import static com.ruoyi.common.Constant.WAREHOUSE_01;
|
||||
@Slf4j
|
||||
public class Ddj1Thread extends BaseDdjThread {
|
||||
|
||||
public volatile boolean isRun = true;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
@@ -57,7 +60,7 @@ public class Ddj1Thread extends BaseDdjThread {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_01);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Ddj2Thread extends BaseDdjThread {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_01);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Ddj3Thread extends BaseDdjThread {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_01);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Ddj4Thread extends BaseDdjThread {
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_02);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Ddj5Thread extends BaseDdjThread {
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_02);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Ddj6Thread extends BaseDdjThread {
|
||||
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getParamMap(String trayCode) {
|
||||
public HashMap<String, Object> getParamMap(String trayCode,Integer height) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("trayCode", trayCode);
|
||||
paramMap.put("warehouseId",WAREHOUSE_02);
|
||||
|
||||
Reference in New Issue
Block a user