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');
	}
}