diff --git a/modules/common/src/main/java/com/zhehekeji/common/util/PathUtil.java b/modules/common/src/main/java/com/zhehekeji/common/util/PathUtil.java index 83e4d71..63d4c22 100644 --- a/modules/common/src/main/java/com/zhehekeji/common/util/PathUtil.java +++ b/modules/common/src/main/java/com/zhehekeji/common/util/PathUtil.java @@ -34,6 +34,12 @@ public class PathUtil { return cameraId+"/"+row+"-"+column+"/"+date + "/" +now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss-"))+row+"-"+column + "."+fileType; } + public static String createFileNameByRowColumn2(String fileType,Integer cameraId,Integer row,Integer column){ + LocalDateTime now = LocalDateTime.now(); + String date = now.format(DateTimeFormatter.ofPattern("yyyyMMdd")); + return cameraId+"-"+"-"+date + "-" +now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss-"))+"-"+row+"-"+column + "."+fileType; + } + /** * 检查文件的文件夹是否存在,不存在则新建 * @param url diff --git a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java index c69accc..240865c 100644 --- a/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java +++ b/web/src/main/java/com/zhehekeji/web/config/ConfigProperties.java @@ -40,6 +40,7 @@ public class ConfigProperties { private ScanCodeMode scanCodeMode; private Rfid rfid; + private Boolean actionCheckPic = false; private AsyncExecutorThread asyncExecutorThread; private VisualSense visualSense; diff --git a/web/src/main/java/com/zhehekeji/web/service/PlcService.java b/web/src/main/java/com/zhehekeji/web/service/PlcService.java index 06a9009..65a2468 100644 --- a/web/src/main/java/com/zhehekeji/web/service/PlcService.java +++ b/web/src/main/java/com/zhehekeji/web/service/PlcService.java @@ -446,6 +446,21 @@ public class PlcService { gyrateCameraByCodeTimeLater(cameraId, "C5", configProperties.getCameraConfig().getC2OutDelayCaptureTime() + 500); } + if (configProperties.getActionCheckPic()){ + + code = "E1" + "-" + plcCmdInfo.getEndStr(1, plcCmdInfo.getFromAround()); + + gyrateCameraByCode(cameraId, code); + + path = PathUtil.createFileNameByRowColumn2("jpg", cameraId, plcCmdInfo.getRow1(), plcCmdInfo.getColumn1()); + try { + + cameraCapture(cameraId, false, null, path); + } catch (NullPointerException e) { + log.error("相机{}未连接无法拍照", cameraId); + } + } + // threadPoolExecutor.execute(()->{ // rfidLiveService.rfidOrderStock(plcCmdInfo, times, code); // }); @@ -778,23 +793,7 @@ public class PlcService { //货物使用球机扫码 log.info("盘点信息:{}", algorithmPojo.toString()); -// //关闭光源 -// Thread thread = new Thread(() -> { -// try { -// Thread.sleep(30000); -// } catch (InterruptedException e) { -// throw new RuntimeException(e); -// } -// //关闭光源 -// streetController.closeStreetLightSource(street.getId()); -// }); -// thread.start(); - //核对异常 -// Integer status = 4; - //托盘和货物都正确 -// if (algorithmPojo != null && algorithmPojo.getResult() != null && algorithmPojo.getResult() == 1) { -// status = 2; -// } + Integer status = 1; if (algorithmPojo != null && algorithmPojo.getResult() != null && algorithmPojo.getResult() == 0) { status = 2; diff --git a/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java b/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java index cdbb82f..6154257 100644 --- a/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java +++ b/web/src/main/java/com/zhehekeji/web/service/algorithm/AlgorithmService.java @@ -176,13 +176,13 @@ public class AlgorithmService { // System.out.println(calculate); }catch (RestClientException e){ - log.error("未连接上堆垛机"+e); + log.error("未连接上算法平台"+e); //Assert.isTrue(false,"请求失败,视觉服务未连接"); algorithmPojo.setResult(0); return algorithmPojo; }catch (Exception e){ - log.error("堆垛机报错"+e); + log.error("算法平台报错"+e); e.printStackTrace(); algorithmPojo.setResult(0); return algorithmPojo; diff --git a/web/src/main/resources/application-prod.yml b/web/src/main/resources/application-prod.yml index 42e9e15..4182ae2 100644 --- a/web/src/main/resources/application-prod.yml +++ b/web/src/main/resources/application-prod.yml @@ -98,6 +98,9 @@ rfid: #rfid连续扫描时间,默认5s 单位s scanTime: 1 +# 随行进行盘点拍照 +actionCheckPic: true + asyncExecutorThread: corePoolSize: 5