From 254ea442ff0e0a7a97e9f481e9f127a782cba840 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 17 七月 2023 11:37:35 +0800
Subject: [PATCH] 修改附件7.17

---
 force-app/main/default/pages/AssetModifyBelongs.page                           |   27 +-
 force-app/main/default/classes/BatchSelectRepairPDFDelete.cls                  |  105 +++++++-
 force-app/main/default/classes/eSignHospitalConfirmController.cls              |   55 +++-
 force-app/main/default/pages/AssetQR.page                                      |   61 +++-
 force-app/main/default/pages/AssetQR.page-meta.xml                             |    2 
 force-app/main/default/pages/eSignFormAttachment.page                          |   26 +-
 force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls          |  100 +++++++-
 force-app/main/default/classes/MaintenanceProductDataController.cls            |    2 
 force-app/main/default/classes/OPDPlanHandler.cls                              |   84 +++++-
 force-app/main/default/classes/ConsumTrialPDFController.cls                    |    7 
 force-app/main/default/pages/AssetGuaranteePeriodAlteration.page               |   24 +
 force-app/main/default/pages/ConsumApplyQR.page                                |   41 ++
 force-app/main/default/pages/OFSRepairConsignPDF.page                          |    2 
 force-app/main/default/classes/GuaranteePeriodAlterationController.cls         |   21 +
 force-app/main/default/classes/BidAnnounceIframeController.cls                 |   25 +
 force-app/main/default/classes/eSignAgencyPageController.cls                   |   58 +++-
 force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls-meta.xml |    2 
 force-app/main/default/classes/BatchSelectRepairPDFDelete.cls-meta.xml         |    2 
 force-app/main/default/classes/BidAnnounceIframeController.cls-meta.xml        |    2 
 force-app/main/default/pages/ConsumApplyQR.page-meta.xml                       |    2 
 force-app/main/default/pages/ConsumApplyBR.page                                |   38 ++
 force-app/main/default/pages/OFSRepairConsignPDFOuter.page                     |    1 
 22 files changed, 510 insertions(+), 177 deletions(-)

diff --git a/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls b/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls
index 9083f5f..40a7703 100644
--- a/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls
+++ b/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls
@@ -1,35 +1,104 @@
 public without sharing class BatchSelectRepairPDFDelete {
     public void deletePDF(List<Repair__c> repList){
-    	List<String> attachmentNameList = new List<String>();
-        List<Attachment> isGeneratedPDFList = new List<Attachment>();
-    	for(Repair__c re : repList){   
-          	attachmentNameList.add(re.name + '_' + 'MaintenanceCommission.pdf');
+        //淇敼鍒犻櫎闄勪欢锛屾敼涓哄垹闄ゆ枃浠讹紙lightning鏀归�狅級
+        List<String> attachmentNameList = new List<String>();
+        List<Id> parentIdList = new List<Id>();
+        List<ContentDocumentLink> isGeneratedPDFLinkList = new List<ContentDocumentLink>();
+        List<ContentDocument> isGeneratedPDFList = new List<ContentDocument>();
+        for(Repair__c re : repList){   
+            attachmentNameList.add(re.name + '_' + 'MaintenanceCommission.pdf');
+            parentIdList.add(re.Id);
         }
-        isGeneratedPDFList = [select id from Attachment where name IN:attachmentNameList];
-        System.debug(LoggingLevel.INFO, '*** isGeneratedPDFList: ' + isGeneratedPDFList);
+        isGeneratedPDFLinkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in: parentIdList];
+        List<Id> attachmentIdList = new List<Id>();
+        for (ContentDocumentLink PDFLink : isGeneratedPDFLinkList) {
+            attachmentIdList.add(PDFLink.ContentDocumentId);
+        }
+        isGeneratedPDFList = [select Id from ContentDocument where Id in: attachmentIdList and Title in: attachmentNameList];
         if(isGeneratedPDFList.size() > 0){
             delete isGeneratedPDFList;
         }
+        
+
+
+
+
+
+
+
+
+    	// List<String> attachmentNameList = new List<String>();
+        // List<Attachment> isGeneratedPDFList = new List<Attachment>();
+    	// for(Repair__c re : repList){   
+        //   	attachmentNameList.add(re.name + '_' + 'MaintenanceCommission.pdf');
+        // }
+        // isGeneratedPDFList = [select id from Attachment where name IN:attachmentNameList];
+        // System.debug(LoggingLevel.INFO, '*** isGeneratedPDFList: ' + isGeneratedPDFList);
+        // if(isGeneratedPDFList.size() > 0){
+        //     delete isGeneratedPDFList;
+        // }
     }
 
     public void createPDF(List<Repair__c> repList){
-    	PageReference pdfPage;
-        List<Attachment> attachments = new List<Attachment>();
-    	for(Repair__c re : repList){       
-          	pdfPage = new PageReference('/apex/MaintenanceCommissionPDF?id=' + re.Id);
+    	// PageReference pdfPage;
+        // List<Attachment> attachments = new List<Attachment>();
+    	// for(Repair__c re : repList){       
+        //   	pdfPage = new PageReference('/apex/MaintenanceCommissionPDF?id=' + re.Id);
+        //     Blob pdfBody;
+        //     if(System.Test.isRunningTest()) { 
+        //         pdfBody = blob.valueOf('Unit.Test');
+        //     } else {
+        //         pdfBody = pdfPage.getContentAsPDF();
+        //     }
+        //     Attachment attach = new Attachment();
+        //     attach.Body = pdfBody;
+        //     attach.Name = re.name + '_' + 'MaintenanceCommission.pdf';
+        //     attach.ParentId = re.id;
+        //     attachments.add(attach);
+        // }
+        // System.debug(LoggingLevel.INFO, '*** attachments: ' + attachments);
+        // insert attachments;
+
+        PageReference pdfPage;
+        List<ContentVersion> versions = new List<ContentVersion>();
+        for(Repair__c re : repList){       
+            pdfPage = new PageReference('/apex/MaintenanceCommissionPDF?id=' + re.Id);
             Blob pdfBody;
             if(System.Test.isRunningTest()) { 
                 pdfBody = blob.valueOf('Unit.Test');
             } else {
                 pdfBody = pdfPage.getContentAsPDF();
             }
-            Attachment attach = new Attachment();
-            attach.Body = pdfBody;
-            attach.Name = re.name + '_' + 'MaintenanceCommission.pdf';
-            attach.ParentId = re.id;
-            attachments.add(attach);
+            ContentVersion version = new ContentVersion();
+            version.VersionData = pdfBody;
+            version.Title = re.name + '_' + 'MaintenanceCommission.pdf';
+            version.ContentLocation = 's';
+            version.PathOnClient = re.name + '_' + 'MaintenanceCommission.pdf';
+            versions.add(version);
         }
-        System.debug(LoggingLevel.INFO, '*** attachments: ' + attachments);
-        insert attachments;
-    	}
+        if (versions.size() > 0) {
+            insert versions;
+        }
+        List<Id> idList = new List<Id>();
+        for (ContentVersion newVersion : versions) {
+            idList.add(newVersion.Id);
+        }
+        versions = [select ContentDocumentId from ContentVersion where Id in: idList];
+        List<ContentDocumentLink> links = new List<ContentDocumentLink>();
+        Integer i = 0;
+        for (ContentVersion newVersion : versions) {
+            ContentDocumentLink link = new ContentDocumentLink();
+            link.ContentDocumentId = newVersion.ContentDocumentId;
+            link.LinkedEntityId = repList[i].Id;
+            link.ShareType = 'I';
+            link.Visibility = 'AllUsers';
+            links.add(link);
+            i++;
+        }
+        if (links.size() > 0) {
+            insert links;
+        }
+
+    }
+
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls-meta.xml b/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls-meta.xml
index 91b23b8..800e53c 100644
--- a/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls-meta.xml
+++ b/force-app/main/default/classes/BatchSelectRepairPDFDelete.cls-meta.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>46.0</apiVersion>
+    <apiVersion>43.0</apiVersion>
     <status>Active</status>
 </ApexClass>
diff --git a/force-app/main/default/classes/BidAnnounceIframeController.cls b/force-app/main/default/classes/BidAnnounceIframeController.cls
index 2d424a7..68b19cb 100644
--- a/force-app/main/default/classes/BidAnnounceIframeController.cls
+++ b/force-app/main/default/classes/BidAnnounceIframeController.cls
@@ -8,17 +8,24 @@
     
     public void init() {
         Bid_Announcement__c bid = [select Id, Web_URL__c, Web_URL_ModifiedDate__c from Bid_Announcement__c where Id = :recordId];
-        List<Attachment> attList = [select Id, LastModifiedDate from Attachment where ParentId = :recordId order by LastModifiedDate desc limit 1];
-        Attachment att = null;
-        if (attList.size() > 0) {
-            att = attList[0];
+        // List<Attachment> attList = [select Id, LastModifiedDate from Attachment where ParentId = :recordId order by LastModifiedDate desc limit 1];
+        List<ContentDocumentLink> links = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId =: recordId];
+        List<Id> idList = new List<Id>();
+        for (ContentDocumentLink link : links) {
+            idList.add(link.ContentDocumentId);
+        }
+        List<ContentDocument> docList = [select Id,ContentModifiedDate from ContentDocument where Id in: idList order by ContentModifiedDate desc limit 1];
+        // Attachment att = null;
+        ContentDocument doc = null;
+        if (docList.size() > 0) {
+            doc = docList[0];
         }
         
         if (bid.Web_URL__c != null) {
             // 涓爣閫氱煡涔RL鏇存柊鏃堕棿銆�銇ㄣ��鏈�鏂癆ttachment銇檪闁撱仺姣旇純銆佹柊銇椼亜銈傘伄銈掗仼鐢�
-            if (att != null) {
-                if (bid.Web_URL_ModifiedDate__c < att.LastModifiedDate) {
-                    iframe = '/servlet/servlet.FileDownload?file=' + att.Id;
+            if (doc != null) {
+                if (bid.Web_URL_ModifiedDate__c < doc.ContentModifiedDate) {
+                    iframe = '/lightning/r/ContentDocument/' + doc.Id + '/view';
                 } else {
                     iframe = bid.Web_URL__c;
                 }
@@ -29,8 +36,8 @@
             }
         } else {
             // Attachment銈掗仼鐢�
-            if (att != null) {
-                iframe = '/servlet/servlet.FileDownload?file=' + att.Id;
+            if (doc != null) {
+                iframe = '/lightning/r/ContentDocument/' + doc.Id + '/view';
             }
         }
     }
diff --git a/force-app/main/default/classes/BidAnnounceIframeController.cls-meta.xml b/force-app/main/default/classes/BidAnnounceIframeController.cls-meta.xml
index f165265..91b23b8 100644
--- a/force-app/main/default/classes/BidAnnounceIframeController.cls-meta.xml
+++ b/force-app/main/default/classes/BidAnnounceIframeController.cls-meta.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>29.0</apiVersion>
+    <apiVersion>46.0</apiVersion>
     <status>Active</status>
 </ApexClass>
diff --git a/force-app/main/default/classes/ConsumTrialPDFController.cls b/force-app/main/default/classes/ConsumTrialPDFController.cls
index 7c8c801..d605b5e 100644
--- a/force-app/main/default/classes/ConsumTrialPDFController.cls
+++ b/force-app/main/default/classes/ConsumTrialPDFController.cls
@@ -224,10 +224,11 @@
     }
 
     public static string GetImageBase64(string id){
-        List<Attachment> atts = [SELECT Id, IsDeleted, ParentId, Name, IsPrivate, ContentType, BodyLength, Body, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Description FROM Attachment where id=:id];
-        if (atts.size()==0) {
+        List<ContentVersion> version = [select VersionData from ContentVersion where ContentDocumentId =: id];
+        // List<Attachment> atts = [SELECT Id, IsDeleted, ParentId, Name, IsPrivate, ContentType, BodyLength, Body, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Description FROM Attachment where id=:id];
+        if (version.size()==0) {
             return null;
         }
-        return 'data:image/png;base64,' + EncodingUtil.base64Encode(atts[0].body);
+        return 'data:image/png;base64,' + EncodingUtil.base64Encode(version[0].VersionData);
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/GuaranteePeriodAlterationController.cls b/force-app/main/default/classes/GuaranteePeriodAlterationController.cls
index 4dfc08a..6b3029d 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 Integer pageLimit{get;set;}
     public String soql {get;set;}
@@ -57,7 +57,7 @@
         isShow = false;
         Statu_AchievementsId = ApexPages.currentPage().getParameters().get('Statu_AchievementsId');
         Id = ApexPages.currentPage().getParameters().get('Id');
-
+		System.debug('id:'+Id+'   and sId:'+Statu_AchievementsId);
         statusEdit = ApexPages.currentPage().getParameters().get('KeyWords');
         guaranteePeriodAlterationDetailRecords = new List<GuaranteePeriodAlterationDetailInfo>();
         guaranteePeriodAlterationDetaiRecordsview = new List<GuaranteePeriodAlterationDetailInfo>();
@@ -66,6 +66,14 @@
         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);
+        }
+        contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
     }
 
     // 鐢婚潰鍒濆鍖�
@@ -184,6 +192,7 @@
         }  else {
             statu_AchievementId = ambc.GpaaStatu_Achievements__c;
         }
+        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)){
@@ -251,7 +260,13 @@
         ref.setRedirect(true);
         return ref;
     }
