buli
2022-04-26 5835379ec30b1667c4e522db9d294c9b7bb8633a
force-app/main/default/classes/OrderPdfController.cls
@@ -62,6 +62,10 @@
    public List<OrderItem> oiList {get; set;}
    public String staticResourceContact { get; private set; }// PI改造 By Bright 20220422
    public String staticResourceOrder { get; private set; }// PI改造 By Bright 20220422
    public String staticResourceFile { get; private set; }// PI改造 By Bright 20220422
    // The extension constructor initializes the private member
    // variable mysObject by using the getRecord method from the standard
    // controller.
@@ -75,6 +79,10 @@
        } else if (path.indexOf('production/') > 0) {
            baseUrl += '/production';
        }
        staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// PI改造 By Bright 20220422
        staticResourceOrder = JSON.serialize(PIHelper.getPIIntegrationInfo('Order'));// PI改造 By Bright 20220422
        staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document'));// PI改造 By Bright 20220422
    }
    public PageReference init() {
        od = new Order();
@@ -99,7 +107,7 @@
                     PDF_Bi_Packing__c, PDF_Bi_Quality__c, PDF_Bi_Origin__c, PDF_Bi_Non_Wooden__c, PDF_Co_Contract__c, PDF_Co_Contract_E__c, PDF_Co_BContra__c, PDF_Co_BContra_E__c, PDF_SignaturePlaces__c,
                     PDF_Co_SContra__c, PDF_Co_SContra_E__c, PDF_C_Consignee__c, PDF_C_THECONSIGNE__c, PDF_C_Address__c, PDF_C_TEL__c, PDF_C_FAX__c, PDF_C_CONTACT__c,
                     PDF_BusyerCompany__c, PDF_By_Add__c, PDF_By_Tel__c, PDF_Forwarder__c, PDF_F_Add__c, PDF_F_TEL__c, PDF_F_FAX__c, PDF_F_ContactPerson__c,
                     Opportunity.SpecialDeliveryAddress__c, Opportunity.SpecialDeliveryContact__c, DeliveryTimeText__c, DeliveryTimeTextEn__c,
                     Opportunity.SpecialDeliveryAddress__c, Opportunity.SpecialDeliveryContact__c, DeliveryTimeText__c, DeliveryTimeTextEn__c,PDF_Sp_LOADING_E__c,PDF_Sp_LOADING__c,
                     SpecialDeliveryAccount__c, SpecialDeliveryAccount_D__c, SpecialDeliveryContact2__c, SpecialDeliveryContact2_D__c, PDF_Order_No__c, Total_price_E__c, ContractPriceTotal__c,
                     PDF_Shipment_Term2_Text__c, PDF_PaymentTerms__c, PDF_PaymentTerms_E__c, PDF_Sign_Name__c, PDF_Sign_Title__c, org_order__c, Is_Already_Splited__c, PDF_Is_True__c 
                     from Order where id = :Id];
@@ -171,6 +179,12 @@
                if (od.PDF_B_contactperson__c  == null || od.PDF_B_contactperson__c == '') {
                    od.PDF_B_contactperson__c = od.B_contactperson__c;
                }*/
                if (od.PDF_Sp_LOADING_E__c == null || od.PDF_Sp_LOADING_E__c == '') {
                    od.PDF_Sp_LOADING_E__c = 'Hong Kong';
                }
                if (od.PDF_Sp_LOADING__c == null || od.PDF_Sp_LOADING__c == '') {
                    od.PDF_Sp_LOADING__c = '香港';
                }
                if (od.PDF_SELLER__c == null || od.PDF_SELLER__c == '') {
                    od.PDF_Bi_q1__c = '2';
@@ -250,7 +264,9 @@
            }
            specialDeliveryContact = new Contact();
            if (od.SpecialDeliveryContact2_D__c != null) {
                specialDeliveryContact = [select Id, Name, Email from Contact where Id = :od.SpecialDeliveryContact2_D__c];
                specialDeliveryContact = [select Id, Name,
                AWS_Data_Id__c,// 20220222 PI改造 by Bright
                Email from Contact where Id = :od.SpecialDeliveryContact2_D__c];
            }
        }
