采用多个扫码枪

泸州-视觉+扫码-昆船
LAPTOP-S9HJSOEB\昊天 1 year ago
parent 56a2e2d6a8
commit fa4bca30b3

@ -21,9 +21,17 @@ public class StreetVO extends Street {
private Integer leftSensorGunPort;
private String leftDeepSensorGunIp;
private Integer leftDeepSensorGunPort;
private String rightSensorGunIp;
private Integer rightSensorGunPort;
private String rightDeepSensorGunIp;
private Integer rightDeepSensorGunPort;
/**
* 线 1线

@ -371,87 +371,93 @@ public class PlcService {
String trayCode = "";
log.info("扫码类型:" + configProperties.getScanCodeMode().getTray());
//使用sick扫码枪
if(plcCmdInfo.getSeparation1()==1) {
//托盘使用sick扫码枪
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(), plcCmdInfo.getLeftRight1());
if (sensorGun == null) {
trayCode = "扫码枪未配置";
trayCheck = Boolean.FALSE;
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
} else {
trayCode = SickSocket.readOCR(sensorGun.getIp(), sensorGun.getPort());
log.info("sensor tray code:{}", trayCode);
if ("".equals(plcCmdInfo.getWmsCode())) {
//托盘码为空,无货物
//只要扫码枪未识别出条码,即认为盘点正确
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "无货物";
trayCheck = Boolean.TRUE;
} else {
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
}
int leftRight = plcCmdInfo.getLeftRight1();
if(plcCmdInfo.getSeparation1()==2) {
leftRight=leftRight+2;
}
// if(plcCmdInfo.getSeparation1()==1) {
//
// }else {
//
// Integer cameraId=street.getCamera1Id();;
// String code = "E1-DEEP-";
// String path = "";
//
// //使用同侧的camera
// if(plcCmdInfo.getLeftRight1() ==1){
//
// code = code+"L";
// }else {
//
// code = code+"R";
// }
// path = PathUtil.createFileNameByRowColumn("jpg",cameraId,plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
// gyrateCameraByCode(cameraId,code);
// try {
// Thread.sleep(5000L);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// path = cameraCapture(cameraId,false,0L,path);
//
//
// trayCode = reentrantLockExample.identify( configProperties.getSavePath().getMediaPath() + path,configProperties.getIntelliBink().getIp(),configProperties.getIntelliBink().getPort());
// if(trayCode != null && !"".equals(trayCode)){
// if ("".equals(plcCmdInfo.getWmsCode())) {
// //托盘码为空,无货物
// //只要扫码枪未识别出条码,即认为盘点正确
// if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
// trayCode = "无货物";
// trayCheck = Boolean.TRUE;
// } else {
// trayCode = "扫码枪识别异常";
// trayCheck = Boolean.FALSE;
// log.warn("sick ocr error:{}", trayCode);
// }
// } else {
// if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
// trayCode = "扫码枪识别异常";
// trayCheck = Boolean.FALSE;
// log.warn("sick ocr error:{}", trayCode);
// } else {
// //扫到与货码相同
// if(trayCode.equals(plcCmdInfo.getWmsCode())){
// trayCheck = Boolean.TRUE;
// }
// }
// }
// }
// }
//托盘使用sick扫码枪
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(), leftRight);
if (sensorGun == null) {
trayCode = "扫码枪未配置";
trayCheck = Boolean.FALSE;
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
} else {
trayCode = SickSocket.readOCR(sensorGun.getIp(), sensorGun.getPort());
log.info("sensor tray code:{}", trayCode);
if ("".equals(plcCmdInfo.getWmsCode())) {
//托盘码为空,无货物
//只要扫码枪未识别出条码,即认为盘点正确
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "无货物";
trayCheck = Boolean.TRUE;
} else {
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
} else {
//扫到与货码相同
if(trayCode.equals(plcCmdInfo.getWmsCode())){
trayCheck = Boolean.TRUE;
}
}
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
}
}
}else {
Integer cameraId=street.getCamera1Id();;
String code = "E1-DEEP-";
String path = "";
//使用同侧的camera
if(plcCmdInfo.getLeftRight1() ==1){
code = code+"L";
}else {
code = code+"R";
}
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
gyrateCameraByCode(cameraId,code);
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
path = cameraCapture(cameraId,false,0L,path);
} else {
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
} else {
//扫到与货码相同
if(trayCode.equals(plcCmdInfo.getWmsCode())){
trayCode = reentrantLockExample.identify( configProperties.getSavePath().getMediaPath() + path,configProperties.getIntelliBink().getIp(),configProperties.getIntelliBink().getPort());
if(trayCode != null && !"".equals(trayCode)){
if ("".equals(plcCmdInfo.getWmsCode())) {
//托盘码为空,无货物
//只要扫码枪未识别出条码,即认为盘点正确
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "无货物";
trayCheck = Boolean.TRUE;
} else {
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
}
} else {
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
trayCode = "扫码枪识别异常";
trayCheck = Boolean.FALSE;
log.warn("sick ocr error:{}", trayCode);
} else {
//扫到与货码相同
if(trayCode.equals(plcCmdInfo.getWmsCode())){
trayCheck = Boolean.TRUE;
}
}
}
}

@ -219,6 +219,22 @@ public class StreetService {
sensorGun.setPort(streetVO.getRightSensorGunPort());
sensorGunMapper.insert(sensorGun);
}
if(!StringUtils.isEmpty(streetVO.getLeftDeepSensorGunIp()) && streetVO.getLeftDeepSensorGunPort() != null){
SensorGun sensorGun = new SensorGun();
sensorGun.setStreetId(streetId);
sensorGun.setDirection(3);
sensorGun.setIp(streetVO.getLeftDeepSensorGunIp());
sensorGun.setPort(streetVO.getLeftDeepSensorGunPort());
sensorGunMapper.insert(sensorGun);
}
if(!StringUtils.isEmpty(streetVO.getRightDeepSensorGunIp()) && streetVO.getRightDeepSensorGunPort() != null){
SensorGun sensorGun = new SensorGun();
sensorGun.setStreetId(streetId);
sensorGun.setDirection(4);
sensorGun.setIp(streetVO.getRightDeepSensorGunIp());
sensorGun.setPort(streetVO.getRightDeepSensorGunPort());
sensorGunMapper.insert(sensorGun);
}
}
public void RFIDConfig(StreetVO streetVO,Integer streetId){

@ -101,7 +101,7 @@ lightSource:
# 扫码模式 0:此处不盘点 1球机扫码 2sick扫码枪 3:南北达RFID
scanCodeMode:
tray: 0
goods: 2x
goods: 2
goodsCodeTypes:
- 14
trayCodeTypes:

Loading…
Cancel
Save