From fd9df05c48c09b4d7f39a3b401882bda226dedea Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 31 十月 2023 20:38:18 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/classes/GuaranteePeriodAlterationController.cls |   48 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/classes/GuaranteePeriodAlterationController.cls b/force-app/main/default/classes/GuaranteePeriodAlterationController.cls
index 6b3029d..b262edd 100644
--- a/force-app/main/default/classes/GuaranteePeriodAlterationController.cls
+++ b/force-app/main/default/classes/GuaranteePeriodAlterationController.cls
@@ -48,7 +48,7 @@
     public String Id  { get; set; }
     public Boolean isShow { get; set; }
     public List<Attachment> attachments { get; set; }
-	public List<ContentDocument> contents { get; set; }
+	public List<ContentDocument> contents { get; set; }//update by liwentao 鏇存柊lightning闄勪欢涓婁紶
     //鍒嗛〉鍔熻兘
     public Integer pageLimit{get;set;}
     public String soql {get;set;}
@@ -66,14 +66,18 @@
         pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize);
 
         attachments = new List<Attachment>();
-        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
-                                                   FROM ContentDocumentLink
-                                                   WHERE LinkedEntityId = :Id];
-        List<ID> fileIDs = new List<ID>();
-        for (ContentDocumentLink docLink : cdlList) {
-            fileIDs.add(docLink.ContentDocumentId);
+        //update 鏉庢枃娑� 2023/07/13 鏇存柊lightning闄勪欢涓婁紶 start
+        if(String.isNotBlank(Id)){
+            List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+                                                       FROM ContentDocumentLink
+                                                       WHERE LinkedEntityId = :Id];
+            List<ID> fileIDs = new List<ID>();
+            for (ContentDocumentLink docLink : cdlList) {
+                fileIDs.add(docLink.ContentDocumentId);
+            }
+            contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
         }
-        contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
+        //update 鏉庢枃娑� 2023/07/13 鏇存柊lightning闄勪欢涓婁紶 end
     }
 
     // 鐢婚潰鍒濆鍖�
@@ -155,6 +159,22 @@
             attachments = seekAttachment();
         } 
     }
+    public void refreshFile(){
+        if(String.isBlank(id)){
+            return;
+        }
+        // 20231103   Lightning鏂囦欢淇敼 Start
+        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+                                                   FROM ContentDocumentLink
+                                                   WHERE LinkedEntityId = :Id];
+        List<ID> fileIDs = new List<ID>();
+        for (ContentDocumentLink docLink : cdlList) {
+            fileIDs.add(docLink.ContentDocumentId);
+        }
+        contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
+        // contents=null;
+        // 20231103   Lightning鏂囦欢淇敼 End
+    }
     // 妫�绱�
     public void searchConsumableorderdetails() {
         
@@ -189,14 +209,14 @@
         }
         if (String.isNotBlank(Statu_AchievementsId)) {
             statu_AchievementId = Statu_AchievementsId;
-        }  else {
+        }  else if(String.isNotBlank(ambc.GpaaStatu_Achievements__c)) {
             statu_AchievementId = ambc.GpaaStatu_Achievements__c;
+        } else{
+            statu_AchievementId='';
         }
-        statu_AchievementId='';
         String soql = 'select Id,name,SerialNumber,Asset_situation__c,Order_No__c,Account.Name,Status,Installation_Site__c,CurrentContract__c,guarantee_period__c,RepairQuantity__c from Asset where Backorder__c = \'' + statu_AchievementId +'\'';
         soql += ' AND AssetMark__c != \'鑰楁潗\'';
         if(!String.isBlank(text1)){
-
                 soql += ' AND ('+ text1 +' like \'%' + String.escapeSingleQuotes(val1.replaceAll('%', '\\%')) + '%\' )';
         }
         soql += ' limit 200';
@@ -260,13 +280,15 @@
         ref.setRedirect(true);
         return ref;
     }
+    //update 鏉庢枃娑� 2023/07/13 鏇存柊lightning闄勪欢涓婁紶 start
     //璺宠浆鍒颁笂浼犻檮浠堕〉闈ightning
     public PageReference uploadingAttachmentLightning(){
         //PageReference ref = new Pagereference('/p/attach/NoteAttach?pid=' + Id +'&retURL=%2Fapex/AssetGuaranteePeriodAlteration?Id='+Id);
-        PageReference ref = new Pagereference('/lightning/n/lightning?objectApiName&context=RECORD_DETAIL&backgroundContext=%2Flightning%2Fr%2FAssetGuaranteePeriodAlteration__c%2F'+Id+'%2Fedit%3F0.source%3DalohaHeader&0.recordId='+Id+'');
+        PageReference ref = new Pagereference('/lightning/n/LexUploadPage?0.recordId='+Id+'');
         ref.setRedirect(true);
         return ref;
     }
+    //update 鏉庢枃娑� 2023/07/13 鏇存柊lightning闄勪欢涓婁紶 start
     //鏌ユ壘"淇濇湁璁惧"鏄惁鍚湁"QIS"鍜�"淇悊"鍜�"淇濇湁璁惧鐨勪繚淇湡闄愬彉鏇磋繃"
     public Boolean find_QIS_Repair(List<String> assetIdList) {
 
@@ -311,7 +333,7 @@
         GuaranteePeriodAlterationApplication__c  agAlteration = new GuaranteePeriodAlterationApplication__c();
         agAlteration.Id = Id;
         attachments = seekAttachment();
-        if (ambc.ChangeReason__c == '闆嗕腑閲囪喘,鏈垎閰嶅埌鍖婚櫌' && attachments.size() == 0) {
+        if (ambc.ChangeReason__c == '闆嗕腑閲囪喘,鏈垎閰嶅埌鍖婚櫌' && contents.size() == 0) {
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇蜂笂浼犳爣涔�')); 
             return null;
         }  

--
Gitblit v1.9.1