My full error message is as follows
Error: Compile Error: Method does not exist or incorrect signature: void add(AggregateResult) from the type List at line 21 column 41
I am working on building a page to represent items in a shipment, that page must show the items picked for the shipment and list their locations in our inventory below each product picked. I am grabbing the information I need from an object called Shipment_Line__c that holds a relation what products have been picked for shipment and the other object is GMBLASERP__Inventory_Movement_Cube__c and it represents where a product is in our inventory. I am needing to match up the two objects based on Project_Task__r.Product_Code__c from Shipment_Line__c and GMBLASERP__Product__c from GMBLASERP__Inventory_Movement_Cube__c.
My controller is as follows:
public class ShipmentInventoryMovements {
public List<Shipment_Line__c> allShipmentLines { get; set; }
public List<Shipment_Line__c> displayShipmentLines { get; set; }
public Map<Id, List<GMBLASERP__Inventory_Movement_Cube__c>> inventoryMap { get; set; }
public ShipmentInventoryMovements ( ) {
allShipmentLines = new List<Shipment_Line__c>();
allShipmentLines = [SELECT Id, Product_ID__c, Shipment__r.Warehouse__r.Name, Quantity__c, Quantity_Filled__c, Project_Task__r.GMBLASERP__Product__r.Name, Project_Task__r.Product_Code__c FROM Shipment_Line__c];
displayShipmentLines = new List<Shipment_Line__c>(allShipmentLines);
inventoryMap = new Map<Id, List<GMBLASERP__Inventory_Movement_Cube__c>>();
for (Shipment_Line__c sl : allShipmentLines) {
inventoryMap.put(sl.Product_ID__c, new
List<GMBLASERP__Inventory_Movement_Cube__c>());
}
List<AggregateResult> shipInventory = new List<AggregateResult>([SELECT GMBLASERP__Product__r.id ID, GMBLASERP__Product__r.Name ProdName, GMBLASERP__Location__r.Name LocName, SUM(GMBLASERP__Quantity__c) Sum
FROM GMBLASERP__Inventory_Movement_Cube__c WHERE GMBLASERP__Product__c IN
:inventoryMap.keyset() GROUP BY GMBLASERP__Product__r.id, GMBLASERP__Product__r.name, GMBLASERP__Location__r.name]);
for(AggregateResult shipLine : shipInventory){
inventoryMap.get(shipLine.ID).add(shipLine);
}
}
}