sige 1 year ago
parent
commit
345c617c33
  1. 36
      src/main/java/a8k/service/db/dao/A8KGeneralConsumablesPropertyDao.java
  2. 59
      src/main/java/a8k/service/db/dao/A8kDirectCtrlPosDao.java
  3. 17
      src/main/java/a8k/service/db/dao/ModulerParameterDao.java
  4. 13
      src/main/java/a8k/service/db/dao/MotorTubeRackMoveCtrlServiceParameterDao.java
  5. 27
      src/main/java/a8k/service/db/entity/A8kDirectCtrlPos.java
  6. 20
      src/main/java/a8k/service/db/entity/A8kGeneralConsumablesProperty.java
  7. 10
      src/main/java/a8k/service/db/entity/A8kTubeInfo.java
  8. 34
      src/main/java/a8k/service/db/entity/ModuleParameter.java
  9. 40
      src/main/java/a8k/service/db/entity/MotorTubeRackMoveCtrlServiceParameter.java
  10. 108
      src/main/java/a8k/service/hardware/MotorTubeRackMoveCtrlService.java
  11. 11
      src/main/java/a8k/service/hardware/SamplesPreProcessModuleCtrlService.java

36
src/main/java/a8k/service/db/dao/A8KGeneralConsumablesPropertyDao.java

@ -1,36 +0,0 @@
package a8k.service.db.dao;
import a8k.service.db.entity.A8kGeneralConsumablesProperty;
import com.iflytop.uf.UfActiveRecord;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 用于存储耗材的一些属性信息
*/
@Component
public class A8KGeneralConsumablesPropertyDao {
public float getValAsFloat(String propertyKey) {
A8kGeneralConsumablesProperty val = UfActiveRecord.findOne(A8kGeneralConsumablesProperty.class, Map.of("propertyKey", propertyKey));
assert val != null;
return Float.parseFloat(val.val);
}
public int getValAsInt(String propertyKey) {
A8kGeneralConsumablesProperty val = UfActiveRecord.findOne(A8kGeneralConsumablesProperty.class, Map.of("propertyKey", propertyKey));
assert val != null;
return Integer.parseInt(val.val);
}
public String getValAsString(String propertyKey) {
A8kGeneralConsumablesProperty val = UfActiveRecord.findOne(A8kGeneralConsumablesProperty.class, Map.of("propertyKey", propertyKey));
assert val != null;
return val.val;
}
}

59
src/main/java/a8k/service/db/dao/A8kDirectCtrlPosDao.java

@ -1,59 +0,0 @@
package a8k.service.db.dao;
import a8k.appbean.PosBean;
import a8k.service.db.entity.A8kDirectCtrlPos;
import com.iflytop.uf.UfActiveRecord;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
*
* 用于设备运行中的关键位置信息
*
*
*/
@Component
public class A8kDirectCtrlPosDao {
//
// 试管架移动相关坐标
// 1.零点参考点为零点光电
// 2.移动坐标参考点为从左往右数第一个试管
// 3.正方向为执行机构的正方向
//
public static final String MotorTubeRackMotor_tubeScanPos = "MotorTubeRackMotor_tubeScanPos"; //扫码位置
public static final String MotorTubeRackMotor_tubeHeighJudgmentPos = "MotorTubeRackMotor_tubeHeighJudgmentPos"; //高低试管判断位置
public static final String MotorTubeRackMotor_tubePreProcessPos = "MotorTubeRackMotor_tubePreProcessPos"; //试管预处理位置
public static final String MotorTubeRackMotor_tubeExistJudgmentPos = "MotorTubeRackMotor_tubeExistJudgmentPos";//试管有无
public static final String MotorTubeRackMotor_tubeRackEnterPos = "MotorTubeRackMotor_tubeRackEnterPos"; //入料位置
public static final String MotorTubeRackMotor_tubeRackExitPos = "MotorTubeRackMotor_tubeRackExitPos"; //出料位置
public static final String MotorTubeRackMotor_tubeRackScanCodePos = "MotorTubeRackMotor_tubeRackScanCodePos"; //出料位置
//
// 试管扫码夹紧模块
//
public static final String MotorTubeScanClampModule_clampPos = "MotorTubeScanClampModule_clampPos";//试管扫码夹紧模组 夹紧位置
public static final String MotorTubeScanClampModule_releasePos = "MotorTubeScanClampModule_releasePos";//试管扫码夹紧模组 释放位置
//
// 试管预处理模块
//
PosBean getPosBean(String posName) {
A8kDirectCtrlPos pos = UfActiveRecord.findOne(A8kDirectCtrlPos.class, Map.of("posName", posName));
assert pos != null;
return new PosBean(pos.posX, pos.posY, pos.posZ);
}
public A8kDirectCtrlPos getPos(String posName) {
A8kDirectCtrlPos pos = UfActiveRecord.findOne(A8kDirectCtrlPos.class, Map.of("posName", posName));
assert pos != null;
return pos;
}
}

