diff --git a/app.db b/app.db index f201695..f739c7f 100644 Binary files a/app.db and b/app.db differ diff --git a/pom.xml b/pom.xml index cecb3d1..0d9adc5 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,18 @@ spring-boot-starter-web + org.springframework.boot + spring-boot-starter-aop + + + org.springframework + spring-aop + + + org.aspectj + aspectjweaver + + org.xerial sqlite-jdbc 3.45.2.0 @@ -57,6 +69,7 @@ lombok annotationProcessor + diff --git a/src/main/java/a8k/BoditechA800Application.java b/src/main/java/a8k/BoditechA800Application.java index ce79558..0cba5bd 100644 --- a/src/main/java/a8k/BoditechA800Application.java +++ b/src/main/java/a8k/BoditechA800Application.java @@ -3,8 +3,10 @@ package a8k; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.EnableAspectJAutoProxy; @SpringBootApplication +@EnableAspectJAutoProxy public class BoditechA800Application { public static void main(String[] args) { SpringApplication.run(BoditechA800Application.class, args); diff --git a/src/main/java/a8k/SpringBootBeanUtil.java b/src/main/java/a8k/SpringBootBeanUtil.java index 6fcd6d4..8eba9ab 100644 --- a/src/main/java/a8k/SpringBootBeanUtil.java +++ b/src/main/java/a8k/SpringBootBeanUtil.java @@ -3,6 +3,7 @@ package a8k; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; +import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Component; import java.io.File; diff --git a/src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java b/src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java index 789d198..8d025d7 100644 --- a/src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java +++ b/src/main/java/a8k/extapi_controler/pagecontrol/ExtApiTabConfig.java @@ -18,11 +18,12 @@ public enum ExtApiTabConfig { TubeFeedingModulePosCalibration("校准.试管入料校准", true), TubePreProcesPosCalibration("校准.试管预处理校准", true), ReactionPlatesTransmitControlerCalibration("校准.反应板相关位置校准", true), + HbotConsumablePosCalibration("校准.耗材位置校准", true), ActionReactorService("底层调试.单步调试", false),//OK Hbot2DCodeScanPos("参数.Hbot二维码扫描坐标参数", false), //底层硬件 - A8kPipetteCtrlModule("A8kPipetteCtrlModule", false), + A8kPipetteCtrlModule("A8kPipetteCtrlModule", true), SampleTransportParam("参数.样本出入料&扫描参数", false), PosParam("PosParam", false), diff --git a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java index 849bdb3..9893251 100644 --- a/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java +++ b/src/main/java/a8k/service/app/devicedriver/calibration/HbotConsumablePosCalibration.java @@ -26,13 +26,17 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.annotation.Resource; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; import org.slf4j.Logger; +import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; import java.util.Map; -@ExtApiTab(cfg = ExtApiTabConfig.Hbot2DCodeScanPosCalibration) +@ExtApiTab(cfg = ExtApiTabConfig.HbotConsumablePosCalibration) @Component +@Aspect public class HbotConsumablePosCalibration { static Logger logger = org.slf4j.LoggerFactory.getLogger(HbotConsumablePosCalibration.class); @@ -71,10 +75,6 @@ public class HbotConsumablePosCalibration { return hbotConsumablePosMgr.getParams(); } - @ExtApiFn(name = "获取所有坐标中文说明", group = "基础", order = 2) - public Object getPossChName() throws AppException { - return hbotConsumablePosMgr.getParamsChName(); - } // 测试工具 @@ -102,12 +102,15 @@ public class HbotConsumablePosCalibration { // @ExtApiFn(name = "标定HBOT坐标", group = "标定", order = 21) - void calibratePos(HbotConsumablePos hbotConsumablePos) throws AppException { + public void calibratePos(HbotConsumablePos hbotConsumablePos) throws AppException { enableModule(); Pos2d xypos = hbotModule.readPos(); pipetteCtrlModule.zMotorMeasureDistance(); Integer z = pipetteCtrlModule.zMotorReadMeasureDistanceResult(); hbotConsumablePosMgr.setParam(hbotConsumablePos, new Pos3d(xypos.x, xypos.y, z)); + if (hbotConsumablePos.ordinal() <= HbotConsumablePos.Tip02_119Pos.ordinal()) { + pipetteCtrlModule.putTipBlock(); + } } @@ -170,4 +173,6 @@ public class HbotConsumablePosCalibration { public void stopTest() throws AppException { setStopFlag(); } + + } diff --git a/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java b/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java index 5f65209..63300b9 100644 --- a/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java +++ b/src/main/java/a8k/service/app/devicedriver/ctrl/HbotControler.java @@ -60,9 +60,9 @@ public class HbotControler { //取tip pipetteCtrlModule.zMotorMoveToBlock(tipPos.z - 100); - if (!pipetteCtrlModule.isHasTip()) { - throw new AppException(A8kEcode.APPE_TAKE_TIP_FAIL); - } +// if (!pipetteCtrlModule.isHasTip()) { +// throw new AppException(A8kEcode.APPE_TAKE_TIP_FAIL); +// } //丢tip pipetteCtrlModule.putTipBlock(); diff --git a/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java b/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java index 5e97e53..fd2f161 100644 --- a/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java +++ b/src/main/java/a8k/service/app/devicedriver/pos/HbotConsumablePosMgr.java @@ -10,12 +10,18 @@ import a8k.type.HbotConsumablePos; import a8k.type.cfg.Pos3d; import a8k.type.type.TipGroup; import a8k.utils.PlaneUtils; +import a8k.utils.ZJsonHelper; +import a8k.utils.ZSqliteJdbcHelper; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import jakarta.annotation.PostConstruct; import jakarta.annotation.Resource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; +import java.util.List; import java.util.Map; /** @@ -31,7 +37,7 @@ public class HbotConsumablePosMgr { LowerDeviceParameterDBService lowerDeviceParameterDBService; PosParameterReader posReader = null; - static Integer nowParaVersion = 0; + static Integer nowParaVersion = 2; @PostConstruct void initialize() { @@ -45,36 +51,46 @@ public class HbotConsumablePosMgr { public void paramReset() { logger.info("init param"); posReader.setVersion(nowParaVersion); - posReader.updatePos(HbotConsumablePos.Tip00_000Pos.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.Tip00_119Pos.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.Tip01_000Pos.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.Tip01_119Pos.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.Tip02_000Pos.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.Tip02_119Pos.name(), new Pos3d(0, 0, 0)); - - posReader.updatePos(HbotConsumablePos.LittleBufferPos00_00.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.LittleBufferPos05_24.name(), new Pos3d(0, 0, 0)); - - posReader.updatePos(HbotConsumablePos.ProbeSubstance00_00.name(), new Pos3d(0, 0, 0)); - posReader.updatePos(HbotConsumablePos.ProbeSubstance05_24.name(), new Pos3d(0, 0, 0)); - } - public Map getParams() { - Map map = new java.util.HashMap<>(); - for (HbotConsumablePos param : HbotConsumablePos.values()) { - map.put(param.name(), posReader.getPos(param.name(), Pos3d.class)); - } - return map; + posReader.updatePos(HbotConsumablePos.Tip00_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip00_011Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip00_108Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip00_119Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip01_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip01_011Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip01_108Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip01_119Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip02_000Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip02_011Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip02_108Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.Tip02_119Pos, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LittleBufferPos00_00, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LittleBufferPos00_24, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LittleBufferPos05_00, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LittleBufferPos05_24, new Pos3d()); + posReader.updatePos(HbotConsumablePos.ProbeSubstance00_00, new Pos3d()); + posReader.updatePos(HbotConsumablePos.ProbeSubstance00_24, new Pos3d()); + posReader.updatePos(HbotConsumablePos.ProbeSubstance05_00, new Pos3d()); + posReader.updatePos(HbotConsumablePos.ProbeSubstance05_24, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LargeBufferPos00, new Pos3d()); + posReader.updatePos(HbotConsumablePos.LargeBufferPos05, new Pos3d()); + + } - public Map getParamsChName() { - Map map = new java.util.HashMap<>(); + public List getParams() { + List list = new java.util.ArrayList<>(); for (HbotConsumablePos param : HbotConsumablePos.values()) { - map.put(param.name(), param.chName); + ObjectNode posNode = ZJsonHelper.createObjectNode(); + posNode.put("pos", ZJsonHelper.createObjectNode(posReader.getPos(param.name(), Pos3d.class))); + posNode.put("name", param.name()); + posNode.put("chName", param.chName); + list.add(posNode); } - return map; + return list; } + public void setParam(HbotConsumablePos param, Pos3d pos) { posReader.updatePos(param.name(), pos); } @@ -109,9 +125,9 @@ public class HbotConsumablePosMgr { assert tip119 != null; //水平方向 - double dx = (tip119.x - tip000.x) / 12.0; + double dx = (tip119.x - tip000.x) / 11.0; //前后方向 - double dy = (tip119.y - tip000.y) / 10.0; + double dy = (tip119.y - tip000.y) / 9.0; int xoff = tipoff % 12; int yoff = tipoff / 12; diff --git a/src/main/java/a8k/type/HbotConsumablePos.java b/src/main/java/a8k/type/HbotConsumablePos.java index 6ce0a1d..04a0602 100644 --- a/src/main/java/a8k/type/HbotConsumablePos.java +++ b/src/main/java/a8k/type/HbotConsumablePos.java @@ -1,36 +1,37 @@ package a8k.type; public enum HbotConsumablePos { - Tip00_000Pos("Tip00_000Pos"), - Tip00_011Pos("Tip00_011Pos"), - Tip00_108Pos("Tip00_108Pos"), - Tip00_119Pos("Tip00_119Pos"), - - Tip01_000Pos("Tip01_000Pos"), - Tip01_011Pos("Tip01_011Pos"), - Tip01_108Pos("Tip01_108Pos"), - Tip01_119Pos("Tip01_119Pos"), - - Tip02_000Pos("Tip02_000Pos"), - Tip02_011Pos("Tip02_011Pos"), - Tip02_108Pos("Tip02_108Pos"), - Tip02_119Pos("Tip02_119Pos"), - - LittleBufferPos00_00("LittleBufferPos00_00"), - LittleBufferPos00_24("LittleBufferPos00_24"), - LittleBufferPos05_00("LittleBufferPos05_00"), - LittleBufferPos05_24("LittleBufferPos05_24"), - - ProbeSubstance00_00("ProbeSubstance00_00"), - ProbeSubstance00_24("ProbeSubstance00_24"), - ProbeSubstance05_00("ProbeSubstance05_00"), - ProbeSubstance05_24("ProbeSubstance05_24"), - - LargeBufferPos00("LargeBufferPos00"), - LargeBufferPos05("LargeBufferPos05"), + Tip00_000Pos("第0组TIP的第0个位置"), + Tip00_011Pos("第0组TIP的第11个位置"), + Tip00_108Pos("第0组TIP的第108个位置"), + Tip00_119Pos("第0组TIP的第119个位置"), + + Tip01_000Pos("第1组TIP的第0个位置"), + Tip01_011Pos("第1组TIP的第11个位置"), + Tip01_108Pos("第1组TIP的第108个位置"), + Tip01_119Pos("第1组TIP的第119个位置"), + + Tip02_000Pos("第2组TIP的第0个位置"), + Tip02_011Pos("第2组TIP的第11个位置"), + Tip02_108Pos("第2组TIP的第108个位置"), + Tip02_119Pos("第2组TIP的第119个位置"), + + LittleBufferPos00_00("第0组小瓶的第0个位置"), + LittleBufferPos00_24("第0组小瓶的第24个位置"), + LittleBufferPos05_00("第5组小瓶的第0个位置"), + LittleBufferPos05_24("第5组小瓶的第24个位置"), + + ProbeSubstance00_00("第0组探针的第0个位置"), + ProbeSubstance00_24("第0组探针的第24个位置"), + ProbeSubstance05_00("第5组探针的第0个位置"), + ProbeSubstance05_24("第5组探针的第24个位置"), + + LargeBufferPos00("左上角大瓶位置"), + LargeBufferPos05("右下角大瓶位置"), ; final public String chName; + HbotConsumablePos(String chName) { this.chName = chName; } diff --git a/src/main/java/a8k/type/cfg/Pos3d.java b/src/main/java/a8k/type/cfg/Pos3d.java index cd3689e..d5cadac 100644 --- a/src/main/java/a8k/type/cfg/Pos3d.java +++ b/src/main/java/a8k/type/cfg/Pos3d.java @@ -14,10 +14,6 @@ public class Pos3d { this.z = z; } - public Pos2d getXYPos() { - return new Pos2d(x, y); - } - public String toString() { return String.format("(%d, %d, %d)", x, y, z); } diff --git a/src/main/java/a8k/utils/ZJsonHelper.java b/src/main/java/a8k/utils/ZJsonHelper.java index f51a7e2..50aaa0f 100644 --- a/src/main/java/a8k/utils/ZJsonHelper.java +++ b/src/main/java/a8k/utils/ZJsonHelper.java @@ -1,6 +1,9 @@ package a8k.utils; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; public class ZJsonHelper { public static String objectToJson(Object obj) { @@ -13,5 +16,12 @@ public class ZJsonHelper { } } + public static ObjectNode createObjectNode() { + return new ObjectMapper().createObjectNode(); + } + public static ObjectNode createObjectNode(Object obj) { + ObjectMapper ObjectMapper = new ObjectMapper(); + return ObjectMapper.valueToTree(obj); + } }