|
|
|
@ -400,6 +400,7 @@ public class PlcService {
|
|
|
|
log.error("ptz not found ,code:{},cameraId:{}", code, cameraId);
|
|
|
|
log.error("ptz not found ,code:{},cameraId:{}", code, cameraId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void gyrateCameraByCode(Integer cameraId, String code, String taskId) {
|
|
|
|
public void gyrateCameraByCode(Integer cameraId, String code, String taskId) {
|
|
|
|
Integer ptzId = cameraService.getPtzIdByCodeAndCameraId(code, cameraId);
|
|
|
|
Integer ptzId = cameraService.getPtzIdByCodeAndCameraId(code, cameraId);
|
|
|
|
if (ptzId != null && ptzId >= 0) {
|
|
|
|
if (ptzId != null && ptzId >= 0) {
|
|
|
|
@ -601,6 +602,7 @@ public class PlcService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getCameraByPlcCmdE(PlcCmdInfo plcCmdInfo, Integer leftRight) {
|
|
|
|
public Integer getCameraByPlcCmdE(PlcCmdInfo plcCmdInfo, Integer leftRight) {
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
Street street = streetService.getStreetByPlcId(plcCmdInfo.getPlcId());
|
|
|
|
Integer type;
|
|
|
|
Integer type;
|
|
|
|
@ -611,6 +613,7 @@ public class PlcService {
|
|
|
|
return street.getCamera2Id();
|
|
|
|
return street.getCamera2Id();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private LightSourceMapper lightSourceMapper;
|
|
|
|
private LightSourceMapper lightSourceMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@ -665,11 +668,10 @@ public class PlcService {
|
|
|
|
//如果是用扫码枪 扫 托盘码,就直接扫
|
|
|
|
//如果是用扫码枪 扫 托盘码,就直接扫
|
|
|
|
//if(configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
//if(configProperties.getScanCodeMode().getTray() == 2){
|
|
|
|
log.info("扫码类型:" + configProperties.getScanCodeMode().getTray());
|
|
|
|
log.info("扫码类型:" + configProperties.getScanCodeMode().getTray());
|
|
|
|
if (plcCmdInfo.getSeparation1() == 1 && configProperties.getScanCodeMode().getTray() == 2) {
|
|
|
|
|
|
|
|
//托盘使用sick扫码枪
|
|
|
|
//托盘使用sick扫码枪
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
SensorGun sensorGun = sensorService.getSensorByPlc(street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
if (sensorGun == null) {
|
|
|
|
if (sensorGun == null) {
|
|
|
|
trayCode = "识别异常";
|
|
|
|
trayCode = "扫码枪识别异常";
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -682,28 +684,26 @@ public class PlcService {
|
|
|
|
trayCode = "";
|
|
|
|
trayCode = "";
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
trayCode = "识别异常";
|
|
|
|
trayCode = "扫码枪识别异常";
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("NoRead")) {
|
|
|
|
trayCode = "识别异常";
|
|
|
|
trayCode = "扫码枪识别异常";
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
log.warn("sick ocr error:{}", trayCode);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RFID
|
|
|
|
} else if (configProperties.getScanCodeMode().getTray() == 3 ) {
|
|
|
|
|
|
|
|
// //RFID
|
|
|
|
|
|
|
|
// RFID rfid = rfidService.getRFIDByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
// RFID rfid = rfidService.getRFIDByPlc(street.getId(),plcCmdInfo.getLeftRight1());
|
|
|
|
|
|
|
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
Boolean trayRFIDCheck = Boolean.FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
Set<String> tags = new HashSet<>();
|
|
|
|
Set<String> tags = new HashSet<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
RFIDCheck(plcCmdInfo, true);
|
|
|
|
RFIDCheck(plcCmdInfo, true);
|
|
|
|
@ -719,12 +719,13 @@ public class PlcService {
|
|
|
|
if (tags.containsAll(wmsTrayCodeMapByTask.get(plcCmdInfo.getOrderNum()))) {
|
|
|
|
if (tags.containsAll(wmsTrayCodeMapByTask.get(plcCmdInfo.getOrderNum()))) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trayCode = "盘点正常";
|
|
|
|
trayRFIDCheck = Boolean.TRUE;
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if(trayCheck){
|
|
|
|
trayCode = "盘点失败";
|
|
|
|
trayCode = "RFID扫描失败";
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
}else
|
|
|
|
|
|
|
|
trayCode += ";RFID扫描失败";
|
|
|
|
|
|
|
|
trayRFIDCheck = Boolean.FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wmsTrayCodeMapByTask.remove(plcCmdInfo.getOrderNum());
|
|
|
|
wmsTrayCodeMapByTask.remove(plcCmdInfo.getOrderNum());
|
|
|
|
RFID rfid = rfidMapper.selectOne(new QueryWrapper<RFID>().eq("street_id", street.getId()));
|
|
|
|
RFID rfid = rfidMapper.selectOne(new QueryWrapper<RFID>().eq("street_id", street.getId()));
|
|
|
|
@ -734,45 +735,17 @@ public class PlcService {
|
|
|
|
rfidLiveService.rfidSave(plcCmdInfo, String.join(",", tags), street, rfid);
|
|
|
|
rfidLiveService.rfidSave(plcCmdInfo, String.join(",", tags), street, rfid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
OrderInfo orderInfo = new OrderInfo(street, plcCmdInfo, 1, cmdCode);
|
|
|
|
OrderInfo orderInfo = new OrderInfo(street, plcCmdInfo, 1, cmdCode);
|
|
|
|
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(orderInfo.getStreetId(), plcCmdInfo.getFromDirection(), orderInfo.getSeparation(), orderInfo.getRow(), orderInfo.getColumn());
|
|
|
|
Stock stock = stockMapper.getByStreetAndDirectionAndSideAndRowColumn(orderInfo.getStreetId(), plcCmdInfo.getFromDirection(), orderInfo.getSeparation(), orderInfo.getRow(), orderInfo.getColumn());
|
|
|
|
String scanCode = null;
|
|
|
|
String scanCode = null;
|
|
|
|
Boolean codeCheck = Boolean.TRUE;
|
|
|
|
|
|
|
|
Boolean trayCodeCheck = Boolean.TRUE;
|
|
|
|
|
|
|
|
//货物使用球机扫码
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (configProperties.getScanCodeMode().getTray() == 2 && plcCmdInfo.getSeparation1() == 2) {
|
|
|
|
//货物使用球机扫码
|
|
|
|
//托盘使用球机扫码
|
|
|
|
|
|
|
|
if ("".equals(wmsTrayCode)) {
|
|
|
|
|
|
|
|
//空货物的处理
|
|
|
|
|
|
|
|
//如果系统货物为空,则只要扫码识别未出结果,就认为无货物
|
|
|
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath() + path, configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
|
|
|
log.info("tray code:{},sys trayCode:{}", trayCode, wmsTrayCode);
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(trayCode) || trayCode.equals("Unrecognized")) {
|
|
|
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
|
|
|
trayCode = "";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
trayCode = BarcodeDetector.detectBestCodeUntilOK(configProperties.getSavePath().getMediaPath() + path, configProperties.getScanCodeMode().getTrayCodeTypes());
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(trayCode)) {
|
|
|
|
|
|
|
|
log.error("row:{},cloumn:{}", plcCmdInfo.getRow1(), plcCmdInfo.getColumn1());
|
|
|
|
|
|
|
|
log.error("detectBestBarCode:{}", trayCode);
|
|
|
|
|
|
|
|
trayCode = "识别异常";
|
|
|
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
trayCheck = wmsTrayCode.equals(trayCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info("code:{}", scanCode);
|
|
|
|
log.info("code:{}", scanCode);
|
|
|
|
//核对异常
|
|
|
|
//核对异常
|
|
|
|
Integer status = 1;
|
|
|
|
Integer status = 1;
|
|
|
|
//托盘和货物都正确
|
|
|
|
//托盘和货物都正确
|
|
|
|
if (trayCheck && codeCheck) {
|
|
|
|
if (trayCheck && trayRFIDCheck ) {
|
|
|
|
status = 2;
|
|
|
|
status = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (stock == null) {
|
|
|
|
if (stock == null) {
|
|
|
|
@ -826,7 +799,6 @@ public class PlcService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void checkLog(Stock stock) {
|
|
|
|
public void checkLog(Stock stock) {
|
|
|
|
CheckLog checkLog = new CheckLog();
|
|
|
|
CheckLog checkLog = new CheckLog();
|
|
|
|
checkLog.setCheckNum(stock.getCheckNum());
|
|
|
|
checkLog.setCheckNum(stock.getCheckNum());
|
|
|
|
@ -852,6 +824,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 根据信息开启rfid链接
|
|
|
|
* 根据信息开启rfid链接
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param plcCmdInfo 相关信息
|
|
|
|
* @param plcCmdInfo 相关信息
|
|
|
|
* @param fromOrTo 确定方向
|
|
|
|
* @param fromOrTo 确定方向
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|