From 9b197b7fac92278fb591ea8f4942c7d5687cb5ce Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期一, 28 三月 2022 18:01:22 +0800
Subject: [PATCH] LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备0328
---
force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls | 295 +++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 205 insertions(+), 90 deletions(-)
diff --git a/force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls b/force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls
index 46684e3..83caace 100644
--- a/force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls
+++ b/force-app/main/default/classes/RentalFixtureSetAssignAgencyControTest.cls
@@ -74,7 +74,7 @@
// 浜у搧
Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
- Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
+ Fixture_Model_No__c='modlen01',Serial_Lot_No__c='S/N tracing',
Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
ProductCode_Ext__c='pc01',Manual_Entry__c=false);
Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
@@ -188,7 +188,7 @@
Fixture_Set__c fsObj1 = new Fixture_Set__c();
//fsObj1.Name = 'set1';
fsObj1.Name = 'n01';
- fsObj1.Fixture_Set_Body_Model_No__c = 'n01';
+ fsObj1.Fixture_Set_Body_Model_No__c = 'modlen01';
fsObj1.Loaner_name__c = 'name1';
insert fsObj1;
@@ -367,7 +367,29 @@
raesdObj3.Product_category_text__c = 'GI';
raesdObj3.Equipment_Type_text__c = '浜у搧璇曠敤';
raesdObj3.Cancel_Select__c=false;
- insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3};
+
+ Rental_Apply_Equipment_Set_Detail__c raesdObj4 = new Rental_Apply_Equipment_Set_Detail__c();
+ raesdObj4.Rental_Apply__c = raObj.Id; //raesdObj3.Asset__c = asset3.Id;
+ raesdObj4.Fixture_Set_Detail__c = fsdObjA3.Id;
+ raesdObj4.Rental_Num__c = 1;
+ raesdObj4.Queue_Number__c = null;
+ raesdObj4.Is_Body__c = false;
+ raesdObj4.Rental_Apply_Equipment_Set__c = raesObj.Id;
+ raesdObj4.IndexFromUniqueKey__c = 4;
+ raesdObj4.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA3.Id + ':4';
+ raesdObj4.FSD_OneToOneAccessory_Cnt__c = 2;
+ raesdObj4.FSD_Is_Optional__c = false;
+ raesdObj4.FSD_Is_OneToOne__c = false;
+ raesdObj4.ApplyPersonAppended__c = false;
+ raesdObj4.FSD_Fixture_Model_No__c = 'n04';
+ raesdObj4.Fixture_Model_No_text__c = 'n04';
+ raesdObj4.Salesdepartment_before__c = '1.鍗庡寳钀ヤ笟鏈儴';
+ raesdObj4.Internal_asset_location_before__c = '鍖椾含 澶囧搧涓績';
+ raesdObj4.Product_category_text__c = 'GI';
+ raesdObj4.Equipment_Type_text__c = '浜у搧璇曠敤';
+ raesdObj4.Cancel_Select__c=true;
+ raesdObj4.Cancel_Reason__c= '涓诲姩鍙栨秷';
+ insert new Rental_Apply_Equipment_Set_Detail__c[] {raesdObj1,raesdObj2,raesdObj3,raesdObj4};
// 鐢宠鍗曞彉涓哄凡鎵瑰噯
raObj.Status__c = '宸叉壒鍑�';
@@ -458,6 +480,33 @@
System.assertEquals(false, controller.done_flg);
System.debug('init Success');
+
+ }
+
+ @isTest
+ public static void test_cancelSet3() {
+
+ List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
+
+ PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ Test.setCurrentPage(ref);
+
+ RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
+ Test.startTest();
+
+ controller.init();
+ controller.esdList[0].checked = false;
+ // 20210916 ljh update start
+ // controller.cancelReason = '涓诲姩鍙栨秷';
+ // controller.cancelReasonRemark = 'aaaa';
+ controller.parentObj.Cancel_Reason__c = '涓诲姩鍙栨秷';
+ controller.parentObj.Loaner_cancel_reason__c = '閲嶅鐢宠';
+ // 20210916 ljh update end
+ controller.cancelSet();
+ Test.stopTest();
+
+ //System.assertEquals(true, controller.done_flg);
+ //System.debug('init Success');
}
@@ -621,95 +670,11 @@
System.debug('init Success');
}
- //20210521 ljh add 1829 start
- @isTest
- public static void test_assignSub() {
+ @isTest
+ public static void test_assign() {
+
changeData();
- List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
-
- PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
- Test.setCurrentPage(ref);
-
- RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
- Test.startTest();
-
- controller.init();
- // 绗竴娆″垎閰�
- controller.esdList[0].checked = true;
- controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
- controller.applyDate();
- controller.stepName = '鍒嗛厤';
-
- controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
- controller.scanAndMatch();
- controller.assign();
-
- // controller.stepName = '涓嬫灦';
- // controller.esdList[0].checked = true;
- // controller.stockDown();// 20210624 ljh update SFDC-C448GR
-
- ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
- controller = new RentalFixtureSetAssignAgencyController();
- // 涓嬫灦鍚庨噸鏂板垎閰�
- controller.init();
- controller.stepName = '鍒嗛厤';
- controller.esdList[0].checked = true;
- controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
- controller.scanAndMatch();
- controller.assign();
-
- Test.stopTest();
-
- //System.assertEquals(true, controller.done_flg);
- System.debug('init Success');
- }
-
-
- @isTest
- public static void test_assignSub3() {
-
- List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
-
- PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
- Test.setCurrentPage(ref);
-
- RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
- Test.startTest();
-
- controller.init();
- // 绗竴娆″垎閰�
- controller.esdList[0].checked = true;
- controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
- controller.applyDate();
- controller.stepName = '鍒嗛厤';
-
- controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
- controller.scanAndMatch();
- controller.assign();
-
- // controller.stepName = '涓嬫灦';
- // controller.esdList[0].checked = true;
- // controller.stockDown();// 20210624 ljh update SFDC-C448GR
-
- ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
- controller = new RentalFixtureSetAssignAgencyController();
- // 涓嬫灦鍚庨噸鏂板垎閰�
- controller.init();
- controller.stepName = '鍒嗛厤';
- controller.esdList[0].checked = true;
- controller.qrcode = '51110001;2;'+controller.esdList[2].rec.Rental_Apply_Equipment_Set__c;
- controller.scanAndMatch();
- controller.assign();
-
- Test.stopTest();
-
- //System.assertEquals(true, controller.done_flg);
- System.debug('init Success');
- }
-
- @isTest
- public static void test_assign() {
List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
@@ -752,6 +717,156 @@
System.debug('init Success');
}
+ //20210521 ljh add 1829 start
+ @isTest
+ public static void test_assignSub() {
+ List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
+
+ PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ Test.setCurrentPage(ref);
+ List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c];
+ RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
+ Test.startTest();
+
+ controller.init();
+ // 绗竴娆″垎閰�
+ controller.esdList[0].checked = true;
+ controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
+ controller.applyDate();
+ controller.stepName = '鍒嗛厤';
+
+ controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
+ //controller.qrcode = '511100000;2;'+raesone[0].Id;
+ controller.scanAndMatch();
+ controller.assign();
+
+ // controller.stepName = '涓嬫灦';
+ // controller.esdList[0].checked = true;
+ // controller.stockDown();// 20210624 ljh update SFDC-C448GR
+
+ ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ controller = new RentalFixtureSetAssignAgencyController();
+ // 涓嬫灦鍚庨噸鏂板垎閰�
+ controller.init();
+ controller.stepName = '鍒嗛厤';
+ controller.esdList[0].checked = false;
+ //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
+ controller.qrcode = '511100000;2;'+raesone[0].Id;
+ controller.scanAndMatch();
+ controller.assign();
+
+ Test.stopTest();
+
+ //System.assertEquals(true, controller.done_flg);
+ System.debug('init Success');
+ }
+
+ @isTest
+ public static void test_assignSub03() {
+
+ List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
+
+ PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ Test.setCurrentPage(ref);
+
+ RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
+ Test.startTest();
+
+ controller.init();
+ // 绗竴娆″垎閰�
+ controller.esdList[0].checked = true;
+ controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
+ controller.applyDate();
+ controller.stepName = '鍒嗛厤';
+
+ controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
+ controller.scanAndMatch();
+ controller.assign();
+
+ // controller.stepName = '涓嬫灦';
+ // controller.esdList[0].checked = true;
+ // controller.stockDown();// 20210624 ljh update SFDC-C448GR
+
+ ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ Test.setCurrentPage(ref);
+ controller = new RentalFixtureSetAssignAgencyController();
+ // 涓嬫灦鍚庨噸鏂板垎閰�
+ controller.init();
+ controller.stepName = '鍒嗛厤';
+ controller.esdList[0].checked = true;
+ controller.qrcode = '51110001;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
+ List<Asset> mainAssetList = [
+ SELECT Id
+ , Fixture_Model_No_F__c
+ , Internal_asset_location__c
+ , SerialNumber
+ , Salesdepartment__c
+ , SalesProvince__c
+ , Product_category__c
+ , Equipment_Type__c
+ , Internal_Asset_number_key__c
+ FROM Asset
+ WHERE Fixture_QRCode__c ='51110001'
+ //AND Main_OneToOne__c = true //20210508 ljh add 1834
+ AND You_Xiao_Ku_Cun__c > 0
+ LIMIT 1
+ ];
+ List<Product2> pro2l=[select id from Product2 where Fixture_Model_No_T__c != 'n01'];
+ mainAssetList[0].Product2=pro2l[0];
+ update mainAssetList;
+ controller.scanAndMatch();
+ controller.assign();
+ Test.stopTest();
+ //System.assertEquals(true, controller.done_flg);
+ System.debug('init Success');
+ }
+
+
+ @isTest
+ public static void test_assignSub04() {
+ List<Rental_Apply__c> esList = [SELECT Id FROM Rental_Apply__c];
+
+ PageReference ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ Test.setCurrentPage(ref);
+ List<Rental_Apply_Equipment_Set__c> raesone=[select Id from Rental_Apply_Equipment_Set__c];
+ RentalFixtureSetAssignAgencyController controller = new RentalFixtureSetAssignAgencyController();
+ Test.startTest();
+
+ controller.init();
+ // 绗竴娆″垎閰�
+ controller.esdList[0].checked = true;
+ controller.parentObj.Asset_loaner_start_day__c = Date.today()+1;//20210513 ljh update
+ controller.applyDate();
+ controller.stepName = '鍒嗛厤';
+
+ controller.qrcode = '511100000;2;'+controller.esdList[1].rec.Rental_Apply_Equipment_Set__c;
+ //controller.qrcode = '511100000;2;'+raesone[0].Id;
+ controller.scanAndMatch();
+ controller.assign();
+
+ ref = new PageReference('/apex/RentalFixtureSetAssignAgency?pt_recid=' + esList[0].Id);
+ controller = new RentalFixtureSetAssignAgencyController();
+ // 涓嬫灦鍚庨噸鏂板垎閰�
+ controller.init();
+ controller.stepName = '鍒嗛厤';
+ integer i=controller.esdList.size();
+ for(integer j=0;i<i;j++){
+ controller.esdList[j].checked = false;
+ }
+ //controller.qrcode = '511100000;2;'+controller.esdList[0].rec.Rental_Apply_Equipment_Set__c;
+ controller.qrcode = '511100000;2;'+raesone[0].Id;
+ controller.scanAndMatch();
+ controller.assign();
+
+ Test.stopTest();
+
+ //System.assertEquals(true, controller.done_flg);
+ System.debug('init Success');
+ }
+
+
+
+
--
Gitblit v1.9.1