buli
2023-04-26 d6a096fadfe9c8f261f56a827cfceed663c36b8b
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
import { LightningElement, track, wire ,api} from 'lwc';
 
import blockUIcss from '@salesforce/resourceUrl/blockUIcss';
import jquery183minjs from '@salesforce/resourceUrl/jquery183minjs';
import PleaseWaitDialog from '@salesforce/resourceUrl/PleaseWaitDialog';
 
 
 
// import getCl  from "@salesforce/apex/SearchProductController.getCl";
 
 
import Product_Search from '@salesforce/label/c.Product_Search';
import Search_Condition from '@salesforce/label/c.Search_Condition';
import Asset_No  from '@salesforce/label/c.Asset_No';
import Search  from '@salesforce/label/c.Search';
import Add_Product  from '@salesforce/label/c.Add_Product';
import Search_Result  from '@salesforce/label/c.Search_Result';
import Selected  from '@salesforce/label/c.Selected';
import SFDA_Status  from '@salesforce/label/c.SFDA_Status';
import ListPrice_In  from '@salesforce/label/c.ListPrice_In';
import ListPrice_Out  from '@salesforce/label/c.ListPrice_Out';
import Unit  from '@salesforce/label/c.Unit';
 
const columns = [
    { label: '选择', fieldName: 'Selected'  },
    { label: '产品型号', fieldName: 'Asset_No' },
    { label: '产品编码', fieldName: '{!$ObjectType.Product2.fields.OT_CODE_no_link__c.Label}' },
    { label: '产品名称', fieldName: 'Product_Name' },
    { label: '适用科室', fieldName: '{!$ObjectType.Product2.fields.suitDepartment__c.Label}' },
    { label: '代替产品', fieldName: '{!$ObjectType.Product2.fields.Alternative_Products__c.Label}' },
    { label: 'NMPA状态', fieldName: 'SFDA_Status', },
    { label: 'ListPrice(内贸)', fieldName: 'ListPrice_Out' },
    { label: 'ListPrice(外贸)', fieldName: 'ListPrice_In' },
    { label: '规格', fieldName: 'Specifications' },
 
];
export default class lexSearchProduct extends LightningElement {
 
 
    Label = {
        Product_Search,
        Search_Condition,
        Asset_No,
        Search,
        Add_Product,
        Search_Result,
        Selected,
        SFDA_Status,
        ListPrice_In,
        ListPrice_Out,
        Unit
    }
 
 
 
 
    @api recordId;
    IsLoading=true;
    inputData;
    data = [];
    columns = columns;
 
    connectedCallback(){
        // const data = getCl();
        // this.data = data;
    }
 
 
 
    getInput(event){
        this.inputData=event.detail.value;
 
    }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
     
