From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/OFSInsReportLayoutController.cls |  122 +++++++++++++++++++++++++---------------
 1 files changed, 76 insertions(+), 46 deletions(-)

diff --git a/force-app/main/default/classes/OFSInsReportLayoutController.cls b/force-app/main/default/classes/OFSInsReportLayoutController.cls
index 7950992..0e700a6 100644
--- a/force-app/main/default/classes/OFSInsReportLayoutController.cls
+++ b/force-app/main/default/classes/OFSInsReportLayoutController.cls
@@ -28,7 +28,7 @@
 
     private String oldHospital;
     private String oldStatus;
-    private Boolean isPDF;
+    public Boolean isPDF{get;private set;}
     private Boolean isUpDown;
     private Boolean isSubmit;
     public String alertMessage {
@@ -247,18 +247,23 @@
             oirSettingMap.put(oir.recordType_devName__c, oir);
         }
     }
+
+
+    public string staticResource { get; private set; }
+    //public boolean IsAddmessage { get; private set; }
+    
     /**
     * Visaulforce銇嬨倝鍛笺伆銈屻倠銈炽兂銈广儓銉┿偗銈�
     */
     public OFSInsReportLayoutController(ApexPages.StandardController controller) {
-
+        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Inspection_Report__c'));
 }
     public OFSInsReportLayoutController() {
         countorder = 1;
         nowAssetcount = 1;
         runCount = 0;
         isUpDown = true;
-
+        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Inspection_Report__c'));
     }
 
     // TODO 鍏ㄩ儴鐢婚潰銉儠銉儍銈枫儱銇仚銈�
@@ -335,7 +340,7 @@
                 pReportId = iis[0].Inspection_ReportId__c;
             }
 
-            List < Inspection_Report__c > queryIrs = [select Id, RecordType.DeveloperName, RecordType.Name, Name, Status__c, Inspection_StartTime__c, Inspection_EndTime__c from Inspection_Report__c where Id = :pReportId];
+            List < Inspection_Report__c > queryIrs = [select Id, RecordType.DeveloperName, RecordType.Name, Name, Status__c, Inspection_StartTime__c, Inspection_EndTime__c,AWS_Data_Id__c from Inspection_Report__c where Id = :pReportId];    //zhj 鏂版柟妗堟敼閫� 2022-12-05 鍒犻櫎Encrypted__c
             if (queryIrs.size() <= 0) {
                 initFlag = false;
                 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鏃犳硶鎵惧埌鐐规鎶ュ憡涔�'));
@@ -401,7 +406,7 @@
             }
         }
 
-        this.settingSoql = 'select Id, Name, Name_Manual__c, Next_StartHour_Page__c, Next_StartMinute_Page__c, Next_EndHour_Page__c, Next_EndMinute_Page__c '
+        this.settingSoql = 'select Id, Name, Name_Manual__c, Next_StartHour_Page__c, Next_StartMinute_Page__c, Next_EndHour_Page__c, Next_EndMinute_Page__c,AWS_Data_Id__c '        //zhj 鏂版柟妗堟敼閫� 2022-12-05 鍒犻櫎Encrypted__c
         // fxk 2021/8/4 鏂板姞 Start
         + ' , Remarks__c, CleaningFluid__c,SterilizationMethod__c,Disinfectant__c,UsedMachine__c,Used_ET__c ,Mode__c';
         // fxk 2021/8/4 鏂板姞 End
@@ -577,13 +582,15 @@
     /**
     * 閬告姙娓堛伩锛忔湭閬告姙瑁藉搧銇疆銇嶆彌銇�
     */
-    public PageReference exchangeAsset() {
+    public void exchangeAsset() {
         isUpDown = false;
+        
         System.debug('exchangeAsset start');
         // 鐥呴櫌澶夋洿銉併偋銉冦偗
         if (!this.checkHpChange()) {
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '淇濇湁璁惧鐨勫尰闄笌鐐规鎶ュ憡涔︾殑鍖婚櫌涓嶇锛岃鐐瑰嚮鍒锋柊鎸夐挳閲嶆柊鍙栧緱淇濇湁璁惧銆�'));
-            return null;
+            // return null;
+            return;
         }
         Date systemToday = System.today();
         List < AssetInfo > tmpChecked = new List < AssetInfo > ();
@@ -595,24 +602,27 @@
             } else {
                 if (ass.rec_checkBox_c) {
                     tmpChecked.add(ass);
+                    system.debug('=====uncheck SerialNumber1:' + ass.rec.SerialNumber);
                 } else {
                     tmpUnChecked.add(ass);
                 }
             }
         }