-
+    //璺宠浆鍒颁笂浼犻檮浠堕〉闈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+'');
+        ref.setRedirect(true);
+        return ref;
+    }
     //鏌ユ壘"淇濇湁璁惧"鏄惁鍚湁"QIS"鍜�"淇悊"鍜�"淇濇湁璁惧鐨勪繚淇湡闄愬彉鏇磋繃"
     public Boolean find_QIS_Repair(List<String> assetIdList) {
 
diff --git a/force-app/main/default/classes/MaintenanceProductDataController.cls b/force-app/main/default/classes/MaintenanceProductDataController.cls
index 016221e..f75b185 100644
--- a/force-app/main/default/classes/MaintenanceProductDataController.cls
+++ b/force-app/main/default/classes/MaintenanceProductDataController.cls
@@ -1104,7 +1104,7 @@
         // PageReference ref = new Pagereference('/p/attach/NoteAttach?pid='+id+'&retURL=%2F' + '/apex/MaintenanceProductData?id=' +id);
         // ref.setRedirect(true);
         // return ref;
-        PageReference ref = new Pagereference('/lightning/n/lightning?backgroundContext=%2Flightning%2Fr%2FAssetModifyBelongsChange__c%2F'+id+'%2Fedit%3Fcount%3D1&0.recordId='+id+'');
+        PageReference ref = new Pagereference('/lightning/n/lightning?backgroundContext=%2Flightning%2Fr%2FMaintenance_Product_Data__c%2F'+id+'%2Fedit%3Fcount%3D1&0.recordId='+id+'');
         ref.setRedirect(true);
         return ref;
     }
