From 715152a0932fe16d743766c141527bc4634087f4 Mon Sep 17 00:00:00 2001
From: 涂煌豪 <tuhuanghao@prec-tech.com>
Date: 星期二, 12 四月 2022 16:58:22 +0800
Subject: [PATCH] WLIG-CC78MX  【委托】NFM105接口增加OTS运单号字段

---
 force-app/main/default/classes/NFM603Controller.cls     |   12 +++++++++++-
 force-app/main/default/classes/NFM603ControllerTest.cls |   36 +++++++++---------------------------
 force-app/main/default/classes/NFM105Rest.cls           |    9 +++++----
 3 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/force-app/main/default/classes/NFM105Rest.cls b/force-app/main/default/classes/NFM105Rest.cls
index 7b4bb1f..80e7a37 100644
--- a/force-app/main/default/classes/NFM105Rest.cls
+++ b/force-app/main/default/classes/NFM105Rest.cls
@@ -26,7 +26,7 @@
         public String ReturnType;
         public String InspectType;
         //WLIG-CC78MX 銆愬鎵樸�慛FM105鎺ュ彛澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220307 start
-        // public String OTSRepairOrder;
+        public String OTSRepairOrder;
         //WLIG-CC78MX 銆愬鎵樸�慛FM105鎺ュ彛澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220307 end
         public InspectionResultInformation[] InspectionResultInformation;
         public FailureInformation[] FailureInformation;
@@ -475,9 +475,9 @@
                     // L65-OGZ淇悊鍝佸嚭搴�
                     // L80-RC淇悊鍝佸嚭搴�
                     //WLIG-CC78MX 銆愬鎵樸�慛FM105鎺ュ彛澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220307 start
-                    // if(String.isNotBlank(quoteInfo.OTSRepairOrder)){
-                    //     rpr.OTSRepairOrder__c = quoteInfo.OTSRepairOrder;
-                    // }
+                    if(String.isNotBlank(quoteInfo.OTSRepairOrder)){
+                        rpr.OTSRepairOrder__c = quoteInfo.OTSRepairOrder;
+                    }
                     //WLIG-CC78MX 銆愬鎵樸�慛FM105鎺ュ彛澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220307 end
                     Asset ast = getAstUpdate(astUpdateMap, rpr);
                     if (rpr.Return_Without_Repair_IF__c == true) {
@@ -554,6 +554,7 @@
             for (Repair_Quotation__c rqfalse : rqList) {
                 rqfalse.Quotation_agreement__c = false;
             }
+            System.debug('rqUpdateMap1:' + rqUpdateMap);
             rqList.addAll(rqUpdateMap.values());
             if (rqList.size() > 0) {
                 // TODO update false;
diff --git a/force-app/main/default/classes/NFM603Controller.cls b/force-app/main/default/classes/NFM603Controller.cls
index bc76418..2aa5dbe 100644
--- a/force-app/main/default/classes/NFM603Controller.cls
+++ b/force-app/main/default/classes/NFM603Controller.cls
@@ -41,6 +41,10 @@
         public String QuotationGread; //鎶ヤ环绛夌骇(new)
         public String detectionResult; //妫�娴嬬粨鏋�
         public String cus_dn; //DN鍙�
+        //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 start
+        public String OTSRepairOrder;
+        //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 end
+
         //閫佷慨鐗╂祦
         public String deliveryLogisticsMode; //閫佷慨鐗╂祦鏂瑰紡
         public String engineerSendDate; //宸ョ▼甯堜慨鐞嗗搧瀵勯�佹棩
@@ -233,7 +237,10 @@
                 Repair_Final_Inspection_DateTime__c,
                 Repair_Shipped_DateTime__c,
                 Repair_Discount_approval_DateTime_form__c,
-                Agreed_DateTime__c
+                Agreed_DateTime__c,
+                //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 start
+                OTSRepairOrder__c
+                //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 end
                 from Repair__c where id in: repairOrderIdList
             ];
         }
@@ -369,6 +376,9 @@
                 info.SorcOgzDate = NFMUtil.formatDate2StrDateTime(repair.SorcOgzDate__c);
 
                 info.cus_dn = repair.DnNO__c;
+                //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 start
+                info.OTSRepairOrder = repair.OTSRepairOrder__c;
+                //淇悊澧炲姞OTS杩愬崟鍙峰瓧娈� thh 20220308 end
                 repairs.add(info);
             }
             logstr += '\nend';
diff --git a/force-app/main/default/classes/NFM603ControllerTest.cls b/force-app/main/default/classes/NFM603ControllerTest.cls
index f0899a1..92d2cab 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');
@@ -74,8 +75,6 @@
                from Asset
                where Id = :ast.Id];
 
-       
-
         Repair__c rpr = new Repair__c();
         rpr.PAE_Determine__c = 'PAE' ;   //-- 
         rpr.ifDeadHurt__c = '鏈�';        //-- R1
@@ -105,10 +104,7 @@
         //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 +154,6 @@
         raObj.Repair__c = rpr.Id;
         insert raObj;
 
-
         Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
 
         // 澶囧搧閰嶅
@@ -167,9 +162,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 +177,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 +211,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';
@@ -251,13 +233,13 @@
 
     // @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);
         
@@ -266,7 +248,7 @@
 
     @isTest
     static void testcallout3(){
-    	BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test'];
+      BatchIF_Log__c iflog = [select id from BatchIF_Log__c where Type__c = '603test'];
         NFM603Controller.ManualExecute(iflog.Id);
     }
 

--
Gitblit v1.9.1