From ec47f5ab5923a315bf22e0df5af7371e9668589e Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期五, 23 十二月 2022 11:16:18 +0800
Subject: [PATCH] 修理接口推送触发条件新加故障描述修理内容等
---
force-app/main/default/classes/NFM603ControllerTest.cls | 86 +++++++++++++++++++++++++++----------------
1 files changed, 54 insertions(+), 32 deletions(-)
diff --git a/force-app/main/default/classes/NFM603ControllerTest.cls b/force-app/main/default/classes/NFM603ControllerTest.cls
index f0899a1..d30f234 100644
--- a/force-app/main/default/classes/NFM603ControllerTest.cls
+++ b/force-app/main/default/classes/NFM603ControllerTest.cls
@@ -6,6 +6,7 @@
@testSetup
static void makeTestRepair() {
+ Oly_TriggerHandler.bypass('ContactTriggerHandler');
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
throw new ControllerUtil.myException('not found 鐥呴櫌 recodetype');
@@ -73,9 +74,11 @@
ast = [select Id, Name, Product_Serial_No__c, AccountId, Department_Class__c, Department_Class__r.Management_Code_Auto__c, Hospital__c, Product2Id, Product2.ProductCode, Product2.Repair_Product_Code__c, SerialNumber
from Asset
where Id = :ast.Id];
-
-
-
+ RepairSubOrder__c subOrder = new RepairSubOrder__c();
+ subOrder.AttachmentDownload__c = true;
+ subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
+ subOrder.AttachmentName__c = '娴嬭瘯闄勪欢涓嬭浇';
+ insert subOrder;
Repair__c rpr = new Repair__c();
rpr.PAE_Determine__c = 'PAE' ; //--
rpr.ifDeadHurt__c = '鏈�'; //-- R1
@@ -84,12 +87,16 @@
rpr.Account__c = depart.Id;
rpr.Department_Class__c = section.Id;
rpr.Hospital__c = company.Id;
+ rpr.DeliveryLogisticsMode__c = '鍏朵粬';
+ rpr.RepairSubOrder__c = subOrder.Id;
rpr.Delivered_Product__c = ast.Id;
rpr.Status__c = '1.鍙楃悊瀹屾瘯';
+ rpr.SAP_Transfer_time__c = null;
rpr.Incharge_Staff__c = Userinfo.getUserId();
rpr.Repair_Detail__c = 'test';
rpr.GeneratedPDFField__c = null;
rpr.AsyncData__c = true;
+ rpr.AwaitToSendAWS__c = false;
rpr.Complaint_Number__c = null;
rpr.ReportAdverseEvents__c = '鏈�';
rpr.ProblemOccurred__c = '鍒拌揣楠屾敹';
@@ -100,15 +107,13 @@
rpr.Failure_Occurrence_Date__c = Date.today();
rpr.Repair_Ordered_Date__c = Date.today();
rpr.Repair_Shipped_Date__c = Date.today();
+ rpr.Repair_Ordered_DateTime__c = Datetime.newInstance(2022,04,13,18,18,18);
rpr.ReturnType__c = 'A20';
rpr.AwaitToSendAWS__c = true;
//rpr.Returns_Product_waySAP__c = '杩旈�佸尰闄�';
insert rpr;
-
-
-
- BatchIF_Log__c iflog = new BatchIF_Log__c();
+ BatchIF_Log__c iflog = new BatchIF_Log__c();
iflog.Log__c = '[{"userReturnDate":"2021-08-09","userAgreeDAte":"2021-08-09","strategicDepartmenNm":null,"strategicDepartmenCd":"8089815","spareEquipMode":null,"spareEquipLendingDate":null,"SAPrepairApplyDate":"2021-08-05","returnStage":null,"returnLogisticsSendTime":"2021-08-03T09:49:00.000Z","returnLogisticsRemark":"123123","returnLogisticsReceiveTime":"2021-08-19T09:49:00.000Z","returnLogisticsNo":"123123","returnLogisticsMode":null,"RepairType":null,"repairStartDate":"2021-08-09","repairproductsRevDate":"2021-08-10","repairOrderNo2":null,"repairOrderNo":null,"repairOrderCreateDate":"2021-08-03T10:05:44.000Z","repairOrderCompleteDate":"2021-08-09","repairNo":"RS-202108-564405","repairCompleteExpectedDate":null,"repairCompleteDate":"2021-08-09","repairApplicant":"SFDC-05","region":"鏉变含","RCreturnDate":"2021-08-09","RCacceptanceDate":"2021-08-09","quotationDate":null,"province":"鍖椾含甯�","priceApprovalDate":null,"planQuotationDate":"2021-08-11","payCompleteDate":"2021-08-09","partsCompleteDate":"2021-08-09","officeLogisticsReceiveDate":"2021-08-10","MultiYearContractStartDate":null,"MultiYearContractNo":null,"MultiYearContractEndDate":null,"logisticsSendDate":"2021-08-04","logisticsReceiveDate":"2021-08-19","latestPayDate":null,"isRepairWarrantyObj":false,"invoiceReceiveDate":"2021-08-09","invoiceDate":null,"inspectionDate":"2021-08-09","incomeReckoninDate":"2021-08-09","hospitalNm":"1","hospitalCd":"8089815","FSErepairApplyDate":"2021-08-17","FirstQuotationDate":null,"finalTestDate":"2021-08-09","finalQuotationPrice":152.2,"FaultDescData":null,"equipmentModel":"GX2201:111222","equipmentCd":"111222","detectionResult":null,"departmentNm":"8089815","departmentCd":null,"deliveryLogisticsNo":"123123","deliveryLogisticsMode":"蹇��","ContractStartDate":null,"ContractNo":null,"ContractEndDate":null,"city":"鍖椾含甯�","cancelRepairDate":"2021-08-09","bpsqbh":null,"applySpareEquip":false,"applicantTel":null,"ActualQuotationDate":"2021-08-09","acceptanceFormSendDate":"2021-08-09","acceptanceFormReceivedDate":"2021-08-09","abandonPayDate":null},{"userReturnDate":"2021-08-09","userAgreeDAte":"2021-08-09","strategicDepartmenNm":null,"strategicDepartmenCd":"8089815","spareEquipMode":null,"spareEquipLendingDate":null,"SAPrepairApplyDate":"2021-08-05","returnStage":null,"returnLogisticsSendTime":"2021-08-03T09:49:00.000Z","returnLogisticsRemark":"====","returnLogisticsReceiveTime":"2021-08-04T02:23:00.000Z","returnLogisticsNo":"20210804-1","returnLogisticsMode":null,"RepairType":null,"repairStartDate":"2021-08-09","repairproductsRevDate":"2021-08-10","repairOrderNo2":null,"repairOrderNo":null,"repairOrderCreateDate":"2021-08-04T02:39:59.000Z","repairOrderCompleteDate":"2021-08-09","repairNo":"RS-202108-564406","repairCompleteExpectedDate":"2021-08-09","repairCompleteDate":"2021-08-09","repairApplicant":"SFDC-05","region":"鍏朵粬","RCreturnDate":"2021-08-09","RCacceptanceDate":"2021-08-09","quotationDate":null,"province":"鍖椾含甯�","priceApprovalDate":null,"planQuotationDate":"2021-08-10","payCompleteDate":"2021-08-09","partsCompleteDate":"2021-08-09","officeLogisticsReceiveDate":"2021-08-10","MultiYearContractStartDate":null,"MultiYearContractNo":"BJ-RS-BJ0063159","MultiYearContractEndDate":null,"logisticsSendDate":"2021-08-21","logisticsReceiveDate":"2021-08-15","latestPayDate":null,"isRepairWarrantyObj":false,"invoiceReceiveDate":"2021-08-09","invoiceDate":null,"inspectionDate":"2021-08-09","incomeReckoninDate":"2021-08-09","hospitalNm":"1","hospitalCd":"8089815","FSErepairApplyDate":"2021-08-17","FirstQuotationDate":null,"finalTestDate":"2021-08-09","finalQuotationPrice":152.2,"FaultDescData":null,"equipmentModel":"GX2201:111222","equipmentCd":"111222","detectionResult":null,"departmentNm":"8089815","departmentCd":null,"deliveryLogisticsNo":"20210804","deliveryLogisticsMode":"蹇��","ContractStartDate":null,"ContractNo":"BJ-RS-BJ0063159","ContractEndDate":null,"city":"鍖椾含甯�","cancelRepairDate":"2021-08-09","bpsqbh":null,"applySpareEquip":false,"applicantTel":null,"ActualQuotationDate":"2021-08-10","acceptanceFormSendDate":"2021-08-09","acceptanceFormReceivedDate":"2021-08-09","abandonPayDate":null,"supplySpareEquip":true}]';
iflog.Type__c = '603test';
insert iflog;
@@ -158,7 +163,6 @@
raObj.Repair__c = rpr.Id;
insert raObj;
-
Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
// 澶囧搧閰嶅
@@ -167,9 +171,6 @@
// fsObj1.Fixture_Set_Body_Model_No__c = 'modelNo1';
// fsObj1.Loaner_name__c = 'name1';
// insert fsObj1;
-
-
-
// 浜у搧
Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
@@ -185,7 +186,6 @@
fsdObjA1.Is_Optional__c = false;
fsdObjA1.UniqueKey__c = fsObjA1.Id + ':' + pro1.Id;
fsdObjA1.SortInt__c = 1;
-
// 鍊熷嚭澶囧搧閰嶅涓�瑙�
Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
@@ -220,25 +220,16 @@
raesdObj1.DataMigration_Flag__c = true;
insert raesdObj1;
raesObj.First_RAESD__c = raesdObj1.Id;
- update raesObj;
-
-
-
-
-
-
-
+ update raesObj;
}
@isTest
static void testCallOut1(){
- List<Repair__c> repairList = [select id from Repair__c];
-
- Test.startTest();
-
+ List<Repair__c> repairList = [select id from Repair__c];
+ Test.startTest();
List<Id> idList = new List<Id>();
for(Repair__c repair : repairList){
- idList.add(repair.Id);
+ idList.add(repair.Id);
}
BatchIF_Log__c iflog = new BatchIF_Log__c();
iflog.Log__c = 'test start \n';
@@ -248,27 +239,50 @@
Test.stopTest();
}
+ @isTest
+ static void testCallOut1_2(){
+ List<Repair__c> repairList = [select id,Repair_Ordered_DateTime__c,OTSRepairOrder__c,SAP_Transfer_time__c,Status__c from Repair__c];
+ Test.startTest();
+ List<Id> idList = new List<Id>();
+ for(Repair__c repair : repairList){
+ repair.Repair_Ordered_DateTime__c = Datetime.newInstance(2022,04,13,05,18,18);
+ repair.SAP_Transfer_time__c = Datetime.newInstance(2022,04,13,18,18,18);
+ repair.OTSRepairOrder__c = '123123123';
+ // idList.add(repair.Id);
+ }
+ upsert repairList;
+ for(Repair__c repair : repairList){
+ idList.add(repair.Id);
+ }
+ BatchIF_Log__c iflog = new BatchIF_Log__c();
+ iflog.Log__c = 'test start \n';
+ insert iflog;
+
+ NFM603Controller.executefuture(iflog,idList);
+
+ Test.stopTest();
+ }
// @isTest
// static void testcallout2(){
- // List<Repair__c> repairList = [select id from Repair__c];
+ // List<Repair__c> repairList = [select id from Repair__c];
// Test.startTest();
// List<Id> idList = new List<Id>();
// for(Repair__c repair : repairList){
- // idList.add(repair.Id);
+ // idList.add(repair.Id);
// }
// NFM603Controller.executefuture(null,idList);
// Test.stopTest();
// }
- @isTest
- static void testcallout3(){
- BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test'];
- NFM603Controller.ManualExecute(iflog.Id);
- }
+ // @isTest
+ // static void testcallout3(){
+ // BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test' limit 1];
+ // NFM603Controller.ManualExecute(iflog.Id);
+ // }
@isTest
static void NFM603BatchTest01(){
@@ -291,5 +305,13 @@
Database.executeBatch(new NFM603Batch(idList),100);
Test.stopTest();
}
+ @isTest
+ static void NFM603execute(){
+ List<BatchIF_Log__c> logList = [select id from BatchIF_Log__c];
+ Test.startTest();
+ BatchIF_Log__c iflog = logList[0];
+ NFM603Controller.ManualExecute(iflog.Id);
+ Test.stopTest();
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1