From a82f0830a132be063a63dcd7dd2ccca2179d5738 Mon Sep 17 00:00:00 2001
From: zhangzhengmei <zhangzhengmei@prec-tech.com>
Date: 星期日, 06 八月 2023 10:46:38 +0800
Subject: [PATCH] QISPDF课题修改同步

---
 force-app/main/default/classes/QISTrigger.cls         |   92 ++++++++++++++++++++++++++++++
 force-app/main/default/classes/QISPDFController.cls   |    8 ++
 force-app/main/default/pages/NewAndEditQIS.page       |   12 ++++
 force-app/main/default/pages/QISPDF.page              |   46 ++++++++++++---
 force-app/main/default/classes/QISToETQWebService.cls |    6 +
 5 files changed, 154 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/classes/QISPDFController.cls b/force-app/main/default/classes/QISPDFController.cls
index f51b606..f4d6b33 100644
--- a/force-app/main/default/classes/QISPDFController.cls
+++ b/force-app/main/default/classes/QISPDFController.cls
@@ -13,6 +13,10 @@
     public string Photo_2_Text { get; private set; }
     public string Photo_3_Text { get; private set; }
     public string Photo_4_Text { get; private set; }
+    public string Photo_5_Text { get; private set; }
+    public string Photo_6_Text { get; private set; }
+    public string Photo_7_Text { get; private set; }
+    public string Photo_8_Text { get; private set; }
     
 
     public QISPDFController() {
@@ -65,6 +69,10 @@
             Photo_2_Text = getImageByUrl(qr.Photo_2_Text__c);
             Photo_3_Text = getImageByUrl(qr.Photo_3_Text__c);
             Photo_4_Text = getImageByUrl(qr.Photo_4_Text__c);
+            Photo_5_Text = getImageByUrl(qr.Photo_5_Text__c);
+            Photo_6_Text = getImageByUrl(qr.Photo_6_Text__c);
+            Photo_7_Text = getImageByUrl(qr.Photo_7_Text__c);
+            Photo_8_Text = getImageByUrl(qr.Photo_8_Text__c);
         }
     }
 
