高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
20211208 by ljh 查看新品收货最大编码,不用了可以删除。测试类都在 MaxManagmentCodeControllerTest
*/
public with sharing class MaxManagmentCodeController {
    public List<String> codeList{get;set;}
    public MaxManagmentCodeController() {
        
    }
    public void init(){
    codeList = new List<String>();
    List<AggregateResult> asa = new List<AggregateResult>();
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XB1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XB4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XB0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'DB1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'DB4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'DB0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HB1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HB4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HB0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SA0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'BA1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'BA4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'BA0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XN1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XN5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'XN0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HN1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HN4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HN0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'PA1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'PA4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'PA0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HD1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HD4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'HD0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SA1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SA4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP6%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI6%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA3%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA2%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP6%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP3%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP2%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SP1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP3%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP2%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI3%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'GI2%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'CP0%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW6%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW4%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW3%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW2%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'FW1%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA6%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'MA5%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'PAJ%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'SAJ%'];
    codeList.add((String)asa[0].get('code'));
    asa = [SELECT Max(EquipmentSet_Managment_Code__c) code FROM ReceivingNoteDetail__c WHERE EquipmentSet_Managment_Code__c like    'BAJ%'];
    codeList.add((String)asa[0].get('code'));
    //String codess = String.join(codeList,',');
    //system.debug('===codess:'+codess);
    //system.debug('===codeList:'+codeList);
    }
}