|
|
@ -76,7 +76,7 @@ public class SprayTaskExecutor { |
|
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(sprayTask.getCmdId(), sprayTask.getCmdCode(), CommandStatus.START, "喷涂任务开始执行")); |
|
|
|
List<SprayTaskParams> sprayTaskParams = sprayTask.getSprayTaskParams(); |
|
|
|
for (SprayTaskParams sprayTaskParam : sprayTaskParams) {//循环玻片 |
|
|
|
if (sprayTask.getCurrentIndex() != null && sprayTaskParam.getIndex() < sprayTask.getCurrentIndex()) { |
|
|
|
if (sprayTask.getCurrentIndex() != null && sprayTaskParam.getIndex() < sprayTask.getCurrentIndex()) {//喷涂过的玻片跳过 |
|
|
|
continue; |
|
|
|
} |
|
|
|
sprayTask.setCurrentIndex(sprayTaskParam.getIndex()); |
|
|
@ -93,7 +93,7 @@ public class SprayTaskExecutor { |
|
|
|
continue; |
|
|
|
} |
|
|
|
sprayTask.setSprayTimes(sprayTimes); |
|
|
|
Double[] slide = slideArr[sprayTaskParam.getIndex()];//获取玻片的坐标 |
|
|
|
Double[] slide = slideArr[sprayTaskParam.getIndex()];//获取玻片原点的坐标 |
|
|
|
|
|
|
|
List<SprayTaskStep> sprayTaskStepList = getSprayPath(sprayTimes);//计算本次喷涂的路线 |
|
|
|
|
|
|
@ -117,30 +117,11 @@ public class SprayTaskExecutor { |
|
|
|
commandWait(threeWayValveOpenSyringePipelineCommandFuture); |
|
|
|
|
|
|
|
delay(500); |
|
|
|
//判断是否有暂停的点位,如果有则还原暂停时的点位 |
|
|
|
// Point3D currentPausedPoint = sprayTask.getCurrentPausedPoint(); |
|
|
|
// if (currentPausedPoint != null) { |
|
|
|
// DeviceCommand motorXRestoreCommand = DeviceCommandGenerator.motorXPositionSet(currentPausedPoint.x, 20.0); |
|
|
|
// DeviceCommand motorYRestoreCommand = DeviceCommandGenerator.motorYPositionSet(currentPausedPoint.y, 20.0); |
|
|
|
// DeviceCommand motorZRestoreCommand = DeviceCommandGenerator.motorZPositionSet(currentPausedPoint.z, 20.0); |
|
|
|
// CommandFuture motorXRestoreCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXRestoreCommand); |
|
|
|
// CommandFuture motorYRestoreCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYRestoreCommand); |
|
|
|
// CommandFuture motorZRestoreCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZRestoreCommand); |
|
|
|
// commandWait(motorXRestoreCommandFuture, motorYRestoreCommandFuture, motorZRestoreCommandFuture); |
|
|
|
// sprayTask.setCurrentPausedPoint(null); |
|
|
|
// } |
|
|
|
|
|
|
|
//因为走的是折线,所以单次指令只需要移动x或y,缓存上一个点位用来判断本次是走x还是y |
|
|
|
double cacheXPoint = -1; |
|
|
|
double cacheYPoint = -1; |
|
|
|
int currentStep = 0; //记录当前线程喷涂步骤序号 |
|
|
|
for (SprayTaskStep sprayTaskStep : sprayTaskStepList) {//因为田字格喷涂其实是两次 |
|
|
|
if (sprayTimes.getHighVoltage()) {//加电 |
|
|
|
DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(sprayTimes.getHighVoltageValue());//开启高压 |
|
|
|
CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageOpenCommand); |
|
|
|
commandWait(highVoltageOpenCommandFuture); |
|
|
|
} |
|
|
|
|
|
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen();//开启喷嘴阀 |
|
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveOpenCommand); |
|
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
@ -149,6 +130,12 @@ public class SprayTaskExecutor { |
|
|
|
CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), syringePumpForwardCommand); |
|
|
|
commandWait(syringePumpForwardCommandFuture); |
|
|
|
|
|
|
|
if (sprayTimes.getHighVoltage()) {//加电 |
|
|
|
DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(sprayTimes.getHighVoltageValue());//开启高压 |
|
|
|
CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageOpenCommand); |
|
|
|
commandWait(highVoltageOpenCommandFuture); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i < sprayTaskStep.getSprayPathPointList().size(); i++) {//循环路线 |
|
|
|
if (currentStep < sprayTask.getCurrentStep()) { |
|
|
|
currentStep++; |
|
|
@ -178,12 +165,12 @@ public class SprayTaskExecutor { |
|
|
|
sprayTask.setCurrentStep(currentStep); |
|
|
|
} |
|
|
|
//一次喷涂完毕后停止推注射泵 |
|
|
|
DeviceCommand highVoltageCloseCommand = DeviceCommandGenerator.highVoltageClose(); //关闭高压 |
|
|
|
CommandFuture highVoltageCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageCloseCommand); |
|
|
|
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 |
|
|
|
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), syringePumpStopCommand); |
|
|
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); //关闭喷嘴阀 |
|
|
|
CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveCloseCommand); |
|
|
|
DeviceCommand highVoltageCloseCommand = DeviceCommandGenerator.highVoltageClose(); //关闭高压 |
|
|
|
CommandFuture highVoltageCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageCloseCommand); |
|
|
|
commandWait(syringePumpStopCommandFuture, nozzleValveCloseCommandFuture, highVoltageCloseCommandFuture); |
|
|
|
|
|
|
|
sprayTask.setCurrentCountSprayNum(sprayTask.getCurrentCountSprayNum() + 1); |
|
|
@ -191,10 +178,10 @@ public class SprayTaskExecutor { |
|
|
|
delay(sprayTimes.getGridDelay() * 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
delay(sprayTimes.getDelay() * 1000); |
|
|
|
sprayNum++; |
|
|
|
sprayTask.setSprayNum(sprayNum); |
|
|
|
sprayTask.setCurrentStep(0); |
|
|
|
delay(sprayTimes.getDelay() * 1000); |
|
|
|
} |
|
|
|
sprayTask.setSprayNum(0); |
|
|
|
} |
|
|
|