|
@@ -32,6 +32,8 @@ import javax.validation.ConstraintViolationException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 利库资源池Controller
|
|
@@ -177,7 +179,11 @@ public class LiKuResourcePoolController extends BaseController {
|
|
|
String area = "";
|
|
|
try {
|
|
|
ImportUtil ei = new ImportUtil(file,0,0);
|
|
|
- List<LiKuResourcePool> list = ei.getDataList(LiKuResourcePool.class);
|
|
|
+ //导入数据 如果没有序号则认为是空行直接过滤
|
|
|
+ List<LiKuResourcePool> list = ei.getDataList(LiKuResourcePool.class)
|
|
|
+ .stream()
|
|
|
+ .filter(l->StringUtils.isNotBlank(l.getSerialNumber()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
for(LiKuResourcePool pool:list){
|
|
|
pool.setIsSectionLength(LiKuUtils.isTheUnitMeter(pool.getUnitOfMeasurement()));
|
|
|
//获取库存地描述,标记数据所属区域
|
|
@@ -191,9 +197,27 @@ public class LiKuResourcePoolController extends BaseController {
|
|
|
Integer isSectionLength = pool.getIsSectionLength();
|
|
|
if (isSectionLength.compareTo(LiKuUtils.YES) == 0) {
|
|
|
String lengthOfCable = pool.getLengthOfCable();
|
|
|
+
|
|
|
if (null != lengthOfCable && !"".equals(lengthOfCable)) {
|
|
|
- String[] split = lengthOfCable.split(";");
|
|
|
+ String[] split = new String[0];
|
|
|
+ if(lengthOfCable.contains(";")){
|
|
|
+ split = lengthOfCable.split(";");
|
|
|
+ }else if(lengthOfCable.contains(",")){
|
|
|
+ split = lengthOfCable.split(",");
|
|
|
+ }else if(lengthOfCable.contains("/")){
|
|
|
+ split = lengthOfCable.split("/");
|
|
|
+ }else if(lengthOfCable.contains(",")){
|
|
|
+ split = lengthOfCable.split(",");
|
|
|
+ }else if(lengthOfCable.contains(";")){
|
|
|
+ split = lengthOfCable.split(";");
|
|
|
+ }
|
|
|
+ Pattern pattern = Pattern.compile("[\u4e00-\u9fa5]+");
|
|
|
for (int i = 0; i < split.length; i++) {
|
|
|
+ if(pattern.matcher(split[i]).find()){
|
|
|
+ throw new RuntimeException("段长物资格式不正确,内包含中文!");
|
|
|
+ }else if(StringUtils.isBlank(split[i])){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
LiKuResourcePool liKu = new LiKuResourcePool();
|
|
|
liKu.setSerialNumber(pool.getSerialNumber());
|
|
|
liKu.setPlanner(pool.getPlanner());
|
|
@@ -242,6 +266,8 @@ public class LiKuResourcePoolController extends BaseController {
|
|
|
} catch (Exception e) {
|
|
|
j.setSuccess(false);
|
|
|
j.setMsg("导入利库资源池失败!失败信息:"+e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ System.out.println(e.getMessage());
|
|
|
}
|
|
|
return j;
|
|
|
}
|