高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
@isTest
// RowDataを残すため、@future execute にします
private class NFM010WebServiceTest {
    
    static Opportunity makeTestOpp() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            throw new ControllerUtil.myException('not found 病院 recodetype');
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            throw new ControllerUtil.myException('not found 戦略科室分類 呼吸科 recodetype');
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            throw new ControllerUtil.myException('not found 診療科 消化科 recodetype');
        }
 
        // テストデータ
        List<BatchIF_Transfer__c> transfers = new List<BatchIF_Transfer__c>();
        BatchIF_Transfer__c transfer = new BatchIF_Transfer__c();
        transfer.Table__c          = 'Statu_Achievements__c';
        transfer.Column__c         = 'SalesChannel__c';
        transfer.External_Value__c = '1';
        transfer.Internal_Value__c = 'OCM直接販売';
        transfers.add(transfer);
        transfer = new BatchIF_Transfer__c();
        transfer.Table__c          = 'Statu_Achievements__c';
        transfer.Column__c         = 'SalesChannel__c';
        transfer.External_Value__c = '3';
        transfer.Internal_Value__c = '販売店';
        transfers.add(transfer);
        insert transfers;
        
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM010TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM010TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        // 再取得
        List<Id> accountIds = new Id[] {company.Id, section.Id, depart.Id};
        List<Account> accList = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id In :accountIds order by Management_Code_Auto__c];
 
        Opportunity opp = new Opportunity();
        opp.AccountId           = depart.Id;
        opp.Department_Class__c = section.Id;
        opp.Hospital__c         = company.Id;
        opp.Name                = 'GZ-SP-GD3187';
        opp.Trade__c            = '内貿';
        opp.StageName           = '引合';
        opp.Sales_Root__c       = 'OCM直接販売';
        opp.CloseDate           = date.newinstance(2022, 11, 30);
        insert opp;
        // 再取得
        opp = [select Opportunity_No__c, Opp_Number__c, Name, Id from Opportunity where Id =: opp.Id];
        return opp;
    }
    // @isTest
    static void testNFM010_void() {
        Opportunity opp = makeTestOpp();
 
        // そのままreturn
        // null
        NFM010WebService.NFM010(null);
 
        NFM010WebService.Achievement Achievement = new NFM010WebService.Achievement();
        NFM010WebService.Achievements Achievements = new NFM010WebService.Achievements();
        Achievements.Achievement = new NFM010WebService.Achievement[] { Achievement };
        // Monitoringをセットしない
        NFM010WebService.NFM010(Achievements);
        
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        Achievements.Monitoring = new NFMUtil.Monitoring();
        Achievements.Monitoring.MessageGroupNumber = nowStr + '01';
        // 必須項目をセットしない
        NFM010WebService.NFM010(Achievements);
        
        // 商談がない
        Achievements.Monitoring.MessageGroupNumber = nowStr + '02';
        Achievement.SoNo          = '35100023';
        Achievement.QuotationCode = 'GZ-SP-GD3187';
        Achievement.TimeLimit     = 20121122;
        NFM010WebService.NFM010(Achievements);
 
        Product2[] rslts = [select Id from Product2];
        System.assertEquals(0, rslts.size());
    }
    //@isTest
    static void testNFM010_insert() {
        Opportunity opp = makeTestOpp();
 
        NFM010WebService.Achievement Achievement = new NFM010WebService.Achievement();
        NFM010WebService.Achievement Achievement2 = new NFM010WebService.Achievement();
        NFM010WebService.Achievements Achievements = new NFM010WebService.Achievements();
        Achievements.Achievement = new NFM010WebService.Achievement[] { Achievement, Achievement2 };
 
        // Monitoringの設定
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        Achievements.Monitoring = new NFMUtil.Monitoring();
        Achievements.Monitoring.MessageGroupNumber = nowStr + '11';
 
        // insert
        Achievement.QuotationCode         = opp.Opportunity_No__c;
        Achievement.SoNo                  = 'NFM010Tst1';
        Achievement.ReturnFlag            = '';
        Achievement.OverviewStatus        = '无效合同';
        Achievement.ContractNO            = 'GD-GYN-121668';
        Achievement.ContractReceivedDate  = '20120114';
        Achievement.FirstApproveDate      = '20120214';
        Achievement.SecondApproveDate     = '20120314';
        Achievement.SoLatestDeliveryDate  = '20120414';
        Achievement.DeliveryDate          = '20120514';
        Achievement.InstallDate           = '20120614';
        Achievement.TimeLimit             = 20120714;
        Achievement.Currency_x            = 'RMB';
        Achievement.ContractAmount        = 12345.12;
        Achievement.PaymentAmount         = 2345.12;
        Achievement.PaymentRate           = '17.99%,20171111';
        Achievement.DeliveryStatus        = '交付';
        Achievement.AssignmentStatus      = '分配';
        Achievement.PaymentStatus         = '完成';
        Achievement.InstallStatus         = '安装';
        Achievement.AuthorizationNo       = 'AUTH123432154';
        Achievement.ContractApplicationNo = 'ApplicationNo345674';
        Achievement.PaymentTerms          = '发货';
        Achievement.SalesChannel          = 3;
 
        Achievement2.QuotationCode         = opp.Opportunity_No__c;
        Achievement2.SoNo                  = 'NFM010Tst1';              // 同じ番号なので、1つの注残として登録
        Achievement2.ReturnFlag            = 'Y';
        Achievement2.OverviewStatus        = '无效合同';
        Achievement2.ContractNO            = 'GD-GYN-121668';
        Achievement2.ContractReceivedDate  = '20120115';
        Achievement2.FirstApproveDate      = '20120215';
        Achievement2.SecondApproveDate     = '20120315';
        Achievement2.SoLatestDeliveryDate  = '20120415';
        Achievement2.DeliveryDate          = '20120515';
        Achievement2.InstallDate           = '19000101';
        Achievement2.TimeLimit             = 20120715;
        Achievement2.Currency_x            = 'RMB';
        Achievement2.ContractAmount        = 12345.12;
        Achievement2.PaymentAmount         = 2345.12;
        Achievement2.PaymentRate           = '18.99%,20171111';
        Achievement2.DeliveryStatus        = '未交付';
        Achievement2.AssignmentStatus      = '部分分配';
        Achievement2.PaymentStatus         = '尾款完成';
        Achievement2.InstallStatus         = '全部安装';
        Achievement2.AuthorizationNo       = 'AUTH123432153';
        Achievement2.ContractApplicationNo = 'ApplicationNo345678';
        Achievement2.PaymentTerms          = '款到发货';
        Achievement2.SalesChannel          = 1;
 
        System.Test.startTest();
        NFM010WebService.NFM010(Achievements);
        System.Test.stopTest();
        
        String statu_Achievements_Ext = Achievement.QuotationCode + ':' + Achievement.SoNo;
        Statu_Achievements__c[] rslts = [select Id, Name, Opportunity__r.Opportunity_No__c,
                                                Statu_Achievements_Ext__c, ReturnFlag__c, OverviewStatus__c, ContractNO__c,
                                                ContractReceivedDate__c, FirstApproveDate__c, LastApproveDate__c,
                                                SoLatestDeliveryDate__c, DeliveryDate__c, InstallDate__c, Collection_Day_Invoice__c, UnshippedAmount__c,
                                                CurrencyIsoCode, ContractAmount__c, PaymentAmount__c, PaymentRate__c,
                                                DeliveryStatus__c, AssignmentStatus__c, PaymentStatus__c, InstallStatus__c, 
                                                AuthorizationNo__c, ContractApplicationNo__c, PaymentTerms__c, SalesChannel__c,
                                                End_User_Price__c
                                           from Statu_Achievements__c where Statu_Achievements_Ext__c = :statu_Achievements_Ext];
        System.assertEquals(1, rslts.size());
        if (rslts.size() == 1) {
            System.assertEquals(Achievement2.QuotationCode, rslts[0].Opportunity__r.Opportunity_No__c);
            System.assertEquals(Achievement2.SoNo, rslts[0].Name);
            System.assertEquals(true, rslts[0].ReturnFlag__c);
            System.assertEquals(Achievement2.OverviewStatus, rslts[0].OverviewStatus__c);
            System.assertEquals(Achievement2.ContractNO, rslts[0].ContractNO__c);
            System.assertEquals(NFMUtil.parseStr2Date(Achievement2.ContractReceivedDate), rslts[0].ContractReceivedDate__c);
            System.assertEquals(NFMUtil.parseStr2Date(Achievement2.FirstApproveDate), rslts[0].FirstApproveDate__c);
            System.assertEquals(NFMUtil.parseStr2Date(Achievement2.SecondApproveDate), rslts[0].LastApproveDate__c);
            System.assertEquals(NFMUtil.parseStr2Date(Achievement2.SoLatestDeliveryDate), rslts[0].SoLatestDeliveryDate__c);
            System.assertEquals(NFMUtil.parseStr2Date(Achievement2.DeliveryDate), rslts[0].DeliveryDate__c);
            System.assertEquals(null, rslts[0].InstallDate__c);
            System.assertEquals(null, rslts[0].Collection_Day_Invoice__c);
            System.assertEquals(Achievement2.TimeLimit, rslts[0].UnshippedAmount__c);
            System.assertEquals('CNY', rslts[0].CurrencyIsoCode);
            System.assertEquals(Achievement2.ContractAmount, rslts[0].ContractAmount__c);
            System.assertEquals(Achievement2.PaymentAmount, rslts[0].PaymentAmount__c);
            System.assertEquals(Achievement2.PaymentRate, rslts[0].PaymentRate__c);
            System.assertEquals(Achievement2.DeliveryStatus, rslts[0].DeliveryStatus__c);
            System.assertEquals(Achievement2.AssignmentStatus, rslts[0].AssignmentStatus__c);
            System.assertEquals(Achievement2.PaymentStatus, rslts[0].PaymentStatus__c);
            System.assertEquals(Achievement2.InstallStatus, rslts[0].InstallStatus__c);
            System.assertEquals(Achievement2.AuthorizationNo, rslts[0].AuthorizationNo__c);
            System.assertEquals(Achievement2.ContractApplicationNo, rslts[0].ContractApplicationNo__c);
            System.assertEquals(Achievement2.PaymentTerms, rslts[0].PaymentTerms__c);
//            System.assertEquals('OCM直接販売', rslts[0].SalesChannel__c);
            System.assertEquals(1.0, rslts[0].End_User_Price__c);
            Opportunity opp1 = [Select Id, Min_FirstApproveDate__c, Contract_Once_Recognize_Day__c from Opportunity where Id =: opp.Id];
            System.assertEquals(null, opp1.Min_FirstApproveDate__c);
            System.assertEquals(null, opp1.Contract_Once_Recognize_Day__c);
        }
    }
    
