型侃PDF导入调整
parent
a147da04df
commit
bcc158cb60
|
|
@ -300,6 +300,8 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
|
|||
info=str[j].split(" ");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Boolean temp=Boolean.FALSE;
|
||||
|
|
@ -307,6 +309,10 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
|
|||
shdz=info[1];
|
||||
continue;
|
||||
|
||||
}
|
||||
if(isAddress(info[0])){
|
||||
continue;
|
||||
|
||||
}
|
||||
if(info[0].indexOf("单据请当场仔细验收")>=0){
|
||||
|
||||
|
|
@ -321,7 +327,6 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
|
|||
}
|
||||
|
||||
if(info[0].indexOf("产品质量")>=0){
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
|
@ -331,53 +336,51 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
|
|||
bzh=info[1];
|
||||
temp=true;
|
||||
}else{
|
||||
if(info.length>1){
|
||||
String [] bb=info;
|
||||
List<String> listWithEmptyStrings = new ArrayList<>(Arrays.asList(bb));
|
||||
listWithEmptyStrings.removeIf(String::isEmpty);
|
||||
String[] resultArray = listWithEmptyStrings.toArray(new String[0]);
|
||||
cpdm=resultArray[1];
|
||||
cpdm=cpdm.replaceAll("([\u4E00-\u9FA5]+)|([\u4E00-\u9FA5])","");
|
||||
System.out.println(cpdm);
|
||||
line=Integer.parseInt(resultArray[0]);
|
||||
System.out.println(line);
|
||||
}
|
||||
// 使用removeIf方法移除所有空字符串
|
||||
String [] aa=info;
|
||||
List<String> listWithEmptyStrings = new ArrayList<>(Arrays.asList(aa));
|
||||
listWithEmptyStrings.removeIf(String::isEmpty);
|
||||
String[] resultArray = listWithEmptyStrings.toArray(new String[0]);
|
||||
for(int x=2;x<resultArray.length;x++){
|
||||
String s=resultArray[x];
|
||||
if(s.equals("**")){
|
||||
qty=resultArray[x-1];
|
||||
unit="个";
|
||||
break;
|
||||
}
|
||||
}
|
||||
SdPdf pdf=new SdPdf();
|
||||
pdf.setPage(p);
|
||||
pdf.setLine(line);
|
||||
pdf.setMdmc(mdmc);
|
||||
pdf.setCusName(cusName);
|
||||
pdf.setLinkMan(linkMan);
|
||||
pdf.setHth(hth);
|
||||
pdf.setTel(tel);
|
||||
pdf.setShdh(shdh.replaceAll("\\s*|\r|\n|\t",""));
|
||||
pdf.setShdz(shdz);
|
||||
pdf.setDyrq(dyrq);
|
||||
pdf.setCpdm(cpdm);
|
||||
pdf.setUnit(unit);
|
||||
/*String REGEX_CHINESE = "[\u4e00-\u9fa5]";
|
||||
String string = qty.replaceAll(REGEX_CHINESE, "");
|
||||
pdf.setQty(Double.parseDouble(string));*/
|
||||
pdf.setQty(Double.parseDouble(qty));
|
||||
pdf.setBzh(bzh);
|
||||
pdfs.add(pdf);
|
||||
|
||||
String [] bb=info;
|
||||
List<String> listWithEmptyStrings2 = new ArrayList<>(Arrays.asList(bb));
|
||||
listWithEmptyStrings2.removeIf(String::isEmpty);
|
||||
String[] resultArray2 = listWithEmptyStrings2.toArray(new String[0]);
|
||||
cpdm=resultArray2[1];
|
||||
cpdm=cpdm.replaceAll("([\u4E00-\u9FA5]+)|([\u4E00-\u9FA5])","");
|
||||
System.out.println(cpdm);
|
||||
line=Integer.parseInt(resultArray2[0]);
|
||||
System.out.println(line);
|
||||
// 使用removeIf方法移除所有空字符串
|
||||
String [] aa=info;
|
||||
List<String> listWithEmptyStrings = new ArrayList<>(Arrays.asList(aa));
|
||||
listWithEmptyStrings.removeIf(String::isEmpty);
|
||||
String[] resultArray = listWithEmptyStrings.toArray(new String[0]);
|
||||
for(int x=2;x<resultArray.length;x++){
|
||||
String s=resultArray[x];
|
||||
if(s.equals("**")){
|
||||
qty=resultArray[x-1];
|
||||
unit="个";
|
||||
break;
|
||||
}
|
||||
}
|
||||
SdPdf pdf=new SdPdf();
|
||||
pdf.setPage(p);
|
||||
pdf.setLine(line);
|
||||
pdf.setMdmc(mdmc);
|
||||
pdf.setCusName(cusName);
|
||||
pdf.setLinkMan(linkMan);
|
||||
pdf.setHth(hth);
|
||||
pdf.setTel(tel);
|
||||
pdf.setShdh(shdh.replaceAll("\\s*|\r|\n|\t",""));
|
||||
pdf.setShdz(shdz);
|
||||
pdf.setDyrq(dyrq);
|
||||
pdf.setCpdm(cpdm);
|
||||
pdf.setUnit(unit);
|
||||
/*String REGEX_CHINESE = "[\u4e00-\u9fa5]";
|
||||
String string = qty.replaceAll(REGEX_CHINESE, "");
|
||||
pdf.setQty(Double.parseDouble(string));*/
|
||||
pdf.setQty(Double.parseDouble(qty));
|
||||
pdf.setBzh(bzh);
|
||||
pdfs.add(pdf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -521,6 +524,22 @@ public class DefaultImportFileManager extends DefaultBaseManager implements Impo
|
|||
}
|
||||
}
|
||||
|
||||
private static final String[] ADDRESS_KEYWORDS = {"省", "市", "区", "街道", "路", "街", "交叉路口","楼"};
|
||||
|
||||
public static boolean isAddress(String input) {
|
||||
if (input == null || input.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String keyword : ADDRESS_KEYWORDS) {
|
||||
if (input.contains(keyword)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void storePdfInfo(List<SdPdf> pdfs) {
|
||||
if(pdfs.size()>0){
|
||||
|
|
|
|||
Loading…
Reference in New Issue