diff --git a/src/main/java/a8k/base_hardware/A8kCanBusService.java b/src/main/java/a8k/base_hardware/A8kCanBusService.java index 033ee1a..7c4c366 100644 --- a/src/main/java/a8k/base_hardware/A8kCanBusService.java +++ b/src/main/java/a8k/base_hardware/A8kCanBusService.java @@ -149,49 +149,45 @@ public class A8kCanBusService { } - //TODO public A8kPacket callcmd(Integer moduleId, Integer cmdId) throws HardwareException { - return null; + return this.callcmd(moduleId, cmdId, new Integer[]{}); } - //TODO public A8kPacket callcmd(Integer moduleId, Integer cmdId, Integer p0) throws HardwareException { - return null; + return this.callcmd(moduleId, cmdId, new Integer[]{p0}); } - //TODO public A8kPacket callcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1) throws HardwareException { - return null; + return this.callcmd(moduleId, cmdId, new Integer[]{p0, p1}); } - //TODO public A8kPacket callcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1, Integer p2) throws HardwareException { - return null; + return this.callcmd(moduleId, cmdId, new Integer[]{p0, p1, p2}); } - //TODO public A8kPacket callcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1, Integer p2, Integer p3) throws HardwareException { - return null; + return this.callcmd(moduleId, cmdId, new Integer[]{p0, p1, p2, p3}); } - //TODO public void callblockcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1, Integer p2, Integer p3, Integer acitionOvertime) throws HardwareException, InterruptedException { + this.callblockcmd(moduleId, cmdId, new Integer[]{p0,p1,p2,p3}, acitionOvertime); } - //TODO public void callblockcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1, Integer p2, Integer acitionOvertime) throws HardwareException, InterruptedException { + this.callblockcmd(moduleId, cmdId, new Integer[]{p0,p1,p2}, acitionOvertime); } - //TODO public void callblockcmd(Integer moduleId, Integer cmdId, Integer p0, Integer p1, Integer acitionOvertime) throws HardwareException, InterruptedException { + this.callblockcmd(moduleId, cmdId, new Integer[]{p0,p1}, acitionOvertime); } - //TODO public void callblockcmd(Integer moduleId, Integer cmdId, Integer p0, Integer acitionOvertime) throws HardwareException, InterruptedException { + this.callblockcmd(moduleId, cmdId, new Integer[]{p0}, acitionOvertime); } //TODO public void callblockcmd(Integer moduleId, Integer cmdId, Integer acitionOvertime) throws HardwareException, InterruptedException { + this.callblockcmd(moduleId, cmdId, new Integer[]{}, acitionOvertime); } //TODO diff --git a/src/main/java/a8k/controller/SamplesPreProcessModuleCtrlController.java b/src/main/java/a8k/controller/SamplesPreProcessModuleCtrlController.java new file mode 100644 index 0000000..b307087 --- /dev/null +++ b/src/main/java/a8k/controller/SamplesPreProcessModuleCtrlController.java @@ -0,0 +1,27 @@ +package a8k.controller; +import a8k.service.hardware.SamplesPreProcessModuleCtrlService; +import com.iflytop.uf.controller.UfApiControllerBase; +import com.iflytop.uf.controller.UfApiResponse; +import com.iflytop.uf.util.UfClassHelper; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import java.util.List; +import java.util.Map; +@Controller +public class SamplesPreProcessModuleCtrlController extends UfApiControllerBase { + @Resource + private SamplesPreProcessModuleCtrlService samplesPreProcessModuleCtrlService; + + @PostMapping("/api/sample-pre-process-module-ctrl/execute-service-method") + @ResponseBody + public UfApiResponse executeServiceMethod( @RequestBody Map params ) throws NoSuchMethodException { + Object service = this.samplesPreProcessModuleCtrlService; + String methodName = (String)params.get("method"); + List methodArgs = (List)params.get("params"); + Object result = UfClassHelper.invokeMethod(service, methodName, methodArgs); + return this.success(result); + } +} diff --git a/src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java b/src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java index d9cc057..df790cf 100644 --- a/src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java +++ b/src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java @@ -362,14 +362,14 @@ public class SamplesPreProcessModuleCtrlService { */ public void openAerosolFan() throws HardwareException { var params = this.samplesPreProcessModuleCtrlParamsService; - this.a8kCanBusService.callcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to_zero, params.getAerosolFanLevel()); + this.a8kCanBusService.callcmd(ModuleId.WbTubeFanModule, CmdId.kfan_controler_set_speed, params.getAerosolFanLevel()); } /** * 关闭气溶胶风扇 */ public void closeAerosolFan() throws HardwareException { - this.a8kCanBusService.callcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to_zero, 0); + this.a8kCanBusService.callcmd(ModuleId.WbTubeFanModule, CmdId.kfan_controler_set_speed, 0); } /**