diff --git a/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls b/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls
index 49701be..a089c99 100644
--- a/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls
+++ b/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls
@@ -10,45 +10,113 @@
     
     public void saveSign() {
         // Sign鐢诲儚銇竴銇ゃ仹銇勩亜銇樸們銇亜锛烡elete鈬扞nsert銇仚銈�
-        List<Attachment> atts = [select Id from Attachment where ParentId = :rp.Id and Name = :(rp.Name + '_Sign')];
-        if (atts.size() > 0) delete atts;
+        // List<Attachment> atts = [select Id from Attachment where ParentId = :rp.Id and Name = :(rp.Name + '_Sign')];
+        // if (atts.size() > 0) delete atts;
         
-        Attachment ac = new Attachment();
-        ac.Body = EncodingUtil.base64Decode(this.signStr.removeStart('data:image/png;base64,'));
-        ac.Name = rp.Name + '_Sign';
-        ac.ParentId = rp.Id;
-        ac.ContentType = 'jpg';
+        // Attachment ac = new Attachment();
+        // ac.Body = EncodingUtil.base64Decode(this.signStr.removeStart('data:image/png;base64,'));
+        // ac.Name = rp.Name + '_Sign';
+        // ac.ParentId = rp.Id;
+        // ac.ContentType = 'jpg';
+        // try {
+        //     insert ac;
+        //     rp.Sign__c = '<img src="/servlet/servlet.FileDownload?file=' + ac.Id + '"/>';
+        //     rp.SignUrl__c = '/servlet/servlet.FileDownload?file=' + ac.Id;
+        //     rp.SignDate__c = Date.today();
+        //     update rp;
+        // } catch (Exception ex) {
+        //     ApexPages.addMessages(ex);
+        //     //return;
+        // }
+
+
+
+        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
+                                                   FROM ContentDocumentLink
+                                                   WHERE LinkedEntityId = :rp.Id];
+        List<ID> fileIDs = new List<ID>();
+        for (ContentDocumentLink docLink : cdlList) {
+            fileIDs.add(docLink.ContentDocumentId);
+        }
+        List<ContentDocument> attachmentinfo=[SELECT Title,OwnerId from ContentDocument WHERE id IN :fileIDs and Title =: (rp.Name + '_Sign')];
+        if (attachmentinfo.size() > 0) delete attachmentinfo;
+        ContentVersion contVerFile = new ContentVersion();
+        contVerFile.VersionData = EncodingUtil.base64Decode(this.signStr.removeStart('data:image/png;base64,'));
+        contVerFile.Title = rp.Name + '_Sign';
+        contVerFile.ContentLocation= 's';
+        contVerFile.PathOnClient=rp.Name + '_Sign.jpg';
+        insert contVerFile;
+        Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:contVerFile.Id].ContentDocumentId;
+        ContentDocumentLink cDe = new ContentDocumentLink();
+        cDe.ContentDocumentId = conDoc;
+        cDe.LinkedEntityId = rp.Id;
+        cDe.ShareType = 'I';
+        cDe.Visibility = 'AllUsers';
+        insert cDe;
         try {
-            insert ac;
-            rp.Sign__c = '<img src="/servlet/servlet.FileDownload?file=' + ac.Id + '"/>';
-            rp.SignUrl__c = '/servlet/servlet.FileDownload?file=' + ac.Id;
+            
+            rp.Sign__c = '<img src="/lightning/r/ContentDocument/' + contVerFile.ContentDocumentId + '/view"/>';
+            rp.SignUrl__c = '/lightning/r/ContentDocument/' + contVerFile.ContentDocumentId + '/view';
             rp.SignDate__c = Date.today();
             update rp;
         } catch (Exception ex) {
             ApexPages.addMessages(ex);
             //return;
         }
+
+        
     }
     
     public void savePDF() {
+        // String pdfPageURL = '/apex/OFSRepairConsignPDF?id=' + rp.Id;
+        // PageReference pageRef = new PageReference(pdfPageURL);
+
+        // Attachment att = new Attachment();
+        // // TODO TestMethod銇痝etContent銈掋偟銉濄兗銉堛仐銇亜
+        // if (!Test.isRunningTest()) {
+        //     att.body = pageRef.getContent();
+        // } else {
+        //     att.body = EncodingUtil.base64Decode('test');
+        // }
+        // att.Name = rp.Name + '_缁翠慨濮旀墭涔' + String.valueOf(Datetime.now()) + '.pdf';
+        // att.ParentId = rp.Id;
+        // try {
+        //     insert att;
+        // } catch (Exception ex) {
+        //     ApexPages.addMessages(ex);
+        //     //return;
+        // }
+
+
         String pdfPageURL = '/apex/OFSRepairConsignPDF?id=' + rp.Id;
         PageReference pageRef = new PageReference(pdfPageURL);
 
-        Attachment att = new Attachment();
+        ContentVersion contVerFile = new ContentVersion();
         // TODO TestMethod銇痝etContent銈掋偟銉濄兗銉堛仐銇亜
         if (!Test.isRunningTest()) {
-            att.body = pageRef.getContent();
+            contVerFile.VersionData = pageRef.getContent();
         } else {
-            att.body = EncodingUtil.base64Decode('test');
+            contVerFile.VersionData = EncodingUtil.base64Decode('test');
         }
-        att.Name = rp.Name + '_缁翠慨濮旀墭涔' + String.valueOf(Datetime.now()) + '.pdf';
-        att.ParentId = rp.Id;
+        contVerFile.Title = rp.Name + '_缁翠慨濮旀墭涔' + String.valueOf(Datetime.now()) + '.pdf';
+        contVerFile.ContentLocation= 's';
+        contVerFile.PathOnClient=rp.Name + '_缁翠慨濮旀墭涔' + String.valueOf(Datetime.now()) + '.pdf';
+        // att.ParentId = rp.Id;
         try {
-            insert att;
+            insert contVerFile;
+            Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:contVerFile.Id].ContentDocumentId;
+            ContentDocumentLink cDe = new ContentDocumentLink();
+            cDe.ContentDocumentId = conDoc;
+            cDe.LinkedEntityId = rp.Id;
+            cDe.ShareType = 'I';
+            cDe.Visibility = 'AllUsers';
+            insert cDe;
         } catch (Exception ex) {
             ApexPages.addMessages(ex);
             //return;
         }
+
+
     }
     
     private Repair__c getReportData(String id) {
diff --git a/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls-meta.xml b/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls-meta.xml
index f165265..800e53c 100644
--- a/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls-meta.xml
+++ b/force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls-meta.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>29.0</apiVersion>
+    <apiVersion>43.0</apiVersion>
     <status>Active</status>
 </ApexClass>
diff --git a/force-app/main/default/classes/OPDPlanHandler.cls b/force-app/main/default/classes/OPDPlanHandler.cls
index 7540370..bd9837c 100644
--- a/force-app/main/default/classes/OPDPlanHandler.cls
+++ b/force-app/main/default/classes/OPDPlanHandler.cls
@@ -666,25 +666,75 @@
                     insert insertCloneList;
                 }
             }
-            List<Attachment> getAttachmentList = [SELECT Id, Body, Name, ParentId
-                                        FROM Attachment
-                                        WHERE ParentId In:reapplyopdMap.keySet()];
-            List<Attachment> insertAttachmentCloneList = new List<Attachment>();
-            if (getAttachmentList.size() > 0 ) {
-                for(Attachment att :getAttachmentList){
-                    Attachment attClone = new Attachment();
-                    attClone = att.clone();
-                    attClone.Id = null;
-                    attClone.Body = att.Body;
-                    attClone.Name = att.Name;
-                    attClone.ParentId = reapplyopdMap.get(att.ParentId);
-                    insertAttachmentCloneList.add(attClone);
-                }
 
-                if (insertAttachmentCloneList.size() > 0) {
-                    insert insertAttachmentCloneList;
-                }
+
+            List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId,LinkedEntityId
+                                                   FROM ContentDocumentLink
+                                                   WHERE LinkedEntityId In:reapplyopdMap.keySet()];
+            List<ID> fileIDs = new List<ID>();
+            for (ContentDocumentLink docLink : cdlList) {
+                fileIDs.add(docLink.ContentDocumentId);
             }