//    static testMethod void testNFM010_update() {
//        Opportunity opp = makeTestOpp();
//        opp.Estimation_Decision__c = true;
//        opp.Estimation_Id__c    = 'Estimation_Id';
//        opp.Purchase_Type__c    = '一般引合';
//        opp.Promise_Class__c    = '内貿';
//        opp.Fund_Basis__c       = '政府資金';
//        opp.SAP_Province__c     = '北京市';
//        opp.Authorized_DB_No__c = 'Authorized_DB_No';
//        opp.NotesApprovedNo__c = 'NotesApprovedNo';
//        update opp;
//        opp.SAP_Send_OK__c      = true;
//        update opp;
//        Statu_Achievements__c sta = new Statu_Achievements__c(
//            Name='NFM010Tst1',
//            Opportunity__c = opp.Id,
//            OverviewStatus__c = '无效合同',
//            ContractAmount__c = 123456,
//            DeliveryStatus__c = 'test',
//            PaymentRate__c = '1234',
//            End_User_price__c = 0,
//            AssignmentStatus__c = '全部分配',
//            Last_week__c = '5 货齐,未付款,无用户合同',
//            X2weeks_ago__c = '4 备货中',
//            X3Weeks_ago__c = '3 已付款,无用户合同',
//            X4weeks_ago__c = '2 待付款',
//            X5weeks_ago__c = '1 全没有'
//        );
//        insert sta;
//        Opportunity opp1 = [Select Id, SAP_Send_OK__c, Note_Residual_Result__c, Min_FirstApproveDate__c, Contract_Once_Recognize_Day__c from Opportunity where Id =: opp.Id];
//        System.assertEquals(true, opp1.SAP_Send_OK__c);
//        System.assertEquals('4', opp1.Note_Residual_Result__c);
//        System.assertEquals(null, opp1.Min_FirstApproveDate__c);
//        System.assertEquals(null, opp1.Contract_Once_Recognize_Day__c);
 
