From 5835379ec30b1667c4e522db9d294c9b7bb8633a Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 26 四月 2022 12:00:31 +0800
Subject: [PATCH] SSBG Back up
---
force-app/main/default/classes/SBG027Controller.cls | 74 ++++++++++++++++++++++++++++++++-----
1 files changed, 64 insertions(+), 10 deletions(-)
diff --git a/force-app/main/default/classes/SBG027Controller.cls b/force-app/main/default/classes/SBG027Controller.cls
index 8ca0d67..4631772 100644
--- a/force-app/main/default/classes/SBG027Controller.cls
+++ b/force-app/main/default/classes/SBG027Controller.cls
@@ -1,5 +1,13 @@
+/**
+ * @description :
+ * @author : ChangeMeIn@UserSettingsUnder.SFDoc
+ * @group :
+ * @last modified on : 03-09-2022
+ * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc
+**/
public without sharing class SBG027Controller {
-
+ public static String responseBody;//dennis 2022/3/9
+ public static String status;//dennis 2022/3/9
public class SBG027 {
public GeDatas_element GeDatas;
}
@@ -23,6 +31,7 @@
public String SalesChannel;
public String DealerCode;
public String DealerSalesStaffName;
+ public String DataId; //dennis update for pi 2022/3/9
public String DeliveryDate;
public String PaymentCondition;
public String SpecialWarranty;
@@ -107,7 +116,8 @@
Opportunity.SalesChannel__c, Opportunity.ExpectedDeliveryDate__c, Opportunity.DealerId__c,Opportunity.DealerSalesStaffName__c,OlympusContractPricesD__c,SpecialDeliveryContact_D__c,Opportunity.SpecialDeliveryContact_D__r.ManagementCode_F__c,
Opportunity.ForeignTradeCompany__c, Opportunity.SpecialDeliveryAddress__c,PaymentTerms__c,SpecialDeliveryContact__c,PDF_Sp_Shipment_Term__c,PDF_Sp_ShippingTerms__c,
ForeignTradeCompany_D__r.ManagementCode_F__c, SpecialDeliveryAccount_D__r.ManagementCode_F__c, SpecialDeliveryContact2_D__r.ManagementCode_F__c,Opportunity.Dealer__r.DummyDealer__c,ContractPriceTotal__c,
- If_Supervise__c,CrossCooperativeDealerCode__c,SplitRatio__c,CrossCooperativeProject__c,Level_Category__c,DealerSalesStaffNameA__c,Dealer_A__r.ManagementCode_Ext__c,Dealer_B__r.ManagementCode_F__c
+ If_Supervise__c,CrossCooperativeDealerCode__c,SplitRatio__c,CrossCooperativeProject__c,Level_Category__c,
+ Opportunity.AWS_Data_Id__c //dennis start for pi 2022/3/3
from order where Id IN :ordIds ];
//List<order> ordList = [select Id,Name,Opportunity.Name, Opportunity.CurrencyIsoCode,OrderNumber,Opportunity.ForeignTradeCompany__r.ManagementCode_F__c,CustomerContractPriceD__c,SpecialCondition_text__c,SalesChannel__c,
// Owner.Name,Opportunity.AccountId__c,Opportunity.InquiryNumber__c,Opportunity.SpecialDeliveryAddress__r.ManagementCode_F__c, ServiceFee_D__c,Opportunity.SpecialDeliveryAddress_D__c,Opportunity.SpecialDeliveryAddress_D__r.ManagementCode_F__c,
@@ -189,9 +199,14 @@
//CBPR
if (ord.Opportunity.Dealer__r.DummyDealer__c == true || ord.Opportunity.SalesChannel__c == 'direct'){
- quotation.DealerCode = ord.Opportunity.Account.ManagementCode_F__c;
- quotation.SalesAccountCode = ord.SpecialDeliveryAccount_D__r.ManagementCode_F__c;
- }
+ quotation.DealerCode = ord.Opportunity.Account.ManagementCode_F__c;
+ if (ord.Opportunity.TradeType__c == 'Tax Exemption' && ord.Opportunity.SalesChannel__c == 'direct') {
+ quotation.SalesAccountCode = ord.Opportunity.Account.ManagementCode_F__c;
+ }else {
+ quotation.SalesAccountCode = ord.SpecialDeliveryAccount_D__r.ManagementCode_F__c;
+ }
+ }
+
else{
quotation.DealerCode = ord.Opportunity.Dealer__r.ManagementCode_Ext__c;
quotation.SalesAccountCode = ord.Opportunity.Account.ManagementCode_F__c;
@@ -200,19 +215,20 @@
quotations.GeData.add(quotation);
quotation.OrderCode = ord.OrderNumber;
quotation.OpportunityCode = ord.Opportunity.InquiryNumber__c;
-// //quotation.SalesAccountCode = ord.Opportunity.Account.ManagementCode_F__c;
+// quotation.SalesAccountCode = ord.Opportunity.Account.ManagementCode_F__c;
quotation.ProductSegment = ord.Opportunity.ProductSegment__c;
quotation.TradeType = ord.Opportunity.TradeType__c;
quotation.MachineParts = ord.Opportunity.Machine_Parts__c;
quotation.SalesChannel = ord.Opportunity.Machine_Parts__c == 'Parts' ? '40' : ord.Opportunity.SalesChannel__c == 'dealer' ? '41' : '42';
quotation.DeliveryDate = NFMUtil.formatDate2Str(ord.Opportunity.ExpectedDeliveryDate__c);
-// // quotation.DealerCode = ord.Opportunity.Dealer__r.ManagementCode_Ext__c;
+// quotation.DealerCode = ord.Opportunity.Dealer__r.ManagementCode_Ext__c;
quotation.DealerSalesStaffName = ord.Opportunity.DealerSalesStaffName__c;
quotation.ForeignTradeCompany = ord.ForeignTradeCompany_D__r.ManagementCode_F__c;
quotation.PaymentCondition = ord.PaymentTerms__c;
quotation.EndUser = ord.EndUserD__r.ManagementCode_F__c;
quotation.DeliveryDate = NFMUtil.formatDate2Str(ord.ExpDelDate__c);
quotation.ServiceFee = ord.ServiceFee_D__c;
+ quotation.DataId = ord.Opportunity.AWS_Data_Id__c;//dennis start for pi 2022/3/9 update to oppotuinity dataid
//2017/01/15杩藉姞
if(ord.Opportunity.SalesChannel__c == 'direct' && ord.Opportunity.Machine_Parts__c == 'Parts'){
quotation.Discount = 0;
@@ -238,12 +254,23 @@
quotation.Other2 = other2;//ord.SpecialCondition_text__c;
quotation.Other3 = ord.Shipment_Term_D__c + ',' + ord.Shipment_Term2_D__c;
// 璺ㄥ尯鍩熼攢鍞� XHL 20210831 Start
- quotation.CoopAgent = '';
+ /*quotation.CoopAgent = '';
quotation.CoopAgentPCT = '';
if (ord.CrossCooperativeProject__c) {//璺ㄧ渷浠藉悎浣滈」鐩�
quotation.CoopAgent = ord.Dealer_B__r.ManagementCode_F__c;//鍚堜綔鍖哄煙浠g悊鍟咰ode
quotation.DealerCode = ord.Dealer_A__r.ManagementCode_Ext__c;
quotation.DealerSalesStaffName = ord.DealerSalesStaffNameA__c;
+ String splitRatio = ord.SplitRatio__c;
+ if (String.isNotBlank(splitRatio) && splitRatio.indexof(':') > 0) {
+ Integer pct = Integer.valueOf(splitRatio.split(':')[1].trim())*10;
+ quotation.CoopAgentPCT = String.valueof(pct);//涓氱哗鎷嗗垎姣斾緥(鍙�:鍚庤竟鐨勫��*10)
+ }
+ } */
+
+ quotation.CoopAgent = '';
+ quotation.CoopAgentPCT = '';
+ if (ord.CrossCooperativeProject__c) {//璺ㄧ渷浠藉悎浣滈」鐩�
+ quotation.CoopAgent = ord.CrossCooperativeDealerCode__c;//鍚堜綔鍖哄煙浠g悊鍟咰ode
String splitRatio = ord.SplitRatio__c;
if (String.isNotBlank(splitRatio) && splitRatio.indexof(':') > 0) {
Integer pct = Integer.valueOf(splitRatio.split(':')[1].trim())*10;
@@ -375,10 +402,37 @@
} else {
logstr = iflog.Log__c;
}
+ // 娣诲姞aws涓婄嚎寮�鍏� by sushanhu 20220420
+ Boolean piOn =AWSServiceTool.getAWSServiceStatus();
try{
+ //add by sushanhu for test 20220421
+ //piOn=false;
+ if (piOn) {
+ //update to aws 2022/3/9 dennis
+ PIHelper.PIIntegration pi =PIHelper.getPIIntegrationInfo('SBG027');
+ // NFMUtil.response result =NFMUtil.sendToPiAWS(rowDataStr,pi.newUrl,pi.token);
+ AWSServiceTool.response result = AWSServiceTool.sendToPiAWS(rowDataStr,pi.newUrl,pi.token);//update forpipl by sushanhu 20220425
+ system.debug('aws result---'+result);
+ status = result.status;
+ system.debug('aws status--'+status);
+ responseBody=result.responseBody;
+ // Map<String, Object> res = (Map<String, Object>)JSON.deserializeUntyped(responseBody);
+ // status=(String)res.get(status);
+ if ('200'.equals(status)) {
+ logstr += status + '\n';
+ rowData.retry_cnt__c = 0;
+ }
+ //add by sushanhu 20220406 鍐欏叆閿欒鏃ュ織 start
+ else {
+ iflog.ErrorLog__c +=responseBody;
+ }
+ //add by sushanhu 20220406 鍐欏叆閿欒鏃ュ織 end
+ }else {
+ NFMUtil.sendToSap(rowDataStr, NFMUtil.SBG027_ENDPOINT);
+ rowData.retry_cnt__c = 0;
+
+ }
- NFMUtil.sendToSap(rowDataStr, NFMUtil.SBG027_ENDPOINT);
- rowData.retry_cnt__c = 0;
}catch(Exception ex) {
// TODO IOException
// 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎
--
Gitblit v1.9.1