buli
2023-07-14 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7
force-app/main/default/classes/LexInventoryViewControllerTest.cls
@@ -7,102 +7,32 @@
    static testMethod void LexInventoryViewControllerTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
            ];
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
      system.runAs(thisUser){
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            List<RecordType> rectHos = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
            ];
            List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
            if (rectHos.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
             myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900');
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
            insert core;
            myUser_test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'testUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com',
                Work_Location__c = '深圳'
            );
            myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '深圳');
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod01 = new Product2(
                Name = '3400PK:PK针 5mmx33cm',
                ProductCode = 'Test01',
                Asset_Model_No__c = '3400PK:PK针 5mmx33cm',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test001',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test002',
                Packing_list_manual__c = 12,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2__c pro1 = new Product2__c(
                Name = '3400PK:PK针 5mmx33cm',
                OT_CODE_Text__c = 'Test001',
                Product2__c = prod01.Id,
                Category3_text__c = '腹腔镜手术',
                Category4_text__c = 'PK',
                Category5_text__c = 'G400'
            );
            Product2__c pro2 = new Product2__c(
                Name = 'Pro002',
                OT_CODE_Text__c = 'Test002',
                Product2__c = prod02.Id,
                Category3_text__c = '腹腔镜手术',
                Category4_text__c = 'PK',
                Category5_text__c = 'G400'
            );
            insert new List<Product2__c>{ pro1, pro2 };
                Product2 prod01 = new Product2(Name='3400PK:PK针 5mmx33cm',ProductCode='Test01',Asset_Model_No__c = '3400PK:PK针 5mmx33cm',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test001',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
                Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
                insert new Product2[]{prod01,prod02};
                Product2__c pro1 = new Product2__c(Name='3400PK:PK针 5mmx33cm',OT_CODE_Text__c='Test001',Product2__c = prod01.Id,Category3_text__c = '腹腔镜手术',Category4_text__c = 'PK',Category5_text__c = 'G400');
                Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id,Category3_text__c = '腹腔镜手术',Category4_text__c = 'PK',Category5_text__c = 'G400');
                insert new Product2__c[] {pro1, pro2};
            System.debug('pro2===》' + pro2);
            System.debug('pro1===》' + pro1);
@@ -186,7 +116,7 @@
            Orderdet4.Lose_Flag__c = false;
            Orderdet4.Box_Piece__c = '个';
            insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4 };
                insert new Consumable_order_details2__c[] {Orderdet1, Orderdet2,Orderdet3,Orderdet4};
            //制作盘点履历
            List<Consumable_order__c> InsPDlist = new List<Consumable_order__c>();
@@ -227,149 +157,48 @@
            orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
            System.debug('orderDetZaikuListLWC' + orderDetZaikuListLWC);
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                '',
                '',
                '',
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                Category3,
                Category4,
                Category5,
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
                LexInventoryViewController.searchConsumableorderdetails(category1,'','','',orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
                LexInventoryViewController.searchConsumableorderdetails(category1,Category3,Category4,Category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
        }
    }
    static testMethod void InventoryViewSearchTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
            ];
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
      List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
       myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',AgentCode_Ext__c = '9999900');
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
            insert core;
            myUser_test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'testUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com'
            );
        myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com');
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'CDS',
                Category4__c = 'OER',
                Category5__c = '其它',
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'ENT',
                Category4__c = 'Celon',
                Category5__c = 'Celon',
                Manual_Entry__c = false
            );
            Product2 prod03 = new Product2(
                Name = 'Test03',
                ProductCode = 'Test03',
                Asset_Model_No__c = 'Test03',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'US',
                Category4__c = 'ALOKA',
                Category5__c = '体外超声',
                Manual_Entry__c = false
            );
            Product2 prod04 = new Product2(
                Name = 'Test04',
                ProductCode = 'Test04',
                Asset_Model_No__c = 'Test04',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'OCS',
                Category4__c = '附属品',
                Category5__c = 'S45',
                Manual_Entry__c = false
            );
            Product2 prod05 = new Product2(
                Name = 'Test05',
                ProductCode = 'Test05',
                Asset_Model_No__c = 'Test05',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = '光源',
                Category4__c = '附属品',
                Category5__c = 'OCS',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02, prod03, prod04, prod05 };
      system.runAs(myUser_test){
         Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true
            ,Category3__c = 'CDS',Category4__c = 'OER',Category5__c = '其它',Manual_Entry__c = false);
           Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true
              ,Category3__c = 'ENT',Category4__c = 'Celon',Category5__c = 'Celon',Manual_Entry__c = false);
           Product2 prod03 = new Product2(Name='Test03',ProductCode='Test03',Asset_Model_No__c = 'Test03',SFDA_Status__c = '有効',Dealer_special_Object__c = true
              ,Category3__c = 'US',Category4__c = 'ALOKA',Category5__c = '体外超声',Manual_Entry__c = false);
          Product2 prod04 = new Product2(Name='Test04',ProductCode='Test04',Asset_Model_No__c = 'Test04',SFDA_Status__c = '有効',Dealer_special_Object__c = true
              ,Category3__c = 'OCS',Category4__c = '附属品',Category5__c = 'S45',Manual_Entry__c = false);
          Product2 prod05 = new Product2(Name='Test05',ProductCode='Test05',Asset_Model_No__c = 'Test05',SFDA_Status__c = '有効',Dealer_special_Object__c = true
              ,Category3__c = '光源',Category4__c = '附属品',Category5__c = 'OCS',Manual_Entry__c = false);
           insert new Product2[] {prod01, prod02, prod03, prod04, prod05};
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name = 'Pro003', OT_CODE_Text__c = 'Test003', Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name = 'Pro004', OT_CODE_Text__c = 'Test004', Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name = 'Pro005', OT_CODE_Text__c = 'Test005', Product2__c = prod05.Id);
            insert new List<Product2__c>{ pro1, pro2, pro3, pro4, pro5 };
         insert new Product2__c[] {pro1, pro2, pro3, pro4, pro5};
            Consumable_order__c Order1 = new Consumable_order__c();
            Order1.Name = 'OCM_01_001';