diff --git a/force-app/main/default/classes/QISToETQWebService.cls b/force-app/main/default/classes/QISToETQWebService.cls
index bcba6d8..1865666 100644
--- a/force-app/main/default/classes/QISToETQWebService.cls
+++ b/force-app/main/default/classes/QISToETQWebService.cls
@@ -1,7 +1,7 @@
 global without sharing class QISToETQWebService {
     public static List<ImgObj> ImgObjs = new List<ImgObj>();
     webservice static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){
-        List<QIS_Report__c> temp = [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c,Photo_4__c,
+        List<QIS_Report__c> temp = [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c,Photo_4__c,Photo_5__c,Photo_6__c,Photo_7__c,Photo_8__c,
         Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c
         from QIS_Report__c where GeneratedPDFField__c = null and id in :repairIds ];
         List<Repair__c> tempRe = [select id,name,GeneratedPDFField__c,ProblemDescription__c,ASReportedCodeAC__c,AE_DetermineResult__c,PAE_Determine__c,PAE_DetermineAC__c from Repair__c where GeneratedPDFField__c = null
@@ -15,6 +15,10 @@
                 apiNames.add('Photo_2__c');
                 apiNames.add('Photo_3__c');
                 apiNames.add('Photo_4__c');
+                apiNames.add('Photo_5__c');
+                apiNames.add('Photo_6__c');
+                apiNames.add('Photo_7__c');
+                apiNames.add('Photo_8__c');
                 apiNames.add('Photo_OSH_1__c');
                 apiNames.add('Photo_OSH_2__c');
                 apiNames.add('Photo_OSH_3__c');
diff --git a/force-app/main/default/classes/QISTrigger.cls b/force-app/main/default/classes/QISTrigger.cls
index ed06e17..b20f822 100644
--- a/force-app/main/default/classes/QISTrigger.cls
+++ b/force-app/main/default/classes/QISTrigger.cls
@@ -95,6 +95,98 @@
                 qr.Photo_4_Text__c = phtTxt;
                 QIS_Ids.add(qr.Id);
             }
+
+
+
+            //鍔�4涓瓧娈� 20230627
+             // Photo5
+            if (Trigger.isInsert && String.isBlank(qr.Photo_5__c) == false
+                    || (Trigger.isUpdate && ((QIS_Report__c) oldMap.get(qr.Id)).Photo_5__c != qr.Photo_5__c)
+                    || (Trigger.isUpdate && String.isBlank(qr.Photo_5__c) == false && String.isBlank(qr.Photo_5_Text__c))
+            ) {
+                String phtTxt = '';
+                if (String.isBlank(qr.Photo_5__c) == false) {
+                    Integer pStt = qr.Photo_5__c.indexOf('<img');
+                    if (pStt >= 0) {
+                        pStt = qr.Photo_5__c.indexOf('src="');
+                        if (pStt >= 0) {
+                            Integer pEnd = qr.Photo_5__c.indexOf('"', pStt + 5);
+                            if (pEnd >= 0) {
+                                phtTxt = qr.Photo_5__c.substring(pStt + 5, pEnd);
+                                phtTxt = phtTxt.unescapeHtml4();
+                            }
+                        }
+                    }
+                }
+                qr.Photo_5_Text__c = phtTxt;
+                QIS_Ids.add(qr.Id);
+            }
+             // Photo6
+            if (Trigger.isInsert && String.isBlank(qr.Photo_6__c) == false
+                    || (Trigger.isUpdate && ((QIS_Report__c) oldMap.get(qr.Id)).Photo_6__c != qr.Photo_6__c)
+                    || (Trigger.isUpdate && String.isBlank(qr.Photo_6__c) == false && String.isBlank(qr.Photo_6_Text__c))
+            ) {
+                String phtTxt = '';
+                if (String.isBlank(qr.Photo_6__c) == false) {
+                    Integer pStt = qr.Photo_6__c.indexOf('<img');
+                    if (pStt >= 0) {
+                        pStt = qr.Photo_6__c.indexOf('src="');
+                        if (pStt >= 0) {
+                            Integer pEnd = qr.Photo_6__c.indexOf('"', pStt + 5);
+                            if (pEnd >= 0) {
+                                phtTxt = qr.Photo_6__c.substring(pStt + 5, pEnd);
+                                phtTxt = phtTxt.unescapeHtml4();
+                            }
+                        }
+                    }
+                }
+                qr.Photo_6_Text__c = phtTxt;
+                QIS_Ids.add(qr.Id);
+            }
+             // Photo7
+            if (Trigger.isInsert && String.isBlank(qr.Photo_7__c) == false
+                    || (Trigger.isUpdate && ((QIS_Report__c) oldMap.get(qr.Id)).Photo_7__c != qr.Photo_7__c)
+                    || (Trigger.isUpdate && String.isBlank(qr.Photo_7__c) == false && String.isBlank(qr.Photo_7_Text__c))
+            ) {
+                String phtTxt = '';
+                if (String.isBlank(qr.Photo_7__c) == false) {
+                    Integer pStt = qr.Photo_7__c.indexOf('<img');
+                    if (pStt >= 0) {
+                        pStt = qr.Photo_7__c.indexOf('src="');
+                        if (pStt >= 0) {
+                            Integer pEnd = qr.Photo_7__c.indexOf('"', pStt + 5);
+                            if (pEnd >= 0) {
+                                phtTxt = qr.Photo_7__c.substring(pStt + 5, pEnd);
+                                phtTxt = phtTxt.unescapeHtml4();
+                            }
+                        }
+                    }
+                }
+                qr.Photo_7_Text__c = phtTxt;
+                QIS_Ids.add(qr.Id);
+            }
+             // Photo8
+            if (Trigger.isInsert && String.isBlank(qr.Photo_8__c) == false
+                    || (Trigger.isUpdate && ((QIS_Report__c) oldMap.get(qr.Id)).Photo_8__c != qr.Photo_8__c)
+                    || (Trigger.isUpdate && String.isBlank(qr.Photo_8__c) == false && String.isBlank(qr.Photo_8_Text__c))
+            ) {
+                String phtTxt = '';
+                if (String.isBlank(qr.Photo_8__c) == false) {
+                    Integer pStt = qr.Photo_8__c.indexOf('<img');
+                    if (pStt >= 0) {
+                        pStt = qr.Photo_8__c.indexOf('src="');
+                        if (pStt >= 0) {
+                            Integer pEnd = qr.Photo_8__c.indexOf('"', pStt + 5);
+                            if (pEnd >= 0) {
+                                phtTxt = qr.Photo_8__c.substring(pStt + 5, pEnd);
+                                phtTxt = phtTxt.unescapeHtml4();
+                            }
+                        }
+                    }
+                }
+                qr.Photo_8_Text__c = phtTxt;
+                QIS_Ids.add(qr.Id);
+            }
         }
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/pages/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page
index 5cdc25e..d0053b2 100644
--- a/force-app/main/default/pages/NewAndEditQIS.page
+++ b/force-app/main/default/pages/NewAndEditQIS.page
@@ -300,6 +300,18 @@
             if(getCKEinstance('Photo_4__c')){
                 result.Photo_4__c = getCKEinstance('Photo_4__c').getData()
             }
+            if(getCKEinstance('Photo_5__c')){
+                result.Photo_5__c = getCKEinstance('Photo_5__c').getData()
+            }
+            if(getCKEinstance('Photo_6__c')){
+                result.Photo_6__c = getCKEinstance('Photo_6__c').getData()
+            }
+            if(getCKEinstance('Photo_7__c')){
+                result.Photo_7__c = getCKEinstance('Photo_7__c').getData()
+            }
+            if(getCKEinstance('Photo_8__c')){
+                result.Photo_8__c = getCKEinstance('Photo_8__c').getData()
+            }
 
             if(getCKEinstance('Photo_OSH_1__c')){
                 result.Photo_OSH_1__c = getCKEinstance('Photo_OSH_1__c').getData()
diff --git a/force-app/main/default/pages/QISPDF.page b/force-app/main/default/pages/QISPDF.page
index f0465a6..09f7e6b 100644
--- a/force-app/main/default/pages/QISPDF.page
+++ b/force-app/main/default/pages/QISPDF.page
@@ -400,9 +400,9 @@
         </table>
         
         
-        </div>
-        <div style="page-break-after: always;"></div>
-        <div class="pdf-page">
+        <!-- </div> -->
+        <div style="page-break-after: always;height: 20px;"></div>
+        <!-- <div class="pdf-page"> -->
             
         <table width="100%" border="0">
             <tr>
@@ -455,34 +455,62 @@
         </table>
         <br/>
         <table width="100%" border="1" cellspacing="2" style="font-size: 8pt;">
-            <tr>
-                <td style="width:50%">
+            <tr style="display:{!IF(ISBLANK(qr.Photo_1_Text__c),'none','')};">
+                <td style="width:50%" rendered="{!NOT(ISBLANK(qr.Photo_1_Text__c))}">
                     <table width="100%" border="0" cellspacing="0">
                         <tr><td style="height:300px; text-align: center;"><apex:image id="Photo_1_Text" value="{!Photo_1_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_1_Text__c))}" /></td></tr>
                         <tr><td style="height:40px;"></td></tr>
                     </table>
                 </td>
-                <td style="border-left-color: white;">
+                <td style="border-left-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_2_Text__c))}">
                     <table width="100%" border="0" cellspacing="0">
                         <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_2_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_2_Text__c))}" /></td></tr>
                         <tr><td style="height:40px;"></td></tr>
                     </table>
                 </td>
             </tr>
