判断RRR号格式为:供应商+年月日,如:vm00001100328

// 判断RRR号是否符合规则
     String rrrNo = rrrNos[rowIndex];
     String vendorCode = WebUtil.getCurrentOrganization(request).getOrgCode();
     if ((rrrNo!=null) && !(rrrNo.equals("")) && (rrrNo.length()==vendorCode.length()+6)){
      if (!(rrrNo.substring(0, vendorCode.length()).equals(vendorCode))){
       addActionMessageX(WebConstants.ERROR, request, msgs, "returnCode.rrr.info.error");
       saveMessages(request, msgs);
      } else{
       String dateStr = rrrNo.substring(vendorCode.length(), rrrNo.length());
       if (dateStr.length()!=6){
        addActionMessageX(WebConstants.ERROR, request, msgs, "returnCode.rrr.info.error");
        saveMessages(request, msgs);
       } else{
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
         dateFormat.setLenient(false);
         try {
         dateFormat.parse("20"+dateStr.substring(0,2)+"/"+dateStr.substring(2, 4)+"/"+dateStr.substring(4, 6));
        } catch (ParseException e) {
         addActionMessageX(WebConstants.ERROR, request, msgs, "returnCode.rrr.info.error");
         saveMessages(request, msgs);
        }
       }
      }
     } else{
      addActionMessageX(WebConstants.ERROR, request, msgs, "returnCode.rrr.info.error");
      saveMessages(request, msgs);
     }

你可能感兴趣的:(String,null)