+            List<ContentDocument> attachmentinfo=[SELECT Id,Title,OwnerId from ContentDocument WHERE id IN :fileIDs];
+            List<Id> idList = new List<Id>();
+            for (ContentDocument attachment : attachmentinfo) {
+                idList.add(attachment.Id);
+            }
+            List<ContentVersion> versionList = [select Id,VersionData,Title,ContentLocation,PathOnClient from ContentVersion where ContentDocumentId in: idList];
+            List<ContentVersion> newVersionList = new List<ContentVersion>();
+            for (ContentVersion version : versionList) {
+                ContentVersion newVersion = new ContentVersion();
+                newVersion = version.clone();
+                newVersion.Id = null;
+                newVersion.VersionData = version.VersionData;
+                newVersion.Title = version.Title;
+                newVersion.ContentLocation = version.ContentLocation;
+                newVersion.PathOnClient = version.PathOnClient;
+                newVersionList.add(newVersion);
+            }
+
+            if (newVersionList.size() > 0) {
+                insert newVersionList;
+            }
+            idList = new List<Id>();
+            for (ContentVersion newVersion : newVersionList) {
+                idList.add(newVersion.Id);
+            }
+            newVersionList = [SELECT ContentDocumentId FROM ContentVersion WHERE Id IN:idList];
+            List<ContentDocumentLink> linkList = new List<ContentDocumentLink>();
+            Integer i = 0;
+            for (ContentVersion newVersion : newVersionList) {
+                ContentDocumentLink link = new ContentDocumentLink();
+                link.ContentDocumentId = newVersion.ContentDocumentId;
+                link.LinkedEntityId = reapplyopdMap.get(cdlList[i].LinkedEntityId);
+                link.ShareType = 'I';
+                link.Visibility = 'AllUsers';
+                linkList.add(link);
+                i++;
+            }
+            if (linkList.size() > 0) {
+                insert linkList;
+            }
+            
+            // List<Attachment> getAttachmentList = [SELECT Id, Body, Name, ParentId
+            //                             FROM Attachment
+            //                             WHERE ParentId In:reapplyopdMap.keySet()];
+            // List<Attachment> insertAttachmentCloneList = new List<Attachment>();
+            // if (getAttachmentList.size() > 0 ) {
+            //     for(Attachment att :getAttachmentList){
+            //         Attachment attClone = new Attachment();
+            //         attClone = att.clone();
+            //         attClone.Id = null;
+            //         attClone.Body = att.Body;
+            //         attClone.Name = att.Name;
+            //         attClone.ParentId = reapplyopdMap.get(att.ParentId);
+            //         insertAttachmentCloneList.add(attClone);
+            //     }
+
+            //     if (insertAttachmentCloneList.size() > 0) {
+            //         insert insertAttachmentCloneList;
+            //     }
+            // }
     }
 
     private void updateOppPlan() {
diff --git a/force-app/main/default/classes/eSignAgencyPageController.cls b/force-app/main/default/classes/eSignAgencyPageController.cls
index e8bf4cb..1e143d1 100644
--- a/force-app/main/default/classes/eSignAgencyPageController.cls
+++ b/force-app/main/default/classes/eSignAgencyPageController.cls
@@ -354,41 +354,59 @@
     public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
         base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
  
-        Attachment oAttachment = new Attachment();
-        oAttachment.parentId = parentId;
+        // Attachment oAttachment = new Attachment();
+        // oAttachment.parentId = parentId;
  
-        oAttachment.Body = EncodingUtil.base64Decode(base64Data);
-        oAttachment.Name = fileName;
-        oAttachment.ContentType = contentType;
+        // oAttachment.Body = EncodingUtil.base64Decode(base64Data);
+        // oAttachment.Name = fileName;
+        // oAttachment.ContentType = contentType;
  
-        insert oAttachment;
- 
-        return oAttachment.Id;
+        // insert oAttachment;
+        ContentVersion version = new ContentVersion();
+        version.Title = fileName;
+        version.VersionData = EncodingUtil.base64Decode(base64Data);
+        version.ContentLocation = 's';
+        version.PathOnClient = fileName + '.' +contentType;
+        insert version;
+        version = [select ContentDocumentId from ContentVersion where Id =: version.Id limit 1];
+        ContentDocumentLink link = new ContentDocumentLink();
+        link.ContentDocumentId = version.ContentDocumentId;
+        link.LinkedEntityId = parentId;
+        link.ShareType = 'I';
+        link.Visibility = 'AllUsers';
+        insert link;
+
+        return link.ContentDocumentId;
     }
  
     private static void appendToFile(Id fileId, String base64Data) {
         base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
  
-        Attachment a = [
-            SELECT Id, Body
-            FROM Attachment
-            WHERE Id =: fileId
-        ];
+        // Attachment a = [
+        //     SELECT Id, Body
+        //     FROM Attachment
+        //     WHERE Id =: fileId
+        // ];
+        ContentVersion version = [select Id,VersionData from ContentVersion where ContentDocumentId =: fileId];
  
-        String existingBody = EncodingUtil.base64Encode(a.Body);
+        // String existingBody = EncodingUtil.base64Encode(a.Body);
+        String existingBody = EncodingUtil.base64Encode(version.VersionData);
  
-        a.Body = EncodingUtil.base64Decode(existingBody + base64Data);
+        // a.Body = EncodingUtil.base64Decode(existingBody + base64Data);
+        version.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
  
-        update a;
+        update version;
     }
 
     //鏂囦欢鍒犻櫎鍔熻兘  绮剧悽鎶�鏈� thh 2021-09-26 start
     @AuraEnabled
     public static void deleteChunk(Id AttachmentId) {
-        Attachment attachment = new Attachment();
-        attachment.id = AttachmentId;
-
-        delete attachment;
+        // Attachment attachment = new Attachment();
+        // attachment.id = AttachmentId;
+        ContentDocument con = new ContentDocument();
+        con.Id = AttachmentId;
+        delete con;
+        // delete attachment;
     }
     //鏂囦欢鍒犻櫎鍔熻兘  绮剧悽鎶�鏈� thh 2021-09-26 end
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/eSignHospitalConfirmController.cls b/force-app/main/default/classes/eSignHospitalConfirmController.cls
index 0f772c2..1693f12 100644
--- a/force-app/main/default/classes/eSignHospitalConfirmController.cls
+++ b/force-app/main/default/classes/eSignHospitalConfirmController.cls
@@ -207,41 +207,60 @@
     public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
         base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
  
-        Attachment oAttachment = new Attachment();
-        oAttachment.parentId = parentId;
+        ContentVersion version = new ContentVersion();
+        version.Title = fileName;
+        version.VersionData = EncodingUtil.base64Decode(base64Data);
+        version.ContentLocation = 's';
+        version.PathOnClient = fileName + '.' + contentType;
+        insert version;
+        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
+        ContentDocumentLink link = new ContentDocumentLink();
+        link.ContentDocumentId = version.ContentDocumentId;
+        link.LinkedEntityId = parentId;
+        link.ShareType = 'I';
+        link.Visibility = 'AllUsers';
+        insert link;
+        // Attachment oAttachment = new Attachment();
+        // oAttachment.parentId = parentId;
  
-        oAttachment.Body = EncodingUtil.base64Decode(base64Data);
-        oAttachment.Name = fileName;
-        oAttachment.ContentType = contentType;
+        // oAttachment.Body = EncodingUtil.base64Decode(base64Data);
+        // oAttachment.Name = fileName;
+        // oAttachment.ContentType = contentType;
  
-        insert oAttachment;
+        // insert oAttachment;
  
-        return oAttachment.Id;
+        return link.ContentDocumentId;
     }
  
     private static void appendToFile(Id fileId, String base64Data) {
         base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
  
-        Attachment a = [
-            SELECT Id, Body
-            FROM Attachment
-            WHERE Id =: fileId
-        ];
+        // Attachment a = [
+        //     SELECT Id, Body
+        //     FROM Attachment
+        //     WHERE Id =: fileId
+        // ];
+        ContentVersion version = [select Id,VersionData from ContentVersion where ContentDocumentId =: fileId];
  
-        String existingBody = EncodingUtil.base64Encode(a.Body);
+        // String existingBody = EncodingUtil.base64Encode(a.Body);
+        String existingBody = EncodingUtil.base64Encode(version.VersionData);
  
-        a.Body = EncodingUtil.base64Decode(existingBody + base64Data);
+        // a.Body = EncodingUtil.base64Decode(existingBody + base64Data);
+        version.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
  
-        update a;
+        update version;
     }
     
     //鏂囦欢鍒犻櫎鍔熻兘  绮剧悽鎶�鏈� thh 2021-09-26 start
     @AuraEnabled
     public static void deleteChunk(Id AttachmentId) {
-        Attachment attachment = new Attachment();
-        attachment.id = AttachmentId;
+        // Attachment attachment = new Attachment();
+        // attachment.id = AttachmentId;
 
-        delete attachment;
+        // delete attachment;
+        ContentDocument con = new ContentDocument();
+        con.Id = AttachmentId;
+        delete con;
     }
     //鏂囦欢鍒犻櫎鍔熻兘  绮剧悽鎶�鏈� thh 2021-09-26 end
 }
