图片按照行列存储

merge-requests/5/merge
yiming 4 years ago
parent be05be2071
commit 23b9c29b2c

@ -30,6 +30,12 @@ public class PathUtil {
return time + "/" + now.format(DateTimeFormatter.ofPattern("HHmmss-"))+getRandomString(10) + "."+fileType;
}
public static String createFileNameByRowColumn(String fileType,Integer cameraId,Integer row,Integer column){
LocalDateTime now = LocalDateTime.now();
String date = now.format(DateTimeFormatter.ofPattern("yyyy/MM/dd")) + "/"+cameraId;
return row+"-"+column+"/"+date + "/" +date+ now.format(DateTimeFormatter.ofPattern("HHmmss-"))+row+"-"+column + "."+fileType;
}
/**
*
* @param url

@ -222,7 +222,18 @@ public class PlcService {
if(code.startsWith("C1") || code.startsWith("C3")){
delay = true;
}
path = cameraCapture(cameraId,delay,configProperties.getCameraConfig().getDelayCaptureTime());
Integer row = 0;
Integer column = 0;
if(times<=2){
row = plcCmdInfo.getRow1();
column = plcCmdInfo.getColumn1();
}else {
row = plcCmdInfo.getRow2();
column = plcCmdInfo.getColumn2();
}
path = PathUtil.createFileNameByRowColumn("jpg",cameraId,row,column);
path = cameraCapture(cameraId,delay,configProperties.getCameraConfig().getDelayCaptureTime(),path);
}
//update order info after capture
if (path != null && needCapture) {
@ -281,8 +292,8 @@ public class PlcService {
*
* @Return pic address
*/
public String cameraCapture(Integer cameraId,Boolean delay,Long delayTime) {
String path = PathUtil.createFileName("jpg",cameraId);
public String cameraCapture(Integer cameraId,Boolean delay,Long delayTime,String path) {
//String path = PathUtil.createFileName("jpg",cameraId);
String realPath = configProperties.getSavePath().getMediaPath() + path;
if(delay){
TaskDelayExecutor.addPicDelayTask(cameraId,realPath,delayTime);
@ -522,7 +533,8 @@ public class PlcService {
} catch (InterruptedException e) {
e.printStackTrace();
}
String path = cameraCapture(cameraId,false,null);
String path = PathUtil.createFileNameByRowColumn("jpg",cameraId,plcCmdInfo.getRow1(),plcCmdInfo.getColumn1());
cameraCapture(cameraId,false,null,path);
//托盘码
String trayCode = null;
Boolean trayCheck = Boolean.TRUE;

Loading…
Cancel
Save