From 1727a4f4d02e429475608e60f142a63bc24127bc Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 23 十月 2023 10:07:34 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls |  145 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 143 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls b/force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls
index 94f7ea4..11b6d45 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcControllerTest.cls
@@ -26,14 +26,43 @@
         lexPCLLostReportLwcController.searchBatchIfForProduct('');
         lexPCLLostReportLwcController.getNewLostBrand(0);
         lexPCLLostReportLwcController.getNewLostProduct(0);
-        
         Test.stopTest();
     }
     static testMethod void testSave(){
+		List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+        insert myAccount2;
         // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟'];
+        Account depart1 = [select Id from Account limit 1];
+        LostReport conTest2 = new LostReport();
+        conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
+		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
+		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
+		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
+		conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '鍏朵粬';
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
+		conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
+		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
+
+        Test.startTest();
+        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+		lexPCLLostReportLwcController.searchProduct(conTest2.LostBrands[0].LostProducts[0].LostProductss.Id);
+		System.debug('chenjingwu=>'+ maps.get('error'));
+
+        Test.stopTest();
+    }
+
+	static testMethod void testSubmit(){
+        Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟' limit 1];
         Account depart1 = [select Id from Account where RecordTypeId = '01210000000QemG' limit 1];
         LostReport conTest2 = new LostReport();
         conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
 		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
 		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
 		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
@@ -44,7 +73,119 @@
 		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
 
         Test.startTest();
-        lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+        lexPCLLostReportLwcController.submit('鑽夋',false,report.Id);
+        Test.stopTest();
+    }
+
+	static testMethod void TestSubmitForApproval2(){
+		List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+        insert myAccount2;
+        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟'];
+        Account depart1 = [select Id from Account limit 1];
+        LostReport conTest2 = new LostReport();
+        conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
+		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
+		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
+		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
+		conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '鍏朵粬';
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
+		conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
+		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
+
+        Test.startTest();
+        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+		lexPCLLostReportLwcController.submit('鑽夋',false,conTest2.lostReport.Id);
+		lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Approve');
+		lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Removed');
+        Test.stopTest();
+    }
+	static testMethod void TestSubmitForApproval1(){
+		List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+        insert myAccount2;
+        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟'];
+        Account depart1 = [select Id from Account limit 1];
+        LostReport conTest2 = new LostReport();
+        conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
+		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
+		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
+		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
+		conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '鍏朵粬';
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
+		conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
+		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
+
+        Test.startTest();
+        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+		lexPCLLostReportLwcController.submit('鑽夋',false,conTest2.lostReport.Id);
+		lexPCLLostReportLwcController.submitForApproval(conTest2.lostReport.Id,'','Reject');
+        Test.stopTest();
+    }
+
+	static testMethod void TestSubmitForApproval3(){
+		List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+        insert myAccount2;
+        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟'];
+        Account depart1 = [select Id from Account limit 1];
+        LostReport conTest2 = new LostReport();
+        conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
+		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
+		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
+		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
+		conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '鍏朵粬';
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
+		conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
+		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
+
+        Test.startTest();
+        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+		lexPCLLostReportLwcController.submit('鑽夋',false,conTest2.lostReport.Id);
+		lexPCLLostReportLwcController.reassignStep(conTest2.lostReport.Id,UserInfo.getUserId());
+        Test.stopTest();
+    }
+
+	static testMethod void TestSubmitForApproval4(){
+		List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '璨╁2搴�'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        Account myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,AgentCode_Ext__c = '9999900');
+        insert myAccount2;
+        // Lost_cancel_report__c report = [select Id from Lost_cancel_report__c where LostType__c = '澶卞崟'];
+        Account depart1 = [select Id from Account limit 1];
+        LostReport conTest2 = new LostReport();
+        conTest2.lostReport.LostType__c = '澶卞崟';
+		conTest2.lostReport.Opportunity__c = [select Id from Opportunity limit 1].Id;
+		conTest2.LostBrands[0].lostBrand.LostPrice__c = 12;
+		conTest2.LostBrands[0].lostBrand.Lost_reason_main__c = '浠锋牸';
+		conTest2.LostBrands[0].LostProducts[0].LostProductss.Quantity__c =3;
+		conTest2.LostBrands[0].lostBrand.Agency__c = myAccount2.Id;
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company__c = '鍏朵粬';
+		conTest2.LostBrands[0].lostBrand.Lost_By_Company_Mannual__c = 'dddddd';
+		conTest2.LostBrands[0].LostProducts[0].lineNo2 = 0;
+		conTest2.LostBrands[0].LostProducts[0].LostProductss = new PCLLostProduct__c(Quantity__c = 3);
+
+        Test.startTest();
+        Map<String,String> maps =  lexPCLLostReportLwcController.dataEntry(JSON.serialize(conTest2),new List<Id>(),new List<Id>());
+		lexPCLLostReportLwcController.submit('鑽夋',false,conTest2.lostReport.Id);
+		lexPCLLostReportLwcController.init('','' + conTest2.lostReport.Id,'View','','');
         Test.stopTest();
     }
 

--
Gitblit v1.9.1