-            <tr>
-                <td style="border-top-color: white;">
+            <tr style="display:{!IF(ISBLANK(qr.Photo_3_Text__c),'none','')};">
+                <td style="border-top-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_3_Text__c))}">
                     <table width="100%" border="0" cellspacing="0">
                         <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_3_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_3_Text__c))}" /></td></tr>
                         <tr><td style="height:40px;"></td></tr>
                     </table>
                 </td>
-                <td style="border-left-color: white; border-top-color: white;">
+                <td style="border-left-color: white; border-top-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_4_Text__c))}">
                     <table width="100%" border="0" cellspacing="0">
                         <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_4_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_4_Text__c))}" /></td></tr>
                         <tr><td style="height:40px;"></td></tr>
                     </table>
                 </td>
             </tr>
+            <tr style="display:{!IF(ISBLANK(qr.Photo_5_Text__c),'none','')};">
+                <td style="width:50%;" rendered="{!NOT(ISBLANK(qr.Photo_5_Text__c))}">
+                    <table width="100%" border="0" cellspacing="0">
+                        <tr><td style="height:300px; text-align: center;"><apex:image id="Photo_5_Text" value="{!Photo_5_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_5_Text__c))}" /></td></tr>
+                        <tr><td style="height:40px;"></td></tr>
+                    </table>
+                </td>
+                <td style="border-left-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_6_Text__c))}">
+                    <table width="100%" border="0" cellspacing="0">
+                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_6_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_6_Text__c))}" /></td></tr>
+                        <tr><td style="height:40px;"></td></tr>
+                    </table>
+                </td>
+            </tr>
+            <tr style="display:{!IF(ISBLANK(qr.Photo_7_Text__c),'none','')};">
+                <td style="border-top-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_7_Text__c))}">
+                    <table width="100%" border="0" cellspacing="0">
+                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_7_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_7_Text__c))}" /></td></tr>
+                        <tr><td style="height:40px;"></td></tr>
+                    </table>
+                </td>
+                <td style="border-left-color: white; border-top-color: white;" rendered="{!NOT(ISBLANK(qr.Photo_8_Text__c))}">
+                    <table width="100%" border="0" cellspacing="0">
+                        <tr><td style="height:300px; text-align: center;"><apex:image value="{!Photo_8_Text}" width="80%" rendered="{!NOT(ISBLANK(qr.Photo_8_Text__c))}" /></td></tr>
+                        <tr><td style="height:40px;"></td></tr>
+                    </table>
+                </td>
+            </tr>
         </table>
         </div>
         

--
Gitblit v1.9.1