Browse Source

fix:参数加热区数组改为单个加热区字符串

master
王梦远 2 months ago
parent
commit
138def5e1e
  1. 2
      src/main/java/com/iflytop/sgs/SeparateGoldServiceApplication.java
  2. 22
      src/main/java/com/iflytop/sgs/app/cmd/control/AnnealStartCommand.java
  3. 18
      src/main/java/com/iflytop/sgs/app/cmd/control/AnnealStopCommand.java
  4. 19
      src/main/java/com/iflytop/sgs/app/cmd/control/DryStartCommand.java
  5. 13
      src/main/java/com/iflytop/sgs/app/cmd/control/DryStopCommand.java
  6. 19
      src/main/java/com/iflytop/sgs/app/cmd/control/FanStartCommand.java
  7. 12
      src/main/java/com/iflytop/sgs/app/cmd/control/FanStopCommand.java
  8. 20
      src/main/java/com/iflytop/sgs/app/cmd/control/HeatStartCommand.java
  9. 13
      src/main/java/com/iflytop/sgs/app/cmd/control/HeatStopCommand.java
  10. 103
      src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java
  11. 4
      src/main/java/com/iflytop/sgs/app/core/aspect/DeviceStateChangeAspect.java
  12. 3
      src/main/java/com/iflytop/sgs/app/model/bo/status/device/SolutionModuleState.java

2
src/main/java/com/iflytop/sgs/SeparateGoldServiceApplication.java

@ -2,8 +2,10 @@ package com.iflytop.sgs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@SpringBootApplication
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class SeparateGoldServiceApplication {
public static void main(String[] args) {

22
src/main/java/com/iflytop/sgs/app/cmd/control/AnnealStartCommand.java

@ -35,23 +35,17 @@ public class AnnealStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
if (heatModuleCodeJsonArray.size() > 1 && !heatModuleCodeJsonArray.getStr(0).equals(HeatModuleCode.heat_module_04.name())) {//参数校验 设备问题参数固定位[heat_module_04]
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
if (!heatModuleCode.equals(HeatModuleCode.heat_module_04)) {//参数校验 设备问题参数固定位[heat_module_04]
throw new AppException(ResultCode.PARAMETER_TYPE_MISMATCH);
}
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);//获取加热模块状态
double targetTemperature = heatModuleState.getAnnealTemperature();//获取设定的退火温度
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String targetHeatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode targetHeatModuleCode = HeatModuleCode.valueOf(targetHeatModuleCodeStr);//目标退火模块
Assert.isTrue(targetHeatModuleCode != null, () -> new AppException(ResultCode.PARAMETER_TYPE_MISMATCH));//参数检验
HeatModuleState heatModuleState=deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode);//获取加热模块状态
Assert.isTrue(heatModuleState.isTrayStatus(), () -> new AppException(ResultCode.TARGET_HEAT_MODULE_NO_TRAY));//检测是否有托盘
double targetTemperature = heatModuleState.getAnnealTemperature();//获取设定的退火温度
heatModuleState.setTargetTemperature(targetTemperature);//将退火温度设定为目标温度
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleCode, targetTemperature);//开启加热
deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setHeatingType(HeatingType.annealing);//状态修改为退火中
}
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, targetTemperature);//开启加热
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.annealing);//状态修改为退火中
heatModuleState.setTargetTemperature(targetTemperature);//将退火温度设定为目标温度
});

18
src/main/java/com/iflytop/sgs/app/cmd/control/AnnealStopCommand.java

@ -31,22 +31,12 @@ public class AnnealStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
if (heatModuleCodeJsonArray.size() > 1 && !heatModuleCodeJsonArray.getStr(0).equals(HeatModuleCode.heat_module_04.name())) {//参数校验 设备问题参数固定位[heat_module_04]
throw new AppException(ResultCode.PARAMETER_TYPE_MISMATCH);
}
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String targetHeatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode targetHeatModuleCode = HeatModuleCode.valueOf(targetHeatModuleCodeStr);//目标退火模块
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode);//获取退火区的状态
Assert.isTrue(heatModuleState.getHeatingType().equals(HeatingType.annealing), () -> new AppException(ResultCode.TARGET_HEAT_MODULE_NOT_ANNEAL));//判断退火区状态
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleCode);//关闭加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setHeatingType(HeatingType.stop);//设置退火区退火状态
}
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//关闭加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);//设置退火区退火状态
});
}
}

19
src/main/java/com/iflytop/sgs/app/cmd/control/DryStartCommand.java

@ -28,19 +28,14 @@ public class DryStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);//获取设定的烘干温度
double targetTemperature = heatModuleState.getDryTemperature();
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);//获取设定的烘干温度
double targetTemperature = heatModuleState.getDryTemperature();
heatModuleState.setTargetTemperature(targetTemperature);//将烘干温度设定为目标温度
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, targetTemperature);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.drying); //设置加热区状态 烘干中
}
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, targetTemperature);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.drying); //设置加热区状态 烘干中
heatModuleState.setTargetTemperature(targetTemperature);//将烘干温度设定为目标温度
});
}
}

