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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| public without sharing class ProductSetTrigger {
| public ProductSetTrigger() {
|
| }
|
| public static void CopyProductSetDetail(List<Product_Set__c> newList, Map<Id, Product_Set__c> newMap,
| List<Product_Set__c> oldList, Map<Id, Product_Set__c> oldMap){
| System.debug('CopyProductSetDetail===========> Start');
|
| Product_Set__c pd = newList[0];
| if (pd.RefertoID__c != null) {
|
| List<Product_Set_Detail__c> psdList
| = [select Product_Set__c,
| Product_SFDA_Status__c,
| Price__c,
| Quantity__c,
| Stop_Quantity__c,
| Contain_stop_product__c,
| Judge_SFDA_status__c,
| Asset_Model_No__c,
| Product__c,
| Product_RMB__c,
| Product_USD__c,
| Product_Set_CD__c,
| Total_price_RMB__c,
| List_price_total_RMB_text__c,
| Code__c,
| Total_Price__c,
| Description__c,
| CurrencyIsoCode
| from Product_Set_Detail__c
| where Product_Set__c = :pd.RefertoID__c];
|
| if (psdList.size() > 0) {
| List<Product_Set_Detail__c> psdListNew = psdList.clone();
| for (Product_Set_Detail__c psdDetail : psdListNew) {
| psdDetail.Id = null;
| psdDetail.Product_Set__c = pd.Id;
| }
|
| System.debug('psdListNew===========> ' + psdListNew);
|
| insert psdListNew;
| }
|
| }
|
|
| System.debug('CopyProductSetDetail===========> End');
| }
| }
|
|