黄千龙
2022-04-08 01f207d979d6be17c8cdec293feab48828c0ec3e
force-app/main/default/classes/RetrospectiveWeeklyReportController.cls
@@ -6,7 +6,7 @@
    @AuraEnabled public List<Map<String,String>> doctorList{get;set;}
    @AuraEnabled public String UserProType{get;set;}
    @AuraEnabled public Map<String,Agency_Report__c> AgencyReportMap{get;set;}
    @AuraEnabled public Map<String,string> PIConfig{get;set;}
    
    public RetrospectiveWeeklyReportController() {
    }
@@ -101,6 +101,9 @@
        // 見出し設定
        this.fieldsMap = new Map<String,String>();
        this.fieldsMap = this.getfiledsmap();
        this.PIConfig = new Map<String,string>();
        this.PIConfig.put('staticResourceAgencyContact', JSON.serialize(PIHelper.getPIIntegrationInfo('Agency_Contact__c')));
    }
    
    
@@ -274,7 +277,9 @@
        ret.add(space);
        
        Agency_Hospital_Link__c ahl = [select Hospital__c from Agency_Hospital_Link__c where id = :hospital_id];
        List<Agency_Contact__c> doctor_list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c
        List<Agency_Contact__c> doctor_list = [select id,Name,Doctor_Division1__c,
                                               AWS_Data_Id__c,// PI改造 By Bright 20220328
                                               Type__c,Agency_Hospital__c
            FROM Agency_Contact__c WHERE Hospital_ID18__c=:ahl.Hospital__c order by Name];
        for (Agency_Contact__c row : doctor_list)
        {
@@ -283,6 +288,7 @@
            tmp.put('value', row.Id);
            tmp.put('selected', 'false');
            tmp.put('Doctor_Division1__c', row.Doctor_Division1__c);
            tmp.put('AWS_Data_Id__c', row.AWS_Data_Id__c);// PI改造 By Bright 20220328
            ret.add(tmp);
        }
        return ret;
@@ -297,6 +303,8 @@
                                                String UseProduct1, String UseProduct2, String UseProduct3,
                                                String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date)
    {
        Department_Cateogy = GetDepartment_Cateogy(Department_Cateogy);
        system.debug('Department_Cateogy+++'+Department_Cateogy);
        Agency_Report__c agency_report = makeAgencyReport(Department_Cateogy,ConsumptionOfConsumables,
        WorkMark,warlocksNumber,DealerPersonnel,ProductCcategory,productCategories,WarlockClassification,ProductClassification, WorkRecord,
        EffectProgress,Agency_Report_Header,
@@ -370,12 +378,17 @@
    //新建方法
    public static Agency_Report__c insertAgencyReport(Agency_Report__c data) {
        if (String.isBlank(data.Hospital__c)) {
            system.debug('data.Agency_Hospital__c+++'+data.Agency_Hospital__c);
            List<Agency_Hospital_Link__c> agency_hospital_link = [select Id, Hospital__c from Agency_Hospital_Link__c where Id=:data.Agency_Hospital__c];
            system.debug('agency_hospital_link+++'+agency_hospital_link);
            data.Hospital__c = agency_hospital_link[0].Hospital__c;
        }
        if (String.isBlank(data.Department_Class__c)) {
            system.debug('data.Department_Cateogy__c+++'+data.Department_Cateogy__c);
            String record_type_id = LightningUtil.getRecordTypeId(data.Department_Cateogy__c);
            system.debug('RecordTypeId+++'+record_type_id);
            List<Account> account = [select Id, RecordTypeId from account where Hospital_Department_Class__c=:data.Hospital__c and RecordTypeId=:record_type_id];
            system.debug('account+++'+account);
            data.Department_Class__c = account[0].Id;
        }
        User userPro = LightningUtil.loginUserId();