public with sharing class LexInventoryHeaderClearStatusController {

    @AuraEnabled
    public static List<Inventory_Header__c> init(String recordId){
        List<Inventory_Header__c> InventoryList = new List<Inventory_Header__c>([SELECT Id, Name, Inventory_Status__c FROM Inventory_Header__c WHERE Id = :recordId OR Fixture_Header__c = :recordId]);
        return InventoryList;
    }

    @AuraEnabled
    public static String updateStatus(List<Inventory_Header__c> inventoryList){
        List<Inventory_Header__c> tempList = new List<Inventory_Header__c>();
        try {
            for(Inventory_Header__c inventory : inventoryList){
                Inventory_Header__c temp = new Inventory_Header__c();
                temp.Id = inventory.Id;
                temp.Inventory_Status__c = null;
                tempList.add(temp);
            }
            UPDATE tempList;
            return '清除盘点状态完毕';
        }
        catch (Exception e) {
            return e.getMessage();
        }
        
    } 
}