| | |
| | | // } |
| | | //失单总金额 |
| | | //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)){ |
| | |
| | | // 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'; |
| | | } |
| | |
| | | |
| | | // 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 注释原因: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__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 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | |
| | | //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 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | // // 初始化保存参数 |
| | | // 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 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | // // 赋值 |
| | | // // 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 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | System.debug(opp_map); |
| | | StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719 |
| | | update opp_map.values(); |
| | | StaticParameter.EscapeOppandStaTrigger = true; //20230215 lt DB202302247719 |
| | | } |
| | | |
| | | //DB202302247719 注释 lt 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | // 失单对手型号 |
| | | 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 注释原因:DB202302247719课题刷失单报告数据只刷失单金额 |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | |
| | |
| | | } 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]; |
| | |
| | | [ 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]; |
| | |
| | | } |
| | | } |
| | | } |
| | | System.debug('---lt123---descriptions---'+descriptions); |
| | | // System.debug('---lt123---descriptions---'+descriptions); |
| | | if (descriptions.size() <= 0) { |
| | | errorflg = true; |
| | | errorMessage = '没有要委托的产品。'; |
| | |
| | | } |
| | | 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]; |
| | |
| | | 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 |
| | |
| | | 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【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | if (!String.isBlank(tenderid)&&!description.contains('招标项目') ) { |
| | | description += '\r\n' + '招标项目' + ':' + baseUrl + '/' + tenderid; |
| | |
| | | //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善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]; |
| | |
| | | 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 |
| | |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P: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]; |
| | |
| | | //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 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | q.cancelMultiyearInsurance__c = quo.cancelMultiyearInsurance__c; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | |
| | | //SWAG-CF589P【委托】【P: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 【委托】【OBSAP-报价委托】报价委托项目改善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 【报价委托改善】OBSAP通知邮件发送邮箱修改 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]; |
| | |
| | | * startには、queryを実行、ユーザーを検索 |
| | | */ |
| | | 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 + '\''; |
| | | } |
| | |
| | | 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 ******** |
| | | **** 到本月的工作日(今年度) |
| | | **** 到本周的工作日(今年度) |
| | |
| | | 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 |