高章伟
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
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
public without sharing class FixtureRemindForAgencyRequestController {
 
    public final static List<String> BSC_STATUS_LIST {set;get;}         //办事处页面展示数据
    public final static List<String> BSC_ADDR_LIST {set;get;}         //办事处页面展示数据
    private static Map<String, String> BSC_NAME_MAP;                    //办事处页面展示数据
    private static List<String> BSC_ADDR_DB_LIST;         //东北办事处页面展示数据
    private static List<String> BSC_ADDR_HB_LIST;         //华北办事处页面展示数据
    private static List<String> BSC_ADDR_XB_LIST;         //西北办事处页面展示数据
    private static List<String> BSC_ADDR_XN_LIST;         //西南办事处页面展示数据
    private static List<String> BSC_ADDR_HN_LIST;         //华南办事处页面展示数据
    private static List<String> BSC_ADDR_HD_LIST;         //华东办事处页面展示数据
    public FixtureRemindSnapshot__c snap{get;set;}
 
    public Map<String,Map<String,Integer>> allmap = new Map<String,Map<String,Integer>>();
 
 
     //定义一大堆省份/城市的map 其实如果定义为上面那种的话也可以 后面也会有一点判断 包括 '哈尔滨 -> 黑龙江' 或者 省份不存在时展示0  要更好一点 
    //但是前端展示的时候,不好展示,需要在repeat里才能正确展示 并且需要一个key值 即 城市/省份 来取得 xx状态下的数据,会循环很多遍,这个没有解决,所以定义了一大堆map..
    public Map<String, Integer> dlmap {set;get;} // 大连
    public Map<String, Integer> symap {set;get;} // 沈阳
    public Map<String, Integer> ccmap {set;get;} // 长春
    public Map<String, Integer> hrbmap {set;get;} // 哈尔滨
    public Map<String, Integer> bjmap {set;get;} // 北京 // 20220114 ljh add
    public Map<String, Integer> sjzmap {set;get;} // 石家庄
    public Map<String, Integer> tjmap {set;get;} // 天津
    public Map<String, Integer> hhhtmap {set;get;} // 呼和浩特
    public Map<String, Integer> jnmap {set;get;} // 济南
    public Map<String, Integer> qdmap {set;get;} // 青岛
    public Map<String, Integer> sxmap {set;get;} // 陕西
    public Map<String, Integer> shxmap {set;get;} // 山西
    public Map<String, Integer> hnmap {set;get;} // 河南
    public Map<String, Integer> qhmap {set;get;} // 青海
    public Map<String, Integer> mapnx {set;get;} // 宁夏
    public Map<String, Integer> xjmap {set;get;} // 新疆
    public Map<String, Integer> gsmap {set;get;} // 甘肃
    public Map<String, Integer> cdmap {set;get;} // 成都
    public Map<String, Integer> cqmap {set;get;} // 重庆
    public Map<String, Integer> gymap {set;get;} // 贵阳
    public Map<String, Integer> kmmap {set;get;} // 昆明
    public Map<String, Integer> whmap {set;get;} // 武汉
    public Map<String, Integer> csmap {set;get;} // 长沙
    public Map<String, Integer> nnmap {set;get;} // 南宁
    public Map<String, Integer> mapgz {set;get;} // 广州
     public Map<String, Integer> szmap {set;get;} // 深圳 // 20220114 ljh add
    public Map<String, Integer> shmap {set;get;} // 上海
    public Map<String, Integer> njmap {set;get;} // 南京
    public Map<String, Integer> hzmap {set;get;} // 杭州
    public Map<String, Integer> ncmap {set;get;} // 南昌
    public Map<String, Integer> hfmap {set;get;} // 合肥
    public Map<String, Integer> fzmap {set;get;} // 福州
 
    public Boolean canshowdongbei {get;set;}
    public Boolean canshowhuabei {get;set;}
    public Boolean canshowxibei {get;set;}
    public Boolean canshowxinan {get;set;}
    public Boolean canshowhuanan {get;set;}
    public Boolean canshowhuadong {get;set;}
    // private String ownerProvince ; // 20220111 ljh update 
    public Boolean hasAuthority {get;set;}
    public String showStyle {get;set;}
    public Boolean isBenBu {get;set;}
    private OlympusCalendar__c today;
    private String nowTimeOption; 
    //add by rentx 20210902 start 
    public Boolean canshowData {get;set;}
    //add by rentx 20210902 end
 
    public List<SelectOption> showStyles{get;set;}
 
    public FixtureRemindForAgencyRequestController() {
        
        this.snap = new FixtureRemindSnapshot__c();
        snap.Date__c = System.today();
        dlmap = new Map<String, Integer>();
        symap = new Map<String, Integer>();
        ccmap = new Map<String, Integer>();
        bjmap = new Map<String, Integer>(); // 202201014 ljh add
        tjmap = new Map<String, Integer>();
        jnmap = new Map<String, Integer>();
        qdmap = new Map<String, Integer>();
        sxmap = new Map<String, Integer>();
        hnmap = new Map<String, Integer>();
        qhmap = new Map<String, Integer>();
        mapnx = new Map<String, Integer>();
        xjmap = new Map<String, Integer>();
        gsmap = new Map<String, Integer>();
        cdmap = new Map<String, Integer>();
        cqmap = new Map<String, Integer>();
        gymap = new Map<String, Integer>();
        kmmap = new Map<String, Integer>();
        whmap = new Map<String, Integer>();
        csmap = new Map<String, Integer>();
        nnmap = new Map<String, Integer>();
        mapgz = new Map<String, Integer>();
        szmap = new Map<String, Integer>(); // 202201014 ljh add
        shmap = new Map<String, Integer>();
        njmap = new Map<String, Integer>();
        hzmap = new Map<String, Integer>();
        ncmap = new Map<String, Integer>();
        hfmap = new Map<String, Integer>();
        fzmap = new Map<String, Integer>();
        hrbmap = new Map<String, Integer>();
        sjzmap = new Map<String, Integer>();
        hhhtmap = new Map<String, Integer>();
        shxmap = new Map<String, Integer>();
        hasAuthority = false;
        showStyle = '本部';
        canshowData = true;
        // showStyle = '办事处';
        showStyles = new List<SelectOption>();
        showStyles.add(new SelectOption('本部','本部'));
        showStyles.add(new SelectOption('办事处','办事处'));
        isBenBu = true;
        // isBenBu = false;
        // 20220117 ljh update start
        User currentUser = [SELECT UserRole.Name, ProfileId,Post__c,Dept__c  FROM User WHERE Id=: UserInfo.getUserId()]; 
        // User currentUser = [SELECT UserRole.Name, ProfileId,OCM_man_province_Rental__c,Default_Referable_Apply_Equipment_Center__c,Dept__c  FROM User WHERE Id=: UserInfo.getUserId()]; 
        List<OCM_Management_Province__c> opList = [SELECT id FROM  OCM_Management_Province__c WHERE Agency_assistant1__c = :UserInfo.getUserId()  OR Agency_assistant2__c = :UserInfo.getUserId() LIMIT 1];
        Boolean isZL = opList.size() > 0;
        // 备品总窗口
        Boolean BeiPinWindow = false;
        Map<String,String> IdMap = new Map<String,String>();
        //查询公用小组成员
        List<Group> gList = [ SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = 'OPD营业插队组'];
        if (gList != null && gList.size() > 0) {
            for (Group g : gList) {
                for (GroupMember gm : g.groupMembers) {
                    IdMap.put(gm.userOrGroupId,gm.userOrGroupId);
                }
            }
        }
        if(IdMap.containsKey(UserInfo.getUserId())){
            BeiPinWindow = true;
        }
        // 20220117 ljh update end 
        //用于判断营业本部和备品中心
        String roleName = String.valueOf(currentUser.UserRole.Name);
        //用于判断 办事处助理根据所在位置查看所属大区的数据信息注释by rentx 20210902
        // String addr = String.valueOf(currentUser.Default_Referable_Apply_Equipment_Center__c);
        //简档是否是办事处助理简档 注释by rentx 20210902
        // Boolean iscontainsLabel = System.Label.AgencyProfileId.contains(currentUser.ProfileId);
        Boolean iscontainsLabelFornewbsc = System.Label.AgencyProfileIdForBsc.contains(currentUser.ProfileId);
        // 20220117 ljh add start
        String postName = String.valueOf(currentUser.Post__c);
        List<String> postL = System.Label.AgencyPostForBsc.split(';');
        Boolean iscontainsPost = postL.contains(postName);
        // 20220117 ljh add end
        //拿 本部(选项 判断本部)
        String addr = String.valueOf(currentUser.Dept__c);  
        nowTimeOption = nowTimeToOption();  
        try{
            today = [SELECT Before_1_WorkDay__c FROM OlympusCalendar__c WHERE Date__c=:System.today()];
        }
        catch(Exception e){
            today = new OlympusCalendar__c(Date__c=System.today(), Before_1_WorkDay__c = System.today().addDays(-1));
        }
        //简档 2S9_备品窗口 可以看全部
        //add by rentx 20210901 end WLIG-C4VDUX
        // if (System.Label.ProfileId_EquCenAdmin.contains(currentUser.ProfileId) || System.Label.s9BPChuangkou.contains(currentUser.ProfileId) || roleName == '备品运营部' || roleName == '医疗备品管理中心'){
        if (System.Label.ProfileId_EquCenAdmin.contains(currentUser.ProfileId)  || roleName == '备品运营部' || roleName == '医疗备品管理中心' || BeiPinWindow){
            this.hasAuthority     = true;
            this.canshowdongbei     =true;                                                                            
            this.canshowhuabei      =true;
            this.canshowxibei       =true;
            this.canshowxinan       =true;
            this.canshowhuanan      =true;
            this.canshowhuadong     =true;
        }else if (roleName == '备品中心北方管理成员') {
            this.canshowdongbei     =true;
            this.canshowhuabei      =true;
            this.canshowxibei       =true;
            this.hasAuthority       =true;
        }else if (roleName == '备品中心南方管理成员') {
            this.canshowxinan       =true;
            this.canshowhuanan      =true;
            this.hasAuthority       =true;
            // 20220117 ljh update 判断增加 iscontainsPost isZL start
        }else if (roleName == '备品中心华东管理成员' || 
            ((iscontainsPost|| isZL)  && iscontainsLabelFornewbsc && addr == '医疗华东营业本部' )) {
            this.canshowhuadong     =true;
            this.hasAuthority       =true;
        }else if ((iscontainsPost || isZL) && iscontainsLabelFornewbsc && addr == '医疗西南营业本部') {
            this.canshowxinan       =true;
            this.hasAuthority       =true;
        }else if ((iscontainsPost || isZL)  && iscontainsLabelFornewbsc && addr == '医疗西北营业本部') {
            this.canshowxibei       =true;
            this.hasAuthority       =true;
        }else if ((iscontainsPost || isZL)  && iscontainsLabelFornewbsc && addr == '医疗东北营业本部') {
            this.canshowdongbei     =true;
            this.hasAuthority       =true;
        }else if ((iscontainsPost || isZL)  && iscontainsLabelFornewbsc && addr == '医疗华北营业本部') {
            this.canshowhuabei      =true;
            this.hasAuthority       =true;
        }else if ((iscontainsPost || isZL)  && iscontainsLabelFornewbsc && addr == '医疗华南营业本部') {
        // 20220117 ljh update 判断增加 iscontainsPost end
            this.canshowhuanan      =true;
            this.hasAuthority       =true;
        }
        // else if (!iscontainsLabelFornewbsc ) {
        else if (!iscontainsLabelFornewbsc || !(iscontainsPost || isZL)) {
            this.canshowData = false;
            return;
        }
             
    }
 
    public void resetAllMaps() {
        initStatusMap(dlmap,BSC_STATUS_LIST);
        initStatusMap(symap,BSC_STATUS_LIST);
        initStatusMap(ccmap,BSC_STATUS_LIST);
        initStatusMap(tjmap,BSC_STATUS_LIST);
        initStatusMap(bjmap,BSC_STATUS_LIST);// 202201014 ljh add
        initStatusMap(jnmap,BSC_STATUS_LIST);
        initStatusMap(qdmap,BSC_STATUS_LIST);
        initStatusMap(sxmap,BSC_STATUS_LIST);
        initStatusMap(hnmap,BSC_STATUS_LIST);
        initStatusMap(qhmap,BSC_STATUS_LIST);
        initStatusMap(qdmap,BSC_STATUS_LIST);
        initStatusMap(mapnx,BSC_STATUS_LIST);
        initStatusMap(xjmap,BSC_STATUS_LIST);
        initStatusMap(gsmap,BSC_STATUS_LIST);
        initStatusMap(cdmap,BSC_STATUS_LIST);
        initStatusMap(cqmap,BSC_STATUS_LIST);
        initStatusMap(gymap,BSC_STATUS_LIST);
        initStatusMap(kmmap,BSC_STATUS_LIST);
        initStatusMap(whmap,BSC_STATUS_LIST);
        initStatusMap(csmap,BSC_STATUS_LIST);
        initStatusMap(nnmap,BSC_STATUS_LIST);
        initStatusMap(mapgz,BSC_STATUS_LIST);
        initStatusMap(szmap,BSC_STATUS_LIST);// 202201014 ljh add
        initStatusMap(shmap,BSC_STATUS_LIST);
        initStatusMap(njmap,BSC_STATUS_LIST);
        initStatusMap(hzmap,BSC_STATUS_LIST);
        initStatusMap(ncmap,BSC_STATUS_LIST);
        initStatusMap(hfmap,BSC_STATUS_LIST);
        initStatusMap(fzmap,BSC_STATUS_LIST);
        initStatusMap(hrbmap,BSC_STATUS_LIST);
        initStatusMap(sjzmap,BSC_STATUS_LIST);
        initStatusMap(hhhtmap,BSC_STATUS_LIST);
        initStatusMap(shxmap,BSC_STATUS_LIST);
 
    }
 
    // 按给定状态列表初始化map
    private void initStatusMap(Map<String, Integer> tempMap, List<String> show_status_list) {
        for(String show_status : show_status_list){
            tempMap.put(show_status, 0);
        }
    }
 
    public void changeShowStyle(){
        if (!hasAuthority) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您所在的Role无权查看数量'));
            return;
        }
        if (showStyle == '本部') {
            isBenBu = true;
 
        }else{
            isBenBu = false;
        }
    }
 
    public void makeData(){
        resetAllMaps();
        Date nowDay = Date.today();
        List<Rental_Apply_Equipment_Set_Detail__c> raesdList = [
            SELECT RAESD_Status_Text__c
                 , Rental_Apply__r.ToAgency__c
                 , Rental_Apply__r.SalesdeptSelect__c
                 , Rental_Apply__r.isSameCity__c // 20220111 ljh add
                 , Lost_item_check_time_Final__c
                 , Repair_Status_F__c
                 , Return_DeliverySlip__c 
                 , Bollow_Date__c 
                 , EquipmentSet_Detail_Status_Status__c
                 , Rental_Apply_Equipment_Set__c
                 , Arrival_wh_Result_Agency__c
                 , Is_Body_F__c
                 , Loaner_accsessary__c 
              FROM Rental_Apply_Equipment_Set_Detail__c
             WHERE (
                (Is_Body_F__c = true AND 
                    (
                        RAESD_Status_Text__c IN:BSC_NAME_MAP.keySet()
                        // 20220111 ljh update
                        // OR Bollow_Date__c = :nowDay 
                        OR (Bollow_Date__c >= :nowDay AND Bollow_Date__c <= :nowDay )
                        //待欠品确认配套数
                        // 20220111 ljh update
                        // OR (Rental_Apply__r.ToAgency__c != :ownerProvince AND (EquipmentSet_Detail_Status_Status__c = '已回寄' OR ( EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c != null)) )
                    ) 
                )
                OR (
                    //主体 & 附属品
                    (Is_Body_F__c = true OR Loaner_accsessary__c = true)
                        //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细)
                        AND (
                            (
                                // 20220111 ljh update start
                                // (Rental_Apply__r.ToAgency__c = :ownerProvince AND EquipmentSet_Detail_Status_Status__c = '欠品中') OR 
                                // (Rental_Apply__r.ToAgency__c != :ownerProvince AND EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c = null) 
                                (Rental_Apply__r.isSameCity__c = true AND EquipmentSet_Detail_Status_Status__c = '欠品中') OR 
                                (Rental_Apply__r.isSameCity__c = false AND EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c = null) 
                                // 20220111 ljh update end
                            )
                            //待欠品确认配套数
                            OR (Rental_Apply__r.isSameCity__c = false AND (EquipmentSet_Detail_Status_Status__c = '已回寄' OR ( EquipmentSet_Detail_Status_Status__c = '欠品中' AND Return_DeliverySlip__c != null)) ) // 20220111 ljh add
                            OR ( Arrival_wh_Result_Agency__c = '待修理' )
                            OR ( Arrival_wh_Result_Agency__c = '移至报废区'))
                    )
                )
                AND Rental_Apply__r.RecordType.DeveloperName = 'AgencyRequest'
        ];
        //该map用于去重 --> 待欠品确认数去重(查询的数据应该是配套(一览)的数据)
        Map<String,Integer> tempMap = new Map<String,Integer>();
        for(Rental_Apply_Equipment_Set_Detail__c  raesd : raesdList) {
            String show_status = '';
            // 20220111 ljh add start
            if (String.valueOf(raesd.Bollow_Date__c) == String.valueOf(nowDay) && raesd.Is_Body_F__c == true) {
                show_status = '今日已发货件数';
                if(String.isNotBlank(raesd.Rental_Apply__r.ToAgency__c) && raesd.Rental_Apply__r.ToAgency__c !=null){
                    switch on raesd.Rental_Apply__r.ToAgency__c {
                        when '大连'{ dlmap.put(show_status, dlmap.get(show_status) + 1); }
                        when '沈阳'{ symap.put(show_status, symap.get(show_status) + 1); }
                        //长春 --> 吉林
                        when '吉林'{ ccmap.put(show_status, ccmap.get(show_status) + 1);  }
                        //哈尔滨 --> 黑龙江   
                        when '黑龙江'{ hrbmap.put(show_status, hrbmap.get(show_status) + 1); }
                        when '北京'{ bjmap.put(show_status, bjmap.get(show_status) + 1); } // 20220114 ljh add
                        //石家庄 --> 河北
                        when '河北'{ sjzmap.put(show_status, sjzmap.get(show_status) + 1); }
                        when '天津'{ tjmap.put(show_status, tjmap.get(show_status) + 1); }
                        //呼和浩特 --> 内蒙古
                        when '内蒙古'{ hhhtmap.put(show_status, hhhtmap.get(show_status) + 1);}
                        //济南 --> 山东
                        when '山东'{ jnmap.put(show_status, jnmap.get(show_status) + 1);}
                        when '青岛'{ qdmap.put(show_status, qdmap.get(show_status) + 1); }
                        when '陕西'{ sxmap.put(show_status, sxmap.get(show_status) + 1); }
                        when '山西' { shxmap.put(show_status, shxmap.get(show_status) +1);}
                        when '河南' { hnmap.put(show_status, hnmap.get(show_status) + 1);}
                        when '青海' { qhmap.put(show_status, qhmap.get(show_status) + 1);}
                        when '宁夏' { mapnx.put(show_status, mapnx.get(show_status) + 1);}
                        when '新疆' { xjmap.put(show_status, xjmap.get(show_status) + 1);}
                        when '甘肃' { gsmap.put(show_status, gsmap.get(show_status) + 1);}
                        //成都 --> 四川/西藏
                        when '四川/西藏' { cdmap.put(show_status, cdmap.get(show_status) + 1);}
                        when '重庆' { cqmap.put(show_status, cqmap.get(show_status) + 1);}
                        //贵阳 --> 贵州 
                        when '贵州' { gymap.put(show_status, gymap.get(show_status) + 1);}
                        //昆明 --> 云南
                        when '云南' { kmmap.put(show_status, kmmap.get(show_status) + 1);}
                        //武汉 --> 湖北
                        when '湖北' {       
                            whmap.put(show_status, whmap.get(show_status) + 1);
                        }
                        //长沙 --> 湖南
                        when '湖南' { csmap.put(show_status, csmap.get(show_status) + 1);}
                        //南宁 --> 广西
                        when '广西' { nnmap.put(show_status, nnmap.get(show_status) + 1);}
                        //广州 --> 广东
                        when '广东' { mapgz.put(show_status, mapgz.get(show_status) + 1);}
                        when '深圳'{ szmap.put(show_status, szmap.get(show_status) + 1); } // 20220114 ljh add
                        when '上海' { shmap.put(show_status, shmap.get(show_status) + 1);}
                        //南京 --> 江苏
                        when '江苏' { njmap.put(show_status, njmap.get(show_status) + 1);}
                        //杭州 --> 浙江
                        when '浙江' { hzmap.put(show_status, hzmap.get(show_status) + 1);}
                        //南昌 --> 江西
                        when '江西' { ncmap.put(show_status, ncmap.get(show_status) + 1);}
                        //合肥 --> 安徽
                        // 20220110 ljh update ljh start
                        // when '合肥' { hfmap.put(show_status, hfmap.get(show_status) + 1);}
                        when '安徽' { hfmap.put(show_status, hfmap.get(show_status) + 1);}
                        // 20220110 ljh update ljh end
                        //福州 --> 福建
                        when '福建' { fzmap.put(show_status, fzmap.get(show_status) + 1);}
                    }
                }
                allmap.put('大连', dlmap);
                allmap.put('沈阳', symap);
                allmap.put('长春', ccmap);
                allmap.put('哈尔滨', hrbmap);
                allmap.put('北京', bjmap);// 20220114 ljh add
                allmap.put('石家庄', sjzmap);
                allmap.put('天津', tjmap);
                allmap.put('济南', jnmap);
                allmap.put('青岛', qdmap);
                allmap.put('陕西', sxmap);
                allmap.put('山西', shxmap);
                allmap.put('河南', hnmap);
                allmap.put('青海', qhmap);
                allmap.put('宁夏', mapnx);
                allmap.put('新疆', xjmap);
                allmap.put('甘肃', gsmap);
                allmap.put('成都', cdmap);
                allmap.put('重庆', cqmap);
                allmap.put('贵阳', gymap);
                allmap.put('昆明', kmmap);
                allmap.put('武汉', whmap);
                allmap.put('长沙', csmap);
                allmap.put('南宁', nnmap);
                allmap.put('广州', mapgz);
                allmap.put('深圳', szmap);// 20220114 ljh add
                allmap.put('上海', shmap);
                allmap.put('南京', njmap);
                allmap.put('杭州', hzmap);
                allmap.put('南昌', ncmap);
                allmap.put('合肥', hfmap);
                allmap.put('福州', fzmap);
                allmap.put('呼和浩特', hhhtmap);
            }
            // 20220111 ljh add end   
            if(BSC_NAME_MAP.containsKey(raesd.RAESD_Status_Text__c)) {
                show_status = BSC_NAME_MAP.get(raesd.RAESD_Status_Text__c);
            }
            // 2022011 update ljh start
            // else if (raesd.Bollow_Date__c == nowDay) {
            //     show_status = '今日已发货件数';  
            // }
            // 2022011 update ljh end
 
            // 20220111 ljh update start
            /*else if (raesd.Rental_Apply__r.ToAgency__c != ownerProvince && (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' 
                || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null))) {
                // if (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null)) {
                    show_status = '待欠品确认件数';
                    if (!tempMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) {
                       tempMap.put(raesd.Rental_Apply_Equipment_Set__c, 1);
                    }else{
                        continue;                        
                    }
                    //使用map来去重 这样的话 如果遇到一个配套/一览 里的两个明细 就会跳过了
                    //这个展示的应该是配套数↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
                // }else{
                //     continue;
                // }
            }*/
            else if (raesd.Rental_Apply__r.isSameCity__c == false 
                    && (raesd.EquipmentSet_Detail_Status_Status__c == '已回寄' 
                        || (raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c != null)
                        )
                    ) {
                    show_status = '待欠品确认件数';
                    if (!tempMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) {
                       tempMap.put(raesd.Rental_Apply_Equipment_Set__c, 1);
                    }else{
                        continue;                        
                    }
                    //使用map来去重 这样的话 如果遇到一个配套/一览 里的两个明细 就会跳过了
                    //这个展示的应该是配套数↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
                // }else{
                //     continue;
                // }
            }
            // 20220111 ljh update end
            // 20220111 ljh update start 
            /*else if (raesd.Rental_Apply__r.ToAgency__c == ownerProvince && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' ) {
                //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细)
                show_status = '欠品中件数';
            }else if (raesd.Rental_Apply__r.ToAgency__c != ownerProvince 
                    && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c == null) {
                show_status = '欠品中件数';
            }*/
            else if (raesd.Rental_Apply__r.isSameCity__c == true && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' ) {
                //欠品中件数 同一办事处显示当前为欠品的(按明细),不同办事处显示欠品中未回寄的(按明细)
                show_status = '欠品中件数';
            }else if (raesd.Rental_Apply__r.isSameCity__c == false 
                    && raesd.EquipmentSet_Detail_Status_Status__c == '欠品中' && raesd.Return_DeliverySlip__c == null) {
                show_status = '欠品中件数';
            }
            // 20220111 ljh update end
            else if (raesd.Arrival_wh_Result_Agency__c == '待修理' && ( raesd.Is_Body_F__c || raesd.Loaner_accsessary__c) ) {
                show_status = '待修理件数';
            }else if (raesd.Arrival_wh_Result_Agency__c == '移至报废区' && ( raesd.Is_Body_F__c || raesd.Loaner_accsessary__c) ) {
                show_status = '待废弃件数';
            } 
            else {
                continue;
            }
            if(String.isNotBlank(raesd.Rental_Apply__r.ToAgency__c) && raesd.Rental_Apply__r.ToAgency__c !=null){
                switch on raesd.Rental_Apply__r.ToAgency__c {
                    when '大连'{ dlmap.put(show_status, dlmap.get(show_status) + 1); }
                    when '沈阳'{ symap.put(show_status, symap.get(show_status) + 1); }
                    //长春 --> 吉林
                    when '吉林'{ ccmap.put(show_status, ccmap.get(show_status) + 1);  }
                    //哈尔滨 --> 黑龙江   
                    when '黑龙江'{ hrbmap.put(show_status, hrbmap.get(show_status) + 1); }
                    when '北京'{ bjmap.put(show_status, bjmap.get(show_status) + 1); } // 20220114 ljh add
                    //石家庄 --> 河北
                    when '河北'{ sjzmap.put(show_status, sjzmap.get(show_status) + 1); }
                    when '天津'{ tjmap.put(show_status, tjmap.get(show_status) + 1); }
                    //呼和浩特 --> 内蒙古
                    when '内蒙古'{ hhhtmap.put(show_status, hhhtmap.get(show_status) + 1);}
                    //济南 --> 山东
                    when '山东'{ jnmap.put(show_status, jnmap.get(show_status) + 1);}
                    when '青岛'{ qdmap.put(show_status, qdmap.get(show_status) + 1); }
                    when '陕西'{ sxmap.put(show_status, sxmap.get(show_status) + 1); }
                    when '山西' { shxmap.put(show_status, shxmap.get(show_status) +1);}
                    when '河南' { hnmap.put(show_status, hnmap.get(show_status) + 1);}
                    when '青海' { qhmap.put(show_status, qhmap.get(show_status) + 1);}
                    when '宁夏' { mapnx.put(show_status, mapnx.get(show_status) + 1);}
                    when '新疆' { xjmap.put(show_status, xjmap.get(show_status) + 1);}
                    when '甘肃' { gsmap.put(show_status, gsmap.get(show_status) + 1);}
                    //成都 --> 四川/西藏
                    when '四川/西藏' { cdmap.put(show_status, cdmap.get(show_status) + 1);}
                    when '重庆' { cqmap.put(show_status, cqmap.get(show_status) + 1);}
                    //贵阳 --> 贵州 
                    when '贵州' { gymap.put(show_status, gymap.get(show_status) + 1);}
                    //昆明 --> 云南
                    when '云南' { kmmap.put(show_status, kmmap.get(show_status) + 1);}
                    //武汉 --> 湖北
                    when '湖北' {       
                        whmap.put(show_status, whmap.get(show_status) + 1);
                    }
                    //长沙 --> 湖南
                    when '湖南' { csmap.put(show_status, csmap.get(show_status) + 1);}
                    //南宁 --> 广西
                    when '广西' { nnmap.put(show_status, nnmap.get(show_status) + 1);}
                    //广州 --> 广东
                    when '广东' { mapgz.put(show_status, mapgz.get(show_status) + 1);}
                    when '深圳'{ szmap.put(show_status, szmap.get(show_status) + 1); } // 20220114 ljh add
                    when '上海' { shmap.put(show_status, shmap.get(show_status) + 1);}
                    //南京 --> 江苏
                    when '江苏' { njmap.put(show_status, njmap.get(show_status) + 1);}
                    //杭州 --> 浙江
                    when '浙江' { hzmap.put(show_status, hzmap.get(show_status) + 1);}
                    //南昌 --> 江西
                    when '江西' { ncmap.put(show_status, ncmap.get(show_status) + 1);}
                    //合肥 --> 安徽
                    // 20220110 ljh update ljh start
                    // when '合肥' { hfmap.put(show_status, hfmap.get(show_status) + 1);}
                    when '安徽' { hfmap.put(show_status, hfmap.get(show_status) + 1);}
                    // 20220110 ljh update ljh start
                    //福州 --> 福建
                    when '福建' { fzmap.put(show_status, fzmap.get(show_status) + 1);}
                }
            }
            allmap.put('大连', dlmap);
            allmap.put('沈阳', symap);
            allmap.put('长春', ccmap);
            allmap.put('哈尔滨', hrbmap);
            allmap.put('北京', bjmap);// 20220114 ljh add
            allmap.put('石家庄', sjzmap);
            allmap.put('天津', tjmap);
            allmap.put('济南', jnmap);
            allmap.put('青岛', qdmap);
            allmap.put('陕西', sxmap);
            allmap.put('山西', shxmap);
            allmap.put('河南', hnmap);
            allmap.put('青海', qhmap);
            allmap.put('宁夏', mapnx);
            allmap.put('新疆', xjmap);
            allmap.put('甘肃', gsmap);
            allmap.put('成都', cdmap);
            allmap.put('重庆', cqmap);
            allmap.put('贵阳', gymap);
            allmap.put('昆明', kmmap);
            allmap.put('武汉', whmap);
            allmap.put('长沙', csmap);
            allmap.put('南宁', nnmap);
            allmap.put('广州', mapgz);
            allmap.put('深圳', szmap);// 20220114 ljh add
            allmap.put('上海', shmap);
            allmap.put('南京', njmap);
            allmap.put('杭州', hzmap);
            allmap.put('南昌', ncmap);
            allmap.put('合肥', hfmap);
            allmap.put('福州', fzmap);
            allmap.put('呼和浩特', hhhtmap);
        }
    }
 
    public void init(){
        if (!hasAuthority) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您所在的Role无权查看数量'));
            return;
        }
        makeData();
    }
    public void refreshTable(){
        if(snap.Time__c == null){
            this.init();
            return;
        }
        else if(snap.Date__c != null) {
            resetAllMaps();
 
            List<FixtureRemindSnapshot__c> frsList = [
                SELECT Id
                     , Region__c
                     , Date__c
                     , Time__c
                     , Consum_Dai_Chu_Ku_Zhi_Shi_Cnt__c
                     , Consum_Dai_Fa_Huo_Cnt__c
                     , Consum_Dai_Fen_Pei_Cnt__c
                     , Consum_Dai_Que_Ren_Shi_Yong_Biao_Cnt__c
                     , Consum_Dai_Shou_Huo_Cnt__c
                     , Consum_Dao_Huo_NG_Dai_Que_Ren_Cnt__c
                     , Dai_Bao_Xiu_Cnt__c
                     , Dai_CDS_Cnt__c
                     , Dai_Chu_Ku_Qian_Jian_Ce_Cnt__c
                     , Dai_Chu_Ku_Zhi_Shi_Cnt__c
                     , Dai_Fa_Huo_Cnt__c
                     , Dai_Fen_Pei_Cnt__c
                     , Dai_Hui_Shou_Hou_Jian_Ce_Cnt__c
                     , Dai_Qian_Pin_Que_Ren_Cnt__c
                     , Dai_Que_Ren_Qian_Shou_Cnt__c
                     , Dai_Shang_Jia_Cnt__c
                     , Dai_Xia_Jia_Cnt__c
                     , Pai_Dui_Zhong_Cnt__c
                     , Qian_Pin_Zhong_Cnt__c
                     , Zan_Ding_Fen_Pei_Cnt__c
                     , Rental_ApplyRecordtype__c
                     , Dai_Fei_Qi_Cnt__c
                     , Dai_Xiu_Li_Cnt__c
                     , today_Yi_Fa_Huo_Cnt__c 
                FROM FixtureRemindSnapshot__c
                WHERE Date__c = : snap.Date__c
                AND Time__c = : snap.Time__c
                AND Rental_ApplyRecordtype__c = '办事处'
            ];
            if (frsList ==null || frsList.size() == 0) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '该时间没有快照'));
                return;
            }
            for (FixtureRemindSnapshot__c frs : frsList) {
                switch on frs.Region__c{
                    when '大连'{ loadMap(this.dlmap, frs);}
                    when '沈阳'{ loadMap(this.symap, frs);}
                    //长春 --> 吉林
                    when '长春'{ loadMap(this.ccmap, frs); }
                    //哈尔滨 --> 黑龙江   
                    when '哈尔滨'{ loadMap(this.hrbmap,frs);}
                    when '北京' {loadMap(this.bjmap,frs);}// 20220114 ljh add
                    //石家庄 --> 河北
                    when '石家庄'{ loadMap(this.sjzmap,frs);}
                    when '天津'{ loadMap(this.tjmap,frs);}
                    //呼和浩特 --> 内蒙古
                    when '呼和浩特'{ loadMap(this.hhhtmap,frs);}
                    //济南 --> 山东
                    when '济南'{ loadMap(this.jnmap,frs);}
                    when '青岛'{ loadMap(this.qdmap,frs);}
                    when '陕西'{ loadMap(this.sxmap,frs);}
                    when '山西' { loadMap(this.shxmap,frs);}
                    when '河南' { loadMap(this.hnmap,frs);}
                    when '青海' { loadMap(this.qhmap,frs);}
                    when '宁夏' { loadMap(this.mapnx,frs);}
                    when '新疆' { loadMap(this.xjmap,frs);}
                    when '甘肃' { loadMap(this.gsmap,frs);}
                    //成都 --> 四川/西藏
                    when '成都' { loadMap(this.cdmap,frs);}
                    when '重庆' { loadMap(this.cqmap,frs);}
                    //贵阳 --> 贵州 
                    when '贵阳' { loadMap(this.gymap,frs);}
                    //昆明 --> 云南
                    when '昆明' { loadMap(this.kmmap,frs);}
                    //武汉 --> 湖北
                    when '武汉' { loadMap(this.whmap,frs);}
                    //长沙 --> 湖南
                    when '长沙' { loadMap(this.csmap,frs);}
                    //南宁 --> 广西
                    when '南宁' { loadMap(this.nnmap,frs);}
                    //广州 --> 广东
                    when '广州' {loadMap(this.mapgz,frs);}
                    when '深圳' {loadMap(this.szmap,frs);}// 20220114 ljh add
                    when '上海' { loadMap(this.shmap,frs);}
                    //南京 --> 江苏
                    when '南京' { loadMap(this.njmap,frs);}
                    //杭州 --> 浙江
                    when '杭州' { loadMap(this.hzmap,frs);}
                    //南昌 --> 江西
                    when '南昌' { loadMap(this.ncmap,frs);}
                    //合肥 --> 安徽
                    // 20220110 ljh update ljh start
                    // when '安徽' { loadMap(this.hfmap,frs);}
                    when '合肥' { loadMap(this.hfmap,frs);}
                    // 20220110 ljh update ljh end
                    //福州 --> 福建
                    when '福州' { loadMap(this.fzmap,frs);}
                }
            }
        }
    }
 
    static {
 
        //画面展示省份/城市 list
        BSC_ADDR_LIST = new List<String> {
            // 20220114 ljh update start
            // '大连','沈阳','长春','哈尔滨','合计','石家庄','天津','呼和浩特','济南','青岛','合计','陕西','山西','河南','青海','宁夏','新疆','甘肃','合计','成都','重庆','贵阳','昆明','合计','武汉','长沙','南宁','广州','合计','上海','南京','杭州','南昌','合肥','福州','合计'
            '大连','沈阳','长春','哈尔滨','合计','北京','石家庄','天津','呼和浩特','济南','青岛','合计','陕西','山西','河南','青海','宁夏','新疆','甘肃','合计','成都','重庆','贵阳','昆明','合计','武汉','长沙','南宁','广州','深圳','合计','上海','南京','杭州','南昌','合肥','福州','合计'
           // 20220114 ljh update end
        };
        BSC_ADDR_DB_LIST = new List<String> {
            '大连','沈阳','长春','哈尔滨'
        };
        BSC_ADDR_HB_LIST = new List<String> {
            // 20220114 ljh update start
            // '石家庄','天津','呼和浩特','济南','青岛'
            '北京','石家庄','天津','呼和浩特','济南','青岛'
            // 20220114 ljh update end
        };
        BSC_ADDR_XB_LIST = new List<String> {
            //
            '西安','太原','郑州','西宁','银川','乌鲁木齐','兰州'
        };
        BSC_ADDR_XN_LIST = new List<String> {
            '成都','重庆','贵阳','昆明'
        };
        BSC_ADDR_HN_LIST = new List<String> {
            // 20220114 ljh update start
            // '武汉','长沙','南宁','广州'
            '武汉','长沙','南宁','广州','深圳'
            // 20220114 ljh update end
        };
        BSC_ADDR_HD_LIST = new List<String> {
            '上海','南京','杭州','南昌','合肥','福州'
        };
 
        BSC_STATUS_LIST = new List<String>{
            '待分配件数',
            // '待下架件数',// 20220106 ljh WLIG-C4VDUX update start
            '待发货件数',
            '待欠品确认件数',
            '待CDS件数',
            '待上架件数',
            '今日已发货件数',
            '欠品中件数',
            '待修理件数',
            '待废弃件数'
 
        };
 
        //作成map --> 数据库api -> 画面展示名
        BSC_NAME_MAP = new Map<String,String> {
            FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Dai_Fen_Pei.ordinal())       => '待分配件数',
            // 20220106 ljh WLIG-C4VDUX update start
            // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Chu_Ku_Zhi_Shi.ordinal())       => '待下架件数',
            // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Chu_Ku_Qian_Yi_Jian_Ce.ordinal())     => '待发货件数',
            FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal())     => '待发货件数',
            
            // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Hui_Ji.ordinal())     => '待欠品确认件数',
            FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Hui_Shou.ordinal())             => '待CDS件数',
            
            // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Dai_Shang_Jia.ordinal()) => '待上架件数',
            // FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Yi_Zhi_Bao_Fei_Qu.ordinal()) => '待上架件数'
            FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Hui_Shou_Hou_Yi_CDS.ordinal()) => '待上架件数'
            // 20220106 ljh WLIG-C4VDUX update end
 
        };
 
    }
 
    private void loadMap(Map<String, Integer> fixtureMap, FixtureRemindSnapshot__c frs){
        fixtureMap.put('待分配件数', Integer.valueOf(frs.Dai_Fen_Pei_Cnt__c));
        // fixtureMap.put('待下架件数', Integer.valueOf(frs.Dai_Xia_Jia_Cnt__c));// 20220106 ljh WLIG-C4VDUX update start
        fixtureMap.put('待发货件数', Integer.valueOf(frs.Dai_Fa_Huo_Cnt__c));
        fixtureMap.put('待欠品确认件数', Integer.valueOf(frs.Dai_Qian_Pin_Que_Ren_Cnt__c));
        fixtureMap.put('待CDS件数', Integer.valueOf(frs.Dai_CDS_Cnt__c));
        fixtureMap.put('待上架件数', Integer.valueOf(frs.Dai_Shang_Jia_Cnt__c));
        fixtureMap.put('欠品中件数', Integer.valueOf(frs.Qian_Pin_Zhong_Cnt__c));
        fixtureMap.put('今日已发货件数', Integer.valueOf(frs.today_Yi_Fa_Huo_Cnt__c));
        fixtureMap.put('待修理件数', Integer.valueOf(frs.Dai_Xiu_Li_Cnt__c));
        fixtureMap.put('待废弃件数', Integer.valueOf(frs.Dai_Fei_Qi_Cnt__c));
    }
 
    // 创建快照记录
    public FixtureRemindSnapshot__c createSnapshotRecord(String region) {
        if (region == '合计') {
            return null;
        }
        FixtureRemindSnapshot__c frs = new FixtureRemindSnapshot__c();
        Map<String, Integer> snapMap = null;
        snapMap = allmap.get(region);
        System.debug('snapMap::::'+snapMap);
        if (snapMap != null) {
            frs.Dai_Fen_Pei_Cnt__c = snapMap.get('待分配件数');
            // frs.Dai_Xia_Jia_Cnt__c = snapMap.get('待下架件数');// 20220106 ljh WLIG-C4VDUX update start
            frs.Dai_Fa_Huo_Cnt__c = snapMap.get('待发货件数');
            frs.Dai_Qian_Pin_Que_Ren_Cnt__c = snapMap.get('待欠品确认件数');
            frs.Dai_CDS_Cnt__c = snapMap.get('待CDS件数');
            frs.Dai_Shang_Jia_Cnt__c = snapMap.get('待上架件数');
            frs.today_Yi_Fa_Huo_Cnt__c = snapMap.get('今日已发货件数');
            frs.Qian_Pin_Zhong_Cnt__c = snapMap.get('欠品中件数');
            frs.Dai_Xiu_Li_Cnt__c = snapMap.get('待修理件数');
            frs.Dai_Fei_Qi_Cnt__c = snapMap.get('待废弃件数');
        }
 
        frs.Date__c = System.today();
        frs.Time__c = nowTimeOption;
        frs.Region__c = region;
        frs.Rental_ApplyRecordtype__c = '办事处';
        return frs;
    }
 
    // 时间=> 字段列表中选项
    @TestVisible public String nowTimeToOption() {
        DateTime now = System.now();
        if(now.time() < Time.newInstance(11,30,0,0)) {
            return '09:00';
        } 
        else if(now.time() < Time.newInstance(13,0,0,0)) {
            return '11:30';
        }
        else if(now.time() < Time.newInstance(14,0,0,0)){
            return '13:00';
        }
        else if(now.time() < Time.newInstance(15,0,0,0)){
            return '14:00';
        }
        else if(now.time() < Time.newInstance(17,30,0,0)){
            return '15:00';
        }
        else{
            return '17:30';
        }
    }
    // ljh 大部分代码都已经跑到了,没有跑到的是 switch on中代码。暂时先I++解决就可以
    @TestVisible private void test() {
        Integer i = 0;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    } 
}