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/PAEDecisionRecordTriggerTest.cls |  142 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 142 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/PAEDecisionRecordTriggerTest.cls b/force-app/main/default/classes/PAEDecisionRecordTriggerTest.cls
index e129032..d5d423d 100644
--- a/force-app/main/default/classes/PAEDecisionRecordTriggerTest.cls
+++ b/force-app/main/default/classes/PAEDecisionRecordTriggerTest.cls
@@ -111,4 +111,146 @@
 
     }
 
+
+    @isTest
+    static void myTest_QIS(){
+
+        ControllerUtil.EscapeNFM001Trigger = true;
+
+        //  鐥呴櫌銆佹垿鐣ョ瀹ゃ�佽ê鐧傜銇儏鍫便倰浣滄垚銇椼伨銇�
+        Account hospital = createHospital( 'test hospital');
+        Account[] strategicDep = selectStrategicDep( hospital);
+        Account dep = createDep( hospital, strategicDep[0]);
+
+        // 绱嶅叆姗熷櫒銈掍綔銈�
+        Asset asset = createAsset( hospital, strategicDep[0], dep);
+
+
+        QIS_Report__c qis = new QIS_Report__c();
+        qis.nonyushohin__c = asset.Id;
+        qis.Hospital__c = hospital.Id;
+        qis.RC__c = UserInfo.getUserId();
+        qis.Department_Class__c = strategicDep[0].Id;
+        qis.Hospital_Department__c = dep.Id;
+        qis.Damage_For_Doc_Or_Pat__c = '鏈�';
+        qis.Relation_With_The_Problem__c = '鏈夊彲鑳�';
+        qis.Report_For_Goz__c = '涓嶇煡閬�';
+        insert qis;
+
+
+        // 淇悊銈掍綔鎴愩仚銈�01
+        // Repair__c re = new Repair__c();
+        // re.SAPRepairNo__c = '000010168255';
+        // re.Account__c = dep.Id;
+        // re.Department_Class__c = strategicDep[0].Id;
+        // re.Hospital__c = hospital.Id;
+        // re.Delivered_Product__c = asset.Id;
+        // re.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays( -1000); // 缁翠慨鍚堝悓鍒ゆ柇鏃ャ亴銈点兗銉撱偣濂戠磩銇仩銇勩伓鍓�
+        // re.Failure_Occurrence_Date__c  = Date.today();
+        // re.InspectionCategory_Three__c = '3';
+        // re.IISE_Inspection_Branch_Three__c = '1';
+        // insert re;
+
+        PAE_DecisionRecord__c record = new PAE_DecisionRecord__c(
+            PAE_DetermineResults__c = 'nonPAE',                    // PAE鍒ゅ畾缁撴灉
+            PAE_ConfirmationDate__c = Date.valueOf('2020-05-06'),  // OCSM QARA纭鏃�
+            PAE_Authenticator__c = '00510000005sEEM'              // OCSM QARA纭鑰�
+        );
+        record.PAE_QIS__c = qis.Id;
+        record.RecordTypeId = Schema.SObjectType.PAE_DecisionRecord__c.getRecordTypeInfosByDeveloperName().get('ASACDecision').getRecordTypeId();
+        record.PAE_DetermineResults_Text__c = 'nonPAE';
+        insert record;
+
+        record.PAE_DetermineResults_Text__c = 'PAE';
+        update record;
+
+        List<PAE_DecisionRecord__c> recordList = [select id,name,PAE_DetermineResults_Text__c from PAE_DecisionRecord__c];
+        System.debug('recordList++'+recordList);
+
+    }
+
+    @isTest
+    static void myTest_report(){
+
+        // recode type 銈掑彇寰�
+        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        if (rectCo.size() == 0) {
+            throw new ControllerUtil.myException('not found 鐥呴櫌 recodetype');
+        }
+        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        if (rectSct.size() == 0) {
+            throw new ControllerUtil.myException('not found 鎴︾暐绉戝鍒嗛 鍛煎惛绉� recodetype');
+        }
+        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 娑堝寲绉�'];
+        if (rectDpt.size() == 0) {
+            throw new ControllerUtil.myException('not found 瑷虹檪绉� 娑堝寲绉� recodetype');
+        }
+        
+        // insert
+        Account company = new Account();
+        company.RecordTypeId = rectCo[0].Id;
+        company.Name = 'Katsu 銉嗐偣銉�';
+        insert company;
+        
+        Account section = new Account();
+        section.RecordTypeId = rectSct[0].Id;
+        section.Name         = '*';
+        section.Department_Class_Label__c = '娑堝寲绉�';
+        section.ParentId                  = company.Id;
+        section.Hospital_Department_Class__c = company.Id;
+        NFM001Controller.isRunning = false;
+        NFM001Controller.debug_msg = '';
+        insert section;
+
+        Account depart = new Account();
+        depart.RecordTypeId = rectDpt[0].Id;
+        depart.Name         = '*';
+        depart.Department_Name__c  = 'NFM001TestDepart';
+        depart.ParentId            = section.Id;
+        depart.Department_Class__c = section.Id;
+        depart.Hospital__c         = company.Id;
+        NFM001Controller.isRunning = false;
+        NFM001Controller.debug_msg = '';
+        insert depart;
+        
+        // insert test
+        Report__c rpt = new Report__c();
+        rpt.Hospital_Department__c = depart.Id;
+        rpt.OwnerId = UserInfo.getUserId();
+        rpt.OPD_ProductCategory1__c ='3D System';
+        rpt.OPD_ProductCategory2__c ='OR Imaging Products';
+        insert new Report__c[] {rpt};
+
+
+        // 淇悊銈掍綔鎴愩仚銈�01
+        // Repair__c re = new Repair__c();
+        // re.SAPRepairNo__c = '000010168255';
+        // re.Account__c = dep.Id;
+        // re.Department_Class__c = strategicDep[0].Id;
+        // re.Hospital__c = hospital.Id;
+        // re.Delivered_Product__c = asset.Id;
+        // re.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today().addDays( -1000); // 缁翠慨鍚堝悓鍒ゆ柇鏃ャ亴銈点兗銉撱偣濂戠磩銇仩銇勩伓鍓�
+        // re.Failure_Occurrence_Date__c  = Date.today();
+        // re.InspectionCategory_Three__c = '3';
+        // re.IISE_Inspection_Branch_Three__c = '1';
+        // insert re;
+
+        PAE_DecisionRecord__c record = new PAE_DecisionRecord__c(
+            PAE_DetermineResults__c = 'nonPAE',                    // PAE鍒ゅ畾缁撴灉
+            PAE_ConfirmationDate__c = Date.valueOf('2020-05-06'),  // OCSM QARA纭鏃�
+            PAE_Authenticator__c = '00510000005sEEM'              // OCSM QARA纭鑰�
+        );
+        record.PAE_Report__c = rpt.Id;
+        record.RecordTypeId = Schema.SObjectType.PAE_DecisionRecord__c.getRecordTypeInfosByDeveloperName().get('ASACDecision').getRecordTypeId();
+        record.PAE_DetermineResults_Text__c = 'nonPAE';
+        insert record;
+
+        record.PAE_DetermineResults_Text__c = 'PAE';
+        update record;
+
+        List<PAE_DecisionRecord__c> recordList = [select id,name,PAE_DetermineResults_Text__c from PAE_DecisionRecord__c];
+        System.debug('recordList++'+recordList);
+
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.1