From b98c031f4bb9ccef46005694a0c4837b1b4d853b Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期四, 28 四月 2022 09:32:24 +0800
Subject: [PATCH] 修理触发条件、调用方法修改
---
force-app/main/default/classes/NFM603Controller.cls | 32 ++++++++-------
force-app/main/default/classes/NFM603ControllerTest.cls | 12 +++---
force-app/main/default/classes/RepairHandler.cls | 24 ++++++++++-
force-app/main/default/classes/RepairHandlerTest.cls | 4 +-
4 files changed, 46 insertions(+), 26 deletions(-)
diff --git a/force-app/main/default/classes/NFM603Controller.cls b/force-app/main/default/classes/NFM603Controller.cls
index 579e136..d819d9c 100644
--- a/force-app/main/default/classes/NFM603Controller.cls
+++ b/force-app/main/default/classes/NFM603Controller.cls
@@ -495,7 +495,9 @@
logstr += ex.getMessage();
iflog.ErrorLog__c += ex.getMessage() + '\n';
iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
- rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, ex, null);
+ if(!Test.isRunningTest()){
+ rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, ex, null);
+ }
}
iflog.Log__c = logstr;
upsert iflog;
@@ -700,19 +702,19 @@
// }
// 2022/4/18 zhangyuheng update end
// 娴嬭瘯鐜娴嬭瘯鐢紝涓婄嚎鍓嶈娉ㄦ帀
- if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) {
- if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) {
- NFM603Controller.NFM603_Ids.add(rpr.Id);
- // rprIds.add(rpr.Id);
- rprIdMap.put(rpr.Id, rpr.Id);
- }
- }
- if (rpr.Repair_Shipped_Date__c != oldrpr.Repair_Shipped_Date__c) {
- if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) {
- NFM603Controller.NFM603_Ids.add(rpr.Id);
- rprIdMap.put(rpr.Id, rpr.Id);
- }
- }
+ // if (rpr.Repair_Firstestimated_Date__c != oldrpr.Repair_Firstestimated_Date__c) {
+ // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) {
+ // NFM603Controller.NFM603_Ids.add(rpr.Id);
+ // // rprIds.add(rpr.Id);
+ // rprIdMap.put(rpr.Id, rpr.Id);
+ // }
+ // }
+ // if (rpr.Repair_Shipped_Date__c != oldrpr.Repair_Shipped_Date__c) {
+ // if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) {
+ // NFM603Controller.NFM603_Ids.add(rpr.Id);
+ // rprIdMap.put(rpr.Id, rpr.Id);
+ // }
+ // }
// 娴嬭瘯鐜娴嬭瘯鐢紝涓婄嚎鍓嶈娉ㄦ帀
}
@@ -726,7 +728,7 @@
iflog.Type__c = LOG_TYPE;
iflog.Log__c = 'callout start\n';
insert iflog;
- NFM603Controller.callout(iflog.Id, rprIds);
+ NFM603Controller.executefuture(iflog, rprIds);
}
} else {
if (Trigger.isUpdate) {
diff --git a/force-app/main/default/classes/NFM603ControllerTest.cls b/force-app/main/default/classes/NFM603ControllerTest.cls
index c8c1c38..1688f92 100644
--- a/force-app/main/default/classes/NFM603ControllerTest.cls
+++ b/force-app/main/default/classes/NFM603ControllerTest.cls
@@ -258,7 +258,7 @@
iflog.Log__c = 'test start \n';
insert iflog;
- NFM603Controller.callout(iflog.Id,idList);
+ NFM603Controller.executefuture(iflog,idList);
Test.stopTest();
}
@@ -278,11 +278,11 @@
// 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(){
diff --git a/force-app/main/default/classes/RepairHandler.cls b/force-app/main/default/classes/RepairHandler.cls
index db18525..083d2ac 100644
--- a/force-app/main/default/classes/RepairHandler.cls
+++ b/force-app/main/default/classes/RepairHandler.cls
@@ -98,9 +98,27 @@
// 鍖呭惈鎶ヤ慨瀛愬崟鐨勪慨鐞� 淇悊鍗曠姸鎬佺紪鍙峰彉鏇村彂閫丄WS Start
if (Trigger.isUpdate) {
Repair__c oldrpr = oldMap.get(nObj.Id);
- if (String.isNotBlank(nObj.RepairSubOrder__c) && nObj.RepairOrderStatusCode__c != oldrpr.RepairOrderStatusCode__c) {
- nObj.AwaitToSendAWS__c = true;
- }
+ // 2022/04/20 zhangyuheng update start
+ if ((nObj.OTSRepairOrder__c == oldrpr.OTSRepairOrder__c) && // OTS璁㈠崟鍙峰彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.DeliveryLogisticsNo__c == oldrpr.DeliveryLogisticsNo__c) && // 閫佷慨鐗╂祦鍗曞彿鍙戠敓鏀瑰彉锛屽嵆鏃跺彂閫丄WS
+ (nObj.Returns_Product_waySAP__c == oldrpr.Returns_Product_waySAP__c) && // 閫佷慨鏂瑰紡鍙戠敓鏀瑰彉涓斿瘎閫佹棩鏈夊�硷紝鍗虫椂鍙戦�丄WS
+ (nObj.FSE_ApplyForRepair_time__c == oldrpr.FSE_ApplyForRepair_time__c) && // FSE鐢宠淇悊鏃ュ彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.Repair_Ordered_DateTime__c == oldrpr.Repair_Ordered_DateTime__c) && // 4.淇悊鍝丷C鍙楃悊鏃ワ紙灏忕▼搴忥級鍙戠敓鏀瑰彉锛屽嵆鏃跺彂閫丄WS
+ (nObj.Repair_Firstestimated_Date__c == oldrpr.Repair_Firstestimated_Date__c) && // 鍒濇鎶ヤ环鏃ワ紙涓嶇敤锛夊彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.Repair_Shipped_DateTime__c == oldrpr.Repair_Shipped_DateTime__c) && // 11.RC淇悊鍝佽繑閫佹棩锛堝皬绋嬪簭锛夊彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.Repair_Final_Inspection_DateTime__c == oldrpr.Repair_Final_Inspection_DateTime__c) && // 10.鏈�缁堟娴嬫棩锛堝皬绋嬪簭锛夊彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.Agreed_DateTime__c == oldrpr.Agreed_DateTime__c) && //7.鐢ㄦ埛鍚屾剰鏃ワ紙灏忕▼搴忥級鍙戠敓鏀瑰彉锛屽嵆鏃跺彂閫丄WS
+ (nObj.Agreed_Date__c == oldrpr.Agreed_Date__c) && // 7.鐢ㄦ埛鍚屾剰鏃ュ彂鐢熸敼鍙橈紝鍗虫椂鍙戦�丄WS
+ (nObj.engineerSendDate__c == oldrpr.engineerSendDate__c)
+ ) {
+ // 2022/04/20 zhangyuheng update end
+ if (String.isNotBlank(nObj.RepairSubOrder__c) && nObj.RepairOrderStatusCode__c != oldrpr.RepairOrderStatusCode__c) {
+ nObj.AwaitToSendAWS__c = true;
+ }
+ // 2022/04/20 zhangyuheng update start
+ }
+ // 2022/04/20 zhangyuheng update end
+
}
// 鍖呭惈鎶ヤ慨瀛愬崟鐨勪慨鐞� 淇悊鍗曠姸鎬佺紪鍙峰彉鏇村彂閫丄WS End
diff --git a/force-app/main/default/classes/RepairHandlerTest.cls b/force-app/main/default/classes/RepairHandlerTest.cls
index e90d72f..b1d643f 100644
--- a/force-app/main/default/classes/RepairHandlerTest.cls
+++ b/force-app/main/default/classes/RepairHandlerTest.cls
@@ -349,7 +349,7 @@
Username = 'Test' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja',
ProfileId = System.Label.ProfileId_SystemAdmin,
- Dept__c = '鍖荤枟鍗庡寳钀ヤ笟鏈儴', Province__c = '鍖椾含');
+ Dept__c = '鍖荤枟鍗庡寳钀ヤ笟鏈儴', Province__c = '鍖椾含',Employee_No__c = '12345'); // 2022-04-25 zhangyuheng update 'Employee_No__c = '12345''
List<Profile> p = [Select Id From Profile Where Name = '2S1_閿�鍞尰闄㈡媴褰�'];
System.assertEquals(p.size(), 1);
@@ -359,7 +359,7 @@
Username = 'Test1' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja',
ProfileId = p[0].Id,
- Dept__c = '鍖荤枟鍗庡寳钀ヤ笟鏈儴', Province__c = '鍖椾含');
+ Dept__c = '鍖荤枟鍗庡寳钀ヤ笟鏈儴', Province__c = '鍖椾含',Employee_No__c = '23456'); // 2022-04-25 zhangyuheng update 'Employee_No__c = '23456''
List<User> us = new List<User>();
us.add(user1);
us.add(user2);
--
Gitblit v1.9.1