From e3c02c03dd2de442bbced87236f60a13a1cd154e Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期四, 02 三月 2023 17:51:57 +0800
Subject: [PATCH] gzw 正式环境最新代码更新
---
force-app/main/default/classes/NFM103Controller.cls | 138 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 130 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/NFM103Controller.cls b/force-app/main/default/classes/NFM103Controller.cls
index 086b371..d0da9c7 100644
--- a/force-app/main/default/classes/NFM103Controller.cls
+++ b/force-app/main/default/classes/NFM103Controller.cls
@@ -110,14 +110,27 @@
//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;
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy start
+ public String MAINITIAL;
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy end
}
////NFM103淇敼Rest end
// 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 +187,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 +227,17 @@
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);
+ 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);
+ }else{
+ NFM103Controller.callout(iflog.Id, rprIds);
+ }
+ // 20220902 ljh XLIU-CHSD8G update end
}
System.debug('-----NFM103Trigger end');
}
@@ -217,6 +250,10 @@
*/
@future (callout = true)
public static void callout(String iflog_Id, List<Id> repairIds) {
+ calloutNotfuture(iflog_Id, repairIds);
+ }
+ //20220902 ljh 鏂板锛堝鍒讹級鏂规硶 XLIU-CHSD8G
+ public static void calloutNotfuture(String iflog_Id, List<Id> repairIds) {
if (repairIds == null || repairIds.size() == 0) {
@@ -341,6 +378,23 @@
//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
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy start
+ ,MAINITIAL__c
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy end
from Repair__c where Id IN :repairIds]; // 鍓婇櫎銉囥兗銈裤倰妞滅储銇椼仾銇勩伅銇氥�丄ll ROWS 銇勩倝銇亜銇仛
System.debug(Logginglevel.DEBUG, 'NFM103_ recptList.size()=' + recptList.size());
@@ -362,9 +416,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 +457,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
@@ -495,6 +557,29 @@
//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
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy start
+ element.MAINITIAL =rpr.MAINITIAL__c ? 'X':'';
+ //DB202211397391鈥滅淮淇濋鍒も�濆拰鈥滅淮淇濋」鐩�濇柊澧炴柟妗� fy end
+ //URF闄愭鍚堝悓2鏈� xxf 20220811 start
+ if (!String.isBlank(rpr.Maintenance_Contract__c)){
+ 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 = null;
+ //鍐嶆敞鍐屽垎鏋� 闇�姹� 鏂板瀛楁 20220811 sx end
}
@@ -525,14 +610,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 +677,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 +700,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 +716,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 +724,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 +804,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