diff --git a/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java b/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java index fe23fe9..e8c0e0a 100644 --- a/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java +++ b/web/src/main/java/com/zhehekeji/web/controller/IndustrialCameraController.java @@ -214,9 +214,25 @@ public class IndustrialCameraController { kuKou.setWmsCode(industrialCameraVo.getCode()); kuKou.setPath(configProperties.getSavePath().getNetPicPath() + pa + ".jpg"); kuKou.setCategoryName(industrialCameraVo.getTypeMacth()); - if (re && count == industrialCameraVo.getCount() && code.endsWith(industrialCameraVo.getCode())) { + if (re && count.equals(industrialCameraVo.getCount()) && code.endsWith(industrialCameraVo.getCode())) { kuKou.setFlag(1); - } else kuKou.setFlag(0); + } else if (count.equals(-1)){ + kuKou.setCount(0); + + kuKou.setFlag(12); + + }else if (count.equals(-2)){ + kuKou.setCount(0); + + kuKou.setFlag(11); + + }else { + + kuKou.setCount(0); + kuKou.setFlag(0); + + } + kuKouService.save(kuKou); // serialPortExample.openLight(0); diff --git a/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java b/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java index 5ea9d94..71a52d4 100644 --- a/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java +++ b/web/src/main/java/com/zhehekeji/web/service/IndustrialCamera/LxPointCloudSaveImage.java @@ -2,6 +2,7 @@ package com.zhehekeji.web.service.IndustrialCamera; import com.sun.jna.Native; import com.sun.jna.ptr.PointerByReference; +import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; import java.nio.file.Files; @@ -124,7 +125,7 @@ public class LxPointCloudSaveImage { } - public static boolean saveImage(String sn, String path,int type) { + public static Integer saveImage(String sn, String path, int type) { DcLibrary INSTANCE; INSTANCE = INSTANCER; int result = 0; @@ -150,7 +151,7 @@ public class LxPointCloudSaveImage { System.out.println("stop Stream Result: " + result); - return true; + return result; } public static void main(String[] args) { diff --git a/web/src/main/java/com/zhehekeji/web/service/algorithm/InventoryService.java b/web/src/main/java/com/zhehekeji/web/service/algorithm/InventoryService.java index e70f1c5..953a0e0 100644 --- a/web/src/main/java/com/zhehekeji/web/service/algorithm/InventoryService.java +++ b/web/src/main/java/com/zhehekeji/web/service/algorithm/InventoryService.java @@ -87,7 +87,17 @@ public class InventoryService { for (int i = 0; i < 3; i++) { String currentPath = path.replace(".pcd", "_" + i + ".pcd"); // 添加索引以区分不同次拍照的文件路径 - LxPointCloudSaveImage.saveImage(configProperties.getCameraConfig().getCamera3D(), currentPath, 1); + Integer picResult = LxPointCloudSaveImage.saveImage(configProperties.getCameraConfig().getCamera3D(), currentPath, 1); + if ( picResult==-3){ +// 网络问题 + log.error("3D拍照失败:"+picResult); + return -1; + }else if(picResult != 0 && picResult!=25){ +// 没有成功拍照 + log.error("3D拍照失败:"+picResult); + return -2; + } + log.info("3D拍照成功 :"+picResult); Integer result = PointCloudProcessor.getBaijiuBox( currentPath, @@ -107,14 +117,11 @@ public class InventoryService { return results.get(2); } - - - - try { + try { Thread.sleep(300*(i+1)); // 间隔300ms - } catch (InterruptedException e) { + } catch (InterruptedException e) { log.error("线程休眠异常", e); - } + } } return results.get(results.size() - 1);