\ No newline at end of file
diff --git a/force-app/main/default/pages/AssetGuaranteePeriodAlteration.page b/force-app/main/default/pages/AssetGuaranteePeriodAlteration.page
index 3f38171..94a7016 100644
--- a/force-app/main/default/pages/AssetGuaranteePeriodAlteration.page
+++ b/force-app/main/default/pages/AssetGuaranteePeriodAlteration.page
@@ -1,5 +1,7 @@
-<apex:page standardController="GuaranteePeriodAlterationApplication__c" extensions="GuaranteePeriodAlterationController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="淇濅慨鏈熷彉鏇寸敵璇�">
+<apex:page standardController="GuaranteePeriodAlterationApplication__c" extensions="GuaranteePeriodAlterationController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="淇濅慨鏈熷彉鏇寸敵璇�" lightningStylesheets="true">
 <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
+
 <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
 <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
 <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
@@ -137,7 +139,7 @@
         </apex:actionFunction>
          <apex:actionFunction name="DelConsumable" action="{!DelConsumable}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter()">
         </apex:actionFunction>
-        <apex:actionFunction name="uploadingAttachmentJs" action="{!uploadingAttachment}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter()">
+        <apex:actionFunction name="uploadingAttachmentJs" action="{!uploadingAttachmentLightning}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter()">
         </apex:actionFunction>
         <!-- <apex:actionFunction name="returnChangePage" action="{!returnChangePage}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter()">
         </apex:actionFunction> -->
@@ -150,6 +152,7 @@
         <apex:outputPanel id="allPanel">
             <apex:pageBlock id="allBlock" >
                 <apex:pageBlock id="EDCline_1" >
+                    <apex:commandButton style="display:none"/>
                     <apex:commandButton onclick="EditConsumable();"   value="缂栬緫" style="margin-left:30px;width:180px" rerender="dummy" rendered="{!!(editAble)}"  disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯'||ambc.Change_status__c='椹冲洖',true,false)}"/>
                    
                     <apex:commandButton onclick="SorderJs();"         value="鎻愪氦鐢宠" style="margin-left:30px;width:180px" rerender="dummy" rendered="{!!(editAble )}" disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯',true,false)}"/>
@@ -232,7 +235,7 @@
                             id="val1" style="width:100px"/>
                             </td>
                             <td align="right"></td>
-                            <td><apex:commandButton value="淇濇湁璁惧鎼滅储" style="width: 100px;" onclick="searchProductJs('0');return false;" /></td>
+                            <td><apex:commandButton value="淇濇湁璁惧鎼滅储" style="width: 120px;" onclick="searchProductJs('0');return false;" /></td>
                             <td><input type="button" value="娓呯┖" style="width: 100px;" onclick="ClearJs();return false;" class="btn"/></td>
                             <td/>
                         </tr>
@@ -243,7 +246,7 @@
 
                             <td colspan="3"/>
                          
-                            <td  colspan="4">&nbsp; &nbsp;&nbsp;&nbsp;鍙樻洿鍘熷洜锛�<!-- <apex:selectList value="{!ambc.ChangeReason__c}" id="changeReason01" size="1" style="width:204px" onchange="ChangeReasonjs('{!ambc.ChangeReason__c}');"><apex:selectOptions value="{!changeReasonOpts}"   />  -->
+                            <td  colspan="4" style="height:50px">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;鍙樻洿鍘熷洜锛�<!-- <apex:selectList value="{!ambc.ChangeReason__c}" id="changeReason01" size="1" style="width:204px" onchange="ChangeReasonjs('{!ambc.ChangeReason__c}');"><apex:selectOptions value="{!changeReasonOpts}"   />  -->
                             <!-- </apex:selectList> -->
                                 <apex:inputField value="{!ambc.ChangeReason__c}" style="width:200px"></apex:inputField>
                             </td>
@@ -256,7 +259,7 @@
                             <td colspan="3"/>
                             <!-- <td colspan="1"/> -->
                             <!-- <td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鍙樻洿鍘熷洜鍏朵粬锛�<apex:inputText value="{!ambc.ChangeReason_text__c}" style="width:200px"/></td> -->
-                             <td colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;瀹夎鏃ユ湡锛�<apex:outputField value="{!ambc.WarrantyStartDate__c}" style="width:200px"/></td>
+                             <td colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;瀹夎鏃ユ湡锛�<apex:outputField value="{!ambc.WarrantyStartDate__c}" style="width:200px"/></td>
                             <!-- <td colspan="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 淇濅慨澶╂暟锛�<apex:inputText value="{!ambc.WarrantyDays__c}" style="width:200px"/></td> -->
                             <!-- <td  colspan="4"/> -->
                         </tr>
@@ -268,6 +271,7 @@
                  </apex:outputPanel>
                 <apex:pageBlock title="淇濇湁璁惧鎵�灞炲彉鏇存槑缁�" id="ConsumableorderdetailsSection">
                 <input type="hidden" id="allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsCount" value="{!ConsumableorderdetailsviewCount}" />
+                <input type="hidden" id="allPage:allForm:allBlock:ConsumableorderdetailsSection:Id" value="{!Id}" />
                     <table class="list" border="0" cellpadding="0" cellspacing="0">
                         <tr class="headerRow">
                             <apex:variable var="v" value="" rendered="{!editAble}">
@@ -307,19 +311,19 @@
 
                 </apex:pageBlock>
                 <!-- CHAN-BC6BV2 XHL AddStart 20190522 -->
-                <apex:pageBlock title="闄勪欢" id="accessory" rendered="{!isShow}">
+                <apex:pageBlock title="鏂囦欢" id="accessory" rendered="{!isShow}">
                 
                     <apex:pageBlockButtons location="top">
-                        <apex:commandButton value="闄勪欢涓婁紶"  onclick="uploadingAttachmentJs();" disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯',true,false)}"/>
+                        <apex:commandButton value="鏂囦欢涓婁紶"  onclick="uploadingAttachmentJs();" disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯',true,false)}"/>
                     </apex:pageBlockButtons>
-                    <apex:pageBlockTable value="{!attachments}" var="attachment" >
+                    <apex:pageBlockTable value="{!contents}" var="attachment" >
                         
                         
                         <apex:column headerValue="鏍囬" style="width: 33%">
-                            <apex:outputField value="{!attachment.Name}"/>
+                            <apex:outputField value="{!attachment.Title}"/>
                         </apex:column>
                         <apex:column headerValue="涓婃淇敼鏃堕棿" style="width: 33%">
-                            <apex:outputField value="{!attachment.CreatedDate}"/>
+                            <apex:outputField value="{!attachment.ContentModifiedDate}"/>
                         </apex:column>
                         <apex:column headerValue="鍒涘缓浜�" style="width: 33%">
                             <apex:outputField value="{!attachment.OwnerId}"/>
diff --git a/force-app/main/default/pages/AssetModifyBelongs.page b/force-app/main/default/pages/AssetModifyBelongs.page
index 439cb07..647d4c1 100644
--- a/force-app/main/default/pages/AssetModifyBelongs.page
+++ b/force-app/main/default/pages/AssetModifyBelongs.page
@@ -224,8 +224,8 @@
                 <apex:pageBlock id="searchBlock" rendered="{!editAble}">
                     <table>
                         <colgroup>
-                            <col width="10px"/>
-                            <col width="10px"/>
+                            <col width="0px"/>
+                            <col width="0px"/>
                             <col width="60px"/>
                             <col width="85px"/>
                             <col width="60px"/>
@@ -242,14 +242,14 @@
                             <td align="right"></td>
                             <td></td>
                             <td/>
-                            <td align="right">閫夋嫨鏉′欢锛�</td>
+                            <td align="right">&nbsp;&nbsp;&nbsp;閫夋嫨鏉′欢锛�</td>
                             <td>
                              <apex:selectList value="{!text1}" id="text1" size="1" style="width:90px"><apex:selectOptions value="{!textOpts}"/>
                             </apex:selectList>
                             </td>                           
                             <td>
                             <apex:inputText value="{!val1}"
-                            id="val1" style="width:100px"/>
+                            id="val1" style="width:200px"/>
                             </td>
                             <td align="left"><div id="seachdiv">鍚堝悓缂栫爜绮剧‘鏌ヨ<apex:inputCheckbox value="{!checkexact}" id="RowCheckbox"/></div></td>
                             <td><apex:commandButton value="淇濇湁璁惧鎼滅储" style="width: 120px;" onclick="searchProductJs('0');return false;" /></td>
