@isTest
|
private class MaintenanceProductDataControllerTest {
|
static void initHpData() {
|
List<RecordType> rectCo = [select Id,DeveloperName from RecordType where IsActive = true and SobjectType = 'Maintenance_Product_Data__c'];
|
if (rectCo.size() == 0) {
|
return;
|
}
|
List<RecordType> rectCo1 = [Select Id ,DeveloperName FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteeMain'];
|
system.assertEquals('GuranteeMain',rectCo1[0].DeveloperName);
|
//Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
|
Product2 prod01 = new Product2(Name='Test01',
|
ProductCode='Test01',
|
Asset_Model_No__c = 'Test01',
|
SFDA_Status__c = '有効',
|
Product_Status__c = '正常销售',
|
SFDA_Approbated_Status__c = '有效',
|
Category3__c = 'CDS',
|
Category4__c = 'OER',
|
Category5__c = '其它',
|
IsActive = true,
|
Dealer_special_Object__c = true,
|
SFDA_Approbation_No__c = 'Test001',
|
Packing_list_manual__c = 1,
|
SFDA_Expiration_Date__c= Date.today(),
|
Intra_Trade_List_RMB_1__c = 1000,
|
Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
|
Important_Rroduct_1GI__c = true,
|
//-----
|
Intra_Trade_Service_RMB_1__c = 6000.00,
|
Intra_Trade_Service_RMB_Date1__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Service_RMB_EndDate1__c = Date.toDay().addMonths(24),
|
|
Intra_Trade_Gurantee_RMB_1__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date1__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Gurantee_RMB_End_Date1__c = Date.toDay().addMonths(24),
|
//-----
|
Extend_new_product_gurantee_MD__c = true,
|
Entend_gurantee_period_MD__c = '两年',
|
Extend_Gurantee_Start_MD__c = Date.toDay(),
|
Extend_Gurantee_End_MD__c = Date.toDay().addMonths(24)
|
);
|
Product2 prod02 = new Product2(Name='Test02',
|
ProductCode='Test02',
|
Asset_Model_No__c = 'Test02',
|
SFDA_Status__c = '有効',
|
Product_Status__c = '正常销售',
|
SFDA_Approbated_Status__c = '有效',
|
Category3__c = 'ENT',
|
Category4__c = 'Celon',
|
Category5__c = 'Celon',
|
IsActive = true,
|
Dealer_special_Object__c = true,
|
SFDA_Approbation_No__c = 'Test002',
|
Packing_list_manual__c = 1,
|
SFDA_Expiration_Date__c= Date.today(),
|
Intra_Trade_List_RMB_1__c = 1000,
|
Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_Date2__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
|
Important_Rroduct_1GI__c = true,
|
//-----
|
Intra_Trade_Service_RMB_2__c = 6001.00,
|
Intra_Trade_Service_RMB_Date2__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Service_RMB_EndDate2__c = Date.toDay().addMonths(24),
|
|
Intra_Trade_Gurantee_RMB_2__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date2__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Gurantee_RMB_End_Date2__c = Date.toDay().addMonths(24),
|
//-----
|
Extend_new_product_gurantee_MD__c = false,
|
Extend_new_product_gurantee__c = false
|
/*Entend_gurantee_period_MD__c = '两年',
|
Extend_Gurantee_Start_MD__c = Date.toDay(),
|
Extend_Gurantee_End_MD__c = Date.toDay().addMonths(24)*/
|
);
|
Product2 prod03 = new Product2(Name='Test03',
|
ProductCode='Test03',
|
Asset_Model_No__c = 'Test03',
|
SFDA_Status__c = '有効',
|
Dealer_special_Object__c = true,
|
Product_Status__c = '正常销售',
|
SFDA_Approbated_Status__c = '有效',
|
Category3__c = 'US',
|
Category4__c = 'ALOKA',
|
Category5__c = '体外超声',
|
IsActive = true,
|
Intra_Trade_List_RMB_1__c = 1000,
|
Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
|
Important_Rroduct_1GI__c = true,
|
//-----
|
Intra_Trade_Service_RMB_1__c = 6000.00,
|
Intra_Trade_Service_RMB_Date1__c = Date.toDay().addMonths(-2),
|
Intra_Trade_Service_RMB_EndDate1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Service_RMB_2__c = 6002.00,
|
Intra_Trade_Service_RMB_Date2__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Service_RMB_EndDate2__c = Date.toDay().addMonths(24),
|
|
Intra_Trade_Gurantee_RMB_1__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date1__c = Date.toDay().addMonths(-2),
|
Intra_Trade_Gurantee_RMB_End_Date1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Gurantee_RMB_2__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date2__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Gurantee_RMB_End_Date2__c = Date.toDay().addMonths(24),
|
//-----
|
Extend_new_product_gurantee__c = true,
|
Entend_gurantee_period__c = '两年',
|
Extend_Gurantee_Start__c = Date.toDay(),
|
Extend_Gurantee_End__c = Date.toDay().addMonths(24)
|
);
|
|
Product2 prod04 = new Product2(Name='Test04',
|
ProductCode='Test04',Asset_Model_No__c = 'Test04',
|
SFDA_Status__c = '有効',
|
Dealer_special_Object__c = true,
|
Product_Status__c = '正常销售',
|
SFDA_Approbated_Status__c = '有效',
|
Category3__c = 'OCS',
|
Category4__c = '附属品',
|
Category5__c = 'OCS',
|
IsActive = true,
|
Intra_Trade_List_RMB_1__c = 1000,
|
Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
|
Important_Rroduct_1GI__c = true,
|
//-----
|
Intra_Trade_Service_RMB_1__c = 6003.00,
|
Intra_Trade_Service_RMB_Date1__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Service_RMB_EndDate1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Service_RMB_2__c = 6000.00,
|
Intra_Trade_Service_RMB_Date2__c = Date.toDay().addMonths(-2),
|
Intra_Trade_Service_RMB_EndDate2__c = Date.toDay().addMonths(24),
|
|
Intra_Trade_Gurantee_RMB_1__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date1__c = Date.toDay().addMonths(-1),
|
Intra_Trade_Gurantee_RMB_End_Date1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Gurantee_RMB_2__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date2__c = Date.toDay().addMonths(-2),
|
Intra_Trade_Gurantee_RMB_End_Date2__c = Date.toDay().addMonths(24),
|
//-----
|
Extend_new_product_gurantee_MD__c = true,
|
Entend_gurantee_period_MD__c = '两年',
|
Extend_Gurantee_Start_MD__c = Date.toDay(),
|
Extend_Gurantee_End_MD__c = Date.toDay().addMonths(24)
|
);
|
Product2 prod05 = new Product2(Name='Test05',
|
ProductCode='Test05',
|
Asset_Model_No__c = 'Test05',
|
SFDA_Status__c = '有効',
|
Dealer_special_Object__c = true,
|
Product_Status__c = '正常销售',
|
SFDA_Approbated_Status__c = '有效',
|
Category3__c = '光源',
|
Category4__c = 'CLV',
|
Category5__c = 'S45',
|
IsActive = true,
|
Intra_Trade_List_RMB_1__c = 1000,
|
Intra_Trade_List_RMB_Date1__c = Date.today().addDays(-1),
|
Intra_Trade_List_RMB_End_Date1__c = Date.today().addDays(1),
|
Important_Rroduct_1GI__c = true,
|
Intra_Trade_Service_RMB_1__c = 6000.00,
|
Intra_Trade_Service_RMB_EndDate1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Service_RMB_Date1__c = Date.toDay(),
|
Intra_Trade_Gurantee_RMB_End_Date1__c = Date.toDay().addMonths(24),
|
Intra_Trade_Gurantee_RMB_1__c = 6500.00 ,
|
Intra_Trade_Gurantee_RMB_Date1__c = Date.toDay().addMonths(-1)
|
);
|
insert new Product2[] {prod01,prod02,prod03, prod04, prod05};
|
SS_Batch_Column_Mapping__c oppMapping = new SS_Batch_Column_Mapping__c(Name = 'MaintenanceProductDataDetails', SS_TableName__c='Key_product_147P__c');
|
oppMapping.From_Column_001__c = '1';
|
oppMapping.SS_Column_001__c = '01.CV-290';
|
oppMapping.From_Column_002__c = '2'; // 重複してもエラーにはならない
|
oppMapping.SS_Column_002__c = '02.GI-290镜子';
|
insert new SS_Batch_Column_Mapping__c[] {oppMapping};
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 Star
|
Service_Category6__c sc6 = new Service_Category6__c();
|
sc6.Name = '260光源';
|
insert sc6;
|
Service_Category7__c sc7 = new Service_Category7__c();
|
sc7.Name = 'CP监视器';
|
insert sc7;
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 End
|
}
|
//分记录类型 重点产品区分维护ImportantProduct
|
static testMethod void testMethod1() {
|
initHpData();
|
Maintenance_Product_Data__c m = new Maintenance_Product_Data__c();
|
PageReference page = new PageReference('/apex/MaintenanceProductData?RecordTypeName=ImportantProduct&retURL=/a3V/o');
|
page.setRedirect(true);
|
System.Test.setCurrentPage(page);
|
MaintenanceProductDataController mpdTest = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
System.Test.startTest();
|
mpdTest.size = 2;
|
mpdTest.init();
|
mpdTest.getKeyProduct147POps();
|
mpdTest.getGuranteeTypeOps();
|
mpdTest.getEntendGuranteePeriodOps();
|
mpdTest.getDefaultFixtureArrivalProcessOps();
|
mpdTest.getAssetLoanerCategoryOps();
|
mpdTest.searchMaintenanceProductDataDetails();
|
List<Product2> Product2Num = [select Id ,ProductCode_Ext__c,Name FROM Product2 WHERE IsActive = true ];
|
system.assertEquals(5,Product2Num.size());
|
system.assertEquals(5,mpdTest.mpdDetailsRecordsView.size());
|
|
mpdTest.mpdDetailsRecordsView[0].check = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'ImportantProduct'].id;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Important_Endopartner_product__c = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Key_product_147P__c = '01.CV-290';
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[0].Prod.id;
|
mpdTest.mpdDetailsRecordsView[1].check = true;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'ImportantProduct'].id;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Important_Endopartner_product__c = true;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Key_product_147P__c = '01.CV-290';
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Key_product_147P_Old__c = null;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[1].Prod.id;
|
mpdTest.save();
|
//修改
|
List<Maintenance_Product_Data__c> mList = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c ];
|
system.assertEquals(1,mList.size());
|
mpdTest.setEditAble();
|
PageReference page1 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page1.setRedirect(true);
|
System.Test.setCurrentPage(page1);
|
MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
mpdTest1.init();
|
List<Maintenance_Product_Data_Details__c> mdList = [SELECT Id,Status__c,Name
|
FROM Maintenance_Product_Data_Details__c where Maintenance_Product_Data__c=:mList[0].id];
|
mpdTest1.size = 5;
|
//mpdTest1.id = mList[0].id;
|
//mpdTest1.category1 = 'Test';
|
mpdTest1.searchMaintenanceProductDataDetails();
|
|
//mpdTest1.mpdDetailsRecords[0].check = true;
|
mpdTest1.mpdDetailsRecords[0].mpded.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'ImportantProduct'].id;
|
mpdTest1.mpdDetailsRecords[0].mpded.Important_Endopartner_product__c = false;
|
mpdTest1.mpdDetailsRecords[0].mpded.Key_product_147P__c = '02.GI-290镜子';
|
mpdTest1.mpdDetailsRecords[0].mpded.id = mdList[0].id;
|
mpdTest1.mpdDetailsRecords[1].mpded.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'ImportantProduct'].id;
|
mpdTest1.mpdDetailsRecords[1].mpded.Important_Endopartner_product__c = false;
|
mpdTest1.mpdDetailsRecords[1].mpded.Key_product_147P__c = '02.GI-290镜子';
|
mpdTest1.mpdDetailsRecords[1].mpded.Key_product_147P_Old__c = null;
|
mpdTest1.mpdDetailsRecords[1].mpded.id = mdList[1].id;
|
//mpdTest1.save();
|
mpdTest1.UpdateSave();
|
mpdTest1.Submitmpd();
|
List<Maintenance_Product_Data__c> mList1 = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id=:mpdTest1.id];
|
List<Maintenance_Product_Data_Details__c> mdList1 = [SELECT Id,Status__c,Name,Key_product_147P__c,Key_product_147P_Old__c
|
FROM Maintenance_Product_Data_Details__c where Maintenance_Product_Data__c=:mList1[0].id];
|
mdList1[1].Key_product_147P_Old__c = null;
|
update mdList1;
|
system.assertEquals('02.GI-290镜子',mdList1[0].Key_product_147P__c);
|
system.assertEquals('02.GI-290镜子',mdList1[1].Key_product_147P__c);
|
system.assertEquals(null,mdList1[1].Key_product_147P_Old__c);
|
system.assertEquals(1,mList1.size());
|
if(mList1.size()>0){
|
mList1[0].Status__c = '完成';
|
update mList1[0];
|
}
|
System.Test.stopTest();
|
}
|
//多年保主数据维护 GuranteeMain
|
static testMethod void testMethod2() {
|
initHpData();
|
Maintenance_Product_Data__c m = new Maintenance_Product_Data__c();
|
PageReference page = new PageReference('/apex/MaintenanceProductData?RecordTypeName=GuranteeMain&retURL=/a3V/o');
|
page.setRedirect(true);
|
System.Test.setCurrentPage(page);
|
MaintenanceProductDataController mpdTest = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
System.Test.startTest();
|
mpdTest.init();
|
mpdTest.size = 5;
|
//mpdTest.category1 = 'Test';
|
mpdTest.searchMaintenanceProductDataDetails();
|
mpdTest.mpdDetailsRecordsView[0].check = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteeMain'].id;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Entend_gurantee_period__c = '两年';
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Gurantee_Start_Date__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.GuranteeType__c = '服务';
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Gurantee_End_Date__c = Date.toDay().addMonths(24);
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[0].Prod.id;
|
|
mpdTest.mpdDetailsRecordsView[1].check = true;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteeMain'].id;
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Entend_gurantee_period__c = '三年';
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Gurantee_Start_Date__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.GuranteeType__c = '服务';
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.Gurantee_End_Date__c = Date.toDay().addMonths(36);
|
mpdTest.mpdDetailsRecordsView[1].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[1].Prod.id;
|
|
mpdTest.mpdDetailsRecordsView[2].check = true;
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteeMain'].id;
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.Entend_gurantee_period__c = '三年';
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.Gurantee_Start_Date__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.GuranteeType__c = '服务';
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.Gurantee_End_Date__c = Date.toDay().addMonths(36);
|
mpdTest.mpdDetailsRecordsView[2].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[2].Prod.id;
|
|
mpdTest.mpdDetailsRecordsView[3].check = true;
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteeMain'].id;
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.Entend_gurantee_period__c = '两年';
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.Gurantee_Start_Date__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.GuranteeType__c = '服务';
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.Gurantee_End_Date__c = Date.toDay().addMonths(24);
|
mpdTest.mpdDetailsRecordsView[3].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[3].Prod.id;
|
|
|
mpdTest.save();
|
mpdTest.Submitmpd();
|
List<Maintenance_Product_Data__c> mList = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id=:mpdTest.id];
|
system.assertEquals(1,mList.size());
|
if(mList.size()>0){
|
mList[0].Status__c = '审批中';
|
update mList[0];
|
}
|
PageReference page11 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page11.setRedirect(true);
|
MaintenanceProductDataController mpdTest11 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
mpdTest11.init();
|
|
System.Test.setCurrentPage(page11);
|
if(mList.size()>0){
|
mList[0].Status__c = '服务填写';
|
update mList[0];
|
}
|
|
//修改
|
mpdTest.setEditAble();
|
PageReference page1 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page1.setRedirect(true);
|
System.Test.setCurrentPage(page1);
|
MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
mpdTest1.init();
|
|
mpdTest1.mpdDetailsRecords[0].mpded.Intra_Trade_Service_RMB__c = null;
|
mpdTest1.mpdDetailsRecords[0].mpded.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
|
mpdTest1.mpdDetailsRecords[0].mpded.Maintenance_Price_Year__c = 7000.00;
|
mpdTest1.mpdDetailsRecords[1].mpded.Intra_Trade_Service_RMB__c = null;
|
mpdTest1.mpdDetailsRecords[1].mpded.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
|
mpdTest1.mpdDetailsRecords[1].mpded.Maintenance_Price_Year__c = 7000.00;
|
mpdTest1.mpdDetailsRecords[2].mpded.Intra_Trade_Service_RMB__c = null;
|
mpdTest1.mpdDetailsRecords[2].mpded.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
|
mpdTest1.mpdDetailsRecords[2].mpded.Maintenance_Price_Year__c = 7000.00;
|
mpdTest1.mpdDetailsRecords[3].mpded.Intra_Trade_Service_RMB__c = null;
|
mpdTest1.mpdDetailsRecords[3].mpded.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
|
mpdTest1.mpdDetailsRecords[3].mpded.Maintenance_Price_Year__c = 7000.00;
|
mpdTest1.UpdateSave();
|
Attachment att = new Attachment(
|
Name = 'test',
|
ParentId = mpdTest1.Id,
|
Body = EncodingUtil.base64Decode('test')
|
);
|
insert att;
|
//system.assertEquals(1,mList.size());
|
if(mList.size()>0){
|
mList[0].Status__c = '审批中-服务';
|
update mList[0];
|
}
|
if(mList.size()>0){
|
mList[0].Status__c = '完成';
|
update mList[0];
|
}
|
System.Test.stopTest();
|
}
|
//多年保价格维护 GuranteePrice
|
static testMethod void testMethod3() {
|
initHpData();
|
Maintenance_Product_Data__c m = new Maintenance_Product_Data__c();
|
PageReference page = new PageReference('/apex/MaintenanceProductData?RecordTypeName=GuranteePrice&retURL=/a3V/o');
|
page.setRedirect(true);
|
System.Test.setCurrentPage(page);
|
MaintenanceProductDataController mpdTest = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
System.Test.startTest();
|
mpdTest.init();
|
mpdTest.size = 5;
|
//mpdTest.category1 = 'Test';
|
mpdTest.searchMaintenanceProductDataDetails();
|
mpdTest.mpdDetailsRecordsView[0].check = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'GuranteePrice'].id;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Intra_Trade_Gurantee_RMB__c = 7500.00 ;
|
//mpdTest.mpdDetailsRecordsView[0].mpdrdd.Intra_Trade_Gurantee_RMB_DateFrom__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Intra_Trade_Service_RMB__c = 8000.00;
|
//mpdTest.mpdDetailsRecordsView[0].mpdrdd.Intra_Trade_Service_RMB_DateFrom__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Maintenance_Price_Year__c = 9000.00;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[0].Prod.id;
|
mpdTest.save();
|
//修改
|
List<Maintenance_Product_Data__c> mList = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c ];
|
system.assertEquals(1,mList.size());
|
mpdTest.setEditAble();
|
|
PageReference page1 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page1.setRedirect(true);
|
System.Test.setCurrentPage(page1);
|
MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
mpdTest1.init();
|
//mpdTest1.UpdateSave();
|
List<Maintenance_Product_Data__c> mListEdit = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id = :mpdTest1.id];
|
Attachment att = new Attachment(
|
Name = 'test11',
|
ParentId = mListEdit[0].Id,
|
Body = EncodingUtil.base64Decode('test11')
|
);
|
insert att;
|
mpdTest1.init();
|
mpdTest1.UpdateSave();
|
mpdTest1.Submitmpd();
|
List<Maintenance_Product_Data__c> mListEdit1 = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id = :mpdTest1.id];
|
system.assertEquals(1,mListEdit.size());
|
if(mListEdit1.size()>0){
|
mListEdit1[0].Status__c = '完成';
|
update mListEdit1[0];
|
}
|
System.Test.stopTest();
|
|
}
|
//修理信息维护 RepairInfo
|
static testMethod void testMethod4() {
|
initHpData();
|
Maintenance_Product_Data__c m = new Maintenance_Product_Data__c();
|
PageReference page = new PageReference('/apex/MaintenanceProductData?RecordTypeName=RepairInfo&retURL=/a3V/o');
|
page.setRedirect(true);
|
System.Test.setCurrentPage(page);
|
MaintenanceProductDataController mpdTest = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
System.Test.startTest();
|
mpdTest.init();
|
mpdTest.size = 2;
|
//mpdTest.category1 = 'Test';
|
mpdTest.searchMaintenanceProductDataDetails();
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 Star
|
mpdTest.getCanRepairOps();
|
mpdTest.getServiceCategory1();
|
mpdTest.getServiceCategory2();
|
mpdTest.getServiceCategory3();
|
mpdTest.getServiceCategory4();
|
mpdTest.getServiceCategory5();
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 END
|
mpdTest.mpdDetailsRecordsView[0].check = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'RepairInfo'].id;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RepairListPriceLevelA__c = 1000 ;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RepairListPriceLevelB__c = 2000;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RepairListPriceLevelC__c = 3000;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.CanRepairAccsessary__c = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Repair_Product_Code__c = 'test';
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.PartSupplyFinishDate__c = Date.toDay();
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Maintenance_Price_Year__c = 8000.00;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[0].Prod.id;
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 Star
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Can_Repair__c = '可';
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category1__c = '本体';
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category2__c = 'ENG';
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category3__c = '硬性镜';
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category4__c = '膀胱镜';
|
// mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category5__c = '3D周边产品';
|
//mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category6__c = cs6.Id;
|
//mpdTest.mpdDetailsRecordsView[0].mpdrdd.Service_Category7__c = cs7.Id;
|
//LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 LY 20210917 END
|
mpdTest.save();
|
//修改
|
List<Maintenance_Product_Data__c> mList = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c ];
|
system.assertEquals(1,mList.size());
|
mpdTest.setEditAble();
|
PageReference page1 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page1.setRedirect(true);
|
System.Test.setCurrentPage(page1);
|
MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
List<Maintenance_Product_Data__c> mListEdit = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id = :mpdTest1.id];
|
Attachment att = new Attachment(
|
Name = 'test11',
|
ParentId = mListEdit[0].Id,
|
Body = EncodingUtil.base64Decode('test11')
|
);
|
insert att;
|
mpdTest1.init();
|
mpdTest1.UpdateSave();
|
mpdTest1.Submitmpd();
|
List<Maintenance_Product_Data__c> mListEdit1 = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id=:mpdTest1.id];
|
if(mListEdit1.size()>0){
|
mListEdit1[0].Status__c = '完成';
|
update mListEdit1[0];
|
}
|
System.Test.stopTest();
|
}
|
//备品信息维护 EquipmentInfo
|
static testMethod void testMethod5() {
|
initHpData();
|
Maintenance_Product_Data__c m = new Maintenance_Product_Data__c();
|
PageReference page = new PageReference('/apex/MaintenanceProductData?RecordTypeName=EquipmentInfo&retURL=/a3V/o');
|
page.setRedirect(true);
|
System.Test.setCurrentPage(page);
|
MaintenanceProductDataController mpdTest = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
System.Test.startTest();
|
mpdTest.init();
|
mpdTest.size = 2;
|
//mpdTest.category1 = 'Test';
|
mpdTest.searchMaintenanceProductDataDetails();
|
mpdTest.mpdDetailsRecordsView[0].check = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.RecordTypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Maintenance_Product_Data_Details__c' and DeveloperName = 'EquipmentInfo'].id;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Asset_loaner_category__c = '为资产管理' ;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Special_Model__c = true;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Fixture_Model_No__c = 'test001';
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.Packing_list_Fixture__c = 2 ;
|
mpdTest.mpdDetailsRecordsView[0].mpdrdd.ProductsID__c = mpdTest.mpdDetailsRecordsView[0].Prod.id;
|
mpdTest.save();
|
//修改
|
List<Maintenance_Product_Data__c> mList = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c ];
|
system.assertEquals(1,mList.size());
|
mpdTest.setEditAble();
|
PageReference page1 = new PageReference('/apex/MaintenanceProductData?id='+mList[0].id+'&retURL=/a3V/o');
|
page1.setRedirect(true);
|
System.Test.setCurrentPage(page1);
|
MaintenanceProductDataController mpdTest1 = new MaintenanceProductDataController(new ApexPages.StandardController(m));
|
mpdTest1.init();
|
mpdTest1.UpdateSave();
|
mpdTest1.Submitmpd();
|
List<Maintenance_Product_Data__c> mListEdit = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName
|
FROM Maintenance_Product_Data__c where id=:mpdTest1.id];
|
if(mListEdit.size()>0){
|
mListEdit[0].Status__c = '完成';
|
update mListEdit[0];
|
}
|
System.Test.stopTest();
|
}
|
}
|