From cb4bae31a02af72fea30e1a57c1d498eabef5d01 Mon Sep 17 00:00:00 2001 From: 李彤 <litong@prec-tech.com> Date: 星期四, 16 三月 2023 10:17:12 +0800 Subject: [PATCH] 同步代码 --- force-app/main/default/classes/UpdateUserTextColBatch.cls | 26 +++ force-app/main/default/classes/LostCancelReportOppBatch.cls | 298 +++++++++++++++++++++++++----------------- force-app/main/default/classes/NewQuoteIraiController.cls | 55 +++++++ force-app/main/default/classes/LostCancelReportHandler.cls | 11 + force-app/main/default/triggers/UserToContact.trigger | 12 + 5 files changed, 275 insertions(+), 127 deletions(-) diff --git a/force-app/main/default/classes/LostCancelReportHandler.cls b/force-app/main/default/classes/LostCancelReportHandler.cls index bfdf8a2..a864cd5 100644 --- a/force-app/main/default/classes/LostCancelReportHandler.cls +++ b/force-app/main/default/classes/LostCancelReportHandler.cls @@ -322,10 +322,19 @@ // } //澶卞崟鎬婚噾棰� //opp.LostPrices__c=lcr.PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c;//20230215 lt DB202302247719 娉ㄩ噴 - opp.LostPrices__c=lcr.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c; //20230215 lt DB202302247719 + // opp.LostPrices__c=lcr.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c; //20230215 lt DB202302247719 opp.of_lost_system_processor__c=lcr.PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c; } } + //20230215 lt DB202302247719 start + if(arrMap.get(lcro).TotalAmountLost__c != null){ + if(opp.LostPrices__c == null){ + opp.LostPrices__c = 0; + } + opp.LostPrices__c+=arrMap.get(lcro).TotalAmountLost__c; + } + //20230215 lt DB202302247719 end + // 20221202 ljh DB202211594688 start System.debug('zheli00:'+oppIdPZSet+'~'+opp.Id); if(oppIdPZSet.contains(opp.Id)){ diff --git a/force-app/main/default/classes/LostCancelReportOppBatch.cls b/force-app/main/default/classes/LostCancelReportOppBatch.cls index 72442ae..8765955 100644 --- a/force-app/main/default/classes/LostCancelReportOppBatch.cls +++ b/force-app/main/default/classes/LostCancelReportOppBatch.cls @@ -31,7 +31,8 @@ // query += ' where Id in :IdList'; // } // 2022-01-18 淇敼 浠庡け鍗曟姤鍛婂彇鍊� - String query = 'SELECT Id FROM Lost_cancel_report__c WHERE Report_Status__c = \'鎵瑰噯\' AND LostType__c in (\'澶卞崟\', \'閮ㄥ垎澶卞崟\') '; + String query = 'SELECT Id, Opportunity__c FROM Lost_cancel_report__c WHERE Report_Status__c = \'鎵瑰噯\' AND LostType__c in (\'澶卞崟\', \'閮ㄥ垎澶卞崟\') '; + //20230215 lt DB202302247719 add , Opportunity__c if (start_date != null) { query += ' AND Submit_Day__c >= :start_date'; } @@ -138,148 +139,207 @@ // 2022-01-18 淇敼 浠庡け鍗曟姤鍛婂彇鍊� global void execute(Database.BatchableContext BC, List<Lost_cancel_report__c> scope) { + + // List<String> reportIdList=new List<String>();//20230215 lt DB202302247719 娉ㄩ噴 + Set<String> oppIdList = new Set<String>();//20230215 lt DB202302247719 - List<String> reportIdList=new List<String>(); for (Lost_cancel_report__c report : scope) { - reportIdList.add(report.Id); + // reportIdList.add(report.Id); //20230215 lt DB202302247719 娉ㄩ噴 + oppIdList.add(report.Opportunity__c); //20230215 lt DB202302247719 } - List<PCLLostProduct__c> pclLpList=[select - id, // 澶卞崟鍨嬪彿id - Quantity__c, // 澶卞崟鏁伴噺 - LostProductName__c, // 澶卞崟瀵规墜鍨嬪彿 - LostProductMannual__c, // 澶卞崟瀵规墜鍨嬪彿锛堟墜鍔級 - PCLLostBrand__r.Lost_By_Company__c, // 澶卞崟鍝佺墝 - PCLLostBrand__r.Lost_reason_main__c, // 澶卞崟鍘熷洜锛堜富锛� - PCLLostBrand__r.Lost_Reason_Sub__c, // 澶卞崟鍘熷洜锛堟锛� - PCLLostBrand__r.Lost_By_Company_Mannual__c, // 澶卞崟鍝佺墝锛堟墜鍔級 - PCLLostBrand__r.Agency__r.Name, // 涓爣缁忛攢鍟� - PCLLostBrand__r.AgencyMannual__c, // 涓爣缁忛攢鍟嗭紙鎵嬪姩锛� - PCLLostBrand__r.Lost_cancel_report__r.LostType__c, // 澶卞崟绫诲瀷 - PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c, // 澶卞崟鎬婚噾棰� - PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c, // 澶卞崟鎬婚噾棰濓紙涓嶅惈绋庯級 //20230215 lt DB202302247719 - PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c, // 澶卞崟涓绘満鍙版暟 - PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c - from - PCLLostProduct__c - where - PCLLostBrand__r.Lost_cancel_report__c in :reportIdList]; - - // 鍒濆鍖栦繚瀛樺弬鏁� - Map<String, Opportunity> opp_map = new Map<String, Opportunity>(); - Map<String, String> prod_map = new Map<String, String>(); - Map<String, String> agency_map = new Map<String, String>(); + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� + // List<PCLLostProduct__c> pclLpList=[select + // id, // 澶卞崟鍨嬪彿id + // Quantity__c, // 澶卞崟鏁伴噺 + // LostProductName__c, // 澶卞崟瀵规墜鍨嬪彿 + // LostProductMannual__c, // 澶卞崟瀵规墜鍨嬪彿锛堟墜鍔級 + // PCLLostBrand__r.Lost_By_Company__c, // 澶卞崟鍝佺墝 + // PCLLostBrand__r.Lost_reason_main__c, // 澶卞崟鍘熷洜锛堜富锛� + // PCLLostBrand__r.Lost_Reason_Sub__c, // 澶卞崟鍘熷洜锛堟锛� + // PCLLostBrand__r.Lost_By_Company_Mannual__c, // 澶卞崟鍝佺墝锛堟墜鍔級 + // PCLLostBrand__r.Agency__r.Name, // 涓爣缁忛攢鍟� + // PCLLostBrand__r.AgencyMannual__c, // 涓爣缁忛攢鍟嗭紙鎵嬪姩锛� + // PCLLostBrand__r.Lost_cancel_report__r.LostType__c, // 澶卞崟绫诲瀷 + // PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c, // 澶卞崟鎬婚噾棰� + // PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c, // 澶卞崟鎬婚噾棰濓紙涓嶅惈绋庯級 //20230215 lt DB202302247719 + // PCLLostBrand__r.Lost_cancel_report__r.of_lost_system_processor__c, // 澶卞崟涓绘満鍙版暟 + // PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c + // from + // PCLLostProduct__c + // where + // PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c in :reportIdList]; + //20230215 lt DB202302247719 PCLLostBrand__r.Lost_cancel_report__c ---update--- PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c - // 寰幆鏁寸悊鏁版嵁 - for (PCLLostProduct__c lost : pclLpList) { - // 鍒ゆ柇鏄惁鍙敤鏁版嵁 - // if (String.isBlank(lost.LostProductName__c) && String.isBlank(lost.LostProductMannual__c)) { - // continue; - // } + List<Lost_cancel_report__c> lcrList = [SELECT Id, Opportunity__c, TotalAmountLost__c + FROM Lost_cancel_report__c + WHERE Opportunity__c in :oppIdList]; + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� + + //DB202302247719 lt start + Map<String, Opportunity> opp_map = new Map<String, Opportunity>(); + + for (Lost_cancel_report__c lcr : lcrList){ // 璇环id - String opp_id = lost.PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c; + String opp_id = lcr.Opportunity__c; + // 璇环 Opportunity opp = opp_map.get(opp_id); if (opp == null) { opp = new Opportunity(); opp.Id = opp_id; - opp.of_lost_system_processor__c = 0; opp_map.put(opp_id, opp); } - // 璧嬪�� - opp.LostTypeText__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostType__c; // 澶卞崟绫诲瀷 - //opp.LostPrices__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c; // 澶卞崟閲戦 //20230215 lt DB202302247719 娉ㄩ噴 - opp.LostPrices__c = lost.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c; // 澶卞崟閲戦 //20230215 lt DB202302247719 - opp.Lost_reason_main__c = lost.PCLLostBrand__r.Lost_reason_main__c; // 澶卞崟鍘熷洜锛堜富锛� - opp.Lost_Reason_Sub__c = lost.PCLLostBrand__r.Lost_Reason_Sub__c; // 澶卞崟鐞嗙敱锛堟锛� - opp.of_lost_system_processor__c += lost.Quantity__c; // 澶卞崟涓绘満鍙版暟锛堢疮鍔狅級 - // 澶卞崟浜у搧123 start - if (opp.CompetitorProduct1__c == null) { - opp.CompetitorProduct1__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); - }else if (opp.CompetitorProduct2__c == null) { - opp.CompetitorProduct2__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); - }else if (opp.CompetitorProduct3__c == null) { - opp.CompetitorProduct3__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); + System.debug('---lt123---璇环澶卞崟閲戦---'+opp.LostPrices__c); + System.debug('---lt123---澶卞崟鎬婚噾棰濓紝鍗冨厓涓嶅惈绋�---'+lcr.TotalAmountLost__c); + if(lcr.TotalAmountLost__c != null){ + if(opp.LostPrices__c == null){ + opp.LostPrices__c = 0; + } + opp.LostPrices__c += lcr.TotalAmountLost__c; // 澶卞崟閲戦 + System.debug('---lt123---绱姞鍚庤浠峰け鍗曢噾棰�---'+opp.LostPrices__c); } - // 澶卞崟浜у搧123 end - - // 澶卞崟鍝佺墝 - opp.PCLLostBrands__c = lost_brand_name(opp.PCLLostBrands__c, lost.PCLLostBrand__r.Lost_By_Company__c, lost.PCLLostBrand__r.Lost_By_Company_Mannual__c); - - // 涓爣缁忛攢鍟� - opp.Agencies__c = lost_agency_name(opp.Agencies__c, lost.PCLLostBrand__r.Agency__r.Name, lost.PCLLostBrand__r.AgencyMannual__c); } + //DB202302247719 lt end + + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� + // // 鍒濆鍖栦繚瀛樺弬鏁� + // Map<String, Opportunity> opp_map = new Map<String, Opportunity>(); + // Map<String, String> prod_map = new Map<String, String>(); + // Map<String, String> agency_map = new Map<String, String>(); + + // // 寰幆鏁寸悊鏁版嵁 + // for (PCLLostProduct__c lost : pclLpList) { + // // 鍒ゆ柇鏄惁鍙敤鏁版嵁 + // // if (String.isBlank(lost.LostProductName__c) && String.isBlank(lost.LostProductMannual__c)) { + // // continue; + // // } + // // 璇环id + // String opp_id = lost.PCLLostBrand__r.Lost_cancel_report__r.Opportunity__c; + // // 璇环 + // Opportunity opp = opp_map.get(opp_id); + // if (opp == null) { + // opp = new Opportunity(); + // opp.Id = opp_id; + // opp.of_lost_system_processor__c = 0; + // opp_map.put(opp_id, opp); + // } + + // //20230215 lt DB202302247719 start + // System.debug('---lt123---璇环澶卞崟閲戦---'+opp.LostPrices__c); + // System.debug('---lt123---澶卞崟鎬婚噾棰濓紝鍗冨厓涓嶅惈绋�---'+lost.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c); + + // if(lost.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c != null){ + // if(opp.LostPrices__c == null){ + // opp.LostPrices__c = 0; + // } + // opp.LostPrices__c += lost.PCLLostBrand__r.Lost_cancel_report__r.TotalAmountLost__c; // 澶卞崟閲戦 + // } + + // //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� + // // 璧嬪�� + // // opp.LostTypeText__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostType__c; // 澶卞崟绫诲瀷 + // // //opp.LostPrices__c = lost.PCLLostBrand__r.Lost_cancel_report__r.LostTotalAmount__c; // 澶卞崟閲戦 + // // opp.Lost_reason_main__c = lost.PCLLostBrand__r.Lost_reason_main__c; // 澶卞崟鍘熷洜锛堜富锛� + // // opp.Lost_Reason_Sub__c = lost.PCLLostBrand__r.Lost_Reason_Sub__c; // 澶卞崟鐞嗙敱锛堟锛� + // // opp.of_lost_system_processor__c += lost.Quantity__c; // 澶卞崟涓绘満鍙版暟锛堢疮鍔狅級 + + + // // 澶卞崟浜у搧123 start + // // if (opp.CompetitorProduct1__c == null) { + // // opp.CompetitorProduct1__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); + // // }else if (opp.CompetitorProduct2__c == null) { + // // opp.CompetitorProduct2__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); + // // }else if (opp.CompetitorProduct3__c == null) { + // // opp.CompetitorProduct3__c = lost_product_name(lost.LostProductName__c, lost.LostProductMannual__c); + // // } + // // 澶卞崟浜у搧123 end + + // // 澶卞崟鍝佺墝 + // // opp.PCLLostBrands__c = lost_brand_name(opp.PCLLostBrands__c, lost.PCLLostBrand__r.Lost_By_Company__c, lost.PCLLostBrand__r.Lost_By_Company_Mannual__c); + + // // 涓爣缁忛攢鍟� + // // opp.Agencies__c = lost_agency_name(opp.Agencies__c, lost.PCLLostBrand__r.Agency__r.Name, lost.PCLLostBrand__r.AgencyMannual__c); + // //DB202302247719 娉ㄩ噴 lt + // //20230215 lt DB202302247719 end + + // } + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� System.debug(opp_map); + StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719 update opp_map.values(); + StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719 } + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� // 澶卞崟瀵规墜鍨嬪彿 - private String lost_product_name(String lost_product, String lost_product_mannual) { - if (String.isBlank(lost_product) && String.isNotBlank(lost_product_mannual)) { - return lost_product_mannual; - } - return lost_product; - } + // private String lost_product_name(String lost_product, String lost_product_mannual) { + // if (String.isBlank(lost_product) && String.isNotBlank(lost_product_mannual)) { + // return lost_product_mannual; + // } + // return lost_product; + // } - // 澶卞崟鍝佺墝 - private String lost_brand_name(String lost_brand_in_opp, String lost_brand, String lost_brand_mannual) { - // 鍒濆鍖栧弬鏁� - String plus = ''; - // 鍒ゆ柇 - // SWAG-CCC6F6 2022-04-22 ssm start - // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊� - // if ('鍏朵粬'.equals(lost_brand) && String.isNotBlank(lost_brand_mannual)) { - // plus = lost_brand_mannual; - // } else { - // plus = lost_brand; - // } - plus = lost_brand; - // SWAG-CCC6F6 2022-04-22 ssm end - // 鍒濆鍖栬繑鍥炲�� - if (String.isBlank(lost_brand_in_opp)) { - lost_brand_in_opp = ''; - } - // 鎷兼帴 - if (String.isNotBlank(plus) && !lost_brand_in_opp.contains(plus)) { - // 澧炲姞鍒嗛殧鏍囪瘑 - if (String.isNotBlank(lost_brand_in_opp)) { - lost_brand_in_opp += ','; - } - lost_brand_in_opp += plus; - } - return lost_brand_in_opp; - } + // // 澶卞崟鍝佺墝 + // private String lost_brand_name(String lost_brand_in_opp, String lost_brand, String lost_brand_mannual) { + // // 鍒濆鍖栧弬鏁� + // String plus = ''; + // // 鍒ゆ柇 + // // SWAG-CCC6F6 2022-04-22 ssm start + // // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊� + // // if ('鍏朵粬'.equals(lost_brand) && String.isNotBlank(lost_brand_mannual)) { + // // plus = lost_brand_mannual; + // // } else { + // // plus = lost_brand; + // // } + // plus = lost_brand; + // // SWAG-CCC6F6 2022-04-22 ssm end + // // 鍒濆鍖栬繑鍥炲�� + // if (String.isBlank(lost_brand_in_opp)) { + // lost_brand_in_opp = ''; + // } + // // 鎷兼帴 + // if (String.isNotBlank(plus) && !lost_brand_in_opp.contains(plus)) { + // // 澧炲姞鍒嗛殧鏍囪瘑 + // if (String.isNotBlank(lost_brand_in_opp)) { + // lost_brand_in_opp += ','; + // } + // lost_brand_in_opp += plus; + // } + // return lost_brand_in_opp; + // } - // 涓爣缁忛攢鍟� - private String lost_agency_name(String lost_agency_in_opp, String lost_agency, String lost_agency_mannual) { - // 鍒濆鍖栧弬鏁� - String plus = ''; - // 鍒ゆ柇 - // SWAG-CCC6F6 2022-04-22 ssm start - // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊� - // if ('瀵规墜缁忛攢鍟�'.equals(lost_agency) && String.isNotBlank(lost_agency_mannual)) { - // plus = lost_agency_mannual; - // } else { - // plus = lost_agency; - // } - plus = lost_agency; - // SWAG-CCC6F6 2022-04-22 ssm end - // 鍒濆鍖栬繑鍥炲�� - if (String.isBlank(lost_agency_in_opp)) { - lost_agency_in_opp = ''; - } - // 鎷兼帴 - if (String.isNotBlank(plus) && !lost_agency_in_opp.contains(plus)) { - // 澧炲姞鍒嗛殧鏍囪瘑 - if (String.isNotBlank(lost_agency_in_opp)) { - lost_agency_in_opp += ','; - } - lost_agency_in_opp += plus; - } - return lost_agency_in_opp; - } + // // 涓爣缁忛攢鍟� + // private String lost_agency_name(String lost_agency_in_opp, String lost_agency, String lost_agency_mannual) { + // // 鍒濆鍖栧弬鏁� + // String plus = ''; + // // 鍒ゆ柇 + // // SWAG-CCC6F6 2022-04-22 ssm start + // // 璇环涓婇兘鍙樉绀洪�夐」鍒楄〃鐨勫�硷紝涓嶉渶瑕佹墜鍔ㄧ殑鍊� + // // if ('瀵规墜缁忛攢鍟�'.equals(lost_agency) && String.isNotBlank(lost_agency_mannual)) { + // // plus = lost_agency_mannual; + // // } else { + // // plus = lost_agency; + // // } + // plus = lost_agency; + // // SWAG-CCC6F6 2022-04-22 ssm end + // // 鍒濆鍖栬繑鍥炲�� + // if (String.isBlank(lost_agency_in_opp)) { + // lost_agency_in_opp = ''; + // } + // // 鎷兼帴 + // if (String.isNotBlank(plus) && !lost_agency_in_opp.contains(plus)) { + // // 澧炲姞鍒嗛殧鏍囪瘑 + // if (String.isNotBlank(lost_agency_in_opp)) { + // lost_agency_in_opp += ','; + // } + // lost_agency_in_opp += plus; + // } + // return lost_agency_in_opp; + // } + //DB202302247719 娉ㄩ噴 lt 娉ㄩ噴鍘熷洜锛欴B202302247719璇鹃鍒峰け鍗曟姤鍛婃暟鎹彧鍒峰け鍗曢噾棰� global void finish(Database.BatchableContext BC) { diff --git a/force-app/main/default/classes/NewQuoteIraiController.cls b/force-app/main/default/classes/NewQuoteIraiController.cls index 510f981..a681f61 100644 --- a/force-app/main/default/classes/NewQuoteIraiController.cls +++ b/force-app/main/default/classes/NewQuoteIraiController.cls @@ -310,6 +310,15 @@ } else { // 宸茬粡瀛樺湪鎶ヤ环 if (String.isNotBlank(oppquoid)) { + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy start + Quote quo2 = new Quote(); + List<Quote> quote = [select Id,Agency1__c,Agency2__c From Quote Where Id =:oppquoid]; + if(quote.size()>0){ + quo2=quote[0]; + } + quo.Agency1_entrust__c = quo2.Agency1__c; + quo.Agency2_entrust__c = quo2.Agency2__c; + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy end // 鎶ヤ环鍟嗗搧鍙栧緱 // CHAN-BHNBX6 2019/11/20 START//fy lastbuy 20220310 PricebookEntry.Product2.LastbuyProductFLG__c List<QuoteLineItem> qlis = [select id,PricebookEntry.Product2Id,PricebookEntry.Product2.LastbuyProductFLG__c,Quantity__c,CurrencyIsoCode,GuaranteePeriod__c from QuoteLineItem where QuoteId = :oppquoid]; @@ -426,6 +435,7 @@ [ SELECT Id,Name,Cancel_Decide__c,Agency_Hospital_Link__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,Agency1_entrust__c,cancelMultiyearInsurance__c, Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Noteplus__c,Lead__c,Opportunity__c, TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, + Agency2_entrust__c,//DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy Print_HP_Name__c,Account__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c , urgent__c //20230104 lt DB202212427301 FROM QuoteIrai__c Where Id =:quoId]; @@ -1022,7 +1032,7 @@ } } } - System.debug('---lt123---descriptions---'+descriptions); + // System.debug('---lt123---descriptions---'+descriptions); if (descriptions.size() <= 0) { errorflg = true; errorMessage = '娌℃湁瑕佸鎵樼殑浜у搧銆�'; @@ -1059,7 +1069,7 @@ } i += 1; } - System.debug('---lt123---description---'+description); + // System.debug('---lt123---description---'+description); //obsap 鏂板缁忛攢鍟�1瀛楁 fy start if (!String.isBlank(quo.Agency1_entrust__c)) { Account quoteAeName = [select Id,Name from Account where Id =:quo.Agency1_entrust__c]; @@ -1068,6 +1078,13 @@ descriptionsendEmailbody += '\r\n' + '绗竴缁忛攢鍟嗗悕绉�' + '锛�' + quoteAeName.Name; //20230116 fy end } + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy start + if (!String.isBlank(quo.Agency2_entrust__c)) { + Account quoteAeName2 = [select Id,Name from Account where Id =:quo.Agency2_entrust__c]; + description += '\r\n' + '绗簩缁忛攢鍟嗗悕绉�' + '锛�' + quoteAeName2.Name; + descriptionsendEmailbody += '\r\n' + '绗簩缁忛攢鍟嗗悕绉�' + '锛�' + quoteAeName2.Name; + } + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy end if (quo.QuoteProportion__c!=null) { description += '\r\n' + '鎶ヤ环姣斾緥' + '锛�' + quo.QuoteProportion__c; //20230116 fy start @@ -1119,6 +1136,12 @@ descriptionsendEmailbody += '\r\n' + '绗竴缁忛攢鍟�' + '锛�' + baseUrl + '/' + quo.Agency1_entrust__c; //20230116 fy end } + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy start + if (!String.isBlank(quo.Agency2_entrust__c)) { + description += '\r\n' + '绗簩缁忛攢鍟�' + '锛�' + baseUrl + '/' + quo.Agency2_entrust__c; + descriptionsendEmailbody += '\r\n' + '绗簩缁忛攢鍟�' + '锛�' + baseUrl + '/' + quo.Agency2_entrust__c; + } + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy end //SWAG-CKDATG銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start if (!String.isBlank(tenderid)&&!description.contains('鎷涙爣椤圭洰') ) { description += '\r\n' + '鎷涙爣椤圭洰' + '锛�' + baseUrl + '/' + tenderid; @@ -1304,7 +1327,7 @@ //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c, quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c, Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c, - TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, + TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c , urgent__c //20230104 lt DB202212427301 FROM QuoteIrai__c Where Id =:quoId]; @@ -1327,6 +1350,25 @@ if(String.isNotBlank(leadid)){ lea.Id = leadid; lea.OfferToEntrust__c = 1; + + //20230227 lt DB202302251962 start + Map<Date,String> lm = new Map<Date,String>(); + for(OlympusCalendar__c oc:[SELECT Id,Date__c FROM OlympusCalendar__c WHERE Date__c =: Date.today()]){ + lm.put(oc.Date__c,oc.Id); + } + String datestr =String.valueOf(Date.today()); + String dt = lm.get(Date.valueOf(datestr.substring(0,10))); + + List<Lead> leadlist = [select Id,FirstDate_Quote_Irai__c from Lead where Id = :leadid]; + // System.debug('lt123鏃ユ湡1'+ leadlist[0].FirstDate_Quote_Irai__c); + // System.debug('lt123鏃ユ湡2'+ lea.FirstDate_Quote_Irai__c); + if(leadlist.size() > 0){ + if(leadlist[0].FirstDate_Quote_Irai__c == null){ + lea.FirstDate_Quote_Irai__c = dt; + } + } + //20230227 lt DB202302251962 end + update lea; } //XLIU-CHY4KW 20220907 lt end @@ -1668,7 +1710,7 @@ //XLIU-CFE8M7 銆愬鎵樸�戙�怭-OBSAP銆戞姤浠峰鎵樹换鍔℃敼鍠� fy Noteplus__c //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c, qs = [select Id,Account__c,Agency_Hospital_Link__c,Name,IraiUser__c,IraiSubject__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c, - Preferential_Trading_Price__c,Discount__c,Pricing__c,Unit_Price__c,Offer_Amount__c,TOTAL__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, + Preferential_Trading_Price__c,Discount__c,Pricing__c,Unit_Price__c,Offer_Amount__c,TOTAL__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy Contract__c,Print_HP_Name__c,Quote_Expiration_Date__c,Quote_Comment__c,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c , urgent__c //20230104 lt DB202212427301 From QuoteIrai__c Where Id =:quoId]; @@ -1697,6 +1739,9 @@ //obsap 鏂板缁忛攢鍟�1瀛楁 fy staty q.Agency1_entrust__c = quo.Agency1_entrust__c; //obsap 鏂板缁忛攢鍟�1瀛楁 fy staty + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy start + q.Agency2_entrust__c = quo.Agency2_entrust__c; + //DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy end // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start q.cancelMultiyearInsurance__c = quo.cancelMultiyearInsurance__c; // SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end @@ -1738,7 +1783,7 @@ //SWAG-CF589P銆愬鎵樸�戙�怭:OBSAP銆戞姤浠峰鎵樼浉鍏虫柊闇�姹傝瘎浼� fy Lead__c,Opportunity__c, quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 鏂板缁忛攢鍟�1瀛楁 fy satrt Agency1_entrust__c,SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start cancelMultiyearInsurance__c, Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c,Headquarters__c,//DB202301106714 銆愭姤浠峰鎵樻敼鍠勩�慜BSAP閫氱煡閭欢鍙戦�侀偖绠变慨鏀� fy Headquarters__c - TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, + TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682銆愭姤浠峰鎵樸�戞姤浠峰鎵樻敼鍠�224 fy Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c , urgent__c //20230104 lt DB202212427301 FROM QuoteIrai__c Where Id =:q.Id]; diff --git a/force-app/main/default/classes/UpdateUserTextColBatch.cls b/force-app/main/default/classes/UpdateUserTextColBatch.cls index bd698f3..7b2e242 100644 --- a/force-app/main/default/classes/UpdateUserTextColBatch.cls +++ b/force-app/main/default/classes/UpdateUserTextColBatch.cls @@ -32,7 +32,7 @@ * start銇伅銆乹uery銈掑疅琛屻�併儲銉笺偠銉笺倰妞滅储 */ global Database.QueryLocator start(Database.BatchableContext BC) { - String query = 'Select Id, Fiscal_Start_Date__c, Fiscal_Start_Date_from_May__c, Use_Start_Date__c from User'; + String query = 'Select Id, Fiscal_Start_Date__c, Fiscal_Start_Date_from_May__c, Use_Start_Date__c, Maternity_leave_StartDate__c, Maternity_leave_EndDate__c from User'; //20230303 lt DB202302421915 add , Maternity_leave_StartDate__c, Maternity_leave_EndDate__c if (String.isBlank(testUserId) == false) { query += ' where Id =\'' + testUserId + '\''; } @@ -48,7 +48,29 @@ fromDate4 = usr.Use_Start_Date__c; } - usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate)); + //20230303 lt DB202302421915 start + // usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate)); + + Date mlStartDate = usr.Maternity_leave_StartDate__c; + Date mlEndDate = usr.Maternity_leave_EndDate__c; + + if(mlStartDate == null && mlEndDate == null){ + usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate)); + } + else if(mlStartDate != null && mlEndDate == null && mlStartDate > fromDate4){ + usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, mlStartDate)); + } + else if(mlStartDate != null && mlEndDate == null && mlStartDate <= fromDate4){ + usr.Fiscal_Workdays__c = 0; + } + else if(mlStartDate != null && mlEndDate != null && mlStartDate > fromDate4){ + usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, mlStartDate)) + decimal.valueOf(getOlympusWorkDayCount(mlEndDate, toDate)); + } + else if(mlStartDate != null && mlEndDate != null && mlStartDate <= fromDate4){ + usr.Fiscal_Workdays__c = 0 + decimal.valueOf(getOlympusWorkDayCount(mlEndDate, toDate)); + } + //20230303 lt DB202302421915 end + /***** CHAN-AZABMC ****** 2018/06/01 ******** **** 鍒版湰鏈堢殑宸ヤ綔鏃ワ紙浠婂勾搴︼級 **** 鍒版湰鍛ㄧ殑宸ヤ綔鏃ワ紙浠婂勾搴︼級 diff --git a/force-app/main/default/triggers/UserToContact.trigger b/force-app/main/default/triggers/UserToContact.trigger index fafa3d9..5dea882 100644 --- a/force-app/main/default/triggers/UserToContact.trigger +++ b/force-app/main/default/triggers/UserToContact.trigger @@ -12,6 +12,18 @@ if (Trigger.isUpdate) { old = Trigger.oldMap.get(local.Id); } + + //20230303 lt DB202302421915 start + if(Trigger.isBefore && Trigger.isUpdate && local.Pregnant_Rest__c != old.Pregnant_Rest__c){ + if(old.Pregnant_Rest__c == FALSE && local.Pregnant_Rest__c == TRUE){ + local.Maternity_leave_StartDate__c = Date.today(); + } + if(old.Pregnant_Rest__c == TRUE && local.Pregnant_Rest__c == FALSE){ + local.Maternity_leave_EndDate__c = Date.today(); + } + } + //20230303 lt DB202302421915 end + if (String.isNotBlank(local.Employee_No__c) && ( Trigger.isInsert || old.Test_staff__c != local.Test_staff__c -- Gitblit v1.9.1