|
|
@ -174,11 +174,11 @@ public class SprayTaskExecutor { |
|
|
|
commandWait(syringePumpStopCommandFuture, nozzleValveCloseCommandFuture, highVoltageCloseCommandFuture); |
|
|
|
|
|
|
|
sprayTask.setCurrentCountSprayNum(sprayTask.getCurrentCountSprayNum() + 1); |
|
|
|
if (sprayTimes.getGridDelay() != null) { |
|
|
|
delay(sprayTimes.getGridDelay() * 1000); |
|
|
|
if ("grid".equals(sprayTimes.getMatrixPathType()) && sprayTimes.getGridDelay() != null) { |
|
|
|
delay(2, sprayTimes.getGridDelay() * 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
delay(sprayTimes.getDelay() * 1000); |
|
|
|
delay(1, sprayTimes.getDelay() * 1000); |
|
|
|
sprayNum++; |
|
|
|
sprayTask.setSprayNum(sprayNum); |
|
|
|
sprayTask.setCurrentStep(0); |
|
|
@ -306,6 +306,38 @@ public class SprayTaskExecutor { |
|
|
|
} |
|
|
|
|
|
|
|
private void delay(long millisecond) throws InterruptedException { |
|
|
|
Thread.sleep(millisecond); |
|
|
|
delay(null, millisecond); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param type 1每次喷涂睡眠 2田字格睡眠 |
|
|
|
*/ |
|
|
|
private void delay(Integer type, long millisecond) throws InterruptedException { |
|
|
|
SprayTask task = SprayTask.getInstance(); |
|
|
|
long remaining = millisecond; |
|
|
|
if (type != null) { |
|
|
|
if (type == 1 && task.getRemainingDelay() != null) {//每次喷涂睡眠 |
|
|
|
remaining = task.getRemainingDelay(); |
|
|
|
} else if (type == 2 && task.getRemainingGridDelay() != null) {//田字格睡眠 |
|
|
|
remaining = task.getRemainingGridDelay(); |
|
|
|
} |
|
|
|
} |
|
|
|
long chunk = 100; |
|
|
|
while (remaining > 0) { |
|
|
|
long sleepTime = Math.min(chunk, remaining); |
|
|
|
try { |
|
|
|
Thread.sleep(sleepTime); |
|
|
|
remaining -= sleepTime; |
|
|
|
} catch (InterruptedException e) { |
|
|
|
if (type != null) { //中断时,把还没睡完的时间存起来,再向上抛 |
|
|
|
if (type == 1) {//每次喷涂睡眠 |
|
|
|
task.setRemainingDelay(remaining); |
|
|
|
} else if (type == 2) {//田字格睡眠 |
|
|
|
task.setRemainingGridDelay(remaining); |
|
|
|
} |
|
|
|
} |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |