| | |
| | | @isTest |
| | | private class LexConInvoiceViewControllerTest { //新建发票 以及编辑发票 invoiceId<>null |
| | | private class LexConInvoiceViewControllerTest |
| | | { //新建发票 以及编辑发票 invoiceId<>null |
| | | public static user myUser_test; |
| | | public static Account myAccount1; |
| | | public static Account hosp1; |
| | |
| | | public static Account agency2; |
| | | @testSetup |
| | | static void setupTestData() { |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | User thisUser = [ select Id from User where Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证']; |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(ET)']; |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectHos = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | List<RecordType> rectHos = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectHos.size() == 0) { |
| | | return; |
| | | } |
| | | //二级经销商SecondDealer |
| | | agency1 = new Account( |
| | | name = 'Testhosp001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id |
| | | ); |
| | | agency2 = new Account( |
| | | name = 'Testhosp002', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectCo[0].Id |
| | | ); |
| | | agency1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id); |
| | | agency2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectCo[0].Id); |
| | | //经销商 |
| | | myAccount1 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | | RecordTypeId = rectCo[0].Id |
| | | ); |
| | | myAccount1 = new Account(name='Testaccount002',Dealer_discount__c =20,RecordTypeId = rectCo[0].Id); |
| | | insert agency1; |
| | | insert agency2; |
| | | insert myAccount1; |
| | | //客户名HospitalInfo |
| | | hosp1 = new Account( |
| | | name = 'Testhosp001', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectHos[0].Id |
| | | ); |
| | | Account hosp2 = new Account( |
| | | name = 'Testhosp002', |
| | | Dealer_discount__c = 10, |
| | | RecordTypeId = rectHos[0].Id |
| | | ); |
| | | hosp1 = new Account(name='Testhosp001',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id); |
| | | Account hosp2 = new Account(name='Testhosp002',Dealer_discount__c =10,RecordTypeId = rectHos[0].Id); |
| | | insert hosp1; |
| | | |
| | | Dealer_elationship__c dealerelationship = new Dealer_elationship__c( |
| | | Dealer_principal__c = myAccount1.id, |
| | | Dealer_subordinate__c = agency1.id |
| | | ); |
| | | Dealer_elationship__c dealerelationship = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency1.id); |
| | | insert dealerelationship; |
| | | Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c( |
| | | Dealer_principal__c = myAccount1.id, |
| | | Dealer_subordinate__c = agency2.id |
| | | ); |
| | | Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(Dealer_principal__c = myAccount1.id,Dealer_subordinate__c = agency2.id); |
| | | insert dealerelationship1; |
| | | |
| | | Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c( |
| | | Hospital__c = hosp1.id, |
| | | Agency__c = myAccount1.id |
| | | ); |
| | | Agency_Hospital_Link__c agencyHospitalLink1 = new Agency_Hospital_Link__c(Hospital__c = hosp1.id,Agency__c = myAccount1.id); |
| | | insert agencyHospitalLink1; |
| | | |
| | | Contact core = new Contact( |
| | | email = 'jplumber@salesforce.com', |
| | | firstname = 'Joe', |
| | | lastname = 'Plumber', |
| | | accountid = myAccount1.id |
| | | ); |
| | | Contact core = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber',accountid=myAccount1.id); |
| | | insert core; |
| | | MyUser_Test = new User( |
| | | ContactId = core.id, |
| | | Alias = 'newUser', |
| | | Email = 'newuser@testorg.com', |
| | | EmailEncodingKey = 'UTF-8', |
| | | LastName = 'TestUser', |
| | | LanguageLocaleKey = 'zh_CN', |
| | | LocaleSidKey = 'zh_CN', |
| | | ProfileId = prof.Id, |
| | | TimeZoneSidKey = 'Asia/Shanghai', |
| | | UserName = 'testUser@testorg.com', |
| | | Work_Location__c = '重庆' |
| | | ); |
| | | MyUser_Test = New User(ContactId = core.id,Alias = 'newUser',Email='newuser@testorg.com',EmailEncodingKey='UTF-8', LastName='TestUser', LanguageLocaleKey='zh_CN',LocaleSidKey='zh_CN', ProfileId = prof.Id,TimeZoneSidKey='Asia/Shanghai', UserName='testUser@testorg.com',Work_Location__c ='重庆'); |
| | | insert MyUser_Test; |
| | | } |
| | | |
| | | |
| | | } |
| | | static testMethod void conInvoiceViewTestedit_1() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | |
| | | System.runAs(curUser) { |
| | | |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList1; |
| | | insert testList2; |
| | | System.Test.startTest(); |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | //出库单1明细1 |
| | |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3}; |
| | | |
| | | |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.saveAttachment( |
| | | JSON.serialize(LexConInvoiceViewController.attachmentRecoeds), |
| | | invoiceorder.Id |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.deleteButton(testList1.Id, testList1); |
| | | LexConInvoiceViewController.deleteButton('234567', testList1); |
| | | // LexConInvoiceViewController.saveFile(invoiceorder.Id,'Test','TmFtZSxTdW1tb25zRm9yRGlyY3Rpb25fX2MsSG9zcGl0YWxDb2RlLE9yZGVyX0Zvckhvc3BpdGFsX19jLE9yZGVyX0ZvckN1c3RvbWVyVGV4dF9fYyxPcmRlcl9Gb3JEZWFsZXJfX2MsQmFyX0NvZGVfX2MsU2hpcG1lbnRfQ291bnRfX2MsRGVsaXZlcnlfTGlzdF9STUJfX2MsQm94X1BpZWNlX19jLFVuaXRwcmljZV9Ub19hZ2VuY3lfX2MsT3V0Ym91bmRfRGF0ZV9fYyxMb3NlX3JlYXNvbl9fYw0KREItRlkyMDI0LTA2LVozMTAwMDIs55u05o6l6ZSA5ZSu57uZ5Yy76ZmiLDgxMDU2NDAs5a6955S45Lic5qGl5bq35aSN5Yy76ZmiLOa2iOWMluenkSwsMTY4NjIwMzI1NDQ2ODI1MFZWR0lVLDEsMjAwMCznm5IsMjAsMjAyMy82Lzgs5Lii5aSx5Y6f5ZugDQpEQi1GWTIwMjQtMDYtWjMxMDAwMyznm7TmjqXplIDllK7nu5nljLvpmaIsODEwNTY0MCzlrr3nlLjkuJzmoaXlurflpI3ljLvpmaIs5raI5YyW56eRLCwxNjg2MjAzMjU2MDk4MjUwUkVKT1EsMSwzMDAwLOebkiwyMCwyMDIzLzYvOCzkuKLlpLHljp%2Flm6ANCkRCLUZZMjAyNC0wNi1aMzEwMDA0LOebtOaOpemUgOWUrue7meWMu%2BmZoiw4MTA1NjQwLOWuveeUuOS4nOahpeW6t%2BWkjeWMu%2BmZoizmtojljJbnp5EsLDE2ODYyMDMyNTc2NTcyNTBHU0ZTQiwxLDQwMDAs55uSLDIwLDIwMjMvNi84LOS4ouWkseWOn%2BWboA0K'); |
| | |
| | | LexConInvoiceViewController.saveFile(invoiceorder.Id, 'Test', ''); |
| | | } catch (Exception e) { |
| | | system.debug('Test'); |
| | | |
| | | } |
| | | LexConInvoiceViewController.outbound = testList2; |
| | | LexConInvoiceViewController.getInvoiceName(); |
| | |
| | | Map<String, String> deleteMap = new Map<String, String>(); |
| | | LexConInvoiceViewController.deleteOutboundorder(deleteMap, ''); |
| | | // LexConInvoiceViewController.invoiceOrderRecoedsCount |
| | | LexConInvoiceViewController.orderby = new List<String>{ |
| | | 'Outbound_Date__c', |
| | | 'Name', |
| | | 'ShipmentAccount__c' |
| | | }; |
| | | LexConInvoiceViewController.orderby = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' }; |
| | | LexConInvoiceViewController.sortKey = 'test'; |
| | | LexConInvoiceViewController.preSortKey = 'test'; |
| | | LexConInvoiceViewController.sortOrderAsc = false; |
| | | LexConInvoiceViewController.sortOrder = new List<String>{ |
| | | 'Outbound_Date__c', |
| | | 'Name', |
| | | 'ShipmentAccount__c' |
| | | }; |
| | | LexConInvoiceViewController.sortOrder = new List<String>{ 'Outbound_Date__c', 'Name', 'ShipmentAccount__c' }; |
| | | List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>(); |
| | | List<String> chukudanID = new List<String>(); |
| | | chukudanID.add(testList2.Id); |
| | |
| | | // LexConInvoiceViewController.outOrderchange(insertDetMap); |
| | | LexConInvoiceViewController.getdefaultMapinfo(chukudanID); |
| | | |
| | | |
| | | |
| | | |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | //新建发票 invoiceId=null |
| | | |
| | | static testMethod void conInvoiceViewTestedit_2() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList1; |
| | | insert testList2; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | System.Test.startTest(); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | |
| | | |
| | | // LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | //新建发票 invoiceId=null error check |
| | | |
| | | static testMethod void conInvoiceViewTestedit_3() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | insert new Product2__c[] {pro1}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList1; |
| | | insert testList2; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?invoiceId=' + |
| | | invoiceorder.Id + |
| | | '&KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | System.Test.startTest(); |
| | |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | |
| | | |
| | | |
| | | // LexConInvoiceViewController.init(); |
| | | |
| | |
| | | System.debug('===>hosp1.id' + hosp1.id); |
| | | LexConInvoiceViewController.invoiceId = null; |
| | | System.Test.stopTest(); |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | //新建发票 以及编辑发票invoiceId== NULL and deliveryId== NULL |
| | | static testMethod void conInvoiceViewTestinit() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | |
| | | System.runAs(curUser) { |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='草案中',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | //insert new Consumable_order__c[]{testList1,testList2}; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable2', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable2; |
| | | //出库单1明细1 |
| | | Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Shipment_Count__c = 1; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4}; |
| | | //附件 |
| | | Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c(); |
| | | caic.Attachment_ID__c = acc.Id; |
| | | caic.Accessories_type__c = '发票和明细'; |
| | | caic.Invoice_code__c = invoiceorder.id; |
| | | insert caic; |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | |
| | | //新建发票 以及编辑发票invoiceId== NULL and deliveryId<> NULL |
| | | static testMethod void conInvoiceViewTestinit_1() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='草案中',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | //insert new Consumable_order__c[]{testList1,testList2}; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable2', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable2; |
| | | //出库单1明细1 |
| | | Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Shipment_Count__c = 1; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4}; |
| | | //附件 |
| | | Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c(); |
| | | caic.Attachment_ID__c = acc.Id; |
| | | caic.Accessories_type__c = '发票和明细'; |
| | | caic.Invoice_code__c = invoiceorder.id; |
| | | insert caic; |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?invoiceId=' + invoiceorder.id |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.id); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | |
| | | // contest.deliveryId=testList1.id; |
| | | System.Test.startTest(); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | //新建发票 以及编辑发票invoiceId<> NULL |
| | | static testMethod void conInvoiceViewTestinit_2() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='草案中',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | //insert new Consumable_order__c[]{testList1,testList2}; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable2', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable2; |
| | | //出库单1明细1 |
| | | Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Shipment_Count__c = 1; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4}; |
| | | //附件 |
| | | Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c(); |
| | | caic.Attachment_ID__c = acc.Id; |
| | |
| | | // contest.deliveryId=testList1.id; |
| | | // conTest.invoiceId =invoiceorder.Id; |
| | | System.Test.startTest(); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | |
| | | |
| | | |
| | | |
| | | // conTest.init(); |
| | | |
| | |
| | | |
| | | // conTest.SortLimited(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | static testMethod void conInvoiceViewTestoutOrderchange() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList1; |
| | | insert testList2; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | //出库单1明细1 |
| | |
| | | orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet2.Consumable_count__c = 1; |
| | | orderdet2.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2}; |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | | static testMethod void conInvoiceViewTestgetdefaultMapinfo() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList1; |
| | | insert testList2; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | //出库单1明细1 |
| | |
| | | orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet2.Consumable_count__c = 1; |
| | | orderdet2.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2}; |
| | | |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?invoiceId=' + |
| | | invoiceorder.Id + |
| | | '&KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | |
| | | //从出库单直接开票 |
| | | static testMethod void conInvoiceViewRedirectTest() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='草案中',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | testList1.Order_date__c = Date.today().addDays(2); |
| | | testList2.Order_date__c = Date.today().addDays(2); |
| | | testList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | //insert new Consumable_order__c[]{testList1,testList2}; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable2', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable2; |
| | | //出库单1明细1 |
| | | Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Shipment_Count__c = 1; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4}; |
| | | //附件 |
| | | Consumable_accessories_invoice__c caic = new Consumable_accessories_invoice__c(); |
| | | caic.Attachment_ID__c = acc.Id; |
| | | caic.Accessories_type__c = '发票和明细'; |
| | | caic.Invoice_code__c = invoiceorder.id; |
| | | insert caic; |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?deliveryId=' + testList1.Id + '&KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?deliveryId='+testList1.Id+'&KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | |
| | | System.Test.startTest(); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.saveAttachment( |
| | | JSON.serialize(LexConInvoiceViewController.attachmentRecoeds), |
| | | invoiceorder.Id |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id); |
| | | // LexConInvoiceViewController.saveAttachment(JSON.serialize(caic),invoiceorder.Id); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //提交 |
| | | static testMethod void conInvoiceViewTestapproval() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false, |
| | | Packing_list_manual__c = 5 |
| | | ); |
| | | Product2 prod02 = new Product2( |
| | | Name = 'Test02', |
| | | ProductCode = 'Test02', |
| | | Asset_Model_No__c = 'Test02', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false,Packing_list_manual__c = 5); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',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 = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | invoiceorder.Dealer_Info__c = acc.Id; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | //Consumable_order__c testList1 = new Consumable_order__c(Name='Test1',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='草案中',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | //Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货',SummonsStatus_c__c='已完成',Order_ForHospital__c =hosp1.Id,SummonsForDirction__c='直接销售给医院',Order_status__c='已提交',Order_type__c='传票',Order_ForDealer__c = agency1.Id, Dealer_info__c=myAccount1.Id,ConInvoice_Code__c = invoiceorder.id); |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Consumable_order__c testList1 = new Consumable_order__c(Name='Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | RecordTypeId = System.Label.RT_ConOrder_Sale, |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | RecordTypeId = System.Label.RT_ConOrder_Sale, |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | testList1.Order_date__c = Date.today().addDays(2); |
| | | testList2.Order_date__c = Date.today().addDays(2); |
| | | testList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | //insert new Consumable_order__c[]{testList1,testList2}; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable2', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable2',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable2; |
| | | //出库单1明细1 |
| | | Consumable_Orderdetails__c orderdet1 = new Consumable_Orderdetails__c(); |
| | |
| | | // orderdet1.Shipment_Count__c = 50; |
| | | // orderdet1.Invoiced_Procount__c = 5; |
| | | // orderdet1.RrturnPro_count__c = 5; |
| | | |
| | | |
| | | |
| | | |
| | | Consumable_Orderdetails__c orderdet12 = new Consumable_Orderdetails__c(); |
| | | orderdet12.Name = 'Test1_001001'; |
| | |
| | | orderdet4.Consumable_count__c = 1; |
| | | orderdet4.Shipment_Count__c = 1; |
| | | orderdet4.Consumable_product__c = pro2.Id; |
| | | insert new List<Consumable_Orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3, |
| | | orderdet4, |
| | | orderdet12 |
| | | }; |
| | | insert new Consumable_Orderdetails__c[]{orderdet1,orderdet2,orderdet3,orderdet4,orderdet12}; |
| | | |
| | | List<String> conorList = new List<String>(); |
| | | conorList.add(testList1.Id); |
| | |
| | | Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>(); |
| | | for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) { |
| | | if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) { |
| | | tempCocMap.put( |
| | | cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, |
| | | cocTemp |
| | | ); |
| | | tempCocMap.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp); |
| | | } |
| | | } |
| | | for (Consumable_Orderdetails__c cocTemp : outOrderdet1List1) { |
| | | if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) { |
| | | tempCocMap1.put( |
| | | cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, |
| | | cocTemp |
| | | ); |
| | | tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp); |
| | | } |
| | | } |
| | | |
| | |
| | | caic.Invoice_code__c = invoiceorder.id; |
| | | insert caic; |
| | | |
| | | |
| | | System.Test.startTest(); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.approval( |
| | | conorList, |
| | | tempCocMap, |
| | | invoiceorder.id |
| | | ); |
| | | LexConInvoiceViewController.approval( |
| | | conorList, |
| | | tempCocMap1, |
| | | invoiceorder.id |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.approval(conorList,tempCocMap,invoiceorder.id); |
| | | LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id); |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | |
| | | //提交发票 |
| | | static testMethod void conInvoice_approval() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Oly_TriggerHandler.bypass('ConsumableAssetHander'); |
| | | Oly_TriggerHandler.bypass('Oly_TriggerHandler'); |
| | | System.runAs(curUser) { |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | |
| | | //出库单1 |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | // Order_ForHospital__c=hosp1.Id, |
| | | Dealer_Info__c = acc.Id |
| | | ); |
| | | Dealer_Info__c = acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | | insert testList1; |
| | |
| | | invoicedet1.Invoicedet1_OD_link__c = testList1.Id; |
| | | insert invoicedet1; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | List<Consumable_Orderdetails__c> outOrderdet1List = [ |
| | | SELECT |
| | |
| | | Map<String, Consumable_Orderdetails__c> tempCocMap1 = new Map<String, Consumable_Orderdetails__c>(); |
| | | for (Consumable_Orderdetails__c cocTemp : outOrderdet1List) { |
| | | if (cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c != null) { |
| | | tempCocMap1.put( |
| | | cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, |
| | | cocTemp |
| | | ); |
| | | tempCocMap1.put(cocTemp.Consumable_order__c + cocTemp.Asset_Model_No__c, cocTemp); |
| | | } |
| | | } |
| | | |
| | | |
| | | System.Test.startTest(); |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | orderdet1.Id |
| | | ); |
| | | |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',orderdet1.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = acc.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | acc.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | acc.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.approval( |
| | | conorList, |
| | | tempCocMap1, |
| | | invoiceorder.id |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,acc.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,acc.id,invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.approval(conorList,tempCocMap1,invoiceorder.id); |
| | | LexConInvoiceViewController.approval(conorList, tempCocMap1, '2345678'); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // conTest.init(); |
| | | |
| | | // System.assertEquals(1, conTest.invoiceOrderRecoeds.size()); |
| | | // conTest.approval(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | //新建发票 以及编辑发票 invoiceId<>null |
| | | static testMethod void rentestreopen() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList3 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList3.Order_date__c = Date.today().addDays(2); |
| | |
| | | insert testList2; |
| | | insert testList3; |
| | | System.Test.startTest(); |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList3.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | insert order_LinkTable2; |
| | | insert order_LinkTable3; |
| | |
| | | orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet2.Consumable_count__c = 1; |
| | | orderdet2.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2}; |
| | | |
| | | //出库单2明细1 |
| | | Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_product__c = pro1.Id; |
| | | insert orderdet4; |
| | | |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?invoiceId=' + |
| | | invoiceorder.Id + |
| | | '&reopen=isreopen&KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | |
| | | |
| | | |
| | | |
| | | // ConInvoiceViewController conTest = new ConInvoiceViewController(); |
| | | |
| | |
| | | // conTest.coc.Order_ForHospital__c = hosp1.id; |
| | | // conTest.coc.Invoice_Date__c = Date.today(); |
| | | |
| | | |
| | | // //conTest.SortLimited(); |
| | | // //conTest.InvoiceorderSearch(); |
| | | // System.assertEquals(3, conTest.invoiceOrderRecoeds.size()); |
| | |
| | | // conTest.invoiceOrderRecoeds[1].esd.Order_ForCustomerText__c = 'AA'; |
| | | // conTest.invoiceOrderRecoeds[1].esd.Order_ForHospital__c =hosp1.Id; |
| | | // conTest.invoiceOrderRecoeds[1].esd.Order_ForDealer__c = agency1.id; |
| | | |
| | | |
| | | // conTest.invoiceOrderRecoeds[2].esd.Order_ForCustomerText__c = 'AA'; |
| | | // conTest.invoiceOrderRecoeds[2].esd.Order_ForHospital__c =hosp1.Id; |
| | |
| | | // conTest.getExistOutbound(); |
| | | // conTest.getInvoiceName(); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | //新建发票 以及编辑发票 invoiceId<>null |
| | | static testMethod void rentestreopen001() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList3 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Consumable_order__c testList3 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList3.Order_date__c = Date.today().addDays(2); |
| | |
| | | insert testList2; |
| | | insert testList3; |
| | | System.Test.startTest(); |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList2.Id, |
| | | Invoice_Code_link__c = invoiceorder.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList3.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | Consumable_order_LinkTable__c order_LinkTable2 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList2.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | Consumable_order_LinkTable__c order_LinkTable3 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c = testList3.Id,Invoice_Code_link__c =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | insert order_LinkTable2; |
| | | insert order_LinkTable3; |
| | |
| | | orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet2.Consumable_count__c = 1; |
| | | orderdet2.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ orderdet1, orderdet2 }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2}; |
| | | |
| | | //出库单2明细1 |
| | | Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c(); |
| | |
| | | orderdet4.Consumable_product__c = pro1.Id; |
| | | insert orderdet4; |
| | | |
| | | PageReference page = new PageReference( |
| | | '/apex/ConInvoiceView?invoiceId=' + |
| | | invoiceorder.Id + |
| | | '&reopen=isreopen&KeyWords=Redirect' |
| | | ); |
| | | PageReference page = new PageReference('/apex/ConInvoiceView?invoiceId='+invoiceorder.Id+'&reopen=isreopen&KeyWords=Redirect'); |
| | | page.setRedirect(true); |
| | | System.Test.setCurrentPage(page); |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.id,'Redirect',testList2.Id); |
| | | LexConInvoiceViewController conTest = new LexConInvoiceViewController(); |
| | | LexConInvoiceViewController.HospitalInfo = hosp1.id; |
| | | LexConInvoiceViewController.SecondDealer = agency1.id; |
| | | LexConInvoiceViewController.invoiceId = invoiceorder.Id; |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', testList1.Id); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '济宁任城儒济医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.InvoiceorderSearch( |
| | | testList1, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | '重庆', |
| | | 'ET', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'济宁任城儒济医院',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.InvoiceorderSearch(testList1,invoiceorder.Id,acc.Id,'重庆','ET',hosp1.id,agency1.id,invoiceOrderRecoeds); |
| | | System.Test.stopTest(); |
| | | |
| | | } |
| | | } |
| | | //新建发票 以及编辑发票 invoiceId<>null |
| | | static testMethod void allinit() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //准备数据 |
| | | // Consumable_order__c Id = deliveryId //出库单 |
| | | // Consumable_order__c |
| | | // WHERE Id = :invoiceId AND Order_type__c = '发票' |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | invoiceorder = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :invoiceorder.id |
| | | ]; |
| | | invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | //出库单 |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test2', |
| | | Summons_Sale_Status__c = '出货', |
| | | SummonsStatus_c__c = '已完成', |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '已提交', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Order_ForCustomerText__c = '' |
| | | ); |
| | | Consumable_order__c testList2 = new Consumable_order__c(Name='Test2',Summons_Sale_Status__c='出货', |
| | | SummonsStatus_c__c='已完成',SummonsForDirction__c='直接销售给医院', |
| | | Order_status__c='已提交',Order_type__c='传票', |
| | | Dealer_info__c=acc.Id,Order_ForCustomerText__c = ''); |
| | | TestList1.Order_date__c = Date.today().addDays(2); |
| | | TestList2.Order_date__c = Date.today().addDays(2); |
| | | TestList1.Deliver_date__c = Date.today(); |
| | |
| | | insert testList2; |
| | | insert testList3; |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder.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 =invoiceorder.Id); |
| | | insert order_LinkTable1; |
| | | |
| | | //出库单1明细1 |
| | |
| | | orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice; |
| | | orderdet3.Consumable_count__c = 1; |
| | | orderdet3.Consumable_product__c = pro1.Id; |
| | | insert new List<Consumable_orderdetails__c>{ |
| | | orderdet1, |
| | | orderdet2, |
| | | orderdet3 |
| | | }; |
| | | insert new Consumable_orderdetails__c[]{orderdet1,orderdet2,orderdet3}; |
| | | |
| | | //发票附件 |
| | | Consumable_accessories_invoice__c cai = new Consumable_accessories_invoice__c(); |
| | |
| | | LexConInvoiceViewController.init('', '', testList1.Id); |
| | | LexConInvoiceViewController.init(invoiceorder.Id, '', ''); |
| | | LexConInvoiceViewController.init('', '', ''); |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList1.Id |
| | | ); |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.init('', 'Redirect', ''); |
| | | LexConInvoiceViewController.init('', 'Redirect', testList1.Id); |
| | | System.debug( |
| | | 'order==>' + LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | System.debug('order==>'+LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList2, |
| | | 'Testhosp001', |
| | | '', |
| | | '', |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList3, |
| | | 'Testhosp001', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList2, |
| | | 'Testhosp001', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList2,'Testhosp001','','',invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList3,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList2,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | |
| | | //保存 |
| | | // LexConInvoiceViewController.save(testList1,'测试医院',hosp1.Id,agency1.Id,'',testList1.Id,invoiceorder.Id,myAccount1.Id,'ET'); |
| | |
| | | } |
| | | static testMethod void allsave() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | // LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList1.Id); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | null, |
| | | null, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.saveAttachment( |
| | | JSON.serialize(LexConInvoiceViewController.attachmentRecoeds), |
| | | invoiceorder.Id |
| | | ); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001',null,null,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.saveAttachment(JSON.serialize(LexConInvoiceViewController.attachmentRecoeds),invoiceorder.Id); |
| | | } |
| | | } |
| | | static testMethod void allsave1() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | //invoiceorder.Order_ProType__c = 'ET'; |
| | | insert invoiceorder; |
| | | |
| | | |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | | Summons_Sale_Status__c = '出货', |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today(), |
| | | Order_ForCustomerText__c = '消化科' |
| | | ); |
| | | Invoice_Date__c = Date.today(),Order_ForCustomerText__c = '消化科'); |
| | | insert testList1; |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today(), |
| | | Order_ForDealerText__c = 'Test' |
| | | ); |
| | | Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test'); |
| | | insert testList2; |
| | | |
| | | LexConInvoiceViewController.init( |
| | | invoiceorder.Id, |
| | | 'Redirect', |
| | | testList2.Id |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoeds = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ); |
| | | |
| | | LexConInvoiceViewController.init(invoiceorder.Id,'Redirect',testList2.Id); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | String invoiceOrderRecoeds = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoeds); |
| | | List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>(); |
| | | for ( |
| | | LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ) { |
| | | for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){ |
| | | ass.check = true; |
| | | test1.add(ass); |
| | | } |
| | | System.debug('test1==>' + test1); |
| | | System.debug( |
| | | 'invoiceOrderRecoedschangeLwc==>' + invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | hosp1.id, |
| | | agency1.id, |
| | | invoiceOrderRecoeds, |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | '', |
| | | '', |
| | | JSON.serialize(test1), |
| | | testList1.Id, |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | 'Testhosp001', |
| | | '', |
| | | '', |
| | | JSON.serialize(test1), |
| | | '', |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '青岛盈海医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]', |
| | | '', |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | testList1, |
| | | '青岛盈海医院', |
| | | hosp1.id, |
| | | agency1.id, |
| | | '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]', |
| | | '', |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | System.debug('invoiceOrderRecoedschangeLwc==>'+invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001',hosp1.id,agency1.id,invoiceOrderRecoeds,testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),testList1.Id,invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'Testhosp001','','',JSON.serialize(test1),'',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'青岛盈海医院',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(testList1,'青岛盈海医院',hosp1.id,agency1.id,'[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | static testMethod void allsave2() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = 'invoice01'; |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today(), |
| | | Order_ForDealerText__c = 'Test' |
| | | ); |
| | | Invoice_Date__c = Date.today(),Order_ForDealerText__c = 'Test'); |
| | | insert testList2; |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | insert testList1; |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | //选择开票单 |
| | | LexConInvoiceViewController.save( |
| | | testList2, |
| | | '青岛盈海医院', |
| | | '', |
| | | agency2.id, |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]', |
| | | '', |
| | | invoiceorder.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save(testList2,'青岛盈海医院','',agency2.id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder.Id,acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | static testMethod void allsave3() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',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 = '有効',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 = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | insert testList2; |
| | | |
| | | List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>(); |
| | |
| | | orderdet1.RrturnPro_count__c = 2; |
| | | conList.add(orderdet1); |
| | | |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder, |
| | | '潍城现代门诊部', |
| | | '0011000001g0uyhAAA', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]', |
| | | '', |
| | | '', |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder, |
| | | '潍城现代门诊部', |
| | | '0011000001g0uyhAAA', |
| | | agency1.Id, |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]', |
| | | testList2.Id, |
| | | '', |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]','','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | |
| | | List<LexConInvoiceViewController.InvoiceOrderInfo> test1 = new List<LexConInvoiceViewController.InvoiceOrderInfo>(); |
| | | for ( |
| | | LexConInvoiceViewController.InvoiceOrderInfo ass : LexConInvoiceViewController.invoiceOrderRecoeds |
| | | ) { |
| | | for(LexConInvoiceViewController.InvoiceOrderInfo ass:LexConInvoiceViewController.invoiceOrderRecoeds){ |
| | | ass.check = true; |
| | | test1.add(ass); |
| | | } |
| | | System.debug('test1==>' + test1); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder, |
| | | '潍城现代门诊部', |
| | | '0011000001g0uyhAAA', |
| | | '', |
| | | JSON.serialize(test1), |
| | | '', |
| | | '', |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','0011000001g0uyhAAA','',JSON.serialize(test1),'','',acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | static testMethod void allsave4() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | Account hosp1 = [SELECT Id FROM Account WHERE name = 'Testhosp001' LIMIT 1]; |
| | | Account agency1 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp001' |
| | | LIMIT 1 |
| | | ]; |
| | | Account agency2 = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testhosp002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account agency1 = [SELECT Id FROM Account WHERE name='Testhosp001' LIMIT 1]; |
| | | Account agency2 = [SELECT Id FROM Account WHERE name='Testhosp002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | | invoiceorder.Name = '202306164590'; |
| | |
| | | // invoiceorder.Order_ForHospital__c = hosp1.Id; |
| | | insert invoiceorder1; |
| | | |
| | | |
| | | |
| | | // invoiceorder = [select id,Name from Consumable_order__c where id =:invoiceorder.id]; |
| | | Consumable_order__c testList2 = new Consumable_order__c( |
| | | Name = 'Test1', |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | |
| | | insert testList2; |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | //不需要输入科室 |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '', |
| | | agency1.Id, |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]', |
| | | testList2.Id, |
| | | '', |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','',agency1.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": true,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,'',acc.Id,'ET','',invoiceOrderRecoedschangeLwc); |
| | | |
| | | |
| | | |
| | | |
| | | //LexConInvoiceViewController.save(invoiceorder,'潍城现代门诊部','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc); |
| | | // LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','',agency2.Id,'[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}, {"check": false,"esd": {"Id": "a2K0l000000xAnwEAE","Order_ForHospital__c": "0011000001g0uyhAAA","Name": "a2K0l000000xAnw","Outbound_Date__c": "2023-05-12","ShipmentAccount__c": "潍城现代门诊部", "Shipment_total_amount__c": 2300,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 2300,"InvoiceNotPro_money__c": 2300,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "潍城现代门诊部","Id": "0011000001g0uyhAAA"} }, "needInvoiceCount": 0,"oldCheck": false, "Id": "a2K0l000000xAnwEAE"}]',testList2.Id,invoiceorder1.Id,myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc); |
| | | |
| | | } |
| | | } |
| | | |
| | | static testMethod void allsave5() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | orderList.add(testList2); |
| | | //出库单 |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | orderList.add(testList1); |
| | | insert orderList; |
| | | List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>(); |
| | |
| | | orderdet1.RrturnPro_count__c = 2; |
| | | conList.add(orderdet1); |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = testList1.Id, |
| | | Invoice_Code_link__c = invoiceorder1.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 =invoiceorder1.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c(); |
| | | upDateform.Name = 'Test1_001001'; |
| | |
| | | upDateform.Consumable_order__c = order_LinkTable1.Outboundorder_Code_link__c; |
| | | conList.add(upDateform); |
| | | insert conList; |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '0011000001k1K9ZAAU', |
| | | '', |
| | | '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]', |
| | | testList1.Id, |
| | | invoiceorder1.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | 'isreopen', |
| | | invoiceOrderRecoedschangeLwc |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc); |
| | | // LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,'',myAccount1.Id,'ET','isreopen',invoiceOrderRecoedschangeLwc); |
| | | } |
| | | } |
| | | |
| | | static testMethod void allsave6() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | orderList.add(testList2); |
| | | //出库单 |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | orderList.add(testList1); |
| | | insert orderList; |
| | | List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>(); |
| | |
| | | orderdet1.Consumable_product__c = pro1.Id; |
| | | conList.add(orderdet1); |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = invoiceorder1.Id, |
| | | Invoice_Code_link__c = invoiceorder1.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c(); |
| | | upDateform.Name = 'Test1_001001'; |
| | |
| | | upDateform.RrturnPro_count__c = 10; |
| | | conList.add(upDateform); |
| | | insert conList; |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '0011000001k1K9ZAAU', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]', |
| | | testList1.Id, |
| | | invoiceorder1.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]' |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '0011000001k1K9ZAAU', |
| | | '', |
| | | '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]', |
| | | '', |
| | | invoiceorder1.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]' |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '0011000001k1K9ZAAU', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]', |
| | | '', |
| | | invoiceorder1.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]' |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]',testList1.Id,invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'); |
| | | } |
| | | } |
| | | |
| | | static testMethod void allsave7() { |
| | | user curUser = [SELECT Id FROM User WHERE LastName = 'TestUser' LIMIT 1]; |
| | | Account acc = [ |
| | | SELECT Id |
| | | FROM Account |
| | | WHERE name = 'Testaccount002' |
| | | LIMIT 1 |
| | | ]; |
| | | System.runAs(curUser) { |
| | | Account acc = [SELECT Id FROM Account WHERE name='Testaccount002' LIMIT 1]; |
| | | system.runAs(curUser){ |
| | | //产品信息 |
| | | Product2 prod01 = new Product2( |
| | | Name = 'Test01', |
| | | ProductCode = 'Test01', |
| | | Asset_Model_No__c = 'Test01', |
| | | SFDA_Status__c = '有効', |
| | | 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 = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Manual_Entry__c = false |
| | | ); |
| | | insert new List<Product2>{ prod01, prod02 }; |
| | | Product2 prod01 = new Product2(Name='Test01',ProductCode='Test01',Asset_Model_No__c = 'Test01',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | Product2 prod02 = new Product2(Name='Test02',ProductCode='Test02',Asset_Model_No__c = 'Test02',SFDA_Status__c = '有効',Dealer_special_Object__c = true,Manual_Entry__c = false); |
| | | insert new Product2[] {prod01, prod02}; |
| | | |
| | | Product2__c pro1 = new Product2__c( |
| | | Name = 'Pro001', |
| | | OT_CODE_Text__c = 'Test001', |
| | | Product2__c = prod01.Id |
| | | ); |
| | | Product2__c pro2 = new Product2__c( |
| | | Name = 'Pro002', |
| | | OT_CODE_Text__c = 'Test002', |
| | | Product2__c = prod02.Id |
| | | ); |
| | | insert new List<Product2__c>{ pro1, pro2 }; |
| | | Product2__c pro1 = new Product2__c(Name='Pro001',OT_CODE_Text__c='Test001',Product2__c = prod01.Id); |
| | | Product2__c pro2 = new Product2__c(Name='Pro002',OT_CODE_Text__c='Test002',Product2__c = prod02.Id); |
| | | insert new Product2__c[] {pro1, pro2}; |
| | | List<Consumable_order__c> orderList = new List<Consumable_order__c>(); |
| | | //发票信息 |
| | | Consumable_order__c invoiceorder = new Consumable_order__c(); |
| | |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id, |
| | | Invoice_Date__c = Date.today() |
| | | ); |
| | | Invoice_Date__c = Date.today()); |
| | | orderList.add(testList2); |
| | | //出库单 |
| | | Consumable_order__c testList1 = new Consumable_order__c( |
| | |
| | | SummonsForDirction__c = '直接销售给医院', |
| | | Order_status__c = '草案中', |
| | | Order_type__c = '传票', |
| | | Dealer_info__c = acc.Id |
| | | ); |
| | | Dealer_info__c=acc.Id); |
| | | orderList.add(testList1); |
| | | insert orderList; |
| | | List<Consumable_orderdetails__c> conList = new List<Consumable_orderdetails__c>(); |
| | |
| | | orderdet1.Consumable_product__c = pro1.Id; |
| | | conList.add(orderdet1); |
| | | |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c( |
| | | Name = 'order_LinkTable1', |
| | | Outboundorder_Code_link__c = invoiceorder1.Id, |
| | | Invoice_Code_link__c = invoiceorder1.Id |
| | | ); |
| | | Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(Name='order_LinkTable1',Outboundorder_Code_link__c =invoiceorder1.Id,Invoice_Code_link__c =invoiceorder1.Id); |
| | | insert order_LinkTable1; |
| | | Consumable_Orderdetails__c upDateform = new Consumable_Orderdetails__c(); |
| | | upDateform.Name = 'Test1_001001'; |
| | |
| | | upDateform.RrturnPro_count__c = 10; |
| | | conList.add(upDateform); |
| | | insert conList; |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize( |
| | | LexConInvoiceViewController.invoiceOrderRecoedschange |
| | | ); |
| | | LexConInvoiceViewController.save( |
| | | invoiceorder1, |
| | | '潍城现代门诊部', |
| | | '0011000001k1K9ZAAU', |
| | | '', |
| | | '[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]', |
| | | '', |
| | | invoiceorder1.Id, |
| | | acc.Id, |
| | | 'ET', |
| | | '', |
| | | '[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]' |
| | | ); |
| | | String invoiceOrderRecoedschangeLwc = JSON.serialize(LexConInvoiceViewController.invoiceOrderRecoedschange); |
| | | LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": true,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"},{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848,"Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false}]','',invoiceorder1.Id,acc.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'); |
| | | // LexConInvoiceViewController.save(invoiceorder1,'潍城现代门诊部','0011000001k1K9ZAAU','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]','',invoiceorder1.Id,myAccount1.Id,'ET','','[{"check": false,"esd": {"Id": "a2K0l000000x1KXEAY","Order_ForHospital__c": "0011000001k1K9ZAAU","Name": "DB-FY2024-04-Z316244","Outbound_Date__c": "2023-06-09","ShipmentAccount__c": "青岛盈海医院","Shipment_total_amount__c": 848,"RrturnPro_total_amount__c": 0,"Total_Invoiced_Procount__c": 0,"InvoiceNotPro_total_amount__c": 848,"InvoiceNotPro_money__c": 848, "Invoice_total_amount__c": 0,"Billed_Status__c": "还没开票","Order_ForHospital__r": {"Name": "青岛盈海医院","Id": "0011000001k1K9ZAAU"}},"needInvoiceCount": 0,"oldCheck": false,"Id": "a2K0l000000x1KXEAY"}]'); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |