From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新
---
force-app/main/default/classes/NFM007TriggerTest.cls | 92 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 70 insertions(+), 22 deletions(-)
diff --git a/force-app/main/default/classes/NFM007TriggerTest.cls b/force-app/main/default/classes/NFM007TriggerTest.cls
index df44fe7..7dd1240 100644
--- a/force-app/main/default/classes/NFM007TriggerTest.cls
+++ b/force-app/main/default/classes/NFM007TriggerTest.cls
@@ -8,6 +8,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -60,7 +61,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -76,7 +76,24 @@
product.Asset_Model_No__c = '11111';
product.ProductCode = 'OTV-SP1H-NA-12E';
product.MDM_Model_No__c = 'test';
+ product.CanNotCancelledGurantee__c=true;
insert product;
+
+ Product_Register__c prc = new Product_Register__c(Name = '鍥芥娉ㄨ繘20162220210',
+ MedPrdClass__c = '3',
+ ValidFrom__c = date.newinstance(2018, 07, 22),
+ ValidTo__c = date.newinstance(2028, 07, 22),
+ RegisterNoClass_Old__c = '6815',
+ RegisterNoClass_New__c = '6815',
+ RegisterNoStatus__c = '鏈夋晥'
+ );
+ insert prc;
+
+ Product_Register_Link__c prlc = new Product_Register_Link__c(
+ Product2__c = product.Id,
+ Product_Register__c = prc.Id
+ );
+ insert prlc;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product.Id);
entry.UnitPrice = 0;
@@ -89,18 +106,20 @@
opp.AccountId = depart.Id;
opp.Department_Class__c = section.Id;
opp.Hospital__c = company.Id;
- opp.SAP_Send_OK__c = true;
+ opp.SAP_Send_OK__c = false;
opp.Gurantee_Period__c = '2';
opp.Name = 'GZ-SP-NFM007_1';
opp.Trade__c = '鍐呰部';
opp.StageName = '寮曞悎';
opp.Sales_Root__c = '璨╁2搴�';
- opp.CloseDate = date.newinstance(2022, 11, 30);
+ // opp.CloseDate = date.newinstance(2022, 11, 30);
+ opp.CloseDate = date.today();
opp.Agency1__c = company1.Id;
opp.Authorized_DB_No__c = 'Test20180522';
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -114,6 +133,8 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+
+ System.Test.startTest();
//QuoteLineItem qli = new QuoteLineItem();
//qli.QuoteId = quo.Id;
@@ -163,6 +184,7 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
@@ -178,6 +200,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -230,7 +253,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -247,12 +269,14 @@
opp.Trade__c = '鍐呰部';
opp.StageName = '寮曞悎';
opp.Sales_Root__c = '璨╁2搴�';
- opp.CloseDate = date.newinstance(2022, 11, 30);
+ // opp.CloseDate = date.newinstance(2022, 11, 30);
+ opp.CloseDate = date.today();
opp.Agency1__c = company1.Id;
opp.Authorized_DB_No__c = 'Test20180522';
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -266,6 +290,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -280,7 +305,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
-
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product3.Id);
@@ -323,18 +348,19 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
opp.SAP_Send_OK__c = true;
opp.Gurantee_Period__c = '2';
- opp.oldData_flg__c = true;
+ // opp.oldData_flg__c = true; //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈�
opp.Estimation_Decision__c = true;
update opp;
//Test.stopTest();
}
- //static testMethod void testUpdateHospital() {
+ //static testMethod void testUpdateHospital() {
// List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
// if (rectCo.size() == 0) {
// return;
@@ -862,6 +888,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -914,7 +941,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -931,12 +957,14 @@
opp.Trade__c = '鍐呰部';
opp.StageName = '寮曞悎';
opp.Sales_Root__c = '璨╁2搴�';
- opp.CloseDate = date.newinstance(2022, 11, 30);
+ // opp.CloseDate = date.newinstance(2022, 11, 30);
+ opp.CloseDate = date.today();
opp.Agency1__c = company1.Id;
opp.Authorized_DB_No__c = 'Test20180522';
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -950,6 +978,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -964,7 +993,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
-
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
PricebookEntry entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=product3.Id);
@@ -996,7 +1025,7 @@
PromotionSalesProducts__c psp = new PromotionSalesProducts__c();
- psp.QuantityId__c = quo.id;
+ psp.QuantityId__c = quo.ID;
// psp.PromotionSales__r.PromotionHead__r.SpoId__c
// psp.PromotionSales__r.Category__c
psp.PromotionSales__c = ps.id;
@@ -1008,7 +1037,7 @@
insert psp;
QuoteLineItem qli = new QuoteLineItem();
- qli.QuoteId = quo.Id;
+ qli.QuoteId = quo.ID;
qli.Id__c = '210';
qli.SFDA_Status__c = '鏈夊姽';
qli.Name__c = '211';
@@ -1023,7 +1052,7 @@
qli.PricebookEntryId = entry.Id;
//qli.PricebookEntry.Product2Id = product.ID;
insert qli;
-
+
OpportunityLineItem oppli = new OpportunityLineItem();
oppli.OpportunityId = opp.Id;
oppli.Id__c = '110';
@@ -1040,13 +1069,17 @@
oppli.PricebookEntryId = entry.Id;
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
opp.SAP_Send_OK__c = true;
opp.Gurantee_Period__c = '2';
- opp.oldData_flg__c = true;
+ // opp.oldData_flg__c = true; //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈�
opp.Estimation_Decision__c = true;
+ // opp.Estimation_Decision__c = true;
+ opp.Estimation_Id__c = quo.ID;
+ // update opp;
update opp;
//Test.stopTest();
}
@@ -1056,6 +1089,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -1108,7 +1142,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -1125,12 +1158,13 @@
opp.Trade__c = '鍐呰部';
opp.StageName = '寮曞悎';
opp.Sales_Root__c = '璨╁2搴�';
- opp.CloseDate = date.newinstance(2022, 11, 30);
- opp.Agency1__c = company1.Id;
+ // opp.CloseDate = date.newinstance(2022, 11, 30);
+ opp.CloseDate = date.today();
opp.Authorized_DB_No__c = 'Test20180522';
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
insert opp;
Quote quo = new Quote();
@@ -1144,6 +1178,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -1163,6 +1198,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
@@ -1207,12 +1243,13 @@
insert oppli;
System.Test.stopTest();
+ StaticParameter.EscapeOppandStaTrigger = false;
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
opp.SAP_Send_OK__c = true;
opp.Gurantee_Period__c = '2';
- opp.oldData_flg__c = true;
+ // opp.oldData_flg__c = true; //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈�
opp.Estimation_Decision__c = true;
update opp;
//Test.stopTest();
@@ -1223,6 +1260,7 @@
StaticParameter.EscapeNFM001Trigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger = true;
StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -1275,7 +1313,6 @@
LicenseAndAccount__c = company1.Id
);
insert linc;
- System.Test.startTest();
// 鍐嶅彇寰�
//List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
//List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id in :accountIds order by Management_Code__c];
@@ -1292,12 +1329,15 @@
opp.Trade__c = '澶栬部';
opp.StageName = '寮曞悎';
opp.Sales_Root__c = '璨╁2搴�';
- opp.CloseDate = date.newinstance(2022, 11, 30);
+ // opp.CloseDate = date.newinstance(2022, 11, 30);
+ opp.CloseDate = date.today();
opp.Agency1__c = company1.Id;
opp.Authorized_DB_No__c = 'Test20180522';
opp.Contract_DB_SalesDept_complite_day__c = date.newinstance(2019, 05, 22);
opp.NotesApprovedNo__c = 'Test20180622';
opp.Estimation_Id__c = '';
+ opp.multiYearWarranty__c =true;
+ opp.CurrencyIsoCode = 'USD';
insert opp;
Quote quo = new Quote();
@@ -1311,6 +1351,7 @@
quo.OCM_Agent1_Price__c = 203;
quo.Pricebook2Id = pricebookId;
insert quo;
+ System.Test.startTest();
opp.Estimation_Decision__c = true;
opp.Estimation_Id__c = quo.ID;
update opp;
@@ -1330,6 +1371,7 @@
product3.Asset_Model_No__c = '11111';
product3.MDM_Model_No__c = '123';
product3.ProductCode = 'OTV-SP1H-NA-12E';
+ product3.CanNotCancelledGurantee__c=true;
insert product3;
@@ -1377,11 +1419,17 @@
//Test.startTest();
// NFM007銈堛倞銆侀�佷俊銇椼仾銇勩亾銇�
//System.assertEquals('', NFM007Controller.debug_msg);
+ StaticParameter.EscapeOppandStaTrigger = false;
opp.SAP_Send_OK__c = true;
opp.Gurantee_Period__c = '2';
- opp.oldData_flg__c = true;
+ // opp.oldData_flg__c = true; //20221229 lt DB202211430986 璇环鍘嗗彶涓嶄娇鐢ㄥ瓧娈�
opp.Estimation_Decision__c = true;
update opp;
//Test.stopTest();
}
+
+ static testMethod void test_00() {
+ NFM007Controller controller = new NFM007Controller();
+ controller.test();
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1