buli
2022-03-11 02ddc35714cbd1688b7cb057f770f1410de79dab
force-app/main/default/classes/OFSInsReportLayoutController.cls
@@ -28,7 +28,7 @@
    private String oldHospital;
    private String oldStatus;
    private Boolean isPDF;
    public Boolean isPDF{get;private set;}
    private Boolean isUpDown;
    private Boolean isSubmit;
    public String alertMessage {
@@ -247,18 +247,23 @@
            oirSettingMap.put(oir.recordType_devName__c, oir);
        }
    }
    public string staticResource { get; private set; }
    //public boolean IsAddmessage { get; private set; }
    /**
    * Visaulforceから呼ばれるコンストラクタ
    */
    public OFSInsReportLayoutController(ApexPages.StandardController controller) {
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Inspection_Report__c'));
}
    public OFSInsReportLayoutController() {
        countorder = 1;
        nowAssetcount = 1;
        runCount = 0;
        isUpDown = true;
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Inspection_Report__c'));
    }
    // TODO 全部画面リフレッシュにする
@@ -335,7 +340,7 @@
                pReportId = iis[0].Inspection_ReportId__c;
            }
            List < Inspection_Report__c > queryIrs = [select Id, RecordType.DeveloperName, RecordType.Name, Name, Status__c, Inspection_StartTime__c, Inspection_EndTime__c from Inspection_Report__c where Id = :pReportId];
            List < Inspection_Report__c > queryIrs = [select Id, RecordType.DeveloperName, RecordType.Name, Name, Status__c, Inspection_StartTime__c, Inspection_EndTime__c,Responsible_Person_Encrypted__c,phone_Encrypted__c,AWS_Data_Id__c from Inspection_Report__c where Id = :pReportId];
            if (queryIrs.size() <= 0) {
                initFlag = false;
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '无法找到点检报告书'));
@@ -401,7 +406,7 @@
            }
        }
        this.settingSoql = 'select Id, Name, Name_Manual__c, Next_StartHour_Page__c, Next_StartMinute_Page__c, Next_EndHour_Page__c, Next_EndMinute_Page__c '
        this.settingSoql = 'select Id, Name, Name_Manual__c, Next_StartHour_Page__c, Next_StartMinute_Page__c, Next_EndHour_Page__c, Next_EndMinute_Page__c,Responsible_Person_Encrypted__c,phone_Encrypted__c,AWS_Data_Id__c '
        // fxk 2021/8/4 新加 Start
        + ' , Remarks__c, CleaningFluid__c,SterilizationMethod__c,Disinfectant__c,UsedMachine__c,Used_ET__c ,Mode__c';
        // fxk 2021/8/4 新加 End
@@ -785,14 +790,19 @@
            // }
        }
        if (isError) {
            system.debug('795'+ir.AWS_Data_Id__c);
            return null;
        }
        system.debug('798'+ir.AWS_Data_Id__c);
        //add by rentx 20210630
        if (timeCheck() != true) {
            system.debug('800');
            return null;
        }
        system.debug('804');
        if (isPDF) {
            ir.Status__c = 'PDF';
        }
@@ -801,6 +811,7 @@
            ir.Status__c = '填写完毕';
        }
        system.debug('813');
        Savepoint sp = Database.setSavepoint();
        try {
            // 部长经理总监
@@ -815,9 +826,11 @@
            OFSInsReportAssetHistoryController.upsertInspection_Report(ir);
        } catch(Exception e) {
            clearIrId(sp, e, isIrNew);
            system.debug('829');
            return null;
        }
        system.debug('832');
        // 日報からくる場合、保存時、EventCに書き戻す
        if (String.isBlank(pEventCId) == false) {
            try {
@@ -825,10 +838,11 @@
                update ec;
            } catch(Exception e) {
                clearIrId(sp, e, isIrNew);
                system.debug('840');
                return null;
            }
        }
        system.debug('844');
        //List<Inspection_Item__c> toUpsertAhs = new List<Inspection_Item__c>();
        List < Inspection_Item__c > toDeleteAhs = new List < Inspection_Item__c > ();
        List < Inspection_Item__c > manualDeleteAhs = new List < Inspection_Item__c > ();
@@ -868,14 +882,17 @@
        // SWAG-AREBA8 end
        toDeleteAhs = [select Id, AssetId__c from Inspection_Item__c where AssetId__c in :unCheckedAssetIds and Inspection_ReportId__c = :ir.Id];
        system.debug('884');
        try {
            if (manualDeleteAhs.size() > 0) toDeleteAhs.addAll(manualDeleteAhs);
            OFSInsReportAssetHistoryController.deleteInspection_Item(ir, toDeleteAhs);
        } catch(Exception e) {
            clearIrId(sp, e, isIrNew);
            system.debug('890');
            return null;
        }
        system.debug('894');
        try {
            //OFSInsReportAssetHistoryController.upsertInspection_Item(ir, toUpsertAhs);
            OFSInsReportAssetHistoryController.upsertInspection_Item(ir, new List < Inspection_Item__c > (toUpsertAhsMap.keySet()));
@@ -884,9 +901,11 @@
            for (Inspection_Item__c ah: toUpsertAhsMap.keySet()) {
                if (toUpsertAhsMap.get(ah).isNew == true) ah.Id = null;
            }
            system.debug('903');
            return null;
        }
        system.debug('905');
        saveOK = true;
        this.init();
        return null;
@@ -896,6 +915,7 @@
        if (isIrNew) ir.Id = null;
        Database.rollback(sp);
        ApexPages.addMessages(e);
        //IsAddmessage = true;
    }
    private Boolean checkHpChange() {