From f23b1ac19cedaa6d4fbdd9cf88598282f45c0dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-S9HJSOEB=5C=E6=98=8A=E5=A4=A9?= Date: Fri, 4 Sep 2026 16:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=8F=E8=A1=8C=E6=8B=8D?= =?UTF-8?q?=E7=85=A7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zhehekeji/common/util/PathUtil.java | 6 ++++ .../web/config/ConfigProperties.java | 1 + .../com/zhehekeji/web/service/PlcService.java | 33 +++++++++---------- .../service/algorithm/AlgorithmService.java | 4 +-- web/src/main/resources/application-prod.yml | 3 ++ 5 files changed, 28 insertions(+), 19 deletions(-) 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