黄千龙
2023-03-08 962519811b7c4be07f30d09e791798b0ea79d3ae
force-app/main/default/classes/NFM103Controller.cls
@@ -203,11 +203,12 @@
                    //XLIU-CGAD3Z 【委托】备品相关字段传输至SAP LY 20220714 end
                    
                    // 到达上限   修理单修改时  上限合同 by20230104 start
                    if ( rpr.ZFLAG_SX__c == true){
                    if ((rpr.ZFLAG_SX__c == true && oldMap.get(rpr.Id).ZFLAG_SX__c !=rpr.ZFLAG_SX__c && rpr.Agreed_Date__c!=null) ||
                        (rpr.ZFLAG_SX__c == false && oldMap.get(rpr.Id).ZFLAG_SX__c !=rpr.ZFLAG_SX__c && rpr.Agreed_Date__c==null) ){
                        if (NFM103Controller.NFM103_Ids.contains(rpr.Id) == false) {
                            NFM103_Ids.add(rpr.Id);
                            rprIds.add(rpr.Id);
                            updMap.put(rpr.Id, new Repair__c(Id = rpr.Id));
                            updMap.put(rpr.Id, new Repair__c(Id = rpr.Id,Address_type__c = 'X'));
                            NFM103Controller.debug_msg += 'NFM103_callout_update3_' + rpr.Name;
                        }
                    }
@@ -246,8 +247,9 @@
            // NFM103Controller.callout(iflog.Id, rprIds);
            String uid = UserInfo.getUserId();
            String BUid = System.Label.Batch_User_Id;
            String OLYid = System.Label.OlympusSystem_ID;
            System.debug('zheli');
            if (uid.substring(0,15) == BUid.substring(0,15)) {
            if (uid.substring(0,15) == BUid.substring(0,15) || uid.substring(0,15) == OLYid.substring(0,15)) {
                NFM103Controller.calloutNotfuture(iflog.Id, rprIds, null);
            }else{
                NFM103Controller.callout(iflog.Id, rprIds, null);
@@ -414,6 +416,7 @@
                                         ,Maintenance_Contract__r.Sum_repair_price_new__c
                                         ,Repair_Quotation_Id__r.Usage_Ratio_Price__c
                                         ,Maintenance_Contract__r.Remaining_Amount__c
                                         ,Maintenance_Contract__r.Limit_Price__c
                                         ,ZFLAG_CGSX__c
                                         ,ZFLAG_SX__c
                                         // 上限合同 by20230104 end
@@ -524,17 +527,18 @@
                        && rpr.FSE_ApplyForRepair_Day__c >= rpr.Contract_Start_Date__c && rpr.FSE_ApplyForRepair_Day__c <= rpr.Contract_End_Date__c) {
                    // 上限合同 by20230201 LY start 如果是上限合同才去判断是否“超过合同上限”和“到达上限”标识
                    if (rpr.Maintenance_Contract__r.Limit_Price__c == true){
                        // “超过合同上限”为true,不传合同信息,ZFLAG_CGSX传Y
                        if (rpr.ZFLAG_CGSX__c == true) {
                            element.ZFLAG_CGSX = 'Y';
                        }
                        //“到达上限”为true,传合同信息,ZFLAG_SX传Y
                        if (rpr.ZFLAG_SX__c == true) {
                            element.ZFLAG_SX = 'Y';
                        if (rpr.ZFLAG_CGSX__c == true) { // “超过合同上限”为true,不传合同信息,ZFLAG_CGSX传Y
                            element.ZFLAG_CGSX = 'X';
                        }else if (rpr.ZFLAG_SX__c == true) { //“到达上限”为true,传合同信息,ZFLAG_SX传Y
                            element.ZFLAG_SX = 'X';
                            element.RepairContractObject  = 'X';
                            element.RepairContractNumber  = rpr.Maintenance_Contract__r.Maintenance_Contract_No__c;
                        }else { //没超过合同上限也没达到上限 传合同信息 ZFLAG_CGSX传空 ZFLAG_SX传空
                            element.RepairContractObject  = 'X';
                            element.RepairContractNumber  = rpr.Maintenance_Contract__r.Maintenance_Contract_No__c;
                        }
                    }else {
                    }else { //不是上限合同 传合同信息
                        element.RepairContractObject  = 'X';
                        element.RepairContractNumber  = rpr.Maintenance_Contract__r.Maintenance_Contract_No__c;
                    }
@@ -845,11 +849,21 @@
            // エラーが発生した場合
            System.debug(Logginglevel.ERROR, 'NFM103_' + iflog.Name + ':' + ex.getMessage());
            System.debug(Logginglevel.ERROR, 'NFM103_' + iflog.Name + ':' + ex.getStackTraceString());
            logstr += ex.getMessage();
            iflog.ErrorLog__c += ex.getMessage() + '\n';
            iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
            //NFM105触发103接口 20230303 LY start
            // logstr += ex.getMessage();
            // iflog.ErrorLog__c += ex.getMessage() + '\n';
            // iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
                System.debug('标记0--------------------1:' + rowData.retry_cnt__c);
            // Callout from triggers are currently not supported.
            System.debug('NFM201jiekou'+ex.getMessage());
            if (!String.valueOf(ex.getMessage()).contains('Callout from triggers')) {
                logstr += ex.getMessage();
                iflog.ErrorLog__c += ex.getMessage() + '\n';
                iflog.ErrorLog__c += ex.getStackTraceString() + '\n';
            }
            //NFM105触发103接口 20230303 LY end
            //---Gaozw---add
            if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
            if (rowData.retry_cnt__c < batch_retry_max_cnt) {