| | |
| | | @isTest |
| | | private class LexSummonsCreatControllerTest { |
| | | @isTest |
| | | <<<<<<< HEAD |
| | | static void testInit() { |
| | | ======= |
| | | static void testInit(){ |
| | | >>>>>>> LEXCommunityLiJun |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | <<<<<<< HEAD |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | |
| | | ); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email = 'jplumber@salesforce.com', firstname = 'Joe', lastname = 'Plumber', accountId = accountItem1.Id); |
| | | ======= |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | >>>>>>> LEXCommunityLiJun |
| | | insert core; |
| | | |
| | | Agency_Hospital_Link__c ahl = new Agency_Hospital_Link__c(); |
| | | ahl.Name = 'test1经销商医院'; |
| | | ahl.Hospital__c = accountItem2.Id; |
| | | ahl.Agency__c = accountItem1.Id; |
| | | <<<<<<< HEAD |
| | | insert new List<Agency_Hospital_Link__c>{ ahl }; |
| | | |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | |
| | | UserPro_Type__c = 'ENG', |
| | | Work_Location__c = '北京' |
| | | ); |
| | | ======= |
| | | insert new Agency_Hospital_Link__c[]{ahl}; |
| | | |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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='北京'); |
| | | >>>>>>> LEXCommunityLiJun |
| | | insert userTest; |
| | | } |
| | | //发货 |
| | |
| | | insert consOrder; |
| | | |
| | | // create ContentVersions |
| | | <<<<<<< HEAD |
| | | list<ContentVersion> cvList = new List<ContentVersion>(); |
| | | cvList.add( |
| | | new ContentVersion( |
| | |
| | | FROM User |
| | | WHERE id = :userId |
| | | ]; |
| | | ======= |
| | | list<ContentVersion> cvList = new list<ContentVersion>(); |
| | | cvList.add( new ContentVersion(Title = 'test1',PathOnClient ='/' + 'Test1.txt' ,VersionData = Blob.valueOf('test data 1'), IsMajorVersion = true) ); |
| | | cvList.add( new ContentVersion(Title = 'test2',PathOnClient ='/' + 'Test2.txt' ,VersionData = Blob.valueOf('test data 2'), IsMajorVersion = true) ); |
| | | cvList.add( new ContentVersion(Title = 'test3',PathOnClient ='/' + 'Test3.txt' ,VersionData = Blob.valueOf('test data 3'), IsMajorVersion = true) ); |
| | | insert cvList; |
| | | // retrieve Ids for ContentDocuments created on insert of ContentVersions |
| | | list<Id> cdIdList = new list<Id>(); |
| | | for (ContentDocument cd : [SELECT Id, LatestPublishedVersionId |
| | | FROM ContentDocument |
| | | WHERE (LatestPublishedVersionId =:cvList[0].Id OR LatestPublishedVersionId =:cvList[1].Id OR LatestPublishedVersionId =:cvList[2].Id) |
| | | ORDER BY Title]) |
| | | { |
| | | cdIdList.add(cd.Id); |
| | | } |
| | | system.assertEquals(3, cdIdList.size()); |
| | | list<ContentDocumentLink> cdlList = new list<ContentDocumentLink>(); |
| | | cdlList.add(new ContentDocumentLink(ContentDocumentId=cdIdList[0], LinkedEntityId=consOrder.Id, ShareType='V')); |
| | | insert cdlList; |
| | | LexSummonsCreatController.saveFile(consOrder.Id,'A-65224941-20200923--1.docx','Unit Test Attachment Body'); |
| | | LexSummonsCreatController.getFiles(consOrder.Id); |
| | | LexSummonsCreatController.deleteAtt(cvList[0].Id); |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | <<<<<<< HEAD |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | |
| | | Category5_text__c = 'test123' |
| | | ); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | ======= |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'CDS',Category4__c = 'OER',Category5__c = 'Celon', |
| | | SFDA_Status__c = '有効',Product_Status__c = '正常销售',SFDA_Approbated_Status__c = '有效',Dealer_special_Object__c = true,SFDA_Approbation_No__c = 'Test002',Packing_list_manual__c = 1, |
| | | SFDA_Expiration_Date__c= Date.today(),Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | //发货 |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | |
| | | createIdSend3.SummonsStatus_c__c = '批准'; |
| | | createIdSend3.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend3.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_order__c createIdSend4 = new Consumable_order__c(); |
| | | createIdSend4.Name = 'testMing1'; |
| | | createIdSend4.Order_status__c = '批准'; |
| | |
| | | createIdSend6.SummonsStatus_c__c = ''; |
| | | createIdSend6.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend6.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_order__c createIdSend7 = new Consumable_order__c(); |
| | | createIdSend7.Name = 'testMing222222'; |
| | | createIdSend7.Order_status__c = '批准'; |
| | |
| | | createIdSend7.SummonsStatus_c__c = ''; |
| | | createIdSend7.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend7.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_order__c createIdSend8 = new Consumable_order__c(); |
| | | createIdSend8.Name = 'testMing222222'; |
| | | createIdSend8.Order_status__c = '批准'; |
| | |
| | | createIdSend8.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend8.Delivery_detail_count__c = 5; |
| | | |
| | | <<<<<<< HEAD |
| | | //发票信息 |
| | | Consumable_order__c createIdSend9 = new Consumable_order__c(); |
| | | createIdSend9.Name = 'invoice01'; |
| | | createIdSend9.Invoice_status__c = '已完成'; |
| | | ======= |
| | | //发票信息 |
| | | Consumable_order__c createIdSend9 = new Consumable_order__c(); |
| | | createIdSend9.Name = 'invoice01'; |
| | | createIdSend9.Invoice_status__c='已完成'; |
| | | >>>>>>> LEXCommunityLiJun |
| | | createIdSend9.Order_type__c = '发票'; |
| | | createIdSend9.RecordTypeid = System.Label.RT_ConOrder_Invoice; |
| | | createIdSend9.Order_status__c = '草案中'; |
| | |
| | | createIdSend11.Order_ProType__c = 'ET'; |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c(); |
| | | <<<<<<< HEAD |
| | | testList1.Name = 'Test1'; |
| | | testList1.Summons_Sale_Status__c = '出货'; |
| | | testList1.SummonsStatus_c__c = '已完成'; |
| | |
| | | testList1.Order_status__c = '草案中'; |
| | | testList1.Order_type__c = '传票'; |
| | | testList1.Dealer_info__c = accountItem1.Id; |
| | | ======= |
| | | testList1.Name='Test1'; |
| | | testList1.Summons_Sale_Status__c='出货'; |
| | | testList1.SummonsStatus_c__c='已完成'; |
| | | testList1.Arrive_Order__c = createIdSend9.Id; |
| | | testList1.SummonsForDirction__c='直接销售给医院'; |
| | | testList1.Order_status__c='草案中'; |
| | | testList1.Order_type__c='传票'; |
| | | testList1.Dealer_info__c=accountItem1.Id; |
| | | >>>>>>> LEXCommunityLiJun |
| | | testList1.ConInvoice_Code__c = createIdSend9.id; |
| | | |
| | | //到货 |
| | |
| | | createIdArrived.orderPattern__c = 'promotionorder'; |
| | | createIdArrived.Dealer_Info__c = accountItem1.Id; |
| | | createIdArrived.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order__c>{ |
| | | createIdSend, |
| | | createIdSend1, |
| | |
| | | Invoice_Code_link__c = createIdSend9.Id |
| | | ); |
| | | insert new List<Consumable_order_LinkTable__c>{ order_LinkTable1 }; |
| | | ======= |
| | | insert new Consumable_order__c[]{createIdSend,createIdSend1,createIdSend2,createIdSend3,createIdSend4,createIdSend5,createIdSend6,createIdSend7,createIdSend8,createIdSend9,createIdSend10,createIdSend11,createIdArrived,testList1}; |
| | | |
| | | System.debug('createIdSend9.id = ' + createIdSend9.id); |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList1.Id,Invoice_Code_link__c =createIdSend9.Id); |
| | | insert new Consumable_order_LinkTable__c[]{order_LinkTable1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | |
| | | coc2.Delivery_List_RMB__c = -999.00; |
| | | coc2.Shipment_Count__c = 9999.00; |
| | | coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2 }; |
| | | ======= |
| | | insert new Consumable_orderdetails__c[]{coc,coc1,coc2}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | |
| | | conOrderDetail1.Cancellation_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | conOrderDetail1.Sterilization_limit__c = Date.Today(); |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order_details2__c>{ conOrderDetail1 }; |
| | | |
| | | ======= |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = accountId; |
| | | hp1.account__c = accountId; |
| | | hp1.product__c = pro1.Id; |
| | | <<<<<<< HEAD |
| | | insert new List<hospitalprice__c>{ hp1 }; |
| | | |
| | | Dealer_elationship__c dealerelationship = new Dealer_elationship__c( |
| | |
| | | Dealer_subordinate__c = accountItem1.id |
| | | ); |
| | | insert new List<Dealer_elationship__c>{ dealerelationship, dealerelationship1 }; |
| | | ======= |
| | | insert new hospitalprice__c[]{hp1}; |
| | | |
| | | Dealer_elationship__c dealerelationship = new Dealer_elationship__c(Dealer_principal__c = accountItem1.id,Dealer_subordinate__c = accountItem1.id); |
| | | Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(Dealer_principal__c = accountItem1.id,Dealer_subordinate__c = accountItem1.id); |
| | | insert new Dealer_elationship__c[] {dealerelationship, dealerelationship1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo c0 = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | c0.packinglist = 0; |
| | |
| | | Map<String, String> boxorpieceMap = new Map<String, String>(); |
| | | boxorpieceMap.put('盒', '盒'); |
| | | boxorpieceMap.put('个', '个'); |
| | | <<<<<<< HEAD |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo coder = new LexSummonsCreatController.ConsumableorderdetailsInfo( |
| | | conOrderDetail1 |
| | | ); |
| | | ======= |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo coder = new LexSummonsCreatController.ConsumableorderdetailsInfo(conOrderDetail1); |
| | | >>>>>>> LEXCommunityLiJun |
| | | coder.check = true; |
| | | coder.oldCheck = true; |
| | | coder.hospitalSpecialOffer = true; |
| | |
| | | c3.Boxnumber = 10; |
| | | c1.compareTo(c3); |
| | | c1.Boxnumber = 20; |
| | | <<<<<<< HEAD |
| | | c3.Boxnumber = 10; |
| | | ======= |
| | | c3.Boxnumber = 10; |
| | | >>>>>>> LEXCommunityLiJun |
| | | c1.compareTo(c3); |
| | | c3.Boxnumber = 10; |
| | | c1.Boxnumber = 20; |
| | |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | <<<<<<< HEAD |
| | | consumable.add(codi); |
| | | ======= |
| | | consumable.add(codi); |
| | | >>>>>>> LEXCommunityLiJun |
| | | List<SelectOption> categoryOptionList = new List<SelectOption>(); |
| | | System.Test.startTest(); |
| | | Integer size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | |
| | | String arrive = null; |
| | | String alertMessage = null; |
| | | |
| | | <<<<<<< HEAD |
| | | String category1 = '3400PK:PK针 5mm×33cm'; |
| | | ======= |
| | | String category1= '3400PK:PK针 5mm×33cm'; |
| | | >>>>>>> LEXCommunityLiJun |
| | | String Category3 = '腹腔镜手术'; |
| | | String Category4 = 'PK'; |
| | | String Category5 = 'G400'; |
| | |
| | | optionMap.put('', '-无-'); |
| | | optionMap.put('ishos', '医院特价产品'); |
| | | optionMap.put('nothos', '非医院特价产品'); |
| | | <<<<<<< HEAD |
| | | |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Integer count = LexSummonsCreatController.consumableorderdetailsCount; |
| | | Consumable_order__c cocOrderId = new Consumable_order__c(); |
| | | LexSummonsCreatController.coc = cocOrderId; |
| | | String consumableorderId = LexSummonsCreatController.consumableorderId; |
| | | LexSummonsCreatController summonCC = new LexSummonsCreatController(); |
| | | <<<<<<< HEAD |
| | | |
| | | LexSummonsCreatController.init(testList1.Id, 'Test', 1, 100, testList1.Id); |
| | | LexSummonsCreatController.firstInit(ESetId); |
| | |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend3, createIdSend3.Id, pageRecords); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend1, createIdSend1.Id, pageRecordsLwcLwc); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend6, createIdSend6.Id, pageRecordsLwcLwc); |
| | | ======= |
| | | |
| | | LexSummonsCreatController.init(testList1.Id,'Test',1,100,testList1.Id); |
| | | LexSummonsCreatController.firstInit(ESetId); |
| | | LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive); |
| | | LexSummonsCreatController.init(ESetId,statusEdit,1,100,createIdSend.Id); |
| | | LexSummonsCreatController.init(createIdSend.Id,statusEdit,1,100,arrive); |
| | | LexSummonsCreatController.init(createIdSend.Id,'Test',1,100,createIdSend3.Id); |
| | | LexSummonsCreatController.init(ESetId,'Test',1,100,createIdSend.Id); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ENG','Testaccount001','北京','ishos','Test07','CDS','OER','Celon',true,pageRecords,consumable,'',1,100); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ENG','Testaccount001','北京','nothos','Test07','CDS','OER','Celon',true,pageRecords,consumable,'',1,100); |
| | | LexSummonsCreatController.save(createIdSend2,'','','',pageRecordsLwcLwc,accountId,createIdSend2.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend1,'','','Test',pageRecordsLwcLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend1,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend7,'','',accountItem1.Id,pageRecordsLwcLwc,accountId,createIdSend7.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend3,'Test','Test','',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend3,'','','Test',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend3,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend3.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend4,'','','',pageRecordsLwcLwc,accountId,createIdSend4.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend5,'','','',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend5,'','','Test',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend5,'Test','Test','Test',pageRecordsLwcLwc,accountId,createIdSend5.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend8,accountId,'Test',accountId,pageRecords,accountId,createIdSend8.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend8,accountId,'Test',null,pageRecordsLwc,accountId,createIdSend8.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.checkOutPattern(); |
| | | LexSummonsCreatController.PraseToPDF(createIdSend,createIdSend.Id); |
| | | LexSummonsCreatController.search('Testaccount001'); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend,createIdSend.Id,pageRecordsLwcLwc); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend3,createIdSend3.Id,pageRecords); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend1,createIdSend1.Id,pageRecordsLwcLwc); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend6,createIdSend6.Id,pageRecordsLwcLwc); |
| | | >>>>>>> LEXCommunityLiJun |
| | | LexSummonsCreatController.DelConsumable(createIdSend.Id); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | <<<<<<< HEAD |
| | | static void testSaveMethod() { |
| | | ======= |
| | | static void testSaveMethod(){ |
| | | >>>>>>> LEXCommunityLiJun |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | <<<<<<< HEAD |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | |
| | | FROM User |
| | | WHERE id = :userId |
| | | ]; |
| | | ======= |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | <<<<<<< HEAD |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | |
| | | Category5_text__c = 'test123' |
| | | ); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | ======= |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | | createIdSend.Order_status__c = '批准'; |
| | |
| | | createIdSend1.SummonsStatus_c__c = '价格未定'; |
| | | createIdSend1.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend1.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order__c>{ createIdSend, createIdSend1 }; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | |
| | | coc1.Shipment_Count__c = 9999.00; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | ======= |
| | | insert new Consumable_order__c[]{createIdSend,createIdSend1}; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | | coc.Dealer_Custom_Price__c = 999.00; |
| | | coc.Consumable_count__c = 3; |
| | | coc.Consumable_product__c = pro1.Id; |
| | | coc.Box_Piece__c = '盒'; |
| | | coc.isOutPattern__c = true; |
| | | coc.Consumable_order__c = createIdSend.Id; |
| | | coc.Unitprice_To_agency__c = 999.00; |
| | | coc.Delivery_List_RMB__c = -999.00; |
| | | coc.Shipment_Count__c = 9999.00; |
| | | coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c(); |
| | | coc1.Name = 'Too001'; |
| | | coc1.Dealer_Custom_Price__c = 999.00; |
| | | coc1.Consumable_count__c = 3; |
| | | coc1.Consumable_product__c = pro1.Id; |
| | | coc1.Box_Piece__c = '盒'; |
| | | coc1.isOutPattern__c = true; |
| | | coc1.Consumable_order__c = createIdSend.Id; |
| | | coc1.Unitprice_To_agency__c = 999.00; |
| | | coc1.Delivery_List_RMB__c = null; |
| | | coc1.Shipment_Count__c = 9999.00; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c(); |
| | | coc2.Name = 'Too001'; |
| | | coc2.Dealer_Custom_Price__c = 999.00; |
| | |
| | | coc3.Delivery_List_RMB__c = 100.00; |
| | | coc3.Shipment_Count__c = 9999.00; |
| | | coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2, coc3 }; |
| | | ======= |
| | | insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | |
| | | conOrderDetail1.Cancellation_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | conOrderDetail1.Sterilization_limit__c = Date.Today(); |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order_details2__c>{ conOrderDetail1 }; |
| | | ======= |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | <<<<<<< HEAD |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.save( |
| | |
| | | agencyProType, |
| | | userWorkLocation |
| | | ); |
| | | ======= |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords2,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords3,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords0,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords4,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | >>>>>>> LEXCommunityLiJun |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | <<<<<<< HEAD |
| | | static void testSaveMethod1() { |
| | | ======= |
| | | static void testSaveMethod1(){ |
| | | >>>>>>> LEXCommunityLiJun |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | <<<<<<< HEAD |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | |
| | | FROM User |
| | | WHERE id = :userId |
| | | ]; |
| | | ======= |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | <<<<<<< HEAD |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | |
| | | Category5_text__c = 'test123' |
| | | ); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | ======= |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効', |
| | | Intra_Trade_List_RMB_End_Date1__c = Date.Today(),Intra_Trade_List_RMB_Date2__c = null ,Intra_Trade_List_RMB_1__c = 1,Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | | createIdSend.Order_status__c = '批准'; |
| | |
| | | createIdSend1.SummonsStatus_c__c = '价格未定'; |
| | | createIdSend1.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend1.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order__c>{ createIdSend, createIdSend1 }; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | |
| | | coc1.Shipment_Count__c = null; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | ======= |
| | | insert new Consumable_order__c[]{createIdSend,createIdSend1}; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | | coc.Dealer_Custom_Price__c = 999.00; |
| | | coc.Consumable_count__c = 3; |
| | | coc.Consumable_product__c = pro1.Id; |
| | | coc.Box_Piece__c = '个'; |
| | | coc.isOutPattern__c = true; |
| | | coc.Consumable_order__c = createIdSend.Id; |
| | | coc.Unitprice_To_agency__c = 999.00; |
| | | coc.Delivery_List_RMB__c = 999.00; |
| | | coc.Shipment_Count__c = 9999.00; |
| | | coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c(); |
| | | coc1.Name = 'Too002'; |
| | | coc1.Dealer_Custom_Price__c = 999.00; |
| | | coc1.Consumable_count__c = 3; |
| | | coc1.Consumable_product__c = pro1.Id; |
| | | coc1.Box_Piece__c = '个'; |
| | | coc1.isOutPattern__c = true; |
| | | coc1.Consumable_order__c = createIdSend.Id; |
| | | coc1.Unitprice_To_agency__c = 999.00; |
| | | coc1.Delivery_List_RMB__c = 999.00; |
| | | coc1.Shipment_Count__c = null; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c(); |
| | | coc2.Name = 'Too003'; |
| | | coc2.Dealer_Custom_Price__c = 999.00; |
| | |
| | | coc7.Delivery_List_RMB__c = 100; |
| | | coc7.Shipment_Count__c = 0; |
| | | coc7.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2, coc3, coc4, coc5, coc6, coc7 }; |
| | | ======= |
| | | insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3,coc4,coc5,coc6,coc7}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | |
| | | conOrderDetail1.Cancellation_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | conOrderDetail1.Sterilization_limit__c = Date.Today(); |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order_details2__c>{ conOrderDetail1 }; |
| | | ======= |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c0.check = true; |
| | |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | <<<<<<< HEAD |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.save( |
| | |
| | | agencyProType, |
| | | userWorkLocation |
| | | ); |
| | | ======= |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords2,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords3,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | >>>>>>> LEXCommunityLiJun |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | <<<<<<< HEAD |
| | | static void testSave() { |
| | | ======= |
| | | static void testSave(){ |
| | | >>>>>>> LEXCommunityLiJun |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | <<<<<<< HEAD |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | |
| | | FROM User |
| | | WHERE id = :userId |
| | | ]; |
| | | ======= |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | <<<<<<< HEAD |
| | | Product2 prod07 = new Product2( |
| | | Name = 'Test07', |
| | | ProductCode = 'Test07', |
| | |
| | | Category5_text__c = 'test123' |
| | | ); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | ======= |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | |
| | | createIdSend2.SummonsStatus_c__c = '价格未定'; |
| | | createIdSend2.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend2.Delivery_detail_count__c = 5; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order__c>{ createIdSend, createIdSend1, createIdSend2 }; |
| | | ======= |
| | | insert new Consumable_order__c[] {createIdSend,createIdSend1,createIdSend2}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | |
| | | coc5.Delivery_List_RMB__c = 100; |
| | | coc5.Shipment_Count__c = 10000; |
| | | coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2, coc3, coc4, coc5 }; |
| | | ======= |
| | | insert new Consumable_orderdetails__c[]{coc,coc1,coc2,coc3,coc4,coc5}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | |
| | | conOrderDetail1.Consumable_order_minor__c = createIdSend.Id; |
| | | conOrderDetail1.Lose_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | <<<<<<< HEAD |
| | | insert new List<Consumable_order_details2__c>{ conOrderDetail1 }; |
| | | |
| | | ======= |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = accountId; |
| | | hp1.account__c = accountId; |
| | | hp1.product__c = pro1.Id; |
| | | <<<<<<< HEAD |
| | | insert new List<hospitalprice__c>{ hp1 }; |
| | | ======= |
| | | insert new hospitalprice__c[]{hp1}; |
| | | >>>>>>> LEXCommunityLiJun |
| | | |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc cod = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | |
| | | String arrive = createIdSend.Id; |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.firstInit(ESetId); |
| | | <<<<<<< HEAD |
| | | LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive); |
| | | LexSummonsCreatController.init(ESetId, null, 1, 100, arrive); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend2, createIdSend2.Id, pageRecords); |
| | |
| | | } |
| | | } |
| | | } |
| | | ======= |
| | | LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive); |
| | | LexSummonsCreatController.init(ESetId,null,1,100,arrive); |
| | | LexSummonsCreatController.GoodsDelivery(createIdSend2,createIdSend2.Id,pageRecords); |
| | | LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecordsList,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,null,accountId,createIdSend.Id,null,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,accountId,'Test',accountItem1.Id,pageRecords,accountId,null,consumableList,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords2,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend2,accountId,'Test',null,pageRecords3,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend1,'','',accountItem1.Id,pageRecords3,accountId,createIdSend2.Id,null,agencyProType,userWorkLocation); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | @isTest |
| | | static void testAttachment(){ |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | thisUserInfo.UserPro_Type__c = ''; |
| | | update thisUserInfo; |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | //发货 |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | | createIdSend.Order_status__c = '批准'; |
| | | createIdSend.Deliver_date__c = Date.today(); |
| | | createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend.Order_type__c = '订单'; |
| | | createIdSend.Order_ProType__c = 'ENG'; |
| | | createIdSend.SummonsForDirction__c = '直接销售给医院'; |
| | | createIdSend.Order_ForDealerText__c = 'Test'; |
| | | createIdSend.Order_ForCustomerText__c = 'Test'; |
| | | createIdSend.SummonsStatus_c__c = '批准'; |
| | | createIdSend.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend.Delivery_detail_count__c = 5; |
| | | |
| | | Consumable_order__c createIdSend1 = new Consumable_order__c(); |
| | | createIdSend1.Name = 'testMing1'; |
| | | createIdSend1.Order_status__c = '批准'; |
| | | createIdSend1.Deliver_date__c = Date.today(); |
| | | createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend1.Order_type__c = '订单'; |
| | | createIdSend1.Order_ProType__c = 'ENG'; |
| | | createIdSend1.SummonsForDirction__c = '医院试用'; |
| | | createIdSend1.Order_ForDealerText__c = 'Test'; |
| | | createIdSend1.Order_ForCustomerText__c = ''; |
| | | createIdSend1.SummonsStatus_c__c = '批准'; |
| | | createIdSend1.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend1.Delivery_detail_count__c = 5; |
| | | |
| | | Consumable_order__c createIdSend2 = new Consumable_order__c(); |
| | | createIdSend2.Name = 'testMing1'; |
| | | createIdSend2.Order_status__c = '批准'; |
| | | createIdSend2.Deliver_date__c = Date.today(); |
| | | createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend2.Order_type__c = '订单'; |
| | | createIdSend2.Order_ProType__c = 'ENG'; |
| | | createIdSend2.SummonsForDirction__c = '互相调货'; |
| | | createIdSend2.Order_ForDealerText__c = ''; |
| | | createIdSend2.Order_ForCustomerText__c = 'Test'; |
| | | createIdSend2.SummonsStatus_c__c = '批准'; |
| | | createIdSend2.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend2.Delivery_detail_count__c = 5; |
| | | insert new Consumable_order__c[] {createIdSend,createIdSend1,createIdSend2}; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | | coc.Dealer_Custom_Price__c = 999.00; |
| | | coc.Consumable_count__c = 3; |
| | | coc.Consumable_product__c = pro1.Id; |
| | | coc.Box_Piece__c = '盒'; |
| | | coc.isOutPattern__c = true; |
| | | coc.Consumable_order__c = createIdSend.Id; |
| | | coc.Unitprice_To_agency__c = 999.00; |
| | | coc.Delivery_List_RMB__c = 999.00; |
| | | coc.Shipment_Count__c = null; |
| | | coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c(); |
| | | coc2.Name = 'Too001'; |
| | | coc2.Dealer_Custom_Price__c = 999.00; |
| | | coc2.Consumable_count__c = 3; |
| | | coc2.Consumable_product__c = pro1.Id; |
| | | coc2.Box_Piece__c = '个'; |
| | | coc2.isOutPattern__c = true; |
| | | coc2.Consumable_order__c = createIdSend.Id; |
| | | coc2.Unitprice_To_agency__c = 999.00; |
| | | coc2.Delivery_List_RMB__c = 0; |
| | | coc2.Shipment_Count__c = 0; |
| | | coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | insert new Consumable_orderdetails__c[]{coc,coc2}; |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | | conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id; |
| | | conOrderDetail1.Consumable_Product__c = pro1.Id; |
| | | conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | conOrderDetail1.Bar_Code__c = '11111'; |
| | | conOrderDetail1.Arrive_date__c = Date.today().addDays(1); |
| | | conOrderDetail1.Send_Date__c = null; |
| | | conOrderDetail1.Used_date__c = null; |
| | | conOrderDetail1.Return_date__c = null; |
| | | conOrderDetail1.Consumable_order_minor__c = createIdSend.Id; |
| | | conOrderDetail1.Lose_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = accountId; |
| | | hp1.account__c = accountId; |
| | | hp1.product__c = pro1.Id; |
| | | insert new hospitalprice__c[]{hp1}; |
| | | |
| | | Attachment attach = new Attachment(); |
| | | attach.Name='A-65224941-20200923--1.docx'; |
| | | Blob bodyBlob= Blob.valueOf('Unit Test Attachment Body'); |
| | | attach.body = bodyBlob; |
| | | attach.ParentId = createIdSend.id; |
| | | attach.ContentType = 'application/pdf'; |
| | | insert new Attachment[] {attach}; |
| | | |
| | | System.Test.startTest(); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c5.check = true; |
| | | c5.hospitalSpecialOffer = true; |
| | | c5.orderdetails1 = coc; |
| | | c5.allnumber = 1999.00; |
| | | pageRecordsLwcLwc.add(c5); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList= new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c8.check = true; |
| | | c8.hospitalSpecialOffer = true; |
| | | c8.orderdetails1 = coc2; |
| | | c8.allnumber = 1999.00; |
| | | pageRecordsList.add(c8); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c6.check = false; |
| | | c6.hospitalSpecialOffer = false; |
| | | c6.orderdetails1 = coc; |
| | | c6.allnumber = 1999.00; |
| | | pageRecords.add(c6); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c7.check = true; |
| | | c7.oldCheck = true; |
| | | c7.hospitalSpecialOffer = true; |
| | | c7.orderdetails1 = coc; |
| | | c7.orderdetails2 = conOrderDetail1; |
| | | c7.Prod = pro1; |
| | | c7.Boxnumber = 0.00; |
| | | c7.Piecenumber = 0.00; |
| | | c7.allnumber = 1999.00; |
| | | c7.oldConsumableCount = 1999.00; |
| | | c7.canSelect = true; |
| | | c7.sortBy = true; |
| | | c7.packinglist = 1; |
| | | c7.approbation_No = ''; |
| | | c7.expiration_Date = Date.Today(); |
| | | c7.boxorpiecein = ''; |
| | | c7.boxorpiece = null; |
| | | c7.boxorpieceMap = null; |
| | | c7.concc = null; |
| | | c7.BoxPiece = null; |
| | | c7.hosPro = true; |
| | | pageRecordsLwc.add(c7); |
| | | |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi.check = true; |
| | | codi.oldCheck = true; |
| | | codi.hospitalSpecialOffer = true; |
| | | codi.packinglist = 0; |
| | | codi.approbation_No = null; |
| | | codi.expiration_Date = Date.Today(); |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi1.check = false; |
| | | codi1.oldCheck = true; |
| | | codi1.hospitalSpecialOffer = false; |
| | | codi1.packinglist = 0; |
| | | codi1.approbation_No = null; |
| | | codi1.expiration_Date = Date.Today(); |
| | | codi1.boxorpiecein = null; |
| | | codi1.orderdetails1 = coc; |
| | | codi1.Prod = pro1; |
| | | consumable.add(codi); |
| | | |
| | | Integer size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | String ESetId = createIdSend.Id; |
| | | String statusEdit = 'Test'; |
| | | String arrive = createIdSend.Id; |
| | | LexSummonsCreatController.firstInit(ESetId); |
| | | LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive); |
| | | LexSummonsCreatController.save(createIdSend,'Test','Test','Test',pageRecordsLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend1,'Test','Test','Test',pageRecordsLwc,accountId,createIdSend1.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend2,'','','',pageRecordsLwc,accountId,createIdSend2.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecordsList,accountId,null,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.searchConsumableorderdetails(agencyProType,accountName,userWorkLocation,'ishos','Test07','Test7','Test77','Test777',true,pageRecordsLwc,consumable,'',1,100); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo con = new LexSummonsCreatController.ConsumableorderdetailsInfo(attach); |
| | | con.concc = attach; |
| | | con.hospitalSpecialOffer = false; |
| | | con.hosPro = false; |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | static void testSave1(){ |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900',Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | thisUserInfo.UserPro_Type__c = ''; |
| | | update thisUserInfo; |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | | createIdSend.Order_status__c = '批准'; |
| | | createIdSend.Deliver_date__c = Date.today(); |
| | | createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend.Order_type__c = '订单'; |
| | | createIdSend.Order_ProType__c = 'ENG'; |
| | | createIdSend.SummonsForDirction__c = '互相调货'; |
| | | createIdSend.Order_ForDealerText__c = ''; |
| | | createIdSend.Order_ForCustomerText__c = ''; |
| | | createIdSend.SummonsStatus_c__c = ''; |
| | | createIdSend.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend.Delivery_detail_count__c = 5; |
| | | |
| | | Consumable_order__c createIdSend1 = new Consumable_order__c(); |
| | | createIdSend1.Name = 'testMing1'; |
| | | createIdSend1.Order_status__c = '批准'; |
| | | createIdSend1.Deliver_date__c = Date.today(); |
| | | createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend1.Order_type__c = '订单'; |
| | | createIdSend1.Order_ProType__c = 'ENG'; |
| | | createIdSend1.SummonsForDirction__c = '互相调货'; |
| | | createIdSend1.Order_ForDealerText__c = ''; |
| | | createIdSend1.Order_ForCustomerText__c = ''; |
| | | createIdSend1.SummonsStatus_c__c = ''; |
| | | createIdSend1.Arrive_Order__c = createIdSend.Id; |
| | | createIdSend1.Order_ForDealerTextID__c = accountItem1.Id; |
| | | createIdSend1.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend1.Delivery_detail_count__c = 5; |
| | | insert new Consumable_order__c[] {createIdSend,createIdSend1}; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | | coc.Dealer_Custom_Price__c = 999.00; |
| | | coc.Consumable_count__c = 3; |
| | | coc.Consumable_product__c = pro1.Id; |
| | | coc.Box_Piece__c = '盒'; |
| | | coc.isOutPattern__c = true; |
| | | coc.Consumable_order__c = createIdSend.Id; |
| | | coc.Unitprice_To_agency__c = 999.00; |
| | | coc.Delivery_List_RMB__c = 999.00; |
| | | coc.Shipment_Count__c = null; |
| | | coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c(); |
| | | coc1.Name = 'Too001'; |
| | | coc1.Dealer_Custom_Price__c = 999.00; |
| | | coc1.Consumable_count__c = 3; |
| | | coc1.Consumable_product__c = pro1.Id; |
| | | coc1.Box_Piece__c = '盒'; |
| | | coc1.isOutPattern__c = true; |
| | | coc1.Consumable_order__c = createIdSend.Id; |
| | | coc1.Unitprice_To_agency__c = 999.00; |
| | | coc1.Delivery_List_RMB__c = null; |
| | | coc1.Shipment_Count__c = 10000; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | insert new Consumable_orderdetails__c[]{coc,coc1}; |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | | conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id; |
| | | conOrderDetail1.Consumable_Product__c = pro1.Id; |
| | | conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | conOrderDetail1.Bar_Code__c = '11111'; |
| | | conOrderDetail1.Arrive_date__c = Date.today().addDays(1); |
| | | conOrderDetail1.Send_Date__c = null; |
| | | conOrderDetail1.Used_date__c = null; |
| | | conOrderDetail1.Return_date__c = null; |
| | | conOrderDetail1.Consumable_order_minor__c = createIdSend.Id; |
| | | conOrderDetail1.Lose_Flag__c = false; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1}; |
| | | |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = accountId; |
| | | hp1.account__c = accountId; |
| | | hp1.product__c = pro1.Id; |
| | | insert new hospitalprice__c[]{hp1}; |
| | | |
| | | Integer size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | String ESetId = createIdSend.Id; |
| | | String statusEdit = 'Test'; |
| | | String arrive = createIdSend.Id; |
| | | |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c7.check = true; |
| | | c7.oldCheck = true; |
| | | c7.hospitalSpecialOffer = true; |
| | | c7.orderdetails1 = coc; |
| | | c7.orderdetails2 = conOrderDetail1; |
| | | c7.Prod = pro1; |
| | | c7.Boxnumber = 0.00; |
| | | c7.Piecenumber = 0.00; |
| | | c7.allnumber = 1999.00; |
| | | c7.oldConsumableCount = 1999.00; |
| | | c7.canSelect = true; |
| | | c7.sortBy = true; |
| | | c7.packinglist = 1; |
| | | c7.approbation_No = ''; |
| | | c7.expiration_Date = Date.Today(); |
| | | c7.boxorpiecein = ''; |
| | | c7.boxorpiece = null; |
| | | c7.boxorpieceMap = null; |
| | | c7.concc = null; |
| | | c7.BoxPiece = null; |
| | | c7.hosPro = true; |
| | | pageRecordsLwc.add(c7); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c8.check = true; |
| | | c8.oldCheck = true; |
| | | c8.hospitalSpecialOffer = true; |
| | | c8.orderdetails1 = coc1; |
| | | c8.orderdetails2 = conOrderDetail1; |
| | | c8.Prod = null; |
| | | c8.Boxnumber = 0.00; |
| | | c8.Piecenumber = 0.00; |
| | | c8.allnumber = 1999.00; |
| | | c8.oldConsumableCount = 1999.00; |
| | | c8.canSelect = true; |
| | | c8.sortBy = true; |
| | | c8.packinglist = 1; |
| | | c8.approbation_No = ''; |
| | | c8.expiration_Date = Date.Today(); |
| | | c8.boxorpiecein = ''; |
| | | c8.boxorpiece = null; |
| | | c8.boxorpieceMap = null; |
| | | c8.concc = null; |
| | | c8.BoxPiece = null; |
| | | c8.hosPro = true; |
| | | pageRecords1.add(c8); |
| | | |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi.check = true; |
| | | codi.oldCheck = true; |
| | | codi.hospitalSpecialOffer = true; |
| | | codi.packinglist = 0; |
| | | codi.approbation_No = null; |
| | | codi.expiration_Date = Date.Today(); |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi1.check = false; |
| | | codi1.oldCheck = true; |
| | | codi1.hospitalSpecialOffer = false; |
| | | codi1.packinglist = 0; |
| | | codi1.approbation_No = null; |
| | | codi1.expiration_Date = Date.Today(); |
| | | codi1.boxorpiecein = null; |
| | | codi1.orderdetails1 = coc; |
| | | codi1.Prod = pro1; |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecordsLwc,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend1,'','','',pageRecordsLwc,accountId,null,consumable,agencyProType,userWorkLocation); |
| | | LexSummonsCreatController.save(createIdSend,'','','',pageRecords1,accountId,null,consumable,agencyProType,userWorkLocation); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | static testMethod void testInnerClass(){ |
| | | Account accountItem1; |
| | | Account accountItem2; |
| | | User userTest; |
| | | String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name='Testaccount002',RecordTypeId = rectHp, AgentCode_Ext__c = '9999999', ParentId = accountItem1.Id,Contract_Decide_Start_Date__c = Date.today(),ENG_Dealer__c = true,BillingCity = null); |
| | | insert accountItem2; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe', lastname='Plumber', accountId = accountItem1.Id); |
| | | insert core; |
| | | System.runAs(new user(ID = UserInfo.getUserID())) { |
| | | userTest = 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 userTest; |
| | | } |
| | | System.runAs(userTest){ |
| | | String userId = UserInfo.getUserId(); |
| | | User thisUserInfo = [SELECT accountid, UserPro_Type__c, ContactId, Contact.AccountId,Contact.Account.Name, Work_Location__c FROM User WHERE id =:userId]; |
| | | String accountId = thisUserInfo.accountid; |
| | | String accountName = thisUserInfo.Contact.Account.Name; |
| | | String agencyProType = thisUserInfo.UserPro_Type__c; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | thisUserInfo.UserPro_Type__c = ''; |
| | | update thisUserInfo; |
| | | if (String.isBlank(thisUserInfo.UserPro_Type__c)) { |
| | | agencyProType = 'ET'; |
| | | } |
| | | Product2 prod07 = new Product2(Name='Test07',ProductCode='Test07',Asset_Model_No__c = 'Test07', ProductCode_Ext__c = 'Test07',Category3__c = 'Test7',Category4__c = 'Test77',Category5__c = 'Test777',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Packing_list_manual__c = 1,Manual_Entry__c = false); |
| | | insert new Product2[] {prod07}; |
| | | Product2__c pro1 = new Product2__c(Name='MH-155:白平衡帽',OT_CODE_Text__c='Test001',Product2__c = prod07.Id,Category3_text__c = 'test123', Category4_text__c = 'test123', Category5_text__c = 'test123'); |
| | | insert new Product2__c[] {pro1}; |
| | | Consumable_order__c createIdSend = new Consumable_order__c(); |
| | | createIdSend.Name = 'testMing1'; |
| | | createIdSend.Order_status__c = '批准'; |
| | | createIdSend.Deliver_date__c = Date.today(); |
| | | createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend.Order_type__c = '订单'; |
| | | createIdSend.Order_ProType__c = 'ENG'; |
| | | createIdSend.SummonsForDirction__c = '测试0001'; |
| | | createIdSend.Order_ForDealerText__c = 'Testaccount003'; |
| | | createIdSend.Order_ForCustomerText__c = 'Test000'; |
| | | createIdSend.SummonsStatus_c__c = '批准'; |
| | | createIdSend.orderPattern__c = 'hospitalorder'; |
| | | createIdSend.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend.Delivery_detail_count__c = 5; |
| | | |
| | | Consumable_order__c createIdSend3 = new Consumable_order__c(); |
| | | createIdSend3.Name = 'testMing123456'; |
| | | createIdSend3.Order_status__c = '批准'; |
| | | createIdSend3.Deliver_date__c = Date.today(); |
| | | createIdSend3.Arrive_Order__c = createIdSend.Id; |
| | | createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | createIdSend3.Order_type__c = '订单'; |
| | | createIdSend3.Order_ProType__c = 'ENG'; |
| | | createIdSend3.SummonsForDirction__c = '互相调货'; |
| | | createIdSend3.Order_ForDealerText__c = ''; |
| | | createIdSend3.Order_ForCustomerText__c = 'Test001'; |
| | | createIdSend3.SummonsStatus_c__c = '批准'; |
| | | createIdSend3.Dealer_Info__c = accountItem1.Id; |
| | | createIdSend3.Delivery_detail_count__c = 5; |
| | | //到货 |
| | | Consumable_order__c createIdArrived = new Consumable_order__c(); |
| | | createIdArrived.Name = 'testMing2'; |
| | | createIdArrived.Order_status__c = '批准'; |
| | | createIdArrived.Deliver_date__c = Date.today(); |
| | | createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive; |
| | | createIdArrived.Order_type__c = '订单'; |
| | | createIdArrived.Order_ProType__c = 'ET'; |
| | | createIdArrived.Arrive_Order__c = createIdSend.Id; |
| | | createIdArrived.SummonsStatus_c__c = '已提交'; |
| | | createIdArrived.orderPattern__c = 'promotionorder'; |
| | | createIdArrived.Dealer_Info__c = accountItem1.Id; |
| | | createIdArrived.Delivery_detail_count__c = 5; |
| | | insert new Consumable_order__c[]{createIdSend,createIdSend3,createIdArrived}; |
| | | |
| | | Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); |
| | | coc.Name = 'Too001'; |
| | | coc.Dealer_Custom_Price__c = 999.00; |
| | | coc.Consumable_count__c = 3; |
| | | coc.Consumable_product__c = pro1.Id; |
| | | coc.Box_Piece__c = '盒'; |
| | | coc.isOutPattern__c = true; |
| | | coc.Consumable_order__c = createIdSend.Id; |
| | | coc.Unitprice_To_agency__c = 999.00; |
| | | coc.Delivery_List_RMB__c = -999.00; |
| | | coc.Shipment_Count__c = 9999.00; |
| | | coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | |
| | | Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c(); |
| | | coc1.Name = 'Too001'; |
| | | coc1.Dealer_Custom_Price__c = 999.00; |
| | | coc1.Consumable_count__c = 3; |
| | | coc1.Consumable_product__c = pro1.Id; |
| | | coc1.Box_Piece__c = '盒'; |
| | | coc1.isOutPattern__c = true; |
| | | coc1.Consumable_order__c = createIdSend3.Id; |
| | | coc1.Unitprice_To_agency__c = 999.00; |
| | | coc1.Delivery_List_RMB__c = 999.00; |
| | | coc1.Shipment_Count__c = 9999.00; |
| | | coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order; |
| | | insert new Consumable_orderdetails__c[]{coc,coc1}; |
| | | |
| | | Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c(); |
| | | conOrderDetail1.Name = 'OCM_01_001001'; |
| | | conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id; |
| | | conOrderDetail1.Consumable_Product__c = pro1.Id; |
| | | conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | conOrderDetail1.Bar_Code__c = '11111'; |
| | | conOrderDetail1.Arrive_date__c = Date.today().addDays(1); |
| | | conOrderDetail1.Send_Date__c = null; |
| | | conOrderDetail1.Used_date__c = null; |
| | | conOrderDetail1.Return_date__c = null; |
| | | conOrderDetail1.Consumable_Arrived_order__c = createIdSend.Id; |
| | | conOrderDetail1.Consumable_order_minor__c = createIdSend.Id; |
| | | conOrderDetail1.Lose_Flag__c = false; |
| | | conOrderDetail1.Cancellation_Flag__c = false; |
| | | conOrderDetail1.exchangeOutPattern__c = true; |
| | | conOrderDetail1.Box_Piece__c = '盒'; |
| | | conOrderDetail1.Sterilization_limit__c = Date.Today(); |
| | | |
| | | Consumable_order_details2__c conOrderDetail2 = new Consumable_order_details2__c(); |
| | | conOrderDetail2.Name = 'OCM_01_001002'; |
| | | conOrderDetail2.Consumable_ZS_order__c = createIdArrived.Id; |
| | | conOrderDetail2.Consumable_Product__c = pro1.Id; |
| | | conOrderDetail2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | conOrderDetail2.Bar_Code__c = '22222'; |
| | | conOrderDetail2.Arrive_date__c = Date.today().addDays(1); |
| | | conOrderDetail2.Send_Date__c = null; |
| | | conOrderDetail2.Used_date__c = null; |
| | | conOrderDetail2.Return_date__c = null; |
| | | conOrderDetail2.Consumable_Arrived_order__c = createIdArrived.Id; |
| | | conOrderDetail2.Consumable_order_minor__c = createIdArrived.Id; |
| | | conOrderDetail2.Lose_Flag__c = false; |
| | | conOrderDetail2.exchangeOutPattern__c = false; |
| | | conOrderDetail2.Cancellation_Flag__c = false; |
| | | conOrderDetail2.Box_Piece__c = '个'; |
| | | conOrderDetail2.Sterilization_limit__c = Date.Today(); |
| | | insert new Consumable_order_details2__c[]{conOrderDetail1,conOrderDetail2}; |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c6.check = true; |
| | | c6.oldCheck = true; |
| | | c6.hospitalSpecialOffer = true; |
| | | c6.orderdetails1 = coc1; |
| | | c6.orderdetails2 = conOrderDetail1; |
| | | c6.Prod = pro1; |
| | | c6.Boxnumber = 0.00; |
| | | c6.Piecenumber = 0.00; |
| | | c6.allnumber = 1999.00; |
| | | c6.oldConsumableCount = 1999.00; |
| | | c6.canSelect = true; |
| | | c6.sortBy = true; |
| | | c6.packinglist = 1; |
| | | c6.approbation_No = ''; |
| | | c6.expiration_Date = Date.Today(); |
| | | c6.boxorpiecein = ''; |
| | | c6.boxorpiece = null; |
| | | c6.boxorpieceMap = null; |
| | | c6.concc = null; |
| | | c6.BoxPiece = null; |
| | | c6.hosPro = true; |
| | | pageRecords.add(c6); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc c111 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | c111.check = true; |
| | | c111.oldCheck = true; |
| | | c111.hospitalSpecialOffer = false; |
| | | c111.orderdetails1 = coc1; |
| | | c111.orderdetails2 = conOrderDetail1; |
| | | c111.Prod = pro1; |
| | | c111.Boxnumber = 0.00; |
| | | c111.Piecenumber = 0.00; |
| | | c111.allnumber = 1999.00; |
| | | c111.oldConsumableCount = 1999.00; |
| | | c111.canSelect = true; |
| | | c111.sortBy = true; |
| | | c111.packinglist = 1; |
| | | c111.approbation_No = ''; |
| | | c111.expiration_Date = Date.Today(); |
| | | c111.boxorpiecein = ''; |
| | | c111.boxorpiece = null; |
| | | c111.boxorpieceMap = null; |
| | | c111.concc = null; |
| | | c111.BoxPiece = null; |
| | | c111.hosPro = true; |
| | | pageRecords1.add(c111); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi.check = true; |
| | | codi.hospitalSpecialOffer = true; |
| | | codi.packinglist = 0; |
| | | codi.approbation_No = null; |
| | | codi.expiration_Date = Date.Today(); |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = coc; |
| | | codi.Prod = pro1; |
| | | consumable.add(codi); |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.init(null,'Test',1,100,createIdArrived.Id); |
| | | LexSummonsCreatController.init(null,'Test',1,100,null); |
| | | LexSummonsCreatController.init(null,null,1,100,createIdArrived.Id); |
| | | LexSummonsCreatController.categoryAllload('Test7'); |
| | | LexSummonsCreatController.categoryload('Test7','Test77'); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','北京','ishos','Test07','Test7','Test77','Test777',true,pageRecords,consumable,'',1,1); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','北京','nothos','Test07','Test7','Test77','Test777',true,pageRecords,consumable,'',1,1); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','北京','ishos','Test07','Test7','Test77','Test777',true,pageRecords1,consumable,'',1,1); |
| | | LexSummonsCreatController.searchConsumableorderdetails('ET','Testaccount001','北京','nothos','Test07','Test7','Test77','Test777',true,pageRecords1,consumable,'',1,1); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfo> cro = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>(); |
| | | cro.sort(); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | static void saveMethodTest1(){ |
| | | 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 rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = myAccount2.Id; |
| | | hp1.account__c = myAccount1.Id; |
| | | insert hp1; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user 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='北京'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | Consumable_order__c Order0 = new Consumable_order__c(); |
| | | Order0.Name = 'OCM_01_000'; |
| | | Order0.Order_status__c = '批准'; |
| | | Order0.Order_type__c = '订单'; |
| | | Order0.Dealer_Info__c = myAccount1.id; |
| | | Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order0.Order_ProType__c = 'ET'; |
| | | insert Order0; |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | | Order1.Order_status__c = '批准'; |
| | | Order1.Order_type__c = '订单'; |
| | | Order1.Dealer_Info__c = myAccount1.id; |
| | | Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order1.Order_ProType__c = 'ET'; |
| | | Order1.OutPattern__c = true; |
| | | Order1.Arrive_Order__c = Order0.Id; |
| | | insert Order1; |
| | | Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c(); |
| | | Orderdet.Name = 'OCM_01_00101'; |
| | | Orderdet.Consumable_order__c = Order1.Id; |
| | | Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | Orderdet.Consumable_Product__c = pro1.Id; |
| | | Orderdet.Consumable_count__c = 4; |
| | | Orderdet.Shipment_Count__c = 10; |
| | | Orderdet.isOutPattern__c = true; |
| | | Orderdet.Delivery_List_RMB__c = 100; |
| | | Orderdet.Box_Piece__c = '盒'; |
| | | insert Orderdet; |
| | | Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet1.Consumable_Product__c = pro1.Id; |
| | | Orderdet1.Asset_Model_No__c = 'Test01'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Cancellation_Date__c = null; |
| | | Orderdet1.TracingCode__c = 'BXJRF'; |
| | | Orderdet1.SerialLotNo__c = '5ZK'; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.exchangeOutPattern__c = true; |
| | | Orderdet1.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet1.Box_Piece__c = '盒'; |
| | | insert Orderdet1; |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, ''); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfoLwc p = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc(); |
| | | p.check = true; |
| | | p.oldcheck = true; |
| | | p.hospitalSpecialOffer = true; |
| | | p.orderdetails1 = Orderdet; |
| | | p.orderdetails2 = Orderdet1; |
| | | p.Prod = pro1; |
| | | p.Boxnumber = 2; |
| | | p.Piecenumber = 2; |
| | | pList.add(p); |
| | | List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>(); |
| | | LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo(); |
| | | codi.check = true; |
| | | codi.hospitalSpecialOffer = true; |
| | | codi.packinglist = 0; |
| | | codi.approbation_No = null; |
| | | codi.expiration_Date = Date.Today(); |
| | | codi.boxorpiecein = null; |
| | | codi.orderdetails1 = Orderdet; |
| | | codi.orderdetails2 = Orderdet1; |
| | | codi.Prod = pro1; |
| | | consumable.add(codi); |
| | | LexSummonsCreatController.coc.SummonsForDirction__c = '直接销售给医院'; |
| | | LexSummonsCreatController.coc.Order_ForCustomerText__c = '消化科'; |
| | | LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', ''); |
| | | Orderdet.Box_Piece__c = '个'; |
| | | LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', ''); |
| | | p.Piecenumber = 20; |
| | | LexSummonsCreatController.save(LexSummonsCreatController.coc, myAccount2.Id, myAccount2.Name, '', pList, myAccount1.Id, '', consumable, 'ET', ''); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | static void initMethodTest1(){ |
| | | 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 rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = myAccount2.Id; |
| | | hp1.account__c = myAccount1.Id; |
| | | insert hp1; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user 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='北京'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | Consumable_order__c Order0 = new Consumable_order__c(); |
| | | Order0.Name = 'OCM_01_000'; |
| | | Order0.Order_status__c = '批准'; |
| | | Order0.Order_type__c = '订单'; |
| | | Order0.Dealer_Info__c = myAccount1.id; |
| | | Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order0.Order_ProType__c = 'ET'; |
| | | insert Order0; |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | | Order1.Order_status__c = '批准'; |
| | | Order1.Order_type__c = '传票'; |
| | | Order1.Dealer_Info__c = myAccount1.id; |
| | | Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order1.Order_ProType__c = 'ET'; |
| | | Order1.OutPattern__c = true; |
| | | Order1.Arrive_Order__c = Order0.Id; |
| | | Order1.SummonsStatus_c__c = '已提交'; |
| | | Order1.SummonsForDirction__c = '直接销售给医院'; |
| | | insert Order1; |
| | | Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c(); |
| | | Orderdet.Name = 'OCM_01_00101'; |
| | | Orderdet.Consumable_order__c = Order1.Id; |
| | | Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | Orderdet.Consumable_Product__c = pro1.Id; |
| | | Orderdet.Consumable_count__c = 4; |
| | | Orderdet.Shipment_Count__c = 10; |
| | | Orderdet.isOutPattern__c = true; |
| | | Orderdet.Delivery_List_RMB__c = 100; |
| | | Orderdet.Box_Piece__c = '盒'; |
| | | insert Orderdet; |
| | | Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet1.Consumable_Product__c = pro1.Id; |
| | | Orderdet1.Asset_Model_No__c = 'Test01'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Cancellation_Date__c = null; |
| | | Orderdet1.TracingCode__c = 'BXJRF'; |
| | | Orderdet1.SerialLotNo__c = '5ZK'; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.exchangeOutPattern__c = true; |
| | | Orderdet1.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet1.Box_Piece__c = '盒'; |
| | | insert Orderdet1; |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, ''); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | @isTest |
| | | static void initMethodTest2(){ |
| | | 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 rectCoO = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | Account myAccount2 = new Account(RecordTypeId = rectCoO.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | Account myAccount1 = new Account(name='Testaccount001',Dealer_discount__c =30,RecordTypeId = rectCo[0].Id); |
| | | insert new account[]{myAccount1,myAccount2}; |
| | | hospitalprice__c hp1 = new hospitalprice__c(); |
| | | hp1.hospital__c = myAccount2.Id; |
| | | hp1.account__c = myAccount1.Id; |
| | | insert hp1; |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | user 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'); |
| | | System.runAs(new User(Id = UserInfo.getUserId())){ |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | | System.runAs(MyUser_Test){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',JANCODE__c = '04953170200311',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',JANCODE__c = '04953170200312',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01,prod02}; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='N3047730',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='N3047731',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | Consumable_order__c Order0 = new Consumable_order__c(); |
| | | Order0.Name = 'OCM_01_000'; |
| | | Order0.Order_status__c = '批准'; |
| | | Order0.Order_type__c = '订单'; |
| | | Order0.Dealer_Info__c = myAccount1.id; |
| | | Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery; |
| | | Order0.Order_ProType__c = 'ET'; |
| | | insert Order0; |
| | | |
| | | Consumable_order__c Order1 = new Consumable_order__c(); |
| | | Order1.Name = 'OCM_01_001'; |
| | | Order1.Order_status__c = '批准'; |
| | | Order1.Order_type__c = '订单'; |
| | | Order1.Dealer_Info__c = myAccount1.id; |
| | | Order1.RecordTypeid = System.Label.RT_ConOrder_Arrive; |
| | | Order1.Order_ProType__c = 'ET'; |
| | | Order1.OutPattern__c = true; |
| | | Order1.Arrive_Order__c = Order0.Id; |
| | | Order1.SummonsStatus_c__c = '已提交'; |
| | | Order1.SummonsForDirction__c = '直接销售给医院'; |
| | | insert Order1; |
| | | Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c(); |
| | | Orderdet.Name = 'OCM_01_00101'; |
| | | Orderdet.Consumable_order__c = Order0.Id; |
| | | Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | Orderdet.Consumable_Product__c = pro1.Id; |
| | | Orderdet.Consumable_count__c = 4; |
| | | Orderdet.Shipment_Count__c = 10; |
| | | Orderdet.isOutPattern__c = true; |
| | | Orderdet.Delivery_List_RMB__c = 100; |
| | | Orderdet.Box_Piece__c = '盒'; |
| | | insert Orderdet; |
| | | Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c(); |
| | | Orderdet1.Name = 'OCM_01_001001'; |
| | | Orderdet1.Consumable_order_minor__c = Order1.Id; |
| | | Orderdet1.Consumable_Product__c = pro1.Id; |
| | | Orderdet1.Asset_Model_No__c = 'Test01'; |
| | | Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery; |
| | | Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF'; |
| | | Orderdet1.Cancellation_Date__c = null; |
| | | Orderdet1.TracingCode__c = 'BXJRF'; |
| | | Orderdet1.SerialLotNo__c = '5ZK'; |
| | | Orderdet1.Arrive_date__c = Date.today(); |
| | | Orderdet1.exchangeOutPattern__c = true; |
| | | Orderdet1.Consumable_ZS_order__c = Order1.Id; |
| | | Orderdet1.Box_Piece__c = '盒'; |
| | | Orderdet1.Sterilization_limit__c= Date.today().addDays(2); |
| | | insert Orderdet1; |
| | | System.Test.startTest(); |
| | | LexSummonsCreatController.init('', 'edit', 10, 1, Order1.Id); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | } |
| | | >>>>>>> LEXCommunityLiJun |