|  |  |  | 
|---|
|  |  |  | userWorkLocation = Useracc[0].Work_Location__c; | 
|---|
|  |  |  | coc = new Consumable_order__c(); | 
|---|
|  |  |  | // 获得订单一览 | 
|---|
|  |  |  | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe() | 
|---|
|  |  |  | .get('Consumable_order__c') | 
|---|
|  |  |  | .getDescribe() | 
|---|
|  |  |  | .fieldSets.getMap(); | 
|---|
|  |  |  | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); | 
|---|
|  |  |  | Schema.FieldSet fs = fsMap.get('order_view'); | 
|---|
|  |  |  | // 获得订单中的所有项目 | 
|---|
|  |  |  | List<FieldSetMember> fsmList = fs.getFields(); | 
|---|
|  |  |  | 
|---|
|  |  |  | List<CusCol> cols = new List<CusCol>(); | 
|---|
|  |  |  | for (FieldSetMember fsm : fsmList) { | 
|---|
|  |  |  | //add by Link | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | fsm.getFieldPath() == 'Order_ForHospital__c' && | 
|---|
|  |  |  | agencyProType == 'ET' | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if(fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType == 'ET'){ | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | CusCol col = new CusCol(); | 
|---|
|  |  |  | col.label = fsm.getLabel(); | 
|---|
|  |  |  | 
|---|
|  |  |  | cols.add(col); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //update by rentx 2020-12-22 start | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | fsm.getLabel() == '医院' && | 
|---|
|  |  |  | agencyProType != null && | 
|---|
|  |  |  | agencyProType == 'ET' | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | title.add(fsm.getLabel()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | fsm.getFieldPath() == 'Order_ForHospital__c' && | 
|---|
|  |  |  | agencyProType != null && | 
|---|
|  |  |  | agencyProType == 'ET' | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | column.add(fsm.getFieldPath()); | 
|---|
|  |  |  | columns.add(fsm.getFieldPath().split('\\.')); | 
|---|
|  |  |  | 
|---|
|  |  |  | for (String s : column) { | 
|---|
|  |  |  | soql += ',' + s; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | soql += | 
|---|
|  |  |  | ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + | 
|---|
|  |  |  | '订单' + | 
|---|
|  |  |  | '\''; | 
|---|
|  |  |  | soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '订单' + '\''; | 
|---|
|  |  |  | soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\''; | 
|---|
|  |  |  | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\''; | 
|---|
|  |  |  | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; | 
|---|
|  |  |  | soql += | 
|---|
|  |  |  | ' and Dealer_Info__c =\'' + | 
|---|
|  |  |  | accountid + | 
|---|
|  |  |  | '\' order by Order_status__c '; | 
|---|
|  |  |  | soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c '; | 
|---|
|  |  |  | System.debug('====soql====' + soql); | 
|---|
|  |  |  | raesList = Database.query(soql); | 
|---|
|  |  |  | //add by rentx 2021-3-10 start | 
|---|
|  |  |  | //为 hasHop 赋值 判断当前经销商下是否有特价医院 | 
|---|
|  |  |  | List<hospitalprice__c> hopList = [ | 
|---|
|  |  |  | SELECT id, hospital__c | 
|---|
|  |  |  | FROM hospitalprice__c | 
|---|
|  |  |  | WHERE account__c = :accountid | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid]; | 
|---|
|  |  |  | if (hopList == null || hopList.size() == 0) { | 
|---|
|  |  |  | hasHop = false; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Account> contractList = [ | 
|---|
|  |  |  | SELECT Id, Name, RecordType.DeveloperName | 
|---|
|  |  |  | FROM Account | 
|---|
|  |  |  | WHERE | 
|---|
|  |  |  | RecordType.DeveloperName = 'AgencyContract' | 
|---|
|  |  |  | AND Contact_Type__c LIKE :agencyProType | 
|---|
|  |  |  | AND Agent_Ref__c = :accountid | 
|---|
|  |  |  | WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<Id> dealIds = new List<Id>(); | 
|---|
|  |  |  | if (contractList != null && contractList.size() > 0) { | 
|---|
|  |  |  | for (Account acc : contractList) { | 
|---|
|  |  |  | dealIds.add(acc.Id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Dealer_Product__c> deList = [ | 
|---|
|  |  |  | SELECT id | 
|---|
|  |  |  | FROM Dealer_Product__c | 
|---|
|  |  |  | WHERE Dealer_Contact__c IN :dealIds | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds]; | 
|---|
|  |  |  | if (deList == null || deList.size() == 0) { | 
|---|
|  |  |  | hasSpecial = false; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | Date cate2 = coc.Order_date__c; | 
|---|
|  |  |  | String cate3 = coc.Order_status__c; | 
|---|
|  |  |  | // 获得订单一览 | 
|---|
|  |  |  | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe() | 
|---|
|  |  |  | .get('Consumable_order__c') | 
|---|
|  |  |  | .getDescribe() | 
|---|
|  |  |  | .fieldSets.getMap(); | 
|---|
|  |  |  | Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap(); | 
|---|
|  |  |  | Schema.FieldSet fs = fsMap.get('order_view'); | 
|---|
|  |  |  | // 获得订单中的所有项目 | 
|---|
|  |  |  | List<FieldSetMember> fsmList = fs.getFields(); | 
|---|
|  |  |  | 
|---|
|  |  |  | columns = new List<List<String>>(); | 
|---|
|  |  |  | for (FieldSetMember fsm : fsmList) { | 
|---|
|  |  |  | //update by rentx 2020-12-22 start | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | fsm.getLabel() == '医院' && | 
|---|
|  |  |  | agencyProType != null && | 
|---|
|  |  |  | agencyProType == 'ET' | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (fsm.getLabel() == '医院' && agencyProType != null && agencyProType == 'ET') { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | title.add(fsm.getLabel()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ( | 
|---|
|  |  |  | fsm.getFieldPath() == 'Order_ForHospital__c' && | 
|---|
|  |  |  | agencyProType != null && | 
|---|
|  |  |  | agencyProType == 'ET' | 
|---|
|  |  |  | ) { | 
|---|
|  |  |  | if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') { | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | column.add(fsm.getFieldPath()); | 
|---|
|  |  |  | columns.add(fsm.getFieldPath().split('\\.')); | 
|---|
|  |  |  | 
|---|
|  |  |  | soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' '; | 
|---|
|  |  |  | soql += ' and Order_ProType__c =\'' + agencyProType + '\' '; | 
|---|
|  |  |  | if (!String.isBlank(category1)) { | 
|---|
|  |  |  | soql += | 
|---|
|  |  |  | ' and Name like \'%' + | 
|---|
|  |  |  | String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + | 
|---|
|  |  |  | '%\' '; | 
|---|
|  |  |  | soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' '; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (cate2 != null) { | 
|---|
|  |  |  | soql += ' and Order_date__c = :cate2'; | 
|---|