现场调度问题修改
This commit is contained in:
@@ -66,18 +66,35 @@ public class ScheduleThread {
|
|||||||
private void scheduleInit() {
|
private void scheduleInit() {
|
||||||
MonitoringThread monitoringThread = new MonitoringThread();
|
MonitoringThread monitoringThread = new MonitoringThread();
|
||||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||||
Ddj4Thread ddj4Thread = new Ddj4Thread(plcDdj4ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
List<MsgDdj> msgDdjs = msgDdjService.selectMsgDdjList(new MsgDdj());
|
||||||
ddj4CustomThread = new CustomThread<>(new Thread(ddj4Thread), ddj4Thread);
|
for (MsgDdj msgDdj : msgDdjs) {
|
||||||
/*Ddj2Thread ddj2Thread = new Ddj2Thread();
|
if ("0".equals(msgDdj.getSpare1())){
|
||||||
ddj2CustomThread = new CustomThread<>(new Thread(ddj2Thread), ddj2Thread);
|
if (msgDdj.getId() == 1){
|
||||||
Ddj3Thread ddj3Thread = new Ddj3Thread();
|
Ddj1Thread ddjThread = new Ddj1Thread(plcDdj1ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
ddj3CustomThread = new CustomThread<>(new Thread(ddj3Thread), ddj3Thread);
|
ddj1CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
Ddj4Thread ddj4Thread = new Ddj4Thread();
|
}
|
||||||
ddj4CustomThread = new CustomThread<>(new Thread(ddj4Thread), ddj4Thread);
|
if (msgDdj.getId() == 2){
|
||||||
Ddj5Thread ddj5Thread = new Ddj5Thread();
|
Ddj2Thread ddjThread = new Ddj2Thread(plcDdj2ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
ddj5CustomThread = new CustomThread<>(new Thread(ddj5Thread), ddj5Thread);
|
ddj2CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
Ddj6Thread ddj6Thread = new Ddj6Thread();
|
}
|
||||||
ddj6CustomThread = new CustomThread<>(new Thread(ddj6Thread), ddj6Thread);*/
|
if (msgDdj.getId() == 3){
|
||||||
|
Ddj3Thread ddjThread = new Ddj3Thread(plcDdj3ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
|
ddj3CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
|
}
|
||||||
|
if (msgDdj.getId() == 4){
|
||||||
|
Ddj4Thread ddjThread = new Ddj4Thread(plcDdj4ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
|
ddj4CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
|
}
|
||||||
|
if (msgDdj.getId() == 5){
|
||||||
|
Ddj5Thread ddjThread = new Ddj5Thread(plcDdj5ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
|
ddj5CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
|
}
|
||||||
|
if (msgDdj.getId() == 6){
|
||||||
|
Ddj6Thread ddjThread = new Ddj6Thread(plcDdj6ReadCustomThread.runnable,plcSsjReadCustomThread.runnable);
|
||||||
|
ddj6CustomThread = new CustomThread<>(new Thread(ddjThread), ddjThread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,8 +110,8 @@ public class ScheduleThread {
|
|||||||
}
|
}
|
||||||
String ipAddress = deviceSsjs.get(0).getIpAddress();
|
String ipAddress = deviceSsjs.get(0).getIpAddress();
|
||||||
String[] split = ipAddress.split(":");
|
String[] split = ipAddress.split(":");
|
||||||
String ip = "192.168.56.80";
|
String ip = split[0];
|
||||||
int port = 102;
|
int port = Convert.toInt(split[1]);
|
||||||
//plc输送机读取线程
|
//plc输送机读取线程
|
||||||
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo(ip, port));
|
PlcSsjRead plcSsjRead = new PlcSsjRead(ssjList, new PlcConnectInfo(ip, port));
|
||||||
Thread plcSsjReadThread = new Thread(plcSsjRead);
|
Thread plcSsjReadThread = new Thread(plcSsjRead);
|
||||||
@@ -107,33 +124,35 @@ public class ScheduleThread {
|
|||||||
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
|
msgDdj.setPlcDbReadAddress(msgDdj.getPlcDbReadAddress());
|
||||||
msgDdj.setTrayCode(null);
|
msgDdj.setTrayCode(null);
|
||||||
PlcDdjRead plcDdjRead = new PlcDdjRead(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
PlcDdjRead plcDdjRead = new PlcDdjRead(msgDdj, new PlcConnectInfo(msgDdj.getIp(), Convert.toInt(msgDdj.getPort())));
|
||||||
switch (msgDdj.getId()){
|
if ("0".equals(msgDdj.getSpare1())){
|
||||||
case 1:
|
switch (msgDdj.getId()){
|
||||||
Thread plcDdjReadThread1 = new Thread(plcDdjRead);
|
case 1:
|
||||||
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread1, plcDdjRead);
|
Thread plcDdjReadThread1 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj1ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread1, plcDdjRead);
|
||||||
case 2:
|
break;
|
||||||
Thread plcDdjReadThread2 = new Thread(plcDdjRead);
|
case 2:
|
||||||
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead);
|
Thread plcDdjReadThread2 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj2ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread2, plcDdjRead);
|
||||||
case 3:
|
break;
|
||||||
Thread plcDdjReadThread3 = new Thread(plcDdjRead);
|
case 3:
|
||||||
plcDdj3ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread3, plcDdjRead);
|
Thread plcDdjReadThread3 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj3ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread3, plcDdjRead);
|
||||||
case 4:
|
break;
|
||||||
Thread plcDdjReadThread4 = new Thread(plcDdjRead);
|
case 4:
|
||||||
plcDdj4ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread4, plcDdjRead);
|
Thread plcDdjReadThread4 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj4ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread4, plcDdjRead);
|
||||||
case 5:
|
break;
|
||||||
Thread plcDdjReadThread5 = new Thread(plcDdjRead);
|
case 5:
|
||||||
plcDdj5ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread5, plcDdjRead);
|
Thread plcDdjReadThread5 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj5ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread5, plcDdjRead);
|
||||||
case 6:
|
break;
|
||||||
Thread plcDdjReadThread6 = new Thread(plcDdjRead);
|
case 6:
|
||||||
plcDdj6ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread6, plcDdjRead);
|
Thread plcDdjReadThread6 = new Thread(plcDdjRead);
|
||||||
break;
|
plcDdj6ReadCustomThread = new CustomThread<PlcDdjRead>(plcDdjReadThread6, plcDdjRead);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
|
||||||
}
|
}
|
||||||
ddjList.put("ddj" + msgDdj.getId(), msgDdj);
|
|
||||||
}
|
}
|
||||||
PlcDdjRead.deviceDdjMap = ddjList;
|
PlcDdjRead.deviceDdjMap = ddjList;
|
||||||
}
|
}
|
||||||
@@ -143,6 +162,7 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void startAllThread() {
|
public void startAllThread() {
|
||||||
plcSsjReadCustomThread.getThread().start();
|
plcSsjReadCustomThread.getThread().start();
|
||||||
|
plcDdj1ReadCustomThread.getThread().start();
|
||||||
plcDdj4ReadCustomThread.getThread().start();
|
plcDdj4ReadCustomThread.getThread().start();
|
||||||
/*plcDdj2ReadCustomThread.getThread().start();
|
/*plcDdj2ReadCustomThread.getThread().start();
|
||||||
plcDdj3ReadCustomThread.getThread().start();
|
plcDdj3ReadCustomThread.getThread().start();
|
||||||
@@ -157,6 +177,7 @@ public class ScheduleThread {
|
|||||||
*/
|
*/
|
||||||
public void startAllThread2() {
|
public void startAllThread2() {
|
||||||
monitoringCustomThread.thread.start();
|
monitoringCustomThread.thread.start();
|
||||||
|
ddj1CustomThread.thread.start();
|
||||||
ddj4CustomThread.thread.start();
|
ddj4CustomThread.thread.start();
|
||||||
/*ddj2CustomThread.thread.start();
|
/*ddj2CustomThread.thread.start();
|
||||||
ddj3CustomThread.thread.start();
|
ddj3CustomThread.thread.start();
|
||||||
|
|||||||
@@ -73,9 +73,15 @@ public class PlcDdjRead extends Thread {
|
|||||||
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
msgDdj.setYxxf(ParseUtil.optInt(24, ddsx));
|
||||||
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
msgDdj.setXtxh(ParseUtil.optInt(26, ddsx));
|
||||||
msgDdj.setHeight(ParseUtil.optInt(40, ddsx));
|
msgDdj.setHeight(ParseUtil.optInt(40, ddsx));
|
||||||
String trayCode = ParseUtil.optString(32, 8, ddsx);
|
String trayCode;
|
||||||
|
if (msgDdj.getId()<=3){
|
||||||
|
trayCode = ParseUtil.optString(32, 6, ddsx);
|
||||||
|
}else {
|
||||||
|
trayCode = ParseUtil.optString(32, 8, ddsx);
|
||||||
|
}
|
||||||
msgDdj.setTrayCode(trayCode);
|
msgDdj.setTrayCode(trayCode);
|
||||||
|
}else {
|
||||||
|
reConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,21 +83,6 @@ public class PlcSsjRead implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 其他输送机
|
|
||||||
*
|
|
||||||
* @param ssjDevice
|
|
||||||
*/
|
|
||||||
private void readPlcOtherSsj(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.setTaskNo(ParseUtil.optDInt(6, ddsx1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 巷道输送机
|
* 巷道输送机
|
||||||
@@ -118,64 +103,11 @@ public class PlcSsjRead implements Runnable {
|
|||||||
ssjDevice.setException(ParseUtil.optInt(14, ddsx1));
|
ssjDevice.setException(ParseUtil.optInt(14, ddsx1));
|
||||||
ssjDevice.setJxdw(ParseUtil.optInt(16, ddsx1));
|
ssjDevice.setJxdw(ParseUtil.optInt(16, ddsx1));
|
||||||
ssjDevice.setSpare1(ParseUtil.optInt(18, ddsx1));
|
ssjDevice.setSpare1(ParseUtil.optInt(18, ddsx1));
|
||||||
|
}else {
|
||||||
|
reConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 入出库输送机
|
|
||||||
*
|
|
||||||
* @param 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.setException(ParseUtil.optInt(4, ddsx1));
|
|
||||||
ssjDevice.setAllowPut(ParseUtil.optInt(6, ddsx1));
|
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(8, ddsx1));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 产线输送机
|
|
||||||
*
|
|
||||||
* @param ssjDevice
|
|
||||||
*/
|
|
||||||
private void readPlcLineSsj(DeviceSsj ssjDevice) {
|
|
||||||
OperateResultExOne<byte[]> read2 = readWriteNet.Read(ssjDevice.getPlcDbReadAddress(), Short.parseShort("220"));
|
|
||||||
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.setTraySize(ParseUtil.optInt(6, ddsx1));
|
|
||||||
ssjDevice.setTaskNo(ParseUtil.optDInt(8, ddsx1));
|
|
||||||
|
|
||||||
String trayCodeReadAddress="";
|
|
||||||
switch (ssjDevice.getDeviceCode()){
|
|
||||||
case "G1005":
|
|
||||||
trayCodeReadAddress = "DB502.0";
|
|
||||||
break;
|
|
||||||
case "L2012":
|
|
||||||
trayCodeReadAddress = "DB503.0";
|
|
||||||
break;
|
|
||||||
case "L2013":
|
|
||||||
trayCodeReadAddress = "DB504.0";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
OperateResultExOne<byte[]> trayCodeRead = readWriteNet.Read(trayCodeReadAddress, Short.parseShort("220"));
|
|
||||||
if (trayCodeRead.IsSuccess){
|
|
||||||
byte[] content = trayCodeRead.Content;
|
|
||||||
//去除bytes中
|
|
||||||
ssjDevice.setTrayCode(ParseUtil.filterAndConvert(trayCodeRead.Content));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -85,14 +85,11 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
|
MsgDdj msgDdj = PlcDdjRead.deviceDdjMap.get(ddjCode);
|
||||||
try {
|
try {
|
||||||
if (ObjUtil.isNotNull(msgDdj)) {
|
if (ObjUtil.isNotNull(msgDdj)) {
|
||||||
MsgDdj currentMsgDdj = msgDdjService.selectMsgDdjById(Convert.toLong(msgDdj.getId()));
|
generateInBoundPickQueue(msgDdj);
|
||||||
if ("0".equals(currentMsgDdj.getSpare1())) {
|
generateInBoundLoadQueue(msgDdj);
|
||||||
generateInBoundPickQueue(msgDdj);
|
generateOutBoundQueue(msgDdj);
|
||||||
generateInBoundLoadQueue(msgDdj);
|
setOutSsjStatus(msgDdj);
|
||||||
generateOutBoundQueue(msgDdj);
|
ddjTask(msgDdj);
|
||||||
setOutSsjStatus(msgDdj);
|
|
||||||
ddjTask(msgDdj);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
log.error("堆垛机设备为空");
|
log.error("堆垛机设备为空");
|
||||||
}
|
}
|
||||||
@@ -143,16 +140,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
List<DeviceSsj> outSsj1 = getDeviceSsjs("outSsj1");
|
List<DeviceSsj> outSsj1 = getDeviceSsjs("outSsj1");
|
||||||
if (outSsj1.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
if (outSsj1.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
outSsj = outSsj1.get(0).getDeviceCode();
|
outSsj = outSsj1.get(0).getDeviceCode();
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
if (StrUtil.isNotEmpty(outSsj) ) {
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<DeviceSsj> outSsj2 = getDeviceSsjs("outSsj2");
|
List<DeviceSsj> outSsj2 = getDeviceSsjs("outSsj2");
|
||||||
if (outSsj2.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
if (outSsj2.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
outSsj = outSsj2.get(0).getDeviceCode();
|
outSsj = outSsj2.get(0).getDeviceCode();
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
if (StrUtil.isNotEmpty(outSsj) ) {
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,16 +156,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
List<DeviceSsj> outSsj3 = getDeviceSsjs("outSsj3");
|
List<DeviceSsj> outSsj3 = getDeviceSsjs("outSsj3");
|
||||||
if (outSsj3.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
if (outSsj3.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
outSsj = outSsj3.get(0).getDeviceCode();
|
outSsj = outSsj3.get(0).getDeviceCode();
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
if (StrUtil.isNotEmpty(outSsj) ) {
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<DeviceSsj> outSsj4 = getDeviceSsjs("outSsj4");
|
List<DeviceSsj> outSsj4 = getDeviceSsjs("outSsj4");
|
||||||
if (outSsj4.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
if (outSsj4.stream().allMatch(ssj -> ssj.getKx() == 1 && ssj.getTaskNo() == 0 && ddj.getYxxf() == 1 && ddj.getHczt() == 0 && ddj.getSbzt() == 0)) {
|
||||||
outSsj = outSsj4.get(0).getDeviceCode();
|
outSsj = outSsj4.get(0).getDeviceCode();
|
||||||
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
if (StrUtil.isNotEmpty(outSsj) ) {
|
||||||
if (StrUtil.isNotEmpty(outSsj) && ssjJobCount == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,36 +173,41 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ("0".equals(outJob.getExecutionPhase()) && StrUtil.isNotEmpty(outSsj)) {
|
if ("0".equals(outJob.getExecutionPhase()) && StrUtil.isNotEmpty(outSsj)) {
|
||||||
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(outJob.getTaskNo()), ddj.getId());
|
int ssjJobCount = ddjDeviceExecutionQueueService.selectOutJobCount(getOtherOutDdjQueue(outSsj));
|
||||||
//查询这个站点是否存在任务
|
|
||||||
if (ObjUtil.isNull(ddjQueue)) {
|
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
|
||||||
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
|
||||||
ddjDeviceExecutionQueue.setRwh(Convert.toLong(outJob.getTaskNo()));
|
|
||||||
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
|
||||||
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
|
||||||
ddjDeviceExecutionQueue.setRwzt(0);
|
|
||||||
|
|
||||||
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(outJob.getCargoSpaceId());
|
if (ssjJobCount==0){
|
||||||
ddjDeviceExecutionQueue.setYph(basCargoSpace.getThePlatoon());
|
DdjDeviceExecutionQueue ddjQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(Convert.toLong(outJob.getTaskNo()), ddj.getId());
|
||||||
ddjDeviceExecutionQueue.setYlh(basCargoSpace.getTheColumn());
|
//查询这个站点是否存在任务
|
||||||
ddjDeviceExecutionQueue.setYch(basCargoSpace.getTheFloor());
|
if (ObjUtil.isNull(ddjQueue)) {
|
||||||
List<Integer> integers = roadwayMap.get(outSsj);
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = new DdjDeviceExecutionQueue();
|
||||||
ddjDeviceExecutionQueue.setMbph(integers.get(0));
|
ddjDeviceExecutionQueue.setUuid(IdUtil.simpleUUID());
|
||||||
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
ddjDeviceExecutionQueue.setRwh(Convert.toLong(outJob.getTaskNo()));
|
||||||
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
ddjDeviceExecutionQueue.setDevName(ddj.getName());
|
||||||
ddjDeviceExecutionQueue.setDdjxf("0");
|
ddjDeviceExecutionQueue.setDevId(ddj.getId());
|
||||||
ddjDeviceExecutionQueue.setMlfs(5);
|
ddjDeviceExecutionQueue.setRwzt(0);
|
||||||
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
|
||||||
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(outJob.getCargoSpaceId());
|
||||||
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
ddjDeviceExecutionQueue.setYph(basCargoSpace.getThePlatoon());
|
||||||
outJob.setStatus("3");
|
ddjDeviceExecutionQueue.setYlh(basCargoSpace.getTheColumn());
|
||||||
outJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
ddjDeviceExecutionQueue.setYch(basCargoSpace.getTheFloor());
|
||||||
outJob.setExecutionPhase(TASK_EP_DDJ);
|
List<Integer> integers = roadwayMap.get(outSsj);
|
||||||
mydoJobService.updateMydoJob(outJob);
|
ddjDeviceExecutionQueue.setMbph(integers.get(0));
|
||||||
} else {
|
ddjDeviceExecutionQueue.setMblh(integers.get(1));
|
||||||
log.info("任务已存在 rwh{}", outJob.getTaskNo());
|
ddjDeviceExecutionQueue.setMbch(integers.get(2));
|
||||||
|
ddjDeviceExecutionQueue.setDdjxf("0");
|
||||||
|
ddjDeviceExecutionQueue.setMlfs(5);
|
||||||
|
ddjDeviceExecutionQueue.setScsj(DateUtil.formatDateTime(DateUtil.date()));
|
||||||
|
ddjDeviceExecutionQueue.setRwlx(DDJ_RWLX_3);
|
||||||
|
ddjDeviceExecutionQueueService.insertDdjDeviceExecutionQueue(ddjDeviceExecutionQueue);
|
||||||
|
outJob.setStatus("3");
|
||||||
|
outJob.setStartTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
outJob.setExecutionPhase(TASK_EP_DDJ);
|
||||||
|
mydoJobService.updateMydoJob(outJob);
|
||||||
|
} else {
|
||||||
|
log.info("任务已存在 rwh{}", outJob.getTaskNo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,14 +230,14 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
*/
|
*/
|
||||||
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
private void generateInBoundLoadQueue(MsgDdj ddj) {
|
||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && ddj.getHczt() == 1 && ddj.getYxxf() == 1 && ddj.getHeight() > 0) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 0 && ddj.getHczt() == 1 && ddj.getYxxf() == 1 && ddj.getHeight() > 0) {
|
||||||
|
String trayCode = ddj.getTrayCode();
|
||||||
//允许下发 联机 有货待机
|
//允许下发 联机 有货待机
|
||||||
if (ddj.getTrayCode() != null && StrUtil.isNotEmpty(ddj.getTrayCode().trim())) {
|
if (trayCode != null && StrUtil.isNotEmpty(trayCode.trim())) {
|
||||||
if ("11111111".equals(ddj.getTrayCode()) || "NoRead00".equalsIgnoreCase(ddj.getTrayCode())){
|
if ("11111111".equals(trayCode) || "111111".equals(trayCode) || "NoRead".equals(trayCode) || "NoRead00".equalsIgnoreCase(trayCode)) {
|
||||||
createRollbackQueue(ddj, 1);
|
createRollbackQueue(ddj, 1);
|
||||||
|
|
||||||
}else if (!"00000000".equals(ddj.getTrayCode())){
|
} else if (!"00000000".equals(trayCode) && !"000000".equals(trayCode)) {
|
||||||
String trayCode = ddj.getTrayCode();
|
trayCode = trayCode.substring(trayCode.length() - 4);
|
||||||
trayCode = trayCode.substring(trayCode.length()-4);
|
|
||||||
MydoJob param = new MydoJob();
|
MydoJob param = new MydoJob();
|
||||||
param.setTrayCode(trayCode);
|
param.setTrayCode(trayCode);
|
||||||
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||||
@@ -456,12 +454,13 @@ public abstract class BaseDdjThread implements Runnable, DdjThreadInterface {
|
|||||||
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
if (ddj.getCzfs() == 5 && ddj.getSbzt() == 1052 && ddj.getJdbz() < 5 && ddj.getYxxf() == 1) {
|
||||||
//判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
|
//判断堆垛机上任务是否已重分,若未重分,则调用接口,请求重分货位
|
||||||
Long rwh = ddj.getRwh();
|
Long rwh = ddj.getRwh();
|
||||||
|
String trayCode = ddj.getTrayCode();
|
||||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
MydoJob mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
DdjDeviceExecutionQueue ddjDeviceExecutionQueue = ddjDeviceExecutionQueueService.selectDdjDeviceExecutionQueueByRwh(rwh, ddj.getId());
|
||||||
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
if ("0".equals(mydoJob.getFaultFlag()) && "1".equals(ddjDeviceExecutionQueue.getSpare1())) {
|
||||||
mydoJob.setStatus("1");
|
mydoJob.setStatus("1");
|
||||||
mydoJobService.updateMydoJob(mydoJob);
|
mydoJobService.updateMydoJob(mydoJob);
|
||||||
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), ddj.getTrayCode(), ddjDeviceExecutionQueue.getRwh().toString()));
|
AjaxResult ajaxResult = apiService.reAssign(new JobParam(mydoJob.getJobId(), trayCode, ddjDeviceExecutionQueue.getRwh().toString()));
|
||||||
if (ajaxResult.isSuccess()) {
|
if (ajaxResult.isSuccess()) {
|
||||||
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
mydoJob = mydoJobService.selectMydoJobByTaskNo(rwh);
|
||||||
mydoJob.setFaultFlag("2");
|
mydoJob.setFaultFlag("2");
|
||||||
|
|||||||
@@ -97,12 +97,8 @@ public class Ddj1Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
List<Integer> integers = roadwayMap.get(exitSsj);
|
|
||||||
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
param.setDevId(1);
|
param.setSpare2(exitSsj);
|
||||||
param.setMbph(integers.get(0));
|
|
||||||
param.setMblh(integers.get(1));
|
|
||||||
param.setMbch(integers.get(2));
|
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ public class Ddj2Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
return null;
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
|
param.setSpare2(exitSsj);
|
||||||
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ public class Ddj3Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
return null;
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
|
param.setSpare2(exitSsj);
|
||||||
|
return param;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,12 +80,8 @@ public class Ddj4Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
List<Integer> integers = roadwayMap.get(exitSsj);
|
|
||||||
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
param.setDevId(4);
|
param.setSpare2(exitSsj);
|
||||||
param.setMbph(integers.get(0));
|
|
||||||
param.setMblh(integers.get(1));
|
|
||||||
param.setMbch(integers.get(2));
|
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ public class Ddj5Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
return null;
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
|
param.setSpare2(exitSsj);
|
||||||
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ public class Ddj6Thread extends BaseDdjThread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
public DdjDeviceExecutionQueue getOtherOutDdjQueue(String exitSsj) {
|
||||||
return null;
|
DdjDeviceExecutionQueue param = new DdjDeviceExecutionQueue();
|
||||||
|
param.setSpare2(exitSsj);
|
||||||
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CheckWeight {
|
|||||||
InputStream is = socket.getInputStream();
|
InputStream is = socket.getInputStream();
|
||||||
) {
|
) {
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
byte[] bytes = new byte[8];
|
byte[] bytes = new byte[10];
|
||||||
int read = is.read(bytes);
|
int read = is.read(bytes);
|
||||||
if (read!=-1){
|
if (read!=-1){
|
||||||
String weight = byteArrayToCharArray(bytes, "UTF-8");
|
String weight = byteArrayToCharArray(bytes, "UTF-8");
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
#主数据信息
|
#主数据信息
|
||||||
master:
|
master:
|
||||||
url: jdbc:sqlserver://127.0.0.1:1433;databaseName=FT541-wcs;
|
url: jdbc:sqlserver://172.19.1.119:1433;databaseName=FT541-wcs;
|
||||||
username: sa
|
username: sa
|
||||||
password: Flrd0914.
|
password: Flrd0914.
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ spring:
|
|||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 127.0.0.1
|
host: 172.19.1.119
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectOutJobCount">
|
<select id="selectOutJobCount">
|
||||||
select count(*) from ddj_device_execution_queue
|
select count(*) from ddj_device_execution_queue
|
||||||
where mbph = #{mbph} and mblh=#{mblh} and mbch=#{mbch} and dev_id = #{devId}
|
where spare2=#{spare2}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user