Commit acb9f24e896d0d446f58b8e34126f34a240b6cf1

Authored by 王通
1 parent c2dfbe79

1.路单也按线路、自编号分组

src/main/java/com/bsth/server_ws/util/WSDataConver.java
@@ -397,14 +397,14 @@ public class WSDataConver { @@ -397,14 +397,14 @@ public class WSDataConver {
397 * @return 397 * @return
398 */ 398 */
399 public static NH_waybill[] to_waybill_NH4TH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException { 399 public static NH_waybill[] to_waybill_NH4TH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException {
  400 + // 返回值list形态(可转数组)
  401 + List<NH_waybill> result = new ArrayList<>();
400 List<String> nbbmArray = new ArrayList<>(listMap.keySet()); 402 List<String> nbbmArray = new ArrayList<>(listMap.keySet());
401 403
402 - NH_waybill[] rs = new NH_waybill[nbbmArray.size()];  
403 - Field jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");  
404 - //Field lpField = ScheduleRealInfo.class.getDeclaredField("lpName"); 404 + Field xlbmField = ScheduleRealInfo.class.getDeclaredField("xlBm"), jGhField = ScheduleRealInfo.class.getDeclaredField("jGh");
405 405
406 List<ScheduleRealInfo> list; 406 List<ScheduleRealInfo> list;
407 - ArrayListMultimap<String, ScheduleRealInfo> jGhListMap; 407 + ArrayListMultimap<String, ScheduleRealInfo> xlBmListMap, jGhListMap;
408 ScheduleRealInfo sch; 408 ScheduleRealInfo sch;
409 NH_waybill nh_waybill; 409 NH_waybill nh_waybill;
410 NH_waybillItem nh_waybillItem; 410 NH_waybillItem nh_waybillItem;
@@ -412,162 +412,170 @@ public class WSDataConver { @@ -412,162 +412,170 @@ public class WSDataConver {
412 List<ElecInfo> elecInfo; 412 List<ElecInfo> elecInfo;
413 for (int i = 0; i < nbbmArray.size(); i++) { 413 for (int i = 0; i < nbbmArray.size(); i++) {
414 list = listMap.get(nbbmArray.get(i)); 414 list = listMap.get(nbbmArray.get(i));
415 - if (list.size() == 0) 415 + if (list.size() == 0) {
416 continue; 416 continue;
417 - //班次信息  
418 - nh_waybill = new NH_waybill();  
419 - sch = list.get(0);  
420 - //日期  
421 - nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());  
422 - //车辆自编号  
423 - nh_waybill.setM_strNBBM(sch.getClZbh());  
424 - //线路编码  
425 - nh_waybill.setM_strXLBM(sch.getXlBm());  
426 - nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>()); 417 + }
427 418
428 - //按 驾驶员 分组班次,构造路单子项  
429 - jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);  
430 - for (String jGh : jGhListMap.keySet()) {  
431 - list = jGhListMap.get(jGh);  
432 - nh_waybillItem = new NH_waybillItem();  
433 - //计划里程  
434 - nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));  
435 - //实际计划公里  
436 - nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));  
437 - //实际出场里程  
438 - nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));  
439 - //实际进场里程  
440 - nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));  
441 - //营业公里  
442 - nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));  
443 - //空驶公里  
444 - nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));  
445 - //抽减公里  
446 - nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));  
447 - //烂班公里  
448 - nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));  
449 - //增加公里  
450 - nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));  
451 - //总公里  
452 - nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));  
453 - //烂班公里原因  
454 - nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));  
455 - //抽减公里原因  
456 - nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));  
457 - //计划班次  
458 - nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));  
459 - //实际计划班次  
460 - nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));  
461 - //实际班次 ————> 暂时和实际计划班次相同  
462 - nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));  
463 - //增加班次  
464 - nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));  
465 - //抽减班次  
466 - nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));  
467 - //烂班工时  
468 - nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));  
469 - //路牌  
470 - nh_waybillItem.setM_strLP(list.get(0).getLpName());  
471 - //驾驶员工号  
472 - nh_waybillItem.setM_strJSY(list.get(0).getjGh());  
473 - //售票员工号  
474 - nh_waybillItem.setM_strSPY("");  
475 - for (ScheduleRealInfo sri : list) {  
476 - if (StringUtils.isNotEmpty(sri.getsGh())) {  
477 - nh_waybillItem.setM_strSPY(sri.getsGh());  
478 - break;  
479 - }  
480 - }  
481 - //驾驶员考勤  
482 - nh_waybillItem.setM_strJSYKQ("");  
483 - //售票员考勤  
484 - nh_waybillItem.setM_strSPYKQ("");  
485 - //当班调度员  
486 - nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));  
487 - //营运状态  
488 - nh_waybillItem.setM_strYYZT("");  
489 - //备注  
490 - nh_waybillItem.setM_strBZ(""); 419 + xlBmListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", xlbmField);
  420 + for (String xlBm : xlBmListMap.keySet()) {
  421 + list = xlBmListMap.get(xlBm);
491 422
492 - oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
493 - if (oilInfo != null && oilInfo.size() > 0) {  
494 - Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;  
495 - String rylx = "";  
496 - for (OilInfo oi : oilInfo) {  
497 - if (oi.getXlbm().equals(sch.getXlBm())) {  
498 - czyl = Arith.add(czyl, oi.getCzyl());  
499 - jzyl = Arith.add(jzyl, oi.getJzyl());  
500 - jzl = Arith.add(jzl, oi.getJzl());  
501 - ns = Arith.add(ns, oi.getNs());  
502 - yh = Arith.add(yh, oi.getYh());  
503 - rylx = oi.getRylx(); 423 + //班次信息
  424 + nh_waybill = new NH_waybill();
  425 + sch = list.get(0);
  426 + //日期
  427 + nh_waybill.setM_strYYRQ(sch.getScheduleDateStr());
  428 + //车辆自编号
  429 + nh_waybill.setM_strNBBM(sch.getClZbh());
  430 + //线路编码
  431 + nh_waybill.setM_strXLBM(sch.getXlBm());
  432 + nh_waybill.setM_SubInfos(new ArrayList<NH_waybillItem>());
  433 +
  434 + //按 驾驶员 分组班次,构造路单子项
  435 + jGhListMap = new ConvertUtil<ScheduleRealInfo>().groupMultiList(list, "_", jGhField);
  436 + for (String jGh : jGhListMap.keySet()) {
  437 + list = jGhListMap.get(jGh);
  438 + nh_waybillItem = new NH_waybillItem();
  439 + //计划里程
  440 + nh_waybillItem.setM_dblJHLC(ScheduleCalculator.calcJHLC(list));
  441 + //实际计划公里
  442 + nh_waybillItem.setM_dblSJJHLC(ScheduleCalculator.calcSJLC(list));
  443 + //实际出场里程
  444 + nh_waybillItem.setM_dblCCLC(ScheduleCalculator.calcCCLC(list));
  445 + //实际进场里程
  446 + nh_waybillItem.setM_dblJCLC(ScheduleCalculator.calcJCLC(list));
  447 + //营业公里
  448 + nh_waybillItem.setM_dblYYLC(ScheduleCalculator.calcYYLC(list));
  449 + //空驶公里
  450 + nh_waybillItem.setM_dblKSLC(ScheduleCalculator.calcKSLC(list));
  451 + //抽减公里
  452 + nh_waybillItem.setM_dblCJLC(ScheduleCalculator.calcCJLC(list));
  453 + //烂班公里
  454 + nh_waybillItem.setM_dblLBLC(ScheduleCalculator.calcLBLC(list));
  455 + //增加公里
  456 + nh_waybillItem.setM_dblZJLC(ScheduleCalculator.calcZJLC(list));
  457 + //总公里
  458 + nh_waybillItem.setM_dblZLC(ScheduleCalculator.calcZLC(list));
  459 + //烂班公里原因
  460 + nh_waybillItem.setM_strLBYY(ScheduleCalculator.joinLBYY(list));
  461 + //抽减公里原因
  462 + nh_waybillItem.setM_strCJYY(ScheduleCalculator.joinCJYY(list));
  463 + //计划班次
  464 + nh_waybillItem.setM_intJHBC(ScheduleCalculator.countJHBC(list));
  465 + //实际计划班次
  466 + nh_waybillItem.setM_intSJJHBC(ScheduleCalculator.countSJJHBC(list));
  467 + //实际班次 ————> 暂时和实际计划班次相同
  468 + nh_waybillItem.setM_intSJBC(ScheduleCalculator.countSJJHBC(list));
  469 + //增加班次
  470 + nh_waybillItem.setM_intZJBC(ScheduleCalculator.countZJBC(list));
  471 + //抽减班次
  472 + nh_waybillItem.setM_intCJBC(ScheduleCalculator.countCJBC(list));
  473 + //烂班工时
  474 + nh_waybillItem.setM_dblLBGS(ScheduleCalculator.calcLBGS(list));
  475 + //路牌
  476 + nh_waybillItem.setM_strLP(list.get(0).getLpName());
  477 + //驾驶员工号
  478 + nh_waybillItem.setM_strJSY(list.get(0).getjGh());
  479 + //售票员工号
  480 + nh_waybillItem.setM_strSPY("");
  481 + for (ScheduleRealInfo sri : list) {
  482 + if (StringUtils.isNotEmpty(sri.getsGh())) {
  483 + nh_waybillItem.setM_strSPY(sri.getsGh());
  484 + break;
504 } 485 }
505 } 486 }
506 - //出场存油  
507 - nh_waybillItem.setM_dblCCCY(czyl);  
508 - //进场存油  
509 - nh_waybillItem.setM_dblJCCY(jzyl);  
510 - //加注量1  
511 - nh_waybillItem.setM_dblJZL1(jzl);  
512 - //加注量2  
513 - nh_waybillItem.setM_dblJZL2(0.0);  
514 - //尿素  
515 - nh_waybillItem.setM_dblNS(ns);  
516 - //消耗量  
517 - nh_waybillItem.setM_dblYH(yh);  
518 - //加油地点1  
519 - nh_waybillItem.setM_strJYD1("");  
520 - //加油地点2  
521 - nh_waybillItem.setM_strJYD2("");  
522 - //加油工工号1  
523 - nh_waybillItem.setM_strJYG1("");  
524 - //加油工工号1  
525 - nh_waybillItem.setM_strJYG2("");  
526 - //油耗类型1  
527 - nh_waybillItem.setM_strYHLX1(rylx);  
528 - //油耗类型2  
529 - nh_waybillItem.setM_strYHLX1("");  
530 - }  
531 -  
532 - elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());  
533 - if (elecInfo != null && elecInfo.size() > 0) {  
534 - Double cdl = 0., hd = 0.;  
535 - for (ElecInfo ei : elecInfo) {  
536 - cdl = Arith.add(cdl, ei.getCdl());  
537 - hd = Arith.add(hd, ei.getHd()); 487 + //驾驶员考勤
  488 + nh_waybillItem.setM_strJSYKQ("");
  489 + //售票员考勤
  490 + nh_waybillItem.setM_strSPYKQ("");
  491 + //当班调度员
  492 + nh_waybillItem.setM_strDDY(ScheduleCalculator.calcDDY(list, des));
  493 + //营运状态
  494 + nh_waybillItem.setM_strYYZT("");
  495 + //备注
  496 + nh_waybillItem.setM_strBZ("");
  497 +
  498 + oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  499 + if (oilInfo != null && oilInfo.size() > 0) {
  500 + Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.;
  501 + String rylx = "";
  502 + for (OilInfo oi : oilInfo) {
  503 + if (oi.getXlbm().equals(sch.getXlBm())) {
  504 + czyl = Arith.add(czyl, oi.getCzyl());
  505 + jzyl = Arith.add(jzyl, oi.getJzyl());
  506 + jzl = Arith.add(jzl, oi.getJzl());
  507 + ns = Arith.add(ns, oi.getNs());
  508 + yh = Arith.add(yh, oi.getYh());
  509 + rylx = oi.getRylx();
  510 + }
  511 + }
  512 + //出场存油
  513 + nh_waybillItem.setM_dblCCCY(czyl);
  514 + //进场存油
  515 + nh_waybillItem.setM_dblJCCY(jzyl);
  516 + //加注量1
  517 + nh_waybillItem.setM_dblJZL1(jzl);
  518 + //加注量2
  519 + nh_waybillItem.setM_dblJZL2(0.0);
  520 + //尿素
  521 + nh_waybillItem.setM_dblNS(ns);
  522 + //消耗量
  523 + nh_waybillItem.setM_dblYH(yh);
  524 + //加油地点1
  525 + nh_waybillItem.setM_strJYD1("");
  526 + //加油地点2
  527 + nh_waybillItem.setM_strJYD2("");
  528 + //加油工工号1
  529 + nh_waybillItem.setM_strJYG1("");
  530 + //加油工工号1
  531 + nh_waybillItem.setM_strJYG2("");
  532 + //油耗类型1
  533 + nh_waybillItem.setM_strYHLX1(rylx);
  534 + //油耗类型2
  535 + nh_waybillItem.setM_strYHLX1("");
538 } 536 }
539 - //出场存油  
540 - nh_waybillItem.setM_dblCCCY(100.0);  
541 - //进场存油  
542 - nh_waybillItem.setM_dblJCCY(100.0);  
543 - //加注量1  
544 - nh_waybillItem.setM_dblJZL1(cdl);  
545 - //加注量2  
546 - nh_waybillItem.setM_dblJZL2(0.0);  
547 - //尿素  
548 - nh_waybillItem.setM_dblNS(0.0);  
549 - //消耗量  
550 - nh_waybillItem.setM_dblYH(hd);  
551 - //加油地点1  
552 - nh_waybillItem.setM_strJYD1("");  
553 - //加油地点2  
554 - nh_waybillItem.setM_strJYD2("");  
555 - //加油工工号1  
556 - nh_waybillItem.setM_strJYG1("");  
557 - //加油工工号1  
558 - nh_waybillItem.setM_strJYG2("");  
559 - //油耗类型1  
560 - nh_waybillItem.setM_strYHLX1("");  
561 - //油耗类型2  
562 - nh_waybillItem.setM_strYHLX1(""); 537 +
  538 + elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh());
  539 + if (elecInfo != null && elecInfo.size() > 0) {
  540 + Double cdl = 0., hd = 0.;
  541 + for (ElecInfo ei : elecInfo) {
  542 + cdl = Arith.add(cdl, ei.getCdl());
  543 + hd = Arith.add(hd, ei.getHd());
  544 + }
  545 + //出场存油
  546 + nh_waybillItem.setM_dblCCCY(100.0);
  547 + //进场存油
  548 + nh_waybillItem.setM_dblJCCY(100.0);
  549 + //加注量1
  550 + nh_waybillItem.setM_dblJZL1(cdl);
  551 + //加注量2
  552 + nh_waybillItem.setM_dblJZL2(0.0);
  553 + //尿素
  554 + nh_waybillItem.setM_dblNS(0.0);
  555 + //消耗量
  556 + nh_waybillItem.setM_dblYH(hd);
  557 + //加油地点1
  558 + nh_waybillItem.setM_strJYD1("");
  559 + //加油地点2
  560 + nh_waybillItem.setM_strJYD2("");
  561 + //加油工工号1
  562 + nh_waybillItem.setM_strJYG1("");
  563 + //加油工工号1
  564 + nh_waybillItem.setM_strJYG2("");
  565 + //油耗类型1
  566 + nh_waybillItem.setM_strYHLX1("");
  567 + //油耗类型2
  568 + nh_waybillItem.setM_strYHLX1("");
  569 + }
  570 +
  571 + nh_waybill.getM_SubInfos().add(nh_waybillItem);
563 } 572 }
564 573
565 - nh_waybill.getM_SubInfos().add(nh_waybillItem); 574 + result.add(nh_waybill);
566 } 575 }
567 -  
568 - rs[i] = nh_waybill;  
569 } 576 }
570 - return rs; 577 +
  578 + return result.toArray(new NH_waybill[result.size()]);
571 } 579 }
572 580
573 581