|
|
|
|
@ -8,7 +8,7 @@ import lombok.Data;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
public class TransmissionPojo {
|
|
|
|
|
@ -22,16 +22,16 @@ public class TransmissionPojo {
|
|
|
|
|
|
|
|
|
|
private String pcd;//点位文件路径
|
|
|
|
|
private String taskId;
|
|
|
|
|
private Integer checkId;
|
|
|
|
|
private String checkId;
|
|
|
|
|
private Integer direction;//左右
|
|
|
|
|
private Integer count; //数量
|
|
|
|
|
private String category; //品规
|
|
|
|
|
private String[] picsPath; //照片
|
|
|
|
|
private Integer count = 0; //数量
|
|
|
|
|
private String category = ""; //品规
|
|
|
|
|
private Set<String> picsPath; //照片
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Integer result;
|
|
|
|
|
public TransmissionPojo(CheckLog checkLog , Street street){
|
|
|
|
|
this.checkId = checkLog.getId();
|
|
|
|
|
this.checkId = checkLog.getId().toString();
|
|
|
|
|
this.streetNumber = street.getPlcId();
|
|
|
|
|
this.taskId = checkLog.getLotnum();
|
|
|
|
|
this.row = checkLog.getRow();
|
|
|
|
|
@ -46,14 +46,32 @@ public class TransmissionPojo {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将给定数字转换为指定长度(默认3位)的字符,不足部分用“0”补全。
|
|
|
|
|
*
|
|
|
|
|
* @param number 需要转换的数字
|
|
|
|
|
* @param length 目标字符长度(默认3)
|
|
|
|
|
* @return 符合要求的字符串
|
|
|
|
|
*/
|
|
|
|
|
public static String convertNumberToFixedLengthChars(int number, int length) {
|
|
|
|
|
if (length < 1) {
|
|
|
|
|
throw new IllegalArgumentException("Length must be a positive integer.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String numStr = Integer.toString(number);
|
|
|
|
|
while (numStr.length() < length) {
|
|
|
|
|
numStr = "0" + numStr;
|
|
|
|
|
}
|
|
|
|
|
return numStr;
|
|
|
|
|
}
|
|
|
|
|
public TransmissionPojo( Street street,Integer row , Integer column,Integer direction,String orderId){
|
|
|
|
|
this.streetNumber = street.getPlcId();
|
|
|
|
|
this.row = row;
|
|
|
|
|
|
|
|
|
|
this.taskId = orderId;
|
|
|
|
|
this.taskId = "0";
|
|
|
|
|
this.direction = direction;
|
|
|
|
|
this.column = column;
|
|
|
|
|
this.checkId = 0;
|
|
|
|
|
this.checkId = convertNumberToFixedLengthChars(row, 3) + convertNumberToFixedLengthChars(column, 3);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public String toString(TransmissionType type) {
|
|
|
|
|
@ -64,8 +82,6 @@ public class TransmissionPojo {
|
|
|
|
|
return "GPS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction+ "&" + category + "&" + count;
|
|
|
|
|
}else if (type == TransmissionType.RTS) {
|
|
|
|
|
return "RTS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction + "&" + category + "&" + count;
|
|
|
|
|
}else if (type == TransmissionType.SGPS) {
|
|
|
|
|
return "SGPS&" + streetNumber +"/"+row +"/"+column+ "&" + checkId + "&" + taskId + "&" + direction ;
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@ -79,35 +95,64 @@ public class TransmissionPojo {
|
|
|
|
|
String[] dataArr = dataArray[1].split("/");
|
|
|
|
|
this.streetNumber = dataArr[0];
|
|
|
|
|
this.row = Integer.valueOf(dataArr[1]);
|
|
|
|
|
this.column = Integer.valueOf(dataArr[2]);
|
|
|
|
|
if(dataArr.length > 2) {
|
|
|
|
|
this.column = Integer.valueOf(dataArr[2]);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
this.streetNumber = dataArray[1];
|
|
|
|
|
}
|
|
|
|
|
if (dataArray.length > 2) {
|
|
|
|
|
this.checkId = Integer.valueOf(dataArray[2]);
|
|
|
|
|
this.checkId = dataArray[2];
|
|
|
|
|
this.taskId = (dataArray[3]);
|
|
|
|
|
this.direction = Integer.valueOf(dataArray[4]);
|
|
|
|
|
if(dataArray[4] != null && !"".equals(dataArray[4]) && !"null".equals(dataArray[4])) {
|
|
|
|
|
this.direction = Integer.valueOf(dataArray[4]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dataArray.length > 5) {
|
|
|
|
|
this.category = dataArray[5];
|
|
|
|
|
if(!"".equals(dataArray[6]) && dataArray[6] != null) {
|
|
|
|
|
if(dataArray[5] != null &&!"".equals(dataArray[5]) && !"null".equals(dataArray[5]) ) {
|
|
|
|
|
|
|
|
|
|
this.category = dataArray[5];
|
|
|
|
|
}
|
|
|
|
|
if( dataArray.length > 6 && dataArray[6] != null && !"".equals(dataArray[6]) && ! "null".equals(dataArray[5])) {
|
|
|
|
|
this.count = Integer.valueOf(dataArray[6]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (dataArray.length > 7) {
|
|
|
|
|
this.result = Integer.parseInt(dataArray[7])==0 ?0:1;
|
|
|
|
|
this.picsPath = dataArray[8].split(";");
|
|
|
|
|
//不记录2d图像
|
|
|
|
|
//String path2D = "/fileData/"+this.taskId+"/"+this.checkId+"/"+this.direction+".jpg";
|
|
|
|
|
String path3D = "/fileData/"+this.taskId+"/"+this.checkId+"/"+(this.direction+2)+".PNG";
|
|
|
|
|
Set<String> strings = new HashSet<>();
|
|
|
|
|
//strings.add(path2D);
|
|
|
|
|
strings.add(path3D);
|
|
|
|
|
|
|
|
|
|
// 将数组中的元素添加到 Set 集合中
|
|
|
|
|
if(dataArray.length > 8 && dataArray[8].split(";").length>0) {
|
|
|
|
|
String[] s = dataArray[8].split(";");
|
|
|
|
|
for (int i = 0; i < s.length; i++) {
|
|
|
|
|
s[i] = s[i].replace("\\\\","/");
|
|
|
|
|
s[i] = s[i].replace("\\","/");
|
|
|
|
|
if(s[i].startsWith(".")) {
|
|
|
|
|
s[i] = s[i].replaceFirst(".", ""); // 移除单个字符
|
|
|
|
|
}
|
|
|
|
|
// 或者
|
|
|
|
|
// stringArray[i] = stringArray[i].replaceAll(regexToRemove, ""); // 使用正则表达式移除字符类别
|
|
|
|
|
}
|
|
|
|
|
Collections.addAll(strings,s);
|
|
|
|
|
strings.remove("");
|
|
|
|
|
}
|
|
|
|
|
this.picsPath = strings;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (dataArray.length > 9) {
|
|
|
|
|
this.pcd = dataArray[9];
|
|
|
|
|
if(this.taskId != null && !"".equals(this.taskId) && this.checkId != null && !"".equals(this.checkId))
|
|
|
|
|
this.pcd = "/fileData/"+this.taskId+"/"+this.checkId+"/"+(this.direction+2)+".pcd";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
TransmissionPojo transmissionPojo = new TransmissionPojo("RTE&6/3&562493&2121&1&S001&25&1&1.jpg;2.jpg&1.pcd>");
|
|
|
|
|
TransmissionPojo transmissionPojo = new TransmissionPojo("GPE&002/1/18&7&2&123&41111&30&0&fff;.\\\\f.png;/f.png>");
|
|
|
|
|
System.out.println(transmissionPojo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|