|
|
|
|
@ -372,73 +372,20 @@ public class PlcService {
|
|
|
|
|
@Resource
|
|
|
|
|
RestTemplate restTemplate;
|
|
|
|
|
|
|
|
|
|
String scan(PlcCmdInfo plcCmdInfo,Street street,String wmsTrayCode){
|
|
|
|
|
ReadOCR scan(PlcCmdInfo plcCmdInfo,Street street,String wmsTrayCode){
|
|
|
|
|
Boolean trayCheck = Boolean.FALSE;
|
|
|
|
|
String trayCode = "";
|
|
|
|
|
ReadOCR trayCode = new ReadOCR();
|
|
|
|
|
log.info("扫码类型:" + configProperties.getScanCodeMode().getTray());
|
|
|
|
|
//使用sick扫码枪
|
|
|
|
|
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 = "扫码枪未配置";
|
|
|
|
|
trayCode.setCode("扫码枪未配置");
|
|
|
|
|
trayCode.setStatus(2);
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
log.error("no sensor gun config in database ,street id:{},direction:{}", street.getId(), plcCmdInfo.getLeftRight1());
|
|
|
|
|
} else {
|
|
|
|
|
@ -451,14 +398,16 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
log.info("sensor tray code:{}", trayCode);
|
|
|
|
|
//如果无货物判断是否
|
|
|
|
|
for (String code : trayCode.split(";")) {
|
|
|
|
|
for (String code : trayCode.getCode().split(";")) {
|
|
|
|
|
|
|
|
|
|
log.info("sick ocr info:{},wmsCode{}", code,wmsTrayCode);
|
|
|
|
|
|
|
|
|
|
if (!code.endsWith(org.apache.commons.lang3.StringUtils.leftPad(wmsTrayCode, 6, '0'))) {
|
|
|
|
|
trayCheck = Boolean.FALSE;
|
|
|
|
|
// trayCode.setStatus(1);
|
|
|
|
|
log.info("sick ocr error:{}", trayCode);
|
|
|
|
|
} else {
|
|
|
|
|
// trayCode.setStatus(1);
|
|
|
|
|
trayCheck = Boolean.TRUE;
|
|
|
|
|
log.info("sick ocr success:{}", trayCode);
|
|
|
|
|
break;
|
|
|
|
|
@ -466,7 +415,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
plcCmdInfo.setTrayCode(trayCode);
|
|
|
|
|
plcCmdInfo.setTrayCode(trayCode.getCode());
|
|
|
|
|
plcCmdInfo.setTrayCheck(trayCheck);
|
|
|
|
|
log.info("tray code:{},sys trayCode:{},plcInfo{}",trayCode,wmsTrayCode,plcCmdInfo.toString());
|
|
|
|
|
return trayCode;
|
|
|
|
|
@ -633,7 +582,7 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
// 其他逻辑...
|
|
|
|
|
//托盘码
|
|
|
|
|
String trayCode = "";
|
|
|
|
|
ReadOCR trayCode = new ReadOCR();
|
|
|
|
|
Boolean trayCheck = Boolean.TRUE;
|
|
|
|
|
trayCode = scan(plcCmdInfo,street,wmsTrayCode);
|
|
|
|
|
trayCheck = plcCmdInfo.getTrayCheck();
|
|
|
|
|
@ -645,8 +594,8 @@ public class PlcService {
|
|
|
|
|
|
|
|
|
|
IndustrialCameraVO scTransmission = new IndustrialCameraVO();
|
|
|
|
|
scTransmission.setWmsTrayCode(wmsTrayCode);
|
|
|
|
|
scTransmission.setTrayCode(trayCode);
|
|
|
|
|
scTransmission.setFlag(trayCheck?1:0);
|
|
|
|
|
scTransmission.setTrayCode(trayCode.getCode());
|
|
|
|
|
scTransmission.setFlag(trayCode.getStatus());
|
|
|
|
|
kuKouService.setHttp(scTransmission,trayCheck);
|
|
|
|
|
//核对异常
|
|
|
|
|
Integer status = 1;
|
|
|
|
|
@ -658,10 +607,10 @@ public class PlcService {
|
|
|
|
|
stock = Stock.builder()
|
|
|
|
|
.checkNum(plcCmdInfo.getOrderNum())
|
|
|
|
|
.lotnum(plcCmdInfo.getLotnum())
|
|
|
|
|
.code(trayCode)
|
|
|
|
|
.code(trayCode.getCode())
|
|
|
|
|
.wmsCode(wmsCode)
|
|
|
|
|
.wmsTrayCode(wmsTrayCode)
|
|
|
|
|
.trayCode(trayCode)
|
|
|
|
|
.trayCode(trayCode.getCode())
|
|
|
|
|
.streetId(orderInfo.getStreetId())
|
|
|
|
|
.direction(plcCmdInfo.getLeftRight1())
|
|
|
|
|
.side(orderInfo.getSeparation())
|
|
|
|
|
@ -677,9 +626,9 @@ public class PlcService {
|
|
|
|
|
stock.setExportTime(LocalDateTime.now());
|
|
|
|
|
stock.setCheckPic(path);
|
|
|
|
|
stock.setCheckNum(plcCmdInfo.getOrderNum());
|
|
|
|
|
stock.setTrayCode(trayCode);
|
|
|
|
|
stock.setTrayCode(trayCode.getCode());
|
|
|
|
|
stock.setWmsTrayCode(wmsTrayCode);
|
|
|
|
|
stock.setCode(trayCode);
|
|
|
|
|
stock.setCode(trayCode.getCode());
|
|
|
|
|
stock.setWmsCode(wmsCode);
|
|
|
|
|
stockMapper.updateById(stock);
|
|
|
|
|
}
|
|
|
|
|
|