From 41a627eaaf29658a401ac43e4da838a5b622f44e Mon Sep 17 00:00:00 2001 From: 李彤 <litong@prec-tech.com> Date: 星期一, 29 五月 2023 16:54:34 +0800 Subject: [PATCH] DB202303088261 --- force-app/main/default/classes/ConsumableController.cls | 93 ++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 77 insertions(+), 16 deletions(-) diff --git a/force-app/main/default/classes/ConsumableController.cls b/force-app/main/default/classes/ConsumableController.cls index b694207..8d82dc7 100644 --- a/force-app/main/default/classes/ConsumableController.cls +++ b/force-app/main/default/classes/ConsumableController.cls @@ -92,10 +92,14 @@ public ApexPages.StandardSetController con { get; set; } public String soql {get;set;} + private Boolean OSHFLG;//lt 20230517 瀹夊窘涓ょエ鍒� add + // 鐧诲綍鑰呭伐浣滃湴 private String userWorkLocation; + // public String agencyProType {get;set;} + public String agencyProType1 {get;set;} //lt 20230526 瀹夊窘涓ょエ鍒� add public String methodType {get;set;} public String hospitalName {get;set;} @@ -188,6 +192,7 @@ // 鐢婚潰鍒濆鍖� public void init() { + System.debug('zhj init'); this.methodType = ApexPages.currentPage().getParameters().get('type'); this.sortKey = '1'; this.preSortKey = '1'; @@ -211,10 +216,23 @@ userId = UserInfo.getUserId(); //userId = '0050l000001dLbc'; List<user> Useracc = New List<user>(); - Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id = :userId ]; + //lt 20230517 瀹夊窘涓ょエ鍒� add ,OSHFLG__c + Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; accountid = Useracc[0].accountid; userWorkLocation = Useracc[0].Work_Location__c; agencyProType = Useracc[0].UserPro_Type__c; + agencyProType1 = Useracc[0].UserPro_Type__c; //lt 20230526 瀹夊窘涓ょエ鍒� add + + //lt 20230526 瀹夊窘涓ょエ鍒� start + OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 瀹夊窘涓ょエ鍒� add + if(OSHFLG){ + agencyProType1 = 'OSH'; + } + else if(String.isBlank(Useracc[0].UserPro_Type__c)){ + agencyProType1 = 'ET'; + } + //lt 20230526 瀹夊窘涓ょエ鍒� end + if(String.isBlank(Useracc[0].UserPro_Type__c)){ agencyProType = 'ET'; } @@ -233,8 +251,11 @@ where RecordType.DeveloperName ='AgencyContract' and Contract_Decide_Start_Date__c <= :dateToday and Contract_Decide_End_Date__c >= :dateToday - and Contact_Type__c like :agencyProType - and Agent_Ref__c =:accountid]; + and Contact_Type__c like :agencyProType1//lt 20230517 瀹夊窘涓ょエ鍒� add 1 + and Agent_Ref__c =:accountid + and OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add + ]; + for(Account contract : contractList){ contactDealer.add(contract.Id); } @@ -287,9 +308,12 @@ List<Account> contract = [SELECT id,Name,State_Master__c,State_Master__r.Name FROM Account WHERE ParentId = :accountid - AND Contact_Type__c like :agencyProType + AND Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1 AND Contract_Decide_Start_Date__c <= :Date.Today() - AND Contract_Decide_End_Date__c >= :Date.Today()]; + AND Contract_Decide_End_Date__c >= :Date.Today() + AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add + ]; + if(contract.size() == 1){ contractName = contract[0].Name; contractId = contract[0].Id; @@ -302,7 +326,7 @@ size = Integer.valueOf(System.Label.orderdetLimitsize); initStandardController(); product2Selected = Database.query(soql); - + System.debug('product2Selected.size() = ' + product2Selected.size()); for (Integer i = 0; i < product2Selected.size(); i++) { consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i])); MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); @@ -1978,10 +2002,13 @@ List<Account> contract = [select Id,Name,Contract_Department_Class__c,Contract_Quote_Decide_Flag__c from account WHERE Name = :contractName + AND Id =: contractId //lt 20230517 瀹夊窘涓ょエ鍒� add AND Contract_Decide_Start_Date__c <= :Date.Today() AND Contract_Decide_End_Date__c >= :Date.Today() - and Contact_Type__c like :agencyProType - and Agent_Ref__c =:accountid]; + and Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1 + and Agent_Ref__c =:accountid + and OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add + ]; if(contract.size() <= 0){ coc.Order_effective_contact__c.addError('涓嶅瓨鍦ㄧ殑鍚堝悓锛岃閲嶆柊纭銆�'); @@ -2026,20 +2053,37 @@ //=======================================鍖婚櫌鐗逛环,鏈夐噾棰濈殑璇濆彇閲戦 + // gzw 20230419 鍖婚櫌鐗逛环闂淇 start + // Map<String,Decimal> dealerHospitalmMap = new Map<String,Decimal>(); + // // Map<String,Decimal> dealerHospitalpMap = new Map<String,Decimal>(); + // List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c + // from hospitalprice__c + // where product__c in :tpids and mPrice__c <> null + // ]; + // for(hospitalprice__c dealerProduct: hplist){ + // if (dealerProduct.mPrice__c != null ) { + // dealerHospitalmMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.mPrice__c); + // } + // // if (dealerProduct.pPrice__c != null) { + // // dealerHospitalpMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.pPrice__c); + // // } + // } + Map<String,Decimal> dealerHospitalmMap = new Map<String,Decimal>(); // Map<String,Decimal> dealerHospitalpMap = new Map<String,Decimal>(); List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c from hospitalprice__c - where product__c in :tpids and mPrice__c <> null + where product__c in :tpids and mPrice__c <> null and account__c=:accountid ]; for(hospitalprice__c dealerProduct: hplist){ if (dealerProduct.mPrice__c != null ) { - dealerHospitalmMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.mPrice__c); + dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c,dealerProduct.mPrice__c); } // if (dealerProduct.pPrice__c != null) { // dealerHospitalpMap.put('' + dealerProduct.account__c + dealerProduct.product__c,dealerProduct.pPrice__c); // } } + // gzw 20230419 鍖婚櫌鐗逛环闂淇 end //淇冮攢璁㈣揣 鏍规嵁缁忛攢鍟嗕骇鍝佷腑鐨勬暟鎹绠楅噾棰� //=======================================浜у搧鐗规畩鎶樻墸 @@ -2106,9 +2150,14 @@ List<Account> at = [SELECT id,Name,State_Master__c,State_Master__r.Name,Sales_Section__c,Dealer_discount__c FROM Account WHERE Name = :contractName - and Contact_Type__c like :agencyProType + AND Id =: contractId //lt 20230517 瀹夊窘涓ょエ鍒� add + AND Contact_Type__c like :agencyProType1 //lt 20230517 瀹夊窘涓ょエ鍒� add 1 AND Contract_Decide_Start_Date__c <= :Date.Today() - AND Contract_Decide_End_Date__c >= :Date.Today()]; + AND Contract_Decide_End_Date__c >= :Date.Today() + AND OSH_Dealer__c =: OSHFLG //lt 20230517 瀹夊窘涓ょエ鍒� add + ]; + System.debug('---lt123---at.size()锛�'+at.size()); + System.debug('---lt123---at[0].Dealer_discount__c锛�'+at[0].Dealer_discount__c); if(at.size() > 0 && at[0].Dealer_discount__c != null){ disCount = at[0].Dealer_discount__c; }else{ @@ -2180,10 +2229,16 @@ //鍖婚櫌鐗逛环 Consumable_order[0].Order_ForHospital__c = hospitalId; Consumable_order[0].orderPattern__c = 'hospitalorder'; - if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { + // gzw 20230419 鍖婚櫌鐗逛环闂淇 start + // if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { + // //鐩存帴鏍规嵁淇冮攢閲戦璁$畻 + // InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); + // } + if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { //鐩存帴鏍规嵁淇冮攢閲戦璁$畻 - InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); + InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); } + // gzw 20230419 鍖婚櫌鐗逛环闂淇 end } else if(DealerProductMap.containsKey(ass.Prod.Id)){ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; @@ -2268,10 +2323,16 @@ Consumable_order[0].orderPattern__c = 'hospitalorder'; //鍖婚櫌鐗逛环 Consumable_order[0].Order_ForHospital__c = hospitalId; - if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { + // gzw 20230419 鍖婚櫌鐗逛环闂淇 start + // if (dealerHospitalmMap.containsKey(accountid + ass.Prod.Id) && dealerHospitalmMap.get(accountid + ass.Prod.Id) != null) { + // //鐩存帴鏍规嵁淇冮攢閲戦璁$畻 + // InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); + // } + if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { //鐩存帴鏍规嵁淇冮攢閲戦璁$畻 - InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ accountid + ass.Prod.Id); + InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); } + // gzw 20230419 鍖婚櫌鐗逛环闂淇 end } else if(DealerProductMap.containsKey(ass.Prod.Id)){ InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; -- Gitblit v1.9.1