liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
@isTest
public with sharing class lexTmsformControllerTest {
    @TestSetup
    private static void init() {
 
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
 
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        Account accDep = new Account();
        accDep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Agency'].id;
        accDep.Name = '山东省虚拟经销商';
        accDep.Is_Active__c = '有效';
        accDep.TradeComplianceStatus__c = '警示名单';
        accDep.State_Master__c = al.Id;
        accDep.Aim_Price__c = 41421421;
        accDep.ParentId = '001C8000002Se0tIAC';
        accDep.ET_SP_Dealer__c = true;
        accDep.ISVirtualDealer__c = true;
 
        insert accDep;
 
        Dealer_ConsumableManage__c dc = new Dealer_ConsumableManage__c();
        dc.Dealer_Name__c = accDep.id;
        dc.TMS_Key__c = accDep.id+'-'+'ET'+'-'+'FY2024'+'-'+accDep.OCM_man_province_HP__c;
        dc.ET_ENG__c = 'ET';
        dc.FY__c = 'FY2024';
        dc.FY_O_1__c = 123;
        dc.FY_O_10__c = 123;
        dc.FY_O_11__c = 123;
        dc.FY_O_12__c = 123;
        dc.FY_O_2__c = 123;
        dc.FY_O_3__c = 123;
        dc.FY_O_4__c = 123;
        dc.FY_O_5__c = 123;
        dc.FY_O_6__c = 123;
        dc.FY_O_7__c = 123;
        dc.FY_O_8__c = 123;
        dc.FY_O_9__c = 123;
        
        dc.FY_P_1__c = 123;
        dc.FY_P_10__c = 123;
        dc.FY_P_11__c = 123;
        dc.FY_P_12__c = 123;
        dc.FY_P_2__c = 123;
        dc.FY_P_3__c = 123;
        dc.FY_P_4__c = 123;
        dc.FY_P_5__c = 123;
        dc.FY_P_6__c = 123;
        dc.FY_P_7__c = 123;
        dc.FY_P_8__c = 123;
        dc.FY_P_9__c = 123;
 
        dc.FY_S_1__c = 123;
        dc.FY_S_10__c = 123;
        dc.FY_S_11__c = 123;
        dc.FY_S_12__c = 123;
        dc.FY_S_2__c = 123;
        dc.FY_S_3__c = 123;
        dc.FY_S_4__c = 123;
        dc.FY_S_5__c = 123;
        dc.FY_S_6__c = 123;
        dc.FY_S_7__c = 123;
        dc.FY_S_8__c = 123;
        dc.FY_S_9__c = 123;
 
        dc.FY_I_1__c = 123;
        dc.FY_I_10__c = 123;
        dc.FY_I_11__c = 123;
        dc.FY_I_12__c = 123;
        dc.FY_I_2__c = 123;
        dc.FY_I_3__c = 123;
        dc.FY_I_4__c = 123;
        dc.FY_I_5__c = 123;
        dc.FY_I_6__c = 123;
        dc.FY_I_7__c = 123;
        dc.FY_I_8__c = 123;
        dc.FY_I_9__c = 123;
 
        dc.TMS_Unpaid_amount_1__c = 123;
        dc.TMS_Unpaid_amount_10__c = 123;
        dc.TMS_Unpaid_amount_11__c = 123;
        dc.TMS_Unpaid_amount_12__c = 123;
        dc.TMS_Unpaid_amount_2__c = 123;
        dc.TMS_Unpaid_amount_3__c = 123;
        dc.TMS_Unpaid_amount_4__c = 123;
        dc.TMS_Unpaid_amount_5__c = 123;
        dc.TMS_Unpaid_amount_6__c = 123;
        dc.TMS_Unpaid_amount_7__c = 123;
        dc.TMS_Unpaid_amount_8__c = 123;
        dc.TMS_Unpaid_amount_9__c = 123;
 
        dc.TMS_Prediction_1__c = 123;
        dc.TMS_Prediction_10__c = 123;
        dc.TMS_Prediction_11__c = 123;
        dc.TMS_Prediction_12__c = 123;
        dc.TMS_Prediction_2__c = 123;
        dc.TMS_Prediction_3__c = 123;
        dc.TMS_Prediction_4__c = 123;
        dc.TMS_Prediction_5__c = 123;
        dc.TMS_Prediction_6__c = 123;
        dc.TMS_Prediction_7__c = 123;
        dc.TMS_Prediction_8__c = 123;
        dc.TMS_Prediction_9__c = 123;
 
        dc.IMS_Shipments_1__c = 123;
        dc.IMS_Shipments_10__c = 123;
        dc.IMS_Shipments_11__c = 123;
        dc.IMS_Shipments_12__c = 123;
        dc.IMS_Shipments_2__c = 123;
        dc.IMS_Shipments_3__c = 123;
        dc.IMS_Shipments_4__c = 123;
        dc.IMS_Shipments_5__c = 123;
        dc.IMS_Shipments_6__c = 123;
        dc.IMS_Shipments_7__c = 123;
        dc.IMS_Shipments_8__c = 123;
        dc.IMS_Shipments_9__c = 123;
 
        dc.IMS_Prediction_1__c = 123;
        dc.IMS_Prediction_10__c = 123;
        dc.IMS_Prediction_11__c = 123;
        dc.IMS_Prediction_12__c = 123;
        dc.IMS_Prediction_2__c = 123;
        dc.IMS_Prediction_3__c = 123;
        dc.IMS_Prediction_4__c = 123;
        dc.IMS_Prediction_5__c = 123;
        dc.IMS_Prediction_6__c = 123;
        dc.IMS_Prediction_7__c = 123;
        dc.IMS_Prediction_8__c = 123;
        dc.IMS_Prediction_9__c = 123;
 
        dc.TMS_PredictionFulfillment_1__c = 123;
        dc.TMS_PredictionFulfillment_10__c = 123;
        dc.TMS_PredictionFulfillment_11__c = 123;
        dc.TMS_PredictionFulfillment_12__c = 123;
        dc.TMS_PredictionFulfillment_2__c = 123;
        dc.TMS_PredictionFulfillment_3__c = 123;
        dc.TMS_PredictionFulfillment_4__c = 123;
        dc.TMS_PredictionFulfillment_5__c = 123;
        dc.TMS_PredictionFulfillment_6__c = 123;
        dc.TMS_PredictionFulfillment_7__c = 123;
        dc.TMS_PredictionFulfillment_8__c = 123;
        dc.TMS_PredictionFulfillment_9__c = 123;
 
        insert dc;
        
 
        
        // 戦略科室を得る
        Address_Level__c address = new Address_Level__c(Level1_Code__c = 'CN-01',Name='北京市');
            insert address;
            // 病院を作る
            Account hospital = new Account();
            hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Agency'].id;
            hospital.Name = 'test hospital';
            hospital.Is_Active__c = '有效';
            hospital.TradeComplianceStatus__c = '警示名单';
            hospital.State_Master__c = address.Id;
            hospital.Aim_Price__c = 41421421;
            hospital.Agent_Ref__c = '001C8000002Se9aIAC';
            hospital.ParentId = '001C8000002Se9aIAC';
            hospital.ET_SP_Dealer__c = true;
            insert hospital;
        Oly_TriggerHandler.bypass('ConsumableAssetHander');
        Oly_TriggerHandler.bypass('Oly_TriggerHandler');
        Oly_TriggerHandler.bypass('ConsumableAssetUp');
        Consumable_order_details2__c saledet1 = new Consumable_order_details2__c();
        saledet1.Name = 'OCM_01_001001';
 
        saledet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet1.Bar_Code__c = '0114953170032070111804001082K250BBBBB';
 
        saledet1.Used_account__c = hospital.Id;
        saledet1.Delivery_List_RMB__c = 11;
        saledet1.Box_Piece__c = '盒';
        saledet1.TracingCode__c = 'BBBBB';
        saledet1.SerialLotNo__c = '82K';
        saledet1.Intra_Trade_List_RMB__c = 32142;
        saledet1.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet1.Sterilization_limit__c = Date.today().addDays(5);
        saledet1.Send_Date__c = null;
        saledet1.Arrive_date__c = Date.today().addDays(5);
        saledet1.Used_date__c = null;
        saledet1.Used_Account_Type__c = '契約';
        saledet1.Deliver_date__c = Date.today().addDays(-50);
        saledet1.Consumable_product__c = 'a36C80000000IeOIAU';
        insert saledet1;
 
        Consumable_order_details2__c saledet3 = new Consumable_order_details2__c();
        saledet3.Name = 'OCM_01_0010012';
 
        saledet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet3.Bar_Code__c = '0114953170032070111804001082K250BBBBA';
 
        saledet3.Used_account__c = hospital.Id;
        saledet3.Delivery_List_RMB__c = 11;
        saledet3.Box_Piece__c = '盒';
        saledet3.TracingCode__c = 'BBBBB';
        saledet3.SerialLotNo__c = '82K';
        saledet3.Intra_Trade_List_RMB__c = 321342;
        saledet3.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet3.Sterilization_limit__c = Date.today().addDays(5);
        saledet3.Send_Date__c = null;
        saledet3.Arrive_date__c = Date.today().addDays(5);
        saledet3.Used_date__c = null;
        saledet3.Used_Account_Type__c = '販売店';
        saledet3.Deliver_date__c = Date.today().addMonths(3);
        insert saledet3;
        Consumable_order_details2__c saledet4 = new Consumable_order_details2__c();
        saledet4.Name = 'OCM_01_0010012';
 
        saledet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet4.Bar_Code__c = '0114953170032070111804001082K250BBBBA';
 
        saledet4.Used_account__c = hospital.Id;
        saledet4.Delivery_List_RMB__c = 11;
        saledet4.Box_Piece__c = '盒';
        saledet4.TracingCode__c = 'BBBBB';
        saledet4.SerialLotNo__c = '82K';
        saledet4.Intra_Trade_List_RMB__c = 321342;
        saledet4.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet4.Sterilization_limit__c = Date.today().addDays(5);
        saledet4.Send_Date__c = null;
        saledet4.Arrive_date__c = Date.today().addDays(5);
        saledet4.Used_date__c = null;
        saledet4.Used_Account_Type__c = '販売店';
        saledet4.Deliver_date__c = Date.today().addMonths(-4);
        saledet4.Consumable_product__c = 'a36C80000000IeOIAU';
        insert saledet4;
        Consumable_order_details2__c saledet5 = new Consumable_order_details2__c();
        saledet5.Name = 'OCM_01_0010012';
 
        saledet5.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet5.Bar_Code__c = '0114953170032070111804001082K250BBBBA';
 
        saledet5.Used_account__c = hospital.Id;
        saledet5.Delivery_List_RMB__c = 11;
        saledet5.Box_Piece__c = '盒';
        saledet5.TracingCode__c = 'BBBBB';
        saledet5.SerialLotNo__c = '82K';
        saledet5.Intra_Trade_List_RMB__c = 321342;
        saledet5.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet5.Sterilization_limit__c = Date.today().addDays(-5);
        saledet5.Send_Date__c = null;
        saledet5.Arrive_date__c = Date.today().addDays(5);
        saledet5.Used_date__c = null;
        saledet5.Used_Account_Type__c = '販売店';
        saledet5.Deliver_date__c = Date.today().addMonths(5);
        insert saledet5;
        Consumable_order_details2__c saledet6 = new Consumable_order_details2__c();
        saledet6.Name = 'OCM_01_0010012';
 
        saledet6.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
        saledet6.Bar_Code__c = '0114953170032070111804001082K250BBBBA';
 
        saledet6.Used_account__c = hospital.Id;
        saledet6.Delivery_List_RMB__c = 11;
        saledet6.Box_Piece__c = '盒';
        saledet6.TracingCode__c = 'BBBBB';
        saledet6.SerialLotNo__c = '82K';
        saledet6.Intra_Trade_List_RMB__c = 321342;
        saledet6.Guarantee_period_for_products__c = Date.today().addDays(5);
        saledet6.Sterilization_limit__c = Date.today().addDays(5);
        saledet6.Send_Date__c = null;
        saledet6.Arrive_date__c = Date.today().addDays(5);
        saledet6.Used_date__c = null;
        saledet6.Used_Account_Type__c = '販売店';
        saledet6.Deliver_date__c = Date.today().addMonths(6);
        insert saledet6;
    }
    static testMethod void testInitOTwo(){
        Account acc = [select id,name ,OCM_man_province_HP__c  from Account limit 1];
        lexTmsformController.initData('','大连',null,'ET耗材',null,'FY2024',null);
    }
 
    static testMethod void testInitOOne(){
        lexTmsformController.initData2('','大连',null,'ET耗材',null,'FY2024',null);
    }
    static testMethod void testInitOTree(){
        
    }
}