|
|
@ -171,8 +171,7 @@ public class CMDService { |
|
|
|
!params.containsKey("routeType") || |
|
|
|
!params.containsKey("movementSpeed") || |
|
|
|
!params.containsKey("height") || |
|
|
|
!params.containsKey("matrixFlowVelocity") || |
|
|
|
!params.containsKey("nitrogenFlowVelocity") |
|
|
|
!params.containsKey("matrixFlowVelocity") |
|
|
|
) { |
|
|
|
return "参数错误"; |
|
|
|
} |
|
|
@ -191,6 +190,10 @@ public class CMDService { |
|
|
|
// 设置指定轴的电机的运行速度 |
|
|
|
int movementSpeed = (Integer) params.get("movementSpeed"); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.setMotorSpeed("X", movementSpeed)); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("spraying"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.setMotorSpeed("Y", movementSpeed)); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.setMotorSpeed("Z", 10)); |
|
|
|
|
|
|
@ -228,7 +231,7 @@ public class CMDService { |
|
|
|
left, right, top, bottom, space, routeType == 1 ? PathGenerator.MoveMode.HORIZONTAL_ZIGZAG_TOP_DOWN : PathGenerator.MoveMode.VERTICAL_ZIGZAG_LEFT_RIGHT |
|
|
|
); |
|
|
|
log.info("horizontalPath:{}", JSONUtil.toJsonStr(horizontalPath)); |
|
|
|
if(horizontalPath.isEmpty()) { |
|
|
|
if (horizontalPath.isEmpty()) { |
|
|
|
return "路径规划失败"; |
|
|
|
} |
|
|
|
|
|
|
@ -256,7 +259,11 @@ public class CMDService { |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", true)); |
|
|
|
// 推注射泵 |
|
|
|
|
|
|
|
int matrixFlowVelocity = (int) params.get("matrixFlowVelocity"); |
|
|
|
double matrixFlowVelocity =Optional.ofNullable(params.get("matrixFlowVelocity")) |
|
|
|
.filter(Number.class::isInstance) |
|
|
|
.map(Number.class::cast) |
|
|
|
.map(Number::doubleValue) |
|
|
|
.orElse(0.0); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.turnOnSyringePump(matrixFlowVelocity)); |
|
|
|
|
|
|
|
// 插入日志 |
|
|
@ -264,15 +271,17 @@ public class CMDService { |
|
|
|
cmdList.add( () -> { |
|
|
|
OperationLog operationLog = new OperationLog(); |
|
|
|
operationLog.setStatus(0); |
|
|
|
operationLog.setMatrixId((Long) params.get("matrixCraftId")); |
|
|
|
Long matrixCraftId = Long.valueOf(Optional.ofNullable(params.get("matrixCraftId")) |
|
|
|
.filter(Number.class::isInstance) |
|
|
|
.map(Number.class::cast) |
|
|
|
.map(Number::intValue) |
|
|
|
.orElse(0)); |
|
|
|
operationLog.setMatrixId(matrixCraftId); |
|
|
|
operationLog.setMatrixInfo(JSON.toJSONString(params)); |
|
|
|
operationLogService.add(operationLog); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("spraying"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
double currentX = left; |
|
|
|
double currentY = top; |
|
|
@ -301,7 +310,7 @@ public class CMDService { |
|
|
|
// 关闭高压 |
|
|
|
cmdList.add(deviceTcpCMDService::turnOffHighVoltage); |
|
|
|
// 回到原点 |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
// cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("X")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Y")); |
|
|
|
|
|
|
@ -377,9 +386,9 @@ public class CMDService { |
|
|
|
// 关闭高压 |
|
|
|
cmdList.add(deviceTcpCMDService::turnOffHighVoltage); |
|
|
|
// 关闭喷嘴阀 |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", true)); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", false)); |
|
|
|
// 回到原点 |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
// cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("X")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Y")); |
|
|
|
|
|
|
@ -416,6 +425,10 @@ public class CMDService { |
|
|
|
String type = (String) params.get("type"); |
|
|
|
|
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("washing"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("X")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Y")); |
|
|
|
|
|
|
@ -424,19 +437,16 @@ public class CMDService { |
|
|
|
cmdList.add(() -> deviceTcpCMDService.moveMotorToPosition("X", wasteLiquorPosition.get("x"))); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.moveMotorToPosition("Z", wasteLiquorPosition.get("z"))); |
|
|
|
|
|
|
|
// type: "injector" | "nozzle" |
|
|
|
if(Objects.equals(type, "injector")) { |
|
|
|
cmdList.add(() -> deviceTcpCMDService.switchThreeWayValve("clear_spray")); |
|
|
|
// type: "injector"注射器 | "nozzle"喷涂 |
|
|
|
if(Objects.equals(type, "nozzle")) { // ON_C |
|
|
|
cmdList.add(() -> deviceTcpCMDService.switchThreeWayValve("clear_nozzle")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.turnOnSyringePump(1000)); |
|
|
|
} else if (Objects.equals(type, "nozzle")) { |
|
|
|
} else if (Objects.equals(type, "injector")) { // OFF_C |
|
|
|
|
|
|
|
cmdList.add(() -> deviceTcpCMDService.switchThreeWayValve("clear_nozzle")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.switchThreeWayValve("clear_spray")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Cleaning", true)); |
|
|
|
} |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("washing"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
|
|
|
|
initExecutorThread(cmdList, form); |
|
|
|
return true; |
|
|
|
} |
|
|
@ -448,6 +458,9 @@ public class CMDService { |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Cleaning", false)); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", false)); |
|
|
|
cmdList.add(deviceTcpCMDService::turnOffSyringePump); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Z")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("X")); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.motorMoveToHome("Y")); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("idle"); |
|
|
|
return true; |
|
|
@ -465,7 +478,7 @@ public class CMDService { |
|
|
|
public boolean turnOnLightPanel(CMDForm form) { |
|
|
|
Map<String, Object> params = form.getParams(); |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.turnOnLightPanel()); |
|
|
|
cmdList.add(deviceTcpCMDService::turnOnLightPanel); |
|
|
|
initExecutorThread(cmdList, form); |
|
|
|
return true; |
|
|
|
} |
|
|
@ -484,19 +497,28 @@ public class CMDService { |
|
|
|
public boolean startPrefill(CMDForm form) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
Map<String, Object> params = form.getParams(); |
|
|
|
double rotationSpeed = Optional.ofNullable(params.get("rotationSpeed")) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Double> wasteLiquorPosition = sysSettingsService.getWasteLiquorPosition(); |
|
|
|
|
|
|
|
|
|
|
|
cmdList.add(() -> deviceTcpCMDService.moveMotorToPosition("X", wasteLiquorPosition.get("x"))); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("prefilling"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.moveMotorToPosition("Z", wasteLiquorPosition.get("z"))); |
|
|
|
|
|
|
|
double rotationSpeed = Optional.ofNullable(params.get("rotationSpeed")) |
|
|
|
.filter(Number.class::isInstance) |
|
|
|
.map(Number.class::cast) |
|
|
|
.map(Number::doubleValue) |
|
|
|
.orElse(0.0); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.switchThreeWayValve("clear_spray")); |
|
|
|
|
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", true)); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.turnOnSyringePump(rotationSpeed)); |
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("prefilling"); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
|
|
|
|
initExecutorThread(cmdList, form); |
|
|
|
return true; |
|
|
|
} |
|
|
@ -504,7 +526,6 @@ double rotationSpeed = Optional.ofNullable(params.get("rotationSpeed")) |
|
|
|
public boolean stopPrefill(CMDForm form) { |
|
|
|
List<Supplier<Boolean>> cmdList = new ArrayList<>(); |
|
|
|
cmdList.add(deviceTcpCMDService::turnOffSyringePump); |
|
|
|
cmdList.add(() -> deviceTcpCMDService.controlValve("Nozzle", false)); |
|
|
|
|
|
|
|
cmdList.add(() -> { |
|
|
|
sysSettingsService.updateWorkStatus("idle"); |
|
|
|