        // var QuoteEntryMaxLine = window.opener.QuoteEntryMaxLine;
        setProductList() {
            var nextLine = top.window.opener.getLastLineNoNext(window.opener.document);
            var hasCheckedCnt = 0;
            var checklist = j$("input[name='checklist']");
            for(var i=0; i<checklist.length; i++){
                if (checklist[i].checked) {
                    hasCheckedCnt++;
                    //HWAG-BLWB9F 询价报价:多年保产品未登录计提金额时不可报价 精琢技术  20200224 start
                     var Intra_Trade_Gurantee_RMB = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_RMB__c")).val();
                     var GuranteeType = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":GuranteeType")).val();
 
                     //是否登录报价
                     var Estimation_Entry_Possibility =j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Estimation_Entry_Possibility")).val();
                     //内贸成本
                     var CostFlag = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":CostFlag")).val();
 
                     //内外贸
                     var trade = window.opener.j$(escapeVfId("Page:mainForm:block:CurrencyIsoCode")).val();
 
                     //内贸报价金额
                     var Intra_Trade_List_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_List_RMB__c")).text();
                     //外贸报价金额
                     var Foreign_Trade_List_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_List_US__c")).text();
                     //外贸成本
                     var Foreign_Trade_Cost_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_Cost_US__c")).val();
 
                     //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  start 
                     var Intra_Trade_Gurantee_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_USD__c")).val();
 
                     var Intra_Trade_Service_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_USD__c")).val();
 
                     var Maintenance_Price_Year_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Maintenance_Price_Year_USD__c")).val();
                     //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  end
 
 
                     //内贸
                      if(trade == "CNY") {
                        //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 start 
                        // if((GuranteeType == '市场'||GuranteeType == '服务' ) &&Intra_Trade_Gurantee_RMB <=0){
                           
                        //     alert('多年保产品未登录计提金额时不可报价!');
                        // }else
                        //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 end
                        if(Estimation_Entry_Possibility == 'true'){
                            alert('产品未登录报价时不可报价!');
                        }else if(CostFlag == 'true'){
                            alert('产品的成本为空时不可报价!');
                        }else if(Intra_Trade_List_RMB__c == ''||Intra_Trade_List_RMB__c<0){
                            alert('产品的报价金额为空时不可报价!');
                        }else{
                            if (nextLine < QuoteEntryMaxLine) {
                                    SetProductId(nextLine, i);
                                    nextLine++;
                                 } else {
                                         alert('Over Max Line ' + QuoteEntryMaxLine);
                                             return false;
                            }
                        }
                        //外贸
                      }else if(trade == "USD"){
                        //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 start 
                        //外贸多年保 增加判断同内贸 精琢技术 wql 2021/01/21 start
                        // if((GuranteeType == '市场'||GuranteeType == '服务' ) &&Intra_Trade_Gurantee_USD <=0){
                           
                        //     alert('多年保产品未登录计提金额时不可报价!');
                        // }else
                        //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 end 
                        if(Estimation_Entry_Possibility == 'true'){
                            alert('产品未登录报价时不可报价!');
                        } 
                        //外贸多年保 增加判断同内贸 精琢技术 wql 2021/01/21 end
                        else if(Foreign_Trade_List_US__c ==''||Foreign_Trade_List_US__c<0 ){
                                alert('产品的报价金额为空时不可报价!');
                            }else if(Foreign_Trade_Cost_US__c == ''||Foreign_Trade_Cost_US__c<0){
                                 alert('产品的成本为空时不可报价!');
                            }else{
                                if (nextLine < QuoteEntryMaxLine) {
                                    SetProductId(nextLine, i);
                                    nextLine++;
                                 } else {
                                         alert('Over Max Line ' + QuoteEntryMaxLine);
                                             return false;
                            }
                            }
                      }
 
                    
                    //HWAG-BLWB9F 询价报价:多年保产品未登录计提金额时不可报价 精琢技术  20200224 end
                }
            }
            if (hasCheckedCnt == 0) {
                alert(top.window.opener.Error_Message34);
                return false;
            }
            top.window.opener.calPriceAll();
            top.window.close();
        }
        setProductOne(lineno, i) {
            //lineno = getLastLineNo();
            //HWAG-BLWB9F 询价报价:多年保产品未登录计提金额时不可报价 精琢技术  20200224 start
            var Intra_Trade_Gurantee_RMB = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_RMB__c")).val();
            var GuranteeType = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":GuranteeType")).val();
            //是否登录报价
            var Estimation_Entry_Possibility =j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Estimation_Entry_Possibility")).val();
            //内贸成本
             var CostFlag = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":CostFlag")).val();
              //内外贸
             var trade = window.opener.j$(escapeVfId("Page:mainForm:block:CurrencyIsoCode")).val();
 
             //内贸报价金额
             var Intra_Trade_List_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_List_RMB__c")).text();
             //外贸报价金额
             var Foreign_Trade_List_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_List_US__c")).text();
             //外贸成本
             var Foreign_Trade_Cost_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_Cost_US__c")).val();  
             //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  start 
             var Intra_Trade_Gurantee_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_USD__c")).val();
 
             var Intra_Trade_Service_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_USD__c")).val();
 
             var Maintenance_Price_Year_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Maintenance_Price_Year_USD__c")).val();
             //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  end
 
             //内贸
              if(trade == "CNY") {
                //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 start 
                // if((GuranteeType == '市场'||GuranteeType == '服务' ) &&Intra_Trade_Gurantee_RMB <=0){
                   
                //     alert('多年保产品未登录计提金额时不可报价!');
                // }else 
                //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 end 
                if(Estimation_Entry_Possibility == 'true'){
                    alert('产品未登录报价时不可报价!');
                }else if(CostFlag == 'true'){
                    alert('产品的成本为空时不可报价!');
                }else if(Intra_Trade_List_RMB__c == ''||Intra_Trade_List_RMB__c<0){
                    alert('产品的报价金额为空时不可报价!');
                }else{
                     SetProductId(lineno, i);
                }
                //外贸
              }else if(trade == "USD"){
              //外贸多年保 增加判断同内贸 精琢技术 wql 2021/01/21 start 
              //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 start 
              // if((GuranteeType == '市场'||GuranteeType == '服务' ) &&Intra_Trade_Gurantee_USD <=0){
                   
              //       alert('多年保产品未登录计提金额时不可报价!');
              //   }else 
              //WLIG-BXVB6M 【委托】【紧急】取消报价单中多年保计提金额为0的检查 精琢技术 2021/02/03 end 
                if(Estimation_Entry_Possibility == 'true'){
                    alert('产品未登录报价时不可报价!');
                }
              //外贸多年保 增加判断同内贸 精琢技术 wql 2021/01/21 end 
                else if(Foreign_Trade_List_US__c ==''||Foreign_Trade_List_US__c<0 ){
                        alert('产品的报价金额为空时不可报价!');
                    }else if(Foreign_Trade_Cost_US__c == ''||Foreign_Trade_Cost_US__c<0){
                         alert('产品的成本为空时不可报价!');
                    }else{
                         SetProductId(lineno, i);
                    }
              }
           //HWAG-BLWB9F 询价报价:多年保产品未登录计提金额时不可报价 精琢技术  20200224 end
            top.window.opener.calPriceAll();
            top.window.close();
        }
        SetProductId(lineno, i) {
            var Asset_Model_No__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Asset_Model_No__c")).text();
            var Product2Id = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Product_Id")).val();
            var SFDA_Status__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SFDA_Status__c")).text();
            var SFDA_Status = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":SFDA_Status")).val();
 
            //SFDC停止预警(预计消耗到期日) lt 20210929 add start
            var Estimated_ConsumptionDueDate__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Estimated_ConsumptionDueDate")).text();
            //SFDC停止预警(预计消耗到期日) lt 20210929 add end
 
            var name = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Name")).text();
            var Intra_Trade_List_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_List_RMB__c")).text();
            var Foreign_Trade_List_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_List_US__c")).text();
            var NameCode = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":NameCode")).val();
            var Sales_Possibility = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Sales_Possibility")).val();
            var Intra_Trade_Cost_RMB__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Cost_RMB__c")).val();
            var Foreign_Trade_Cost_US__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Foreign_Trade_Cost_US__c")).val();
            var Packing_list_manual__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Specifications")).value();
            var Bsscategory = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Bsscategory")).val();
            var PricebookEntryId = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":PricebookEntryId")).val();
            var trade = window.opener.j$(escapeVfId("Page:mainForm:block:CurrencyIsoCode")).val();
            var StorageStatus__c = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":StorageStatus__c")).val();
            //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  start 
             var Intra_Trade_Gurantee_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_USD__c")).val();
 
             var Intra_Trade_Service_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_USD__c")).val();
 
             var Maintenance_Price_Year_USD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Maintenance_Price_Year_USD__c")).val();
             //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql  end
            // Packing_list_manual__c = parseFloat(Packing_list_manual__c).toFixed(1);
 
            //库存状态
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Storagestatustext")).text(StorageStatus__c);
 
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Storagestatus")).val(StorageStatus__c);
 
            //No
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":indexNo")).text(parseInt(lineno)+1);
 
            //製品型番
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Assert")).val(Asset_Model_No__c);
 
             //Status__c
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Status__c")).text(SFDA_Status__c);
            
            //SFDC停止预警(预计消耗到期日) lt 20210929 add start
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Estimated_ConsumptionDueDate")).text(Estimated_ConsumptionDueDate__c);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Estimated_ConsumptionDueDate1")).text(Estimated_ConsumptionDueDate__c);
            //SFDC停止预警(预计消耗到期日) lt 20210929 add end
 
            //SFDA hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":SFDA")).val(SFDA_Status);
 
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Specifications")).val(Packing_list_manual__c);
 
            //品目名
            var baseUrl = window.opener.j$(escapeVfId("Page:mainForm:block:baseUrl")).val();
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Nametext1")).attr("href", baseUrl + "/" + Product2Id);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Nametext1")).text(name);
            //品目名hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Name__c")).val(name);
 
            //ListPrice
            var ListPrice = 0;
            var Cost_c = 0;
            //多年保修 start
            var Extend_new_product_gurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee__c")).val();
 
            var Extend_new_product_gurantee_MD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee_MD__c")).val();
 
            var GuranteeType = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":GuranteeType")).val();
 
            var Entend_gurantee_period_all = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Entend_gurantee_period_all__c")).val();
            var Intra_Trade_Gurantee_RMB = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Gurantee_RMB__c")).val();
 
            var Intra_Trade_Service_RMB = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Intra_Trade_Service_RMB__c")).val();
 
            var Maintenance_Price_Year  = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Maintenance_Price_Year__c")).val();
            // 供应商名称 
            var VenderName = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":VenderName")).val();
            //不可取消多年保
            var CanNotCancelledGurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":CanNotCancelledGurantee")).val();
 
            //阿西赛多
            var Is_DangerousChemicals = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Is_DangerousChemicals")).val();
 
            var ProductGuranteePrice = 0;
            var ProductServicePrice = 0;
            var productMaintenance_Price_Year = 0;
            //多年保修 end
            if(trade == "CNY") {
               //多年保修 start
               ProductGuranteePrice                  = Intra_Trade_Gurantee_RMB;
               ProductServicePrice                   = Intra_Trade_Service_RMB;
               productMaintenance_Price_Year         = Maintenance_Price_Year;
               //多年保修 end
               ListPrice = Intra_Trade_List_RMB__c;
               Cost_c = Intra_Trade_Cost_RMB__c;
 
            } else if(trade == "USD"){
               //多年保修 start
               //外贸多年保 取产品主数据上的金额 以及 报价 精琢技术 wql start
               ProductGuranteePrice                  = Intra_Trade_Gurantee_USD;
               ProductServicePrice                   = Intra_Trade_Service_USD;
               productMaintenance_Price_Year         = Maintenance_Price_Year_USD;
               //外贸多年保 取产品主数据上的金额 以及 报价 精琢技术 wql end
               //多年保修 end
               ListPrice = Foreign_Trade_List_US__c;
               Cost_c = Foreign_Trade_Cost_US__c;
            }
            Cost_c = top.window.opener.toNum(Cost_c);
            ListPrice = top.window.opener.toNum(ListPrice);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPricetext")).text(top.window.opener.toNumComma(ListPrice));
            //ListPrice hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":ListPrice")).val(ListPrice);
 
            //数量
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Quantity")).val(1);
 
            //価格
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":UnitPrice")).val(top.window.opener.toNumComma(ListPrice));
 
            //规格
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Specifications")).text(Packing_list_manual__c);
 
            //小計
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":TotalPrice")).text(top.window.opener.toNumComma(ListPrice));
 
            //Subtotal__c hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Subtotal__c")).val(ListPrice);
 
            //NameCode hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":NameCode")).val(NameCode);
 
            //Specifications hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Specifications")).val(Packing_list_manual__c);
 
            //Product_Name hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Name")).val(name);
 
            //SFDC停止预警(预计消耗到期日) lt 20210929 add start
            //产品 预计消耗日
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Estimated_ConsumptionDueDate")).val(Estimated_ConsumptionDueDate__c);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Estimated_ConsumptionDueDate1")).val(Estimated_ConsumptionDueDate__c);
            MarkRedFLG(lineno,Estimated_ConsumptionDueDate__c);
            //SFDC停止预警(预计消耗到期日) lt 20210929 add end
 
            //Product_SFDA hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_SFDA")).val(SFDA_Status__c);
 
            //Sales_Possibility hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Sales_Possibility")).val(Sales_Possibility);
 
            //Product_ListPrice hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_ListPrice")).val(ListPrice);
 
            //Product_Cost hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Cost")).val(Cost_c);
 
            //Cost hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Cost")).val(Cost_c);
 
            //CostSubTotal hidden Cost_c * Quantity;
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":CostSubTotal")).val(Cost_c);
 
            //Bsscategory hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Bsscategory")).val(Bsscategory);
 
            //Product_Id hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":Product_Id")).val(Product2Id);
 
            //PricebookEntryId hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":PricebookEntryId")).val(PricebookEntryId);
 
            //lineNo hidden
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno +":lineNo")).val(parseInt(lineno));
            // 多年保修 2019/07/25 start
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":ProductEntend_gurantee_period_all__c")).val(Entend_gurantee_period_all);
 
            // 维修合同报价
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":Maintenance_Price_Year__c")).val(productMaintenance_Price_Year);
            // 最新维修合同报价
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":latestMaintenance_Price_Year")).val(productMaintenance_Price_Year);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":GuranteeType")).val(GuranteeType);
            // 供应商名称
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":VenderName")).text(VenderName);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":VenderName__c")).val(VenderName);
            //不可取消多年保
            
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":CanNotCancelledGurantee__c")).val(CanNotCancelledGurantee);
 
            //阿西赛多
            
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                +":Is_DangerousChemicals__c")).val(Is_DangerousChemicals);
 
            if(VenderName != 'OSH'&&VenderName != ''){
                window.opener.j$(escapeVfId('Page:mainForm:block:lists:'+lineno+':UnitPrice')).attr('disabled','disabled');
            }
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                + ":ProductGuranteePrice__c")).val(ProductGuranteePrice);
            window.opener.j$(escapeVfId("Page:mainForm:block:lists:"+ lineno
                + ":productServicePrice__c")).val(ProductServicePrice);
            // 多年保修 2019/07/25 end
        }
 
        // //SFDC停止预警 lt 20211008 start
        MarkRedFLG(lineno,Estimated_ConsumptionDueDate__c){
            
            //获取当前日期(currentdate)
            var date1 = new Date();
            var seperator = "/";
            var year = date1.getFullYear();
            var month = date1.getMonth() + 1;
            var day = date1.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (day >= 0 && day <= 9) {
                day = "0" + day;
            }
            var currentdate = year + seperator + month + seperator + day;
 
            //预计消耗到期日  -  当前日  相差天数(difDate)
            var ndate = new Date(currentdate);
            var nowDate = ndate.getTime();
            var edate = new Date(Estimated_ConsumptionDueDate__c);
            var endDate = edate.getTime();
            var difDate = (endDate - nowDate)/((1000 * 60 * 60 * 24));
 
            //判断
            if(difDate < 90){
                window.opener.document.getElementById('Page:mainForm:block:lists:' + lineno + ':Estimated_ConsumptionDueDate').style.color = "red";
            }
        }
        //SFDC停止预警 lt 20211008 end
    
}