-        system.debug('=====unCheckedInfoList:' + unCheckedInfoList.size());
-        for (AssetInfo Ai: unCheckedInfoList) {
-            if (Ai.rec_checkBox_c) {
-                system.debug('=====uncheck SerialNumber1:' + Ai.rec.SerialNumber);
-            }
-        }
-        for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
-            for (AssetInfo Ai: Li) {
-                if (Ai.rec_checkBox_c) {
-                    system.debug('=====uncheck SerialNumber2:' + Ai.rec.SerialNumber);
-                }
-            }
-        }
+        // for (AssetInfo Ai: unCheckedInfoList) {
+        //     if (Ai.rec_checkBox_c) {
+        //         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '+++++++++++++++锛� ' + Ai.rec.SerialNumber));
+        //         system.debug('=====uncheck SerialNumber1:' + Ai.rec.SerialNumber);
+        //     }
+        // }
+        // for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
+        //     for (AssetInfo Ai: Li) {
+        //         if (Ai.rec_checkBox_c) {
+        //             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '---------------锛� ' + Ai.rec.SerialNumber));
+        //             system.debug('=====uncheck SerialNumber2:' + Ai.rec.SerialNumber);
+        //         }
+        //     }
+        // }
+        
         if (ThousandFLG > 0) {
             this.unCheckedInfoList.clear();
             for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
@@ -629,13 +639,15 @@
                 tmpUnChecked.add(ass);
             }
         }
-        for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
-            for (AssetInfo Ai: Li) {
-                if (Ai.rec_checkBox_c) {
-                    system.debug('=====uncheck SerialNumber4:' + Ai.rec.SerialNumber);
-                }
-            }
-        }
+        // for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
+        //     for (AssetInfo Ai: Li) {
+        //         if (Ai.rec_checkBox_c) {
+        //             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '4444444444444444 ' + Ai.rec.SerialNumber));
+        //             system.debug('=====uncheck SerialNumber4:' + Ai.rec.SerialNumber);
+        //         }
+        //     }
+        // }
+        // return null;
         this.checkedInfoList = new List < AssetInfo > ();
         for (AssetInfo ass: tmpChecked) {
             ass.lineNo = this.checkedInfoList.size();
@@ -673,7 +685,7 @@
             unCheckedInfoListForThousend.add(bufflist);
         }
         getAssetFromHp();
-        return null;
+        // return null;
     }
 
     public PageReference showPDF() {
@@ -785,14 +797,19 @@
             // }
 
         }
+        
         if (isError) {
+            system.debug('795'+ir.AWS_Data_Id__c);
             return null;
         }
+        system.debug('798'+ir.AWS_Data_Id__c);
         //add by rentx 20210630
         if (timeCheck() != true) {
+            system.debug('800');
             return null;
         }
 
+        system.debug('804');
         if (isPDF) {
             ir.Status__c = 'PDF';
         }
@@ -801,6 +818,7 @@
             ir.Status__c = '濉啓瀹屾瘯';
         }
 
+        system.debug('813');
         Savepoint sp = Database.setSavepoint();
         try {
             // 閮ㄩ暱缁忕悊鎬荤洃
@@ -815,9 +833,11 @@
             OFSInsReportAssetHistoryController.upsertInspection_Report(ir);
         } catch(Exception e) {
             clearIrId(sp, e, isIrNew);
+            system.debug('829');
             return null;
         }
 
+        system.debug('832');
         // 鏃ュ牨銇嬨倝銇忋倠鍫村悎銆佷繚瀛樻檪銆丒ventC銇浉銇嶆埢銇�
         if (String.isBlank(pEventCId) == false) {
             try {
@@ -825,10 +845,11 @@
                 update ec;
             } catch(Exception e) {
                 clearIrId(sp, e, isIrNew);
+                system.debug('840');
                 return null;
             }
         }
-
+        system.debug('844');
         //List<Inspection_Item__c> toUpsertAhs = new List<Inspection_Item__c>();
         List < Inspection_Item__c > toDeleteAhs = new List < Inspection_Item__c > ();
         List < Inspection_Item__c > manualDeleteAhs = new List < Inspection_Item__c > ();
@@ -868,14 +889,17 @@
         // SWAG-AREBA8 end
         toDeleteAhs = [select Id, AssetId__c from Inspection_Item__c where AssetId__c in :unCheckedAssetIds and Inspection_ReportId__c = :ir.Id];
 
+        system.debug('884');
         try {
             if (manualDeleteAhs.size() > 0) toDeleteAhs.addAll(manualDeleteAhs);
             OFSInsReportAssetHistoryController.deleteInspection_Item(ir, toDeleteAhs);
         } catch(Exception e) {
             clearIrId(sp, e, isIrNew);
+            system.debug('890');
             return null;
         }
 