17
src/main/java/a8k/service/db/dao/ModulerParameterDao.java

@ -1,17 +0,0 @@
package a8k.service.db.dao;
import a8k.service.db.entity.ModuleParameter;
import com.iflytop.uf.UfActiveRecord;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class ModulerParameterDao {
ModuleParameter getMotorParameter(int mid) {
var param = UfActiveRecord.findOne(ModuleParameter.class, Map.of("mid", mid));
assert param != null;
return param;
}
}

13
src/main/java/a8k/service/db/dao/MotorTubeRackMoveCtrlServiceParameterDao.java

@ -0,0 +1,13 @@
package a8k.service.db.dao;
import a8k.service.db.entity.MotorTubeRackMoveCtrlServiceParameter;
import org.springframework.stereotype.Component;
@Component
public class MotorTubeRackMoveCtrlServiceParameterDao {
public MotorTubeRackMoveCtrlServiceParameter getParameter() {
//TODO:
return null;
}
}

27
src/main/java/a8k/service/db/entity/A8kDirectCtrlPos.java

@ -1,27 +0,0 @@
package a8k.service.db.entity;
import com.iflytop.uf.UfActiveRecord;
import com.iflytop.uf.UfActiveRecordField;
/**
* A8kDirectCtrlPos
*/
public class A8kDirectCtrlPos extends UfActiveRecord {
@UfActiveRecordField
public String posName; //位置名称
@UfActiveRecordField
public Integer mid;//模块ID
@UfActiveRecordField
public String midName; //模块ID
@UfActiveRecordField
public Integer posX; //位置X如果只有一个位置则使用位置X
@UfActiveRecordField
public Integer posY; //位置Y如果有两个位置则使用位置X,Y
@UfActiveRecordField
public Integer posZ; //位置Z如果有三个位置则使用位置X,YZ
public static String getTableName() {
return "A8kDirectCtrlPos" + "Table";
}
}

20
src/main/java/a8k/service/db/entity/A8kGeneralConsumablesProperty.java

@ -1,20 +0,0 @@
package a8k.service.db.entity;
import com.iflytop.uf.UfActiveRecord;
import com.iflytop.uf.UfActiveRecordField;
/**
* A8kDirectCtrlPos
*/
public class A8kGeneralConsumablesProperty extends UfActiveRecord {
@UfActiveRecordField
public String propertyKey;
@UfActiveRecordField
public String val;
public static String getTableName() {
return "A8kGeneralConsumablesProperty" + "Table";
}
}

10
src/main/java/a8k/service/db/entity/A8kTubeInfo.java