@@ -261,14 +261,14 @@
                         </tr>
                         <tr>
                             <td colspan="3"/>
-                            <td colspan="4">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;鍘熷鎴凤細<apex:outputField value="{!ambc.rawAccount__c}"/></td>
-                            <td colspan="4">鐩爣瀹㈡埛锛�<apex:inputField id="OEC" value="{!ambc.AccountField__c}" style="width:200px"/></td>
+                            <td colspan="4" style="height:50px;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;鍘熷鎴凤細<apex:outputField value="{!ambc.rawAccount__c}"/></td>
+                            <td colspan="4">鐩爣瀹㈡埛锛�<apex:inputField id="OEC" value="{!ambc.AccountField__c}" style="height:25px;width:200px"/></td>
                         </tr>
                        
                         <tr  >
                             <apex:outputPanel rendered="{!checkUser}">
                                 <td colspan="3"/>
-                                <td colspan="4">SPO琛ㄥ崟鍙凤細<apex:inputText value="{!ambc.SPOLink__c}" style="width:200px"/></td>
+                                <td colspan="4">&nbsp;&nbsp;&nbsp;SPO琛ㄥ崟鍙凤細<apex:inputText value="{!ambc.SPOLink__c}" style="width:200px"/></td>
                             </apex:outputPanel>
                             <!-- CHAN-B9B68N Start -->
                             <td  colspan="4">鍙樻洿鍘熷洜锛�<!-- <apex:selectList value="{!ambc.ChangeReason__c}" id="changeReason01" size="1" style="width:204px"><apex:selectOptions value="{!changeReasonOpts}"/> --><apex:inputField value="{!ambc.ChangeReason__c}"></apex:inputField>
@@ -279,18 +279,19 @@
                         </tr>
                          <tr>
                             <td colspan="3"/>
-                                <td colspan="4">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
-                                    &nbsp;澶囨敞锛�<apex:inputText value="{!ambc.remark__c}" style="width:200px"/></td>
+                            
+                                <td colspan="4" style="height:50px;">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                    &nbsp;&nbsp;澶囨敞锛�<apex:inputText value="{!ambc.remark__c}" style="width:200px"/></td>
                              <!-- LZHU-BPJ8DF 20200513  Start -->
-                            <td colspan="4">鍙樻洿璁惧鎬绘暟锛�<apex:outputField value="{!ambc.DetailCnt__c}"/></td>
+                                <td colspan="4" style="height:50px;">鍙樻洿璁惧鎬绘暟锛�<apex:outputField value="{!ambc.DetailCnt__c}"/></td>
                             <!--  LZHU-BPJ8DF 20200513 End -->
-                        </tr>
+                            </tr>
                         <!-- WLIG-BS7B4T ---20200806---update By rentongxiao---Start -->
                          <tr>
                             <!-- 鍏变韩瀛楁鐨勫洖鏄� -->
                              <td colspan="3"/>
                                 <td colspan="4">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
-                                    &nbsp;鍏变韩锛�<apex:inputCheckbox value="{!ambc.share__c}" style="width:50px"/>
+                                    &nbsp;&nbsp;&nbsp;鍏变韩锛�<apex:inputCheckbox value="{!ambc.share__c}" style="height:20px;width:20px"/>
                                 </td>
                                 <td colspan="4"></td>
                         </tr>
@@ -346,7 +347,7 @@
                 <apex:pageBlock title="鏂囦欢" id="accessory" rendered="{!isShow}">
                 
                     <apex:pageBlockButtons location="top">
-                        <apex:commandButton value="鏂囦欢涓婁紶"  onclick="uploadingAttachmentJs();" disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯',true,false)}"/>
+                        <apex:commandButton value="闄勪欢涓婁紶"  onclick="uploadingAttachmentJs();" disabled="{!IF(ambc.Change_status__c='宸叉彁浜�'||ambc.Change_status__c='鎵瑰噯',true,false)}"/>
                     </apex:pageBlockButtons>
                     
                     <apex:pageBlockTable value="{!contents}" var="attachment" >
diff --git a/force-app/main/default/pages/AssetQR.page b/force-app/main/default/pages/AssetQR.page
index 68ebdb5..b5d3a21 100644
--- a/force-app/main/default/pages/AssetQR.page
+++ b/force-app/main/default/pages/AssetQR.page
@@ -13,32 +13,63 @@
 
             sforce.connection.sessionId = '{!GETSESSIONID()}';
 
