| | |
| | | package com.whyc.util; |
| | | |
| | | import com.whyc.constant.MaterialNamingStandard; |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.dto.MaterialCheckDTO; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.service.DocLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * 通用工具列 |
| | |
| | | } |
| | | |
| | | /**手动记录特定日志*/ |
| | | public static void record(long uId, int operationType, String msg){ |
| | | docLogService.record(uId,operationType,msg); |
| | | public static void record(long uId,String name, int operationType, String msg){ |
| | | docLogService.record(uId,name,operationType,msg); |
| | | } |
| | | |
| | | /**手动记录特定日志*/ |
| | | public static void record(long uId, int operationType, String msg,String msgDetail){ |
| | | docLogService.record(uId,operationType,msg,msgDetail); |
| | | public static void record(long uId,String name, int operationType, String msg,String msgDetail){ |
| | | docLogService.record(uId,name,operationType,msg,msgDetail); |
| | | } |
| | | /**手动记录特定日志*/ |
| | | public static void record2(HttpServletRequest request,long uId, int operationType, String msg,String msgDetail){ |
| | | docLogService.record2(request,uId,operationType,msg,msgDetail); |
| | | public static void record2(HttpServletRequest request,long uId,String name, int operationType, String msg,String msgDetail){ |
| | | docLogService.record2(request,uId,name,operationType,msg,msgDetail); |
| | | } |
| | | |
| | | /** |
| | | * 物料编码自动填充补齐 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static String codeAutoFill(String code){ |
| | | int length = code.length(); |
| | | if (length == 9) { |
| | | code = "0" + code; |
| | | } else if (length < 9) { |
| | | int centerZeroNum = 10 - length - 1; |
| | | StringBuilder centerZeroStr = new StringBuilder(); |
| | | for (int j = 0; j < centerZeroNum; j++) { |
| | | centerZeroStr.append("0"); |
| | | } |
| | | String strFront = code.substring(0, 3); |
| | | String strBehind = code.substring(3); |
| | | code = "0" + strFront + centerZeroStr + strBehind; |
| | | } |
| | | return code; |
| | | } |
| | | |
| | | /** |
| | | * 物料规范校验 |
| | | * |
| | | * */ |
| | | public static List<MaterialCheckDTO> checkFormat(List<MaterialCheckDTO> dtoList){ |
| | | List<MaterialCheckDTO> irregularList = new LinkedList<>(); |
| | | for (int i = 0; i < dtoList.size(); i++) { |
| | | MaterialCheckDTO materialCheckDTO = dtoList.get(i); |
| | | String subCode = materialCheckDTO.getSubCode(); |
| | | subCode = subCode.substring(0,4); |
| | | String subName = materialCheckDTO.getSubName(); |
| | | String subModel = materialCheckDTO.getSubModel(); |
| | | switch (subCode){ |
| | | case "0301":{ |
| | | //名称 |
| | | if(Pattern.matches(MaterialNamingStandard.CAPACITOR_TP_0301.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CAPACITOR_TP_0301.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CAPACITOR_TP_0301.getName()+"规范为:"+MaterialNamingStandard.CAPACITOR_TP_0301.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getName()+"规范为:"+MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getName()+"规范为:"+MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.CAPACITOR_TP_0301.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getNameRegexDesc() |
| | | + " 或 "+ MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getNameRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0302":{ |
| | | if(Pattern.matches(MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getName()+"规范为:"+MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getName()+"规范为:"+MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.CAPACITOR_CJ_0301_0302.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.CAPACITOR_DJ_0301_0302.getNameRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0311": |
| | | case "0312":{ |
| | | if(Pattern.matches(MaterialNamingStandard.RES_0311_0312.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.RES_0311_0312.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.RES_0311_0312.getName()+"规范为:"+MaterialNamingStandard.RES_0311_0312.getModelRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.RES_0311_0312.getNameRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0321":{ |
| | | if(Pattern.matches(MaterialNamingStandard.DIODE_TP_0321.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_TP_0321.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_TP_0321.getName()+"规范为:"+MaterialNamingStandard.DIODE_TP_0321.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.DIODE_FWY_0321_0322.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_FWY_0321_0322.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_FWY_0321_0322.getName()+"规范为:"+MaterialNamingStandard.DIODE_FWY_0321_0322.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.DIODE_WY_0321_0322.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_WY_0321_0322.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_WY_0321_0322.getName()+"规范为:"+MaterialNamingStandard.DIODE_WY_0321_0322.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.DIODE_TP_0321.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.DIODE_FWY_0321_0322.getNameRegexDesc() |
| | | + " 或 "+ MaterialNamingStandard.DIODE_WY_0321_0322.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0322":{ |
| | | if(Pattern.matches(MaterialNamingStandard.DIODE_CJ_0322.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_CJ_0322.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_CJ_0322.getName()+"规范为:"+MaterialNamingStandard.DIODE_CJ_0322.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.DIODE_FWY_0321_0322.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_FWY_0321_0322.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_FWY_0321_0322.getName()+"规范为:"+MaterialNamingStandard.DIODE_FWY_0321_0322.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.DIODE_WY_0321_0322.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DIODE_WY_0321_0322.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DIODE_WY_0321_0322.getName()+"规范为:"+MaterialNamingStandard.DIODE_WY_0321_0322.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.DIODE_CJ_0322.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.DIODE_FWY_0321_0322.getNameRegexDesc() |
| | | + " 或 "+ MaterialNamingStandard.DIODE_WY_0321_0322.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0331": |
| | | case "0332":{ |
| | | if(Pattern.matches(MaterialNamingStandard.TRIODE_0331_0332.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.TRIODE_0331_0332.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.TRIODE_0331_0332.getName()+"规范为:"+MaterialNamingStandard.TRIODE_0331_0332.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.TRIODE_0331_0332.getNameRegexDesc()); |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0341": |
| | | case "0342":{ |
| | | if(Pattern.matches(MaterialNamingStandard.IC_CHIP_0341_0342.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.IC_CHIP_0341_0342.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.IC_CHIP_0341_0342.getName()+"规范为:"+MaterialNamingStandard.IC_CHIP_0341_0342.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.IC_CHIP_0341_0342.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0217":{ |
| | | if(Pattern.matches(MaterialNamingStandard.DCDC_0217.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.DCDC_0217.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.DCDC_0217.getName()+"规范为:"+MaterialNamingStandard.DCDC_0217.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.DCDC_0217.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0351":{ |
| | | if(Pattern.matches(MaterialNamingStandard.INDUCTANCE_CJ_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.INDUCTANCE_CJ_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.INDUCTANCE_CJ_0351.getName()+"规范为:"+MaterialNamingStandard.INDUCTANCE_CJ_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.INDUCTANCE_DZ_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.INDUCTANCE_DZ_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.INDUCTANCE_DZ_0351.getName()+"规范为:"+MaterialNamingStandard.INDUCTANCE_DZ_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.INDUCTANCE_TP_CZ_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.INDUCTANCE_TP_CZ_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.INDUCTANCE_TP_CZ_0351.getName()+"规范为:"+MaterialNamingStandard.INDUCTANCE_TP_CZ_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.INDUCTANCE_TP_DG_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.INDUCTANCE_TP_DG_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.INDUCTANCE_TP_DG_0351.getName()+"规范为:"+MaterialNamingStandard.INDUCTANCE_TP_DG_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.TRANSFORMER_BYQ_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.TRANSFORMER_BYQ_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.TRANSFORMER_BYQ_0351.getName()+"规范为:"+MaterialNamingStandard.TRANSFORMER_BYQ_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.TRANSFORMER_BYQ_DZ_0351.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.TRANSFORMER_BYQ_DZ_0351.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.TRANSFORMER_BYQ_DZ_0351.getName()+"规范为:"+MaterialNamingStandard.TRANSFORMER_BYQ_DZ_0351.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.INDUCTANCE_CJ_0351.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.INDUCTANCE_DZ_0351.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.INDUCTANCE_TP_CZ_0351.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.INDUCTANCE_TP_DG_0351.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.TRANSFORMER_BYQ_0351.getNameRegexDesc() |
| | | + " 或 "+ MaterialNamingStandard.TRANSFORMER_BYQ_DZ_0351.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0381":{ |
| | | if(Pattern.matches(MaterialNamingStandard.FUSE_0381.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.FUSE_0381.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.FUSE_0381.getName()+"规范为:"+MaterialNamingStandard.FUSE_0381.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.FUSE_0381.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0363":{ |
| | | if(Pattern.matches(MaterialNamingStandard.OPTOCOUPLER_0363.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.OPTOCOUPLER_0363.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.OPTOCOUPLER_0363.getName()+"规范为:"+MaterialNamingStandard.OPTOCOUPLER_0363.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.OPTOCOUPLER_0363.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0362":{ |
| | | if(Pattern.matches(MaterialNamingStandard.RELAY_0362.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.RELAY_0362.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.RELAY_0362.getName()+"规范为:"+MaterialNamingStandard.RELAY_0362.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.RELAY_0362.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0382":{ |
| | | if(Pattern.matches(MaterialNamingStandard.KEY_SWITCH_0382.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.KEY_SWITCH_0382.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.KEY_SWITCH_0382.getName()+"规范为:"+MaterialNamingStandard.KEY_SWITCH_0382.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.KEY_SWITCH_0382.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0103":{ |
| | | if(Pattern.matches(MaterialNamingStandard.RADIATOR_0103.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.RADIATOR_0103.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.RADIATOR_0103.getName()+"规范为:"+MaterialNamingStandard.RADIATOR_0103.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.RADIATOR_TY_0103.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.RADIATOR_TY_0103.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.RADIATOR_TY_0103.getName()+"规范为:"+MaterialNamingStandard.RADIATOR_TY_0103.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.RADIATOR_0103.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.RADIATOR_TY_0103.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0372":{ |
| | | if(Pattern.matches(MaterialNamingStandard.ANTENNAE_PEDESTAL_0372.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.ANTENNAE_PEDESTAL_0372.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.ANTENNAE_PEDESTAL_0372.getName()+"规范为:"+MaterialNamingStandard.ANTENNAE_PEDESTAL_0372.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.CONNECTOR_ASSEMBLED_0372.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CONNECTOR_ASSEMBLED_0372.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CONNECTOR_ASSEMBLED_0372.getName()+"规范为:"+MaterialNamingStandard.CONNECTOR_ASSEMBLED_0372.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else if(Pattern.matches(MaterialNamingStandard.CONNECTOR_PCB_0372.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CONNECTOR_PCB_0372.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CONNECTOR_PCB_0372.getName()+"规范为:"+MaterialNamingStandard.CONNECTOR_PCB_0372.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.ANTENNAE_PEDESTAL_0372.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.CONNECTOR_ASSEMBLED_0372.getNameRegexDesc() |
| | | +" 或 " + MaterialNamingStandard.CONNECTOR_PCB_0372.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0361":{ |
| | | if(Pattern.matches(MaterialNamingStandard.CRYSTAL_OSCILLATOR_0361.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CRYSTAL_OSCILLATOR_0361.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CRYSTAL_OSCILLATOR_0361.getName()+"规范为:"+MaterialNamingStandard.CRYSTAL_OSCILLATOR_0361.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.CRYSTAL_OSCILLATOR_0361.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0214":{ |
| | | if(Pattern.matches(MaterialNamingStandard.SENSOR_0214.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.SENSOR_0214.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.SENSOR_0214.getName()+"规范为:"+MaterialNamingStandard.SENSOR_0214.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.SENSOR_0214.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0343":{ |
| | | if(Pattern.matches(MaterialNamingStandard.CIRCUIT_MODEL_0343.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.CIRCUIT_MODEL_0343.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.CIRCUIT_MODEL_0343.getName()+"规范为:"+MaterialNamingStandard.CIRCUIT_MODEL_0343.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.CIRCUIT_MODEL_0343.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0391":{ |
| | | if(subName.contains("电池")) { |
| | | if (Pattern.matches(MaterialNamingStandard.BATTERY_OR_ELSE_0391.getNameRegex(), subName)) { |
| | | //型号 |
| | | if (!Pattern.matches(MaterialNamingStandard.BATTERY_OR_ELSE_0391.getModelRegex(), subModel)) { |
| | | materialCheckDTO.setIrregularDesc("型号不对,电池规范为:" + MaterialNamingStandard.BATTERY_OR_ELSE_0391.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } else { //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:" + MaterialNamingStandard.BATTERY_OR_ELSE_0391.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | }break; |
| | | case "0212":{ |
| | | if(Pattern.matches(MaterialNamingStandard.FAN_0212.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.FAN_0212.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.FAN_0212.getName()+"规范为:"+MaterialNamingStandard.FAN_0212.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.FAN_0212.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | case "0226":{ |
| | | if(subName.contains("天线")){ |
| | | if(Pattern.matches(MaterialNamingStandard.ANTENNAE_SPECIAL_OR_ELSE_0226.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.ANTENNAE_SPECIAL_OR_ELSE_0226.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,天线规范为:"+MaterialNamingStandard.ANTENNAE_SPECIAL_OR_ELSE_0226.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else { |
| | | //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:" + MaterialNamingStandard.ANTENNAE_SPECIAL_OR_ELSE_0226.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | }break; |
| | | case "0213":{ |
| | | if(Pattern.matches(MaterialNamingStandard.SWITCHING_POWER_0213.getNameRegex(),subName)){ |
| | | //型号 |
| | | if(!Pattern.matches(MaterialNamingStandard.SWITCHING_POWER_0213.getModelRegex(),subModel)){ |
| | | materialCheckDTO.setIrregularDesc("型号不对,"+MaterialNamingStandard.SWITCHING_POWER_0213.getName()+"规范为:"+MaterialNamingStandard.SWITCHING_POWER_0213.getModelRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | } |
| | | else{ //不符合上述命名规则 |
| | | materialCheckDTO.setIrregularDesc("名称不对,规范为:"+MaterialNamingStandard.SWITCHING_POWER_0213.getNameRegexDesc()); |
| | | |
| | | irregularList.add(materialCheckDTO); |
| | | } |
| | | }break; |
| | | default: break; |
| | | } |
| | | |
| | | } |
| | | |
| | | return irregularList; |
| | | } |
| | | } |