From c866cac39e3b6a7bc8c6a9b3e2eeda860083deee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Wed, 16 Jul 2025 14:47:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=82=B9=E5=87=BB=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=86=8D=E5=9B=9E=E5=8E=9F=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms/app/device/spray/SprayTaskExecutor.java | 25 +++++++------- .../app/front/cmd/business/MatrixSprayPause.java | 38 +++++++++++----------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java b/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java index e4b2467..6d828c3 100644 --- a/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java +++ b/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java @@ -91,18 +91,21 @@ public class SprayTaskExecutor { Double[] slide = slideArr[sprayTaskParam.getIndex()];//获取玻片的坐标 List sprayTaskStepList = getSprayPath(sprayTimes);//计算本次喷涂的路线 - //先移动到玻片左上角位置 - DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(slideArr[sprayTaskParam.getIndex()][0], 20.0); - DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorYPositionSet(slideArr[sprayTaskParam.getIndex()][1], 20.0); - CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXPositionSetCommand); - CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYPositionSetCommand); - SysSettings slideHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper().eq(SysSettings::getCode, "slide_height")); - Double slideHeight = Double.parseDouble(slideHeightSysSettings.getValue()); - Double height = slideHeight - sprayTimes.getMotorZHeight();//下降z轴高度 - DeviceCommand motorZPositionSetAboveSlideCommand = DeviceCommandGenerator.motorZPositionSet(height, 15.0); - CommandFuture motorZPositionSetAboveSlideCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetAboveSlideCommand); - commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetAboveSlideCommandFuture); + if(sprayTask.getCurrentStep() == 0){ + //先移动到玻片左上角位置 + DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(slideArr[sprayTaskParam.getIndex()][0], 20.0); + DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorYPositionSet(slideArr[sprayTaskParam.getIndex()][1], 20.0); + CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXPositionSetCommand); + CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYPositionSetCommand); + + SysSettings slideHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper().eq(SysSettings::getCode, "slide_height")); + Double slideHeight = Double.parseDouble(slideHeightSysSettings.getValue()); + Double height = slideHeight - sprayTimes.getMotorZHeight();//下降z轴高度 + DeviceCommand motorZPositionSetAboveSlideCommand = DeviceCommandGenerator.motorZPositionSet(height, 15.0); + CommandFuture motorZPositionSetAboveSlideCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetAboveSlideCommand); + commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetAboveSlideCommandFuture); + } DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline();//打开三通阀注射器管路 CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), threeWayValveOpenSyringePipelineCommand); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java index 0190094..59c372c 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java @@ -61,31 +61,31 @@ public class MatrixSprayPause extends BaseCommandHandler { CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); - if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录,并且记录点不可被覆盖 - //记录当前位置 - DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令 - CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); - commandWait(motorXyzPositionGetCommandFuture); - JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); - Double xAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("xAxisPosition"); - Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition"); - Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition"); - Point3D point3D = new Point3D(xAxisPosition, yAxisPosition, zAxisPosition); - sprayTask.setCurrentPausedPoint(point3D); - } +// if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录,并且记录点不可被覆盖 +// //记录当前位置 +// DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令 +// CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); +// commandWait(motorXyzPositionGetCommandFuture); +// JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); +// Double xAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("xAxisPosition"); +// Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition"); +// Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition"); +// Point3D point3D = new Point3D(xAxisPosition, yAxisPosition, zAxisPosition); +// sprayTask.setCurrentPausedPoint(point3D); +// } OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId()); operationLog.setStatus(2); operationLogService.updateById(operationLog); //XYZ回原点 - DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); - DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin(); - DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin(); - CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXOriginCommand); - CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYOriginCommand); - CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZOriginCommand); - commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); +// DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); +// DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin(); +// DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin(); +// CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXOriginCommand); +// CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYOriginCommand); +// CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZOriginCommand); +// commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); } catch (Exception e) { throw new RuntimeException(e); }finally {