|
|
@ -6,14 +6,10 @@ import a8k.extapi_controler.utils.ExtApiTab; |
|
|
|
import a8k.service.db.LowerDeviceParameterDBService; |
|
|
|
import a8k.service.db.utils.PosParameterReader; |
|
|
|
import a8k.type.ConsumableGroup; |
|
|
|
import a8k.type.HbotConsumablePos; |
|
|
|
import a8k.type.HbotConsumablePosParam; |
|
|
|
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; |
|
|
@ -22,7 +18,6 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* HBOT二维码扫描坐标参数 |
|
|
@ -37,7 +32,7 @@ public class HbotConsumablePosMgr { |
|
|
|
LowerDeviceParameterDBService lowerDeviceParameterDBService; |
|
|
|
PosParameterReader posReader = null; |
|
|
|
|
|
|
|
static Integer nowParaVersion = 2; |
|
|
|
static Integer nowParaVersion = 3; |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
void initialize() { |
|
|
@ -52,35 +47,24 @@ public class HbotConsumablePosMgr { |
|
|
|
logger.info("init param"); |
|
|
|
posReader.setVersion(nowParaVersion); |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup0_000Pos, new Pos3d()); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup0_SpaceingX, 0.0); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup0_SpaceingY, 0.0); |
|
|
|
|
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup1_000Pos, new Pos3d()); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup1_SpaceingX, 0.0); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingY, 0.0); |
|
|
|
|
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup2_000Pos, new Pos3d()); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingX, 0.0); |
|
|
|
posReader.updatePos(HbotConsumablePosParam.TipGroup2_SpaceingY, 0.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public List<ObjectNode> getParams() { |
|
|
|
List<ObjectNode> list = new java.util.ArrayList<>(); |
|
|
|
for (HbotConsumablePos param : HbotConsumablePos.values()) { |
|
|
|
for (HbotConsumablePosParam param : HbotConsumablePosParam.values()) { |
|
|
|
ObjectNode posNode = ZJsonHelper.createObjectNode(); |
|
|
|
posNode.put("pos", ZJsonHelper.createObjectNode(posReader.getPos(param.name(), Pos3d.class))); |
|
|
|
posNode.put("name", param.name()); |
|
|
@ -91,50 +75,65 @@ public class HbotConsumablePosMgr { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setParam(HbotConsumablePos param, Pos3d pos) { |
|
|
|
posReader.updatePos(param.name(), pos); |
|
|
|
public void setParam(HbotConsumablePosParam param, Object val) { |
|
|
|
posReader.updatePos(param.name(), val); |
|
|
|
} |
|
|
|
|
|
|
|
public void setTipGroupParam(TipGroup tipGroup, Pos3d tip000, Double dx, Double dy) { |
|
|
|
HbotConsumablePosParam tip000Pos = null; |
|
|
|
HbotConsumablePosParam tipDxPos = null; |
|
|
|
HbotConsumablePosParam tipDyPos = null; |
|
|
|
|
|
|
|
if (tipGroup == TipGroup.GROUP0) { |
|
|
|
tip000Pos = HbotConsumablePosParam.TipGroup0_000Pos; |
|
|
|
tipDxPos = HbotConsumablePosParam.TipGroup0_SpaceingX; |
|
|
|
tipDyPos = HbotConsumablePosParam.TipGroup0_SpaceingY; |
|
|
|
} else if (tipGroup == TipGroup.GROUP1) { |
|
|
|
tip000Pos = HbotConsumablePosParam.TipGroup1_000Pos; |
|
|
|
tipDxPos = HbotConsumablePosParam.TipGroup1_SpaceingX; |
|
|
|
tipDyPos = HbotConsumablePosParam.TipGroup2_SpaceingY; |
|
|
|
} else if (tipGroup == TipGroup.GROUP2) { |
|
|
|
tip000Pos = HbotConsumablePosParam.TipGroup2_000Pos; |
|
|
|
tipDxPos = HbotConsumablePosParam.TipGroup2_SpaceingX; |
|
|
|
tipDyPos = HbotConsumablePosParam.TipGroup2_SpaceingY; |
|
|
|
} |
|
|
|
|
|
|
|
assert tip000Pos != null; |
|
|
|
|
|
|
|
posReader.updatePos(tip000Pos, tip000); |
|
|
|
posReader.updatePos(tipDxPos, dx); |
|
|
|
posReader.updatePos(tipDyPos, dy); |
|
|
|
} |
|
|
|
|
|
|
|
public Pos3d getTipPos(TipGroup tipGroup, Integer tipoff) { |
|
|
|
Pos3d tip000 = null; |
|
|
|
Pos3d tip011 = null; |
|
|
|
Pos3d tip108 = null; |
|
|
|
Pos3d tip119 = null; |
|
|
|
Pos3d tip000 = null; |
|
|
|
Double dx = 0.0; |
|
|
|
Double dy = 0.0; |
|
|
|
|
|
|
|
if (tipGroup == TipGroup.GROUP0) { |
|
|
|
tip000 = posReader.getPos(HbotConsumablePos.Tip00_000Pos.name(), Pos3d.class); |
|
|
|
tip011 = posReader.getPos(HbotConsumablePos.Tip00_011Pos.name(), Pos3d.class); |
|
|
|
tip108 = posReader.getPos(HbotConsumablePos.Tip00_108Pos.name(), Pos3d.class); |
|
|
|
tip119 = posReader.getPos(HbotConsumablePos.Tip00_119Pos.name(), Pos3d.class); |
|
|
|
tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup0_000Pos, Pos3d.class); |
|
|
|
dx = posReader.getPos(HbotConsumablePosParam.TipGroup0_SpaceingX, Double.class); |
|
|
|
dy = posReader.getPos(HbotConsumablePosParam.TipGroup0_SpaceingY, Double.class); |
|
|
|
|
|
|
|
} else if (tipGroup == TipGroup.GROUP1) { |
|
|
|
tip000 = posReader.getPos(HbotConsumablePos.Tip01_000Pos.name(), Pos3d.class); |
|
|
|
tip011 = posReader.getPos(HbotConsumablePos.Tip01_011Pos.name(), Pos3d.class); |
|
|
|
tip108 = posReader.getPos(HbotConsumablePos.Tip01_108Pos.name(), Pos3d.class); |
|
|
|
tip119 = posReader.getPos(HbotConsumablePos.Tip01_119Pos.name(), Pos3d.class); |
|
|
|
tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup1_000Pos, Pos3d.class); |
|
|
|
dx = posReader.getPos(HbotConsumablePosParam.TipGroup1_SpaceingX, Double.class); |
|
|
|
dy = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingY, Double.class); |
|
|
|
} else if (tipGroup == TipGroup.GROUP2) { |
|
|
|
tip000 = posReader.getPos(HbotConsumablePos.Tip02_000Pos.name(), Pos3d.class); |
|
|
|
tip011 = posReader.getPos(HbotConsumablePos.Tip02_011Pos.name(), Pos3d.class); |
|
|
|
tip108 = posReader.getPos(HbotConsumablePos.Tip02_108Pos.name(), Pos3d.class); |
|
|
|
tip119 = posReader.getPos(HbotConsumablePos.Tip02_119Pos.name(), Pos3d.class); |
|
|
|
tip000 = posReader.getPos(HbotConsumablePosParam.TipGroup2_000Pos, Pos3d.class); |
|
|
|
dx = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingX, Double.class); |
|
|
|
dy = posReader.getPos(HbotConsumablePosParam.TipGroup2_SpaceingY, Double.class); |
|
|
|
} |
|
|
|
assert tip000 != null; |
|
|
|
assert tip011 != null; |
|
|
|
assert tip108 != null; |
|
|
|
assert tip119 != null; |
|
|
|
|
|
|
|
//水平方向 |
|
|
|
double dx = (tip119.x - tip000.x) / 11.0; |
|
|
|
//前后方向 |
|
|
|
double dy = (tip119.y - tip000.y) / 9.0; |
|
|
|
assert dx != null; |
|
|
|
assert dy != null; |
|
|
|
|
|
|
|
int xoff = tipoff % 12; |
|
|
|
int yoff = tipoff / 12; |
|
|
|
|
|
|
|
double x = tip000.x + xoff * dx; |
|
|
|
double y = tip000.y + yoff * dy; |
|
|
|
double z = PlaneUtils.calculateZ(tip000, tip011, tip119, x, y); |
|
|
|
double z = tip000.z; |
|
|
|
|
|
|
|
return new Pos3d((int) x, (int) y, (int) z); |
|
|
|
} |
|
|
@ -183,24 +182,24 @@ public class HbotConsumablePosMgr { |
|
|
|
} |
|
|
|
|
|
|
|
public Pos3d getLittleBufferPos(ConsumableGroup group, Integer off) { |
|
|
|
Pos3d pos00_00 = posReader.getPos(HbotConsumablePos.LittleBufferPos00_00.name(), Pos3d.class); |
|
|
|
Pos3d pos00_24 = posReader.getPos(HbotConsumablePos.LittleBufferPos00_24.name(), Pos3d.class); |
|
|
|
Pos3d pos05_00 = posReader.getPos(HbotConsumablePos.LittleBufferPos05_00.name(), Pos3d.class); |
|
|
|
Pos3d pos05_24 = posReader.getPos(HbotConsumablePos.LittleBufferPos05_24.name(), Pos3d.class); |
|
|
|
Pos3d pos00_00 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos00_00.name(), Pos3d.class); |
|
|
|
Pos3d pos00_24 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos00_24.name(), Pos3d.class); |
|
|
|
Pos3d pos05_00 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos05_00.name(), Pos3d.class); |
|
|
|
Pos3d pos05_24 = posReader.getPos(HbotConsumablePosParam.LittleBufferPos05_24.name(), Pos3d.class); |
|
|
|
return getLittleBufferOrProbeSubstancePos(pos00_00, pos00_24, pos05_00, pos05_24, group, off); |
|
|
|
} |
|
|
|
|
|
|
|
public Pos3d getProbeSubstancePos(ConsumableGroup group, Integer off) { |
|
|
|
Pos3d pos00_00 = posReader.getPos(HbotConsumablePos.ProbeSubstance00_00.name(), Pos3d.class); |
|
|
|
Pos3d pos00_24 = posReader.getPos(HbotConsumablePos.ProbeSubstance00_24.name(), Pos3d.class); |
|
|
|
Pos3d pos05_00 = posReader.getPos(HbotConsumablePos.ProbeSubstance05_00.name(), Pos3d.class); |
|
|
|
Pos3d pos05_24 = posReader.getPos(HbotConsumablePos.ProbeSubstance05_24.name(), Pos3d.class); |
|
|
|
Pos3d pos00_00 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance00_00.name(), Pos3d.class); |
|
|
|
Pos3d pos00_24 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance00_24.name(), Pos3d.class); |
|
|
|
Pos3d pos05_00 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance05_00.name(), Pos3d.class); |
|
|
|
Pos3d pos05_24 = posReader.getPos(HbotConsumablePosParam.ProbeSubstance05_24.name(), Pos3d.class); |
|
|
|
return getLittleBufferOrProbeSubstancePos(pos00_00, pos00_24, pos05_00, pos05_24, group, off); |
|
|
|
} |
|
|
|
|
|
|
|
public Pos3d getLargeBufferPos(ConsumableGroup group) { |
|
|
|
Pos3d pos00 = posReader.getPos(HbotConsumablePos.LargeBufferPos00.name(), Pos3d.class); |
|
|
|
Pos3d pos05 = posReader.getPos(HbotConsumablePos.LargeBufferPos05.name(), Pos3d.class); |
|
|
|
Pos3d pos00 = posReader.getPos(HbotConsumablePosParam.LargeBufferPos00.name(), Pos3d.class); |
|
|
|
Pos3d pos05 = posReader.getPos(HbotConsumablePosParam.LargeBufferPos05.name(), Pos3d.class); |
|
|
|
|
|
|
|
int xoff = group.off % 3; |
|
|
|
int yoff = group.off / 3; |
|
|
|