buli
2022-04-26 5835379ec30b1667c4e522db9d294c9b7bb8633a
force-app/main/default/classes/OrderPdf2Controller.cls
@@ -20,6 +20,7 @@
    public String strToday { get; set; }
    public boolean is_parts_direct { get; set; }
    public boolean is_ie_direct { get; set; }
    //public String approveStatus { get; set; }
    public Integer pageCnt { get; set; }
    public boolean fistPageBreak { get; set; }
@@ -30,12 +31,12 @@
    private Integer eachCnt = 48;
    private Integer lastMaxCnt = 35;
    private Integer iRfirstCnt = 6;
    private Integer iRfirstCnt = 9;
    private Integer iRfirstMaxCnt = 23;
    private Integer iReachCnt = 48;
    private Integer iRlastMaxCnt = 30;
    private Integer nAfirstCnt = 6;
    private Integer nAfirstCnt = 9;
    private Integer nAfirstMaxCnt = 23;
    private Integer nAeachCnt = 48;
    private Integer nAlastMaxCnt = 30;
@@ -63,6 +64,11 @@
    public String ndt_fax{get;set;}
    public Boolean notSpecialDealer { get; set; }
    public String staticResource { get;private set; }
    //4月11号之后
    //public Boolean fourMaand { get; set; }
    //发货月
    public Boolean delivered { get; set; }
    public OrderPdf2Controller() {
        id = ApexPages.currentPage().getParameters().get('id');
@@ -77,6 +83,8 @@
        Date today = Date.today();
        strToday = today.format();
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// 20220222 PI改造 by Bright
    }
    public PageReference init() {
@@ -103,10 +111,11 @@
        List<Order> orderList = [select Id, AccountId, OpportunityId, Opportunity.Dealer__c, Opportunity.SpecialDeliveryAddress__c, Opportunity.SpecialDeliveryContact__c,Opportunity.InquiryNumber__c,
                                        PDF_S_Name__c, PDF_S_Address__c, PDF_S_City__c, PDF_S_Province__c, PDF_S_Phone__c,Opportunity.CreatedBy.ContactId,CreatedBy.ContactId,
                                        Name, Opportunity.ExpectedDeliveryDate__c, PDF_Sap_No__c, OrderNumber, Opportunity.SubDealer__c,
                                        PDF_Property__c, Opportunity.Name, PDF_No__c, Description, PDF_Order_No__c,CrossCooperativeProject__c,Dealer_A__c,
                                        PDF_Property__c, Opportunity.Name, PDF_No__c, Description, PDF_Order_No__c,CrossCooperativeProject__c,
                                        Olympus_Price_BeforeDiscount_D__c, Discount_D__c, OlympusContractPricesD__c, CustomerContractPriceD__c,
                                        Opportunity.ProductSegment__c, Opportunity.SalesChannel__c, Opportunity.Machine_Parts__c,
                                        SpecialDeliveryAccount__c, SpecialDeliveryAccount_D__c, SpecialDeliveryContact2__c, SpecialDeliveryContact2_D__c
                                        AWS_Data_Id__c, // 20220222 PI改造 by Bright
                                        SpecialDeliveryAccount__c, SpecialDeliveryAccount_D__c, SpecialDeliveryContact2__c, SpecialDeliveryContact2_D__c,Opportunity.DeliveryDate__c
                                   from Order where Id = :id];
        if (orderList.size() == 0) {
            return null;
@@ -116,6 +125,18 @@
        productSegment = order.Opportunity.ProductSegment__c;
        is_parts_direct = false;
        is_ie_direct = false;
        //gwy 4月11号新公司还没有二级备案证
        delivered = false;
        Date deliveryM = order.Opportunity.DeliveryDate__c;
        Date isDelivery = Date.newInstance(2022, 4, 11);
        if (deliveryM <> null) {
            delivered = deliveryM >= isDelivery ? false : true;
        }
        /*approveStatus = order.ApproveStatus__c;
        Datetime date2 = order.CreatedDate;
        Datetime date3 = Datetime.newInstance(2022,4,11,0,0,0);
        fourMaand = date2>date3 ? true:false;*/
        //还剩下有了新的二级备案证的代码
        if (order.Opportunity.ProductSegment__c == 'IE' && order.Opportunity.SalesChannel__c == 'direct') {
            is_ie_direct = true;
        }
@@ -132,12 +153,12 @@
        }*/
        buyer = new Account();
        if (order.Opportunity.Dealer__c != null) {
             if (order.CrossCooperativeProject__c) {
             /*if (order.CrossCooperativeProject__c) {
                buyer = [select Id, Name, Address1__c,Business_license__c, City__c, Province__c, Phone from Account where Id = :order.Dealer_A__c];
            }else{
                buyer = [select Id, Name, Address1__c,Business_license__c, City__c, Province__c, Phone from Account where Id = :order.Opportunity.Dealer__c];
            }
            //buyer = [select Id, Name, Address1__c,Business_license__c, City__c, Province__c, Phone from Account where Id = :order.Opportunity.Dealer__c];
            }*/
            buyer = [select Id, Name, Address1__c,Business_license__c, City__c, Province__c, Phone from Account where Id = :order.Opportunity.Dealer__c];
        }
        notSpecialDealer = !StaticParameter.specialDealerMap.containsKey(((String)order.Opportunity.Dealer__c));
        system.debug('order.Opportunity.Dealer__c' + order.Opportunity.Dealer__c);
@@ -157,7 +178,9 @@
        delivery_contact = new Contact();
        if (order.SpecialDeliveryContact2_D__c != null) {
            delivery_contact = [select Id, Department, Name, Phone, MobilePhone,Address1__c from Contact where Id = :order.SpecialDeliveryContact2_D__c];
            delivery_contact = [select Id, Department, Name, Phone, MobilePhone,
            AWS_Data_Id__c, // 20220222 PI改造 by Bright
            Address1__c from Contact where Id = :order.SpecialDeliveryContact2_D__c];
        }
        user = new Account();
@@ -175,7 +198,9 @@
        }
        contact = new Contact();
        if (contactid != null && contactid.length() > 0) {
            contact = [select Id, Department, Name, Phone, MobilePhone,Fax,Email from Contact where Id = :contactid];
            contact = [select Id, Department, Name, Phone, MobilePhone,Fax,
            AWS_Data_Id__c, // 20220222 PI改造 by Bright
            Email from Contact where Id = :contactid];
        }
        List<OrderItem> oiList = [select Id, PriceBookEntry.Product2.ProductCode, PriceBookEntry.Product2.Product_ECCode__c,PriceBookEntry.Product2.Name,PriceBookEntry.Product2.registrationCode__c,
@@ -579,11 +604,11 @@
        seller_province1 = '北京';
        seller_phone1 = '010-58199000';
        seller_name2 = '奥林巴斯(北京)销售服务有限公司上海分公司';
        seller_address2 = '上海市徐汇区淮海中路1010号1001-1006、1101、1102、1104-1106、1601室';
        seller_name2 = '仪景通光学科技(上海)有限公司';
        seller_address2 = '中国(上海)自由贸易试验区日樱北路199-9号102及302部位';
        seller_city2 = '上海';
        seller_province2 = '上海';
        seller_phone2 = '021-51582084';
        seller_phone2 = '021-58881300';
        header = new HeaderInfo();
        inputDetails = new List<DetailInfo>();
@@ -594,6 +619,7 @@
                                        Name, Opportunity.ExpectedDeliveryDate__c, PDF_Sap_No__c, OrderNumber, Opportunity.SubDealer__c,
                                        PDF_Property__c, Opportunity.Name, PDF_No__c, Description, PDF_Order_No__c,
                                        Olympus_Price_BeforeDiscount_D__c, Discount_D__c, OlympusContractPricesD__c, CustomerContractPriceD__c,
                                        AWS_Data_Id__c, // 20220222 PI改造 by Bright
                                        Opportunity.ProductSegment__c
                                   from Order where Id = :id];
        if (orderList.size() == 0) {
@@ -740,6 +766,7 @@
        public String delivery_user { get; set; }
        public String delivery_phone { get; set; }
        public String delivery_tel { get; set; }
        public String delivery_aws_data_id { get; set; }// 20220222 PI改造 by Bright
        // 最终用户信息
        public String user_name { get; set; }
        public String user_no { get; set; }
@@ -755,6 +782,7 @@
        public String user_property_IE { get; set; }
        public String user_product_IE { get; set; }
        public String user_market_RVI { get; set; }
        public String user_aws_data_id { get; set; }// 20220222 PI改造 by Bright
        // 订单信息2
        public Decimal order_subtotal { get; set; }
        public Decimal order_discount_rate { get; set; }
@@ -802,6 +830,7 @@
            delivery_user = delivery_contact.Name;
            delivery_phone = delivery_contact.Phone;
            delivery_tel = delivery_contact.MobilePhone;
            delivery_aws_data_id = delivery_contact.AWS_Data_Id__c;// 20220222 PI改造 by Bright
            user_name = user.Name;
            user_no = user.ManagementCode_F__c;
@@ -814,6 +843,7 @@
            user_fax = contact.Fax;
            user_email = Contact.Email;
            user_tel = contact.MobilePhone;
            user_aws_data_id = contact.AWS_Data_Id__c;// 20220222 PI改造 by Bright
            user_property_IE = order.PDF_Property__c;
            user_product_IE = user.Sub_Use__c == 'Automotive' ? '汽车' : user.Sub_Use__c;
            user_market_RVI = user.Sub_Use__c;