Browse Source

同步代码

master
白凤吉 5 months ago
parent
commit
ed00e3e5aa
  1. 6
      src/main/java/com/qyft/ms/app/handler/debugimpl/SyringePumpStart.java
  2. 4
      src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java
  3. 9
      src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java
  4. 10
      src/main/java/com/qyft/ms/app/handler/impl/NozzlePipelinePreFill.java

6
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");

4
src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayChangeParam.java

@ -92,8 +92,8 @@ public class MatrixSprayChangeParam implements CommandHandler {
@SuppressWarnings("unchecked")
List<Map<String, Object>> positionList = (List<Map<String, Object>>) 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;

9
src/main/java/com/qyft/ms/app/handler/impl/MatrixSprayStart.java

@ -121,7 +121,7 @@ public class MatrixSprayStart implements CommandHandler {
List<Map<String, Object>> positionList = (List<Map<String, Object>>) 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<Map<String, Object>> 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<Map<String, Object>> 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();

10
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();

Loading…
Cancel
Save