public without sharing class LicenseCheckUtil { public static String LicenseCheck1(String str){ String isOk = '1'; List liList= [select id,IfQuantityCtrl__c,Is_Active_Formula__c,LicenseAndAccount__r.Name,LicenseType__c from License_Information__c where LicenseAndAccount__c = :str]; Integer hasA = -1; if(liList == null){ isOk = '经销商无辐射证照信息'; }else{ for (License_Information__c li : liList ) { if(li.LicenseType__c == '辐射安全许可证' && li.Is_Active_Formula__c == true){ if(li.IfQuantityCtrl__c){ hasA = 1; }else{ hasA = 0; isOk = '0'; } } } } if(hasA == -1){ isOk = '经销商辐射证照无效'; } return isOk; } public static String LicenseCheckOly(){ String isOk = '1'; String str = System.label.Olympus_Id; List liList= [select id, IfControl__c,Is_Active_Formula__c,LicenseAndAccount__r.Name,LicenseType__c from License_Information__c where LicenseAndAccount__c = :str]; System.debug('License_Information__c'+liList); Integer hasA = -1; if(liList == null){ isOk = '经销商无辐射证照信息'; }else{ for (License_Information__c li : liList ) { if(li.LicenseType__c == '辐射安全许可证' && li.Is_Active_Formula__c == true){ if(li.IfControl__c){ hasA = 1; }else{ hasA = 0; isOk = '0'; } } } } if(hasA == -1){ isOk = '经销商辐射证照无效'; } System.debug(isOk); return isOk; } public static Boolean AddressCheck(String str,String add){ Boolean isOk = false; List liList= [select id,Is_Active_Formula__c,LicenseAndAccount__r.Name,LicenseType__c,StorageAddress__c from License_Information__c where LicenseAndAccount__c = :str and LicenseType__c = '第二类医疗器械经营备案凭证' and Is_Active_Formula__c = true]; if(liList != null && liList.size() >0 ){ License_Information__c li = liList[0]; //isOk = add.equals(li.StorageAddress__c); //isOk = li.StorageAddress__c.contains(add); List addressList = new List(); addressList = li.StorageAddress__c.split(';'); for (String str1 : addressList ) { if(str1.equals(add)){ isOk = true; } } } return isOk; } public static String LicenseCheck(String str1){ System.debug(str1); String isOk = '1'; Boolean hasA = false; Boolean hasB = false; List liList= [select id,Is_Active_Formula__c,LicenseAndAccount__r.Name,LicenseType__c from License_Information__c where LicenseAndAccount__c = :str1]; System.debug('!@!@!@'+liList); if(liList == null){ isOk = '代理商没有证照信息'; }else{ for(License_Information__c li : liList){ if(li.LicenseType__c == '营业执照' && li.Is_Active_Formula__c == true){ hasA = true; } if(li.LicenseType__c == '第二类医疗器械经营备案凭证' && li.Is_Active_Formula__c == true){ hasB = true; } } } if(hasA == false && hasB == false){ isOk = '代理商营业执照和第二类医疗器械经营备案凭证都为无效'; }else if(hasA == false && hasB == true){ isOk = '代理商营业执照为无效'; }else if(hasA == true && hasB == false){ isOk = '代理商第二类医疗器械经营备案凭证为无效'; } return isOk; } }