+        system.debug('894');
         try {
             //OFSInsReportAssetHistoryController.upsertInspection_Item(ir, toUpsertAhs);
             OFSInsReportAssetHistoryController.upsertInspection_Item(ir, new List < Inspection_Item__c > (toUpsertAhsMap.keySet()));
@@ -884,9 +908,11 @@
             for (Inspection_Item__c ah: toUpsertAhsMap.keySet()) {
                 if (toUpsertAhsMap.get(ah).isNew == true) ah.Id = null;
             }
+            system.debug('903');
             return null;
         }
 
+        system.debug('905');
         saveOK = true;
         this.init();
         return null;
@@ -896,6 +922,7 @@
         if (isIrNew) ir.Id = null;
         Database.rollback(sp);
         ApexPages.addMessages(e);
+        //IsAddmessage = true;
     }
 
     private Boolean checkHpChange() {
@@ -1151,10 +1178,11 @@
     }
 
     // 妫�绱㈡寜閽�
-    public PageReference searchBtn() {
+    public void searchBtn() {
         countorder = 1;
         //楠岃瘉
-        assetSerialNumberList.clear();
+        // assetSerialNumberList.clear();
+        // this.unCheckedInfoList.clear();
         getAssetSerialNumber();
         List < Asset > assetconfimList = getAssetconfim(text1, cond1, val1);
         // 鑾峰彇assets
@@ -1166,20 +1194,21 @@
         text1ForSort = text1;
         cond1ForSort = cond1;
         val1ForSort = val1;
-        system.debug('=====unCheckedInfoList:' + unCheckedInfoList.size());
-        for (AssetInfo Ai: unCheckedInfoList) {
-            if (Ai.rec_checkBox_c) {
-                system.debug('=====uncheck SerialNumber1:' + Ai.rec.SerialNumber);
-            }
-        }
-        for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
-            for (AssetInfo Ai: Li) {
-                if (Ai.rec_checkBox_c) {
-                    system.debug('=====uncheck SerialNumber2:' + Ai.rec.SerialNumber);
-                }
-            }
-        }
-        return null;
+        // system.debug('=====unCheckedInfoList:' + unCheckedInfoList.size());
+        // for (AssetInfo Ai: unCheckedInfoList) {
+        //     if (Ai.rec_checkBox_c) {
+        //         system.debug('=====uncheck SerialNumber1:' + Ai.rec.SerialNumber);
+        //     }
+        // }
+        // for (List < AssetInfo > Li: unCheckedInfoListForThousend) {
+        //     for (AssetInfo Ai: Li) {
+        //         if (Ai.rec_checkBox_c) {
+        //             system.debug('=====uncheck SerialNumber2:' + Ai.rec.SerialNumber);
+        //         }
+        //     }
+        // }
+        // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '77777777777777777:' + unCheckedInfoList.size()));
+        // return null;
     }
     // 鏄庣粏鎺掑簭
     public void sortTable() {
@@ -1281,7 +1310,7 @@
             soql += ' AND Status = \'浣跨敤涓璡'';
         }
         // fxk 2021/8/4 鏂板姞 Start
-        soql += ' and (Asset.CurrentContract_F__r.Status__c != \'濂戠磩\' or (Asset.CurrentContract_F__r.Status__c = \'濂戠磩\' and Asset.CurrentContract_F_asset__r.Check_object__c = false) or Asset.CurrentContract_F__c = null) ';
+        soql += ' and (Asset.CurrentContract_F__c = \'a0H100000156VLH\' OR  Asset.CurrentContract_F__r.Status__c != \'濂戠磩\' or (Asset.CurrentContract_F__r.Status__c = \'濂戠磩\' and Asset.CurrentContract_F_asset__r.Check_object__c = false) or (Asset.CurrentContract_F__r.Status__c = \'濂戠磩\' and Asset.CurrentContract_F__r.Effective_Status__c = \'鏃犳晥\') or Asset.CurrentContract_F__c = null) ';
         // fxk 2021/8/4 鏂板姞 End
         if (assetSerialNumberList.size() > 0) {
             soql += ' AND SerialNumber not in ' + sqlTail;
@@ -1473,6 +1502,7 @@
             }
         }
 
+
         // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
         //if (overLimit) {
         //    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '鏁版嵁瓒呰繃' + Select_Limit + '鏉★紝鍙樉绀哄墠' + Select_Limit + '鏉�'));

--
Gitblit v1.9.1