-            var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Asset.Id}\' and name = \'QRCode\'");
-
+            // var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Asset.Id}\' and name = \'QRCode\'");
+            var record = sforce.connection.query("SELECT ContentDocumentId from ContentDocumentLink where LinkedEntityId =\'{!Asset.Id}\'");
+            var records;
+            if(record.size > 0){
+                records = record.getArray("records");
+                var idList = records.map(obj => "'" + obj.ContentDocumentId + "'").join(",");
+                record = sforce.connection.query("SELECT Id,Title, OwnerId, ContentModifiedDate FROM ContentDocument WHERE Id IN (" + idList + ") AND Title = 'QRCode'");
+            }
             // 鏃€伀銇傘倢銇扮劇瑕�
             if (record.size == 0) {
-                var atta = new sforce.SObject("Attachment");
-                atta.Name = "QRCode";
-                atta.ParentId = "{!Asset.Id}";
-                atta.Body = src;
-                var result = sforce.connection.create([atta]);
+                // var atta = new sforce.SObject("Attachment");
+                // atta.Name = "QRCode";
+                // atta.ParentId = "{!Asset.Id}";
+                // atta.Body = src;
+                // var result = sforce.connection.create([atta]);
+                var version = new sforce.SObject("ContentVersion");
+                version.VersionData = src;
+                version.Title = "QRCode";
+                version.ContentLocation= 's';
+                version.PathOnClient="QRCode.jpg";
+                var versionResult = sforce.connection.create([version]);
+                record = sforce.connection.query("SELECT ContentDocumentId FROM ContentVersion WHERE Id =\'" + versionResult[0].id + "\'");
+                records = record.getArray("records");
+                var link = new sforce.SObject("ContentDocumentLink");
+                link.ContentDocumentId = records[0].ContentDocumentId;
+                link.LinkedEntityId = "{!Asset.Id}";
+                link.ShareType = 'I';
+                link.Visibility = 'AllUsers';
+                var result = sforce.connection.create([link]);
+
 
                 var es = new sforce.SObject("Asset");
                 es.Id = "{!Asset.Id}";
-                es.QRId__c = result[0].id;
+                es.QRId__c = result[0].ContentDocumentId;
                 es.Fixture_QRCode_Text__c = "{!Asset.Fixture_QRCode__c}";
                 result = sforce.connection.update([es]);
             } else if ("{!Asset.QRId__c}" == null || "{!Asset.QRId__c}" == '' || "{!Asset.Fixture_QRCode__c}" != "{!Asset.Fixture_QRCode_Text__c}"){
-                var records = record.getArray("records");
-                var atta = new sforce.SObject("Attachment");
-                atta.Name = "QRCode";
-                atta.Body = src;
-                atta.Id = records[0].Id;
-                var result = sforce.connection.update([atta]);
+                // var records = record.getArray("records");
+                // var version = 
+                // var atta = new sforce.SObject("Attachment");
+                // atta.Name = "QRCode";
+                // atta.Body = src;
+                // atta.Id = records[0].Id;
+                // var result = sforce.connection.update([atta]);
 
+
+                var result = sforce.connection.query("SELECT Id from ContentDocumentLink where ContentDocumentId =" + record[0].Id);
+                var version = sforce.connection.query("SELECT Id from ContentVersion where ContentDocumentId =" + record[0].Id);
+                var versions = version.getArray("versions");
+                var atta = new sforce.SObject("ContentVersion");
+                atta.VersionData = src;
+                atta.Id = versions[0].Id;
+                version = sforce.connection.update([atta]);
+                records = result.getArray("records");
                 var es = new sforce.SObject("Asset");
                 es.Id = "{!Asset.Id}";
-                es.QRId__c = result[0].id;
+                es.QRId__c = records[0].Id;
                 es.Fixture_QRCode_Text__c = "{!Asset.Fixture_QRCode__c}";
                 result = sforce.connection.update([es]);
                 // TODO Name澶夈倧銈嬪彲鑳芥�с亗銈娿�乽psert銇仐銇俱仚
diff --git a/force-app/main/default/pages/AssetQR.page-meta.xml b/force-app/main/default/pages/AssetQR.page-meta.xml
index b83c733..9492ebe 100644
--- a/force-app/main/default/pages/AssetQR.page-meta.xml
+++ b/force-app/main/default/pages/AssetQR.page-meta.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>35.0</apiVersion>
+    <apiVersion>43.0</apiVersion>
     <availableInTouch>false</availableInTouch>
     <confirmationTokenRequired>false</confirmationTokenRequired>
     <label>AssetQR</label>
diff --git a/force-app/main/default/pages/ConsumApplyBR.page b/force-app/main/default/pages/ConsumApplyBR.page
index 289ae20..5d1d40c 100644
--- a/force-app/main/default/pages/ConsumApplyBR.page
+++ b/force-app/main/default/pages/ConsumApplyBR.page
@@ -53,18 +53,39 @@
             src = srcNew.substring(22, srcNew.length);
             sforce.connection.sessionId = '{!GETSESSIONID()}';
 
-            var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Consum_Apply__c.Id}\' and name = \'BRCode-{!Consum_Apply__c.Name_No__c}\'");
+            // var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Consum_Apply__c.Id}\' and name = \'BRCode-{!Consum_Apply__c.Name_No__c}\'");
+
+            var record = sforce.connection.query("select Id,ContentDocumentId from ContentDocumentLink where LinkedEntityId = \'{!Consum_Apply__c.Id}\'");
+            if(record.size > 0){
+                var records = record.getArray("records");
+                var idList = records.map(obj => "'" + obj.ContentDocumentId + "'").join(",");
+                record = sforce.connection.query("select Id from ContentDocument where Id in (" + idList + ") and Title = \'BRCode-{!Consum_Apply__c.Name_No__c}\'");
+            }
             // 鏃€伀銇傘倢銇扮劇瑕�
             if (record.size == 0) {
-                var atta = new sforce.SObject("Attachment");
-                atta.Name = "BRCode-{!Consum_Apply__c.Name_No__c}";
-                atta.ParentId = "{!Consum_Apply__c.Id}";
-                atta.Body = src;
-                var result = sforce.connection.create([atta]);
+                // var atta = new sforce.SObject("Attachment");
+                // atta.Name = "BRCode-{!Consum_Apply__c.Name_No__c}";
+                // atta.ParentId = "{!Consum_Apply__c.Id}";
+                // atta.Body = src;
+                // var result = sforce.connection.create([atta]);
+                var version = new sforce.SObject("ContentVersion");
+                version.VersionData = src;
+                version.Title = "BRCode-{!Consum_Apply__c.Name_No__c}";
+                version.ContentLocation = 's';
+                version.PathOnClient= "BRCode-{!Consum_Apply__c.Name_No__c}.jpg";
+                var versionResult = sforce.connection.create([version]);
+                record = sforce.connection.query("SELECT ContentDocumentId FROM ContentVersion WHERE Id =\'" + versionResult[0].id + "\'");
+                var records = record.getArray("records");
+                var link = new sforce.SObject("ContentDocumentLink");
+                link.ContentDocumentId = records[0].ContentDocumentId;
+                link.LinkedEntityId = "{!Consum_Apply__c.Id}";
+                link.ShareType = 'I';
+                link.Visibility = 'AllUsers';
+                var result = sforce.connection.create([link]);
 
                 var es = new sforce.SObject("Consum_Apply__c");
                 es.Id = "{!Consum_Apply__c.Id}";
-                es.BRId__c = result[0].id;
+                es.BRId__c = records[0].ContentDocumentId;
                 result = sforce.connection.update([es]);
             //鐢宠涔︽洿鏂板け璐ョ殑璇濆啀娆℃洿鏂�
             } else if ("{!Consum_Apply__c.BRId__c}" == '' || "{!Consum_Apply__c.BRId__c}" == null) {
@@ -75,7 +96,8 @@
                 result = sforce.connection.update([es]);
                 // TODO Name澶夈倧銈嬪彲鑳芥�с亗銈娿�乽psert銇仐銇俱仚
             } else {
-                alert(record[0].id);
+                var records = record.getArray("records");
+                // alert(records[0].Id);
             }
         }
         // BRcode鐢熸垚寰屻�丄ttachment銈掍綔鎴�
diff --git a/force-app/main/default/pages/ConsumApplyQR.page b/force-app/main/default/pages/ConsumApplyQR.page
index da67a69..bd76782 100644
--- a/force-app/main/default/pages/ConsumApplyQR.page
+++ b/force-app/main/default/pages/ConsumApplyQR.page
@@ -13,18 +13,45 @@
 
             sforce.connection.sessionId = '{!GETSESSIONID()}';
 
-            var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Consum_Apply__c.Id}\' and name = \'QRCode-{!Consum_Apply__c.Name}\'");
+            // var record = sforce.connection.query("select id from Attachment where ParentId = \'{!Consum_Apply__c.Id}\' and name = \'QRCode-{!Consum_Apply__c.Name}\'");
+            var record = sforce.connection.query("select ContentDocumentId from ContentDocumentLink where LinkedEntityId = \'{!Consum_Apply__c.Id}\'");
             // 涓嶅瓨鍦╭r鏂囦欢鏃讹紝鏂扮敓鎴愪竴涓紝骞惰繛鍒扮敵璇峰崟涓�
+            console.log(record.size);
+            if(record.size > 0){
+                var records = record.getArray("records");
+                var idList = records.map(obj => "'" + obj.ContentDocumentId + "'").join(",");
+                record = sforce.connection.query("select Id from ContentDocument where Id in (" + idList + ") and Title = \'QRCode-{!Consum_Apply__c.Name}\'");
+                console.log("select Id from ContentDocument where Id in (" + idList + ") and Title = \'QRCode-{!Consum_Apply__c.Name}\'");
+            }
+            console.log(record.size);
             if (record.size == 0) {
-                var atta = new sforce.SObject("Attachment");
-                atta.Name = "QRCode-{!Consum_Apply__c.Name}";
-                atta.ParentId = "{!Consum_Apply__c.Id}";
-                atta.Body = src;
-                var result = sforce.connection.create([atta]);
+                // var atta = new sforce.SObject("Attachment");
+                // atta.Name = "QRCode-{!Consum_Apply__c.Name}";
+                // atta.ParentId = "{!Consum_Apply__c.Id}";
+                // atta.Body = src;
+                // var result = sforce.connection.create([atta]);
+
+                var version = new sforce.SObject("ContentVersion");
+                version.Title = "QRCode-{!Consum_Apply__c.Name}";
+                version.VersionData = src;
+                version.ContentLocation = "s";
+                version.PathOnClient = "QRCode-{!Consum_Apply__c.Name}.jpg";
+                var result = sforce.connection.create([version]);
+                console.log(result[0].id);
+                version = sforce.connection.query("select ContentDocumentId from ContentVersion where Id = \'" + result[0].id + "\'");
+                console.log(version);
+                version = version.getArray("records"); 
+                console.log(version);
+                var link = new sforce.SObject("ContentDocumentLink");
+                link.LinkedEntityId = "{!Consum_Apply__c.Id}";
+                link.ContentDocumentId = version[0].ContentDocumentId;
+                link.ShareType = 'I';
+                link.Visibility = 'AllUsers';
+                result = sforce.connection.create([link]);
 
                 var es = new sforce.SObject("Consum_Apply__c");
                 es.Id = "{!Consum_Apply__c.Id}";
-                es.QRId__c = result[0].id;
+                es.QRId__c = version[0].ContentDocumentId;
                 result = sforce.connection.update([es]);
             }
             else {
diff --git a/force-app/main/default/pages/ConsumApplyQR.page-meta.xml b/force-app/main/default/pages/ConsumApplyQR.page-meta.xml
index 1c2379c..2215165 100644
--- a/force-app/main/default/pages/ConsumApplyQR.page-meta.xml
+++ b/force-app/main/default/pages/ConsumApplyQR.page-meta.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
-    <apiVersion>46.0</apiVersion>
+    <apiVersion>48.0</apiVersion>
     <availableInTouch>false</availableInTouch>
     <confirmationTokenRequired>false</confirmationTokenRequired>
     <label>ConsumApplyQR</label>
diff --git a/force-app/main/default/pages/OFSRepairConsignPDF.page b/force-app/main/default/pages/OFSRepairConsignPDF.page
index 4c68188..c412c32 100644
--- a/force-app/main/default/pages/OFSRepairConsignPDF.page
+++ b/force-app/main/default/pages/OFSRepairConsignPDF.page
@@ -1,4 +1,4 @@
-<apex:page controller="OFSRepairConsignPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false">
+<apex:page controller="OFSRepairConsignPDFController" showHeader="false" sidebar="false" action="{!init}" applyHtmlTag="false" renderAs="pdf">
 <html>
     <head>
         <style>
diff --git a/force-app/main/default/pages/OFSRepairConsignPDFOuter.page b/force-app/main/default/pages/OFSRepairConsignPDFOuter.page
index 7af0ea6..fc3e4d6 100644
--- a/force-app/main/default/pages/OFSRepairConsignPDFOuter.page
+++ b/force-app/main/default/pages/OFSRepairConsignPDFOuter.page
@@ -79,6 +79,7 @@
     rt.style.width = "300px";
     rt.style.height = "150px";
 });