@@ -405,7 +234,7 @@
            Orderdet2.Send_Date__c = null;
            Orderdet2.Used_date__c = null;
            Orderdet2.Lose_Flag__c = false;
            insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
            insert new Consumable_order_details2__c[] {Orderdet1,Orderdet2};
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
@@ -421,10 +250,12 @@
            string userWorkLocation = '深圳';
            List<String> orderDetZaikuListLWC = new List<String>();
            LexInventoryViewController.init(pageSizeLWC, pageTokenLWC, sortFieldLWC, sortOrderLWC);
            LexInventoryViewController.categoryAllload(category3LWC, agencyProTypeLWC);
            LexInventoryViewController.categoryload();
            //  LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
        }
    }
@@ -432,84 +263,32 @@
    static testMethod void InventoryViewTest2() {
        user myUser_test;
        Account myAccount2;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            //Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
            ]; //20200916 ljh update
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];//20200916 ljh update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
            myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
            insert core;
            MyUser_Test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'TestUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com',
                UserPro_Type__c = 'ET',
                Work_Location__c = '北京'
            );
            MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ET', Work_Location__c='北京');
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
        system.runAs(MyUser_Test){
            System.Test.startTest();
            StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
            insert new Product2__c[] {pro1, pro2};
            Consumable_order__c createId = new Consumable_order__c();
            createId.Name = 'testMing';
@@ -628,86 +407,35 @@
    static testMethod void InventoryViewTest3() {
        user myUser_test;
        Account myAccount2;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            //Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
            // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(Email)'];//20200916 ljh update
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
            ]; //20210329 RTX update
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];//20210329 RTX update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
        myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
            insert core;
            MyUser_Test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'TestUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com',
                UserPro_Type__c = 'ENG',
                Work_Location__c = '北京'
            );
        MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ENG', Work_Location__c='北京');
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
        system.runAs(MyUser_Test){
            System.Test.startTest();
            StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
            insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
            insert new Product2__c[] {pro1, pro2};
            Consumable_order__c createId = new Consumable_order__c();
            createId.Name = 'testMing1';
@@ -834,55 +562,24 @@
    static testMethod void InventoryViewTest4() {
        user myUser_test;
        Account myAccount2;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
        system.runAs(thisUser){
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)'
            ]; //20210329 RTX update
        Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET Email)'];//20210329 RTX update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
        myAccount2 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',AgentCode_Ext__c = '9999900');
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
        Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount2.id);
            insert core;
            MyUser_Test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'TestUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com',
                UserPro_Type__c = 'ET',
                Work_Location__c = '济南'
            );
        MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com', UserPro_Type__c='ET', Work_Location__c='济南');
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
        system.runAs(MyUser_Test){
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
@@ -897,32 +594,12 @@
            List<String> orderDetZaikuListLWC = new List<String>();
            List<String> productCodeList = new List<String>();
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
             Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
             Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = '12124',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
             insert new Product2[]{prod01,prod02};
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
             insert new Product2__c[] {pro1, pro2};
            Consumable_order__c Order1 = new Consumable_order__c();
            Order1.Name = 'OCM_01_001';
@@ -959,7 +636,7 @@
            Orderdet2.Sterilization_limit__c = Date.today();
            Orderdet2.Return_date__c = Date.today();
            Orderdet2.Bar_Code__c = '1683272847250250WZIOF';
            Orderdet2.Cancellation_Flag__c = false;
             Orderdet2.Cancellation_Flag__c = FALSE;
            conList.add(Orderdet2);
            Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
@@ -967,8 +644,8 @@
            Orderdet3.Send_Date__c = null;
            Orderdet3.Used_date__c = null;
            Orderdet3.Return_date__c = null;
            Orderdet3.Lose_Flag__c = false;
            Orderdet3.Cancellation_Flag__c = false;
             Orderdet3.Lose_Flag__c = FALSE;
             Orderdet3.Cancellation_Flag__c = FALSE;
            Orderdet3.Bar_Code__c = '1234';
            Orderdet3.Consumable_order_minor__c = Order2.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
@@ -979,27 +656,14 @@
            insert conList;
            System.debug('conList==>' + conList);
            LexInventoryViewController.category1 = category1;
            LexInventoryViewController.Category3 = Category3;
            LexInventoryViewController.Category4 = Category4;
            LexInventoryViewController.Category5 = Category5;
            // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                category3,
                category4,
                category5,
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
            LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC ,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC,productkucunLWC);
            LexInventoryViewController.categoryAllload('CDS', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
@@ -1012,92 +676,32 @@
    static testMethod void supplementTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
            ];
            List<RecordType> rectCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
            ];
        User thisUser = [ select Id from User where Id = :UserInfo.getUserId()];
      system.runAs(thisUser){
            Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            List<RecordType> rectHos = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
            ];
            List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
            if (rectHos.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
             myAccount1 = new Account(name='testaccount001',RecordTypeId = rectCo[0].Id,Product_Limit_Date__c = 'Test01|2|4,Test02|3|5' ,AgentCode_Ext__c = '9999900');
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
            Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id);
            insert core;
            myUser_test = new User(
                ContactId = core.id,
                Alias = 'newUser',
                Email = 'newuser@testorg.com',
                EmailEncodingKey = 'UTF-8',
                LastName = 'testUser',
                LanguageLocaleKey = 'zh_CN',
                LocaleSidKey = 'zh_CN',
                ProfileId = prof.Id,
                TimeZoneSidKey = 'Asia/Shanghai',
                UserName = 'testUser@testorg.com',
                Work_Location__c = '深圳'
            );
            myUser_test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='testUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c = '深圳');
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod05 = new Product2(
                Name = '3400PK:PK针 5mmx33cm',
                ProductCode = 'Test01',
                Asset_Model_No__c = '3400PK:PK针 5mmx33cm',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test001',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod06 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test002',
                Packing_list_manual__c = 12,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod05, prod06 };
            Product2__c pro11 = new Product2__c(
                Name = 'Pro001',
                OT_CODE_Text__c = 'Test001',
                Product2__c = prod05.Id,
                Category3_text__c = '分类3'
            );
                Product2 prod05 = new Product2(Name='3400PK:PK针 5mmx33cm',ProductCode='Test01',Asset_Model_No__c = '3400PK:PK针 5mmx33cm',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test001',Packing_list_manual__c = 1,SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false);
                Product2 prod06 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 12,SFDA_Expiration_Date__c= Date.today(),Category5__c = 'tset',Manual_Entry__c = false);
                insert new Product2[]{prod05,prod06};
                Product2__c pro11 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod05.Id,Category3_text__c = '分类3');
            Product2__c pro22 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod06.Id);
            insert new List<Product2__c>{ pro11, pro22 };
                insert new Product2__c[] {pro11, pro22};
            System.debug('pro11===>' + pro11);
            List<Consumable_order__c> orderList = new List<Consumable_order__c>();
