buli
2022-05-13 2f4492ee18f90274582fcc2bb06f5e9bf64136e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
public without sharing class LicenseCheckUtil {
    public static String LicenseCheck1(String str){
        String isOk = '1';
        List<License_Information__c> 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<License_Information__c> 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<License_Information__c> 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<String> addressList = new List<String>();
            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<License_Information__c> 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;
    }
}