public with sharing class intProCommonMethodController { public intProCommonMethodController() { } public static Product2 buildPro(){ Product2 pro = new Product2( Name = 'proName', // ProductCode='pro001', Asset_Model_No__c = 'pro001', SFDA_Status__c = '有効', Dealer_special_Object__c = true, Packing_list_manual__c = 1, Family='GI', Fixture_Model_No__c='n01', Serial_Lot_No__c='S/N tracing', Fixture_Model_No_T__c = 'n01', ProductCode_Ext__c='pc01', Manual_Entry__c=false ); insert pro; System.debug('-----pro插入成功-----'); return pro; } public static Asset buildAssetConsume(String assName, String accId, String hpAccId, String departAccId, String statu){ Product2 pro1 = buildPro(); System.debug('-----pro插入成功11-----'); Asset Ast = new Asset( Name = assName, Product2Id = pro1.Id, Hospital__c = hpAccId, Department_Class__c = departAccId, AccountId = accId, Status = statu, Asset_Owner__c = '病院資産', IsCompetitorProduct = True, AssetMark__c = '耗材', RecordTypeId = System.Label.Asset_RecordType, SerialNumber = 'asset1', Quantity = 1, Manage_type__c = '个体管理', Loaner_accsessary__c = false, Out_of_wh__c = 0, Salesdepartment__c = '1.华北营业本部', Internal_asset_location__c = '北京 备品中心', Product_category__c = 'GI', Equipment_Type__c = '产品试用', SalesProvince__c = '大连', CompanyOfEquipment__c = '北京', Internal_Asset_number__c = '0001', Rental_Count__c = 0, Asset_loaner_category__c = '固定资产', Consumable_Guaranteen_end__c = System.Today() + 1, WH_location__c = '货架号1' ); insert Ast; System.debug('-----Ass插入成功-----'); return Ast; } public static Asset buildAssetHost(String assName, String accId, String hpAccId, String departAccId, String statu){ Product2 pro1 = buildPro(); System.debug('-----pro插入成功11-----'); Asset Ast = new Asset( Name = assName, Product2Id = pro1.Id, Hospital__c = hpAccId, Department_Class__c = departAccId, AccountId = accId, Status = statu, Asset_Owner__c = '病院資産', IsCompetitorProduct = True, AssetMark__c = '主机', RecordTypeId = System.Label.Asset_RecordType, SerialNumber = 'asset1', Quantity = 1, Manage_type__c = '个体管理', Loaner_accsessary__c = false, Out_of_wh__c = 0, Salesdepartment__c = '1.华北营业本部', Internal_asset_location__c = '北京 备品中心', Product_category__c = 'GI', Equipment_Type__c = '产品试用', SalesProvince__c = '大连', CompanyOfEquipment__c = '北京', Internal_Asset_number__c = '0001', Rental_Count__c = 0, Asset_loaner_category__c = '固定资产', Consumable_Guaranteen_end__c = System.Today() + 1, WH_location__c = '货架号1' ); insert Ast; System.debug('-----Ass插入成功-----'); return Ast; } }