@ -13,23 +13,21 @@ public class A8kTubeInfo extends UfActiveRecord {
@UfActiveRecordField
public String scanCode;//试管对应的编码
@UfActiveRecordField
public Integer tubeNum; //试管数量
@UfActiveRecordField
public Double tubeSpacing; //试管之间的间隔 单位mm
public Integer tubeSpacing; //试管之间的间隔 单位0.1mm
/**
* 摇匀模组使用
*/
@UfActiveRecordField
public Double takeTubeCapPos;//float mm 取试管帽高度
public Integer takeTubeCapPos;// 0.1mm 取试管帽高度
/**
* Z轴使用
*/
@UfActiveRecordField
public Double sampleBeginPos;//float mm 取样高度
public Integer sampleBeginPos;// 0.1mm 取样高度
@UfActiveRecordField
public Double sampleEndPos;//float mm 取样低位
public Integer sampleEndPos;//0.1mm 取样低位
public static String getTableName() {
return "A8kTubeInfo" + "Table";

34
src/main/java/a8k/service/db/entity/ModuleParameter.java

@ -1,34 +0,0 @@
package a8k.service.db.entity;
import com.iflytop.uf.UfActiveRecord;
import com.iflytop.uf.UfActiveRecordField;
public class ModuleParameter extends UfActiveRecord {
@UfActiveRecordField
Integer mid; //模块ID
@UfActiveRecordField
String moduleName; //模块名称
@UfActiveRecordField
Integer zeroPosOff; //零点偏移
@UfActiveRecordField
public Integer moveToZeroOvertime;// 回零超时时间
@UfActiveRecordField
public Integer actionOvertime;// 执行动作的超时时间该超时时间适用于当前模块在当前产品中所有动作的最大时间
@UfActiveRecordField
Integer defaultVelocity; //默认速度
@UfActiveRecordField
Integer backToZeroVelocity; //回零速度
@UfActiveRecordField
public Integer loseStepWarningJudgeDistance; //丢步异常警告距离
public static String getTableName() {
return "MotorParameter" + "Table";
}
}

40
src/main/java/a8k/service/db/entity/MotorTubeRackMoveCtrlServiceParameter.java

@ -0,0 +1,40 @@
package a8k.service.db.entity;
import com.iflytop.uf.UfActiveRecord;
import com.iflytop.uf.UfActiveRecordField;
public class MotorTubeRackMoveCtrlServiceParameter {
@UfActiveRecordField
Integer moveToZeroOvertime;// 回零超时时间
@UfActiveRecordField
public Integer actionOvertime;// 执行动作的超时时间该超时时间适用于当前模块在当前产品中所有动作的最大时间
@UfActiveRecordField
public Integer tubeScanPos; //试管扫码位置
@UfActiveRecordField
public Integer tubeHeighJudgmentPos; //高低试管判断位置
@UfActiveRecordField
public Integer tubePreProcessPos; //试管预处理位置
@UfActiveRecordField
public Integer tubeExistJudgmentPos; //入料位置
@UfActiveRecordField
public Integer tubeRackEnterPos; //出料位置
@UfActiveRecordField
public Integer tubeRackExitPos; //出料位置
@UfActiveRecordField
public Integer tubeRackScanCodePos; //试管架扫码位置
@UfActiveRecordField
Integer horizontalMotorOffset; //水平移动电机位置偏移
public static String getTableName() {
return "MotorTubeRackMoveCtrlServiceParameter" + "Table";
}
}

108
src/main/java/a8k/service/hardware/MotorTubeRackMoveCtrlService.java

@ -7,16 +7,13 @@ import a8k.appbean.HardwareException;
import a8k.base_hardware.A8kCanBusService;
import a8k.service.db.dao.A8kDirectCtrlPosDao;
import a8k.service.db.dao.A8kTubeInfoDao;
import a8k.service.db.dao.MotorTubeRackMoveCtrlServiceParameterDao;
import a8k.service.db.dao.MotorParameterDao;
import a8k.service.db.entity.A8kDirectCtrlPos;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class MotorTubeRackMoveCtrlService {
private static final Integer MOVE_TO_ZERO_MAX_DPOS = 10;
/**
*
* 主要用来控制试管架的平移动作控制
@ -42,14 +39,17 @@ public class MotorTubeRackMoveCtrlService {
// MotorTubeScanClampModule_clampPos
// MotorTubeScanClampModule_releasePos
@Autowired
A8kDirectCtrlPosDao directCtrlPosTableDao;
@Autowired
A8kTubeInfoDao tubeInfoDao;
@Autowired
MotorParameterDao motorParameterDao;
@Resource
private A8kCanBusService a8kCanBusService;
@Resource
MotorTubeRackMoveCtrlServiceParameterDao serviceParameterDao;
//
@ -62,8 +62,6 @@ public class MotorTubeRackMoveCtrlService {
public void moveToZero() throws HardwareException, InterruptedException {
var motorParams = this.motorParameterDao.getMotorParameter(ModuleId.MotorTubeRackMoveModule);
var beforePosResponse = this.a8kCanBusService.callcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_read_pos, new Integer[]{0});
var beforePos = beforePosResponse.getContentI32(0);
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to_zero, new Integer[]{}, motorParams.moveToZeroOvertime);
@ -96,24 +94,24 @@ public class MotorTubeRackMoveCtrlService {
* 移动试管架到入口位置
*/
public void moveTubeRackToEnterPos() throws HardwareException, InterruptedException {
var pos = this.directCtrlPosTableDao.getPos(A8kDirectCtrlPosDao.MotorTubeRackMotor_tubeRackEnterPos);
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{pos.posX}, 30*1000);
var params = this.serviceParameterDao.getParameter();
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{params.tubeRackEnterPos}, params.actionOvertime);
}
/**
* 移动试管架到出口位置
*/
public void moveTubeRackToExitPos() throws HardwareException, InterruptedException {
var pos = this.directCtrlPosTableDao.getPos(A8kDirectCtrlPosDao.MotorTubeRackMotor_tubeRackExitPos);
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{pos.posX}, 30*1000);
var params = this.serviceParameterDao.getParameter();
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{params.tubeExistJudgmentPos}, params.actionOvertime);
}
/**
* 移动试管架到试管架扫码位置
*/
public void moveTubeRackToScanPos() throws HardwareException, InterruptedException {
var pos = this.directCtrlPosTableDao.getPos(A8kDirectCtrlPosDao.MotorTubeRackMotor_tubeRackScanCodePos);
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{pos.posX}, 30*1000);
var params = this.serviceParameterDao.getParameter();
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{params.tubeRackScanCodePos}, params.actionOvertime);
}
/**
@ -139,13 +137,11 @@ public class MotorTubeRackMoveCtrlService {
* @param tubeType
* @param tubeIndex
*/
public void moveTubeToScanPos(String tubeType, Integer tubeIndex) {
public void moveTubeToScanPos(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
var tubeInfo = this.tubeInfoDao.getTubeInfo(tubeType);
var startPosInfo = this.directCtrlPosTableDao.getPos(A8kDirectCtrlPosDao.MotorTubeRackMotor_tubeScanPos);
var scanPos = startPosInfo.posX + tubeIndex * tubeInfo.tubeSpacing;
var motorParams = this.motorParameterDao.getMotorParameter(ModuleId.MotorTubeRackMoveModule);
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{scanPos}, motorParams.actionOvertime);
var scanPos = params.tubeScanPos + tubeIndex * tubeInfo.tubeSpacing;
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{scanPos}, params.actionOvertime);
}
/**
@ -153,8 +149,15 @@ public class MotorTubeRackMoveCtrlService {
* @param tubeType
* @param tubeIndex
*/
public String moveTubeToScanPosAndScan(String tubeType, Integer tubeIndex) {
return null;
public String moveTubeToScanPosAndScan(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
this.moveTubeToScanPos(tubeType, tubeIndex);
this.a8kCanBusService.callcmd(ModuleId.TubeRackScannerModule, CmdId.kcode_scaner_start_scan, new Integer[]{});
Thread.sleep(500);
var response = this.a8kCanBusService.callcmd(ModuleId.TubeRackScannerModule, CmdId.kcode_scaner_read_scaner_result, new Integer[]{});
this.a8kCanBusService.callcmd(ModuleId.TubeRackScannerModule, CmdId.kcode_scaner_stop_scan, new Integer[]{});
var contentBytes = response.getCmdContent();
return new String(contentBytes);
}
/**
@ -162,7 +165,11 @@ public class MotorTubeRackMoveCtrlService {
* @param tubeType
* @param tubeIndex
*/
public void moveTubeToHeighJudgmentPos(String tubeType, Integer tubeIndex) {
public void moveTubeToHeighJudgmentPos(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
var tubeInfo = this.tubeInfoDao.getTubeInfo(tubeType);
var detectPos = params.tubeHeighJudgmentPos + tubeIndex * tubeInfo.tubeSpacing;
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{detectPos}, params.actionOvertime);
}
/**
@ -170,7 +177,11 @@ public class MotorTubeRackMoveCtrlService {
* @param tubeType
* @param tubeIndex
*/
public void moveTubeToPreProcessPos(String tubeType, Integer tubeIndex) {
public void moveTubeToPreProcessPos(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
var tubeInfo = this.tubeInfoDao.getTubeInfo(tubeType);
var pos = params.tubePreProcessPos + tubeIndex * tubeInfo.tubeSpacing;
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{pos}, params.actionOvertime);
}
//
@ -182,15 +193,21 @@ public class MotorTubeRackMoveCtrlService {
* @param tubeType
* @param tubeIndex
*/
public void moveTubeToExistJudgmentPos(String tubeType, Integer tubeIndex) {
public void moveTubeToExistJudgmentPos(String tubeType, Integer tubeIndex) throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
var tubeInfo = this.tubeInfoDao.getTubeInfo(tubeType);
var pos = params.tubeRackExitPos + tubeIndex * tubeInfo.tubeSpacing;
this.a8kCanBusService.callblockcmd(ModuleId.MotorTubeRackMoveModule, CmdId.kstep_motor_easy_move_to, new Integer[]{pos}, params.actionOvertime);
}
public boolean isTubeRackExitInEnterPos() {
return false;
public boolean isTubeRackInEnterPos() throws HardwareException {
var response = this.a8kCanBusService.callcmd(ModuleId.FeederBoard, CmdId.kxymotor_read_inio, new Integer[]{3});
return response.getContentI32(0) == 1;
}
public boolean isTubeRackExitInExitPos() {
return false;
public boolean isTubeRackInExitPos() throws HardwareException {
var response = this.a8kCanBusService.callcmd(ModuleId.FeederBoard, CmdId.kxymotor_read_inio, new Integer[]{5});
return response.getContentI32(0) == 1;
}
/**
@ -198,8 +215,10 @@ public class MotorTubeRackMoveCtrlService {
* @param photoelectricIndex 0:里光电1:外光电
* @return true, 光电触发 false,光电没有触发
*/
public boolean getMoveChannelPhotoelectricState(int photoelectricIndex) {
return false;
public boolean getMoveChannelPhotoelectricState(int photoelectricIndex) throws HardwareException {
var index = 0 == photoelectricIndex ? 2 : 1;
var response = this.a8kCanBusService.callcmd(ModuleId.FeederBoard, CmdId.kxymotor_read_inio, new Integer[]{index});
return response.getContentI32(0) == 1;
}
//
@ -207,4 +226,31 @@ public class MotorTubeRackMoveCtrlService {
//
/**
* 扫描夹紧机构夹紧
*/
public void scanClampModuleCompress() throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
this.a8kCanBusService.callblockcmd(
ModuleId.ServoTubeRackTubePushModule,
CmdId.kmini_servo_move_to,
new Integer[]{0},
params.actionOvertime
);
}
/**
* 扫描夹紧机构复位
*/
public void scanClampModuleReset() throws HardwareException, InterruptedException {
var params = this.serviceParameterDao.getParameter();
this.a8kCanBusService.callblockcmd(
ModuleId.ServoTubeRackTubePushModule,
CmdId.kmini_servo_move_to,
new Integer[]{0},
params.actionOvertime
);
}
}

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

@ -4,13 +4,6 @@ import a8k.appbean.SampleTubeState;
public class SamplesPreProcessModuleCtrlService {
/**
* 样品预处理模块
* 主要负责样品预处理的相关操作
@ -22,7 +15,7 @@ public class SamplesPreProcessModuleCtrlService {
* 4.平移电机取试管位置
* 5.平移电机试管处理位置
*
*
*
*/
public void takeTube(String tubeType) {
@ -34,7 +27,7 @@ public class SamplesPreProcessModuleCtrlService {
/**
* 摇匀试管
* @param tubeState
* @param tubeType
* @param times
* @param shakeDegree
*/

Loading…
Cancel
Save