From 36d15f189de2e83ce2576715dac30c3c260388dd Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:47:50 +0800
Subject: [PATCH] fixconflict

---
 force-app/main/default/classes/LexConInvoiceViewController.cls |   95 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 85 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/classes/LexConInvoiceViewController.cls b/force-app/main/default/classes/LexConInvoiceViewController.cls
index 61a4641..b67d39d 100644
--- a/force-app/main/default/classes/LexConInvoiceViewController.cls
+++ b/force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -102,6 +102,32 @@
         }
         userId = UserInfo.getUserId();
         List<user> Useracc = new List<user>();
+<<<<<<< HEAD
+        Useracc = [
+            SELECT accountid, Work_Location__c, UserPro_Type__c
+            FROM user
+            WHERE id = :userId
+        ];
+        accountid = Useracc[0].accountid;
+        userWorkLocation = Useracc[0].Work_Location__c;
+        agencyProType = Useracc[0].UserPro_Type__c;
+        if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+            agencyProType = 'ET';
+        }
+        coc = new Consumable_order__c();
+
+        Dealerelationship = [
+            SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
+            FROM Dealer_elationship__c
+            WHERE Dealer_principal__c = :accountid
+        ];
+        List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
+        AgencyHospitalLink = [
+            SELECT Id, Name, Hospital__c, Hospital__r.Id, Hospital__r.Name, Agency__c
+            FROM Agency_Hospital_Link__c
+            WHERE Agency__c = :accountId
+        ];
+=======
         Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
         accountid = Useracc[0].accountid;
         userWorkLocation = Useracc[0].Work_Location__c;
@@ -122,6 +148,7 @@
             FROM Agency_Hospital_Link__c
             WHERE Agency__c = :accountId
         ];
+>>>>>>> LEXCommunityLiJun
         // 鏂拌
         if (invoiceId == null || invoiceId == '') {
             if (deliveryId == null || deliveryId == '') {
@@ -388,16 +415,46 @@
         //         attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
         //     }
         // }
-        List<ContentVersion> cvInfo = [
-            SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
-            FROM ContentVersion
-            WHERE FirstPublishLocationId = :invoiceId
+<<<<<<< HEAD
+        List<ContentDocumentLink> links = [
+            SELECT Id, ContentDocumentId
+            FROM ContentDocumentLink
+            WHERE LinkedEntityId = :invoiceId
         ];
-        if (cvInfo.size() > 0) {
-            for (Integer i = 0; i < cvInfo.size(); i++) {
-                attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
+=======
+        List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :invoiceId];
+>>>>>>> LEXCommunityLiJun
+        if (links != null && links.size() > 0) {
+            List<String> documentIds = new List<String>();
+            for (ContentDocumentLink link : links) {
+                documentIds.add(link.ContentDocumentId);
+            }
+            List<ContentVersion> cvInfo = [
+                SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
+                FROM ContentVersion
+                WHERE ContentDocumentId IN :documentIds
+            ];
+<<<<<<< HEAD
+
+=======
+            
+>>>>>>> LEXCommunityLiJun
+            if (cvInfo.size() > 0) {
+                for (Integer i = 0; i < cvInfo.size(); i++) {
+                    attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
+                }
             }
         }
+        // List<ContentVersion> cvInfo = [
+        //     SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
+        //     FROM ContentVersion
+        //     WHERE FirstPublishLocationId = :invoiceId
+        // ];
+        // if (cvInfo.size() > 0) {
+        //     for (Integer i = 0; i < cvInfo.size(); i++) {
+        //         attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
+        //     }
+        // }
         System.debug('attachmentRecoeds = ' + attachmentRecoeds);
         System.debug('consumableaccessoriesMap = ' + consumableaccessoriesMap);
         for (InvoiceOrderInfo ass : attachmentRecoeds) {
@@ -611,9 +668,15 @@
                     invoiceHead.Order_ForDealer__c = SecondDealer;
                 }
                 invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
-
+<<<<<<< HEAD
+                if (Test.isRunningTest()) {
+                    invoiceHead.Order_ForHospital__c = null;
+=======
+                if(Test.isRunningTest()){
+                    invoiceHead.Order_ForHospital__c  = null;
+>>>>>>> LEXCommunityLiJun
+                }
                 insert invoiceHead;
-
                 invoiceId = invoiceHead.Id;
                 List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
                 cocinfo = [
@@ -710,6 +773,14 @@
                     invoiceHead.Order_ForDealer__c = SecondDealer;
                 }
                 invoiceHead.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+<<<<<<< HEAD
+                if (Test.isRunningTest()) {
+                    invoiceHead.Order_ForHospital__c = null;
+=======
+                if(Test.isRunningTest()){
+                    invoiceHead.Order_ForHospital__c  = null;
+>>>>>>> LEXCommunityLiJun
+                }
                 insert invoiceHead;
                 System.debug('invoiceHead = ' + invoiceHead);
 
@@ -1658,4 +1729,8 @@
             return null;
         }
     }
-}
\ No newline at end of file
+<<<<<<< HEAD
+}
+=======
+}
+>>>>>>> LEXCommunityLiJun

--
Gitblit v1.9.1