|
|
|
@ -35,6 +35,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.zhehekeji.web.service.algorithm.FeatureMatchingExample.base642Mat;
|
|
|
|
import static com.zhehekeji.web.service.algorithm.FeatureMatchingExample.base642Mat;
|
|
|
|
|
|
|
|
|
|
|
|
@ -70,12 +71,26 @@ public class IndustrialCameraController {
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
|
|
if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
|
|
|
|
if(configProperties.getCameraConfig().getIndustrialCamera()!=null) {
|
|
|
|
for (String camera:configProperties.getCameraConfig().getIndustrialCamera()) {
|
|
|
|
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
String path = "industrialCamera/" +currentDate.format(formatter)+"/"+camera+ UUID.randomUUID() + ".jpeg";
|
|
|
|
for (String camera : configProperties.getCameraConfig().getIndustrialCamera()) {
|
|
|
|
hikSaveImage.saveImage(camera, configProperties.getSavePath().getMediaPath() + path, "sn");
|
|
|
|
String path = "industrialCamera/" + currentDate.format(formatter) + "/" + camera + UUID.randomUUID() + ".jpeg";
|
|
|
|
list.add(path);
|
|
|
|
String fullPath = configProperties.getSavePath().getMediaPath() + path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交异步任务
|
|
|
|
|
|
|
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
|
|
|
|
|
|
|
|
hikSaveImage.saveImage(camera, fullPath, "sn");
|
|
|
|
|
|
|
|
synchronized (list) {
|
|
|
|
|
|
|
|
list.add(path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
futures.add(future);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 等待所有任务完成
|
|
|
|
|
|
|
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
|
|
|
|
|
|
|
|
|
|
|
return new Result<>(list);
|
|
|
|
return new Result<>(list);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
return new Result<>(list);
|
|
|
|
return new Result<>(list);
|
|
|
|
@ -186,7 +201,7 @@ public class IndustrialCameraController {
|
|
|
|
kuKou.setWmsCode(industrialCameraVo.getCode());
|
|
|
|
kuKou.setWmsCode(industrialCameraVo.getCode());
|
|
|
|
kuKou.setPath(configProperties.getSavePath().getNetPicPath()+pa+".jpg");
|
|
|
|
kuKou.setPath(configProperties.getSavePath().getNetPicPath()+pa+".jpg");
|
|
|
|
kuKouService.save(kuKou);
|
|
|
|
kuKouService.save(kuKou);
|
|
|
|
serialPortExample.openLight(0);
|
|
|
|
// serialPortExample.openLight(0);
|
|
|
|
return new Result<>(kuKou);
|
|
|
|
return new Result<>(kuKou);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|