+
 </script>
 </div>
     </apex:form>
diff --git a/force-app/main/default/pages/eSignFormAttachment.page b/force-app/main/default/pages/eSignFormAttachment.page
index e358110..c023007 100644
--- a/force-app/main/default/pages/eSignFormAttachment.page
+++ b/force-app/main/default/pages/eSignFormAttachment.page
@@ -7,7 +7,7 @@
         <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
         
         <title>
-            鏌ョ湅闄勪欢
+            鏌ョ湅鏂囦欢
         </title>
          <script>
              var widthJs = "500px";
@@ -139,7 +139,7 @@
         <!-- 鏍囬 -->
         <div style="height: 40px;background-color:#0f218b;width: 100%;text-align: center;">
             <h1 style="color: white;font-size: 24px;">
-                鏌ョ湅闄勪欢
+                鏌ョ湅鏂囦欢
             </h1>
         </div>
         <div style="height: 30px; margin-top: 10px;">
@@ -150,7 +150,7 @@
             4銆�#control 鏃嬭浆鍥炬爣
             5銆�#OriginalDiv 鍒囨崲鍘熷浘鍜岀敾甯� -->
             <div id="popLayer">
-                <!--宸︿晶琛ㄦ牸  灞曠ず鎵�鏈夌殑闄勪欢-->
+                <!--宸︿晶琛ㄦ牸  灞曠ず鎵�鏈夌殑鏂囦欢-->
                 <div class="solution-list">
                     <apex:pageBlock id="oppBlock" tabStyle="Report">
                         <apex:outputPanel >
@@ -158,8 +158,8 @@
                             <apex:variable value="identif" var="identif" rendered="{!IF(identifier == '缁忛攢鍟�', true, false)}" >
                                 <table class="list" style="border-bottom-width: 0px;   width:100%; font-size:11px; border-spacing:0;" border="" id="tableHeader_L">
                                     <tr class="headerRow" height="30px"  align="center">
-                                        <td><a href="#" onclick="return false;" >闄勪欢鍚嶇О</a></td>
-                                        <td width="55px"><a href="#" onclick="return false;">闄勪欢绫诲瀷</a></td>
+                                        <td><a href="#" onclick="return false;" >鏂囦欢鍚嶇О</a></td>
+                                        <td width="55px"><a href="#" onclick="return false;">鏂囦欢绫诲瀷</a></td>
                                     </tr>
                                     <apex:repeat value="{!acccData}" var="or" id="oppTable">
                                         <apex:variable value="{!1}" var="cnt"/>
@@ -186,8 +186,8 @@
                                 <table class="list" style="border-bottom-width: 0px;   width:100%; font-size:11px; border-spacing:0;" border="" id="tableHeader_M">
                                     <apex:variable value="identif" var="identif" rendered="{!IF(identifier2 == '鍖婚櫌' && identifier != '缁忛攢鍟�'  , true, false)}">
                                         <tr class="headerRow" height="30px"  align="center">
-                                            <td><a href="#" onclick="return false;" >闄勪欢鍚嶇О</a></td>
-                                            <td width="55px"><a href="#" onclick="return false;">闄勪欢绫诲瀷</a></td>
+                                            <td><a href="#" onclick="return false;" >鏂囦欢鍚嶇О</a></td>
+                                            <td width="55px"><a href="#" onclick="return false;">鏂囦欢绫诲瀷</a></td>
                                         </tr>
                                     </apex:variable>
                                     <apex:variable value="identif" var="identif" rendered="{!IF(identifier2 == '鍖婚櫌' && identifier == '缁忛攢鍟�'  , true, false)}">
@@ -226,10 +226,10 @@
                     </h1>
                 </div>
                 <div class="solution-item" id="imgeDiv">
-                    <div id="onCloseId" style="position: absolute;top:55px;padding-left:73%;cursor:pointer;display:none;"><a href="javascript:void(0)" onclick="closePop()" style="padding-rigth:13px;color:#fff;font-weight:bolder;font-size:15px;text-decoration: none;">鍏抽棴</a></div>
+                    <div id="onCloseId" style="position: absolute;top:75px;padding-left:67%;cursor:pointer;display:none;"><a href="javascript:void(0)" onclick="closePop()" style="padding-rigth:13px;color:#fff;font-weight:bolder;font-size:15px;text-decoration: none;">鍏抽棴</a></div>
                     <!-- 澧炲姞pdf鍏抽棴鎸夐挳  绮剧悽鎶�鏈� thh 2021-09-27 start -->
                     <div class="PdfCss" id="fontpdf" style="display: none;">
-                        <h1 style="position:absolute;top:50%;margin:-4% 0 0 -10%;">
+                        <h1 style="position:absolute;top:50%;">
                             <font face="verdana" style="font-size: 40px;">姝ら〉鏆傛椂鍙敮鎸佸浘鐗囨枃浠剁殑棰勮</font>
                         </h1>
                     </div>
@@ -320,10 +320,10 @@
                 document.getElementById("imgeDiv").style.display='block';
 
                 fadeIn("imgeDiv",1000);
-                //鑾峰彇鐐瑰嚮鐨勯檮浠跺悕绉�
+                //鑾峰彇鐐瑰嚮鐨勬枃浠跺悕绉�
                 var accName = obj.cells[0].innerText;
                 //asdf-kjklljk 鐢靛瓙绛炬敹-鎷呭綋鐜妭浼樺寲寮�鍙� 绮剧悽鎶�鏈� wql 2021/08/09 start
-                //鑾峰彇鐐瑰嚮鐨勯檮浠剁被鍨�
+                //鑾峰彇鐐瑰嚮鐨勬枃浠剁被鍨�
                 var accContentType = obj.cells[1].innerText;
                 //asdf-kjklljk 鐢靛瓙绛炬敹-鎷呭綋鐜妭浼樺寲寮�鍙� 绮剧悽鎶�鏈� wql 2021/08/09 end
                 //鎴彇鍚庣紑鍚�
@@ -847,14 +847,14 @@
              mouseDownLocation = windowToCanvas(canvas, event.clientX, event.clientY);
              if (isPointInImageArea(mouseDownLocation)) {
               isMouseDown = true;
-              document.title = '鏌ョ湅闄勪欢';
+              document.title = '鏌ョ湅鏂囦欢';
              }
             }
             /**榧犳爣寮硅捣*/
             document.body.onmouseup = function() {
              isMouseDown = false;
              canvas.style.cursor = "default";
-             document.title = '鏌ョ湅闄勪欢';
+             document.title = '鏌ョ湅鏂囦欢';
             }
             /**榧犳爣绉诲姩*/
             pandiv.onmousemove = function(event) {

--
Gitblit v1.9.1