@@ -1120,8 +724,8 @@
            con1.Send_Date__c = null;
            con1.Used_date__c = null;
            con1.Return_date__c = null;
            con1.Lose_Flag__c = false;
            con1.Cancellation_Flag__c = false;
                con1.Lose_Flag__c = FALSE;
                con1.Cancellation_Flag__c = FALSE;
            con1.Bar_Code__c = '1234';
            // con1.Consumable_order_minor__c = Order2.Id;
            con1.Consumable_Product__c = pro11.Id;
@@ -1135,8 +739,8 @@
            con2.Send_Date__c = null;
            con2.Used_date__c = null;
            con2.Return_date__c = null;
            con2.Lose_Flag__c = false;
            con2.Cancellation_Flag__c = false;
                con2.Lose_Flag__c = FALSE;
                con2.Cancellation_Flag__c = FALSE;
            con2.Bar_Code__c = '1234';
            // con1.Consumable_order_minor__c = Order2.Id;
            con2.Consumable_Product__c = pro11.Id;
@@ -1158,21 +762,7 @@
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                '3400PK:PK针 5mmx33cm',
                '',
                '',
                '',
                orderDetZaikuListLWC,
                'testaccount001',
                'ET',
                '深圳',
                1,
                0,
                '',
                '',
                productkucunLWC
            );
                LexInventoryViewController.searchConsumableorderdetails('3400PK:PK针 5mmx33cm','','','',orderDetZaikuListLWC ,'testaccount001','ET','深圳',1,0,'','',productkucunLWC);
        }
    }
}