From 98cf72d721051ca2c5dadc2a80d2eac9a92bf29d Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期二, 25 四月 2023 17:24:29 +0800
Subject: [PATCH] Intake判定页面RepPAEDecisionRecord

---
 force-app/main/default/classes/RepPAEDecisionRecordController.cls | 1036 +++++++++++++++++++++++++++++++++++++++++
 force-app/main/default/pages/RepPAEDecisionRecord.page-meta.xml   |    7 
 force-app/main/default/pages/RepPAEDecisionRecord.page            |  402 ++++++++++++++++
 3 files changed, 1,445 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/RepPAEDecisionRecordController.cls b/force-app/main/default/classes/RepPAEDecisionRecordController.cls
new file mode 100644
index 0000000..30fe21a
--- /dev/null
+++ b/force-app/main/default/classes/RepPAEDecisionRecordController.cls
@@ -0,0 +1,1036 @@
+public with sharing class RepPAEDecisionRecordController {
+    public PAE_DecisionRecord__c rdRecord {
+        get;
+        set;
+    }
+    //PAE鍒ゅ畾璁板綍鐨処d
+    public String Id {
+        get;
+        set;
+    }
+    //PAE鍒ゅ畾璁板綍鐨勮褰曠被鍨婭d
+    public String RecordTypeId;
+    public String RecordTypeIdD;
+    public String RecordTypeName {
+        get;
+        set;
+    }
+    public String ASac_ASrc;
+    public Boolean editAble {
+        get;
+        set;
+    }
+    // 淇濆瓨鎸夐挳 闇�瑕佽�冭檻鍐嶇幇/涓嶅啀鐜扮殑鏇存柊浜嗐��
+    // 绠�妗o細2F4_鎶�鏈帹杩涢儴锛�2F4_鎶�鏈帹杩涢儴_闈濻SO锛�2F2B_鏈嶅姟绠$悊锛岀郴缁熺鐞嗗憳鐨勪汉鎿嶄綔鐨勬椂鍊欙紝闇�瑕佸厑璁告搷浣溿�愪繚瀛樸�戙��
+    public Boolean savebuton {
+        get;
+        set;
+    }
+    public Integer CancelineFlag {
+        get;
+        set;
+    }
+    public String OCSM_QARA {
+        get;
+        set;
+    } //20200310
+    public String OCSM_Cording {
+        get;
+        set;
+    } //20200310
+    public String intakePAEReappearConfirm {
+        get;
+        set;
+    }
+    public Integer pageLimit{get;set;}
+    // 濡傛灉Repair__c     涓璂OJ_Status__c       鐨勫瓧娈靛�间负寰匛tQ Response 鎴栬��
+    //     Report__c 涓瑿omplaintStatus__c  鐨勫瓧娈靛�间负寰匛tQ Response 灏嗘爣璁版敼涓簍rue
+    // 褰卞搷鑷冲搴旈〉闈腑鐨勬寜閽槸鍚﹀彲鐢�
+    public Boolean editFlag {
+        get;
+        set;
+    }
+    // 褰撳墠鎶ュ憡涔�
+    public Report__c repa {
+        get;
+        set;
+    }
+    // 鏄惁鏄疧SH
+    public Boolean isOSH {
+        get;
+        set;
+    }
+    public String ReportId {
+        get;
+        set;
+    }
+    public String productIdx {
+        get;
+        set;
+    }
+    //椤甸潰鐨勬槑缁�
+    public List < PAE_DecisionRecordDetailInfo > paedRecordDetailView {
+        get;
+        set;
+    }
+    public Integer paedRecordDetailViewCount {
+        get {
+            return paedRecordDetailView == null ? 0 : paedRecordDetailView.size();
+        }
+    }
+    public RepPAEDecisionRecordController(ApexPages.StandardController stdController) {
+        Id = ApexPages.currentPage().getParameters().get('Id');
+        String profileId = UserInfo.getProfileId();
+        // 褰撳墠鐢ㄦ埛鏄惁鍦� OSH鑷畾涔夋爣绛句腑
+        isOSH = System.label.OSH.contains(profileId);
+        System.debug('isOSH+' + isOSH);
+        // 鍒ゆ柇Report__c鐨凜omplaintStatus__c瀛楁鍊兼槸鍚︿负寰匛tQ Response
+        ReportId = ApexPages.currentPage().getParameters().get('ReportId');
+        List < Report__c > Rep = [select id, name, ComplaintStatus__c, AsyncData__c from Report__c where id = : ReportId];
+        //绮剧悽绉戞妧  zxk  2021-11-03 鏍规嵁淇悊杩涜鐨勪慨鏀�   start 
+         if (Rep.size() > 0){
+              repa = Rep.get(0);
+              system.debug('+++++++++++++++++'+repa);
+                if ('寰匛tQ Response'.equals(Rep.get(0).ComplaintStatus__c)) {
+                    editFlag = true;
+                }
+            } 
+        //绮剧悽绉戞妧  zxk  2021-11-03 鏍规嵁淇悊杩涜鐨勪慨鏀�   end 
+
+        // if (Rep.size() > 0 && '寰匛tQ Response'.equals(Rep.get(0).ComplaintStatus__c)) {
+        //     editFlag = true;
+        // }
+        paedRecordDetailView = new List < PAE_DecisionRecordDetailInfo > ();
+        editAble = false;
+        CancelineFlag = 2;
+        productIdx = '';
+        // PAE_DecisionRecord__c 璁板綍绫诲瀷 ASRCDecision ASACDecision
+        // ASRCDecision --> Intake
+        // ASACDecision --> Final
+        RecordTypeName = ApexPages.currentPage().getParameters().get('RecordTypeIds');
+        pageLimit = Integer.valueOf(System.Label.mpddetPageLimitsize);//绯荤粺鏍囩
+    }
+    public void init() {
+        editAble = true;
+        //褰撳墠鐧诲綍鐫�鐨凱rofileId
+        String profileId = UserInfo.getProfileId().substring(0, 15);
+        //118_CFDA锛堣川閲忔硶瑙勬湰閮級鎷呭綋 绠�妗D鍜� 118_CFDA锛堣川閲忔硶瑙勬湰閮級绐楀彛 绠�妗D鍜岀鐞嗗憳
+        if (profileId.equals(System.Label.ProfileId_OCSM_QARA1) || profileId.equals(System.Label.ProfileId_OCSM_QARA2) || UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)) {
+            OCSM_QARA = '1';
+        } else {
+            OCSM_QARA = '0';
+        }
+        //ProfileId 2F2B_2F4
+        if (System.Label.ProfileId2F2B_2F4.contains(profileId)) {
+            OCSM_Cording = '1';
+        } else {
+            OCSM_Cording = '0';
+        }
+        if (System.Label.ProfileId2F2B_2F4.contains(profileId) || UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin) {
+            savebuton = true;
+        } else {
+            savebuton = false;
+        }
+        if (String.isNotBlank(RecordTypeName)) {
+            RecordTypeId = Schema.SObjectType.PAE_DecisionRecord__c.getRecordTypeInfosByDeveloperName().get(RecordTypeName).getRecordTypeId();
+        } else {
+            List < PAE_DecisionRecord__c > paedRdList = [select Id, PAE_Report__c, RecordTypeId, PAEDetail_DetermineResults__c, RecordType.DeveloperName from PAE_DecisionRecord__c where Id = : Id];
+            if (paedRdList.size() > 0) {
+                RecordTypeName = paedRdList[0].RecordType.DeveloperName;
+                RecordTypeId = paedRdList[0].PAE_Report__c;
+            }
+        }
+        if ('ASRCDecision' == RecordTypeName) {
+            ASac_ASrc = 'Intake';
+            RecordTypeIdD = Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId();
+        } else if ('ASACDecision' == RecordTypeName) {
+            ASac_ASrc = 'Final';
+            RecordTypeIdD = Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('final').getRecordTypeId();
+        }
+        rdRecord = new PAE_DecisionRecord__c();
+        Report__c repair1OrQIS1;
+        if (!string.isBlank(ReportId)) {
+            repair1OrQIS1 = [select id, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c from Report__c where id = : ReportId];
+        }
+        Map < String, PAE_DecisionRecordDetailInfo > MidMap = new Map < String, PAE_DecisionRecordDetailInfo > ();
+        if (Id == NULL || Id == '') {
+            if (string.isnotBlank(ReportId)) {
+                rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c;
+            }
+            //棰勭暀涓�琛�
+            PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
+            paedrd.PAED_Status__c = '鏈夋晥';
+            paedrd.RecordTypeId = RecordTypeIdD;
+            paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
+            //棰勭暀涓�琛�
+        } else {
+            List < PAE_DecisionRecord__c > rdRecordList = new List < PAE_DecisionRecord__c > ();
+            List < PAE_DecisionRecordDetail__c > rdRecordDetailList = new List < PAE_DecisionRecordDetail__c > ();
+            rdRecordList = [SELECT Id, Name, CurrencyIsoCode, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
+                SystemModstamp, PAE_DetermineResults__c, PAE_ConfirmationDate__c,
+                PAE_Authenticator__c, PAE_reappear_confirm__c,
+                PAEDetail_DetermineResults__c, PAE_DetermineResults_Text__c
+                FROM PAE_DecisionRecord__c where Id = : Id
+            ];
+            if (rdRecordList.size() > 0) {
+                rdRecord = rdRecordList[0];
+            }
+            //PAE_reappear_confirm__c  鍐嶇幇缁撴灉纭
+            if (string.isnotBlank(ReportId)) {
+                rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c;
+            }
+            rdRecordDetailList = [SELECT Id, IsDeleted, Name, CurrencyIsoCode, CreatedDate, CreatedById,
+                LastModifiedDate, LastModifiedById, SystemModstamp, PAE_DecisionRecordD__c,
+                PAED_ManagementCode__c, PAE_Judge__c, PAED_Reappear_Result__c, PAED_ResultAffirmant__r.Name,
+                PAED_ResultConfirmationDate__c, Final_universal_code__c,
+                PAED_Status__c, PAED_ConfirmationDate__c, PAED_Affirmant__c, PAE_is_save__c,
+                PAED_Affirmant__r.Name, PAED_RCAC__c, PAED_CancellationDate__c, PAED_Nullifier__c,
+                PAED_Nullifier__r.Name, isInterfaceCreate__c, Location__c, LocationGroup__c, FinalUniversalDesc__c,
+                Phenomenon__c, IntakeUniversalDesc__c, PhenomenonDesc__c,
+                // NFM109淇℃伅鑾峰彇锛孏zw add 20200826
+                Description__c, Cause__c, EtqPart__c, EtqAsAnalyzed__c, EtqCause__c,
+                InspectionCategory109__c, PAED_Affirmant_F__c, PAED_ConfirmationDate_F__c,
+                //璇鹃94 add by rentongxiao 2020-10-10 start
+                PAED_ResultAffirmant_new__c
+                //add by rentx 2020-11-04 
+                , isedit__c, RecordTypeId
+                // RVS005淇℃伅鑾峰彇 gzw add 20201126 start
+                , RVSDetailNo__c, RVS_Date__c, RVS_Time__c, RVS_Decision_Person__c, Monitor_PAE__c
+                // RVS005淇℃伅鑾峰彇 gzw add 20201126 end
+                FROM PAE_DecisionRecordDetail__c
+                where PAE_DecisionRecordD__c = : Id Order by PAED_Status__c, PAED_ManagementCode__c ASC
+            ];      
+            for (Integer i = 0; i < rdRecordDetailList.size(); i++) {
+                MidMap.put(rdRecordDetailList[i].Id, new PAE_DecisionRecordDetailInfo(rdRecordDetailList[i]));
+            }
+            for (PAE_DecisionRecordDetailInfo paeDrd: MidMap.values()) {
+                paedRecordDetailView.add(paeDrd);
+            }
+        }
+    }
+    //淇濆瓨骞跺叧闂�
+    public PageReference SaveAndClose() {
+        // 鍙栨秷琛�
+        if (CancelineFlag == 3) {
+            Integer FLG = 0;
+            Integer Count = 0;
+            for (PAE_DecisionRecordDetailInfo CheckCount: paedRecordDetailView) {
+                FLG = FLG + 1;
+                if (CheckCount.check == false) {
+                    Count = Count + 1;
+                }
+            }
+            if (Count == FLG) {
+                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇烽�夋嫨瑕佸彇娑堢殑琛�'));
+                return null;
+            }
+        }
+        List < PAE_DecisionRecordDetail__c > insertPaeDRDList = new List < PAE_DecisionRecordDetail__c > ();
+        Savepoint sp = Database.setSavepoint();
+        PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
+        String paedRecordId = '';
+        //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨勬�绘暟閲�
+        //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨凱AE鏁伴噺
+        //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨刄nknown鏁伴噺
+        //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨凬onPAE鏁伴噺
+        Integer PAE_Judge_num = 0;
+        Integer PAE_Judge_num_PAE = 0;
+        Integer PAE_Judge_num_Unknown = 0;
+        Integer PAE_Judge_num_nonPAE = 0;
+        String PAE_DetermineResults = null;
+        String prevDetermineResults = null;
+        // try {
+            //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨勬�绘暟閲�
+            //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨凱AE鏁伴噺
+            //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨刄nknown鏁伴噺
+            //鏄庣粏鏈夋晥鐘舵�佹璁板綍鐨凬onPAE鏁伴噺
+            //濡傛灉Code鍖呭惈姹夊瓧鎴栬秴杩�15瀛楁暟鐨勫寲锛岄渶瑕佹彁閱掋�傘�怚ntake universal code涓嶅彲浠ヤ娇鐢ㄦ眽瀛楋紝涓嶅彲浠ヨ秴杩�15瀛楁暟銆�
+            for (PAE_DecisionRecordDetailInfo rdRecorddl: paedRecordDetailView) {
+                if (!(rdRecorddl.check && CancelineFlag == 3) && rdRecorddl.paedrdd.PAED_Status__c != '鍙栨秷') {
+                    PAE_Judge_num++;
+                    if (rdRecorddl.paedrdd.PAE_Judge__c == 'PAE') {
+                        PAE_Judge_num_PAE++;
+                    }
+                    if (rdRecorddl.paedrdd.PAE_Judge__c == 'Unknown') {
+                        PAE_Judge_num_Unknown++;
+                    }
+                    if (rdRecorddl.paedrdd.PAE_Judge__c == 'nonPAE') {
+                        PAE_Judge_num_nonPAE++;
+                    }
+                    // gzw 20210409 淇敼鍙傛暟涓虹┖鏃讹紝琛ㄨ揪寮忓垽鏂嚭閿欓棶棰�
+                    if (Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId() == rdRecorddl.paedrdd.RecordTypeId && (containsChineseCharacters(rdRecorddl.paedrdd.PAED_ManagementCode__c) || (String.isNotBlank(rdRecorddl.paedrdd.PAED_ManagementCode__c) && rdRecorddl.paedrdd.PAED_ManagementCode__c.length() > 15))) {
+                        rdRecorddl.paedrdd.PAED_ManagementCode__c.adderror('Intake universal code涓嶅彲浠ヤ娇鐢ㄦ眽瀛楋紝涓嶅彲浠ヨ秴杩�15瀛楁暟銆�');
+                        return null;
+                    }
+                }
+                System.debug('rdRecorddl.paedrdd.Location__c' + rdRecorddl.paedrdd.Location__c);
+            }
+            if (PAE_Judge_num_PAE > 0) {
+                PAE_DetermineResults = 'PAE';
+            } else if (PAE_Judge_num_Unknown > 0) {
+                PAE_DetermineResults = 'Unknown';
+            } else if (PAE_Judge_num_nonPAE == PAE_Judge_num && PAE_Judge_num_nonPAE > 0) {
+                PAE_DetermineResults = 'nonPAE';
+            } else {
+                PAE_DetermineResults = null;
+            }
+            rdRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;
+            //System.debug('-----------------------:' + PAE_DetermineResults);
+            //鏂板PAE鍒ゅ畾
+            if (String.isBlank(Id)) {
+                //妫�鏌ユ槑缁嗙殑缂栫爜鏄惁涓虹┖---20200107 add 妫�鏌ユ槑缁嗙殑PAE鍒ゅ畾鏄惁蹇呭~
+                if (IsEmptyManagementCode(paedRecordDetailView)) {
+                    return null;
+                }
+                paedRecord.PAE_Report__c = ReportId;
+                paedRecord.PAE_reappear_confirm__c = rdRecord.PAE_reappear_confirm__c; // 20200908 Gzw Final 鍐嶇幇缁撴灉涓㈠け闂 add
+                paedRecord.RecordTypeId = RecordTypeId;
+                insert paedRecord;
+                paedRecordId = paedRecord.Id;
+                UpsertPAE_DecisionRecordDetail(null, paedRecordDetailView, paedRecordId, false, prevDetermineResults);
+            } else {
+                //淇敼PAE鍙樻洿
+                List < PAE_DecisionRecord__c > paedRecordList = [select Id, PAE_DetermineResults__c, PAE_DetermineResults_Text__c, PAE_reappear_confirm__c from PAE_DecisionRecord__c where Id = : Id];
+                List < PAE_DecisionRecordDetail__c > rdRecordDetailList = new List < PAE_DecisionRecordDetail__c > ();
+                //瀛樺湪鐨勬槑缁哅ap
+                Map < Id, PAE_DecisionRecordDetail__c > paedRecordStatusMap = new Map < Id, PAE_DecisionRecordDetail__c > ();
+                rdRecordDetailList = [SELECT Id, IsDeleted, Name, CurrencyIsoCode, CreatedDate, CreatedById,
+                    LastModifiedDate, LastModifiedById, SystemModstamp, PAE_DecisionRecordD__c,
+                    PAED_ManagementCode__c, PAE_Judge__c, PAED_Reappear_Result__c, PAED_ResultAffirmant__r.Name,
+                    PAED_ResultConfirmationDate__c, Final_universal_code__c,
+                    PAED_Status__c, PAED_ConfirmationDate__c, PAED_Affirmant__c, PAE_is_save__c,
+                    PAED_Affirmant__r.Name, PAED_RCAC__c, PAED_CancellationDate__c, PAED_Nullifier__c,
+                    PAED_Nullifier__r.Name, isInterfaceCreate__c, Location__c, LocationGroup__c, FinalUniversalDesc__c,
+                    Phenomenon__c, IntakeUniversalDesc__c, PhenomenonDesc__c,
+                    // NFM109淇℃伅鑾峰彇锛孏zw add 20200826
+                    Description__c, Cause__c, EtqPart__c, EtqAsAnalyzed__c, EtqCause__c,
+                    InspectionCategory109__c, PAED_Affirmant_F__c, PAED_ConfirmationDate_F__c,
+                    //璇鹃94 add by rentongxiao 2020-10-10 start
+                    PAED_ResultAffirmant_new__c
+                    //add by rentx
+                    , isedit__c, RecordTypeId
+                    // RVS005淇℃伅鑾峰彇 gzw add 20201126 start
+                    , RVSDetailNo__c, RVS_Date__c, RVS_Time__c, RVS_Decision_Person__c, Monitor_PAE__c
+                    // RVS005淇℃伅鑾峰彇 gzw add 20201126 end
+                    FROM PAE_DecisionRecordDetail__c
+                    where PAE_DecisionRecordD__c = : Id Order by PAED_Status__c, PAED_ManagementCode__c
+                ];
+                if (rdRecordDetailList.size() > 0) {
+                    for (PAE_DecisionRecordDetail__c paedrd: rdRecordDetailList) {
+                        paedRecordStatusMap.put(paedrd.Id, paedrd);
+                    }
+                }
+                system.debug('paedRecordStatusMap===========>'+paedRecordStatusMap);
+                if (paedRecordList.size() > 0) {
+                    //PAE鍒ゅ畾鐨処d
+                    paedRecordId = paedRecordList[0].Id;
+                    //PAE鍒ゅ畾璁板綍鐨勭姸鎬佷笉鍙�
+                    prevDetermineResults = paedRecordList[0].PAE_DetermineResults_Text__c;
+                    if (paedRecordList[0].PAE_DetermineResults_Text__c == PAE_DetermineResults) {
+                        //妫�鏌ユ槑缁嗙殑缂栫爜鏄惁涓虹┖---20200107 add 妫�鏌ユ槑缁嗙殑PAE鍒ゅ畾鏄惁蹇呭~
+                        if (IsEmptyManagementCode(paedRecordDetailView)) {
+                            return null;
+                        }
+                        UpsertPAE_DecisionRecordDetail(paedRecordStatusMap, paedRecordDetailView, paedRecordId, false, prevDetermineResults);
+                    } else if (paedRecordList[0].PAE_DetermineResults_Text__c != PAE_DetermineResults) {
+                        //PAE鍒ゅ畾璁板綍鐨勭姸鎬佹敼鍙�
+                        //妫�鏌ユ槑缁嗙殑缂栫爜鏄惁涓虹┖---20200107 add 妫�鏌ユ槑缁嗙殑PAE鍒ゅ畾鏄惁蹇呭~
+                        if (IsEmptyManagementCode(paedRecordDetailView)) {
+                            return null;
+                        }
+                        insertPaeDRDList = new List < PAE_DecisionRecordDetail__c > ();
+                        paedRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;
+                        paedRecord.PAE_Report__c = ReportId;
+                        paedRecord.RecordTypeId = RecordTypeId;
+                        insert paedRecord;
+                        paedRecordId = paedRecord.Id;
+                        UpsertPAE_DecisionRecordDetail(paedRecordStatusMap, paedRecordDetailView, paedRecordId, true, prevDetermineResults);
+                    }
+                }
+            }
+        // } catch (Exception e) {
+        //     ApexPages.addMessages(e);
+        //     Database.rollback(sp);
+        //     return null;
+        // }
+        if (CancelineFlag != 2) {
+            return RefreshOriginalInterface(paedRecordId);
+        } else {
+            return ReturnReportInterface();
+        }
+    }
+    //杩斿洖鎶ュ憡涔﹂〉闈�
+    public PageReference ReturnReportInterface() {
+        PageReference ref;
+        system.debug('鍟﹀暒鍟eportId1' + ReportId);
+        if (String.isnotBlank(ReportId)) {
+            ref = new Pagereference('/' + ReportId);
+        }
+        //PageReference ref = new Pagereference('/' + ReportId);
+        ref.setRedirect(true);
+        return ref;
+    }
+    //鐣欏湪褰撳墠椤甸潰
+    public PageReference RefreshOriginalInterface(String paedRecordId) {
+        PageReference ref;
+        if (String.isnotBlank(ReportId)) {
+            ref = new Pagereference('/apex/RepPAEDecisionRecord?Id=' + paedRecordId + '&ReportId=' + ReportId + '&RecordTypeIds=' + RecordTypeName);
+        }
+        ref.setRedirect(true);
+        return ref;
+    }
+    //杩斿洖Intake椤甸潰
+    public PageReference toIntake() {
+        String url = null;
+        if (String.isnotBlank(ReportId)) {
+            List < PAE_DecisionRecord__c > pAE_DecisionRecord = [SELECT LastModifiedDate, Id, Name, LastModifiedById, RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = : ReportId And RecordType.DeveloperName = 'ASRCDecision'
+                Order by LastModifiedDate desc
+            ];
+            if (pAE_DecisionRecord.size() > 0) {
+                url = '/apex/RepPAEDecisionRecord?Id=' + pAE_DecisionRecord[0].Id + '&ReportId=' + ReportId + '&RecordTypeIds=ASRCDecision';
+            } else {
+                url = '/apex/RepPAEDecisionRecord?ReportId=' + ReportId + '&RecordTypeIds=ASRCDecision';
+            }
+        }
+        PageReference ref = new Pagereference(url);
+        ref.setRedirect(true);
+        return ref;
+    }
+   //鎻掑叆绌鸿
+    public PageReference InsertRow() {
+        // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  start
+        List < String > codeNumDataList = new List < String > ();
+        for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
+            String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
+            if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
+                codeNumDataList.add(managementCodeStr);
+            }
+        }
+        Map < String, String > strMapData = updateIsPae(codeNumDataList);
+        for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
+            String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
+            if (String.isBlank(pdrdInFoCode.paedrdd.Id)) {
+                if (String.isNotBlank(managementCodeStr)) {
+                    if (pdrdInFoCode.paedrdd.PAE_Judge__c != strMapData.get(managementCodeStr) || String.isBlank(strMapData.get(managementCodeStr))) {
+                        pdrdInFoCode.monitorPAE = true;
+                    } else {
+                        pdrdInFoCode.monitorPAE = false;
+                    }
+                }
+            }
+        }
+        // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  end
+        PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
+        paedrd.PAED_Status__c = '鏈夋晥';
+        paedrd.RecordTypeId = RecordTypeIdD;
+        // Integer styNum = paedRecordDetailView.size();
+        paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
+        return null;
+    }
+    //鎵归噺鎻掑叆绌鸿瀛楃涓�
+    public void InsertMoreRows() {
+        // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪��
+        List < String > codeNumDataList = new List < String > ();
+        for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
+            String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
+            if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
+                // && pdrdInFoCode.paedrdd.PAE_is_save__c != '1'
+                for (String codeStr: managementCodeStr.split(',')) {
+                    if (String.isNotBlank(codeStr)) {
+                        codeNumDataList.add(codeStr);
+                    }
+                }
+            }
+        }
+        Map < String, String > strMapData = updateIsPae(codeNumDataList);
+        // 绮剧悽绉戞妧   zxk  2021-10-21  end  缁橮AE鍒ゅ畾璁板綍璧嬪��
+        List < PAE_DecisionRecordDetailInfo > paedRecordDetailViewTemporary = new List < PAE_DecisionRecordDetailInfo > ();
+        List < String > codeList = new List < String > ();
+        for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
+            String managementCode = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+            String finalUniversalCode = paedRDInfo.paedrdd.Final_universal_code__c;
+            Date confirmationDate = paedRDInfo.paedrdd.PAED_ConfirmationDate__c;
+            String pStatus = paedRDInfo.paedrdd.PAED_Status__c;
+            PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
+            // 20210719 gzw LJPH-C4Y57Q start
+            if (managementCode == '000' && paedRDInfo.paedrdd.PAE_Judge__c == null) {
+                paedRDInfo.paedrdd.PAE_Judge__c = 'Unknown';
+            }
+            // 20210719 gzw LJPH-C4Y57Q end
+            if (paedRDInfo.paedrdd.PAED_Status__c != '鍙栨秷') {
+                if (String.isBlank(finalUniversalCode) && confirmationDate == null) {
+                    if (String.isNotBlank(managementCode)) {
+                        if (managementCode.indexof(',') != -1) {
+                            Integer q = 1;
+                            for (String code: managementCode.split(',')) {
+                                 // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  start
+                                PAE_DecisionRecordDetailInfo info = new PAE_DecisionRecordDetailInfo();
+                                // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  end
+                                // bug fix gzw 宸叉湁鐨勭┖code鏁版嵁锛屾暟鎹暟鎹椂锛屼細鏂板缓  20201214 start
+                                PAE_DecisionRecordDetail__c paedrdtemp;
+                                if (q == 1) {
+                                    paedrdtemp = paedRDInfo.paedrdd;
+                                } else {
+                                    paedrdtemp = new PAE_DecisionRecordDetail__c();
+                                }
+                                paedrd = ReproduceResult(paedrdtemp, paedRDInfo); //20200106 add
+                                // bug fix gzw 宸叉湁鐨勭┖code鏁版嵁锛屾暟鎹暟鎹椂锛屼細鏂板缓  20201214 start
+                                paedrd.PAED_Status__c = '鏈夋晥';
+                                paedrd.PAED_ManagementCode__c = code;
+                                if (code == '000') {
+                                    paedrd.PAE_Judge__c = 'Unknown';
+                                }
+                                paedrd.RecordTypeId = RecordTypeIdD;
+                                paedrd.PAE_is_save__c = '';
+                                  // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪�� 
+                                if (strMapData.containsKey(code)) {
+                                    paedrd.PAE_Judge__c = strMapData.get(code);
+                                    info.strJudge = strMapData.get(code);
+                                    info.monitorPAE = false;
+                                    paedrd.Monitor_PAE__c = false;
+                                } else if (managementCode.indexof(code) != -1) {
+                                        paedrd.PAE_Judge__c = null;
+                                        info.strJudge = paedRDInfo.strJudge;
+                                        info.monitorPAE = true;
+                                }
+                                if (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '') {
+                                    paedrd.Monitor_PAE__c = true;
+                                    info.monitorPAE = true;
+                                }
+                                info.paedrdd = paedrd;
+                                paedRecordDetailViewTemporary.add(info);
+                                // 绮剧悽绉戞妧   zxk  2021-10-21  end  缁橮AE鍒ゅ畾璁板綍璧嬪��
+                                q++;
+                            }
+                        } else {
+                             // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  start
+                            PAE_DecisionRecordDetailInfo info = new PAE_DecisionRecordDetailInfo();
+                            // 2021-12-08  zxk  绮剧悽绉戞妧   鎵嬪姩璧嬪�奸�昏緫  end
+                            // bug fix gzw 宸叉湁鐨勭┖code鏁版嵁锛屾暟鎹暟鎹椂锛屼細鏂板缓  20201214 start
+                            PAE_DecisionRecordDetail__c paedrdtemp = paedRDInfo.paedrdd;
+                            paedrd = ReproduceResult(paedrdtemp, paedRDInfo); //20200106 add
+                            // bug fix gzw 宸叉湁鐨勭┖code鏁版嵁锛屾暟鎹暟鎹椂锛屼細鏂板缓  20201214 end
+                            paedrd.PAED_Status__c = '鏈夋晥';
+                            paedrd.RecordTypeId = RecordTypeIdD;
+                            paedrd.PAED_ManagementCode__c = managementCode;
+                             // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪�� 
+                            if (strMapData.containsKey(managementCode) && productIdx == managementCode) {
+                                paedrd.PAE_Judge__c = strMapData.get(managementCode);
+                                info.strJudge = strMapData.get(managementCode);
+                                info.monitorPAE = false;
+                                paedrd.Monitor_PAE__c = false;
+                            } else {
+                                 info.strJudge = paedRDInfo.strJudge;
+                                if (strMapData.get(managementCode) != paedRDInfo.paedrdd.PAE_Judge__c || (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '')) {
+                                   
+                                    info.monitorPAE = true;
+                                }
+                            }
+                            if (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '') {
+                                paedrd.Monitor_PAE__c = true;
+                                // info.monitorPAE = true;
+                            }
+                            info.paedrdd = paedrd;
+                            paedRecordDetailViewTemporary.add(info);
+                            // 绮剧悽绉戞妧   zxk  2021-10-21  end  缁橮AE鍒ゅ畾璁板綍璧嬪�� 
+                        }
+                    } else {
+                        // Gzw 20201215 缂栬緫椤甸潰绌虹櫧琛屽け鍘荤劍鐐瑰悗琛屾秷澶� 瀵瑰簲
+                        paedRecordDetailViewTemporary.add(paedRDInfo);
+                    }
+                } else {
+                    paedRecordDetailViewTemporary.add(paedRDInfo);
+                }
+            } else {
+                paedRecordDetailViewTemporary.add(paedRDInfo);
+            }
+        }
+        if (paedRecordDetailViewTemporary != null) {
+            paedRecordDetailView = new List < PAE_DecisionRecordDetailInfo > ();
+            paedRecordDetailView.addAll(paedRecordDetailViewTemporary);
+            if (paedRecordDetailView.size() == 0) {
+                PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
+                paedrd.PAED_Status__c = '鏈夋晥';
+                paedrd.RecordTypeId = RecordTypeIdD;
+                paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
+            }
+        }
+    }
+    //妫�鏌ユ槑缁嗙殑缂栫爜鏄惁涓虹┖---20200107 add 妫�鏌ユ槑缁嗙殑PAE鍒ゅ畾鏄惁蹇呭~
+    public Boolean IsEmptyManagementCode(List < PAE_DecisionRecordDetailInfo > paedRecordDetailView) {
+        String isEmpty = '';
+        if (paedRecordDetailView.size() == 0) {
+            return true;
+        }
+        // gzw 20201215 鍙栨秷鏃朵笉闇�瑕佸垽鏂紪鐮佸拰鐘舵�� 杩藉姞 && CancelineFlag != 3
+        for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
+            // gzw 20201215 鍙栨秷鏃�,涓嶅垽鏂姤閿�
+            if (paedRDInfo.paedrdd.PAED_Status__c == '鍙栨秷') {
+                continue;
+            }
+            if (paedRDInfo.paedrdd != null) {
+                system.debug('paedRDInfo.paedrdd.PAED_ManagementCode__c==========>'+paedRDInfo.paedrdd.PAED_ManagementCode__c);
+                system.debug('CancelineFlag=========>'+CancelineFlag);
+                system.debug('paedRDInfo.paedrdd.PAE_Judge__c==========>'+paedRDInfo.paedrdd.PAE_Judge__c);
+                
+                if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && CancelineFlag != 3) {
+                    isEmpty = 'PAE鍒ゅ畾璁板綍鏄庣粏鐨勭紪鐮佷笉鑳戒负绌�';
+                }
+                if (String.isBlank(paedRDInfo.paedrdd.PAE_Judge__c) && CancelineFlag != 3) {
+                    isEmpty = 'PAE鍒ゅ畾璁板綍鏄庣粏鐨凱AE鍒ゅ畾涓嶈兘涓虹┖';
+                }
+            } else {
+                if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && CancelineFlag != 3) {
+                    isEmpty = 'PAE鍒ゅ畾璁板綍鏄庣粏鐨勭紪鐮佷笉鑳戒负绌�';
+                }
+                if (String.isBlank(paedRDInfo.paedrdd.PAE_Judge__c) && CancelineFlag != 3) {
+                    isEmpty = 'PAE鍒ゅ畾璁板綍鏄庣粏鐨凱AE鍒ゅ畾涓嶈兘涓虹┖';
+                }
+            }
+            // gzw 20210409 淇敼鍙傛暟涓虹┖鏃讹紝琛ㄨ揪寮忓垽鏂嚭閿欓棶棰�
+            if (Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId() == paedRDInfo.paedrdd.RecordTypeId && (containsChineseCharacters(paedRDInfo.paedrdd.PAED_ManagementCode__c) || (String.isNotBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && paedRDInfo.paedrdd.PAED_ManagementCode__c.length() > 15))) {
+                isEmpty = 'Intake universal code涓嶅彲浠ヤ娇鐢ㄦ眽瀛楋紝涓嶅彲浠ヨ秴杩�15瀛楁暟銆�';
+                paedRDInfo.paedrdd.PAED_ManagementCode__c.adderror('Intake universal code涓嶅彲浠ヤ娇鐢ㄦ眽瀛楋紝涓嶅彲浠ヨ秴杩�15瀛楁暟銆�');
+                return true;
+            }
+        }
+        if (String.isNotBlank(isEmpty)) {
+            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '鍖呭惈鏃犳晥鏁版嵁:' + isEmpty));
+            return true;
+        }
+        return false;
+    }
+    //鏇存柊PAE鏄庣粏
+    public void UpsertPAE_DecisionRecordDetail(Map < Id, PAE_DecisionRecordDetail__c > paedRecordStatusMap, List < PAE_DecisionRecordDetailInfo > paedRecordDetailView, String paedRecordId, Boolean updateStatusFlag, String prevDetermineResults) {
+         system.debug('paedRecordStatusMap.size()===============>'+paedRecordStatusMap);
+        List < PAE_DecisionRecordDetail__c > upsertPaedrDetailList = new List < PAE_DecisionRecordDetail__c > ();
+        String repair_PAED_ManagementCodes = '';
+        String repair_PAED_ManagementCodesZ = '';
+        String PAE_codez = '';
+        String reappear_confirm = null;
+        Integer PAED_Reappear_Result_noSelect_num = 0;
+        Integer valid_num = 0;
+         // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪��
+        List < String > codeNumDataList = new List < String > ();
+        for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
+            String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
+            if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
+                for (String codeStr: managementCodeStr.split(',')) {
+                    if (String.isNotBlank(codeStr)) {
+                        codeNumDataList.add(codeStr);
+                    }
+                }
+            }
+        }
+        Map < String, String > strMapData = updateIsPae(codeNumDataList);
+        // 绮剧悽绉戞妧   zxk  2021-10-21  end  缁橮AE鍒ゅ畾璁板綍璧嬪��
+        System.debug('paedRecordDetailView ++++++++ ' + paedRecordDetailView.size());
+        for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
+            PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
+            if (paedRDInfo.paedrdd != null) {
+                paedrd.PAED_Report__c = ReportId;
+                paedrd.PAED_RCAC__c = ASac_ASrc;
+                paedrd.PAE_DecisionRecordD__c = paedRecordId;
+                paedrd.RecordTypeId = RecordTypeIdD;
+                paedrd.PAE_is_save__c = '1'; //20200319 add 
+                system.debug('paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)===============>'+paedRDInfo.paedrdd.Id);
+               
+
+                if (paedRecordStatusMap != null && paedRecordStatusMap.size() > 0 && paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)) {
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨鎺ュ彛淇℃伅瀛楁 start
+                    paedrd.isInterfaceCreate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).isInterfaceCreate__c;
+                    paedrd.LocationGroup__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).LocationGroup__c;
+                    paedrd.Location__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Location__c;
+                    paedrd.Phenomenon__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Phenomenon__c;
+                    paedrd.Description__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Description__c;
+                    paedrd.Cause__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Cause__c;
+                    paedrd.EtqPart__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqPart__c;
+                    paedrd.EtqAsAnalyzed__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqAsAnalyzed__c;
+                    paedrd.EtqCause__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqCause__c;
+                    paedrd.FinalUniversalDesc__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).FinalUniversalDesc__c;
+                    paedrd.InspectionCategory109__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).InspectionCategory109__c;
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨鎺ュ彛淇℃伅瀛楁 end
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨RVS005鎺ュ彛淇℃伅瀛楁 start
+                    paedrd.RVSDetailNo__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVSDetailNo__c;
+                    paedrd.PhenomenonDesc__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PhenomenonDesc__c;
+                    paedrd.RVS_Date__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Date__c;
+                    paedrd.RVS_Time__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Time__c;
+                    paedrd.RVS_Decision_Person__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Decision_Person__c;
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨RVS005鎺ュ彛淇℃伅瀛楁 start
+                    paedrd.PAED_Affirmant__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_Affirmant__c;
+                    paedrd.PAED_ConfirmationDate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_ConfirmationDate__c;
+                     // 绮剧悽绉戞妧  zxk  涓篗onitor_PAE__c璧嬪��   start
+                    paedrd.Monitor_PAE__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Monitor_PAE__c;
+                    // 绮剧悽绉戞妧  zxk  涓篗onitor_PAE__c璧嬪��   end
+                    paedrd = ReproduceResult(paedrd, paedRDInfo);
+                    if (CancelineFlag == 3 && paedRDInfo.check && paedRDInfo.paedrdd.PAED_Status__c != '鍙栨秷') {
+                        //鏈夋晥鍙樻垚鍙栨秷
+                        paedrd.PAED_ManagementCode__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_ManagementCode__c;
+                        paedrd.PAED_Status__c = '鍙栨秷';
+                        paedrd.PAED_CancellationDate__c = Date.toDay();
+                        paedrd.PAED_Nullifier__c = UserInfo.getUserId();
+                    } else if (paedRDInfo.paedrdd.PAED_Status__c == '鏈夋晥') {
+                        //鏈夋晥PAE鏄庣粏缂栫爜
+                        paedrd.PAED_Status__c = '鏈夋晥';
+                        paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        if (String.isBlank(repair_PAED_ManagementCodes)) {
+                            repair_PAED_ManagementCodes = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        } else {
+                            repair_PAED_ManagementCodes += ',' + paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        }
+                        if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '涓嶅啀鐝�' && !paedRDInfo.paedrdd.PAED_ManagementCode__c.equals('000')) {
+                            // WLIG-BWMB4S gzw start
+                            String pmcode = paedRDInfo.paedrdd.PAED_ManagementCode__c.trim();
+                            if (pmcode.length() == 3 && (pmcode.endsWith('V') || pmcode.endsWith('W') || pmcode.endsWith('X') || pmcode.endsWith('Y'))) {
+                                PAE_codez = pmcode.substring(0, pmcode.length() - 1) + 'Z';
+                            } else {
+                                PAE_codez = pmcode + 'Z';
+                            }
+                            // WLIG-BWMB4S gzw end
+                            if (String.isBlank(repair_PAED_ManagementCodesZ)) {
+                                repair_PAED_ManagementCodesZ = PAE_codez;
+                            } else {
+                                repair_PAED_ManagementCodesZ += ',' + PAE_codez;
+                            }
+                        }
+                        valid_num++;
+                        if (paedrd.PAED_Reappear_Result__c == null) {
+                            PAED_Reappear_Result_noSelect_num++;
+                        }
+                    } else if (paedRDInfo.paedrdd.PAED_Status__c == '鍙栨秷') {
+                        paedrd.PAED_Status__c = '鍙栨秷';
+                        paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        paedrd.PAED_Nullifier__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_Nullifier__c; //UserInfo.getUserId();
+                        paedrd.PAED_CancellationDate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_CancellationDate__c; //Date.toDay();
+                    }
+                } else if ((paedRecordStatusMap != null && paedRecordStatusMap.size() > 0 && !paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)) || paedRecordStatusMap == null) {
+                    paedrd = ReproduceResult(paedrd, paedRDInfo);
+                    if (paedRDInfo.check && CancelineFlag == 3) {
+                        //鏂板鍙栨秷PAE鍒ゅ畾鏄庣粏
+                        paedrd.PAED_CancellationDate__c = Date.toDay();
+                        paedrd.PAED_Nullifier__c = UserInfo.getUserId();
+                        paedrd.PAED_Status__c = '鍙栨秷';
+                    } else {
+                        paedrd.PAED_Affirmant__c = UserInfo.getUserId();
+                        paedrd.PAED_ConfirmationDate__c = Date.toDay();
+                        paedrd.PAED_Status__c = paedRDInfo.paedrdd.PAED_Status__c;
+                        if (String.isBlank(repair_PAED_ManagementCodes)) {
+                            repair_PAED_ManagementCodes = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        } else {
+                            repair_PAED_ManagementCodes += ',' + paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                        }
+                        //20191217 add 
+                        if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '涓嶅啀鐝�' && !paedRDInfo.paedrdd.PAED_ManagementCode__c.equals('000')) {
+                            // WLIG-BWMB4S gzw start
+                            String pmcode = paedRDInfo.paedrdd.PAED_ManagementCode__c.trim();
+                            if (pmcode.length() == 3 && (pmcode.endsWith('V') || pmcode.endsWith('W') || pmcode.endsWith('X') || pmcode.endsWith('Y'))) {
+                                PAE_codez = pmcode.substring(0, pmcode.length() - 1) + 'Z';
+                            } else {
+                                PAE_codez = pmcode + 'Z';
+                            }
+                            // WLIG-BWMB4S gzw end
+                            if (String.isBlank(repair_PAED_ManagementCodesZ)) {
+                                repair_PAED_ManagementCodesZ = PAE_codez;
+                            } else {
+                                repair_PAED_ManagementCodesZ += ',' + PAE_codez;
+                            }
+                        }
+                        valid_num++;
+                        if (paedrd.PAED_Reappear_Result__c == null) {
+                            PAED_Reappear_Result_noSelect_num++;
+                        }
+                    }
+                    paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
+                    // 绮剧悽绉戞妧   zxk   2021-11-15  涓篗onitor_PAE__c璧嬪��   start
+                    if (String.isBlank(strMapData.get(paedrd.PAED_ManagementCode__c))) {
+                        paedrd.Monitor_PAE__c = true;
+                    } else {
+                        if (strMapData.get(paedrd.PAED_ManagementCode__c) != paedrd.PAE_Judge__c) {
+                            paedrd.Monitor_PAE__c = true;
+                        }
+                    }
+                    // 绮剧悽绉戞妧   zxk   2021-11-15  涓篗onitor_PAE__c璧嬪��   end
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨鎺ュ彛淇℃伅瀛楁 start
+                    paedrd.isInterfaceCreate__c = paedRDInfo.paedrdd.isInterfaceCreate__c;
+                    paedrd.LocationGroup__c = paedRDInfo.paedrdd.LocationGroup__c;
+                    paedrd.Location__c = paedRDInfo.paedrdd.Location__c;
+                    paedrd.Phenomenon__c = paedRDInfo.paedrdd.Phenomenon__c;
+                    paedrd.Description__c = paedRDInfo.paedrdd.Description__c;
+                    paedrd.Cause__c = paedRDInfo.paedrdd.Cause__c;
+                    // paedrd.PAE_Judge__c = paedRDInfo.paedrdd.PAE_Judge__c;
+                    paedrd.EtqPart__c = paedRDInfo.paedrdd.EtqPart__c;
+                    paedrd.EtqAsAnalyzed__c = paedRDInfo.paedrdd.EtqAsAnalyzed__c;
+                    paedrd.EtqCause__c = paedRDInfo.paedrdd.EtqCause__c;
+                    paedrd.FinalUniversalDesc__c = paedRDInfo.paedrdd.FinalUniversalDesc__c;
+                    // paedrd.PAED_RCAC__c = paedRDInfo.paedrdd.PAED_RCAC__c;
+                    paedrd.InspectionCategory109__c = paedRDInfo.paedrdd.InspectionCategory109__c;
+                    // Gzw add 20200821 PAE缁撴灉鍙樺寲鏃讹紝淇濆瓨鎺ュ彛淇℃伅瀛楁 end
+                }
+                //20191216 ljh start
+                //鐘舵�佹槸鍚︽敼鍙�
+                System.debug('+++++++++++++++++++++: ' + updateStatusFlag);
+                if (updateStatusFlag) {
+                    //鏀瑰彉鐘舵��--->澶嶅埗鏂扮殑鏇存柊闇�瑕佹洿鏂扮殑
+                    upsertPaedrDetailList.add(paedrd);
+                } else {
+                    //鏇存柊闇�瑕佹洿鏂扮殑
+                    paedrd.Id = paedRDInfo.paedrdd.Id;
+                    upsertPaedrDetailList.add(paedrd);
+                }
+            }
+        }
+        if (upsertPaedrDetailList.size() > 0) {
+            upsert upsertPaedrDetailList;
+        }
+        System.debug('PAED_Reappear_Result_noSelect_num' + PAED_Reappear_Result_noSelect_num);
+        if (PAED_Reappear_Result_noSelect_num > 0) {
+            reappear_confirm = '鏈‘璁�';
+        } else if (valid_num > 0 && PAED_Reappear_Result_noSelect_num == 0) {
+            reappear_confirm = '宸茬‘璁�';
+        }
+        AssignValuesOtherObjects(repair_PAED_ManagementCodes, paedRecordId, repair_PAED_ManagementCodesZ, reappear_confirm, prevDetermineResults);
+    }
+    //涓篜AE鍒ゅ畾鍜岀浉鍏崇殑淇悊璧嬪��
+    public void AssignValuesOtherObjects(String stitchingCode, String paedRecordId, String stitchingCodeZ, String reappear_confirm, String prevDetermineResults) {
+        if (String.isNotBlank(stitchingCode) && stitchingCode.contains(',')) {
+            String[] stitchingCodeArr = stitchingCode.split(',');
+            stitchingCodeArr.sort();
+            String stitchingCode1 = '';
+            for (Integer i = 0; i < stitchingCodeArr.size(); i++) {
+                if (i < (stitchingCodeArr.size() - 1)) {
+                    stitchingCode1 += stitchingCodeArr[i] + ',';
+                } else {
+                    stitchingCode1 += stitchingCodeArr[i] + '';
+                }
+            }
+            stitchingCode = stitchingCode1;
+        }
+        //鎶ュ憡涔︾浉鍏�
+        if (!string.isBlank(ReportId)) {
+            Report__c Report = [select id, PAE_DetermineAC__c, PAE_Determine__c, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c,
+                PAE_intakePrevDetermineResults__c, PAE_finalPrevDetermineResults__c, Repair_Authenticator__c, OCSM_RC_CordingUser__c
+                from Report__c where id = : ReportId
+            ];
+            List < PAE_DecisionRecord__c > rdRecordList = [SELECT Id, Name, PAE_DetermineResults__c, PAE_DetermineResults_Text__c, PAE_ConfirmationDate__c,
+                PAE_Authenticator__c
+                FROM PAE_DecisionRecord__c where Id = : paedRecordId
+            ];
+            PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
+            paedRecord.Id = paedRecordId;
+            if (ASac_ASrc == 'Intake') {
+                paedRecord.PAE_reappear_confirm__c = reappear_confirm;
+                Report.PAE_reappear_confirm__c = reappear_confirm;
+            } else {
+                paedRecord.PAE_reappear_confirm__c = Report.PAE_reappear_confirm__c;
+            }
+            if (rdRecordList[0].PAE_ConfirmationDate__c == null) {
+                paedRecord.Id = paedRecordId;
+                paedRecord.PAE_ConfirmationDate__c = Date.toDay();
+                paedRecord.PAE_Authenticator__c = UserInfo.getUserId();
+            }
+            if (paedRecord != null) {
+                update paedRecord;
+            }
+            List < Report__c > repList;
+            if (ASac_ASrc == 'Intake') {
+                repList = [select Id, Name, RC_PAED__c, AC_PAED__c from Report__c where RC_PAED__c = : paedRecordId];
+                if (repList.size() == 0) {
+                    if (String.isBlank(Report.Repair_Authenticator__c)) {
+                        Report.Repair_ConfirmationDate__c = Date.toDay();
+                        Report.Repair_Authenticator__c = UserInfo.getName();
+                    }
+                    Report.RC_PAED__c = paedRecordId;
+                } else {
+                    if (String.isBlank(Report.Repair_Authenticator__c)) {
+                        Report.Repair_ConfirmationDate__c = rdRecord.PAE_ConfirmationDate__c;
+                        Report.Repair_Authenticator__c = rdRecord.PAE_Authenticator__c;
+                    }
+                    Report.RC_PAED__c = paedRecordId;
+                }
+            } else {
+                repList = [select Id, Name, RC_PAED__c, AC_PAED__c from Report__c where AC_PAED__c = : paedRecordId];
+                if (repList.size() == 0) {
+                    if (String.isBlank(Report.OCSM_RC_CordingUser__c)) {
+                        Report.OCSM_RC_CordingDate__c = Date.toDay();
+                        Report.OCSM_RC_CordingUser__c = UserInfo.getName();
+                    }
+                    Report.AC_PAED__c = paedRecordId;
+                } else {
+                    if (String.isBlank(Report.OCSM_RC_CordingUser__c)) {
+                        Report.OCSM_RC_CordingDate__c = rdRecord.PAE_ConfirmationDate__c;
+                        Report.OCSM_RC_CordingUser__c = rdRecord.PAE_Authenticator__c;
+                    }
+                    Report.AC_PAED__c = paedRecordId;
+                }
+            }
+            if (String.isNotBlank(stitchingCode)) {
+                if (ASac_ASrc == 'Intake') {
+                    Report.ASReportedCode__c = stitchingCode;
+                    // 2020/08/04 taoqz modify
+                    Report.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
+                    Report.PAE_intakePrevDetermineResults__c = prevDetermineResults;
+                    //濡傛灉鏈変笉鍦ㄧ幇 鍒欐洿鏂皉epair.ASReportedCodeAC__c 
+                    if (String.isNotBlank(stitchingCodeZ)) {
+                        if (String.isNotBlank(Report.PAE_temp_final_code__c)) {
+                            Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c + ',' + stitchingCodeZ;
+                        } else {
+                            Report.ASReportedCodeAC__c = stitchingCodeZ;
+                        }
+                        Report.PAE_codez__c = stitchingCodeZ;
+                    } else {
+                        //202003224 add 濡傛灉娌℃湁鏈変笉鍦ㄧ幇 鍒欐洿鏂皉epair.ASReportedCodeAC__c
+                        Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c;
+                        Report.PAE_codez__c = stitchingCodeZ;
+                    }
+                } else {
+                    if (String.isNotBlank(Report.PAE_codez__c)) {
+                        Report.ASReportedCodeAC__c = stitchingCode + ',' + Report.PAE_codez__c;
+                    } else {
+                        Report.ASReportedCodeAC__c = stitchingCode;
+                    }
+                    Report.PAE_temp_final_code__c = stitchingCode;
+                    // 2020/08/04 taoqz modify
+                    Report.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
+                    Report.PAE_finalPrevDetermineResults__c = prevDetermineResults;
+                }
+            } else {
+                if (ASac_ASrc == 'Intake') {
+                    Report.ASReportedCode__c = stitchingCode;
+                    Report.PAE_codez__c = stitchingCodeZ;
+                    Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c;
+                    // 2020/08/04 taoqz modify
+                    Report.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
+                    Report.PAE_intakePrevDetermineResults__c = prevDetermineResults;
+                } else {
+                    Report.ASReportedCodeAC__c = stitchingCode;
+                    Report.PAE_temp_final_code__c = stitchingCode;
+                    // 2020/08/04 taoqz modify
+                    Report.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
+                    Report.PAE_finalPrevDetermineResults__c = prevDetermineResults;
+                    Report.OCSM_RC_CordingDate__c = null;
+                    Report.OCSM_RC_CordingUser__c = null;
+                }
+            }
+            update Report;
+        }
+    }
+    //20191209 ljh 鏂板瓧娈垫坊鍔� start
+    public static PAE_DecisionRecordDetail__c ReproduceResult(PAE_DecisionRecordDetail__c paedrd, PAE_DecisionRecordDetailInfo paedRDInfo) {
+        paedrd.PAE_Judge__c = paedRDInfo.paedrdd.PAE_Judge__c;
+        // 20201126 gzw 鑾峰彇RVS005鎺ュ彛淇℃伅鏁版嵁 start
+        paedrd.RVSDetailNo__c = paedRDInfo.paedrdd.RVSDetailNo__c;
+        paedrd.LocationGroup__c = paedRDInfo.paedrdd.LocationGroup__c;
+        paedrd.Location__c = paedRDInfo.paedrdd.Location__c;
+        paedrd.PhenomenonDesc__c = paedRDInfo.paedrdd.PhenomenonDesc__c;
+        paedrd.RVS_Date__c = paedRDInfo.paedrdd.RVS_Date__c;
+        paedrd.RVS_Time__c = paedRDInfo.paedrdd.RVS_Time__c;
+        paedrd.RVS_Decision_Person__c = paedRDInfo.paedrdd.RVS_Decision_Person__c;
+        // 20201126 gzw 鑾峰彇RVS005鎺ュ彛淇℃伅鏁版嵁 end
+        if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '涓嶅啀鐝�') {
+            paedrd.PAED_Reappear_Result__c = '涓嶅啀鐝�';
+            paedrd.PAED_ResultAffirmant__c = UserInfo.getUserId();
+            paedrd.PAED_ResultConfirmationDate__c = Date.toDay();
+        } else {
+            paedrd.PAED_Reappear_Result__c = paedRDInfo.paedrdd.PAED_Reappear_Result__c;
+            paedrd.PAED_ResultAffirmant__c = null;
+            paedrd.PAED_ResultConfirmationDate__c = null;
+        }
+        return paedrd;
+    }
+    // 姝e垯琛ㄨ揪寮� 鍒ゆ柇鏄惁鍖呭惈姹夊瓧
+    // gzw 20210409 淇敼鍙傛暟涓虹┖鏃讹紝琛ㄨ揪寮忓垽鏂嚭閿欓棶棰�
+    public static Boolean containsChineseCharacters(String InputString) {
+        if (String.isNotblank(InputString)) {
+            Pattern p = Pattern.compile('\\p{IsHan}');
+            Matcher m = p.matcher(InputString);
+            return m.find();
+        } else {
+            return false;
+        }
+    }
+    // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪��
+    public Map < String, String > updateIsPae(List < String > codeNumDataList) {
+        Map < String, String > paeStrMap = new Map < String, String > ();
+        String sql = 'select RSS_CODE__C, IS_INTAKE_ESTIMATION__C, IS_PAE__c, IS_INACTIVE__C FROM RSA_master_data__c  WHERE RSS_CODE__C in: codeNumDataList AND IS_INACTIVE__C = \'No\'';
+        if ('ASRCDecision' == RecordTypeName) {
+            sql += ' AND IS_INTAKE_ESTIMATION__C like \'%Intake%\'';
+        }
+        if ('ASACDecision' == RecordTypeName) {
+            sql += ' AND IS_INTAKE_ESTIMATION__C like \'%Estimation%\'';
+        }
+        List < RSA_master_data__c > rsaMasterDataSqlList = DataBase.query(sql);
+        String result = null;
+        for (RSA_master_data__c rsaMaster: rsaMasterDataSqlList) {
+            if ('ASRCDecision' == RecordTypeName) {
+                if (rsaMaster.IS_PAE__c == 'YES') {
+                    result = 'PAE';
+                }
+                if (rsaMaster.IS_PAE__c == 'No') {
+                    result = 'nonPAE';
+                }
+                if (rsaMaster.IS_PAE__c == 'Unknown') {
+                    result = 'Unknown';
+                }
+            }
+            if ('ASACDecision' == RecordTypeName) {
+                if (rsaMaster.IS_PAE__c == 'YES') {
+                    result = 'PAE';
+                }
+                if (rsaMaster.IS_PAE__c == 'No') {
+                    result = 'nonPAE';
+                }
+                if (rsaMaster.IS_PAE__c == 'Unknown') {
+                    result = 'Unknown';
+                }
+            }
+            paeStrMap.put(rsaMaster.RSS_CODE__C, result);
+        }
+        return paeStrMap;
+    }
+    // 绮剧悽绉戞妧   zxk  2021-10-21  start  缁橮AE鍒ゅ畾璁板綍璧嬪��
+
+    //20191209 ljh 鏂板瓧娈垫坊鍔� end
+    class PAE_DecisionRecordDetailInfo {
+         public Boolean check {
+            get;
+            set;
+        }
+        public Boolean oldCheck {
+            get;
+            set;
+        }
+        public Boolean canSelect {
+            get;
+            set;
+        }
+        public String strJudge {
+            get;
+            set;
+        }
+        public Boolean monitorPAE {
+            get;
+            set;
+        }
+        public PAE_DecisionRecordDetail__c paedrdd {
+            get;
+            set;
+        }
+        public PAE_DecisionRecordDetailInfo() {
+            paedrdd = new PAE_DecisionRecordDetail__c();
+            check = false;
+            oldCheck = false;
+            canSelect = false;
+        }
+        public PAE_DecisionRecordDetailInfo(PAE_DecisionRecordDetail__c paedrd) {
+            check = false;
+            oldCheck = false;
+            paedrdd = paedrd;
+            if (String.isNotBlank(paedrd.Id)) {
+                monitorPAE = paedrd.Monitor_PAE__c;
+            }
+            strJudge = paedrd.PAE_Judge__c;
+            //IISE鏉ョ殑鏄庣粏鍏佽鍒犻櫎銆�
+            canSelect = false;
+        }
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/pages/RepPAEDecisionRecord.page b/force-app/main/default/pages/RepPAEDecisionRecord.page
new file mode 100644
index 0000000..724f7b0
--- /dev/null
+++ b/force-app/main/default/pages/RepPAEDecisionRecord.page
@@ -0,0 +1,402 @@
+<apex:page standardController="PAE_DecisionRecord__c" extensions="RepPAEDecisionRecordController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="PAE鍒ゅ畾璁板綍" lightningStylesheets="true">
+<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
+<style  type="text/css">.bPageBlock .pbTitle{width:100%;text-align:center;}</style>
+<script>
+
+//鎻掑叆琛�
+function InsertRows(){
+    //瑙i櫎涓嶅彲鍐欑姸鎬�
+    blockme();
+    InsertRow();
+}
+// 淇濆瓨骞跺叧闂�
+function SaveAndCloses(onlySave){
+   //  绮剧悽绉戞妧   zxk   2021-11-17    start
+            var productCount = "{!paedRecordDetailView}";
+            //鏂板��
+            var PAEJudgeIdStr = '';
+            //鏃у��
+            var strJudgejsIdStr = '';
+            var falsg = 0;
+            //  + ':PAEJudge'
+            for (var i = 0; i < productCount.length; i++) {
+                var PAEJudgeId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':PAEJudge';
+                var strJudgejsId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':strJudgejs';
+                PAEJudgeIdStr = j$(escapeVfId(PAEJudgeId)).value();
+                strJudgejsIdStr = j$(escapeVfId(strJudgejsId)).value();
+                if (PAEJudgeIdStr != '' && PAEJudgeIdStr != strJudgejsIdStr) {
+                    falsg = 1;
+                    break;
+                }
+            }
+            if (falsg == 1) {
+                if (confirm('瀛樺湪鏈煡鎴栬�呬慨鏀硅繃PAE鍒ゅ畾鐨刢ode  纭淇濆瓨锛�')) {
+                    blockme();
+                    SaveAndClose(onlySave);
+                }
+            } else {
+                blockme();
+                SaveAndClose(onlySave);
+            }
+            //  绮剧悽绉戞妧   zxk   2021-11-17    end
+        }
+//20200107 
+function toIntake(){
+    blockme();
+    toIntake();
+}
+//20191209 ljh
+function InsertMoreRowsJs(productIdx){
+    blockme();
+    InsertMoreRows(productIdx);
+
+}
+var selectedSize = 0;
+var pageLimit = {!pageLimit};
+function CheckSize(j){
+    var a = j.id;
+    var productCount = j$(escapeVfId(a)).attr('checked');
+    if (productCount == 'checked') {
+        if(selectedSize >= pageLimit){
+            window.alert("椤甸潰鎵�閫夋暟鎹笉鑳借秴杩�500鏉�");
+            j$(escapeVfId(a)).attr('checked',false);
+            return;
+        }
+        selectedSize ++;
+    } else {
+        selectedSize --;
+    }
+    //alert(selectedSize);
+}
+// 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  start
+        function checkBoxTf() {
+            // alert(lineNumberStr);
+            var productCountStr = "{!paedRecordDetailView}";
+            var PAEJudgeIdStr = '';
+            var strJudgejsIdStr = '';
+            var PaeIsSaveIdStr = '';
+            var  MonitorPAE = '';
+            var falsg = 0; 
+            for (var i = 0; i < productCountStr.length; i++) {
+                var PAEJudgeId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':PAEJudge';
+                var strJudgejsId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':strJudgejs'; 
+                var PaeIsSaveId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':PaeIsSave';
+                var MonitorPAEId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':MonitorPAE';
+                PAEJudgeIdStr = j$(escapeVfId(PAEJudgeId)).value();
+                strJudgejsIdStr = j$(escapeVfId(strJudgejsId)).value();
+                PaeIsSaveIdStr = j$(escapeVfId(PaeIsSaveId)).value();
+                MonitorPAE = j$(escapeVfId(MonitorPAEId)).value();
+                 if(PaeIsSaveIdStr != '1'){
+                        if (strJudgejsIdStr != PAEJudgeIdStr || (strJudgejsIdStr == '' || strJudgejsIdStr == null)) {
+                           j$(escapeVfId('allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':MonitorPAE')).attr('checked',true);
+                        }else{
+                           j$(escapeVfId('allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':MonitorPAE')).attr('checked',false);
+
+                        }
+                }
+            }
+        }
+        // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  end
+function checkAll() {
+    selectedSize = 0;
+    var productCount = "{!paedRecordDetailViewCount}";
+    if (j$(escapeVfId('checker')).attr('checked') == 'checked') {
+        for (var i = 0; i < productCount; i++) {
+            var checkId = 'allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':variableinfo' + ':consumablesCountproRowCheckbox';
+            if (!j$(escapeVfId(checkId)).attr('disabled')){
+                j$(escapeVfId(checkId)).attr('checked',true);
+                selectedSize ++;
+            }
+        }
+    } else {
+        for (var i = 0; i < productCount; i++) {
+            j$(escapeVfId('allPage:allForm:allBlock:unEditable:ConsumableorderdetailsTable:' + i + ':variableinfo' + ':consumablesCountproRowCheckbox')).attr('checked',false);
+        }
+    }
+}
+</script>
+
+<style>
+    .dateFormat  {
+        display: none;
+    }
+    td.columuslowercolour {
+        background-color:red;
+        text-align: right;
+    }
+    td.columuscuperolour {
+        background-color: yellow;
+        text-align: right;
+    }
+</style>
+    <apex:form id="allForm">
+        <apex:actionFunction name="InsertRow" action="{!InsertRow}" rerender="unEditable" onComplete="unblockUI();" >
+        </apex:actionFunction>
+        <apex:actionFunction name="InsertMoreRows" action="{!InsertMoreRows}" rerender="unEditable,message" onComplete="unblockUI();" >
+            <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  start -->
+
+            <apex:param assignto="{!productIdx}" name="productIdx" value="">
+            </apex:param>
+        <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  end -->
+        </apex:actionFunction>
+        <apex:actionFunction name="SaveAndClose" action="{!SaveAndClose}" rerender="unEditable,message" onComplete="unblockUI();" >
+            <apex:param name="firstParam" assignTo="{!CancelineFlag}" value="" />
+        </apex:actionFunction>
+        <apex:actionFunction name="toIntake" action="{!toIntake}" rerender="unEditable" onComplete="unblockUI();" >
+        </apex:actionFunction>
+        <apex:actionFunction name="ReturnReportInterface" action="{!ReturnReportInterface}" rerender="unEditable" onComplete="unblockUI();" >
+        </apex:actionFunction>
+        <apex:outputPanel id="allPanel">
+            <apex:pageBlock id="allBlock" >
+                <apex:pageBlock title="{!IF(RecordTypeName = 'ASRCDecision' , 'Intake universal code 缂栬緫鐢婚潰', 'Final universal code 缂栬緫鐢婚潰')}" id="unEditable" rendered="{!editAble}">
+                     <table cellspacing="10">
+                        <colgroup>  
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="5%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}">
+                            <col width="15%"/>
+                            <col width="15%"/>
+                            </apex:outputPanel>
+                        </colgroup>
+                        <tr>
+                            <td align="left" ><apex:outputText id="OrderCode_out"  value="{!$Label.PAE}" /></td>
+                            <!-- 2020/07/28 taoqz start -->
+                            <!-- PAE鍒ゅ畾缁撴灉 鐢遍�夐」鍒楄〃鏀逛负缁忚繃宸ヤ綔娴佹洿鏂板悗鐨勬枃鏈� -->
+                            <td align="left" ><apex:inputField id="OrderStatus_out" value="{!rdRecord.PAEDetail_DetermineResults__c}"/></td>
+                            <!-- 2020/07/28 taoqz end -->
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <!-- <th>AS-RC</th> -->
+                                <td ><span> {!$ObjectType.Report__c.fields.Repair_ConfirmationDate__c.label}锛�</span></td>
+                            </apex:outputPanel>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}">
+                                <td align="right"> {!$ObjectType.Report__c.fields.OCSM_RC_CordingDate__c.label}锛�</td>
+                            </apex:outputPanel>
+                            <td align="left" ><apex:outputField value="{!rdRecord.PAE_ConfirmationDate__c}"/></td>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <!-- <th>AS-RC</th> -->
+                                <td align="right" > {!$ObjectType.Report__c.fields.Repair_Authenticator__c.label}锛�</td>
+                            </apex:outputPanel>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}">
+                                <!-- <th>AS-AC</th> -->
+                                <td align="right" >{!$ObjectType.Report__c.fields.OCSM_RC_CordingUser__c.label}锛�</td>
+                            </apex:outputPanel>
+                            <td align="left" ><apex:outputField value="{!rdRecord.PAE_Authenticator__c}"/></td>
+                       
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}"> 
+                                <td align="right" >鍐嶇幇缁撴灉纭锛�</td>
+
+                                <td align="left" style="{!IF(rdRecord.PAE_reappear_confirm__c = '鏈‘璁�' , 'color: red;font-weight: 800;', '')}" ><apex:outputField value="{!rdRecord.PAE_reappear_confirm__c}"/></td>
+                                 <input type="button" value="Intake universal code 缂栬緫
+" style="margin-left:30px;float:right;{!IF(rdRecord.PAE_reappear_confirm__c = '鏈‘璁�','color: red;','')}"  onclick="toIntake();return false;"  class="btn" />
+                                   
+                            </apex:outputPanel>
+                            
+                        </tr>   
+
+                    </table>
+                    <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision'&& rdRecord.PAE_reappear_confirm__c = '鏈‘璁�',false , true)}">
+                    <table style="width:100%; {!IF(RecordTypeName = 'ASACDecision'&& rdRecord.PAE_reappear_confirm__c = '鏈‘璁�', 'display: none;', '')}" >                       
+                        <tr>
+                            <td>
+                            
+                            <apex:commandButton value="鍏抽棴"  style="margin-left:30px;width:80px;float:right"  onclick="ReturnReportInterface();return false;"  rerender="unEditable,message" oncomplete="unblockUI();"/>
+                            <apex:commandButton value="淇濆瓨"  disabled="{!IF((editFlag) && savebuton == false && !(RecordTypeName='ASRCDecision'&&OCSM_QARA='1'),true,false)}" style="margin-left:30px;width:80px;float:right"  onclick="SaveAndCloses(1);return false;"  rerender="unEditable,message" oncomplete="unblockUI();"/>
+                            <apex:commandButton value="淇濆瓨骞跺叧闂�" disabled="{!editFlag}"  rendered="{!IF(repa != null && RecordTypeName = 'ASACDecision',true,false)}" style="margin-left:30px;width:80px;float:right"  onclick="SaveAndCloses(2);return false;"  rerender="unEditable,message" oncomplete="unblockUI();" />
+                            
+                            <!-- OCSM QARA screen  [纭畾骞跺叧闂璢 -->
+                            <!-- update by rentx 2020-10-26 start -->
+
+                            <apex:commandButton rendered="{!IF((OCSM_QARA == '1' && RecordTypeName = 'ASRCDecision' && repa != null) || (RecordTypeName = 'ASRCDecision' && ReportId != null),true,false)}" value="纭畾骞跺叧闂�"  disabled="{!editFlag}" style="margin-left:30px;width:100px;float:right"  onclick="SaveAndCloses(2);return false;"  rerender="unEditable,message" oncomplete="unblockUI();" />
+
+                            <!-- update by rentx 2020-10-26 start -->
+                            <apex:commandButton value="鎻掑叆琛�" disabled="{!IF((RecordTypeName = 'ASRCDecision' && OCSM_QARA = '0') && ((RecordTypeName='ASACDecision'&&OCSM_Cording='0')||(editFlag)),true,false)}" style="margin-left:30px;width:100px;float:right" onclick="InsertRows();return false;" rerender="unEditable,message" oncomplete="unblockUI();"/>
+                            <apex:commandButton value="鍙栨秷琛�" disabled="{!IF((RecordTypeName = 'ASRCDecision' && OCSM_QARA = '0') && ((RecordTypeName='ASACDecision'&&OCSM_Cording='0')||(editFlag)),true,false)}" style="margin-left:30px;width:100px;float:right" onclick="SaveAndCloses(3);return false;"  rerender="unEditable,message" oncomplete="unblockUI();"/>
+                            <!-- update by rentx 2020-10-26 end -->
+
+                            </td>
+                        </tr>
+                    </table>
+                    </apex:outputPanel>
+                    <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision'&& rdRecord.PAE_reappear_confirm__c = '鏈‘璁�',true , false)}">
+                    <p style="text-align: center;padding-bottom: 10px;width:100%;font-weight: 800;">鍐嶇幇缁撴灉鏈‘璁�,璇风偣鍑籌ntake universal code 缂栬緫 鎸夐挳鍓嶅幓纭</p>
+                    </apex:outputPanel>
+
+                        <apex:outputPanel id="message">
+                            <apex:pageMessages />
+                        </apex:outputPanel>
+                    
+                    <table class="list" border="0" cellpadding="0" cellspacing="0">
+                        <tr class="headerRow">
+                            <apex:variable var="v" value="" rendered="{!editAble}">
+                                <th><input type='checkbox' onClick='checkAll()' id='checker'/>閫夋嫨</th>
+                            </apex:variable>
+
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}">
+                                <th>Location Group </th>
+                                <th>Location </th>
+                                <th>Final universal description / Phenomenon </th>
+                            </apex:outputPanel>
+
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <th>Intake universal description</th>
+                            </apex:outputPanel>
+
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <th>Intake universal code</th>
+                            </apex:outputPanel>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' , true, false)}">
+                                <th>Final universal code </th>
+                            </apex:outputPanel>
+                            <!-- <th>AS-RC</th> -->
+                            <!-- <th width="7%">PAE鍒ゅ畾</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAE_Judge__c.label}</th>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                            <!-- <th width="7%">鍐嶇幇绲愭灉</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_Reappear_Result__c.label}</th>
+                            <!-- <th width="15%">intake 椤甸潰 Final universal Code</th> -->
+                            <th width="15%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.Final_universal_code__c.label}</th>
+                            </apex:outputPanel>
+                            <!-- <th width="7%">鐘舵��</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_Status__c.label}</th>
+                            <!-- <th width="7%">纭鏃�</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_ConfirmationDate__c.label}</th>
+                            <!-- <th width="7%">纭鑰�</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_Affirmant__c.label}</th>
+                            <!-- <th width="7%">鍙栨秷鏃�</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_CancellationDate__c.label}</th>
+                            <!-- <th width="7%">鍙栨秷鑰�</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_Nullifier__c.label}</th>
+                            <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                            <!-- <th width="7%">涓嶅啀鐝剧祼鏋滅⒑瑾嶆棩</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_ResultConfirmationDate__c.label}</th>
+                            <!-- <th width="7%">涓嶅啀鐝剧祼鏋滅⒑瑾嶈��</th> -->
+                            <th width="7%">{!$ObjectType.PAE_DecisionRecordDetail__c.fields.PAED_ResultAffirmant__c.label}</th> 
+                            </apex:outputPanel>
+                            <!-- <th width="7%">鎵嬪姩淇敼</th> -->
+                            <th width="7%">
+                                {!$ObjectType.PAE_DecisionRecordDetail__c.fields.Monitor_PAE__c.label}
+                            </th> 
+                        </tr>
+                        <apex:repeat value="{!paedRecordDetailView}" var="paedRdV" id="ConsumableorderdetailsTable">
+                            <tr class="dataRow">
+                                <!-- //澶嶉�夋 -->
+                                <apex:variable var="v" value="" rendered="{!editAble}" id="variableinfo">
+                                    <td>
+                                        <apex:inputCheckbox value="{!paedRdV.check}" onclick="CheckSize(this);" id="consumablesCountproRowCheckbox" disabled="{!paedRdV.canSelect}"/>
+                                            <apex:inputCheckbox value="{!paedRdV.oldCheck}" id="proRowOldCheckbox" style="display:none"/>
+                                        <apex:inputCheckbox id="isReadOnly" value="{!paedRdV.canSelect}" style="display:none" />    
+                                    </td>
+                                 </apex:variable>
+
+                                <!-- QIS read only; always blank-->
+                                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' && repa != null , true, false)}">
+                                    <td class="dataCell"></td>
+                                </apex:outputPanel>
+
+                                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASACDecision' && repa != null, true, false)}">
+                                    <td class="dataCell"></td>
+                                    <td class="dataCell"></td>
+                                    <td class="dataCell"></td>
+                                </apex:outputPanel>
+                                <td class="dataCell">
+                                    <apex:outputPanel layout="none" rendered="{!IF(paedRdV.paedrdd.PAE_is_save__c !='1' || paedRdV.paedrdd.isedit__c = true, true,false)}">
+                                        <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'ASACDecision'&& rdRecord.PAE_reappear_confirm__c = '鏈‘璁�')||(OCSM_QARA='0' &&RecordTypeName = 'ASRCDecision'), false, true)}">
+
+                                        <apex:InputField id="PAEDManagementCode" value="{!paedRdV.paedrdd.PAED_ManagementCode__c}" onblur="InsertMoreRowsJs(this.value);return false;"/>
+                                        
+                                        </apex:outputPanel>
+                                    </apex:outputPanel>
+                                    <apex:outputPanel layout="none" rendered="{!IF(!(paedRdV.paedrdd.PAE_is_save__c !='1' || paedRdV.paedrdd.isedit__c = true),true , false)}">
+                                        <apex:outputField value="{!paedRdV.paedrdd.PAED_ManagementCode__c}" />
+                                    </apex:outputPanel>
+                                </td>    
+                                <td class="dataCell">
+                                 <apex:outputPanel layout="none" rendered="{!IF(paedRdV.paedrdd.PAE_is_save__c ='1',false, true)}">
+                                    <apex:outputPanel layout="none" rendered="{!IF((RecordTypeName = 'ASACDecision'&& rdRecord.PAE_reappear_confirm__c = '鏈‘璁�')||(OCSM_QARA='0'&&RecordTypeName = 'ASRCDecision'), false, true)}">
+                                        <apex:InputField id="PAEJudge" onchange="checkBoxTf();" value="{!paedRdV.paedrdd.PAE_Judge__c}"/>
+                                    </apex:outputPanel>
+                                    </apex:outputPanel>
+                                        <apex:outputPanel layout="none" rendered="{!IF(paedRdV.paedrdd.PAE_is_save__c ='1',true , false)}">
+                                        <apex:outputField id="PAEJudge1" value="{!paedRdV.paedrdd.PAE_Judge__c}"/>
+                                    </apex:outputPanel>
+                                     <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  start -->
+
+                                    <apex:inputhidden id="strJudgejs" value="{!paedRdV.strJudge}">
+                                    </apex:inputhidden>
+                                    <apex:inputhidden id="Monitor_PAE__c" value="{!paedRdV.paedrdd.Monitor_PAE__c}">
+                                    </apex:inputhidden>
+                                    <apex:inputhidden id="PaeIsSave" value="{!paedRdV.paedrdd.PAE_is_save__c }">
+                                    </apex:inputhidden>
+                                    <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  end -->
+                                </td>
+                                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <td class="dataCell">
+                                    <apex:outputPanel layout="none" rendered="{!IF(OCSM_Cording != '1', true, false)}">
+                                    <apex:outputField value="{!paedRdV.paedrdd.PAED_Reappear_Result__c}"/>
+                                    </apex:outputPanel>
+                                    <apex:outputPanel layout="none" rendered="{!IF(OCSM_Cording='1', true, false)}">
+                                    <apex:InputField value="{!paedRdV.paedrdd.PAED_Reappear_Result__c}"/>
+                                    </apex:outputPanel>
+
+
+                                </td>
+                                <td class="dataCell">
+                                    <apex:outputField value="{!paedRdV.paedrdd.Final_universal_code__c}"/>  
+                                </td>
+                                </apex:outputPanel>
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_Status__c}"/>
+                                </td>
+                                <td class="dataCell">
+                                    <!-- Gzw 20200826 淇敼 Final 淇℃伅娌℃湁鏃讹紝鏄剧ず淇悊涓婂唴瀹� -->
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_ConfirmationDate_F__c}"/>
+                                  
+                                </td>
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_Affirmant_F__c}"/>
+                                    
+                                </td>
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_CancellationDate__c}" rendered="{!IF(paedRdV.paedrdd.PAED_CancellationDate__c != null, true, false)}"/>
+                                    
+                                </td>
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_Nullifier__r.Name}"/>
+                                </td>
+                                <apex:outputPanel layout="none" rendered="{!IF(RecordTypeName = 'ASRCDecision' , true, false)}">
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_ResultConfirmationDate__c}"/>
+                                </td>
+                                <td class="dataCell">
+                                    <apex:OutputField value="{!paedRdV.paedrdd.PAED_ResultAffirmant_new__c}"/>
+                                </td>
+                                 
+                                </apex:outputPanel>
+                                <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  start -->
+                                    <td class="dataCell">
+                                        <apex:inputcheckbox id="MonitorPAE" value="{!paedRdV.monitorPAE}" disabled="true">
+                                        </apex:inputcheckbox>
+                                        <apex:inputhidden id="MonitorPAEhidden" value="{!paedRdV.monitorPAE}">
+                                        </apex:inputhidden>
+                                    </td>
+                                    <!-- // 2021-12-08  zxk   绮剧悽绉戞妧  鎵嬪姩璧嬪�奸�昏緫  end -->
+                            </tr>
+                        </apex:repeat>
+                    </table>
+                </apex:pageBlock>
+            </apex:pageBlock>
+        </apex:outputPanel>
+    </apex:form>
+</apex:page>
\ No newline at end of file
diff --git a/force-app/main/default/pages/RepPAEDecisionRecord.page-meta.xml b/force-app/main/default/pages/RepPAEDecisionRecord.page-meta.xml
new file mode 100644
index 0000000..3796fc0
--- /dev/null
+++ b/force-app/main/default/pages/RepPAEDecisionRecord.page-meta.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>52.0</apiVersion>
+    <availableInTouch>false</availableInTouch>
+    <confirmationTokenRequired>false</confirmationTokenRequired>
+    <label>RepPAEDecisionRecord</label>
+</ApexPage>

--
Gitblit v1.9.1