buli
2023-07-14 e6068da47c1bef5517c9e5fdc8c726766867ad4e
force-app/main/default/classes/LexSaleOrderControllerTest.cls
@@ -14,27 +14,15 @@
        User userTest;
        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 = '販売店'
            ];
            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            List<RecordType> rectHp = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
            ];
            List<RecordType> rectHp = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
            if (rectHp.size() == 0) {
                return;
            }
            Profile prof = [
                SELECT Id
                FROM Profile
                WHERE Name = '901_经销商社区普通权限_2重验证(ET)'
            ];
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
            accountItem1 = new Account(Name = 'Testaccount001', RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '9999900');
            insert accountItem1;
            accountItem2 = new Account(Name = 'Testaccount002', RecordTypeId = rectHp[0].Id, AgentCode_Ext__c = '9999999');
@@ -64,20 +52,11 @@
        }
        System.runAs(userTest) {
            String Id = UserInfo.getUserId();
            User thisUserInfo = [
                SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
                FROM User
                WHERE id = :Id
            ];
            User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id];
            String accountId = thisUserInfo.Contact.AccountId;
            String userWorkLocation = thisUserInfo.Work_Location__c;
            String accountName;
            Account[] accountInfo = [
                SELECT Name
                FROM account
                WHERE id = :accountId
                LIMIT 1
            ];
            Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
            if (accountInfo.size() > 0) {
                accountName = accountInfo[0].Name;
            }
@@ -317,24 +296,12 @@
        User MyUser_Test;
        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 = '販売店'
            ];
            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)'
            ];
            RecordType hosCo = [
                SELECT Id
                FROM RecordType
                WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
            ];
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
            RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
            olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
            insert olympus;
            myAccount2 = new Account(Name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id);
@@ -364,11 +331,7 @@
        }
        System.runAs(MyUser_Test) {
            String Id = UserInfo.getUserId();
            User thisUserInfo = [
                SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
                FROM User
                WHERE id = :Id
            ];
            User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id];
            String accountId = thisUserInfo.Contact.AccountId;
            String userWorkLocation1 = thisUserInfo.Work_Location__c;
            String accountName = myAccount2.Name;
@@ -663,24 +626,12 @@
    @isTest
    static void testProSale() {
        StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
        List<RecordType> rectCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
        ];
        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)'
        ];
        RecordType hosCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
        ];
        Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
        RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
        Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
        insert olympus;
        Account myAccount2 = new Account(name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id);
@@ -706,20 +657,11 @@
        }
        System.runAs(MyUser_Test) {
            String Id = UserInfo.getUserId();
            User thisUserInfo = [
                SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
                FROM User
                WHERE id = :Id
            ];
            User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id];
            String accountId = thisUserInfo.Contact.AccountId;
            String userWorkLocation = thisUserInfo.Work_Location__c;
            String accountName;
            Account[] accountInfo = [
                SELECT Name
                FROM account
                WHERE id = :accountId
                LIMIT 1
            ];
            Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
            if (accountInfo.size() > 0) {
                accountName = accountInfo[0].Name;
            }
@@ -949,24 +891,12 @@
    @isTest
    static void testProdError() {
        List<RecordType> rectCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
        ];
        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)'
        ];
        RecordType hosCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'
        ];
        Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
        RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
        Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus');
        insert olympus;
        Account myAccount2 = new Account(name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id);
@@ -992,20 +922,11 @@
        //订单
        System.runAs(MyUser_Test) {
            String Id = UserInfo.getUserId();
            User thisUserInfo = [
                SELECT accountid, ContactId, Contact.AccountId, Work_Location__c
                FROM User
                WHERE id = :Id
            ];
            User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id];
            String accountId = thisUserInfo.Contact.AccountId;
            String userWorkLocation = thisUserInfo.Work_Location__c;
            String accountName;
            Account[] accountInfo = [
                SELECT Name
                FROM account
                WHERE id = :accountId
                LIMIT 1
            ];
            Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1];
            if (accountInfo.size() > 0) {
                accountName = accountInfo[0].Name;
            }
@@ -1208,19 +1129,11 @@
    @isTest
    static void searchTest1() {
        List<RecordType> rectCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
        ];
        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)'
        ];
        Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
        Account myAccount2 = new Account(
            name = 'Testaccount002',
            Dealer_discount__c = 20,
@@ -1381,19 +1294,11 @@
    @isTest
    static void searchTest2() {
        List<RecordType> rectCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
        ];
        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)'
        ];
        Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
        Account myAccount2 = new Account(
            name = 'Testaccount002',
            Dealer_discount__c = 20,
@@ -1523,19 +1428,11 @@
    @isTest
    static void searchTest3() {
        List<RecordType> rectCo = [
            SELECT Id
            FROM RecordType
            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'
        ];
        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)'
        ];
        Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
        Account myAccount2 = new Account(
            name = 'Testaccount002',
            Dealer_discount__c = 20,