13
src/main/java/com/iflytop/sgs/app/cmd/control/DryStopCommand.java

@ -27,16 +27,11 @@ public class DryStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);
}
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);
});
}
}

19
src/main/java/com/iflytop/sgs/app/cmd/control/FanStartCommand.java

@ -29,20 +29,17 @@ public class FanStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);//加热模块
HeatModuleState heatModuleState=deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);
if(!heatModuleState.getHeatingType().equals(HeatingType.stop)){//加热棒不是停止加热状态
heatModuleService.heatRodClose(cmdDTO.getCommandId(),cmdDTO.getCommand(),heatModuleCode);//关闭加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);//同步状态
}
heatModuleService.fanStart(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//打开风扇
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(true);//同步状态
if (!heatModuleState.getHeatingType().equals(HeatingType.stop)) {//加热棒不是停止加热状态
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//关闭加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);//同步状态
}
heatModuleService.fanStart(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//打开风扇
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(true);//同步状态
});
}
}

12
src/main/java/com/iflytop/sgs/app/cmd/control/FanStopCommand.java

@ -27,15 +27,11 @@ public class FanStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
heatModuleService.fanClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//关闭风扇
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false);//同步转态
}
heatModuleService.fanClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//关闭风扇
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setFanOpen(false);//同步转态
});
}
}

20
src/main/java/com/iflytop/sgs/app/cmd/control/HeatStartCommand.java

@ -31,20 +31,14 @@ public class HeatStartCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);//获取目标加热区
double targetTemperature = heatModuleState.getHeatTemperature();//获取设定的加热温度
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
HeatModuleState heatModuleState = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode);//获取目标加热区
Assert.isTrue(heatModuleState.isTrayStatus(), ()->new AppException(ResultCode.TARGET_HEAT_MODULE_NO_TRAY));//目标加热区无托盘
double targetTemperature = heatModuleState.getHeatTemperature();//获取设定的加热温度
heatModuleState.setTargetTemperature(targetTemperature);//将加热温度设定为目标温度
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, targetTemperature);//打开加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.heating); //设置加热区状态 加热中
}
heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, targetTemperature);//打开加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.heating); //设置加热区状态 加热中
heatModuleState.setTargetTemperature(targetTemperature);//将加热温度设定为目标温度
});
}
}

13
src/main/java/com/iflytop/sgs/app/cmd/control/HeatStopCommand.java

@ -27,16 +27,11 @@ public class HeatStopCommand extends BaseCommandHandler {
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
JSONArray heatModuleCodeJsonArray = cmdDTO.getJSONArrayParam("heatModuleCode");
String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode");
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
return runAsync(() -> {
for (int i = 0; i < heatModuleCodeJsonArray.size(); i++) {
String heatModuleCodeStr = heatModuleCodeJsonArray.getStr(i);
HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//停止加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);//同步转态
}
heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode);//停止加热棒
deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeatingType(HeatingType.stop);//同步转态
});
}
}

103
src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java

