高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
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
global class InvocableUtil {
    global class LoggingRequest {
       @InvocableVariable(required=true)
       public ID objId;
    }
 
    @InvocableMethod(label='耗材审批驳回取消,删除明细')
    global static void createLog(List<LoggingRequest> requests){
        List<Id> objIdList = new  List<Id>();
        for(LoggingRequest requestObj:requests){
            objIdList.add(requestObj.objId);
        }
        Set<String> selectAssetIdSet = new Set<String>();
        List<Consum_Apply_Equipment_Set_Detail__c> caesdList = [SELECT Id, Asset__c
                                                     FROM Consum_Apply_Equipment_Set_Detail__c
                                                    WHERE Consum_Apply__c = :objIdList];
        for (Consum_Apply_Equipment_Set_Detail__c caesd : caesdList) {
            if (String.isNotBlank(caesd.Asset__c)) {
                selectAssetIdSet.add(caesd.Asset__c);
            }
        }
        List<Asset> ass = [SELECT Id FROM Asset Where Id =:selectAssetIdSet FOR UPDATE];
        Delete caesdList;
   }
}