李彤
2023-05-17 b9055688b13a23f8e445de2bc3d5d0d2b85fec30
force-app/main/default/classes/PCLLostReportController.cls
@@ -20,6 +20,8 @@
   public integer secondNum {get; set;}
   // add tcm 20211122 end
   public Decimal InclusionUltrasound {get; set;}     //20230506 lt DB202304618804  包含超声 add
   // 竞争对手对照关系表,key是品牌名字,value是ID
   public map<string,id> CompetitionMap;
@@ -98,6 +100,7 @@
          Lost_Reason_Sub__c,Lost_By_Company__c,
          LostTotalAmount__c,LostType__c,
          TotalAmountLost__c, //20230215 lt DB202302247719
          InclusionUltrasound__c, //20230506 lt DB202304618804  包含超声
          Report_Status__c,Sales_assistant__c,
          Opportunity__c, Opportunity__r.Sales_assistant_ID__c,
          Opportunity__r.Sales_manager_departmentID__c,
@@ -110,6 +113,9 @@
            pageStatus = null;
            return;
         }
         InclusionUltrasound = lostReportList[0].InclusionUltrasound__c; //20230506 lt DB202304618804  包含超声
         lostReportList[0].Sales_assistant__c =
            lostReportList[0].Opportunity__r.Sales_assistant_ID__c;
         lostReportList[0].Manager_sales__c =
@@ -154,7 +160,6 @@
               system.debug('check products:'+ (templostBrand.PCLLostBrandProduct__r != null) + '|' + (templostBrand.PCLLostBrandProduct__r.size() > 0));
               if (templostBrand.PCLLostBrandProduct__r != null && templostBrand.PCLLostBrandProduct__r.size() > 0) {
                  for( PCLLostProduct__c tempProduct: templostBrand.PCLLostBrandProduct__r) {
                     tempProductList.add(new PCLLostProducts(productCount,tempProduct));
                     productCount++;
                  }
@@ -337,6 +342,15 @@
            }
            // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 end
            // update tcm 20211123 end
            // 20230418 ljh DB202304320022 start
            String LostBrandNameS = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c;
            String LostBrandName = temlostProduct.LostProductss.LostBrandName__c;
            if(LostBrandNameS != LostBrandName){
               temlostProduct.LostProductss.LostBrandName__c.addError('失单品牌名不一致,请确认');
               dataCheck = false;
            }
            // 20230418 ljh DB202304320022 end
         }
         // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 start
         if (productCount == 0 && tempLostBrand.LostProducts != null && tempLostBrand.LostProducts.size() > 0) {
@@ -387,8 +401,8 @@
               //20230215 lt DB202302247719  start 
               Decimal med = tempLostBrand.lostBrand.LostPrice__c/1.13/1000;
               Decimal med1 = med.setScale(2);
               System.debug('---lt123不含税数值(人工)Decimal---'+med);
               System.debug('---lt123不含税数值(人工)Decimal两位小数---'+med1);
               // System.debug('---lt123不含税数值(人工)Decimal---'+med);
               // System.debug('---lt123不含税数值(人工)Decimal两位小数---'+med1);
               LostReport.lostReport.TotalAmountLost__c += med1;
               //LostReport.lostReport.TotalAmountLost__c += tempLostBrand.lostBrand.LostPrices_ThousandY__c;  //20230215 lt DB202302247719
               // LostReport.lostReport.TotalAmountLost__c += tempLostBrand.lostBrand.LostPrice__c/1.13/1000;  //20230215 lt DB202302247719
@@ -575,7 +589,10 @@
      system.debug('brandNo:'+brandNo);
      LostBrand tempLostBrand = LostReport.LostBrands.get(brandNo);
      // PCLLostProduct__c plp = new PCLLostProduct__c(Competitor__c=CompetitionMap.get(LostReport.LostBrands[brandNo].lostBrand.Lost_By_Company__c));
      string brandName = tempLostBrand.lostBrand.Lost_By_Company__c;
      // 20230418 ljh DB202304320022 start
      // string brandName = tempLostBrand.lostBrand.Lost_By_Company__c;
      string brandName = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c;
      // 20230418 ljh DB202304320022 end
      PCLLostProduct__c plp = new PCLLostProduct__c();
      plp.LostBrandName__c = brandName;
      tempLostBrand.LostProducts.add(new PCLLostProducts(tempLostBrand.LostProducts.size(),plp));