//        NFM010WebService.Achievement Achievement = new NFM010WebService.Achievement();
//        NFM010WebService.Achievements Achievements = new NFM010WebService.Achievements();
//        Achievements.Achievement = new NFM010WebService.Achievement[] { Achievement };
 
//        // Monitoringの設定
//        Datetime nowDT = Datetime.now();
//        String nowStr = nowDT.format('yyyyMMddHHmm');
//        Achievements.Monitoring = new NFMUtil.Monitoring();
//        Achievements.Monitoring.MessageGroupNumber = nowStr + '21';
 
//        // update
//        Achievement.QuotationCode         = opp.Opportunity_No__c;
//        Achievement.SoNo                  = 'NFM010Tst1';
//        Achievement.ReturnFlag            = '';
//        Achievement.OverviewStatus        = '初审通过';
//        Achievement.ContractNO            = 'GD-GYN-121999';
//        Achievement.ContractReceivedDate  = '20120125';
//        Achievement.FirstApproveDate      = '20120225';
//        Achievement.SecondApproveDate     = '20120325';
//        Achievement.SoLatestDeliveryDate  = '20120425';
//        Achievement.DeliveryDate          = '20120525';
//        Achievement.InstallDate           = '20120625';
//        Achievement.TimeLimit             = 20120725;
//        Achievement.Currency_x            = 'USD';
//        Achievement.ContractAmount        = 2345.12;
//        Achievement.PaymentAmount         = 345.12;
//        Achievement.PaymentRate           = '14.17%,20171111';
//        Achievement.DeliveryStatus        = '已完全交付';
//        Achievement.AssignmentStatus      = '全部分配';
//        Achievement.PaymentStatus         = '退款完成';
//        Achievement.InstallStatus         = '部分安装';
//        Achievement.AuthorizationNo       = 'AUTH54365465';
//        Achievement.ContractApplicationNo = 'ApplicationNo643242';
//        Achievement.PaymentTerms          = '款不到不发货';
//        Achievement.SalesChannel          = 3;
 
