From bfca7a84bec815da594f1d12558535ed06d2490b Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 13 九月 2022 09:57:32 +0800
Subject: [PATCH] 本地提交备份
---
force-app/main/default/classes/NFM103Controller.cls | 143 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 131 insertions(+), 12 deletions(-)
diff --git a/force-app/main/default/classes/NFM103Controller.cls b/force-app/main/default/classes/NFM103Controller.cls
index 086b371..fb6ef82 100644
--- a/force-app/main/default/classes/NFM103Controller.cls
+++ b/force-app/main/default/classes/NFM103Controller.cls
@@ -110,7 +110,16 @@
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start
public String QuotationDate;
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end
-
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 start
+ public String BollowDate; //澶囧搧涓績鍑哄簱鏃�
+ public String IfRentalApply; //鏄惁鐢宠澶囧搧
+ public String OfferRental; //鏄惁鎻愪緵澶囧搧(NEW)
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 end
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 start
+ public String Series;
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 end
+ //鍐嶆敞鍐屽垎鏋� 闇�姹� 鏂板瀛楁 20220811
+ public String Reanalysis;
}
////NFM103淇敼Rest end
@@ -118,6 +127,7 @@
// Repair__c銇甀d
public static Set<Id> NFM103_Ids = new Set<Id>();
public static String debug_msg = '';
+ public static String rprId = '' ; //2022-07-14 zyh add
// on Repair__c (after insert, after update)
// 鏂拌淇悊銆乷r 鍙椾粯鐢ㄣ伄闋呯洰銈掔法闆嗐仐銇熸檪锛圧epairOrderStatusCode__c = A95鏅傘伄銇� 鍙椾粯鐢ㄣ伄闋呯洰銈掔法闆� 銇с亶銇俱仚锛�
@@ -174,6 +184,16 @@
NFM103Controller.debug_msg += 'NFM103_callout_update_' + rpr.Name;
}
}
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 start
+ if (rpr.SAPRepairNo__c !=null && (oldMap.get(rpr.Id).Bollow_Date__c != rpr.Bollow_Date__c ||oldMap.get(rpr.Id).if_Rental_Apply__c !=rpr.if_Rental_Apply__c || oldMap.get(rpr.Id).Offer_Rental_New__c != rpr.Offer_Rental_New__c)){
+ if (NFM103Controller.NFM103_Ids.contains(rpr.Id) == false) {
+ NFM103_Ids.add(rpr.Id);
+ rprIds.add(rpr.Id);
+ updMap.put(rpr.Id, new Repair__c(Id = rpr.Id,Address_type__c = 'A'));
+ NFM103Controller.debug_msg += 'NFM103_callout_update2_' + rpr.Name;
+ }
+ }
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 end
// // RepairOrderStatusCode__c = A95 锛堝彇娑堜慨鐞嗗彈鐞嗭級銇檪銇犮亼 鍙椾粯鐢ㄣ伄闋呯洰銈掔法闆嗐仐銇熸檪銆佸啀搴� SAP 銇�佷俊
// // TODO SAP鍋� 鍚屻仒鐣彿銇啀閫併伅銇с亶銈嬨亱锛熴�佷娇銇c仸銇亜銇嬨倐锛侊紒
// else if (NFM103Controller.NFM103_Ids.contains(rpr.Id) == false && rpr.RepairOrderStatusCode__c == 'A95') {
@@ -204,7 +224,18 @@
insert iflog;
iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id];
System.debug(Logginglevel.DEBUG, 'NFM103_' + iflog.Name + ' start'); // callout 銇腑 end 銇甽og銈掑嚭銇椼伨銇�
- NFM103Controller.callout(iflog.Id, rprIds);
+ // 20220902 ljh XLIU-CHSD8G update start
+ // NFM103Controller.callout(iflog.Id, rprIds, null);
+ String uid = UserInfo.getUserId();
+ String BUid = System.Label.Batch_User_Id;
+ System.debug('zheli');
+ if (uid.substring(0,15) == BUid.substring(0,15)) {
+ NFM103Controller.calloutNotfuture(iflog.Id, rprIds, null);
+ }else{
+ NFM103Controller.callout(iflog.Id, rprIds, null);
+ }
+ // 20220902 ljh XLIU-CHSD8G update end
+
}
System.debug('-----NFM103Trigger end');
}
@@ -214,11 +245,14 @@
*
* @param iflog_Id 銉偘銉嗐兗銉栥儷銇甀d
* @param repairIds 閫佷俊瀵捐薄淇悊
+ * @param reanalysisFlag 鍐嶆敞鍐屽垎鏋愪娇鐢� --- 鍐嶄慨鐞嗗垎鏋愮姸鎬�
*/
@future (callout = true)
- public static void callout(String iflog_Id, List<Id> repairIds) {
-
-
+ public static void callout(String iflog_Id, List<Id> repairIds, String reanalysisFlag) {
+ calloutNotfuture( iflog_Id, repairIds, reanalysisFlag);
+ }
+ //20220902 ljh 鏂板(澶嶅埗callout)鏂规硶
+ public static void calloutNotfuture(String iflog_Id, List<Id> repairIds, String reanalysisFlag) {
if (repairIds == null || repairIds.size() == 0) {
return;
}
@@ -341,6 +375,20 @@
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start
,Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end
+ //XLIU-CEX8A6 涓枃鏍囩瀵煎叆-SFDC浼犺緭鍨嬪彿淇敼锛堜紭鍏堝搴旓級 20220602 LY Start
+ ,Delivered_Product__r.Product2.Chinese_Labels__c
+ //XLIU-CEX8A6 涓枃鏍囩瀵煎叆-SFDC浼犺緭鍨嬪彿淇敼锛堜紭鍏堝搴旓級 20220602 LY End
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 start
+ ,Bollow_Date__c //澶囧搧涓績鍑哄簱鏃�
+ ,if_Rental_Apply__c //鏄惁鐢宠澶囧搧
+ ,Offer_Rental_New__c //鏄惁鎻愪緵澶囧搧(NEW)
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 end
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 start
+ ,Delivered_Product__r.Product2.ProductURF__c
+ ,Delivered_Product__r.Product2.ProductURF__r.URFLimitSerial__c
+ ,URF_Reapir__c
+ ,Maintenance_Contract__r.URF_Contract__c
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 end
from Repair__c where Id IN :repairIds]; // 鍓婇櫎銉囥兗銈裤倰妞滅储銇椼仾銇勩伅銇氥�丄ll ROWS 銇勩倝銇亜銇仛
System.debug(Logginglevel.DEBUG, 'NFM103_ recptList.size()=' + recptList.size());
@@ -362,9 +410,17 @@
element.DepartmentNo = rpr.Account__r.Management_Code__c;
element.SAPAgentNo = rpr.Dealer__r.Management_Code__c;
element.RepairOTCode = rpr.Delivered_Product__r.Product2.ProductCode;
+
//LJPH-C7Z8AP LY Start
- element.RepairModel = rpr.Delivered_Product__r.Product2.Asset_Model_No__c;
- // LJPH-C9SB9C LHJ 鐗规畩瀵瑰簲 Start
+ //element.RepairModel = rpr.Delivered_Product__r.Product2.Asset_Model_No__c;
+ //LJPH-C9SB9C LHJ 鐗规畩瀵瑰簲 Start
+ //XLIU-CEX8A6 涓枃鏍囩瀵煎叆-SFDC浼犺緭鍨嬪彿淇敼锛堜紭鍏堝搴旓級 20220602 LY Start
+ if (String.isBlank(rpr.Delivered_Product__r.Product2.Chinese_Labels__c)) {
+ element.RepairModel = rpr.Delivered_Product__r.Product2.Asset_Model_No__c;
+ } else {
+ element.RepairModel = rpr.Delivered_Product__r.Product2.Chinese_Labels__c;
+ }
+ //XLIU-CEX8A6 涓枃鏍囩瀵煎叆-SFDC浼犺緭鍨嬪彿淇敼锛堜紭鍏堝搴旓級 20220602 LY End
if (element.RepairModel == 'G400') {
element.RepairModel = '777000';
} else if (element.RepairModel == 'EU-ME2(KEYBOARD)') {
@@ -395,7 +451,7 @@
element.TradeType = NFMUtil.getMapValue(transferMap, 'Trade__c', rpr.Delivered_Product__r.Backorder__r.Opportunity__r.Trade__c, iflog);
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� start
- element.QuotationDate = NFMUtil.formatDateTime2StrSprit2(rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c).replaceAll('/', '');
+ element.QuotationDate = rpr.Delivered_Product__r.SerMarGuranteeType__c != '甯傚満澶氬勾淇濅慨' ? '' : NFMUtil.formatDateTime2StrSprit2(rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c).replaceAll('/', '');
//20220330 lt WLIG-CCT9UG 銆愬鎵樸�戝叧浜庡競鍦哄骞翠繚璁℃彁閲戣皟鏁� end
// 澶氬勾淇濅慨 LHJ Start
@@ -490,11 +546,37 @@
element.Address = rpr.Detailed_Address__c; //璇︾粏鍦板潃
element.Postal = rpr.address_ZipCode__c; //閭紪
element.ReturnType = NFMUtil.getMapValue(ReturnsProductWayMap,'Returns_Product_way__c', rpr.Returns_Product_way__c, iflog);//杩斿搧鏂瑰紡
- element.UpdateStatus = rpr.Address_type__c; //鐢宠淇悊鏃堕棿
+ // modify by liu 20220909 鍐嶆敞鍐岄」鐩甆FM103鎺ュ彛杩為�氭祴璇曟椂杩藉姞瀵瑰簲 start
+ // element.UpdateStatus = rpr.Address_type__c; //鐢宠淇悊鏃堕棿
+ if (String.isNotBlank(reanalysisFlag)) {
+ element.UpdateStatus = 'X'; //鐢宠淇悊鏃堕棿
+ } else {
+ element.UpdateStatus = rpr.Address_type__c; //鐢宠淇悊鏃堕棿
+ }
+ // modify by liu 20220909 鍐嶆敞鍐岄」鐩甆FM103鎺ュ彛杩為�氭祴璇曟椂杩藉姞瀵瑰簲 end
+
//add by wangweipeng 2021/07/14 end
//add pi 瀵嗘枃 sushanhu 20220222 start
element.DataId =rpr.AWS_Data_Id__c;//aws瀛樺偍鍑瘉
//add pi 瀵嗘枃 sushanhu 20220222 end
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 start
+ element.BollowDate =NFMUtil.formatDate2Str(rpr.Bollow_Date__c); //澶囧搧涓績鍑哄簱鏃�
+ element.IfRentalApply =rpr.if_Rental_Apply__c ? 'X':''; //鏄惁鐢宠澶囧搧
+ element.OfferRental =rpr.Offer_Rental_New__c ? 'X':''; //鏄惁鎻愪緵澶囧搧锛圢EW锛�
+ //XLIU-CGAD3Z 銆愬鎵樸�戝鍝佺浉鍏冲瓧娈典紶杈撹嚦SAP LY 20220714 end
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 start
+ if (rpr.Maintenance_Contract__r.URF_Contract__c == true && rpr.Delivered_Product__r.Product2.ProductURF__c !=null) {
+ element.Series =rpr.Delivered_Product__r.Product2.ProductURF__r.URFLimitSerial__c =='URF-P'?'P':'V'; //闄愭鍚堝悓绯诲垪
+ }else{
+ element.Series =null;
+ }
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 end
+ rprId = rpr.Id; //2022-07-14 zyh add
+
+ //鍐嶆敞鍐屽垎鏋� 闇�姹� 鏂板瀛楁 20220811 sx start
+ element.Reanalysis = reanalysisFlag;
+ //鍐嶆敞鍐屽垎鏋� 闇�姹� 鏂板瀛楁 20220811 sx end
+
}
@@ -525,14 +607,27 @@
// NFM103淇敼Rest end
execute(rowData, iflog);
}
- logstr += '\nStatus:' + status;
+ logstr += '\nStatus:' + status ;
// WLIG-BXQBH6 start 淇濆瓨鍥炲鍐呭
logstr += '\nResponse:' + responseBody;
+ System.debug('SAPRepairNo2:' + SAPRepairNo);
if(string.isNotEmpty(SAPRepairNo)){
+ System.debug('SAPRepairNo3:' + SAPRepairNo);
Repair__c rpr = new repair__c(id = repairIds[0], SAPRepairNo__c = SAPRepairNo);
+ System.debug('rpr1:' + rpr);
update rpr;
}
// WLIG-BXQBH6 end 淇濆瓨鍥炲鍐呭
+ //澶囧搧鐩稿叧瀛楁浼犺緭鑷砈AP LY 20220908 start
+ List <Repair__c> rprflag = new List <Repair__c>();
+ for (Id idflag :repairIds){
+ Repair__c rprnew = new repair__c();
+ rprnew.id = idflag;
+ rprnew.Address_type__c = '';
+ rprflag.add(rprnew);
+ }
+ update rprflag;
+ //澶囧搧鐩稿叧瀛楁浼犺緭鑷砈AP LY 20220908 end
logstr += '\nend';
} catch (Exception ex) {
// 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎
@@ -579,6 +674,11 @@
logstr = iflog.Log__c;
}
try {
+ // if (rowData.retry_cnt__c >= 1) {
+ // }else {
+ // List<BatchIF_Log__c> logList = [Select Id, Name, Log__c, ErrorLog__c from BatchIF_Log__c where Id = :rowData.Id];
+ // BatchIF_Log__c log1 = logList[9];
+ // } //2022-07-18 zyh 娉ㄩ噴
// NFM103淇敼Rest start
// Nfm103Sync.HTTPS_Port stub = new Nfm103Sync.HTTPS_Port();
// stub.timeout_x = 100000; // timeout in milliseconds
@@ -597,8 +697,8 @@
// NFMUtil.response response =
// NFMUtil.sendToSapStatusAndBody(rowDataStr, NFMUtil.NFM103_ENDPOINT);
//update to aws 20220222 sushanhu start for PIPL
- PIHelper.PIIntegration NFM103AWS =PIHelper.getPIIntegrationInfo('NFM103');
- NFMUtil.response response = NFMUtil.sendToPiAWS(rowDataStr, NFM103AWS.newUrl,NFM103AWS.token);
+ PIHelper.PIIntegration NFM103AWS =PIHelper.getPIIntegrationInfo('NFM103');
+ NFMUtil.response response = NFMUtil.sendToPiAWS(rowDataStr, NFM103AWS.newUrl,NFM103AWS.token);
//update to aws 20220222 sushanhu end for PIPL
status = response.status;
system.debug('AWS Response status:'+status);
@@ -613,6 +713,7 @@
NFM103Response =
(NFM103Response) JSON.deserializeStrict(ResponseBody, NFM103Response.class);
}
+ System.debug('NFM103Response.SAPRepairNo:' + NFM103Response.response[0].LOG.SAPRepairNo);
if (NFM103Response.response != null &&
NFM103Response.response.size() > 0 &&
NFM103Response.response[0].LOG != null &&
@@ -620,6 +721,23 @@
SAPRepairNo = NFM103Response.response[0].LOG.SAPRepairNo;
}
+ System.debug('SAPRepairNo1===:' + SAPRepairNo);
+ //2022-07-14 zyh add start
+ // if (rowData.retry_cnt__c != 2) {
+ // String srn = NFM103Response.Response[9].LOG.SAPRepairNo;
+ // }
+ String repairNo1 = nfm103.RepairRequest.GeneralData[0].SFDCRepairNo;
+ System.debug('repairNo1--------------------1:' + repairNo1);
+
+ List<Repair__c> repairList = [SELECT Id From Repair__c Where Name = :repairNo1];
+ if(string.isNotEmpty(SAPRepairNo)){
+ System.debug('SAPRepairNo3-1:' + SAPRepairNo);
+ System.debug('rprId--------------------1:' + rprId);
+ Repair__c rpr = new repair__c(id = repairList[0].Id, SAPRepairNo__c = SAPRepairNo);
+ System.debug('rpr1-1:' + rpr);
+ update rpr;
+ }
+ //2022-07-14 zyh add end
rowData.retry_cnt__c = 0;
//add wangweipeng 2022/02/18 start
//濡傛灉涓簍rue锛岃瘉鏄庢槸閲嶆柊鍙戦�佺殑鎺ュ彛锛岄渶瑕佹妸鏃ュ織璁板綍涓�
@@ -683,6 +801,7 @@
iflog.ErrorLog__c += ex.getMessage() + '\n';
iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
+ System.debug('鏍囪0--------------------1:' + rowData.retry_cnt__c);
//---Gaozw---add
if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
if (rowData.retry_cnt__c < batch_retry_max_cnt) {
--
Gitblit v1.9.1