@ -2,11 +2,9 @@ package com.iflytop.sgs.app.cmd.control;
import cn.hutool.core.lang.Assert;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.iflytop.sgs.app.core.BaseCommandHandler;
import com.iflytop.sgs.app.model.bo.Point3D;
import com.iflytop.sgs.app.model.bo.status.device.TransferModuleState;
import com.iflytop.sgs.app.model.bo.status.device.ValveState;
import com.iflytop.sgs.app.model.dto.CmdDTO;
import com.iflytop.sgs.app.model.entity.Solutions;
import com.iflytop.sgs.app.service.api.DevicePositionService;
@ -50,7 +48,11 @@ public class LiquidAddCommand extends BaseCommandHandler {
deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用
deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液
JSONArray jsonArray = cmdDTO.getJSONArrayParam("columns");//获取参数
Assert.notNull(jsonArray, () -> new AppException(ResultCode.INVALID_PARAMETER));//解析参数
Integer solutionId = cmdDTO.getIntegerParam("solutionId");//溶液ID
double volume = cmdDTO.getDoubleParam("volume");//
Solutions solutions = solutionsService.getById(solutionId);//获取溶液
ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code
Assert.isTrue(!jsonArray.isEmpty(), () -> new AppException(ResultCode.INVALID_PARAMETER));//确定选中了列
TransferModuleState transferModuleState = deviceStateService.getDeviceState().getTransferModule();//获取机械臂状态
Assert.isTrue(transferModuleState.isTrayStatus(), () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘
Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位
@ -58,57 +60,56 @@ public class LiquidAddCommand extends BaseCommandHandler {
Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //托盘试管水平间距
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
Integer solutionId = jsonObject.getInt("solutionId");//溶液Id
Integer column = jsonObject.getInt("column");//列数
double volume = jsonObject.getDouble("volume");//
Solutions solutions = solutionsService.getById(solutionId);//获取溶液
ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code
ValveStateCode oldValveState = deviceStateService.getDeviceState().getSolutionModule().getValveState().getState();//获取当前电磁阀的值
double preFillDistance = 0;
if (!oldValveState.equals(valveStateCode)) {//判断是否与当前加酸的通道一致 不一致排空
switch (oldValveState) {
case ValveStateCode.thin -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.thinPreFillDistance).getDistance();//稀硝酸预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
case ValveStateCode.thick -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.thickPreFillDistance).getDistance();//浓硝酸预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
case ValveStateCode.water -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.waterPreFillDistance).getDistance();//蒸馏水预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
//预充
ValveStateCode oldValveState = deviceStateService.getDeviceState().getSolutionModule().getValveState().getState();//获取当前电磁阀的值
double preFillDistance = 0;
if (!oldValveState.equals(valveStateCode)) {//判断是否与当前加酸的通道一致 不一致排空
switch (oldValveState) {
case ValveStateCode.thin -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.thinPreFillDistance).getDistance();//稀硝酸预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
case ValveStateCode.thick -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.thickPreFillDistance).getDistance();//浓硝酸预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
case ValveStateCode.water -> {
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), ValveStateCode.waste);//废液通道打开
double distance = devicePositionService.getPosition(DevicePositionCode.waterPreFillDistance).getDistance();//蒸馏水预充距离
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//排空
}
}
switch (valveStateCode) {
case ValveStateCode.thin -> {
double distance = devicePositionService.getPosition(DevicePositionCode.thinPreFillDistance).getDistance();//稀硝酸预充距离
preFillDistance += distance;
}
switch (valveStateCode) {
case ValveStateCode.thin -> {
double distance = devicePositionService.getPosition(DevicePositionCode.thinPreFillDistance).getDistance();//稀硝酸预充距离
preFillDistance += distance;
}
case ValveStateCode.thick -> {
double distance = devicePositionService.getPosition(DevicePositionCode.thickPreFillDistance).getDistance();//浓硝酸预充距离
preFillDistance += distance;
}
case ValveStateCode.water -> {
double distance = devicePositionService.getPosition(DevicePositionCode.waterPreFillDistance).getDistance();//蒸馏水预充距离
preFillDistance += distance;
}
case ValveStateCode.thick -> {
double distance = devicePositionService.getPosition(DevicePositionCode.thickPreFillDistance).getDistance();//浓硝酸预充距离
preFillDistance += distance;
}
case ValveStateCode.water -> {
double distance = devicePositionService.getPosition(DevicePositionCode.waterPreFillDistance).getDistance();//蒸馏水预充距离
preFillDistance += distance;
}
}
}
double scale = Double.parseDouble(systemConfigService.getSystemConfigValueByCode(valveStateCode.getSystemConfigCode()));//根据溶液获取转换比
double position = volume * scale * 8 + preFillDistance;//加液泵的转数
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), valveStateCode);//电磁阀对应通道打开
deviceStateService.getDeviceState().getSolutionModule().getValveState().setState(valveStateCode);//设置阀门状态
for (int i = 0; i < jsonArray.size(); i++) {
int column = jsonArray.getInt(i);
if (column > 0 && column < 6) {
double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂左移距离
transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//机械臂左移
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeAddPositon);//加液机械臂下降
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//加液
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置
}
double scale = Double.parseDouble(systemConfigService.getSystemConfigValueByCode(valveStateCode.getSystemConfigCode()));//根据溶液获取转换比
double position = volume * scale * 8 + preFillDistance;//加液泵的转数
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), valveStateCode);//电磁阀对应通道打开
double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂左移距离
transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//机械臂左移
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeAddPositon);//加液机械臂下降
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//加液
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置
}
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置

4
src/main/java/com/iflytop/sgs/app/core/aspect/DeviceStateChangeAspect.java

@ -9,6 +9,7 @@ import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import java.util.concurrent.locks.Lock;
@ -25,10 +26,12 @@ public class DeviceStateChangeAspect {
private final Lock lock = new ReentrantLock();
private Object beforeValue;
@Before("execution(* com.iflytop.sgs.app.model.bo.status..set*(..))")
public void beforeSetMethod(JoinPoint joinPoint) {
lock.lock();
try {
System.out.println(joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
Object[] methodArgs = joinPoint.getArgs();
if (methodArgs != null && methodArgs.length > 0) {
beforeValue = methodArgs[0];
@ -44,6 +47,7 @@ public class DeviceStateChangeAspect {
String className = joinPoint.getSignature().getDeclaringType().getName(); // 获取类名
String methodName = joinPoint.getSignature().getName();
Object[] methodArgs = joinPoint.getArgs();
System.out.println(joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
if (methodArgs != null && methodArgs.length > 0) {
// 保存修改后的值
Object afterValue = methodArgs[0];

3
src/main/java/com/iflytop/sgs/app/model/bo/status/device/SolutionModuleState.java

@ -24,4 +24,7 @@ public class SolutionModuleState {
@Schema(description = "电磁阀状态")
private ValveState valveState;
}
Loading…
Cancel
Save