From 2768cebeb80753586dcc25b352913c3b5b5b6cd1 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期五, 21 四月 2023 17:58:11 +0800
Subject: [PATCH] 修改按钮4.21

---
 force-app/main/default/classes/OpportunityLightingButtonController.cls |  124 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 1 deletions(-)

diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index 5c0b778..f3274d0 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-12 11:16:07
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-14 17:24:54
+ * @LastEditTime: 2023-04-21 17:39:35
  */
 public with sharing class OpportunityLightingButtonController {
     @AuraEnabled
@@ -305,6 +305,63 @@
         return res;
     }
     @AuraEnabled
+    public static InitData initForCopyWithAssetButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity oppo = [
+                select
+                Name,
+                SAP_Send_OK__c,
+                IsAuthorized__c
+                from Opportunity where Id =: recordId
+            ];
+            res.name = oppo.Name;
+            res.sapSendOK = oppo.SAP_Send_OK__c;
+            res.isAuthorized = oppo.IsAuthorized__c;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
+    public static InitData initForNewOpportunityAgencyButton(String recordId){
+        InitData res = new InitData();
+        try {
+            Opportunity opp = [
+                select
+                Agency1__r.Id,
+                Agency_Opportunity__c,
+                Trade__c,
+                Hospital__r.Id,
+                Name,
+                Close_Forecasted_Date__c,
+                Bid_Planned_Date__c,
+                Dealer_Final_Price__c,
+                Wholesale_Price__c,
+                Agency1__r.Name,
+                Opportunity_stage__c,
+                Opportunity_Category__c
+                from Opportunity where Id =: recordId
+            ];
+            res.agency1Id = opp.Agency1__r.Id;
+            res.agencyOpportunity = opp.Agency_Opportunity__c;
+            res.trade = opp.Trade__c;
+            res.hospitalId = opp.Hospital__r.Id;
+            res.name = opp.Name;
+            res.closeForecastedDate = opp.Close_Forecasted_Date__c;
+            res.bidPlannedDate = opp.Bid_Planned_Date__c;
+            res.dealerFinalPrice = opp.Dealer_Final_Price__c;
+            res.wholesalePrice = opp.Wholesale_Price__c;
+            res.agency1 = opp.Agency1__c;
+            res.opportunityStage = opp.Opportunity_stage__c;
+            res.opportunityCategory = opp.Opportunity_Category__c;
+            res.agency1Name = opp.Agency1__r.Name;
+        } catch (Exception e) {
+            throw new AuraHandledException(e.getMessage());
+        }
+        return res;
+    }
+    @AuraEnabled
     public static string updateForAgencyAuthorizeButton(String recordId){
         try {
             Opportunity opp = new Opportunity();
@@ -443,6 +500,53 @@
         }
         return quotes;
     }
+
+    @AuraEnabled
+    public static List<Agency_Hospital_Link__c> queryForNewOpportunityAgencyButtonToRecords(String agency1Id,String hospitalId){
+        List<Agency_Hospital_Link__c> links = null;
+        try {
+            links = [
+                SELECT 
+                Id, 
+                Name 
+                FROM Agency_Hospital_Link__c WHERE Agency__c =: agency1Id AND Hospital__c =: hospitalId
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return links;
+    }
+
+    @AuraEnabled
+    public static List<RecordType> queryForNewOpportunityAgencyButtonToRecTypeList(String sobjectType,String developerName,Boolean isActive){
+        List<RecordType> types = null;
+        try {
+            types = [
+                SELECT 
+                Id, 
+                Name FROM RecordType WHERE SobjectType =: sobjectType And developerName=: developerName And IsActive =: isActive 
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return types;
+    }
+
+    @AuraEnabled
+    public static List<FieldDefinition> queryForNewOpportunityAgencyButtonToRecords2(String qualifiedApiName){
+        List<FieldDefinition> fields = null;
+        try {
+            fields = [
+                select 
+                QualifiedApiName, 
+                EntityDefinition.KeyPrefix, 
+                DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName =: qualifiedApiName
+            ];
+        } catch (Exception e) {
+            System.debug('e:****' + e);
+        }
+        return fields;
+    }
     public class InitData{
         @AuraEnabled
         public Boolean directLossFLG;
@@ -520,5 +624,23 @@
         public String lastOpportunityFileId;
         @AuraEnabled
         public String currencyIsoCode;
+        @AuraEnabled
+        public Boolean isAuthorized;
+        @AuraEnabled
+        public String agencyOpportunity;
+        @AuraEnabled
+        public String hospitalId;
+        @AuraEnabled
+        public Date closeForecastedDate;
+        @AuraEnabled
+        public Decimal dealerFinalPrice;
+        @AuraEnabled
+        public Decimal wholesalePrice;
+        @AuraEnabled
+        public String opportunityStage;
+        @AuraEnabled
+        public String opportunityCategory;
+        @AuraEnabled
+        public String agency1Name;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1