//        System.Test.startTest();
//        NFM010WebService.NFM010(Achievements);
//        System.Test.stopTest();
//        List<BatchIF_Log__c> bl = [Select Id, Is_Error__c, Type__c, Log__c, ErrorLog__c from BatchIF_Log__c where RowDataFlg__c = false and Type__c = 'NFM010' order by CreatedDate desc];
//        System.assertEquals(1, bl.size());
//        System.assertEquals(null, bl[0].ErrorLog__c);
        
//        String statu_Achievements_Ext = Achievement.QuotationCode + ':' + Achievement.SoNo;
//        Statu_Achievements__c[] rslts = [select Id, Name, Opportunity__r.Opportunity_No__c,
//                                                Statu_Achievements_Ext__c, ReturnFlag__c, OverviewStatus__c, ContractNO__c,
//                                                ContractReceivedDate__c, FirstApproveDate__c, LastApproveDate__c,
//                                                SoLatestDeliveryDate__c, DeliveryDate__c, InstallDate__c, Collection_Day_Invoice__c, UnshippedAmount__c,
//                                                CurrencyIsoCode, ContractAmount__c, PaymentAmount__c, PaymentRate__c,
//                                                DeliveryStatus__c, AssignmentStatus__c, PaymentStatus__c, InstallStatus__c, 
//                                                AuthorizationNo__c, ContractApplicationNo__c, PaymentTerms__c, SalesChannel__c,
//                                                End_User_Price__c
//                                           from Statu_Achievements__c where Statu_Achievements_Ext__c = :statu_Achievements_Ext];
//        System.assertEquals(1, rslts.size());
//        if (rslts.size() == 1) {
//            System.assertEquals(Achievement.QuotationCode, rslts[0].Opportunity__r.Opportunity_No__c);
//            System.assertEquals(Achievement.SoNo, rslts[0].Name);
//            System.assertEquals(false, rslts[0].ReturnFlag__c);
//            System.assertEquals(Achievement.OverviewStatus, rslts[0].OverviewStatus__c);
//            System.assertEquals(Achievement.ContractNO, rslts[0].ContractNO__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.ContractReceivedDate), rslts[0].ContractReceivedDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.FirstApproveDate), rslts[0].FirstApproveDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.SecondApproveDate), rslts[0].LastApproveDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.SoLatestDeliveryDate), rslts[0].SoLatestDeliveryDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.DeliveryDate), rslts[0].DeliveryDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date(Achievement.InstallDate), rslts[0].InstallDate__c);
//            System.assertEquals(System.today(), rslts[0].Collection_Day_Invoice__c);
//            System.assertEquals(Achievement.TimeLimit, rslts[0].UnshippedAmount__c);
//            System.assertEquals('USD', rslts[0].CurrencyIsoCode);
//            System.assertEquals(Achievement.ContractAmount, rslts[0].ContractAmount__c);
//            System.assertEquals(Achievement.PaymentAmount, rslts[0].PaymentAmount__c);
//            System.assertEquals('14.17%', rslts[0].PaymentRate__c);
//            System.assertEquals(Achievement.DeliveryStatus, rslts[0].DeliveryStatus__c);
//            System.assertEquals(Achievement.AssignmentStatus, rslts[0].AssignmentStatus__c);
//            System.assertEquals(Achievement.PaymentStatus, rslts[0].PaymentStatus__c);
//            System.assertEquals(Achievement.InstallStatus, rslts[0].InstallStatus__c);
//            System.assertEquals(Achievement.AuthorizationNo, rslts[0].AuthorizationNo__c);
//            System.assertEquals(Achievement.ContractApplicationNo, rslts[0].ContractApplicationNo__c);
//            System.assertEquals(Achievement.PaymentTerms, rslts[0].PaymentTerms__c);
////            System.assertEquals('販売店', rslts[0].SalesChannel__c);
//            System.assertEquals(3.0, rslts[0].End_User_Price__c);
//            opp1 = [Select Id, Min_FirstApproveDate__c, Contract_Once_Recognize_Day__c from Opportunity where Id =: opp.Id];
//            System.assertEquals(NFMUtil.parseStr2Date('20120225'), opp1.Min_FirstApproveDate__c);
//            System.assertEquals(NFMUtil.parseStr2Date('20120225'), opp1.Contract_Once_Recognize_Day__c);
//        }
//    }
    static testMethod void testNFM010_resend() {
        Opportunity opp = makeTestOpp();
 
        NFM010WebService.Achievement Achievement = new NFM010WebService.Achievement();
        NFM010WebService.Achievement Achievement2 = new NFM010WebService.Achievement();
        NFM010WebService.Achievements Achievements = new NFM010WebService.Achievements();
        Achievements.Achievement = new NFM010WebService.Achievement[] { Achievement, Achievement2 };
 
        // Monitoringの設定
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        Achievements.Monitoring = new NFMUtil.Monitoring();
        Achievements.Monitoring.MessageGroupNumber = nowStr + '11';
 
        // insert
        Achievement.QuotationCode         = opp.Opportunity_No__c;
        Achievement.SoNo                  = 'NFM010Tst1';
        Achievement.ReturnFlag            = '';
        Achievement.OverviewStatus        = '无效合同';
        Achievement.ContractNO            = 'GD-GYN-121668';
        Achievement.ContractReceivedDate  = '20120114';
        Achievement.FirstApproveDate      = '20120214';
        Achievement.SecondApproveDate     = '20120314';
        Achievement.SoLatestDeliveryDate  = '20120414';
        Achievement.DeliveryDate          = '20120514';
        Achievement.InstallDate           = '20120614';
        Achievement.TimeLimit             = 20120714;
        Achievement.Currency_x            = 'RMB';
        Achievement.ContractAmount        = 12345.12;
        Achievement.PaymentAmount         = 2345.12;
        Achievement.PaymentRate           = '17.99%,20171111';
        Achievement.DeliveryStatus        = '交付';
        Achievement.AssignmentStatus      = '分配';
        Achievement.PaymentStatus         = '完成';
        Achievement.InstallStatus         = '安装';
        Achievement.AuthorizationNo       = 'AUTH123432154';
        Achievement.ContractApplicationNo = 'ApplicationNo345674';
        Achievement.PaymentTerms          = '发货';
        Achievement.SalesChannel          = 3;
 
        Achievement2.QuotationCode         = opp.Opportunity_No__c;
        Achievement2.SoNo                  = 'NFM010Tst1';              // 同じ番号なので、1つの注残として登録
        Achievement2.ReturnFlag            = 'Y';
        Achievement2.OverviewStatus        = '无效合同';
        Achievement2.ContractNO            = 'GD-GYN-121668';
        Achievement2.ContractReceivedDate  = '20120115';
        Achievement2.FirstApproveDate      = '20120215';
        Achievement2.SecondApproveDate     = '20120315';
        Achievement2.SoLatestDeliveryDate  = '20120415';
        Achievement2.DeliveryDate          = '20120515';
        Achievement2.InstallDate           = '19000101';
        Achievement2.TimeLimit             = 20120715;
        Achievement2.Currency_x            = 'RMB';
        Achievement2.ContractAmount        = 12345.12;
        Achievement2.PaymentAmount         = 2345.12;
        Achievement2.PaymentRate           = '18.99%,20171111';
        Achievement2.DeliveryStatus        = '未交付';
        Achievement2.AssignmentStatus      = '部分分配';
        Achievement2.PaymentStatus         = '尾款完成';
        Achievement2.InstallStatus         = '全部安装';
        Achievement2.AuthorizationNo       = 'AUTH123432153';
        Achievement2.ContractApplicationNo = 'ApplicationNo345678';
        Achievement2.PaymentTerms          = '款到发货';
        Achievement2.SalesChannel          = 1;
 
        System.Test.startTest();
        NFM010WebService.NFM010(Achievements);
        System.Test.stopTest();
 
        List<BatchIF_Log__c> rowbl = [Select Id, Log__c, ErrorLog__c
                                        from BatchIF_Log__c
                                        where RowDataFlg__c = true
                                        and Type__c = 'NFM010'
                                        order by CreatedDate desc];
        System.assertEquals(1, rowbl.size());
        rowbl[0].retry_cnt__c = 1;
        update rowbl;
        NFM010WebService.execute(rowbl[0].id);
        List<BatchIF_Log__c> bl = [Select Id, Is_Error__c,
                Type__c, Log__c, ErrorLog__c,retry_cnt__c
                from BatchIF_Log__c
                where Id = :rowbl[0].id];
        //System.assertEquals(0, bl[0].retry_cnt__c);
    }
}