public without sharing class FixtureSetHandler extends Oly_TriggerHandler { private Map newMap; private Map oldMap; private List newList; private List oldList; public FixtureSetHandler() { this.newMap = (Map) Trigger.newMap; this.oldMap = (Map) Trigger.oldMap; this.newList = (List) Trigger.new; this.oldList = (List) Trigger.old; } protected override void beforeInsert() { beforeSetValue(); //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start // setSpareuseaccessories(); //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end } protected override void beforeUpdate() { beforeSetValue(); //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start // setSpareuseaccessories(); //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end } private void beforeSetValue() { for (Fixture_Set__c nObj : newList) { nObj.Loaner_code__c = nObj.Name; } } //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start /*private void setSpareuseaccessories(){ // List detailList = new List(); List detailList = [select id,Is_Body__c,Fixture_Set__c,Fixture_Model_No_F__c from Fixture_Set_Detail__c where Fixture_Set__c in :newMap.keySet()]; if (detailList != null && detailList.size() > 0) { Map> spareMap = new Map>(); for (Fixture_Set_Detail__c detail : detailList) { if (!spareMap.containsKey(detail.Fixture_Set__c)) { Map tempMap = new Map(); spareMap.put(detail.Fixture_Set__c, tempMap); } Map tempMap = spareMap.get(detail.Fixture_Set__c); tempMap.put(detail.Fixture_Model_No_F__c, detail.Is_Body__c); spareMap.put(detail.Fixture_Set__c, tempMap); } for (Fixture_Set__c nObj : newList) { // if (nObj.Spareuseaccessories__c == null) { Map tempMap = spareMap.get(nObj.Id); // if (tempMap != null && tempMap.get(nObj.Name) != null) { nObj.Spareuseaccessories__c = tempMap.get(nObj.Name); // } // } } } }*/ //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end }