From af7b716a60d889acea95560abba0e46eee008b8f Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期三, 05 七月 2023 13:54:50 +0800
Subject: [PATCH] backup0705
---
force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls | 776 ++++++++++++++--------------------------------------------
1 files changed, 192 insertions(+), 584 deletions(-)
diff --git a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
index 2e96f53..1ece459 100644
--- a/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
+++ b/force-app/main/default/classes/LexConInvoicedetailsControllerTest.cls
@@ -1,422 +1,10 @@
@isTest
private class LexConInvoicedetailsControllerTest {
@isTest
- static void itShould() {
- user myUser_test;
- Account myAccount1;
- Account myAccount2;
- Product2__c pro2;
- Product2__c pro1;
- Product2 prod01;
- Product2 prod02;
- User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
- System.runAs(thisUser) {
- Profile prof = [
- SELECT Id
- FROM Profile
- WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
- ];
- List<RecordType> rectCo = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
- ];
- if (rectCo.size() == 0) {
- return;
- }
- List<RecordType> rectHos = [
- SELECT Id
- FROM RecordType
- WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
- ];
- if (rectHos.size() == 0) {
- return;
- }
- //浜у搧淇℃伅
- prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 2,
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test06',
- ProductCode = 'Test06',
- Asset_Model_No__c = 'Test06',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{
- prod01,
- prod02,
- prod03,
- prod04,
- prod05,
- prod06
- };
-
- pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod04.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod05.Id
- );
- Product2__c pro6 = new Product2__c(
- Name = 'Pro006',
- OT_CODE_Text__c = 'Test006',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
-
- myAccount1 = new Account(
- name = 'testaccount001',
- Dealer_discount__c = 10,
- RecordTypeId = rectCo[0].Id
- );
- myAccount2 = new Account(
- name = 'testaccount002',
- Dealer_discount__c = 20,
- RecordTypeId = rectHos[0].Id
- );
- insert myAccount1;
- insert myAccount2;
- 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'
- );
- insert myUser_test;
- }
- System.runAs(myUser_test) {
- //鍙戠エ淇℃伅
- Consumable_order__c invoiceorder = new Consumable_order__c(
- Name = 'invoice01',
- Order_type__c = '鍙戠エ',
- Invoice_status__c = '宸插畬鎴�',
- Invoice_Date__c = Date.today(),
- RecordTypeid = System.Label.RT_ConOrder_Invoice,
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Dealer_info__c = myAccount1.Id
- );
- insert invoiceorder;
-
- //鍑哄簱鍗�
- Consumable_order__c testList1 = new Consumable_order__c(
- Name = 'Test1',
- Summons_Sale_Status__c = '鍑鸿揣',
- SummonsStatus_c__c = '宸插畬鎴�',
- Order_ForHospital__c = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '鑽夋涓�',
- Order_type__c = '浼犵エ',
- 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 = myAccount2.Id,
- SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
- Order_status__c = '宸叉彁浜�',
- Order_type__c = '浼犵エ',
- Dealer_info__c = myAccount1.Id,
- ConInvoice_Code__c = invoiceorder.id
- );
- TestList1.Order_date__c = Date.today().addDays(2);
- TestList2.Order_date__c = Date.today().addDays(2);
- TestList1.Order_date__c = Date.today();
- TestList2.Deliver_date__c = Date.today();
- insert new List<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
- );
- 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
- );
- insert order_LinkTable2;
-
- //鍙戠エ鏄庣粏1
- Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
- invoicedet1.Name = 'invoicetest1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- invoicedet1.Consumable_order__c = invoiceorder.id;
- invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet1.Consumable_count__c = 1;
- invoicedet1.Consumable_product__c = pro1.Id;
- invoicedet1.Invoicedet1_OD_link__c = testList1.Id;
- invoicedet1.Box_Piece__c = '鐩�';
- invoicedet1.Shipment_Count__c = 1;
- invoicedet1.Invoice_Unitprice__c = 1;
- invoicedet1.Delivery_List_RMB__c = 1;
- invoicedet1.InvoicedProCost_RMB__c = 1;
- invoicedet1.Invoice_Unit__c = '涓�';
- invoicedet1.Invoiced_Procount__c = 3;
- invoicedet1.RrturnPro_count__c = 3;
- Consumable_orderdetails__c invoicedet2 = new Consumable_orderdetails__c();
- invoicedet2.Name = 'invoiceTest1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- invoicedet2.Consumable_order__c = invoiceorder.Id;
- invoicedet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet2.Consumable_count__c = 1;
- invoicedet2.Consumable_product__c = pro2.Id;
- invoicedet2.Invoicedet1_OD_link__c = testList2.Id;
- invoicedet2.Box_Piece__c = '鐩�';
- invoicedet2.Shipment_Count__c = 1;
- invoicedet2.Invoice_Unitprice__c = 1;
- invoicedet2.Delivery_List_RMB__c = 1;
- invoicedet2.InvoicedProCost_RMB__c = 1;
- invoicedet2.Invoice_Unit__c = '涓�';
- invoicedet2.Invoiced_Procount__c = 3;
- invoicedet2.RrturnPro_count__c = 3;
- Consumable_orderdetails__c invoicedet3 = new Consumable_orderdetails__c();
- invoicedet3.Name = 'invoiceTest1_001003';
- //orderdet2.Consumable_principal__c = testList2.Id;
- invoicedet3.Consumable_order__c = invoiceorder.Id;
- invoicedet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- invoicedet3.Consumable_count__c = 1;
- invoicedet3.Consumable_product__c = pro2.Id;
- invoicedet3.Invoicedet1_OD_link__c = testList2.Id;
- invoicedet3.Box_Piece__c = '涓�';
- invoicedet3.Shipment_Count__c = 1;
- invoicedet3.Invoice_Unit__c = '鐩�';
- invoicedet3.Delivery_List_RMB__c = 2.0;
- invoicedet3.Invoice_Unitprice__c = 1;
- invoicedet3.InvoicedProCost_RMB__c = 1;
- invoicedet3.Invoiced_Procount__c = 3;
- invoicedet3.RrturnPro_count__c = 3;
- insert new List<Consumable_orderdetails__c>{
- invoicedet1,
- invoicedet2,
- invoicedet3
- };
-
- //鍑哄簱鍗曟槑缁�1
- Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro1.Id;
- orderdet1.Box_Piece__c = '鐩�';
- orderdet1.Shipment_Count__c = 11;
- orderdet1.Delivery_List_RMB__c = 2.0;
- orderdet1.Invoice_Unitprice__c = 1;
- orderdet1.InvoicedProCost_RMB__c = 1;
- orderdet1.Invoiced_Procount__c = 3;
- orderdet1.RrturnPro_count__c = 3;
- orderdet1.Invoice_Unit__c = '涓�';
- orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_0010011';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro2.Id;
- orderdet1.Box_Piece__c = '涓�';
- orderdet1.Shipment_Count__c = 11;
- orderdet1.Delivery_List_RMB__c = 2.0;
- orderdet1.Invoice_Unitprice__c = 1;
- orderdet1.InvoicedProCost_RMB__c = 1;
- orderdet1.Invoiced_Procount__c = 3;
- orderdet1.RrturnPro_count__c = 3;
- orderdet1.Invoice_Unit__c = '鐩�';
- Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_0010012';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro2.Id;
- orderdet2.Box_Piece__c = '鐩�';
- orderdet2.Shipment_Count__c = 10;
- orderdet2.Delivery_List_RMB__c = 2.0;
- orderdet2.Invoice_Unitprice__c = 1;
- orderdet2.InvoicedProCost_RMB__c = 1;
- orderdet2.Invoiced_Procount__c = 3;
- orderdet2.RrturnPro_count__c = 3;
- orderdet2.Invoice_Unit__c = '涓�';
- orderdet2.Invoiced_Count__c = 3;
- orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_0010031';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
- orderdet2.Box_Piece__c = '涓�';
- orderdet2.Shipment_Count__c = 10;
- orderdet2.Delivery_List_RMB__c = 2.0;
- orderdet2.Invoice_Unitprice__c = 1;
- orderdet2.InvoicedProCost_RMB__c = 1;
- orderdet2.Invoiced_Procount__c = 3;
- orderdet2.RrturnPro_count__c = 3;
- orderdet2.Invoice_Unit__c = '鐩�';
- orderdet2.Invoiced_Count__c = 3;
-
- Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList1.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Box_Piece__c = '鐩�';
- orderdet3.Consumable_product__c = pro2.Id;
- orderdet3.Invoice_Unit__c = '涓�';
- orderdet3.Shipment_Count__c = 11;
- orderdet3.Delivery_List_RMB__c = 2.0;
- orderdet3.Invoiced_Procount__c = 3;
- orderdet3.RrturnPro_count__c = 3;
- orderdet3.Invoiced_Count__c = 3;
- orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001003';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList1.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
- orderdet3.Box_Piece__c = '鐩�';
- orderdet3.Consumable_product__c = pro1.Id;
- orderdet3.Invoice_Unit__c = '鐩�';
- orderdet3.Shipment_Count__c = 11;
- orderdet3.Delivery_List_RMB__c = 2.0;
- orderdet3.Invoiced_Procount__c = 3;
- orderdet3.RrturnPro_count__c = 3;
- orderdet3.Invoiced_Count__c = 3;
-
- Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_001004';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet4.Consumable_order__c = testList1.Id;
- orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet4.Consumable_count__c = 1;
- orderdet4.Box_Piece__c = '鐩�';
- orderdet4.Consumable_product__c = pro2.Id;
- orderdet4.Invoice_Unit__c = '涓�';
- orderdet4.Shipment_Count__c = 11;
- orderdet4.Delivery_List_RMB__c = 2.0;
- orderdet4.Invoiced_Procount__c = 3;
- orderdet4.Invoiced_Count__c = 3;
- orderdet4.RrturnPro_count__c = 3;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
-
- // PageReference page = new PageReference('/apex/ConInvoicedetails?orderId=' + testList1.Id + '&invoiceId=' + invoiceorder.id);
- // page.setRedirect(true);
- // System.Test.setCurrentPage(page);
- // page = new Pagereference('/ConInvoiceView?invoiceId='+invoiceorder.id);
- // page.setRedirect(true);
-
- LexConInvoicedetailsController.init('', '');
- // System.assertEquals(4, conTest.consumableorderdetails1Records.size());
- // conTest.consumableorderdetails1Records[0].check= true;
- // conTest.consumableorderdetails1Records[0].invoiceCount= 1;
- // conTest.consumableorderdetails1Records[0].esd.Invoice_Unit__c = '涓�';
- // conTest.consumableorderdetails1Records[1].check= true;
- // conTest.consumableorderdetails1Records[1].invoiceCount= 2;
- // conTest.consumableorderdetails1Records[1].esd.Invoice_Unit__c = '涓�';
- // conTest.save();
- // conTest.returnToinvoice();
- // Consumable_orderdetails__c testInvoice = [select id,Name,Invoiced_Count__c,Invoice_Unit__c,Invoice_Unitprice__c from Consumable_orderdetails__c where id=:invoicedet1.Id];
- // System.assertEquals(4, conTest.invoiceOrderRecoedsCount);
- // System.assertEquals('涓�', testInvoice.Invoice_Unit__c);
- }
- }
- @isTest
static void all() {
User myUser_test;
Account myAccount1;
Account myAccount2;
- Product2__c pro2;
- Product2__c pro1;
- Product2 prod01;
- Product2 prod02;
User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
System.runAs(thisUser) {
Profile prof = [
@@ -440,100 +28,6 @@
if (rectHos.size() == 0) {
return;
}
- //浜у搧淇℃伅
- prod01 = new Product2(
- Name = 'Test01',
- ProductCode = 'Test01',
- Asset_Model_No__c = 'Test01',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- prod02 = new Product2(
- Name = 'Test02',
- ProductCode = 'Test02',
- Asset_Model_No__c = 'Test02',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod03 = new Product2(
- Name = 'Test03',
- ProductCode = 'Test03',
- Asset_Model_No__c = 'Test03',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod04 = new Product2(
- Name = 'Test04',
- ProductCode = 'Test04',
- Asset_Model_No__c = 'Test04',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 2,
- Manual_Entry__c = false
- );
- Product2 prod05 = new Product2(
- Name = 'Test05',
- ProductCode = 'Test05',
- Asset_Model_No__c = 'Test05',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- Product2 prod06 = new Product2(
- Name = 'Test06',
- ProductCode = 'Test06',
- Asset_Model_No__c = 'Test06',
- SFDA_Status__c = '鏈夊姽',
- Dealer_special_Object__c = true,
- Packing_list_manual__c = 1,
- Manual_Entry__c = false
- );
- insert new List<Product2>{
- prod01,
- prod02,
- prod03,
- prod04,
- prod05,
- prod06
- };
- pro1 = new Product2__c(
- Name = 'Pro001',
- OT_CODE_Text__c = 'Test001',
- Product2__c = prod01.Id
- );
- pro2 = new Product2__c(
- Name = 'Pro002',
- OT_CODE_Text__c = 'Test002',
- Product2__c = prod02.Id
- );
- Product2__c pro5 = new Product2__c(
- Name = 'Pro003',
- OT_CODE_Text__c = 'Test003',
- Product2__c = prod03.Id
- );
- Product2__c pro3 = new Product2__c(
- Name = 'Pro004',
- OT_CODE_Text__c = 'Test004',
- Product2__c = prod04.Id
- );
- Product2__c pro4 = new Product2__c(
- Name = 'Pro005',
- OT_CODE_Text__c = 'Test005',
- Product2__c = prod05.Id
- );
- Product2__c pro6 = new Product2__c(
- Name = 'Pro006',
- OT_CODE_Text__c = 'Test006',
- Product2__c = prod06.Id
- );
- insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
myAccount1 = new Account(
Name = 'testaccount001',
Dealer_discount__c = 10,
@@ -570,6 +64,100 @@
insert myUser_test;
}
System.runAs(myUser_test) {
+ //浜у搧淇℃伅
+ Product2 prod01 = new Product2(
+ Name = 'Test01',
+ ProductCode = 'Test01',
+ Asset_Model_No__c = 'Test01',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Packing_list_manual__c = 1,
+ 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,
+ Packing_list_manual__c = 1,
+ Manual_Entry__c = false
+ );
+ Product2 prod03 = new Product2(
+ Name = 'Test03',
+ ProductCode = 'Test03',
+ Asset_Model_No__c = 'Test03',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Packing_list_manual__c = 1,
+ Manual_Entry__c = false
+ );
+ Product2 prod04 = new Product2(
+ Name = 'Test04',
+ ProductCode = 'Test04',
+ Asset_Model_No__c = 'Test04',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Packing_list_manual__c = 2,
+ Manual_Entry__c = false
+ );
+ Product2 prod05 = new Product2(
+ Name = 'Test05',
+ ProductCode = 'Test05',
+ Asset_Model_No__c = 'Test05',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Packing_list_manual__c = 1,
+ Manual_Entry__c = false
+ );
+ Product2 prod06 = new Product2(
+ Name = 'Test06',
+ ProductCode = 'Test06',
+ Asset_Model_No__c = 'Test06',
+ SFDA_Status__c = '鏈夊姽',
+ Dealer_special_Object__c = true,
+ Packing_list_manual__c = 1,
+ Manual_Entry__c = false
+ );
+ insert new List<Product2>{
+ prod01,
+ prod02,
+ prod03,
+ prod04,
+ prod05,
+ prod06
+ };
+ Product2__c pro1 = new Product2__c(
+ Name = 'Pro001',
+ OT_CODE_Text__c = 'Test001',
+ Product2__c = prod01.Id
+ );
+ Product2__c pro2 = new Product2__c(
+ Name = 'Pro002',
+ OT_CODE_Text__c = 'Test002',
+ Product2__c = prod02.Id
+ );
+ Product2__c pro3 = new Product2__c(
+ Name = 'Pro004',
+ OT_CODE_Text__c = 'Test004',
+ Product2__c = prod03.Id
+ );
+ Product2__c pro4 = new Product2__c(
+ Name = 'Pro005',
+ OT_CODE_Text__c = 'Test005',
+ Product2__c = prod04.Id
+ );
+ Product2__c pro5 = new Product2__c(
+ Name = 'Pro003',
+ OT_CODE_Text__c = 'Test003',
+ Product2__c = prod05.Id
+ );
+ Product2__c pro6 = new Product2__c(
+ Name = 'Pro006',
+ OT_CODE_Text__c = 'Test006',
+ Product2__c = prod06.Id
+ );
+ insert new List<Product2__c>{ pro4, pro5, pro6, pro1, pro2, pro3 };
//鍙戠エ
Consumable_order__c invoiceorder = new Consumable_order__c();
invoiceorder.Name = 'invoice02';
@@ -611,10 +199,10 @@
TestList2.Deliver_date__c = Date.today();
insert new List<Consumable_order__c>{ testList1, testList2 };
+ List<Consumable_Orderdetails__c> invoiceList = new List<Consumable_Orderdetails__c>();
//鍙戠エ鏄庣粏1
Consumable_orderdetails__c invoicedet1 = new Consumable_orderdetails__c();
invoicedet1.Name = 'invoicetest1_001001';
- //orderdet1.Consumable_principal__c = testList1.Id;
invoicedet1.Consumable_order__c = invoiceorder.id;
invoicedet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
invoicedet1.Consumable_count__c = 1;
@@ -628,9 +216,10 @@
invoicedet1.Invoice_Unit__c = '涓�';
invoicedet1.Invoiced_Procount__c = 3;
invoicedet1.RrturnPro_count__c = 3;
+ invoiceList.add(invoicedet1);
+
Consumable_orderdetails__c invoicedet2 = new Consumable_orderdetails__c();
invoicedet2.Name = 'invoiceTest1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
invoicedet2.Consumable_order__c = invoiceorder.Id;
invoicedet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
invoicedet2.Consumable_count__c = 1;
@@ -644,9 +233,10 @@
invoicedet2.Invoice_Unit__c = '涓�';
invoicedet2.Invoiced_Procount__c = 3;
invoicedet2.RrturnPro_count__c = 3;
+ invoiceList.add(invoicedet2);
+
Consumable_orderdetails__c invoicedet3 = new Consumable_orderdetails__c();
invoicedet3.Name = 'invoiceTest1_001003';
- //orderdet2.Consumable_principal__c = testList2.Id;
invoicedet3.Consumable_order__c = invoiceorder.Id;
invoicedet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
invoicedet3.Consumable_count__c = 1;
@@ -660,12 +250,10 @@
invoicedet3.InvoicedProCost_RMB__c = 1;
invoicedet3.Invoiced_Procount__c = 3;
invoicedet3.RrturnPro_count__c = 3;
- insert new List<Consumable_orderdetails__c>{
- invoicedet1,
- invoicedet2,
- invoicedet3
- };
+ invoiceList.add(invoicedet3);
+ insert invoiceList;
+ List<Consumable_Orderdetails__c> codList = new List<Consumable_Orderdetails__c>();
//鍑哄簱鍗曟槑缁�1
Consumable_orderdetails__c orderdet1 = new Consumable_orderdetails__c();
orderdet1.Name = 'Test1_001001';
@@ -682,117 +270,137 @@
orderdet1.Invoiced_Procount__c = 3;
orderdet1.RrturnPro_count__c = 3;
orderdet1.Invoice_Unit__c = '涓�';
- orderdet1 = new Consumable_orderdetails__c();
- orderdet1.Name = 'Test1_0010011';
- //orderdet1.Consumable_principal__c = testList1.Id;
- orderdet1.Consumable_order__c = testList1.Id;
- orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet1.Consumable_count__c = 1;
- orderdet1.Consumable_product__c = pro2.Id;
- orderdet1.Box_Piece__c = '涓�';
- orderdet1.Shipment_Count__c = 11;
- orderdet1.Delivery_List_RMB__c = 2.0;
- orderdet1.Invoice_Unitprice__c = 1;
- orderdet1.InvoicedProCost_RMB__c = 1;
- orderdet1.Invoiced_Procount__c = 3;
- orderdet1.RrturnPro_count__c = 3;
- orderdet1.Invoice_Unit__c = '鐩�';
+ codList.add(orderdet1);
+
Consumable_orderdetails__c orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_0010012';
- //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet2.Name = 'Test1_0010011';
orderdet2.Consumable_order__c = testList1.Id;
orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
orderdet2.Consumable_count__c = 1;
orderdet2.Consumable_product__c = pro2.Id;
- orderdet2.Box_Piece__c = '鐩�';
- orderdet2.Shipment_Count__c = 10;
- orderdet2.Delivery_List_RMB__c = 2.0;
- orderdet2.Invoice_Unitprice__c = 1;
- orderdet2.InvoicedProCost_RMB__c = 1;
- orderdet2.Invoiced_Procount__c = 3;
- orderdet2.RrturnPro_count__c = 3;
- orderdet2.Invoice_Unit__c = '涓�';
- orderdet2.Invoiced_Count__c = 3;
- orderdet2 = new Consumable_orderdetails__c();
- orderdet2.Name = 'Test1_0010031';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet2.Consumable_order__c = testList1.Id;
- orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet2.Consumable_count__c = 1;
- orderdet2.Consumable_product__c = pro1.Id;
orderdet2.Box_Piece__c = '涓�';
- orderdet2.Shipment_Count__c = 10;
+ orderdet2.Shipment_Count__c = 11;
orderdet2.Delivery_List_RMB__c = 2.0;
orderdet2.Invoice_Unitprice__c = 1;
orderdet2.InvoicedProCost_RMB__c = 1;
orderdet2.Invoiced_Procount__c = 3;
orderdet2.RrturnPro_count__c = 3;
orderdet2.Invoice_Unit__c = '鐩�';
- orderdet2.Invoiced_Count__c = 3;
+ codList.add(orderdet2);
Consumable_orderdetails__c orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001002';
- //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet3.Name = 'Test1_0010012';
orderdet3.Consumable_order__c = testList1.Id;
orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
orderdet3.Consumable_count__c = 1;
- orderdet3.Box_Piece__c = '鐩�';
orderdet3.Consumable_product__c = pro2.Id;
- orderdet3.Invoice_Unit__c = '涓�';
- orderdet3.Shipment_Count__c = 11;
- orderdet3.Delivery_List_RMB__c = 2.0;
- orderdet3.Invoiced_Procount__c = 3;
- orderdet3.RrturnPro_count__c = 3;
- orderdet3.Invoiced_Count__c = 3;
- orderdet3 = new Consumable_orderdetails__c();
- orderdet3.Name = 'Test1_001003';
- //orderdet2.Consumable_principal__c = testList2.Id;
- orderdet3.Consumable_order__c = testList1.Id;
- orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
- orderdet3.Consumable_count__c = 1;
orderdet3.Box_Piece__c = '鐩�';
- orderdet3.Consumable_product__c = pro1.Id;
- orderdet3.Invoice_Unit__c = '鐩�';
- orderdet3.Shipment_Count__c = 11;
+ orderdet3.Shipment_Count__c = 10;
orderdet3.Delivery_List_RMB__c = 2.0;
+ orderdet3.Invoice_Unitprice__c = 1;
+ orderdet3.InvoicedProCost_RMB__c = 1;
orderdet3.Invoiced_Procount__c = 3;
orderdet3.RrturnPro_count__c = 3;
+ orderdet3.Invoice_Unit__c = '涓�';
orderdet3.Invoiced_Count__c = 3;
+ codList.add(orderdet3);
Consumable_orderdetails__c orderdet4 = new Consumable_orderdetails__c();
- orderdet4.Name = 'Test1_001004';
- //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet4.Name = 'Test1_0010031';
orderdet4.Consumable_order__c = testList1.Id;
orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
orderdet4.Consumable_count__c = 1;
- orderdet4.Box_Piece__c = '鐩�';
- orderdet4.Consumable_product__c = pro2.Id;
- orderdet4.Invoice_Unit__c = '涓�';
- orderdet4.Shipment_Count__c = 11;
+ orderdet4.Consumable_product__c = pro1.Id;
+ orderdet4.Box_Piece__c = '涓�';
+ orderdet4.Shipment_Count__c = 10;
orderdet4.Delivery_List_RMB__c = 2.0;
+ orderdet4.Invoice_Unitprice__c = 1;
+ orderdet4.InvoicedProCost_RMB__c = 1;
orderdet4.Invoiced_Procount__c = 3;
- orderdet4.Invoiced_Count__c = 3;
orderdet4.RrturnPro_count__c = 3;
- insert new List<Consumable_orderdetails__c>{
- orderdet1,
- orderdet2,
- orderdet3,
- orderdet4
- };
+ orderdet4.Invoice_Unit__c = '鐩�';
+ orderdet4.Invoiced_Count__c = 3;
+ codList.add(orderdet4);
+
+ Consumable_orderdetails__c orderdet5 = new Consumable_orderdetails__c();
+ orderdet5.Name = 'Test1_001002';
+ orderdet5.Consumable_order__c = testList1.Id;
+ orderdet5.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet5.Consumable_count__c = 1;
+ orderdet5.Box_Piece__c = '鐩�';
+ orderdet5.Consumable_product__c = pro2.Id;
+ orderdet5.Invoice_Unit__c = '涓�';
+ orderdet5.Shipment_Count__c = 11;
+ orderdet5.Delivery_List_RMB__c = 2.0;
+ orderdet5.Invoiced_Procount__c = 3;
+ orderdet5.RrturnPro_count__c = 3;
+ orderdet5.Invoiced_Count__c = 3;
+ codList.add(orderdet5);
+
+ Consumable_orderdetails__c orderdet6 = new Consumable_orderdetails__c();
+ orderdet6.Name = 'Test1_001003';
+ orderdet6.Consumable_order__c = testList1.Id;
+ orderdet6.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet6.Consumable_count__c = 1;
+ orderdet6.Box_Piece__c = '鐩�';
+ orderdet6.Consumable_product__c = pro1.Id;
+ orderdet6.Invoice_Unit__c = '鐩�';
+ orderdet6.Shipment_Count__c = 11;
+ orderdet6.Delivery_List_RMB__c = 2.0;
+ orderdet6.Invoiced_Procount__c = 3;
+ orderdet6.RrturnPro_count__c = 3;
+ orderdet6.Invoiced_Count__c = 3;
+ codList.add(orderdet6);
+
+ Consumable_orderdetails__c orderdet7 = new Consumable_orderdetails__c();
+ orderdet7.Name = 'Test1_001004';
+ //orderdet2.Consumable_principal__c = testList2.Id;
+ orderdet7.Consumable_order__c = testList1.Id;
+ orderdet7.RecordTypeId = System.Label.RT_ConOrderDetail1_Invoice;
+ orderdet7.Consumable_count__c = 1;
+ orderdet7.Box_Piece__c = '鐩�';
+ orderdet7.Consumable_product__c = pro2.Id;
+ orderdet7.Invoice_Unit__c = '涓�';
+ orderdet7.Shipment_Count__c = 11;
+ orderdet7.Delivery_List_RMB__c = 2.0;
+ orderdet7.Invoiced_Procount__c = 3;
+ orderdet7.Invoiced_Count__c = 3;
+ orderdet7.RrturnPro_count__c = 3;
+ codList.add(orderdet7);
+ insert codList;
LexConInvoicedetailsController.init(testList1.Id, invoiceorder.Id);
+ //搴忓垪鍖朖son
+
+ System.Test.startTest();
System.debug(
'===>鏁版嵁' +
LexConInvoicedetailsController.consumableorderdetails1Records
);
-
- List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> test = LexConInvoicedetailsController.consumableorderdetails1Records;
-
+ List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList = LexConInvoicedetailsController.consumableorderdetails1Records;
LexConInvoicedetailsController.save(
- JSON.serialize(test),
+ JSON.serialize(
+ LexConInvoicedetailsController.consumableorderdetails1Records
+ ),
invoiceorder.Id,
testList1.Id
);
+
+ List<LexConInvoicedetailsController.ConsumableorderdetailsInfo> inList1 = new List<LexConInvoicedetailsController.ConsumableorderdetailsInfo>();
+ for (
+ LexConInvoicedetailsController.ConsumableorderdetailsInfo ass : inList
+ ) {
+ ass.check = true;
+ ass.invoiceCount = 1;
+ ass.esd.Invoice_Unit__c = '涓�';
+ inList1.add(ass);
+ }
+ LexConInvoicedetailsController.save(
+ JSON.serialize(inList1),
+ invoiceorder.Id,
+ testList1.Id
+ );
+ System.Test.stopTest();
}
}
}
--
Gitblit v1.9.1