zhangzhengmei
2023-04-17 fdef1f682351a5311fe96c5f0f1770a9623b985f
force-app/main/default/classes/QISReportController.cls
@@ -350,7 +350,6 @@
        }
         return re;
    }
    //OCSM不要报告
    @AuraEnabled
    public static InitData initForlexOCSMNoToReportLightingButton (String recordId){
@@ -413,6 +412,7 @@
        }
         return re;
    }
    //发送QIS到SPO
    @AuraEnabled
    public static InitData initForlexSendQISButton (String recordId){
@@ -502,6 +502,243 @@
        }
         return re;
    }
    // QIS市场部意见
    @AuraEnabled
    public static InitData initForlexQISSCButton (String recordId){
        InitData res = new initData();
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
        try{
            QIS_Report__c report = [SELECT  id,name,QIS_SC_Report__c,QIS_SC_Id__c,next_action__c,QIS_Market_Category__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.name = report.name;
            res.profileName = userinfo.Profile.name;
            res.qISSCId = report.QIS_SC_Id__c;
            res.qISSCReport = report.QIS_SC_Report__c;
            res.nextaction = report.next_action__c;
            res.qISMarketCategory = report.QIS_Market_Category__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
     // 新建修理
    @AuraEnabled
    public static InitData initForlexCreateRepairButton (String recordId){
        InitData res = new initData();
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,RepairSalesPoint_Province_China__c FROM User WHERE Id = :myUserID LIMIT 1];
        QIS_Report__c report = [SELECT  id,Owner.name,FailureQInHospital__c,InformationFrom__c,Delay15Min__c,
                                AfterFailureInformation__c,Set_usage_product__c,BreakORFallOff__c,Opera_Name__c,
                                Which_Project__c,Report_For_Goz__c,Relation_With_The_Problem__c,Damage_For_Doc_Or_Pat__c,
                                Trable_occur_daY_collect__c,source_for_repair__c,Faliour_date__c,OwnerId,nonyushohin__c,nonyushohin__r.name,
                                Hospital_Department__c,Hospital_Department__r.name,Department_Class__c,Department_Class__r.name,Hospital__c,Hospital__r.name,name,Source_OnCall__c,Source_OnCall__r.name,
                                failuer_situation__c,Comment__c,Is_Used_For_The_Opera__c,RecordType_ID__c,
                                OCM_judgement__c,next_action__c,Special_follow__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
        Account acc = [SELECT id,ParentId,Parent.RecordTypeId,
                        Parent.Parent.FSE_GI_Main_Leader__c,Parent.Parent.FSE_SP_Main_Leader__c,
                        Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c,
                        Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Account WHERE id = :report.Hospital_Department__c limit 1];
        try{
            res.Id = report.Id;
            res.qisRecordTypeId = report.RecordType_ID__c;
            res.oCMjudgement = report.OCM_judgement__c;
            res.nextaction = report.next_action__c;
            res.comment = report.Comment__c;
            res.sourceOnCall = report.Source_OnCall__c;
            res.sourceOnCallname = report.Source_OnCall__r.name;
            res.name = report.name;
            res.hospitalId = report.Hospital__c;
            res.hospitalname = report.Hospital__r.name;
            res.departmentClassId = report.Department_Class__c;
            res.departmentClassname = report.Department_Class__r.name;
            res.hospitalDepartment = report.Hospital_Department__c;
            res.hospitalDepartmentname = report.Hospital_Department__r.name;
            res.nonyushohinId = report.nonyushohin__c;
            res.nonyushohinIdname = report.nonyushohin__r.name;
            res.ownerId = report.OwnerId;
            res.faliourdate = report.Faliour_date__c;
            res.sourceforrepair = report.source_for_repair__c;
            res.repairSalesPointProvinceChina = userinfo.RepairSalesPoint_Province_China__c;
            res.trableoccurdaYcollect = report.Trable_occur_daY_collect__c;
            res.damageForDocOrPat = report.Damage_For_Doc_Or_Pat__c;
            res.relationWithTheProblem = report.Relation_With_The_Problem__c;
            res.reportForGoz = report.Report_For_Goz__c;
            res.whichProject = report.Which_Project__c;
            res.operaName = report.Opera_Name__c;
            res.breakORFallOff = report.BreakORFallOff__c;
            res.setusageproduct = report.Set_usage_product__c;
            res.afterFailureInformation = report.AfterFailureInformation__c;
            res.delay15Min = report.Delay15Min__c;
            res.informationFrom = report.InformationFrom__c;
            res.failureQInHospital = report.FailureQInHospital__c;
            res.ownername = report.Owner.name;
            res.failuerSituation = report.failuer_situation__c;
            res.isUsedForTheOpera = report.Is_Used_For_The_Opera__c;
            res.specialfollow = report.Special_follow__c;
            res.accParentId = acc.ParentId;
            res.accParentRecordTypeId = acc.Parent.RecordTypeId;
            res.accParentParentFSEGIMainLeader = acc.Parent.Parent.FSE_GI_Main_Leader__c;
            res.accParentParentFSEGIMainLeaderWorkLocation = acc.Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c;
            res.accParentParentFSESPMainLeader = acc.Parent.Parent.FSE_SP_Main_Leader__c;
            res.accParentParentFSESPMainLeaderWorkLocation = acc.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
     // PDF(QIS申请书)
    @AuraEnabled
    public static InitData initForlexPDFQISrequestButton (String recordId){
        InitData res = new initData();
        try{
            QIS_Report__c report = [SELECT  id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    // OCSM服务本部检测完毕
    @AuraEnabled
    public static InitData initForlexRCinspectioncompletedateButton (String recordId){
        InitData res = new initData();
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
        try{
            QIS_Report__c report = [SELECT  id ,RC_inspection_date__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.rCinspectionDate = report.RC_inspection_date__c;
            res.QIStatus = report.QIS_Status__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static String updateQisForRCinspectioncompletedate (String recordId){
        String re = '成功';
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,Alias FROM User WHERE Id = :myUserID LIMIT 1];
        try{
                QIS_Report__c rac  = new QIS_Report__c();
                rac.id = recordId;
                rac.RC_inspection_date__c  = Date.today();
                rac.RC__c = myUserID;
                rac.RC_Inspection_staff__c  = userinfo.Alias;
                update rac;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            re = e.getMessage();
        }
         return re;
    }
    // OSH检查受理
    @AuraEnabled
    public static InitData initForlexOSHInspectButton (String recordId){
        InitData res = new initData();
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
        try{
            QIS_Report__c report = [SELECT  id ,OSHInspectionDate__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.oSHInspectionDate = report.OSHInspectionDate__c;
            res.QIStatus = report.QIS_Status__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static String updateQisForlexOSHInspect (String recordId){
        String re = '成功';
        try{
                QIS_Report__c rac  = new QIS_Report__c();
                rac.id = recordId;
                rac.OSHInspectionDate__c   = Date.today();
                update rac;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            re = e.getMessage();
        }
         return re;
    }
     //     复制1
   @AuraEnabled
    public static InitData initForlexcopyQISButton (String recordId){
        InitData res = new initData();
        try{
            QIS_Report__c report = [SELECT  id,Name,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.name = report.Name;
            res.qIStatus = report.QIS_Status__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
     // OCSM无实物送达
    @AuraEnabled
    public static InitData initForlexOCSMNogoodsButton (String recordId){
        InitData res = new initData();
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
        try{
            QIS_Report__c report = [SELECT  id ,QIS_Status__c,isAE_Profile__c,is_CNBuy__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
            res.Id = report.Id;
            res.isAEProfile = report.isAE_Profile__c;
            res.QIStatus = report.QIS_Status__c;
            res.isCNBuy = report.is_CNBuy__c;
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static String updatelexOCSMNogoods (String recordId){
        String re = '成功';
        ID myUserID = UserInfo.getUserId();
        User userinfo = [SELECT Id,Alias__c,Alias, BuchangApprovalManagerSales__c,JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID LIMIT 1];
        try{
                QIS_Report__c rac  = new QIS_Report__c();
                rac.id = recordId;
                rac.QIS_Status__c   = 'RC检测中';
                rac.OCM_RC_RecievedDate__c    = Date.today();
                rac.RC__c = myUserID;
                if (userinfo != null) {
                    rac.RC_Receive_staff__c   = userinfo.Alias;
                }
                if (userinfo != null && userinfo.BuchangApprovalManagerSales__c !=null) {
                    rac.RC_Manager__c  = userinfo.BuchangApprovalManagerSales__c;
                }else{
                    rac.RC_Manager__c = myUserID;
                }
                rac.CDS_date__c    = Date.today();
                rac.RC_CDS_staff__c   = userinfo.Alias__c;
                rac.OCSM_Nogoods__c   = true;
                update rac;
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            re = e.getMessage();
        }
         return re;
    }
    public class InitData{
        @AuraEnabled
        public String Id;
@@ -512,7 +749,75 @@
        @AuraEnabled
        public String qISSCId;
        @AuraEnabled
        public String accParentId;
        @AuraEnabled
        public String accParentRecordTypeId;
        @AuraEnabled
        public String accParentParentFSEGIMainLeader;
        @AuraEnabled
        public String accParentParentFSEGIMainLeaderWorkLocation;
        @AuraEnabled
        public String accParentParentFSESPMainLeader;
        @AuraEnabled
        public String accParentParentFSESPMainLeaderWorkLocation;
        @AuraEnabled
        public String oCMjudgement;
        @AuraEnabled
        public String comment;
        @AuraEnabled
        public String isUsedForTheOpera;
        @AuraEnabled
        public String failuerSituation;
        @AuraEnabled
        public String sourceOnCall;
        @AuraEnabled
        public String sourceOnCallname;
        @AuraEnabled
        public String hospitalId;
        @AuraEnabled
        public String hospitalname;
        @AuraEnabled
        public String departmentClassId;
        @AuraEnabled
        public String departmentClassname;
        @AuraEnabled
        public String hospitalDepartment;
        @AuraEnabled
        public String hospitalDepartmentname;
        @AuraEnabled
        public String nonyushohinId;
        @AuraEnabled
        public String nonyushohinIdname;
        @AuraEnabled
        public String sourceforrepair;
        @AuraEnabled
        public String repairSalesPointProvinceChina;
        @AuraEnabled
        public String damageForDocOrPat;
        @AuraEnabled
        public String relationWithTheProblem;
        @AuraEnabled
        public String reportForGoz;
        @AuraEnabled
        public String whichProject;
        @AuraEnabled
        public String operaName;
        @AuraEnabled
        public String breakORFallOff;
        @AuraEnabled
        public String setusageproduct;
        @AuraEnabled
        public String afterFailureInformation;
        @AuraEnabled
        public String delay15Min;
        @AuraEnabled
        public String informationFrom;
        @AuraEnabled
        public String failureQInHospital;
        @AuraEnabled
        public String ownerId;
        @AuraEnabled
        public String ownername;
        @AuraEnabled
        public String qisRecordTypeId;
        @AuraEnabled
@@ -556,6 +861,10 @@
        @AuraEnabled
        public Date oSHInspectionDate;
        @AuraEnabled
        public Date faliourdate;
        @AuraEnabled
        public Date trableoccurdaYcollect;
        @AuraEnabled
        public Date cdsdate;
        @AuraEnabled
        public Date awaredate;
@@ -567,6 +876,9 @@
        public Boolean isaohuiproduct;
        @AuraEnabled
        public Boolean isSendQIS;
        @AuraEnabled
        public Boolean specialfollow;
    }
}