9 changed files with 20 additions and 335 deletions
-
BINapp.db
-
3src/main/java/a8k/appbean/ecode/AppRet.java
-
7src/main/java/a8k/controller/HbotControlController.java
-
51src/main/java/a8k/controller/MotorTubeRackMoveCtrlController.java
-
52src/main/java/a8k/controller/SamplesPreProcessModuleCtrlController.java
-
70src/main/java/a8k/controller/TmpTestController.java
-
1src/main/java/a8k/service/ctrl_service/DeviceInitializationCtrlService.java
-
138src/main/java/a8k/service/db/dao/SamplesPreProcessModuleCtrlParamsService.java
-
33src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java
@ -1,7 +0,0 @@ |
|||||
package a8k.controller; |
|
||||
import com.iflytop.uf.controller.UfApiControllerBase; |
|
||||
import org.springframework.stereotype.Controller; |
|
||||
@Controller |
|
||||
public class HbotControlController extends UfApiControllerBase { |
|
||||
|
|
||||
} |
|
@ -1,51 +0,0 @@ |
|||||
package a8k.controller; |
|
||||
import a8k.service.db.dao.MotorTubeRackMoveCtrlServiceParameterDao; |
|
||||
import a8k.service.hardware.MotorTubeRackMoveCtrlService; |
|
||||
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.lang.reflect.InvocationTargetException; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
@Controller |
|
||||
public class MotorTubeRackMoveCtrlController extends UfApiControllerBase { |
|
||||
@Resource |
|
||||
private MotorTubeRackMoveCtrlService motorTubeRackMoveCtrlService; |
|
||||
@Resource |
|
||||
private MotorTubeRackMoveCtrlServiceParameterDao motorTubeRackMoveCtrlServiceParameterDao; |
|
||||
|
|
||||
@PostMapping("/api/motor-tube-rack-move-ctrl/execute-service-method") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse executeServiceMethod( @RequestBody Map<String,Object> params ) throws Throwable { |
|
||||
Object service = this.motorTubeRackMoveCtrlService; |
|
||||
String methodName = (String)params.get("method"); |
|
||||
List<Object> methodArgs = (List<Object>)params.get("params"); |
|
||||
Object result = UfClassHelper.invokeMethod(service, methodName, methodArgs); |
|
||||
return this.success(result); |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/motor-tube-rack-move-ctrl/list-options") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse listAllOptions() throws NoSuchMethodException { |
|
||||
var list = this.motorTubeRackMoveCtrlServiceParameterDao.listOptions(); |
|
||||
return this.success(list); |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/motor-tube-rack-move-ctrl/update-options") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse updateOptions(@RequestBody Map<String,Object> params ) throws Exception { |
|
||||
var options = (List<Map<String,Object>>)params.get("options"); |
|
||||
for (Map<String,Object> item : options) { |
|
||||
var name = (String)item.get("name"); |
|
||||
var option = this.motorTubeRackMoveCtrlServiceParameterDao.getOption(name); |
|
||||
option.setValue(item.get("value")); |
|
||||
option.save(); |
|
||||
} |
|
||||
return this.success(); |
|
||||
} |
|
||||
} |
|
@ -1,52 +0,0 @@ |
|||||
package a8k.controller; |
|
||||
import a8k.appbean.HardwareException; |
|
||||
import a8k.service.db.dao.SamplesPreProcessModuleCtrlParamsService; |
|
||||
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.lang.reflect.InvocationTargetException; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
@Controller |
|
||||
public class SamplesPreProcessModuleCtrlController extends UfApiControllerBase { |
|
||||
@Resource |
|
||||
private SamplesPreProcessModuleCtrlService samplesPreProcessModuleCtrlService; |
|
||||
@Resource |
|
||||
private SamplesPreProcessModuleCtrlParamsService samplesPreProcessModuleCtrlParamsService; |
|
||||
|
|
||||
@PostMapping("/api/sample-pre-process-module-ctrl/execute-service-method") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse executeServiceMethod( @RequestBody Map<String,Object> params ) throws Throwable { |
|
||||
Object service = this.samplesPreProcessModuleCtrlService; |
|
||||
String methodName = (String)params.get("method"); |
|
||||
List<Object> methodArgs = (List<Object>)params.get("params"); |
|
||||
Object result = UfClassHelper.invokeMethod(service, methodName, methodArgs); |
|
||||
return this.success(result); |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/sample-pre-process-module-ctrl/list-options") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse listAllOptions() throws NoSuchMethodException { |
|
||||
var list = this.samplesPreProcessModuleCtrlParamsService.listOptions(); |
|
||||
return this.success(list); |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/sample-pre-process-module-ctrl/update-options") |
|
||||
@ResponseBody |
|
||||
public UfApiResponse updateOptions(@RequestBody Map<String,Object> params ) throws Exception { |
|
||||
var options = (List<Map<String,Object>>)params.get("options"); |
|
||||
for (Map<String,Object> item : options) { |
|
||||
var name = (String)item.get("name"); |
|
||||
var option = this.samplesPreProcessModuleCtrlParamsService.getOption(name); |
|
||||
option.setValue(item.get("value")); |
|
||||
option.save(); |
|
||||
} |
|
||||
return this.success(); |
|
||||
} |
|
||||
} |
|
@ -1,70 +0,0 @@ |
|||||
package a8k.controller; |
|
||||
|
|
||||
import a8k.a8k_can_protocol.CmdId; |
|
||||
import a8k.a8k_can_protocol.MId; |
|
||||
import a8k.appbean.HardwareException; |
|
||||
import a8k.appbean.ecode.AppRet; |
|
||||
import a8k.base_hardware.A8kCanBusService; |
|
||||
import a8k.service.A8kDebugTaskExecutorService; |
|
||||
import a8k.service.ctrl_service.DeviceInitializationCtrlService; |
|
||||
import a8k.service.hardware.MotorTubeRackMoveCtrlService; |
|
||||
import com.iflytop.uf.util.UfClassHelper; |
|
||||
import jakarta.annotation.Resource; |
|
||||
import org.springframework.stereotype.Controller; |
|
||||
import org.springframework.web.bind.annotation.GetMapping; |
|
||||
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 TmpTestController { |
|
||||
@Resource |
|
||||
private A8kCanBusService a8kCanBusService; |
|
||||
@Resource |
|
||||
private MotorTubeRackMoveCtrlService motorTubeRackMoveCtrlService; |
|
||||
@Resource |
|
||||
private A8kDebugTaskExecutorService a8kDebugTaskExecutorService; |
|
||||
|
|
||||
@Resource |
|
||||
private DeviceInitializationCtrlService deviceInitializationCtrlService; |
|
||||
|
|
||||
@PostMapping("/api/tmp-test/execute-service-method") |
|
||||
@ResponseBody |
|
||||
public String executeServiceMethod(@RequestBody Map<String, Object> params) throws Throwable { |
|
||||
Object service = this.motorTubeRackMoveCtrlService; |
|
||||
String methodName = (String) params.get("method"); |
|
||||
List<Object> methodArgs = (List<Object>) params.get("params"); |
|
||||
Object result = UfClassHelper.invokeMethod(service, methodName, methodArgs); |
|
||||
return "OK"; |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/tmp-test/update-service-params") |
|
||||
@ResponseBody |
|
||||
public String updateServiceParams(@RequestBody Map<String, Object> params) { |
|
||||
return "OK"; |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/tmp-test/get-service-params") |
|
||||
@ResponseBody |
|
||||
public String getServiceParams() { |
|
||||
return "OK"; |
|
||||
} |
|
||||
|
|
||||
@GetMapping("/tmp-test/a8k-can-bus-service-call") |
|
||||
@ResponseBody |
|
||||
public String a8kCanBusServiceCall() throws HardwareException, InterruptedException { |
|
||||
this.a8kCanBusService.callcmd(MId.ShakeModTubeScanerRotateSV.toInt(), CmdId.mini_servo_enable.toInt(), new Integer[]{1}); |
|
||||
this.a8kCanBusService.callblockcmd(MId.FeedingModInfeedM.toInt(), CmdId.step_motor_easy_move_by.toInt(), new Integer[]{5000}, 20000); |
|
||||
return "OK"; |
|
||||
} |
|
||||
|
|
||||
@PostMapping("/api/zhaohe_test/initialize_device") |
|
||||
@ResponseBody |
|
||||
public AppRet initialize_device() throws HardwareException, InterruptedException { |
|
||||
return deviceInitializationCtrlService.initializeDevice(); |
|
||||
// return "OK"; |
|
||||
} |
|
||||
} |
|
@ -1,138 +0,0 @@ |
|||||
package a8k.service.db.dao; |
|
||||
|
|
||||
import a8k.service.db.entity.HardwareServiceSetting; |
|
||||
import a8k.service.hardware.SamplesPreProcessModuleCtrlService; |
|
||||
import a8k.utils.HardwareServiceParam; |
|
||||
import a8k.utils.HardwareServiceParams; |
|
||||
import com.iflytop.uf.UfActiveRecord; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
import java.util.List; |
|
||||
import java.util.Map; |
|
||||
/** |
|
||||
* 样本预处理相关参数访问 |
|
||||
*/ |
|
||||
@Component |
|
||||
@HardwareServiceParams(service=SamplesPreProcessModuleCtrlService.class) |
|
||||
public class SamplesPreProcessModuleCtrlParamsService { |
|
||||
|
|
||||
/** |
|
||||
* 参数存放在HardwareServiceSetting中, |
|
||||
* 每个参数,依赖于Key+serviceName进行索引 |
|
||||
*/ |
|
||||
public final String serviceName = "SamplesPreProcessModuleCtrlService"; |
|
||||
|
|
||||
@HardwareServiceParam(name="回零超时时间") |
|
||||
public int getMoveToZeroOvertime() { |
|
||||
// 索引为 "SamplesPreProcessModuleCtrlService" "MoveToZeroOvertime" |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "MoveToZeroOvertime", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="执行动作的超时时间") |
|
||||
public int getActionOvertime() { |
|
||||
// 索引为 "SamplesPreProcessModuleCtrlService" "MoveToZeroOvertime" |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ActionOvertime", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="5ML全血试管取试管位置", group="升降电机") |
|
||||
public int getZMotor_HighBloodTakeTubeHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_HighBloodTakeTubeHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="3ML全血试管取试管位置", group="升降电机") |
|
||||
public int getZMotor_ShortBloodTakeTubeHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_ShortBloodTakeTubeHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="5ML全血试管取帽位置", group="升降电机") |
|
||||
public int getZMotor_HighBloodTakeCapHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_HighBloodTakeCapHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="3ML全血试管取帽位置", group="升降电机") |
|
||||
public int getZMotor_ShortBloodTakeCapHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_ShortBloodTakeCapHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="5ML全血试管帽子判断位置", group="升降电机") |
|
||||
public int getZMotor_HighBloodCapJudgeHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_HighBloodCapJudgeHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="3ML全血试管帽子判断位置", group="升降电机") |
|
||||
public int getZMotor_ShortBloodCapJudgeHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_ShortBloodCapJudgeHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="摇匀位放置高度", group="升降电机") |
|
||||
public int getZMotor_placeShakeHeight() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ZMotor_placeShakeHeight", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="待机位置", group="水平移动电机") |
|
||||
public int getHorizontalMotor_standbyPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "HorizontalMotor_standbyPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="取帽位置", group="水平移动电机") |
|
||||
public int getHorizontalMotor_takeCapPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "HorizontalMotor_takeCapPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="放帽位置", group="水平移动电机") |
|
||||
public int getHorizontalMotor_takePushCapPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "HorizontalMotor_takePushCapPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="待机位置", group="抓手舵机") |
|
||||
public int getGripperServo_standbyPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "GripperServo_standbyPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="取帽扭矩", group="抓手舵机") |
|
||||
public int getGripperServo_takeCapTorque() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "GripperServo_takeCapTorque", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="取试管位置", group="抓手舵机") |
|
||||
public int getGripperServo_takeTubePos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "GripperServo_takeTubePos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="判断是否有帽子的位置阈值", group="抓手舵机") |
|
||||
public int getGripperServo_hatDeterminesPosThres() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "GripperServo_hatDeterminesPosThres", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="待机位置", group="摇匀电机") |
|
||||
public int getShakeMotor_standbyPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ShakeMotor_standbyPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="摇匀角度", group="摇匀电机") |
|
||||
public int getShakeMotor_shakeDegree() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "ShakeMotor_shakeDegree", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="待机位置", group="试管夹紧电机") |
|
||||
public int getTubeClampMotor_standbyPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "TubeClampMotor_standbyPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="夹紧位置", group="试管夹紧电机") |
|
||||
public int getTubeClampMotor_ClampPos() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "TubeClampMotor_ClampPos", 0); |
|
||||
} |
|
||||
|
|
||||
@HardwareServiceParam(name="气溶胶风扇风力大小") |
|
||||
public int getAerosolFanLevel() { |
|
||||
return HardwareServiceSetting.getInteger(this.serviceName, "AerosolFanLevel", 100); |
|
||||
} |
|
||||
|
|
||||
public List<HardwareServiceSetting> listOptions() { |
|
||||
return UfActiveRecord.find(HardwareServiceSetting.class, Map.of("serviceName", this.serviceName)); |
|
||||
} |
|
||||
|
|
||||
public HardwareServiceSetting getOption(String optionName) { |
|
||||
return HardwareServiceSetting.getOption(this.serviceName, optionName); |
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue