黄千龙
2023-03-08 962519811b7c4be07f30d09e791798b0ea79d3ae
force-app/main/default/classes/StraightBackAddressController.cls
@@ -145,6 +145,12 @@
                    }
                }else if('返送办事处'.equals(pc.Returns_Product_way__c)){
                    optionAddressClassification.Address_Classification__c = '办事处';
                //
                }else if ('备品中心'.equals(pc.Returns_Product_way__c)) {
                    optionAddressClassification.Address_Classification__c = '备品';
                //
                }else{
                    //获取当前修理的返送经销商
                    if(!String.isBlank(pc.Dealer__c) && '返送经销商'.equals(pc.Returns_Product_way__c)){
@@ -349,18 +355,19 @@
                    tableData.add(new AddressData(accoutList[0],'none','inline','none','医院'));
                }
            }
            //办事处
            /*if('办事处'.equals(typeText)){
                String AccountOfficeSql = makeTextAccOfficeSql();
                //获取地址信息
                List<Account> accDataList = Database.query(AccountOfficeSql);
                if(accDataList != null && accDataList.size() > 0){
                    for(Integer i = 0;i<accDataList.size();i++){
                        indexCou++;
                        tableData.add(new AddressData(accDataList[i],'none','办事处'));
                    }
                }
            }*/
            // //备品:
            // if(('备品'.equals(typeText))){
            //     //HP_ID__c  医院id
            //     typeSearchId = pc.HP_ID__c;
            //     String AccountSql = makeTextAccountSql(pc.HP_ID__c);
            //     //获取地址信息
            //     List<Account> accoutList = Database.query(AccountSql);
            //     if(accoutList != null && accoutList.size() > 0){
            //         indexCou++;
            //         tableData.add(new AddressData(accoutList[0],'none','inline','none','备品'));
            //     }
            // }
            //经销商:
            //1:如果查到多条经销商,并且在地址中查到有数据,只显示地址数据,如果地址数据没查不到,就不显示,
            //2:如果查到有一条经销商,那么第一行就是此经销商数据,从第二行开始为地址数据
@@ -391,7 +398,9 @@
                    
                    if(dataList[i].Address_Classification__c == '办事处'){
                        tableData.add(new AddressData(dataList[i],'none','none','inline'));
                    }else{
                    }else if (dataList[i].Address_Classification__c == '备品'){
                        tableData.add(new AddressData(dataList[i],'none','none','inline'));
                    } else{
                        //只能改自己创建的地址数据,系统管理员、GPI_系统管理员New 没限制
                        if(loginPerson == createId ||loginPerson == '00e10000000dzzG' ||loginPerson == '00e10000000Y3o5'){
                            tableData.add(new AddressData(dataList[i],'inline','inline','inline'));
@@ -601,11 +610,34 @@
    //查询修理表数据
    private String makeTextRepairSql(String uuid){
        String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c,AWS_Data_Id__c FROM Repair__c where id = \''+RepairId+'\'';
        String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c,AWS_Data_Id__c,Incharge_Staff__r.UserRole.name,Incharge_Staff__r.Branch__c,Incharge_Staff__r.Profile.name FROM Repair__c where id = \''+RepairId+'\'';
        return RepairSql;
    }
    //查询地址表数据
    private String makeTextAddressSql(String typeSearchId) {
        // DB202212270703 备品修理直返地址项目导入 start
        String beipCenter = '';
        if (pc.Returns_Product_way__c == '备品中心') {
            if (pc.Incharge_Staff__r.Profile.name.startsWith('2B2')) {
                if (pc.Incharge_Staff__r.Branch__c == '北京') {
                    beipCenter = '北京备品中心';
                }else if (pc.Incharge_Staff__r.Branch__c == '上海') {
                    beipCenter = '华东备品中心';
                }else if (pc.Incharge_Staff__r.Branch__c == '广州') {
                    beipCenter = '广州备品中心';
                }
            }else if (pc.Incharge_Staff__r.UserRole.name == 'CTEC教育本部') {
                if (pc.Incharge_Staff__r.Branch__c == '北京') {
                    beipCenter = '北京C-TEC';
                }else if (pc.Incharge_Staff__r.Branch__c == '上海') {
                    beipCenter = '上海C-TEC';
                }else if (pc.Incharge_Staff__r.Branch__c == '广州') {
                    beipCenter = '广州C-TEC';
                }
            }
        }
        // DB202212270703 备品修理直返地址项目导入 end
        // WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 start 
        // String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,ContactName__c,Telephone__c,ContactName_Encrypted__c' //zhj 新方案改造 去除Encrypted__c 2022-12-05
        //                 +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c'
@@ -627,6 +659,12 @@
            if('办事处'.equals(typeText)){
                AddressSql += ' and Address_Classification__c LIKE \'%' + typeText.trim() + '%\'' ;
            }
            if('备品'.equals(typeText)){
                AddressSql += ' and Address_Classification__c LIKE \'%' + typeText.trim() + '%\'' ;
                // if (String.isNotBlank(beipCenter)) {
                //     AddressSql += ' and Beipin_Center__c = \'' + String.escapeSingleQuotes(beipCenter) +'\'' ;
                // }
            }
            if('经销商'.equals(typeText)){
                if(String.isBlank(typeSearchId)){
                    AddressSql += ' and Address_Classification__c LIKE \'%' + typeText.trim() + '%\'' ;