sige 1 year ago
parent
commit
63dc3ed9ae
  1. 9
      src/main/java/a8k/A8kApplication.java
  2. 36
      src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java

9
src/main/java/a8k/A8kApplication.java

@ -2,8 +2,6 @@ package a8k;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@ControllerAdvice
@ -11,9 +9,14 @@ public class A8kApplication {
@ResponseBody
@ExceptionHandler(value=Exception.class)
public Map<String,Object> controllerExceptionHandler(Exception e){
StringBuilder traceSb = new StringBuilder();
for ( var trace : e.getStackTrace() ) {
traceSb.append(trace.toString()).append("\n");
}
String trace = traceSb.toString();
Map<String,Object> map = new HashMap<>();
map.put("success",false);
map.put("message",String.format("%s\n\nStack Trace : \n%s",e.getMessage(), Arrays.toString(e.getStackTrace())));
map.put("message",String.format("%s\n\nStack Trace : \n%s",e.getMessage(), trace));
map.put("data", null);
return map;
}

36
src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java

@ -8,6 +8,7 @@ import a8k.appbean.HardwareException;
import a8k.base_hardware.A8kCanBusService;
import a8k.service.db.dao.A8kTubeInfoDao;
import a8k.service.db.dao.SamplesPreProcessModuleCtrlParamsService;
import com.iflytop.uf.util.UfCommon;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
@ -119,11 +120,11 @@ public class SamplesPreProcessModuleCtrlService {
* @param tubeType TubeType_HighBlood,TubeType_ShortBlood,TubeType_Mini,TubeType_MiniBlood,TubeType_BulletTube1P5,TubeType_BulletTube0P5
* @param judgeCapExist 是否判断试管帽子存在与否
*/
public A8kEcode takeTube(String tubeType,boolean judgeCapExist) throws HardwareException, InterruptedException {
public A8kEcode takeTube(String tubeType, Boolean judgeCapExist) throws HardwareException, InterruptedException {
var params = this.samplesPreProcessModuleCtrlParamsService;
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperYM.toInt(),
CmdId.step_motor_easy_move_to.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getHorizontalMotor_takeCapPos(),
params.getActionOvertime()
);
@ -160,12 +161,12 @@ public class SamplesPreProcessModuleCtrlService {
}
}
this.a8kCanBusService.callblockcmd(
this.a8kCanBusService.callcmd(
MId.ShakeModGripperSV.toInt(),
CmdId.mini_servo_rotate_with_torque.toInt(),
params.getGripperServo_takeCapTorque(),
params.getActionOvertime()
params.getGripperServo_takeCapTorque()
);
UfCommon.delay(2000);
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperZM.toInt(),
@ -189,8 +190,15 @@ public class SamplesPreProcessModuleCtrlService {
);
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperSV.toInt(),
MId.ShakeModClampingM.toInt(),
CmdId.step_motor_easy_move_to.toInt(),
params.getTubeClampMotor_ClampPos(),
params.getActionOvertime()
);
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperSV.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getGripperServo_standbyPos(),
params.getActionOvertime()
);
@ -204,7 +212,7 @@ public class SamplesPreProcessModuleCtrlService {
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperYM.toInt(),
CmdId.step_motor_easy_move_to.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getHorizontalMotor_standbyPos(),
params.getActionOvertime()
);
@ -377,7 +385,8 @@ public class SamplesPreProcessModuleCtrlService {
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperSV.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getTubeClampMotor_standbyPos()
params.getGripperServo_standbyPos(),
params.getActionOvertime()
);
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperZM.toInt(),
@ -400,6 +409,10 @@ public class SamplesPreProcessModuleCtrlService {
CmdId.step_motor_easy_move_to_zero.toInt(),
params.getMoveToZeroOvertime()
);
this.a8kCanBusService.stepMotorEasyMoveTo(MId.ShakeModClampingM, params.getTubeClampMotor_standbyPos());
this.a8kCanBusService.waitForMod(MId.ShakeModClampingM, params.getActionOvertime());
this.a8kCanBusService.stepMotorEasyMoveTo(MId.ShakeModShakeM, params.getShakeMotor_standbyPos());
this.a8kCanBusService.waitForMod(MId.ShakeModShakeM, params.getActionOvertime());
}
/**
@ -410,7 +423,8 @@ public class SamplesPreProcessModuleCtrlService {
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperSV.toInt(),
CmdId.mini_servo_move_to.toInt(),
params.getTubeClampMotor_standbyPos()
params.getGripperServo_standbyPos(),
params.getActionOvertime()
);
this.a8kCanBusService.callblockcmd(
MId.ShakeModGripperZM.toInt(),
@ -451,5 +465,9 @@ public class SamplesPreProcessModuleCtrlService {
CmdId.step_motor_easy_move_to_zero.toInt(),
params.getMoveToZeroOvertime()
);
this.a8kCanBusService.stepMotorEasyMoveTo(MId.ShakeModClampingM, params.getTubeClampMotor_standbyPos());
this.a8kCanBusService.waitForMod(MId.ShakeModClampingM, params.getActionOvertime());
this.a8kCanBusService.stepMotorEasyMoveTo(MId.ShakeModShakeM, params.getShakeMotor_standbyPos());
this.a8kCanBusService.waitForMod(MId.ShakeModShakeM, params.getActionOvertime());
}
}
Loading…
Cancel
Save