@@ -530,7 +546,8 @@
                        PDF_C_Address__c, PDF_C_TEL__c, PDF_C_FAX__c, PDF_C_CONTACT__c , PDF_G_TrAndPre__c , PDF_G_SpecNo__c, PDF_F_Add__c, PDF_F_ContactPerson__c,
                        Opportunity.SpecialDeliveryAddress__c, Opportunity.SpecialDeliveryContact__c, Shipment_Term__c, Shipment_Term_D__c, Shipment_Term2__c, Shipment_Term2_D__c,
                        SpecialDeliveryAccount__c, SpecialDeliveryAccount_D__c, SpecialDeliveryContact2__c, SpecialDeliveryContact2_D__c, PDF_Order_No__c, DeliveryTimeText__c, DeliveryTimeTextEn__c, Total_price_E__c, ContractPriceTotal__c,
                        PDF_Shipment_Term2_Text__c, PDF_PaymentTerms__c, PDF_PaymentTerms_E__c, PDF_Sign_Name__c, PDF_Sign_Title__c
                        AWS_Data_Id__c,// 20220222 PI改造 by Bright
                        PDF_Shipment_Term2_Text__c, PDF_PaymentTerms__c, PDF_PaymentTerms_E__c, PDF_Sign_Name__c, PDF_Sign_Title__c,PDF_Sp_LOADING__c,PDF_Sp_LOADING_E__c
                        from Order
                        where id = :Id];
            ndtList = [select id, U8_Code__c, Quantity__c, Part_Number__c, Name_of_Goods__c from NDT_Produce__c where NDTOrder__c = :Id order by Id];
@@ -550,7 +567,9 @@
        }
        specialDeliveryContact = new Contact();
        if (odpdf.SpecialDeliveryContact2_D__c != null) {
            specialDeliveryContact = [select Id, Name, Email from Contact where Id = :odpdf.SpecialDeliveryContact2_D__c];
            specialDeliveryContact = [select Id, Name,
                                        AWS_Data_Id__c,// 20220222 PI改造 by Bright
                                        Email from Contact where Id = :odpdf.SpecialDeliveryContact2_D__c];
        }
        List<Quote> quoList = [select Id, Name, CreatedDate, OpportunityId, Opportunity.Dealer__c, Opportunity.DealerSalesStaffName__c, AccountId, PrintPrice__c, TotalPrice,
@@ -640,6 +659,23 @@
        '51个月' => 'fifty-one (51) monthss',
        '63个月' => 'sixty-three (63) months'
    };
    private static Map<String, String> QAapiMap1 = new Map<String, String> {
        '12个月' => '12个月',
        '15个月' => '15个月',
        '18个月' => '18个月',
        '21个月' => '21个月',
        '24个月' => '24个月',
        '27个月' => '27个月',
        '30个月' => '30个月',
        '33个月' => '33个月',
        '36个月' => '36个月',
        '48个月' => '48个月',
        '60个月' => '60个月',
        '39个月' => '39个月',
        '51个月' => '51个月',
        '63个月' => '63个月'
    };
    public class SetInfo {
        private Integer maxLine = 36;
@@ -803,6 +839,8 @@
        public String AllBills { get; private set; }
        public String QAeng { get; private set; }
        public String QAeng2 { get; private set; }
        public String QAeng3 { get; private set; }
        public String QAeng4 { get; private set; }
        public String ShippingTerms { get; private set; }
        public String pdf_c_consignee { get; private set; }
@@ -821,8 +859,10 @@
            } else if (o.PDF_Bi_AllBill__c == '不随货') {
                AllBills = 'not with';
            }
            QAeng = QAapiMap.get(o.PDF_QA__c);
            QAeng = QAapiMap1.get(o.PDF_QA__c);
            QAeng4 = QAapiMap1.get(o.PDF_QA2__c);
            QAeng2 = QAapiMap.get(o.PDF_QA2__c);
            QAeng3 = QAapiMap.get(o.PDF_QA__c);
            if (o.PDF_Sp_ShippingTerms__c == '海运') {
                ShippingTerms = 'by sea';
            } else if (o.PDF_Sp_ShippingTerms__c == '空运') {