liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
public without sharing class RepairSoUpdHandler extends Oly_TriggerHandler {
    private Map<Id, RepairSubOrder__c> newMap;
    private Map<Id, RepairSubOrder__c> oldMap;
    private List<RepairSubOrder__c> newList;
    private List<RepairSubOrder__c> oldList;
    public RepairSoUpdHandler() {
        this.newMap = (Map<Id, RepairSubOrder__c>) Trigger.newMap;
        this.oldMap = (Map<Id, RepairSubOrder__c>) Trigger.oldMap;
        this.newList = (List<RepairSubOrder__c>) Trigger.new;
        this.oldList = (List<RepairSubOrder__c>) Trigger.old;
    }
    protected override void afterUpdate() {
        RepairSoUpdate();
    }
    public void RepairSoUpdate() {
        List<RepairSubOrder__c> repairSoList = new List<RepairSubOrder__c>();
        List<String> repairSoIdList = new List<String>();
        for (RepairSubOrder__c nObj : newList) {
            RepairSubOrder__c oObj = oldMap.get(nObj.Id);
            if (nObj.Status__c != oObj.Status__c && nObj.Status__c != '已转修理') {
                repairSoIdList.add(nObj.Id);
            }
        }
        if (repairSoIdList.size() > 0) {
            System.debug('NFM613S====' + repairSoIdList);
            BatchIF_Log__c iflog = new BatchIF_Log__c();
            iflog.Type__c = 'NFM613';
            iflog.Log__c = 'callout start\n';
            System.debug('NFM613S===RepairSoUpdate===callout start' + repairSoIdList);
            insert iflog;
            NFM613Controller.callout(iflog.Id, repairSoIdList);
        }
    }
}