| | |
| | | delete pcts; |
| | | |
| | | // Id devRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | |
| | | // ETAPP重点产品拆分 fy start Consumable_product__r.Product2__r.Category5__c |
| | | String query = |
| | | ' SELECT Detail_Count__c, Intra_Trade_Without_Tax__c, Dealer_Info_text__c, Dealer_Info_ID__c, OCM_man_province__c, HospItal_Name__c, HospItal_Code__c, Hospital_ID__c, Consumable_product__c, Deliver_date__c, Asset_Model_No__c, ' + |
| | | ' Consumable_product__r.Product2__r.Category3__c, Consumable_product__r.Product2__r.Category4__c,Consumable_product__r.Product2__r.Plan_Term__c,Consumable_Sale_order__r.Opportunity__r.Sales_Root__c' + |
| | | ' Consumable_product__r.Product2__r.Category3__c, Consumable_product__r.Product2__r.Category4__c,Consumable_product__r.Product2__r.Category5__c,Consumable_product__r.Product2__r.Plan_Term__c,Consumable_Sale_order__r.Opportunity__r.Sales_Root__c' + |
| | | ' FROM Consumable_order_details2__c '+ |
| | | ' WHERE (NOT Dealer_Info_text__c LIKE \'%TEST%\') '; |
| | | // if (true != this.isAllFlag) { |
| | |
| | | List<String> pstIdList = new List<String>(); |
| | | for (Consumable_order_details2__c cod : codList) { |
| | | String pSTUniqueKey = term + ':' + cod.Consumable_product__r.Product2__r.Category3__c + ':'; |
| | | pstIdList.add(uniqueCalculate(pSTUniqueKey, cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c)); |
| | | // ETAPP重点产品拆分 fy start Consumable_product__r.Product2__r.Category5__c |
| | | pstIdList.add(uniqueCalculate(pSTUniqueKey, cod.Consumable_product__r.Product2__r.Category5__c,cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c)); |
| | | } |
| | | Map<String, Product_Score_Table__c> pstIdMap = new Map<String, Product_Score_Table__c>(); |
| | | for(Product_Score_Table__c tmpObj : [SELECT Id, UniqueKey__c |
| | |
| | | |
| | | //uniqueKeyATR : A:计画财年(151P):发货月:OCM管理省:医院:经销商:第三分类 :新4.5分类 |
| | | String uniqueKeyPSTH = 'A:' + term + ':' + cod.Deliver_date__c.month() + ':' + cod.OCM_man_province__c + ':' + cod.HospItal_Code__c + ':' + cod.Dealer_Info_ID__c + ':' + cod.Consumable_product__r.Product2__r.Category3__c + ':'; |
| | | uniqueKeyPSTH = uniqueCalculate(uniqueKeyPSTH, cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c); |
| | | // ETAPP重点产品拆分 fy start Consumable_product__r.Product2__r.Category5__c |
| | | uniqueKeyPSTH = uniqueCalculate(uniqueKeyPSTH, cod.Consumable_product__r.Product2__r.Category5__c,cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c); |
| | | |
| | | // Shipping_date__c yyyy/mm/01 |
| | | Date sd = Date.newInstance(cod.Deliver_date__c.year(), cod.Deliver_date__c.month(), 1); |
| | |
| | | |
| | | //产品得分表 step: soql map id |
| | | String pstUniqueKey = term + ':' + cod.Consumable_product__r.Product2__r.Category3__c + ':'; |
| | | pstUniqueKey = uniqueCalculate(pstUniqueKey, cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c); |
| | | // ETAPP重点产品拆分 fy start Consumable_product__r.Product2__r.Category5__c |
| | | pstUniqueKey = uniqueCalculate(pstUniqueKey, cod.Consumable_product__r.Product2__r.Category5__c,cod.Consumable_product__r.Product2__r.Category4__c, cod.Consumable_product__r.Product2__r.Category3__c, cod.Asset_Model_No__c); |
| | | if (pstIdMap.containsKey(pstUniqueKey)) { |
| | | psth.Product_Score_Table__c = pstIdMap.get(pstUniqueKey).Id; |
| | | } |
| | |
| | | eb.send(); |
| | | System.debug('ET_Agency_Target_Result_Table_Batch2 finish method end'); |
| | | } |
| | | |
| | | private static String uniqueCalculate(String uniqueKey, String category4, String category3, String assetModelNo) { |
| | | // ETAPP重点产品拆分 fy start Category5 |
| | | private static String uniqueCalculate(String uniqueKey, String Category5, String category4, String category3, String assetModelNo) { |
| | | if ('吸引活检针' == category4 && 'EUS' == category3) { |
| | | if (assetModelNo.startsWith('NA-U200H')) { |
| | | uniqueKey += '吸引活检针-EZ3P'; |
| | |
| | | } else { |
| | | uniqueKey += '先端系粘膜切开刀-DualJ以外'; |
| | | } |
| | | } |
| | | // ETAPP重点产品拆分 fy start |
| | | else if('导丝' == category4){ |
| | | if (assetModelNo.startsWith('G-240')) { |
| | | uniqueKey += '导丝-G-240'; |
| | | } else { |
| | | uniqueKey += '导丝-G-260'; |
| | | } |
| | | } |
| | | else if('乳头切开刀' == category4){ |
| | | if(category5.contains('乳头切开-三腔')){ |
| | | uniqueKey +='乳头切开刀-三腔'; |
| | | }else{ |
| | | uniqueKey +='乳头切开刀-其他'; |
| | | } |
| | | } else if('注射针(胃镜)'== category4){ |
| | | if (assetModelNo.startsWith('NM-20')){ |
| | | uniqueKey += '注射针(胃镜)-200'; |
| | | }else{ |
| | | uniqueKey += '注射针(胃镜)-400'; |
| | | } |
| | | } |
| | | else if('注射针(肠镜)'== category4){ |
| | | if (assetModelNo.startsWith('NM-20')){ |
| | | uniqueKey += '注射针(肠镜)-200'; |
| | | }else{ |
| | | uniqueKey += '注射针(肠镜)-400'; |
| | | } |
| | | } |
| | | else if('呼吸科ET'==category3 && '吸引活检针'==category4){ |
| | | if(assetModelNo.startsWith('NA-U401SX')||assetModelNo.startsWith('NA-U403SX')){ |
| | | uniqueKey +='吸引活检针-Visishot2'; |
| | | }else{ |
| | | uniqueKey +='吸引活检针-Visishot2以外'; |
| | | } |
| | | } |
| | | // ETAPP重点产品拆分 fy end |
| | | else { |
| | | uniqueKey += category4; |
| | | } |
| | | |