From 36d15f189de2e83ce2576715dac30c3c260388dd Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 14:47:50 +0800 Subject: [PATCH] fixconflict --- force-app/main/default/classes/LexSummonsCreatControllerTest.cls | 2381 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 2,380 insertions(+), 1 deletions(-) diff --git a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls index 6e443dc..0544c9e 100644 --- a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls +++ b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls @@ -1,28 +1,73 @@ @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 + 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); +======= 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())) { + 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 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; } //鍙戣揣 @@ -38,6 +83,61 @@ insert consOrder; // create ContentVersions +<<<<<<< HEAD + 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 + ]; +======= 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) ); @@ -62,6 +162,7 @@ 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; @@ -71,12 +172,41 @@ if (String.isBlank(thisUserInfo.UserPro_Type__c)) { agencyProType = 'ET'; } +<<<<<<< HEAD + 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 = '姝e父閿�鍞�', + 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 List<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 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 = '姝e父閿�鍞�',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'; @@ -134,7 +264,11 @@ 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 = '鎵瑰噯'; @@ -176,7 +310,11 @@ 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 = '鎵瑰噯'; @@ -190,7 +328,11 @@ 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 = '鎵瑰噯'; @@ -205,10 +347,17 @@ 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 = '鑽夋涓�'; @@ -235,6 +384,16 @@ 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.Arrive_Order__c = createIdSend9.Id; + testList1.SummonsForDirction__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='宸插畬鎴�'; @@ -243,6 +402,7 @@ testList1.Order_status__c='鑽夋涓�'; testList1.Order_type__c='浼犵エ'; testList1.Dealer_info__c=accountItem1.Id; +>>>>>>> LEXCommunityLiJun testList1.ConInvoice_Code__c = createIdSend9.id; //鍒拌揣 @@ -256,12 +416,40 @@ 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, + 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 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'; @@ -301,7 +489,11 @@ 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'; @@ -319,17 +511,36 @@ 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_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 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; @@ -357,7 +568,13 @@ 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; @@ -387,7 +604,11 @@ 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; @@ -493,7 +714,11 @@ 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); @@ -502,7 +727,11 @@ 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'; @@ -538,12 +767,233 @@ 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.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); +======= LexSummonsCreatController.init(testList1.Id,'Test',1,100,testList1.Id); LexSummonsCreatController.firstInit(ESetId); @@ -575,18 +1025,68 @@ 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 + 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 + ]; +======= Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); insert accountItem1; @@ -601,6 +1101,7 @@ 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; @@ -610,10 +1111,35 @@ if (String.isBlank(thisUserInfo.UserPro_Type__c)) { agencyProType = 'ET'; } +<<<<<<< HEAD + 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 List<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 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 = '鎵瑰噯'; @@ -641,6 +1167,36 @@ 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(); + 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; + +======= insert new Consumable_order__c[]{createIdSend,createIdSend1}; Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); @@ -669,6 +1225,7 @@ 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; @@ -694,7 +1251,11 @@ 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'; @@ -711,8 +1272,12 @@ 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(); @@ -868,6 +1433,82 @@ codi.boxorpiecein = null; codi.orderdetails1 = coc; codi.Prod = pro1; +<<<<<<< HEAD + 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 + ); +======= consumable.add(codi); System.Test.startTest(); LexSummonsCreatController.save(createIdSend,'','','',pageRecords,accountId,createIdSend.Id,consumable,agencyProType,userWorkLocation); @@ -876,17 +1517,67 @@ 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 + 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 + ]; +======= Profile prof = [SELECT Id FROM Profile WHERE Name ='901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)']; accountItem1 = new Account(Name='Testaccount001',RecordTypeId = rectCo, AgentCode_Ext__c = '9999900'); insert accountItem1; @@ -901,6 +1592,7 @@ 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; @@ -910,11 +1602,39 @@ if (String.isBlank(thisUserInfo.UserPro_Type__c)) { agencyProType = 'ET'; } +<<<<<<< HEAD + 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 List<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 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 = '鎵瑰噯'; @@ -942,6 +1662,36 @@ 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(); + 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; + +======= insert new Consumable_order__c[]{createIdSend,createIdSend1}; Consumable_orderdetails__c coc = new Consumable_orderdetails__c(); @@ -970,6 +1720,7 @@ 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; @@ -1042,7 +1793,11 @@ 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'; @@ -1059,7 +1814,11 @@ 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; @@ -1166,23 +1925,128 @@ codi.boxorpiecein = null; codi.orderdetails1 = coc; codi.Prod = pro1; +<<<<<<< HEAD + 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 + ); +======= 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 + 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 + ]; +======= 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; @@ -1197,6 +2061,7 @@ 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; @@ -1206,10 +2071,35 @@ if (String.isBlank(thisUserInfo.UserPro_Type__c)) { agencyProType = 'ET'; } +<<<<<<< HEAD + 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 List<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 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'; @@ -1255,7 +2145,11 @@ 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'; @@ -1329,7 +2223,11 @@ 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'; @@ -1344,13 +2242,22 @@ 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(); @@ -1478,6 +2385,1477 @@ 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.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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 List<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 = '璨╁2搴�' + ]; + 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 List<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 List<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 List<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 = '璨╁2搴�' + ]; + 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 List<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 List<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 List<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 = '璨╁2搴�' + ]; + 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 List<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 List<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 List<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(); + } + } +} +======= LexSummonsCreatController.init(ESetId,statusEdit,1,100,arrive); LexSummonsCreatController.init(ESetId,null,1,100,arrive); LexSummonsCreatController.GoodsDelivery(createIdSend2,createIdSend2.Id,pageRecords); @@ -2403,4 +4781,5 @@ System.Test.stopTest(); } } -} \ No newline at end of file +} +>>>>>>> LEXCommunityLiJun -- Gitblit v1.9.1