Browse Source

不限制数字,运输方式默认火运或汽运

QuietShadow 3 năm trước cách đây
mục cha
commit
36c665cb6c

+ 5 - 1
src/main/java/com/steerinfo/ems/emsgmpcjh/service/impl/EmsGmPcJhServiceImpl.java

@@ -164,7 +164,7 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
             //Pattern pattern = Pattern.compile("^-?[0-9]+"); //这个也行
             //Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");//这个也行
             //正整数
-            Pattern pattern = Pattern.compile("[0-9]*");
+            Pattern pattern = Pattern.compile("^(\\-|\\+)?\\d+(\\.\\d+)?$");
             if(arr[0].length()>8 || !pattern.matcher(arr[0]).matches()){
                 throw new MarketSlmException(500,"排产日期(编号)有误!");
             }
@@ -216,6 +216,10 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
                         spp.setLengths(new BigDecimal(arr[j]));
                         break;
                     case "运输方式" :
+                        if(arr[j] == null || "".equals(arr[j])){
+                            spp.setTransportType("火运或汽运");
+                            break;
+                        }
                         spp.setTransportType(arr[j]);
                         break;
                     case "用途" :