diff --git a/src/main/java/com/qyft/ms/app/handler/debugimpl/SyringePumpStart.java b/src/main/java/com/qyft/ms/app/handler/debugimpl/SyringePumpStart.java index 571b080..fb2cc34 100644 --- a/src/main/java/com/qyft/ms/app/handler/debugimpl/SyringePumpStart.java +++ b/src/main/java/com/qyft/ms/app/handler/debugimpl/SyringePumpStart.java @@ -19,6 +19,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter; import java.util.Map; +import java.util.Optional; /** * z轴回原点 @@ -59,7 +60,10 @@ public class SyringePumpStart implements CommandHandler { */ emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.RECEIVE, "后台已收到指令"), MediaType.APPLICATION_JSON); - Double speed = (Double) param.get("speed"); + Double speed = Optional.ofNullable(param.get("speed")) + .map(Object::toString) + .map(Double::parseDouble) + .orElse(null); String direction = (String) param.get("direction"); diff --git a/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java b/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java index 1a69036..2de33cf 100644 --- a/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java +++ b/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java @@ -92,8 +92,8 @@ public class MatrixSprayChangeParam implements CommandHandler { @SuppressWarnings("unchecked") List> positionList = (List>) param.get("position"); - if (validate(emitter, frontCmdId, frontCmdName, motorZHeight, gasPressure, volume, highVoltage, highVoltageValue, movingSpeed, positionList)) - return; +// if (validate(emitter, frontCmdId, frontCmdName, motorZHeight, gasPressure, volume, highVoltage, highVoltageValue, movingSpeed, positionList)) +// return; //1.速度 if (motorSpeedSet(emitter, movingSpeed, frontCmdId, frontCmdName)) return; diff --git a/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java b/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java index 3dab179..be804a6 100644 --- a/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java +++ b/src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java @@ -121,7 +121,7 @@ public class MatrixSprayStart implements CommandHandler { List> positionList = (List>) param.get("position"); - if (validate(emitter, matrixPathType, frontCmdId, frontCmdName, motorZHeight, gasPressure, volume, highVoltage, highVoltageValue, spacing, movingSpeed, times, positionList)) + if (validate(emitter, matrixPathType, frontCmdId, frontCmdName, motorZHeight, gasPressure, volume, highVoltage, spacing, movingSpeed, times, positionList)) return; // DeviceInstance deviceInstance = DeviceInstance.getInstance(); @@ -589,7 +589,7 @@ public class MatrixSprayStart implements CommandHandler { return false; } - private static boolean validate(ResponseBodyEmitter emitter, String matrixPathType, String frontCmdId, String frontCmdName, Double motorZHeight, Double gasPressure, Double volume, Boolean highVoltage, Double highVoltageValue, Double spacing, Double movingSpeed, Double times, List> positionList) throws IOException { + private static boolean validate(ResponseBodyEmitter emitter, String matrixPathType, String frontCmdId, String frontCmdName, Double motorZHeight, Double gasPressure, Double volume, Boolean highVoltage, Double spacing, Double movingSpeed, Double times, List> positionList) throws IOException { if (matrixPathType == null) { emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.ERROR, "参数 matrix_path_type 必填"), MediaType.APPLICATION_JSON); emitter.complete(); @@ -615,11 +615,6 @@ public class MatrixSprayStart implements CommandHandler { emitter.complete(); return true; } - if (highVoltageValue == null) { - emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.ERROR, "参数 high_voltage_value 必填"), MediaType.APPLICATION_JSON); - emitter.complete(); - return true; - } if (spacing == null) { emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.ERROR, "参数 spacing 必填"), MediaType.APPLICATION_JSON); emitter.complete(); diff --git a/src/main/java/com/qyft/ms/app/handler/impl/NozzlePipelinePreFill.java b/src/main/java/com/qyft/ms/app/handler/impl/NozzlePipelinePreFill.java index 08bb7d1..cdf10e6 100644 --- a/src/main/java/com/qyft/ms/app/handler/impl/NozzlePipelinePreFill.java +++ b/src/main/java/com/qyft/ms/app/handler/impl/NozzlePipelinePreFill.java @@ -137,8 +137,8 @@ public class NozzlePipelinePreFill implements CommandHandler { //3.xy轴移动到废液位置 latch = new CountDownLatch(2); deviceMessageHandler.setLatch(latch); - emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.SEND, "轴移动到废液位置"), MediaType.APPLICATION_JSON); - CMDToDevice motorXPositionSetCmdToDevice = DeviceCommandGenerator.motor_x_position_set(173.08, 2.0);//生成指令 移动x轴到指定位置 (TODO) 废液桶X轴位置应当可以配置 + emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.SEND, "x轴移动到废液位置"), MediaType.APPLICATION_JSON); + CMDToDevice motorXPositionSetCmdToDevice = DeviceCommandGenerator.motor_x_position_set(173.08);//生成指令 移动x轴到指定位置 (TODO) 废液桶X轴位置应当可以配置 CommandFuture motorXPositionSetCmdToDeviceFuture = new CommandFuture(); motorXPositionSetCmdToDeviceFuture.setCmdToDevice(motorXPositionSetCmdToDevice); Integer motorXPositionSetCmdToDeviceCmdId = motorXPositionSetCmdToDevice.getCmdId(); @@ -169,7 +169,7 @@ public class NozzlePipelinePreFill implements CommandHandler { } emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.RESULT, "移动x轴到指定位置指令反馈", motorXPositionSetCmdToDeviceResult), MediaType.APPLICATION_JSON); - CMDToDevice motorYPositionSetCMDToDevice = DeviceCommandGenerator.motor_y_position_set(75.0, 2.0);//移动y轴到指定位置 (TODO) 废液桶Y轴位置应当可以配置 + CMDToDevice motorYPositionSetCMDToDevice = DeviceCommandGenerator.motor_y_position_set(75.0);//移动y轴到指定位置 (TODO) 废液桶Y轴位置应当可以配置 CommandFuture motorYPositionSetCMDToDeviceFuture = new CommandFuture(); motorYPositionSetCMDToDeviceFuture.setCmdToDevice(motorYPositionSetCMDToDevice); Integer motorYPositionSetCMDToDeviceCmdId = motorYPositionSetCMDToDevice.getCmdId(); @@ -209,7 +209,7 @@ public class NozzlePipelinePreFill implements CommandHandler { latch = new CountDownLatch(1); deviceMessageHandler.setLatch(latch); emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.SEND, "下降z轴高度,防止飞溅"), MediaType.APPLICATION_JSON); - CMDToDevice motorZPositionSetDownCmdToDevice = DeviceCommandGenerator.motor_z_position_set(70.0, 2.0);//生成指令 移动z轴到指定位置 (TODO) 废液桶Y轴位置应当可以配置 + CMDToDevice motorZPositionSetDownCmdToDevice = DeviceCommandGenerator.motor_z_position_set(70.0);//生成指令 移动z轴到指定位置 (TODO) 废液桶Y轴位置应当可以配置 CommandFuture motorZPositionSetDownCmdToDeviceFuture = new CommandFuture(); motorZPositionSetDownCmdToDeviceFuture.setCmdToDevice(motorZPositionSetDownCmdToDevice); Integer motorZPositionSetDownCmdToDeviceCmdId = motorZPositionSetDownCmdToDevice.getCmdId(); @@ -313,7 +313,7 @@ public class NozzlePipelinePreFill implements CommandHandler { emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.RESULT, "开启喷嘴阀指令反馈", nozzleValveOpenCMDToDeviceResult), MediaType.APPLICATION_JSON); //7.设置注射泵速度,推注射泵 emitter.send(FrontCommandAck.backstageAck(frontCmdId, frontCmdName, CommandStatus.SEND, "设置注射泵速度,推注射泵"), MediaType.APPLICATION_JSON); - CMDToDevice syringePumpInjectionVolumeSetCMDToDevice = DeviceCommandGenerator.syringe_pump_forward(1.0);//推动移动注射泵 + CMDToDevice syringePumpInjectionVolumeSetCMDToDevice = DeviceCommandGenerator.syringe_pump_forward(speed);//推动移动注射泵 CommandFuture syringePumpInjectionVolumeSetCMDToDeviceFuture = new CommandFuture(); syringePumpInjectionVolumeSetCMDToDeviceFuture.setCmdToDevice(syringePumpInjectionVolumeSetCMDToDevice); Integer syringePumpInjectionVolumeSetCMDToDeviceCmdId = syringePumpInjectionVolumeSetCMDToDevice.getCmdId();