public without sharing class ConsumableArrDetController {
|
// 订单 ID
|
private String orderId = '';
|
public List<showRecords> arrDetIifo { get; set; }
|
public ConsumableArrDetController() {
|
orderId = ApexPages.currentPage().getParameters().get('Id');
|
arrDetIifo = new List<showRecords>();
|
}
|
|
// 画面初始化
|
public void init() {
|
List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
|
Map<String,String> srtMap = new Map<String,String>();
|
for(Consumable_order_details2__c con : conList){
|
srtMap.put(con.Bar_Code__c, con.Id);
|
}
|
List<String> str = new List<String>();
|
for(String s : srtMap.keySet()){
|
str.add(srtMap.get(s));
|
}
|
List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
|
WHERE Id =: str
|
GROUP BY Asset_Model_No__c];
|
for(Integer i = 0 ; i< arrDetList.size();i++){
|
arrDetIifo.add(new showRecords(arrDetList[i]));
|
}
|
}
|
|
// Data Bean
|
class showRecords implements Comparable {
|
|
public Decimal recordCount { get; set; }
|
public String prodModel { get; set; }
|
|
|
public showRecords(AggregateResult e) {
|
recordCount =Integer.valueOf(e.get('recordCount'));
|
prodModel = String.valueOf(e.get('prodModel'));
|
}
|
// 排序
|
public Integer compareTo(Object compareTo) {
|
return null;
|
}
|
}
|
}
|