111
沙世明
2022-11-22 928399eceec50e3d37ea08669a12789a9410a9d2
force-app/main/default/classes/LostCancelReportHandler.cls
@@ -177,7 +177,15 @@
        }// 20220720 ljh update
        //20220708 询价任务开发,结束失单任务状态,筛选需要的修改的失单任务 end
        List<PCLLostProduct__c> lcrList=[select id,PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c,PCLLostBrand__r.Lost_Reason_Sub__c,PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c,PCLLostBrand__r.Lost_cancel_report__r.LostType__c,PCLLostBrand__r.Lost_By_Company__c,PCLLostBrand__r.Lost_By_Company_Mannual__c,PCLLostBrand__r.LostPrice__c,LostProduct__r.Name, PCLLostBrand__r.Lost_reason_main__c,PCLLostBrand__r.Agency__r.Name,PCLLostBrand__r.AgencyMannual__c,PCLLostBrand__r.Lost_cancel_report__r.Opportunity__r.Name,Opportunity__c, LostProductMannual__c from PCLLostProduct__c where PCLLostBrand__r.Lost_cancel_report__c in : arrMap.keyset()];
        List<PCLLostProduct__c> lcrList=[select id,PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c,
                                        PCLLostBrand__r.Lost_Reason_Sub__c,PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c,
                                        PCLLostBrand__r.Lost_cancel_report__r.LostType__c,PCLLostBrand__r.Lost_By_Company__c,
                                        PCLLostBrand__r.Lost_By_Company_Mannual__c,PCLLostBrand__r.LostPrice__c,LostProduct__r.Name,
                                        PCLLostBrand__r.Lost_reason_main__c,PCLLostBrand__r.Agency__r.Name,PCLLostBrand__r.AgencyMannual__c,
                                        PCLLostBrand__r.Lost_cancel_report__r.Opportunity__r.Name,Opportunity__c, LostProductMannual__c
                                        ,ProductClass__c, Quantity__c   //20220930  lt SWAG-CHL5XA【FY23询价改善】-统计主机台数
                                        from PCLLostProduct__c
                                        where PCLLostBrand__r.Lost_cancel_report__c in : arrMap.keyset()];
        List<Opportunity> oppList=new List<Opportunity>();
        for (String lcro : arrMap.keyset()) {
            // 给产品赋值
@@ -188,10 +196,27 @@
            // List<String> yyList=new List<String>();     //失单原因
            //初始化
            Opportunity opp=new Opportunity();
            //20220930  lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start
            opp.RivalHostsNumber__c = 0;
            System.debug('lt123初始失单主机数'+ opp.RivalHostsNumber__c);
            //20220930  lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end
            opp.Id=arrMap.get(lcro).Opportunity__c; opp.PCLLostBrands__c=''; opp.Agencies__c='';    //Id ,品牌,经销商
            // for产品
            for (PCLLostProduct__c lcr : lcrList) {
                System.debug('lt123主机111'+ lcr.ProductClass__c);
                if (opp.Id==lcr.Opportunity__c) {
                    //20220930  lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start
                    System.debug('lt123主机'+ lcr.ProductClass__c);
                    if(lcr.ProductClass__c == '主机'){
                        opp.RivalHostsNumber__c += lcr.Quantity__c;
                        System.debug('lt123累加失单主机数'+ opp.RivalHostsNumber__c);
                    }else{
                        opp.RivalHostsNumber__c += 0;
                        System.debug('lt123不变失单主机数'+ opp.RivalHostsNumber__c);
                    }
                    //20220930  lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end
                    i++;
                    //给询价不同字段赋值 失单
                    if (lcr.PCLLostBrand__r.Lost_cancel_report__r.LostType__c=='失单') {