| | |
| | | public static string ResponseBody; |
| | | public static String SAPRepairNo; |
| | | public class NFM103Response { |
| | | public RepairRequest_element RepairRequest; |
| | | // public RepairRequest_element RepairRequest; |
| | | public response[] response; |
| | | } |
| | | public class response { |
| | |
| | | public String ReturnType;//返品方式 |
| | | public String UpdateStatus;//直返修改标识 |
| | | //add by wangweipeng 2021/07/14 end |
| | | //add pi 加密 sushanhu 20220222 start |
| | | public String DataId;//AWS存储凭证 |
| | | //add pi 加密 sushanhu 20220222 end |
| | | |
| | | //20220330 lt WLIG-CCT9UG 【委托】关于市场多年保计提金调整 start |
| | | public String QuotationDate; |
| | | //20220330 lt WLIG-CCT9UG 【委托】关于市场多年保计提金调整 end |
| | | |
| | | |
| | | } |
| | | ////NFM103修改Rest end |
| | | |
| | |
| | | */ |
| | | @future (callout = true) |
| | | public static void callout(String iflog_Id, List<Id> repairIds) { |
| | | |
| | | |
| | | if (repairIds == null || repairIds.size() == 0) { |
| | | return; |
| | |
| | | List<Repair__c> recptList = [select |
| | | Id, Name, Workshop__c, SalesOfficeCode__c, |
| | | Repair_Detail__c, RepairSource__c, On_site_repair__c, PaperRepairRequestNo__c, |
| | | Failure_Occurrence_Date__c,Failure_Occurrence_Date2__c, On_Site_Repair_Order_Date__c, Send_To_RC_Date__c, |
| | | Failure_Occurrence_Date__c, On_Site_Repair_Order_Date__c, Send_To_RC_Date__c, |
| | | Hospital__r.Management_Code__c, Account__r.Management_Code__c, Dealer__r.Management_Code__c, |
| | | Incharge_Staff__r.alias, Incharge_Staff_Email__c, Incharge_Staff_Contact__c, Incharge_Staff_Contact__r.Name, CreatedBy.Alias, CreatedBy.Email, |
| | | Delivered_Product__r.Product2.Asset_Model_No__c, Delivered_Product__r.SerialNumber, Delivered_Product__r.LastSFDCRepairNo__c, |
| | |
| | | ,Returns_Product_way__c //返品方式 |
| | | ,FSE_ApplyForRepair_time__c //申请修理时间 |
| | | //add by wangweipeng 2021/07/14 start |
| | | |
| | | ,AWS_Data_Id__c //add by sushanhu AWSDateID for PIPL |
| | | //20220330 lt WLIG-CCT9UG 【委托】关于市场多年保计提金调整 start |
| | | ,Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c |
| | | //20220330 lt WLIG-CCT9UG 【委托】关于市场多年保计提金调整 end |
| | | from Repair__c where Id IN :repairIds]; // 削除データを検索しないはず、All ROWS いらないはず |
| | | System.debug(Logginglevel.DEBUG, 'NFM103_ recptList.size()=' + recptList.size()); |
| | | |
| | |
| | | element.FSEReceiveDate = NFMUtil.formatDate2Str(rpr.On_Site_Repair_Order_Date__c); // TODO 必須ではないけど、修理受付後入力したらどうやってSAPに送る? |
| | | element.FSEDeliverDate = NFMUtil.formatDate2Str(rpr.Send_To_RC_Date__c); // TODO 必須ではないけど、修理受付後入力したらどうやってSAPに送る? |
| | | 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.formatDateTime2StrSprit(rpr.Delivered_Product__r.Backorder__r.Opportunity__r.SAP_Send_OK_Date__c).replaceAll('/', ''); |
| | | //20220330 lt WLIG-CCT9UG 【委托】关于市场多年保计提金调整 end |
| | | |
| | | // 多年保修 LHJ Start |
| | | element.RepairCostType = rpr.Delivered_Product__r.SerMarGuranteeType__c != '市场多年保修' ? '' : rpr.RepairCostType__c; |
| | | element.RepairTypeQIS = rpr.RepairType_QIS__c; |
| | |
| | | }*/ |
| | | // 2021-01-07 mzy update 多年保修外贸NFM103接口修改 start |
| | | String tradeType = rpr.Delivered_Product__r.Backorder__r.Opportunity__r.Trade__c; |
| | | |
| | | String NewProductGuaranteeObject = rpr.NewProductGuaranteeObject__c == null ? '': rpr.NewProductGuaranteeObject__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; //申请修理时间 |
| | | //add by wangweipeng 2021/07/14 start |
| | | //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 |
| | | |
| | | } |
| | | |
| | | if (repairRequest.GeneralData.size() > 0) { |
| | |
| | | // NFM103修改Rest end |
| | | |
| | | // WLIG-BXQBH6 start |
| | | NFMUtil.response response = |
| | | NFMUtil.sendToSapStatusAndBody(rowDataStr, NFMUtil.NFM103_ENDPOINT); |
| | | // 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); |
| | | //update to aws 20220222 sushanhu end for PIPL |
| | | status = response.status; |
| | | ResponseBody = response.responseBody; |
| | | NFM103Response NFM103Response = new NFM103Response(); |
| | | system.debug('AWS Response status:'+status); |
| | | system.System.debug('NGM103 AWS result--'+ response.ResponseBody); |
| | | ResponseBody = response.responseBody; |
| | | //update to aws 20220302 sushanhu start for PIPL |
| | | if ('200'.equals(status)) { |
| | | Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(ResponseBody); |
| | | NFM103Response NFM103Response = new NFM103Response(); |
| | | system.debug(ResponseBody); |
| | | if (string.isNotEmpty(ResponseBody)) { |
| | | NFM103Response = |
| | |
| | | NFM103Response.response.size() > 0 && |
| | | NFM103Response.response[0].LOG != null && |
| | | string.isNotEmpty(NFM103Response.response[0].LOG.SAPRepairNo)) { |
| | | SAPRepairNo = NFM103Response.response[0].LOG.SAPRepairNo; |
| | | SAPRepairNo = NFM103Response.response[0].LOG.SAPRepairNo; |
| | | |
| | | } |
| | | rowData.retry_cnt__c = 0; |
| | | //add wangweipeng 2022/02/18 start |
| | | //如果为true,证明是重新发送的接口,需要把日志记录下 |
| | | if(needUpdateIflog){ |
| | | logstr += 'Status:' + status; |
| | | logstr += '\nResponse:' + ResponseBody; |
| | | logstr += '\nend'; |
| | | } |
| | | //add wangweipeng 2022/02/18 start |
| | | } else { |
| | | if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0; |
| | | if (rowData.retry_cnt__c < batch_retry_max_cnt) { |
| | | rowData.retry_cnt__c++; |
| | | LogAutoSendSchedule.assignOneMinute(); |
| | | } |
| | | if (rowData.retry_cnt__c >= batch_retry_max_cnt) { |
| | | rowData.ErrorLog__c = 'status:' + ResponseBody + |
| | | '\n错误次数已经超过自动送信设定的最大次数,请手动送信'; |
| | | } |
| | | } |
| | | // Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(ResponseBody); |
| | | |
| | | //update to aws 20220302 sushanhu end for PIPL |
| | | |
| | | // 原代码: |
| | | // NFM103修改Rest start |
| | | //status = |
| | |
| | | // WLIG-BXQBH6 end |
| | | |
| | | // 原則非同期ですので、logsを確認する必要がないでしょう。 |
| | | if (status == 'OK') { |
| | | rowData.retry_cnt__c = 0; |
| | | } else { |
| | | if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0; |
| | | if (rowData.retry_cnt__c < batch_retry_max_cnt) { |
| | | rowData.retry_cnt__c++; |
| | | LogAutoSendSchedule.assignOneMinute(); |
| | | } |
| | | if (rowData.retry_cnt__c >= batch_retry_max_cnt) { |
| | | rowData.ErrorLog__c = 'status:' + status + |
| | | '\n错误次数已经超过自动送信设定的最大次数,请手动送信'; |
| | | } |
| | | } |
| | | // if (status == 'OK') { |
| | | // rowData.retry_cnt__c = 0; |
| | | // //add wangweipeng 2022/02/18 start |
| | | // //如果为true,证明是重新发送的接口,需要把日志记录下 |
| | | // if(needUpdateIflog){ |
| | | // logstr += 'Status:' + status; |
| | | // logstr += '\nResponse:' + responseBody; |
| | | // logstr += '\nend'; |
| | | // } |
| | | // //add wangweipeng 2022/02/18 start |
| | | // } else { |
| | | // if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0; |
| | | // if (rowData.retry_cnt__c < batch_retry_max_cnt) { |
| | | // rowData.retry_cnt__c++; |
| | | // LogAutoSendSchedule.assignOneMinute(); |
| | | // } |
| | | // if (rowData.retry_cnt__c >= batch_retry_max_cnt) { |
| | | // rowData.ErrorLog__c = 'status:' + status + |
| | | // '\n错误次数已经超过自动送信设定的最大次数,请手动送信'; |
| | | // } |
| | | // } |
| | | } catch (Exception ex) { |
| | | // TODO IOException |
| | | // エラーが発生した場合 |