Commit 2c33fd45c7b7254c39e4b08ad03f9be2bdf7f914

Authored by 潘钊
1 parent 953b0487

update...

src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
... ... @@ -17,9 +17,12 @@ public class LpData {
17 17  
18 18 this.fcsj = sch.getFcsjActualTime();
19 19 this.zdsj = sch.getZdsjActualTime();
  20 +
  21 + this.qdName = sch.getQdzName();
  22 + this.zdzName = sch.getZdzName();
20 23 }
21 24  
22   - public void appendTo(ScheduleRealInfo sch, int type) {
  25 + public void appendTo(ScheduleRealInfo sch, int type, boolean changeRealTime) {
23 26  
24 27 if (type == 0) {
25 28 //只换人
... ... @@ -31,10 +34,10 @@ public class LpData {
31 34 //只换车
32 35 sch.setClZbh(this.nbbm);
33 36  
34   - if (this.fcsj != null)
35   - sch.setFcsjActualAll(this.fcsj);
36   - if (this.zdsj != null)
37   - sch.setZdsjActualAll(this.zdsj);
  37 + //换实际时间
  38 + if(changeRealTime){
  39 + changeRealTime(sch);
  40 + }
38 41  
39 42 } else if (type == 2) {
40 43 //换人并换车
... ... @@ -44,13 +47,30 @@ public class LpData {
44 47 sch.setsName(this.sName);
45 48 sch.setClZbh(this.nbbm);
46 49  
47   - if (this.fcsj != null)
48   - sch.setFcsjActualAll(this.fcsj);
49   - if (this.zdsj != null)
50   - sch.setZdsjActualAll(this.zdsj);
  50 + //换实际时间
  51 + if(changeRealTime){
  52 + changeRealTime(sch);
  53 + }
51 54 }
52 55 }
53 56  
  57 + public void changeRealTime(ScheduleRealInfo sch){
  58 + if (this.fcsj != null && this.qdName.equals(sch.getQdzName()))
  59 + sch.setFcsjActualAll(this.fcsj);
  60 + if (this.zdsj != null && this.zdzName.equals(sch.getZdzName()))
  61 + sch.setZdsjActualAll(this.zdsj);
  62 + }
  63 +
  64 + /**
  65 + * 起点站名称
  66 + */
  67 + private String qdName;
  68 +
  69 + /**
  70 + * 终点站名称
  71 + */
  72 + private String zdzName;
  73 +
54 74 /**
55 75 * 驾驶员
56 76 */
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -623,6 +623,7 @@ public class DayOfSchedule implements CommandLineRunner {
623 623 // }
624 624  
625 625 public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) {
  626 + Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator);
626 627 return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm));
627 628 }
628 629  
... ... @@ -775,6 +776,8 @@ public class DayOfSchedule implements CommandLineRunner {
775 776 public void addExecPlan(ScheduleRealInfo sch) {
776 777 if(sch != null)
777 778 carExecutePlanMap.put(sch.getClZbh(), sch);
  779 + else
  780 + carExecutePlanMap.remove(sch.getClZbh());
778 781 }
779 782  
780 783 public void removeExecPlan(String clzbh) {
... ... @@ -826,6 +829,14 @@ public class DayOfSchedule implements CommandLineRunner {
826 829 return ups;
827 830 }
828 831  
  832 + public void removeNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){
  833 + nbbmScheduleMap.remove(nbbm, sch);
  834 + }
  835 +
  836 + public void addNbbm2SchMapp(ScheduleRealInfo sch, String nbbm){
  837 + nbbmScheduleMap.put(nbbm, sch);
  838 + }
  839 +
829 840 public void reCalcExecPlan(String nbbm){
830 841 carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm)));
831 842 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -156,7 +156,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
156 156  
157 157 Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
158 158  
159   - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
  159 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime);
160 160  
161 161 Map<String,Object> revokeRealArrive(Long id);
162 162 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -74,8 +74,8 @@ import java.util.zip.ZipOutputStream;
74 74 @Service
75 75 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
76 76 implements ScheduleRealInfoService {
77   - @Autowired
78   - JdbcTemplate jdbcTemplate;
  77 + @Autowired
  78 + JdbcTemplate jdbcTemplate;
79 79 @Autowired
80 80 ScheduleRealInfoRepository scheduleRealInfoRepository;
81 81  
... ... @@ -89,7 +89,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
89 89 SectionRouteService sectionRouteService;
90 90  
91 91 /*@Autowired
92   - BorrowCenter borrowCenter;*/
  92 + BorrowCenter borrowCenter;*/
93 93  
94 94 @Autowired
95 95 LineRepository lineRepository;
... ... @@ -111,13 +111,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
111 111  
112 112 @Autowired
113 113 LineConfigData lineConfigData;
114   -
  114 +
115 115 @Autowired
116 116 DutyEmployeeService dutyEmployeeService;
117   -
  117 +
118 118 @Autowired
119 119 YlxxbRepository ylxxbRepository;
120   -
  120 +
121 121 @Autowired
122 122 YlbRepository ylbRepository;
123 123  
... ... @@ -141,8 +141,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
141 141  
142 142 private final static long DAY_TIME = 1000 * 60 * 60 * 24L;
143 143  
144   - private static int BUF_SIZE = 1024;
145   -
  144 + private static int BUF_SIZE = 1024;
  145 +
146 146 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");
147 147  
148 148 @Override
... ... @@ -175,7 +175,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
175 175 }
176 176  
177 177 //调整班次类型
178   - if(StringUtils.isNotEmpty(bcType)){
  178 + if (StringUtils.isNotEmpty(bcType)) {
179 179 schedule.setBcType(bcType);
180 180 }
181 181  
... ... @@ -200,7 +200,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
200 200 try {
201 201 List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
202 202  
203   - ScheduleRealInfo schedule = null;
  203 + ScheduleRealInfo schedule = null, execSch, next;
204 204 for (String id : idList) {
205 205 schedule = dayOfSchedule.get(Long.parseLong(id));
206 206 if (schedule.isDestroy()) {
... ... @@ -215,6 +215,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
215 215  
216 216 dayOfSchedule.save(schedule);
217 217 rsList.add(schedule);
  218 +
  219 + //如果正在执行当前班次,跳下一个班次
  220 + execSch = dayOfSchedule.executeCurr(schedule.getClZbh());
  221 + if(execSch != null && execSch.getId().equals(schedule.getId())){
  222 + next = dayOfSchedule.next(schedule);
  223 + dayOfSchedule.addExecPlan(next);
  224 + }
218 225 }
219 226  
220 227 map.put("status", ResponseCode.SUCCESS);
... ... @@ -457,207 +464,207 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
457 464 }
458 465  
459 466 }
460   -
  467 +
461 468 @Override
462   - public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state,String type) {
  469 + public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state, String type) {
463 470 // List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
464   - state=state+"";
465   - String lpname=state;
466   - String px=type;
467   - if(state.equals("lpName")){
468   - state =state+"+1";
469   - type="asc";
470   - }
471   - String sqlPlan="select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
472   - + " s.lp_Name as lpName,s.j_Name as jName,s.s_Gh as sGh,s.s_Name as sName"
473   - + " from bsth_c_s_sp_info_real s "
474   - + " where s.xl_Bm = '"+line+"' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='"+date+"' "
475   - + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name,s.s_Gh,"
476   - + " s.s_Name order by ("+state+") "+type;
477   - List<ScheduleRealInfo> list= jdbcTemplate.query(sqlPlan,
478   - new RowMapper<ScheduleRealInfo>(){
479   - @Override
480   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
481   - ScheduleRealInfo t=new ScheduleRealInfo();
482   - t.setId(rs.getLong("id"));
483   - t.setjGh(rs.getString("jGh"));
484   - t.setClZbh(rs.getString("clZbh"));
485   - t.setLpName(rs.getString("lpName"));
486   - t.setjName(rs.getString("jName"));
487   - t.setsGh(rs.getString("sGh"));
488   - t.setsName(rs.getString("sName"));
489   - return t;
490   - }
491   - });
492   - if(lpname.equals("lpName")){
493   - List<ScheduleRealInfo> listNew=new ArrayList<ScheduleRealInfo>();
494   - Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
495   - if(px.equals("desc")){
496   - int zt=0;
497   - for (int l = 0; l < 3; l++) {
498   - for (int i = 0; i < list.size(); i++) {
499   - ScheduleRealInfo t=list.get(i);
500   - if(t.getLpName().indexOf("+")!=-1){
501   - if(zt==0){
502   - listNew.add(t);
503   - }
504   -
505   - }else if(pattern.matcher(t.getLpName()).matches()){
506   - if(zt==1){
507   - listNew.add(t);
508   - }
509   - }else{
510   - if(zt==2){
511   - listNew.add(t);
512   - }
513   - }
514   - }
515   - zt++;
516   - }
517   - }else{
518   - int zt=0;
519   - for (int l = 0; l < 3; l++) {
520   - for (int i = 0; i < list.size(); i++) {
521   - ScheduleRealInfo t=list.get(i);
522   - if(t.getLpName().indexOf("+")!=-1){
523   - if(zt==2){
524   - listNew.add(t);
525   - }
526   -
527   - }else if(pattern.matcher(t.getLpName()).matches()){
528   - if(zt==1){
529   - listNew.add(t);
530   - }
531   - }else{
532   - if(zt==0){
533   - listNew.add(t);
534   - }
535   - }
536   - }
537   - zt++;
538   - }
539   -
540   - }
541   - return listNew;
542   - }else{
543   - return list;
544   - }
545   -
  471 + state = state + "";
  472 + String lpname = state;
  473 + String px = type;
  474 + if (state.equals("lpName")) {
  475 + state = state + "+1";
  476 + type = "asc";
  477 + }
  478 + String sqlPlan = "select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh,"
  479 + + " s.lp_Name as lpName,s.j_Name as jName,s.s_Gh as sGh,s.s_Name as sName"
  480 + + " from bsth_c_s_sp_info_real s "
  481 + + " where s.xl_Bm = '" + line + "' and DATE_FORMAT(s.schedule_Date,'%Y-%m-%d') ='" + date + "' "
  482 + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name ,s.j_Name,s.s_Gh,"
  483 + + " s.s_Name order by (" + state + ") " + type;
  484 + List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan,
  485 + new RowMapper<ScheduleRealInfo>() {
  486 + @Override
  487 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  488 + ScheduleRealInfo t = new ScheduleRealInfo();
  489 + t.setId(rs.getLong("id"));
  490 + t.setjGh(rs.getString("jGh"));
  491 + t.setClZbh(rs.getString("clZbh"));
  492 + t.setLpName(rs.getString("lpName"));
  493 + t.setjName(rs.getString("jName"));
  494 + t.setsGh(rs.getString("sGh"));
  495 + t.setsName(rs.getString("sName"));
  496 + return t;
  497 + }
  498 + });
  499 + if (lpname.equals("lpName")) {
  500 + List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>();
  501 + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
  502 + if (px.equals("desc")) {
  503 + int zt = 0;
  504 + for (int l = 0; l < 3; l++) {
  505 + for (int i = 0; i < list.size(); i++) {
  506 + ScheduleRealInfo t = list.get(i);
  507 + if (t.getLpName().indexOf("+") != -1) {
  508 + if (zt == 0) {
  509 + listNew.add(t);
  510 + }
  511 +
  512 + } else if (pattern.matcher(t.getLpName()).matches()) {
  513 + if (zt == 1) {
  514 + listNew.add(t);
  515 + }
  516 + } else {
  517 + if (zt == 2) {
  518 + listNew.add(t);
  519 + }
  520 + }
  521 + }
  522 + zt++;
  523 + }
  524 + } else {
  525 + int zt = 0;
  526 + for (int l = 0; l < 3; l++) {
  527 + for (int i = 0; i < list.size(); i++) {
  528 + ScheduleRealInfo t = list.get(i);
  529 + if (t.getLpName().indexOf("+") != -1) {
  530 + if (zt == 2) {
  531 + listNew.add(t);
  532 + }
  533 +
  534 + } else if (pattern.matcher(t.getLpName()).matches()) {
  535 + if (zt == 1) {
  536 + listNew.add(t);
  537 + }
  538 + } else {
  539 + if (zt == 0) {
  540 + listNew.add(t);
  541 + }
  542 + }
  543 + }
  544 + zt++;
  545 + }
  546 +
  547 + }
  548 + return listNew;
  549 + } else {
  550 + return list;
  551 + }
  552 +
546 553 }
547 554  
548 555 /**
549 556 *
550 557 */
551 558 @Override
552   - public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName,String date,String line) {
553   - ReportUtils ee = new ReportUtils();
554   - ReportRelatedUtils rru = new ReportRelatedUtils();
555   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
556   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName,date,line);
557   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
558   -
559   - DecimalFormat format = new DecimalFormat("0.00");
  559 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName, String date, String line) {
  560 + ReportUtils ee = new ReportUtils();
  561 + ReportRelatedUtils rru = new ReportRelatedUtils();
  562 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  563 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
  564 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  565 +
  566 + DecimalFormat format = new DecimalFormat("0.00");
560 567 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
561 568 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
562   - int jhbc = 0,cjbc = 0,ljbc = 0;
563   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
564   - float addMileage = 0l,remMileage = 0l;
565   -
566   - Map<String,Object> map;
567   - for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
568   - if(scheduleRealInfo != null){
569   - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
570   - if(scheduleRealInfo != null){
571   - //计划里程(主任务过滤掉临加班次),
572   - //烂班里程(主任务烂班),
573   - //临加里程(主任务临加),
574   - //计划班次,烂班班次,增加班次
575   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
576   - if(scheduleRealInfo.isSflj()){
577   - ljbc++;
578   - }else{
579   - jhlc += tempJhlc;
580   - jhbc++;
581   - if(scheduleRealInfo.getStatus() == -1){
582   - remMileage += tempJhlc;
583   - cjbc++;
584   - }
585   - }
586   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
587   - //计算营运里程,空驶里程
588   - if(childTaskPlans.isEmpty()){
589   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
590   - ){
591   - ksgl += tempJhlc;
592   - }else{
593   - yygl += tempJhlc;
594   - }
595   - }else{
596   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
597   - while(it.hasNext()){
598   - ChildTaskPlan childTaskPlan = it.next();
599   - if(childTaskPlan.getMileageType().equals("empty")){
600   - if(scheduleRealInfo.isSflj()){
601   - addMileage += tempJhlc;
602   - }
603   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
604   - }else{
605   - if(scheduleRealInfo.isSflj()){
606   - addMileage += tempJhlc;
607   - }
608   - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
609   - }
610   - }
611   - }
612   - }
613   -
614   - map = new HashMap<String, Object>();
615   - try {
616   - scheduleRealInfo.setjName(scheduleRealInfo.getjGh()+scheduleRealInfo.getjName());
617   - scheduleRealInfo.setsName(scheduleRealInfo.getsGh()+scheduleRealInfo.getsName());
618   - map = rru.getMapValue(scheduleRealInfo);
619   - String zdsj = scheduleRealInfo.getZdsj();
620   - String zdsjActual = scheduleRealInfo.getZdsjActual();
621   - if(zdsj != null && zdsjActual != null &&
622   - !zdsj.equals(zdsjActual)){
623   - if(zdsj.compareTo(zdsjActual) > 0){
624   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
625   - map.put("slow", "");
626   - } else {
627   - map.put("fast", "");
628   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
629   - }
630   - } else {
631   - map.put("fast", "");
632   - map.put("slow", "");
633   - }
634   - listMap.add(map);
635   - } catch (Exception e) {
636   - e.printStackTrace();
637   - }
638   - }
639   - }
640   -
641   - //计算里程和班次数,并放入Map里
642   - map = new HashMap<String, Object>();
643   - map.put("jhlc", format.format(jhlc));
644   - map.put("remMileage", format.format(remMileage));
645   - map.put("addMileage", format.format(addMileage));
646   - map.put("yygl", format.format(yygl));
647   - map.put("ksgl", format.format(ksgl));
648   - map.put("realMileage", format.format(yygl+ksgl));
649   - map.put("jhbc", jhbc);
650   - map.put("cjbc", cjbc);
651   - map.put("ljbc", ljbc);
652   - map.put("sjbc", jhbc-cjbc+ljbc);
653   -
654   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  569 + int jhbc = 0, cjbc = 0, ljbc = 0;
  570 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0;
  571 + float addMileage = 0l, remMileage = 0l;
  572 +
  573 + Map<String, Object> map;
  574 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  575 + if (scheduleRealInfo != null) {
  576 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  577 + if (scheduleRealInfo != null) {
  578 + //计划里程(主任务过滤掉临加班次),
  579 + //烂班里程(主任务烂班),
  580 + //临加里程(主任务临加),
  581 + //计划班次,烂班班次,增加班次
  582 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  583 + if (scheduleRealInfo.isSflj()) {
  584 + ljbc++;
  585 + } else {
  586 + jhlc += tempJhlc;
  587 + jhbc++;
  588 + if (scheduleRealInfo.getStatus() == -1) {
  589 + remMileage += tempJhlc;
  590 + cjbc++;
  591 + }
  592 + }
  593 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  594 + //计算营运里程,空驶里程
  595 + if (childTaskPlans.isEmpty()) {
  596 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  597 + ) {
  598 + ksgl += tempJhlc;
  599 + } else {
  600 + yygl += tempJhlc;
  601 + }
  602 + } else {
  603 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  604 + while (it.hasNext()) {
  605 + ChildTaskPlan childTaskPlan = it.next();
  606 + if (childTaskPlan.getMileageType().equals("empty")) {
  607 + if (scheduleRealInfo.isSflj()) {
  608 + addMileage += tempJhlc;
  609 + }
  610 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  611 + } else {
  612 + if (scheduleRealInfo.isSflj()) {
  613 + addMileage += tempJhlc;
  614 + }
  615 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  616 + }
  617 + }
  618 + }
  619 + }
  620 +
  621 + map = new HashMap<String, Object>();
  622 + try {
  623 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  624 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  625 + map = rru.getMapValue(scheduleRealInfo);
  626 + String zdsj = scheduleRealInfo.getZdsj();
  627 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  628 + if (zdsj != null && zdsjActual != null &&
  629 + !zdsj.equals(zdsjActual)) {
  630 + if (zdsj.compareTo(zdsjActual) > 0) {
  631 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  632 + map.put("slow", "");
  633 + } else {
  634 + map.put("fast", "");
  635 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  636 + }
  637 + } else {
  638 + map.put("fast", "");
  639 + map.put("slow", "");
  640 + }
  641 + listMap.add(map);
  642 + } catch (Exception e) {
  643 + e.printStackTrace();
  644 + }
  645 + }
  646 + }
  647 +
  648 + //计算里程和班次数,并放入Map里
  649 + map = new HashMap<String, Object>();
  650 + map.put("jhlc", format.format(jhlc));
  651 + map.put("remMileage", format.format(remMileage));
  652 + map.put("addMileage", format.format(addMileage));
  653 + map.put("yygl", format.format(yygl));
  654 + map.put("ksgl", format.format(ksgl));
  655 + map.put("realMileage", format.format(yygl + ksgl));
  656 + map.put("jhbc", jhbc);
  657 + map.put("cjbc", cjbc);
  658 + map.put("ljbc", ljbc);
  659 + map.put("sjbc", jhbc - cjbc + ljbc);
655 660  
656   - list.add(listMap.iterator());
657   - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould/waybill_minhang.xls",
658   - path+"export/" + date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
659   - return scheduleRealInfos;
660   - }
  661 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  662 +
  663 + list.add(listMap.iterator());
  664 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_minhang.xls",
  665 + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  666 + return scheduleRealInfos;
  667 + }
661 668  
662 669 @Override
663 670 public List<Map<String, Object>> dailyInfo(String line, String date, String type) {
... ... @@ -967,6 +974,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
967 974 String remarks = map.get("remarks");
968 975 ScheduleRealInfo sch = dayOfSchedule.get(id);
969 976 if (null != sch) {
  977 +
  978 + String clZbh = map.get("clZbh");
  979 + if (StringUtils.isNotEmpty(clZbh)) {
  980 + //换车
  981 + BiMap<String, String> clMap = BasicData.deviceId2NbbmMap.inverse();
  982 + if (clMap.get(clZbh) == null) {
  983 + rs.put("status", ResponseCode.ERROR);
  984 + rs.put("msg", "车辆 " + clZbh + " 不存在!");
  985 + return rs;
  986 + } else {
  987 + dayOfSchedule.changeCar(sch, clZbh);
  988 + }
  989 + }
  990 + //换驾驶员
  991 + String jsy = map.get("jsy");
  992 + if (StringUtils.isNotEmpty(jsy) && jsy.indexOf("/") != -1) {
  993 + persoChange(sch, jsy.split("/")[0]);
  994 + }
  995 + //换售票员
  996 + String spy = map.get("spy");
  997 + if (StringUtils.isNotEmpty(spy) && spy.indexOf("/") != -1 && !spy.equals("/")) {
  998 + persoChangeSPY(sch, spy.split("/")[0]);
  999 + }
  1000 + else{
  1001 + sch.setsGh("");
  1002 + sch.setsName("");
  1003 + }
  1004 +
  1005 +
970 1006 if (StringUtils.isNotBlank(fcsjActual)) {
971 1007 LineConfig config = lineConfigData.get(sch.getXlBm());
972 1008 long t = 0L;
... ... @@ -1013,8 +1049,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1013 1049  
1014 1050 try {
1015 1051 //烂班
1016   - if(map.get("status") != null
1017   - && Integer.parseInt(map.get("status").toString()) == -1){
  1052 + if (map.get("status") != null
  1053 + && Integer.parseInt(map.get("status").toString()) == -1) {
1018 1054 destroy(sch.getId() + "", "", map.get("adjustExps").toString());
1019 1055 }
1020 1056 } catch (NumberFormatException e) {
... ... @@ -1023,14 +1059,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1023 1059  
1024 1060 //修改班次里程
1025 1061 String jhlc = map.get("jhlc");
1026   - if(StringUtils.isNotEmpty(jhlc)
1027   - && Double.parseDouble(jhlc) != sch.getJhlc()){
  1062 + if (StringUtils.isNotEmpty(jhlc)
  1063 + && Double.parseDouble(jhlc) != sch.getJhlc()) {
1028 1064 sch.setJhlc(Double.parseDouble(jhlc));
1029 1065 }
1030 1066 }
1031 1067  
1032 1068 String bcType = map.get("bcType");
1033   - if(StringUtils.isNotEmpty(bcType)){
  1069 + if (StringUtils.isNotEmpty(bcType)) {
1034 1070 sch.setBcType(bcType);
1035 1071 }
1036 1072 //班次状态
... ... @@ -1247,11 +1283,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1247 1283 }
1248 1284  
1249 1285  
1250   -
1251 1286 @Override
1252 1287 public Map<String, Object> findKMBC(String jName, String clZbh,
1253   - String lpName, String date,String line) {
1254   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1288 + String lpName, String date, String line) {
  1289 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1255 1290 DecimalFormat format = new DecimalFormat("0.00");
1256 1291 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
1257 1292 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
... ... @@ -1286,10 +1321,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1286 1321 if (childTaskPlans.isEmpty()) {
1287 1322 if (scheduleRealInfo.getBcType().equals("in") ||
1288 1323 scheduleRealInfo.getBcType().equals("out")) {
1289   - if(scheduleRealInfo.getStatus() != -1){
1290   - jcclc += tempJhlc;
1291   - }
1292   -
  1324 + if (scheduleRealInfo.getStatus() != -1) {
  1325 + jcclc += tempJhlc;
  1326 + }
  1327 +
1293 1328 }
1294 1329 //主任务 放空班次属于营运
1295 1330 // else if(scheduleRealInfo.getBcType().equals("venting")){
... ... @@ -1451,60 +1486,60 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1451 1486  
1452 1487 @Override
1453 1488 public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1454   - String lpName, String date,String line) {
1455   - List<ScheduleRealInfo> listSchedule=new ArrayList<ScheduleRealInfo>();
  1489 + String lpName, String date, String line) {
  1490 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
1456 1491 List<ScheduleRealInfo> list = null;
1457   - list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date,line);
  1492 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1458 1493 for (int i = 0; i < list.size(); i++) {
1459 1494 ScheduleRealInfo s = list.get(i);
1460   - s.setAdjustExps(i+1+"");
  1495 + s.setAdjustExps(i + 1 + "");
1461 1496 String remarks = "";
1462 1497 if (s.getRemarks() != null) {
1463 1498 remarks += s.getRemarks();
1464 1499 }
1465   -
  1500 +
1466 1501 Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1467 1502 if (!childTaskPlans.isEmpty()) {
1468   - s.setFcsjActual("");
1469   - s.setZdsjActual("");
  1503 + s.setFcsjActual("");
  1504 + s.setZdsjActual("");
1470 1505 }
1471   -
1472   - if(s.isDestroy()){
1473   - s.setFcsjActual("");
1474   - s.setZdsjActual("");
1475   - s.setJhlc(0.0);
1476   - remarks +="(烂班)";
1477   - s.setRemarks(remarks);
  1506 +
  1507 + if (s.isDestroy()) {
  1508 + s.setFcsjActual("");
  1509 + s.setZdsjActual("");
  1510 + s.setJhlc(0.0);
  1511 + remarks += "(烂班)";
  1512 + s.setRemarks(remarks);
1478 1513 }
1479 1514 listSchedule.add(s);
1480 1515 //计算营运里程,空驶里程
1481 1516 if (!childTaskPlans.isEmpty()) {
1482   - String sqlPc="select * from bsth_c_s_child_task where schedule="+s.getId() +" order by start_date ";
1483   - List<ScheduleRealInfo> lists= jdbcTemplate.query(sqlPc,
1484   - new RowMapper<ScheduleRealInfo>(){
1485   - @Override
1486   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
1487   - ScheduleRealInfo t=new ScheduleRealInfo();
1488   - if(rs.getInt("destroy")==0){
1489   - t.setFcsjActual(rs.getString("start_date"));
1490   - t.setZdsjActual(rs.getString("end_date"));
1491   - t.setJhlc(rs.getDouble("mileage"));
1492   - }else{
1493   - t.setFcsjActual("");
1494   - t.setZdsjActual("");
1495   - t.setJhlc(0.0);
1496   - }
1497   - t.setQdzName(rs.getString("start_station_name"));
1498   - t.setZdzName(rs.getString("end_station_name"));
1499   - t.setRemarks(rs.getString("remarks"));
1500   - t.setAdjustExps("子");
1501   - return t;
1502   - }
1503   - });
1504   - for (int j = 0; j < lists.size(); j++) {
1505   - ScheduleRealInfo t=lists.get(j);
1506   - listSchedule.add(t);
1507   - }
  1517 + String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";
  1518 + List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,
  1519 + new RowMapper<ScheduleRealInfo>() {
  1520 + @Override
  1521 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1522 + ScheduleRealInfo t = new ScheduleRealInfo();
  1523 + if (rs.getInt("destroy") == 0) {
  1524 + t.setFcsjActual(rs.getString("start_date"));
  1525 + t.setZdsjActual(rs.getString("end_date"));
  1526 + t.setJhlc(rs.getDouble("mileage"));
  1527 + } else {
  1528 + t.setFcsjActual("");
  1529 + t.setZdsjActual("");
  1530 + t.setJhlc(0.0);
  1531 + }
  1532 + t.setQdzName(rs.getString("start_station_name"));
  1533 + t.setZdzName(rs.getString("end_station_name"));
  1534 + t.setRemarks(rs.getString("remarks"));
  1535 + t.setAdjustExps("子");
  1536 + return t;
  1537 + }
  1538 + });
  1539 + for (int j = 0; j < lists.size(); j++) {
  1540 + ScheduleRealInfo t = lists.get(j);
  1541 + listSchedule.add(t);
  1542 + }
1508 1543 }
1509 1544 }
1510 1545  
... ... @@ -1532,12 +1567,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1532 1567 @Override
1533 1568 public List<Map<String, Object>> statisticsDaily(String line, String date,
1534 1569 String xlName, String type) {
1535   - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1536   - if(date.length() == 10)
1537   - list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
1538   - else if(date.length() == 7)
1539   - list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1540   -
  1570 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  1571 + if (date.length() == 10)
  1572 + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1573 + else if (date.length() == 7)
  1574 + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
  1575 +
1541 1576 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1542 1577 DecimalFormat format = new DecimalFormat("0.00");
1543 1578 double jhlc = 0, tempJhlc = 0, childMileage = 0;
... ... @@ -1551,11 +1586,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1551 1586 int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
1552 1587 int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
1553 1588 int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
1554   -
  1589 +
1555 1590 double jhlcZ = 0, tempJhlcZ = 0, childMileageZ = 0;
1556   - float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
1557   - ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
1558   - ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
  1591 + float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
  1592 + ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
  1593 + ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
1559 1594 //班次
1560 1595 int ssbcZ = 0, ssbc_lzZ = 0, ssbc_dmZ = 0, ssbc_gzZ = 0, ssbc_jfZ = 0, ssbc_zsZ = 0, ssbc_qrZ = 0, ssbc_qcZ = 0, ssbc_kxZ = 0, ssbc_qhZ = 0, ssbc_ywZ = 0, ssbc_otherZ = 0;
1561 1596 int jhbcZ = 0, jhbc_mZ = 0, jhbc_aZ = 0;
... ... @@ -1564,9 +1599,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1564 1599 int fzbcZ = 0, fzbc_mZ = 0, fzbc_aZ = 0;
1565 1600 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
1566 1601 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
1567   - Map<String, Object> map =null;
1568   - for (int i=0; i<list.size();i++) {
1569   - ScheduleRealInfo scheduleRealInfo=list.get(i);
  1602 + Map<String, Object> map = null;
  1603 + for (int i = 0; i < list.size(); i++) {
  1604 + ScheduleRealInfo scheduleRealInfo = list.get(i);
1570 1605 if (scheduleRealInfo != null) {
1571 1606 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1572 1607 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
... ... @@ -1580,7 +1615,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1580 1615 jhlc += tempJhlc;
1581 1616 jhlcZ += tempJhlc;
1582 1617 }
1583   - if (scheduleRealInfo.getStatus() == -1) {
  1618 + if (scheduleRealInfo.getStatus() == -1) {
1584 1619 ssgl += tempJhlc;
1585 1620 ssglZ += tempJhlc;
1586 1621 ssbc++;
... ... @@ -1641,7 +1676,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1641 1676 ssbc_other++;
1642 1677 ssbc_otherZ++;
1643 1678 }
1644   - }else {
  1679 + } else {
1645 1680 sjgl += tempJhlc;
1646 1681 sjglZ += tempJhlc;
1647 1682 }
... ... @@ -1765,12 +1800,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1765 1800 fzbc_aZ++;
1766 1801 }
1767 1802 }
1768   -
1769   - if(i<list.size()-1){
1770   - if(!scheduleRealInfo.getXlBm().equals(list.get(i+1).getXlBm()))
1771   - {
1772   - map= new HashMap<String, Object>();
1773   - map.put("xlName", scheduleRealInfo.getXlName());
  1803 +
  1804 + if (i < list.size() - 1) {
  1805 + if (!scheduleRealInfo.getXlBm().equals(list.get(i + 1).getXlBm())) {
  1806 + map = new HashMap<String, Object>();
  1807 + map.put("xlName", scheduleRealInfo.getXlName());
1774 1808 map.put("jhlc", format.format(jhlc));
1775 1809 map.put("sjgl", format.format(sjgl));
1776 1810 map.put("ssgl", format.format(ssgl));
... ... @@ -1818,21 +1852,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1818 1852 map.put("djg_a", djg_a);
1819 1853 map.put("djg_time", djg_time);
1820 1854 lMap.add(map);
1821   - jhlc = 0; tempJhlc = 0; childMileage = 0;
1822   - sjgl = 0f; ssgl = 0f; ssgl_lz = 0f; ssgl_dm = 0f; ssgl_gz = 0f; ssgl_jf = 0f; ssgl_zs = 0f;
1823   - ssgl_qr = 0f; ssgl_qc = 0f; ssgl_kx = 0f; ssgl_qh = 0f; ssgl_yw = 0f;ssgl_other = 0f;
1824   - ljgl = 0f;
  1855 + jhlc = 0;
  1856 + tempJhlc = 0;
  1857 + childMileage = 0;
  1858 + sjgl = 0f;
  1859 + ssgl = 0f;
  1860 + ssgl_lz = 0f;
  1861 + ssgl_dm = 0f;
  1862 + ssgl_gz = 0f;
  1863 + ssgl_jf = 0f;
  1864 + ssgl_zs = 0f;
  1865 + ssgl_qr = 0f;
  1866 + ssgl_qc = 0f;
  1867 + ssgl_kx = 0f;
  1868 + ssgl_qh = 0f;
  1869 + ssgl_yw = 0f;
  1870 + ssgl_other = 0f;
  1871 + ljgl = 0f;
1825 1872 //班次
1826   - jhbc = 0; jhbc_m = 0; jhbc_a = 0;
1827   - sjbc = 0; sjbc_m = 0; sjbc_a = 0;
1828   - ljbc = 0; ljbc_m = 0; ljbc_a = 0;
1829   - fzbc = 0; fzbc_m = 0; fzbc_a = 0;
1830   - dtbc = 0; dtbc_m = 0; dtbc_a = 0;
1831   - djg = 0; djg_m = 0; djg_a = 0; djg_time = 0;
1832   - }
1833   - }else{
1834   - map= new HashMap<String, Object>();
1835   - map.put("xlName", scheduleRealInfo.getXlName());
  1873 + jhbc = 0;
  1874 + jhbc_m = 0;
  1875 + jhbc_a = 0;
  1876 + sjbc = 0;
  1877 + sjbc_m = 0;
  1878 + sjbc_a = 0;
  1879 + ljbc = 0;
  1880 + ljbc_m = 0;
  1881 + ljbc_a = 0;
  1882 + fzbc = 0;
  1883 + fzbc_m = 0;
  1884 + fzbc_a = 0;
  1885 + dtbc = 0;
  1886 + dtbc_m = 0;
  1887 + dtbc_a = 0;
  1888 + djg = 0;
  1889 + djg_m = 0;
  1890 + djg_a = 0;
  1891 + djg_time = 0;
  1892 + }
  1893 + } else {
  1894 + map = new HashMap<String, Object>();
  1895 + map.put("xlName", scheduleRealInfo.getXlName());
1836 1896 map.put("jhlc", format.format(jhlc));
1837 1897 map.put("sjgl", format.format(sjgl));
1838 1898 map.put("ssgl", format.format(ssgl));
... ... @@ -1880,22 +1940,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1880 1940 map.put("djg_a", djg_a);
1881 1941 map.put("djg_time", djg_time);
1882 1942 lMap.add(map);
1883   - jhlc = 0; tempJhlc = 0; childMileage = 0;
1884   - sjgl = 0f; ssgl = 0f; ssgl_lz = 0f; ssgl_dm = 0f; ssgl_gz = 0f; ssgl_jf = 0f; ssgl_zs = 0f;
1885   - ssgl_qr = 0f; ssgl_qc = 0f; ssgl_kx = 0f; ssgl_qh = 0f; ssgl_yw = 0f;ssgl_other = 0f;
  1943 + jhlc = 0;
  1944 + tempJhlc = 0;
  1945 + childMileage = 0;
  1946 + sjgl = 0f;
  1947 + ssgl = 0f;
  1948 + ssgl_lz = 0f;
  1949 + ssgl_dm = 0f;
  1950 + ssgl_gz = 0f;
  1951 + ssgl_jf = 0f;
  1952 + ssgl_zs = 0f;
  1953 + ssgl_qr = 0f;
  1954 + ssgl_qc = 0f;
  1955 + ssgl_kx = 0f;
  1956 + ssgl_qh = 0f;
  1957 + ssgl_yw = 0f;
  1958 + ssgl_other = 0f;
1886 1959 ljgl = 0f;
1887   - //班次
1888   - jhbc = 0; jhbc_m = 0; jhbc_a = 0;
1889   - sjbc = 0; sjbc_m = 0; sjbc_a = 0;
1890   - ljbc = 0; ljbc_m = 0; ljbc_a = 0;
1891   - fzbc = 0; fzbc_m = 0; fzbc_a = 0;
1892   - dtbc = 0; dtbc_m = 0; dtbc_a = 0;
1893   - djg = 0; djg_m = 0; djg_a = 0; djg_time = 0;
  1960 + //班次
  1961 + jhbc = 0;
  1962 + jhbc_m = 0;
  1963 + jhbc_a = 0;
  1964 + sjbc = 0;
  1965 + sjbc_m = 0;
  1966 + sjbc_a = 0;
  1967 + ljbc = 0;
  1968 + ljbc_m = 0;
  1969 + ljbc_a = 0;
  1970 + fzbc = 0;
  1971 + fzbc_m = 0;
  1972 + fzbc_a = 0;
  1973 + dtbc = 0;
  1974 + dtbc_m = 0;
  1975 + dtbc_a = 0;
  1976 + djg = 0;
  1977 + djg_m = 0;
  1978 + djg_a = 0;
  1979 + djg_time = 0;
1894 1980 }
1895 1981 }
1896 1982 }
1897   - map= new HashMap<String, Object>();
1898   - map.put("xlName", "合计");
  1983 + map = new HashMap<String, Object>();
  1984 + map.put("xlName", "合计");
1899 1985 map.put("jhlc", format.format(jhlcZ));
1900 1986 map.put("sjgl", format.format(sjglZ));
1901 1987 map.put("ssgl", format.format(ssglZ));
... ... @@ -1981,24 +2067,24 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1981 2067 m.get("djg_a", djg_a);
1982 2068 m.get("djg_time", djg_time);
1983 2069 }*/
1984   -
1985   - if(type != null && type.length() != 0 && type.equals("export")){
1986   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
1987   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
1988   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1989   - Map<String,Object> m = new HashMap<String, Object>();
1990   - ReportUtils ee = new ReportUtils();
1991   - try {
1992   - listI.add(lMap.iterator());
1993   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1994   - ee.excelReplace(listI, new Object[] { m }, path+"mould/statisticsDaily_.xls",
1995   - path+"export/统计日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
1996   - } catch (Exception e) {
1997   - // TODO: handle exception
1998   - e.printStackTrace();
1999   - }
  2070 +
  2071 + if (type != null && type.length() != 0 && type.equals("export")) {
  2072 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2073 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2074 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2075 + Map<String, Object> m = new HashMap<String, Object>();
  2076 + ReportUtils ee = new ReportUtils();
  2077 + try {
  2078 + listI.add(lMap.iterator());
  2079 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2080 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  2081 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  2082 + } catch (Exception e) {
  2083 + // TODO: handle exception
  2084 + e.printStackTrace();
  2085 + }
2000 2086 }
2001   -
  2087 +
2002 2088 return lMap;
2003 2089 }
2004 2090  
... ... @@ -2110,84 +2196,88 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2110 2196 }
2111 2197 }
2112 2198 }*/
2113   - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2114   - String lpName="lpName";
2115   - String zdsj="";
2116   - String zdsjActual="";
2117   - String zdsj1="";
2118   - String zdsjActual1="";
2119   - List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
2120   - for (int i = 0; i < listInfo.size(); i++) {
2121   - ScheduleRealInfo t=listInfo.get(i);
2122   - if(!lpName.equals(t.getLpName())){
2123   - zdsjActual=t.getZdsjActual();
2124   - zdsj=t.getZdsj();
2125   - t.setZdsjActual("");
2126   - t.setZdsj("");
2127   - }else{
2128   - zdsj1=t.getZdsj();
2129   - zdsjActual1=t.getZdsjActual();
2130   - t.setZdsjActual(zdsjActual);
2131   - t.setZdsj(zdsj);
2132   - zdsj=zdsj1;
2133   - zdsjActual=zdsjActual1;
2134   - }
2135   - lpName=t.getLpName();
2136   - list.add(t);
2137   - }
2138   -
2139   - List<ScheduleRealInfo> listInfo2=scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2140   - List<ScheduleRealInfo> xList=new ArrayList<ScheduleRealInfo>();
2141   - List<ScheduleRealInfo> yList=new ArrayList<ScheduleRealInfo>();
2142   - List<ScheduleRealInfo> zList=new ArrayList<ScheduleRealInfo>();
2143   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
2144   - if(listInfo2.size()>0){
2145   - int a=listInfo2.size()%3;
2146   - int b=listInfo2.size()/3;
2147   - int x = 0,y=0;
2148   - if(a==2){
2149   - x=b+1;y=x*2;;
2150   - }else if(b==1){
2151   - x=b+1;y=x*2-1;;
2152   - }else{
2153   - x=b;
2154   - y=2*x;
2155   -
2156   - }
2157   - for (int i = 0; i < listInfo2.size(); i++) {
2158   - ScheduleRealInfo s=listInfo2.get(i);
2159   - if(i+1<=x){
2160   - xList.add(s);
2161   - }else if((i+1)>x&&(i+1)<=y){
2162   - yList.add(s);
2163   - }else{
2164   - zList.add(s);
2165   - }
2166   - }
2167   - for (int i = 0; i < x; i++) {
2168   - newList.add(xList.get(i));
2169   - if(yList.size()>i){
2170   - newList.add(yList.get(i));
2171   - }else{
2172   - newList.add(new ScheduleRealInfo());
2173   - }
2174   - if(zList.size()>i){
2175   - newList.add(zList.get(i));
2176   - }else{
2177   - newList.add(new ScheduleRealInfo());
2178   - }
2179   -
2180   - }
2181   - }
2182   - for (int i = 0; i < newList.size(); i++) {
2183   - ScheduleRealInfo t1=newList.get(i);
2184   - for (int j = 0; j < list.size(); j++) {
2185   - ScheduleRealInfo t2=list.get(j);
2186   - if(t1.getId()==t2.getId()){
2187   - t1=t2;
2188   - }
2189   - }
2190   - }
  2199 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2200 + String lpName = "lpName";
  2201 + String zdsj = "";
  2202 + String zdsjActual = "";
  2203 + String zdsj1 = "";
  2204 + String zdsjActual1 = "";
  2205 + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
  2206 + for (int i = 0; i < listInfo.size(); i++) {
  2207 + ScheduleRealInfo t = listInfo.get(i);
  2208 + if (!lpName.equals(t.getLpName())) {
  2209 + zdsjActual = t.getZdsjActual();
  2210 + zdsj = t.getZdsj();
  2211 + t.setZdsjActual("");
  2212 + t.setZdsj("");
  2213 + } else {
  2214 + zdsj1 = t.getZdsj();
  2215 + zdsjActual1 = t.getZdsjActual();
  2216 + t.setZdsjActual(zdsjActual);
  2217 + t.setZdsj(zdsj);
  2218 + zdsj = zdsj1;
  2219 + zdsjActual = zdsjActual1;
  2220 + }
  2221 + lpName = t.getLpName();
  2222 + list.add(t);
  2223 + }
  2224 +
  2225 + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2226 + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>();
  2227 + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>();
  2228 + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>();
  2229 + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>();
  2230 + if (listInfo2.size() > 0) {
  2231 + int a = listInfo2.size() % 3;
  2232 + int b = listInfo2.size() / 3;
  2233 + int x = 0, y = 0;
  2234 + if (a == 2) {
  2235 + x = b + 1;
  2236 + y = x * 2;
  2237 + ;
  2238 + } else if (b == 1) {
  2239 + x = b + 1;
  2240 + y = x * 2 - 1;
  2241 + ;
  2242 + } else {
  2243 + x = b;
  2244 + y = 2 * x;
  2245 +
  2246 + }
  2247 + for (int i = 0; i < listInfo2.size(); i++) {
  2248 + ScheduleRealInfo s = listInfo2.get(i);
  2249 + if (i + 1 <= x) {
  2250 + xList.add(s);
  2251 + } else if ((i + 1) > x && (i + 1) <= y) {
  2252 + yList.add(s);
  2253 + } else {
  2254 + zList.add(s);
  2255 + }
  2256 + }
  2257 + for (int i = 0; i < x; i++) {
  2258 + newList.add(xList.get(i));
  2259 + if (yList.size() > i) {
  2260 + newList.add(yList.get(i));
  2261 + } else {
  2262 + newList.add(new ScheduleRealInfo());
  2263 + }
  2264 + if (zList.size() > i) {
  2265 + newList.add(zList.get(i));
  2266 + } else {
  2267 + newList.add(new ScheduleRealInfo());
  2268 + }
  2269 +
  2270 + }
  2271 + }
  2272 + for (int i = 0; i < newList.size(); i++) {
  2273 + ScheduleRealInfo t1 = newList.get(i);
  2274 + for (int j = 0; j < list.size(); j++) {
  2275 + ScheduleRealInfo t2 = list.get(j);
  2276 + if (t1.getId() == t2.getId()) {
  2277 + t1 = t2;
  2278 + }
  2279 + }
  2280 + }
2191 2281 return newList;
2192 2282 }
2193 2283  
... ... @@ -2202,28 +2292,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2202 2292 }
2203 2293 }
2204 2294 }*/
2205   - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2206   - String lpName="lpName";
2207   - String zdsj="";
2208   - String zdsjActual="";
2209   - String zdsj1="";
2210   - String zdsjActual1="";
2211   - List<ScheduleRealInfo> listInfo=scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
2212   - for (int i = 0; i < listInfo.size(); i++) {
2213   - ScheduleRealInfo t=listInfo.get(i);
2214   - if(!lpName.equals(t.getLpName())){
2215   - zdsjActual=t.getZdsjActual();
2216   - zdsj=t.getZdsj();
2217   - t.setZdsjActual("");
2218   - t.setZdsj("");
2219   - }else{
2220   - zdsj1=t.getZdsj();
2221   - zdsjActual1=t.getZdsjActual();
2222   - t.setZdsjActual(zdsjActual);
2223   - t.setZdsj(zdsj);
2224   - zdsj=zdsj1;
2225   - zdsjActual=zdsjActual1;
2226   - }
  2295 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2296 + String lpName = "lpName";
  2297 + String zdsj = "";
  2298 + String zdsjActual = "";
  2299 + String zdsj1 = "";
  2300 + String zdsjActual1 = "";
  2301 + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date);
  2302 + for (int i = 0; i < listInfo.size(); i++) {
  2303 + ScheduleRealInfo t = listInfo.get(i);
  2304 + if (!lpName.equals(t.getLpName())) {
  2305 + zdsjActual = t.getZdsjActual();
  2306 + zdsj = t.getZdsj();
  2307 + t.setZdsjActual("");
  2308 + t.setZdsj("");
  2309 + } else {
  2310 + zdsj1 = t.getZdsj();
  2311 + zdsjActual1 = t.getZdsjActual();
  2312 + t.setZdsjActual(zdsjActual);
  2313 + t.setZdsj(zdsj);
  2314 + zdsj = zdsj1;
  2315 + zdsjActual = zdsjActual1;
  2316 + }
2227 2317 /*if(i<listInfo.size()-1){
2228 2318 if(s.getLpName().equals(listInfo.get(i+1).getLpName())){
2229 2319 zdsj=s.getZdsj();
... ... @@ -2236,10 +2326,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2236 2326 zdsj=s.getZdsj();
2237 2327 zdsjActual=s.getZdsjActual();
2238 2328 }*/
2239   -
2240   - lpName=t.getLpName();
2241   - list.add(t);
2242   - }
  2329 +
  2330 + lpName = t.getLpName();
  2331 + list.add(t);
  2332 + }
2243 2333 return list;
2244 2334 }
2245 2335  
... ... @@ -2426,7 +2516,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2426 2516 String jName = BasicData.allPerson.get(jGh);
2427 2517 if (StringUtils.isNotEmpty(jName)) {
2428 2518  
2429   - if(jGh.indexOf("-") != -1)
  2519 + if (jGh.indexOf("-") != -1)
2430 2520 sch.setjGh(jGh.substring(jGh.indexOf("-") + 1));
2431 2521 else
2432 2522 sch.setjGh(jGh);
... ... @@ -2444,7 +2534,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2444 2534 return;
2445 2535 String sName = BasicData.allPerson.get(sGh);
2446 2536 if (StringUtils.isNotEmpty(sName)) {
2447   - sch.setsGh(sGh);
  2537 + if (sGh.indexOf("-") != -1)
  2538 + sch.setsGh(sGh.substring(sGh.indexOf("-") + 1));
  2539 + else
  2540 + sch.setsGh(sGh);
2448 2541 sch.setsName(sName);
2449 2542 }
2450 2543 }
... ... @@ -2686,600 +2779,600 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2686 2779 return null;
2687 2780 }
2688 2781  
2689   - @Override
2690   - public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
2691   - // TODO Auto-generated method stub
2692   - ReportUtils ee = new ReportUtils();
2693   - ReportRelatedUtils rru = new ReportRelatedUtils();
2694   - List<Iterator<?>> list = new ArrayList<Iterator<?>>();
2695   - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
2696   - List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
2697   -
2698   - DecimalFormat format = new DecimalFormat("0.00");
  2782 + @Override
  2783 + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) {
  2784 + // TODO Auto-generated method stub
  2785 + ReportUtils ee = new ReportUtils();
  2786 + ReportRelatedUtils rru = new ReportRelatedUtils();
  2787 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  2788 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  2789 + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
  2790 +
  2791 + DecimalFormat format = new DecimalFormat("0.00");
2699 2792 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
2700 2793 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2701   - int jhbc = 0,cjbc = 0,ljbc = 0;
2702   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2703   - float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2704   - int xyz=1;
2705   - Map<String,Object> map;
2706   - for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
2707   - if(scheduleRealInfo != null){
2708   - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
2709   - //计划里程(主任务过滤掉临加班次),
2710   - //烂班里程(主任务烂班),
2711   - //临加里程(主任务临加),
2712   - //计划班次,烂班班次,增加班次
2713   - double jh = 0, sj = 0;
2714   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2715   - if(scheduleRealInfo.isSflj()){
2716   - ljbc++;
2717   - }else{
2718   - if( !(scheduleRealInfo.getBcType().equals("in")
2719   - ||scheduleRealInfo.getBcType().equals("out")) ){
2720   - jhbc++;
2721   - jh += tempJhlc;
2722   - }
2723   - if(scheduleRealInfo.getStatus() == -1){
2724   - remMileage += tempJhlc;
2725   - cjbc++;
2726   - }
2727   - }
2728   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2729   - //计算营运里程,空驶里程
2730   - if(childTaskPlans.isEmpty()){
2731   - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
2732   - ){
2733   - jcclc +=tempJhlc;
2734   - }
2735   - //主任务 放空班次属于营运
  2794 + int jhbc = 0, cjbc = 0, ljbc = 0;
  2795 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  2796 + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
  2797 + int xyz = 1;
  2798 + Map<String, Object> map;
  2799 + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {
  2800 + if (scheduleRealInfo != null) {
  2801 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  2802 + //计划里程(主任务过滤掉临加班次),
  2803 + //烂班里程(主任务烂班),
  2804 + //临加里程(主任务临加),
  2805 + //计划班次,烂班班次,增加班次
  2806 + double jh = 0, sj = 0;
  2807 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2808 + if (scheduleRealInfo.isSflj()) {
  2809 + ljbc++;
  2810 + } else {
  2811 + if (!(scheduleRealInfo.getBcType().equals("in")
  2812 + || scheduleRealInfo.getBcType().equals("out"))) {
  2813 + jhbc++;
  2814 + jh += tempJhlc;
  2815 + }
  2816 + if (scheduleRealInfo.getStatus() == -1) {
  2817 + remMileage += tempJhlc;
  2818 + cjbc++;
  2819 + }
  2820 + }
  2821 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2822 + //计算营运里程,空驶里程
  2823 + if (childTaskPlans.isEmpty()) {
  2824 + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  2825 + ) {
  2826 + jcclc += tempJhlc;
  2827 + }
  2828 + //主任务 放空班次属于营运
2736 2829 // else if(scheduleRealInfo.getBcType().equals("venting")){
2737 2830 // ksgl += tempJhlc;
2738 2831 // }
2739   - else{
2740   - if(scheduleRealInfo.getStatus() != -1){
2741   - if(scheduleRealInfo.isSflj()){
2742   - addMileage += tempJhlc;
2743   - }
2744   - sj += tempJhlc;
2745   - }
2746   - }
2747   - }else{
2748   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2749   - while(it.hasNext()){
2750   - ChildTaskPlan childTaskPlan = it.next();
2751   - if(childTaskPlan.getMileageType().equals("empty")){
2752   - if(childTaskPlan.isDestroy()){
2753   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2754   - }else{
2755   - if(scheduleRealInfo.isSflj()){
2756   - addMileage += tempJhlc;
2757   - }
2758   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2759   - }
2760   - }else{
2761   - if(childTaskPlan.isDestroy()){
2762   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2763   -// cjbc++;
2764   - }else{
2765   - if(scheduleRealInfo.isSflj()){
2766   - addMileage += tempJhlc;
2767   - }
2768   - sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2769   - }
2770   - }
2771   - }
2772   - }
2773   -
2774   - if(!(scheduleRealInfo.getBcType().equals("in")||scheduleRealInfo.getBcType().equals("out"))){
2775   - map = new HashMap<String, Object>();
2776   - try {
2777   - scheduleRealInfo.setBcs(xyz);
2778   - xyz++;
2779   - Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks();
2780   - Double sjlc=0.0;
2781   - if(!cs.isEmpty()){
2782   - Iterator<ChildTaskPlan> it = cs.iterator();
2783   - while(it.hasNext()){
2784   - ChildTaskPlan c = it.next();
2785   - if(!c.isDestroy()){
2786   - sjlc += c.getMileage()==null?0:c.getMileage();
2787   - }
2788   -
2789   - }
2790   - }else{
2791   - if(scheduleRealInfo.getStatus() != -1){
2792   - sjlc =scheduleRealInfo.getJhlc();
2793   - }
2794   - }
2795   - scheduleRealInfo.setjName(scheduleRealInfo.getjGh()+scheduleRealInfo.getjName());
2796   - scheduleRealInfo.setsName(scheduleRealInfo.getsGh()+scheduleRealInfo.getsName());
2797   - scheduleRealInfo.setSjlc(format.format(sjlc));
2798   - map = rru.getMapValue(scheduleRealInfo);
2799   - String zdsj = scheduleRealInfo.getZdsj();
2800   - String zdsjActual = scheduleRealInfo.getZdsjActual();
2801   - if(zdsj != null && zdsjActual != null &&
2802   - !zdsj.equals(zdsjActual)){
2803   - if(zdsj.compareTo(zdsjActual) > 0){
2804   - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
2805   - map.put("slow", "");
2806   - } else {
2807   - map.put("fast", "");
2808   - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
2809   - }
2810   - } else {
2811   - map.put("fast", "");
2812   - map.put("slow", "");
2813   - }
2814   - System.out.println(map);
2815   - listMap.add(map);
2816   - } catch (Exception e) {
2817   - e.printStackTrace();
2818   - }
2819   - }
2820   - jhlc += jh;
2821   - yygl += sj;
2822   - if(jh > sj){
2823   - remgl += jh - sj;
2824   - } else {
2825   - addgl += sj - jh;
2826   - }
2827   - }
2828   - }
2829   -
2830   -
2831   - List<Ylxxb> listYlxxb=ylxxbRepository.queryListYlxxb( clZbh, date);
2832   - Double jzl=0.0;
2833   - for(int t=0;t<listYlxxb.size();t++){
2834   - Ylxxb y=listYlxxb.get(t);
2835   - jzl += y.getJzl();
2836   - }
2837   -
2838   - //计算里程和班次数,并放入Map里
2839   - map = new HashMap<String, Object>();
2840   - map.put("jzl", jzl);
2841   - map.put("jhlc", format.format(jhlc+jcclc));
2842   - map.put("yygljh", format.format(jhlc));
2843   - map.put("ssgl", format.format(remMileage));
2844   - map.put("ksgl", format.format(ksgl));
2845   - map.put("yyglsj", format.format(yygl));
2846   - map.put("jhbc", jhbc);
2847   - map.put("jcclc", jcclc);
2848   -
2849   - map.put("ljgl", format.format(addMileage));
2850   - map.put("ssbc", cjbc);
2851   - map.put("ysgl", format.format(yygl));
2852   - map.put("sjbc", jhbc-cjbc+ljbc);
2853   - map.put("zgl", format.format(yygl+ksgl+jcclc));
2854   - map.put("ljbc", ljbc);
2855   - String zdp="",zwdp="",wdp="";
2856   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2857   - List<DutyEmployee> listDtuy= dutyEmployeeService.getDutyEmployee(line, date+"00:00", date+"23:59");
2858   - try {
2859   - Long fcsj1=sdf.parse(date+" 03:00").getTime();
2860   - Long fcsj2=sdf.parse(date+" 11:00").getTime();
2861   - Long fcsj3=sdf.parse(date+" 22:00").getTime();
2862   - for(int i=0;i<listDtuy.size();i++){
2863   - DutyEmployee t=listDtuy.get(i);
2864   - Long ts=t.getTs();
2865   - if(ts>fcsj1&&ts<fcsj2){
2866   - if(zdp.indexOf(t.getuName())==-1){
2867   - zdp +=t.getuName()+",";
2868   -
2869   - }
2870   - }else if(ts>fcsj2 && ts<fcsj3){
2871   - if(zwdp.indexOf(t.getuName())==-1){
2872   - zwdp +=t.getuName()+",";
2873   - }
2874   - }else{
2875   - if(wdp.indexOf(t.getuName())==-1){
2876   - wdp +=t.getuName()+",";
2877   - }
2878   - }
2879   - }
2880   - }catch (ParseException e) {
2881   - // TODO Auto-generated catch block
2882   - e.printStackTrace();
2883   - }
2884   - map.put("zdp", zdp);
2885   - map.put("zwdp", zwdp);
2886   - map.put("wdp", wdp);
2887   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
2888   - list.add(listMap.iterator());
2889   - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould/waybill_qingpu.xls",
2890   - path+"export/" + date+"-"+clZbh+"-行车路单.xls");
2891   -
2892   - return scheduleRealInfos;
2893   - }
2894   -
2895   - @Override
2896   - public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
2897   - // TODO Auto-generated method stub
2898   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2( clZbh,date,line);
2899   - DecimalFormat format = new DecimalFormat("0.00");
  2832 + else {
  2833 + if (scheduleRealInfo.getStatus() != -1) {
  2834 + if (scheduleRealInfo.isSflj()) {
  2835 + addMileage += tempJhlc;
  2836 + }
  2837 + sj += tempJhlc;
  2838 + }
  2839 + }
  2840 + } else {
  2841 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2842 + while (it.hasNext()) {
  2843 + ChildTaskPlan childTaskPlan = it.next();
  2844 + if (childTaskPlan.getMileageType().equals("empty")) {
  2845 + if (childTaskPlan.isDestroy()) {
  2846 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2847 + } else {
  2848 + if (scheduleRealInfo.isSflj()) {
  2849 + addMileage += tempJhlc;
  2850 + }
  2851 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2852 + }
  2853 + } else {
  2854 + if (childTaskPlan.isDestroy()) {
  2855 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2856 +// cjbc++;
  2857 + } else {
  2858 + if (scheduleRealInfo.isSflj()) {
  2859 + addMileage += tempJhlc;
  2860 + }
  2861 + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2862 + }
  2863 + }
  2864 + }
  2865 + }
  2866 +
  2867 + if (!(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out"))) {
  2868 + map = new HashMap<String, Object>();
  2869 + try {
  2870 + scheduleRealInfo.setBcs(xyz);
  2871 + xyz++;
  2872 + Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks();
  2873 + Double sjlc = 0.0;
  2874 + if (!cs.isEmpty()) {
  2875 + Iterator<ChildTaskPlan> it = cs.iterator();
  2876 + while (it.hasNext()) {
  2877 + ChildTaskPlan c = it.next();
  2878 + if (!c.isDestroy()) {
  2879 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  2880 + }
  2881 +
  2882 + }
  2883 + } else {
  2884 + if (scheduleRealInfo.getStatus() != -1) {
  2885 + sjlc = scheduleRealInfo.getJhlc();
  2886 + }
  2887 + }
  2888 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  2889 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  2890 + scheduleRealInfo.setSjlc(format.format(sjlc));
  2891 + map = rru.getMapValue(scheduleRealInfo);
  2892 + String zdsj = scheduleRealInfo.getZdsj();
  2893 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  2894 + if (zdsj != null && zdsjActual != null &&
  2895 + !zdsj.equals(zdsjActual)) {
  2896 + if (zdsj.compareTo(zdsjActual) > 0) {
  2897 + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2898 + map.put("slow", "");
  2899 + } else {
  2900 + map.put("fast", "");
  2901 + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  2902 + }
  2903 + } else {
  2904 + map.put("fast", "");
  2905 + map.put("slow", "");
  2906 + }
  2907 + System.out.println(map);
  2908 + listMap.add(map);
  2909 + } catch (Exception e) {
  2910 + e.printStackTrace();
  2911 + }
  2912 + }
  2913 + jhlc += jh;
  2914 + yygl += sj;
  2915 + if (jh > sj) {
  2916 + remgl += jh - sj;
  2917 + } else {
  2918 + addgl += sj - jh;
  2919 + }
  2920 + }
  2921 + }
  2922 +
  2923 +
  2924 + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(clZbh, date);
  2925 + Double jzl = 0.0;
  2926 + for (int t = 0; t < listYlxxb.size(); t++) {
  2927 + Ylxxb y = listYlxxb.get(t);
  2928 + jzl += y.getJzl();
  2929 + }
  2930 +
  2931 + //计算里程和班次数,并放入Map里
  2932 + map = new HashMap<String, Object>();
  2933 + map.put("jzl", jzl);
  2934 + map.put("jhlc", format.format(jhlc + jcclc));
  2935 + map.put("yygljh", format.format(jhlc));
  2936 + map.put("ssgl", format.format(remMileage));
  2937 + map.put("ksgl", format.format(ksgl));
  2938 + map.put("yyglsj", format.format(yygl));
  2939 + map.put("jhbc", jhbc);
  2940 + map.put("jcclc", jcclc);
  2941 +
  2942 + map.put("ljgl", format.format(addMileage));
  2943 + map.put("ssbc", cjbc);
  2944 + map.put("ysgl", format.format(yygl));
  2945 + map.put("sjbc", jhbc - cjbc + ljbc);
  2946 + map.put("zgl", format.format(yygl + ksgl + jcclc));
  2947 + map.put("ljbc", ljbc);
  2948 + String zdp = "", zwdp = "", wdp = "";
  2949 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2950 + List<DutyEmployee> listDtuy = dutyEmployeeService.getDutyEmployee(line, date + "00:00", date + "23:59");
  2951 + try {
  2952 + Long fcsj1 = sdf.parse(date + " 03:00").getTime();
  2953 + Long fcsj2 = sdf.parse(date + " 11:00").getTime();
  2954 + Long fcsj3 = sdf.parse(date + " 22:00").getTime();
  2955 + for (int i = 0; i < listDtuy.size(); i++) {
  2956 + DutyEmployee t = listDtuy.get(i);
  2957 + Long ts = t.getTs();
  2958 + if (ts > fcsj1 && ts < fcsj2) {
  2959 + if (zdp.indexOf(t.getuName()) == -1) {
  2960 + zdp += t.getuName() + ",";
  2961 +
  2962 + }
  2963 + } else if (ts > fcsj2 && ts < fcsj3) {
  2964 + if (zwdp.indexOf(t.getuName()) == -1) {
  2965 + zwdp += t.getuName() + ",";
  2966 + }
  2967 + } else {
  2968 + if (wdp.indexOf(t.getuName()) == -1) {
  2969 + wdp += t.getuName() + ",";
  2970 + }
  2971 + }
  2972 + }
  2973 + } catch (ParseException e) {
  2974 + // TODO Auto-generated catch block
  2975 + e.printStackTrace();
  2976 + }
  2977 + map.put("zdp", zdp);
  2978 + map.put("zwdp", zwdp);
  2979 + map.put("wdp", wdp);
  2980 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2981 + list.add(listMap.iterator());
  2982 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_qingpu.xls",
  2983 + path + "export/" + date + "-" + clZbh + "-行车路单.xls");
  2984 +
  2985 + return scheduleRealInfos;
  2986 + }
  2987 +
  2988 + @Override
  2989 + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) {
  2990 + // TODO Auto-generated method stub
  2991 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  2992 + DecimalFormat format = new DecimalFormat("0.00");
2900 2993 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
2901 2994 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2902   - int jhbc = 0,cjbc = 0,ljbc = 0;
2903   - double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2904   - float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2905   - Map<String,Object> map = new HashMap<String, Object>();
2906   - for(ScheduleRealInfo scheduleRealInfo : list){
2907   - if(scheduleRealInfo != null){
2908   - //计划里程(主任务过滤掉临加班次),
2909   - //烂班里程(主任务烂班),
2910   - //临加里程(主任务临加),
2911   - //计划班次,烂班班次,增加班次
2912   - double jh = 0, sj = 0;
2913   - tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2914   - if(scheduleRealInfo.isSflj()){
2915   - ljbc++;
2916   - }else{
2917   - if( !(scheduleRealInfo.getBcType().equals("in")
2918   - ||scheduleRealInfo.getBcType().equals("out")) ){
2919   - jhbc++;
2920   - jh += tempJhlc;
2921   - }
2922   -
2923   - if(scheduleRealInfo.getStatus() == -1){
2924   - remMileage += tempJhlc;
2925   - cjbc++;
2926   - }
2927   - }
2928   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2929   - //计算营运里程,空驶里程
2930   - if(childTaskPlans.isEmpty()){
2931   - if(scheduleRealInfo.getBcType().equals("in") ||
2932   - scheduleRealInfo.getBcType().equals("out")){
2933   - jcclc +=tempJhlc;
2934   - }
2935   -
2936   - //主任务 放空班次属于营运
  2995 + int jhbc = 0, cjbc = 0, ljbc = 0;
  2996 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  2997 + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
  2998 + Map<String, Object> map = new HashMap<String, Object>();
  2999 + for (ScheduleRealInfo scheduleRealInfo : list) {
  3000 + if (scheduleRealInfo != null) {
  3001 + //计划里程(主任务过滤掉临加班次),
  3002 + //烂班里程(主任务烂班),
  3003 + //临加里程(主任务临加),
  3004 + //计划班次,烂班班次,增加班次
  3005 + double jh = 0, sj = 0;
  3006 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  3007 + if (scheduleRealInfo.isSflj()) {
  3008 + ljbc++;
  3009 + } else {
  3010 + if (!(scheduleRealInfo.getBcType().equals("in")
  3011 + || scheduleRealInfo.getBcType().equals("out"))) {
  3012 + jhbc++;
  3013 + jh += tempJhlc;
  3014 + }
  3015 +
  3016 + if (scheduleRealInfo.getStatus() == -1) {
  3017 + remMileage += tempJhlc;
  3018 + cjbc++;
  3019 + }
  3020 + }
  3021 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  3022 + //计算营运里程,空驶里程
  3023 + if (childTaskPlans.isEmpty()) {
  3024 + if (scheduleRealInfo.getBcType().equals("in") ||
  3025 + scheduleRealInfo.getBcType().equals("out")) {
  3026 + jcclc += tempJhlc;
  3027 + }
  3028 +
  3029 + //主任务 放空班次属于营运
2937 3030 // else if(scheduleRealInfo.getBcType().equals("venting")){
2938 3031 // ksgl += tempJhlc;
2939 3032 // }
2940   - else{
2941   - if(scheduleRealInfo.getStatus() != -1){
2942   - if(scheduleRealInfo.isSflj()){
2943   - addMileage += tempJhlc;
2944   - }
2945   - sj += tempJhlc;
2946   - }
2947   - }
2948   - }else{
2949   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2950   - while(it.hasNext()){
2951   - ChildTaskPlan childTaskPlan = it.next();
2952   - if(childTaskPlan.getMileageType().equals("empty")){
2953   - if(childTaskPlan.isDestroy()){
2954   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2955   - }else{
2956   - if(scheduleRealInfo.isSflj()){
2957   - addMileage += tempJhlc;
2958   - }
2959   - ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2960   - }
2961   - }else{
2962   - if(childTaskPlan.isDestroy()){
2963   - remMileage += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  3033 + else {
  3034 + if (scheduleRealInfo.getStatus() != -1) {
  3035 + if (scheduleRealInfo.isSflj()) {
  3036 + addMileage += tempJhlc;
  3037 + }
  3038 + sj += tempJhlc;
  3039 + }
  3040 + }
  3041 + } else {
  3042 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3043 + while (it.hasNext()) {
  3044 + ChildTaskPlan childTaskPlan = it.next();
  3045 + if (childTaskPlan.getMileageType().equals("empty")) {
  3046 + if (childTaskPlan.isDestroy()) {
  3047 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3048 + } else {
  3049 + if (scheduleRealInfo.isSflj()) {
  3050 + addMileage += tempJhlc;
  3051 + }
  3052 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3053 + }
  3054 + } else {
  3055 + if (childTaskPlan.isDestroy()) {
  3056 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2964 3057 // cjbc++;
2965   - }else{
2966   - if(scheduleRealInfo.isSflj()){
2967   - addMileage += tempJhlc;
2968   - }
2969   - sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2970   - }
2971   - }
2972   - }
2973   - }
2974   - jhlc += jh;
2975   - yygl += sj;
2976   - if(jh > sj){
2977   - remgl += jh - sj;
2978   - } else if(sj > jh){
2979   - addgl += sj - jh;
2980   - }
2981   - }
2982   - }
2983   - map.put("jhlc", format.format(jhlc+jcclc));
2984   - map.put("yygljh", format.format(jhlc));
2985   - map.put("ssgl", format.format(remMileage));
2986   - map.put("ksgl", format.format(ksgl));
2987   - map.put("yyglsj", format.format(yygl));
2988   - map.put("jhbc", jhbc);
2989   - map.put("jcclc", jcclc);
2990   -
2991   - map.put("ljgl", format.format(addMileage));
2992   - map.put("ssbc", cjbc);
2993   - map.put("ysgl", format.format(yygl));
2994   - map.put("sjbc", jhbc-cjbc+ljbc);
2995   - map.put("zgl", format.format(yygl+ksgl+jcclc));
2996   - map.put("ljbc", ljbc);
2997   -
2998   - return map;
2999   - }
3000   -
3001   - @Override
3002   - public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
3003   - // TODO Auto-generated method stub
3004   - DecimalFormat format = new DecimalFormat("0.00");
3005   - List <ScheduleRealInfo> list=null;
3006   - list= scheduleRealInfoRepository.queryListWaybill2(clZbh,date,line);
3007   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
3008   - for (int i = 0; i < list.size(); i++) {
3009   - ScheduleRealInfo s=list.get(i);
3010   - if(!(s.getBcType().equals("in")||s.getBcType().equals("out"))){
3011   - String remarks="";
3012   - Double sjlc=0.0;
3013   - if(s.getRemarks()!=null){
3014   - remarks +=s.getRemarks();
3015   - }
3016   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
3017   - if(!childTaskPlans.isEmpty()){
3018   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
3019   - while(it.hasNext()){
3020   - ChildTaskPlan c = it.next();
3021   - if(c.getRemarks()!=null && c.getRemarks().length()>0){
3022   - if(remarks.indexOf(c.getRemarks())==-1){
3023   - remarks += c.getRemarks();
3024   - }
3025   - }
3026   -
3027   - if(!c.isDestroy()){
3028   - sjlc += c.getMileage()==null?0:c.getMileage();
3029   - }
3030   -
3031   - }
3032   - }else{
3033   - if(s.getStatus() != -1){
3034   - sjlc =s.getJhlc();
3035   - }
3036   - }
3037   - s.setSjlc(format.format(sjlc));
3038   - s.setRemarks(remarks);
3039   - newList.add(s);
3040   - }
3041   -
3042   - }
3043   -
3044   - return newList;
3045   - }
3046   -
3047   - @Override
3048   - public Map<String, Object> MapById(Long id) {
3049   - // TODO Auto-generated method stub
3050   - Map<String, Object> map=new HashMap<String, Object>();
3051   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
3052   - ScheduleRealInfo s=scheduleRealInfoRepository.findOne(id);
3053   - String xlbm=s.getXlBm();
3054   - String fcrq=s.getScheduleDateStr();
3055   -
3056   - List<Ylxxb> listYlxxb=ylxxbRepository.queryListYlxxb( s.getClZbh(), fcrq);
3057   - Double jzl=0.0;
3058   - for(int t=0;t<listYlxxb.size();t++){
3059   - Ylxxb y=listYlxxb.get(t);
3060   - jzl += y.getJzl();
3061   - }
3062   -
3063   - List<Ylb> listYlb=ylbRepository.queryListYlb( fcrq,s.getClZbh(),s.getjGh());
3064   - Double ccyl=0.0;
3065   - Double jcyl=0.0;
3066   - Double yh=0.0;
3067   - for (int i = 0; i < listYlb.size(); i++) {
3068   - Ylb y=listYlb.get(i);
3069   - ccyl +=y.getCzyl();
3070   - jcyl+= y.getJzyl();
3071   - yh+=y.getYh();
3072   -
3073   - }
3074   - map.put("jzl", jzl);
3075   - map.put("yh", yh);
3076   - map.put("ccyl", ccyl);
3077   - map.put("jcyl", jcyl);
3078   - map.put("xlName", s.getXlName());
3079   - map.put("clZbh", s.getClZbh());
3080   - map.put("fcsjActual", s.getFcsjActual());
3081   - map.put("zdzName", s.getZdzName());
3082   - map.put("scheduleDate", s.getScheduleDateStr());
3083   - String zdp="",zwdp="",wdp="";
3084   - String zdpT="",zwdpT="",wdpT="";
3085   -
3086   - List<DutyEmployee> list= dutyEmployeeService.getDutyEmployee(xlbm, fcrq+"00:00", fcrq+"23:59");
3087   - try {
3088   - Long fcsj1=sdf.parse(fcrq+" 03:00").getTime();
3089   - Long fcsj2=sdf.parse(fcrq+" 11:00").getTime();
3090   - Long fcsj3=sdf.parse(fcrq+" 22:00").getTime();
3091   - for(int i=0;i<list.size();i++){
3092   - DutyEmployee t=list.get(i);
3093   - Long ts=t.getTs();
3094   - if(ts>fcsj1&&ts<fcsj2){
3095   - if(zdp.indexOf(t.getuName())==-1){
3096   - if(!(zdp.length()>0)){
3097   - zdpT =t.getuName()+"...";
3098   - }
3099   - zdp +=t.getuName()+",";
3100   -
3101   - }
3102   - }else if(ts>fcsj2 && ts<fcsj3){
3103   - if(zwdp.indexOf(t.getuName())==-1){
3104   - if(!(zwdp.length()>0)){
3105   - zwdpT =t.getuName()+"...";
3106   - }
3107   - zwdp +=t.getuName()+",";
3108   - }
3109   - }else{
3110   - if(wdp.indexOf(t.getuName())==-1){
3111   - if(!(wdp.length()>0)){
3112   - wdpT =t.getuName()+"...";
3113   - }
3114   - wdp +=t.getuName()+",";
3115   - }
3116   - }
3117   - }
3118   - } catch (ParseException e) {
3119   - // TODO Auto-generated catch block
3120   - e.printStackTrace();
3121   - }
3122   - map.put("zdp", zdp);
3123   - map.put("zwdp", zwdp);
3124   - map.put("wdp", wdp);
3125   - map.put("zdpT", zdpT);
3126   - map.put("zwdpT", zwdpT);
3127   - map.put("wdpT", wdpT);
3128   - return map;
3129   - }
3130   -
3131   - @Override
3132   - public List<Map<String, Object>> scheduleDailyQp(String line, String date) {
3133   - // TODO Auto-generated method stub
3134   - List<Map<String, Object>> list=new ArrayList<Map<String, Object>>();
3135   - List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.scheduleDailyQp(line, date);
3136   - Map<String, Object> map=null;
3137   - String lp="lp";
3138   - String jgh="jgh";
3139   - String clzbh="clzbh";
3140   - int bcs=0;
3141   - String thclzbh="";
3142   - String sgh="sgh";
3143   - for(int i=0;i<scheduleRealInfos.size();i++){
3144   - ScheduleRealInfo scheduleRealInfo=scheduleRealInfos.get(i);
3145   - if(scheduleRealInfo.getLpName().equals(lp)){
3146   - bcs++;
3147   - String fcsj=scheduleRealInfo.getFcsj();
3148   -
3149   - if(!clzbh.equals(scheduleRealInfo.getClZbh())){
3150   - clzbh=scheduleRealInfo.getClZbh();
3151   - if(thclzbh==""){
3152   - thclzbh +=scheduleRealInfo.getClZbh()+",";
3153   - }else{
3154   - thclzbh +=scheduleRealInfo.getClZbh();
3155   - }
3156   - map.put("thclzbh", thclzbh);
3157   - }
3158   -
3159   - if(!jgh.equals(scheduleRealInfo.getjGh())){
3160   - jgh=scheduleRealInfo.getjGh();
3161   - if(map.get("jjb2")!=null){
3162   - map.put("jjb3", scheduleRealInfo.getjGh()+"/"+
3163   - scheduleRealInfo.getFcsjActual());
3164   -
3165   - }else{
3166   - map.put("jjb2", scheduleRealInfo.getjGh()+"/"+
3167   - scheduleRealInfo.getFcsjActual());
3168   - }
3169   -
3170   - }
3171   -
3172   - if(scheduleRealInfo.getsGh()!=null){
3173   - if(!scheduleRealInfo.getsGh().equals(sgh)){
3174   - sgh=scheduleRealInfo.getsGh();
3175   - if(map.get("sjb1")!=null){
3176   - if(map.get("sjb2")!=null){
3177   - map.put("sjb3", scheduleRealInfo.getsGh()+"/"+
3178   - scheduleRealInfo.getFcsjActual());
3179   - }else{
3180   - map.put("sjb2", scheduleRealInfo.getsGh()+"/"+
3181   - scheduleRealInfo.getFcsjActual());
3182   - }
3183   - }else{
3184   - map.put("sjb1", scheduleRealInfo.getsGh()+"/"+
3185   - scheduleRealInfo.getFcsjActual());
3186   - }
3187   - }
3188   - }
3189   - if(scheduleRealInfo.getFcsjActual()!=null){
3190   - String fcsjs[]=fcsj.split(":");
3191   - String fcsjActuals[]=scheduleRealInfo.getFcsjActual().split(":");
3192   - int a=Integer.parseInt(fcsjActuals[0])*60+Integer.parseInt(fcsjActuals[1]);
3193   - int b=Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1]);
3194   - map.put("cz"+bcs, b-a);
3195   - }else{
3196   - map.put("cz"+bcs, "无");
3197   - }
3198   - map.put("lp", scheduleRealInfo.getLpName());
3199   - map.put("dd"+bcs, scheduleRealInfo.getZdsjActual());
3200   - map.put("kc"+bcs, scheduleRealInfo.getFcsjActual());
3201   -
3202   - if(i<scheduleRealInfos.size()-1){
3203   - if(!scheduleRealInfos.get(i+1).getLpName().equals
3204   - (scheduleRealInfos.get(i).getLpName())){
3205   - list.add(map);
3206   - lp="lp";
3207   - jgh="jgh";
3208   - clzbh="clzbh";
3209   - bcs=0;
3210   - thclzbh="";
3211   - sgh="sgh";
3212   - }
3213   - }else{
3214   - list.add(map);
3215   - }
3216   - }else{
3217   - bcs=1;
3218   - map=new HashMap<String,Object>();
3219   - lp=scheduleRealInfo.getLpName();
3220   - jgh=scheduleRealInfo.getjGh();
3221   - clzbh=scheduleRealInfo.getClZbh();
3222   - if(scheduleRealInfo.getsGh()!=null){
3223   - sgh=scheduleRealInfo.getsGh();
3224   - map.put("sjb1",scheduleRealInfo.getsGh()+"/"+
3225   - scheduleRealInfo.getFcsjActual());
3226   - }
3227   - String fcsj=scheduleRealInfo.getFcsj();
3228   - scheduleRealInfo.getFcsjActual();
3229   - map.put("jjb1", jgh+"/"+scheduleRealInfo.getFcsjActual());
3230   - map.put("cccl", clzbh);
3231   -
3232   - if(scheduleRealInfo.getFcsjActual()!=null){
3233   - String fcsjs[]=fcsj.split(":");
3234   - String fcsjActuals[]=scheduleRealInfo.getFcsjActual().split(":");
3235   - int a=Integer.parseInt(fcsjActuals[0])*60+Integer.parseInt(fcsjActuals[1]);
3236   - int b=Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1]);
3237   - map.put("cz"+bcs, b-a);
3238   - }else{
3239   - map.put("cz"+bcs, "无");
3240   - }
3241   -
3242   -
3243   - map.put("lp", scheduleRealInfo.getLpName());
3244   - map.put("dd"+bcs, scheduleRealInfo.getZdsjActual());
3245   - map.put("kc"+bcs, scheduleRealInfo.getFcsjActual());
3246   -
3247   - if(i<scheduleRealInfos.size()-1){
3248   - if(!scheduleRealInfos.get(i+1).getLpName().equals
3249   - (scheduleRealInfos.get(i).getLpName())){
3250   - list.add(map);
3251   - lp="lp";
3252   - jgh="jgh";
3253   - clzbh="clzbh";
3254   - bcs=0;
3255   - thclzbh="";
3256   - sgh="sgh";
3257   - }
3258   - }else{
3259   - list.add(map);
3260   - }
3261   - }
3262   -
3263   - }
3264   - return list;
3265   - }
3266   -
3267   -
3268   - @Override
3269   - public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map){
3270   - String line = map.get("line").toString();
3271   - String date = map.get("date").toString();
3272   - String xlName = map.get("xlName").toString();
3273   - String state = map.get("state").toString();
3274   - String type = map.get("type").toString();
3275   -
3276   - List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
3277   - List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
3278   - List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
3279   - List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
3280   - List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
3281   -
3282   - for(Map<String, Object> m : list1){
  3058 + } else {
  3059 + if (scheduleRealInfo.isSflj()) {
  3060 + addMileage += tempJhlc;
  3061 + }
  3062 + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  3063 + }
  3064 + }
  3065 + }
  3066 + }
  3067 + jhlc += jh;
  3068 + yygl += sj;
  3069 + if (jh > sj) {
  3070 + remgl += jh - sj;
  3071 + } else if (sj > jh) {
  3072 + addgl += sj - jh;
  3073 + }
  3074 + }
  3075 + }
  3076 + map.put("jhlc", format.format(jhlc + jcclc));
  3077 + map.put("yygljh", format.format(jhlc));
  3078 + map.put("ssgl", format.format(remMileage));
  3079 + map.put("ksgl", format.format(ksgl));
  3080 + map.put("yyglsj", format.format(yygl));
  3081 + map.put("jhbc", jhbc);
  3082 + map.put("jcclc", jcclc);
  3083 +
  3084 + map.put("ljgl", format.format(addMileage));
  3085 + map.put("ssbc", cjbc);
  3086 + map.put("ysgl", format.format(yygl));
  3087 + map.put("sjbc", jhbc - cjbc + ljbc);
  3088 + map.put("zgl", format.format(yygl + ksgl + jcclc));
  3089 + map.put("ljbc", ljbc);
  3090 +
  3091 + return map;
  3092 + }
  3093 +
  3094 + @Override
  3095 + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) {
  3096 + // TODO Auto-generated method stub
  3097 + DecimalFormat format = new DecimalFormat("0.00");
  3098 + List<ScheduleRealInfo> list = null;
  3099 + list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line);
  3100 + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>();
  3101 + for (int i = 0; i < list.size(); i++) {
  3102 + ScheduleRealInfo s = list.get(i);
  3103 + if (!(s.getBcType().equals("in") || s.getBcType().equals("out"))) {
  3104 + String remarks = "";
  3105 + Double sjlc = 0.0;
  3106 + if (s.getRemarks() != null) {
  3107 + remarks += s.getRemarks();
  3108 + }
  3109 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  3110 + if (!childTaskPlans.isEmpty()) {
  3111 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  3112 + while (it.hasNext()) {
  3113 + ChildTaskPlan c = it.next();
  3114 + if (c.getRemarks() != null && c.getRemarks().length() > 0) {
  3115 + if (remarks.indexOf(c.getRemarks()) == -1) {
  3116 + remarks += c.getRemarks();
  3117 + }
  3118 + }
  3119 +
  3120 + if (!c.isDestroy()) {
  3121 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3122 + }
  3123 +
  3124 + }
  3125 + } else {
  3126 + if (s.getStatus() != -1) {
  3127 + sjlc = s.getJhlc();
  3128 + }
  3129 + }
  3130 + s.setSjlc(format.format(sjlc));
  3131 + s.setRemarks(remarks);
  3132 + newList.add(s);
  3133 + }
  3134 +
  3135 + }
  3136 +
  3137 + return newList;
  3138 + }
  3139 +
  3140 + @Override
  3141 + public Map<String, Object> MapById(Long id) {
  3142 + // TODO Auto-generated method stub
  3143 + Map<String, Object> map = new HashMap<String, Object>();
  3144 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3145 + ScheduleRealInfo s = scheduleRealInfoRepository.findOne(id);
  3146 + String xlbm = s.getXlBm();
  3147 + String fcrq = s.getScheduleDateStr();
  3148 +
  3149 + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq);
  3150 + Double jzl = 0.0;
  3151 + for (int t = 0; t < listYlxxb.size(); t++) {
  3152 + Ylxxb y = listYlxxb.get(t);
  3153 + jzl += y.getJzl();
  3154 + }
  3155 +
  3156 + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh());
  3157 + Double ccyl = 0.0;
  3158 + Double jcyl = 0.0;
  3159 + Double yh = 0.0;
  3160 + for (int i = 0; i < listYlb.size(); i++) {
  3161 + Ylb y = listYlb.get(i);
  3162 + ccyl += y.getCzyl();
  3163 + jcyl += y.getJzyl();
  3164 + yh += y.getYh();
  3165 +
  3166 + }
  3167 + map.put("jzl", jzl);
  3168 + map.put("yh", yh);
  3169 + map.put("ccyl", ccyl);
  3170 + map.put("jcyl", jcyl);
  3171 + map.put("xlName", s.getXlName());
  3172 + map.put("clZbh", s.getClZbh());
  3173 + map.put("fcsjActual", s.getFcsjActual());
  3174 + map.put("zdzName", s.getZdzName());
  3175 + map.put("scheduleDate", s.getScheduleDateStr());
  3176 + String zdp = "", zwdp = "", wdp = "";
  3177 + String zdpT = "", zwdpT = "", wdpT = "";
  3178 +
  3179 + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:00", fcrq + "23:59");
  3180 + try {
  3181 + Long fcsj1 = sdf.parse(fcrq + " 03:00").getTime();
  3182 + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime();
  3183 + Long fcsj3 = sdf.parse(fcrq + " 22:00").getTime();
  3184 + for (int i = 0; i < list.size(); i++) {
  3185 + DutyEmployee t = list.get(i);
  3186 + Long ts = t.getTs();
  3187 + if (ts > fcsj1 && ts < fcsj2) {
  3188 + if (zdp.indexOf(t.getuName()) == -1) {
  3189 + if (!(zdp.length() > 0)) {
  3190 + zdpT = t.getuName() + "...";
  3191 + }
  3192 + zdp += t.getuName() + ",";
  3193 +
  3194 + }
  3195 + } else if (ts > fcsj2 && ts < fcsj3) {
  3196 + if (zwdp.indexOf(t.getuName()) == -1) {
  3197 + if (!(zwdp.length() > 0)) {
  3198 + zwdpT = t.getuName() + "...";
  3199 + }
  3200 + zwdp += t.getuName() + ",";
  3201 + }
  3202 + } else {
  3203 + if (wdp.indexOf(t.getuName()) == -1) {
  3204 + if (!(wdp.length() > 0)) {
  3205 + wdpT = t.getuName() + "...";
  3206 + }
  3207 + wdp += t.getuName() + ",";
  3208 + }
  3209 + }
  3210 + }
  3211 + } catch (ParseException e) {
  3212 + // TODO Auto-generated catch block
  3213 + e.printStackTrace();
  3214 + }
  3215 + map.put("zdp", zdp);
  3216 + map.put("zwdp", zwdp);
  3217 + map.put("wdp", wdp);
  3218 + map.put("zdpT", zdpT);
  3219 + map.put("zwdpT", zwdpT);
  3220 + map.put("wdpT", wdpT);
  3221 + return map;
  3222 + }
  3223 +
  3224 + @Override
  3225 + public List<Map<String, Object>> scheduleDailyQp(String line, String date) {
  3226 + // TODO Auto-generated method stub
  3227 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  3228 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDailyQp(line, date);
  3229 + Map<String, Object> map = null;
  3230 + String lp = "lp";
  3231 + String jgh = "jgh";
  3232 + String clzbh = "clzbh";
  3233 + int bcs = 0;
  3234 + String thclzbh = "";
  3235 + String sgh = "sgh";
  3236 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  3237 + ScheduleRealInfo scheduleRealInfo = scheduleRealInfos.get(i);
  3238 + if (scheduleRealInfo.getLpName().equals(lp)) {
  3239 + bcs++;
  3240 + String fcsj = scheduleRealInfo.getFcsj();
  3241 +
  3242 + if (!clzbh.equals(scheduleRealInfo.getClZbh())) {
  3243 + clzbh = scheduleRealInfo.getClZbh();
  3244 + if (thclzbh == "") {
  3245 + thclzbh += scheduleRealInfo.getClZbh() + ",";
  3246 + } else {
  3247 + thclzbh += scheduleRealInfo.getClZbh();
  3248 + }
  3249 + map.put("thclzbh", thclzbh);
  3250 + }
  3251 +
  3252 + if (!jgh.equals(scheduleRealInfo.getjGh())) {
  3253 + jgh = scheduleRealInfo.getjGh();
  3254 + if (map.get("jjb2") != null) {
  3255 + map.put("jjb3", scheduleRealInfo.getjGh() + "/" +
  3256 + scheduleRealInfo.getFcsjActual());
  3257 +
  3258 + } else {
  3259 + map.put("jjb2", scheduleRealInfo.getjGh() + "/" +
  3260 + scheduleRealInfo.getFcsjActual());
  3261 + }
  3262 +
  3263 + }
  3264 +
  3265 + if (scheduleRealInfo.getsGh() != null) {
  3266 + if (!scheduleRealInfo.getsGh().equals(sgh)) {
  3267 + sgh = scheduleRealInfo.getsGh();
  3268 + if (map.get("sjb1") != null) {
  3269 + if (map.get("sjb2") != null) {
  3270 + map.put("sjb3", scheduleRealInfo.getsGh() + "/" +
  3271 + scheduleRealInfo.getFcsjActual());
  3272 + } else {
  3273 + map.put("sjb2", scheduleRealInfo.getsGh() + "/" +
  3274 + scheduleRealInfo.getFcsjActual());
  3275 + }
  3276 + } else {
  3277 + map.put("sjb1", scheduleRealInfo.getsGh() + "/" +
  3278 + scheduleRealInfo.getFcsjActual());
  3279 + }
  3280 + }
  3281 + }
  3282 + if (scheduleRealInfo.getFcsjActual() != null) {
  3283 + String fcsjs[] = fcsj.split(":");
  3284 + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":");
  3285 + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]);
  3286 + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]);
  3287 + map.put("cz" + bcs, b - a);
  3288 + } else {
  3289 + map.put("cz" + bcs, "无");
  3290 + }
  3291 + map.put("lp", scheduleRealInfo.getLpName());
  3292 + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual());
  3293 + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual());
  3294 +
  3295 + if (i < scheduleRealInfos.size() - 1) {
  3296 + if (!scheduleRealInfos.get(i + 1).getLpName().equals
  3297 + (scheduleRealInfos.get(i).getLpName())) {
  3298 + list.add(map);
  3299 + lp = "lp";
  3300 + jgh = "jgh";
  3301 + clzbh = "clzbh";
  3302 + bcs = 0;
  3303 + thclzbh = "";
  3304 + sgh = "sgh";
  3305 + }
  3306 + } else {
  3307 + list.add(map);
  3308 + }
  3309 + } else {
  3310 + bcs = 1;
  3311 + map = new HashMap<String, Object>();
  3312 + lp = scheduleRealInfo.getLpName();
  3313 + jgh = scheduleRealInfo.getjGh();
  3314 + clzbh = scheduleRealInfo.getClZbh();
  3315 + if (scheduleRealInfo.getsGh() != null) {
  3316 + sgh = scheduleRealInfo.getsGh();
  3317 + map.put("sjb1", scheduleRealInfo.getsGh() + "/" +
  3318 + scheduleRealInfo.getFcsjActual());
  3319 + }
  3320 + String fcsj = scheduleRealInfo.getFcsj();
  3321 + scheduleRealInfo.getFcsjActual();
  3322 + map.put("jjb1", jgh + "/" + scheduleRealInfo.getFcsjActual());
  3323 + map.put("cccl", clzbh);
  3324 +
  3325 + if (scheduleRealInfo.getFcsjActual() != null) {
  3326 + String fcsjs[] = fcsj.split(":");
  3327 + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":");
  3328 + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]);
  3329 + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]);
  3330 + map.put("cz" + bcs, b - a);
  3331 + } else {
  3332 + map.put("cz" + bcs, "无");
  3333 + }
  3334 +
  3335 +
  3336 + map.put("lp", scheduleRealInfo.getLpName());
  3337 + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual());
  3338 + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual());
  3339 +
  3340 + if (i < scheduleRealInfos.size() - 1) {
  3341 + if (!scheduleRealInfos.get(i + 1).getLpName().equals
  3342 + (scheduleRealInfos.get(i).getLpName())) {
  3343 + list.add(map);
  3344 + lp = "lp";
  3345 + jgh = "jgh";
  3346 + clzbh = "clzbh";
  3347 + bcs = 0;
  3348 + thclzbh = "";
  3349 + sgh = "sgh";
  3350 + }
  3351 + } else {
  3352 + list.add(map);
  3353 + }
  3354 + }
  3355 +
  3356 + }
  3357 + return list;
  3358 + }
  3359 +
  3360 +
  3361 + @Override
  3362 + public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map) {
  3363 + String line = map.get("line").toString();
  3364 + String date = map.get("date").toString();
  3365 + String xlName = map.get("xlName").toString();
  3366 + String state = map.get("state").toString();
  3367 + String type = map.get("type").toString();
  3368 +
  3369 + List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
  3370 + List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
  3371 + List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
  3372 + List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
  3373 + List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
  3374 +
  3375 + for (Map<String, Object> m : list1) {
3283 3376 // m.put("ssgl", m.get("ssgl"));
3284 3377 // m.put("ssbc", m.get("ssbc"));
3285 3378 // m.put("ssgl_lz", m.get("ssgl_lz") + " / " + m.get("ssbc_lz"));
... ... @@ -3293,181 +3386,182 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3293 3386 // m.put("ssgl_qh", m.get("ssgl_qh") + " / " + m.get("ssbc_qh"));
3294 3387 // m.put("ssgl_yw", m.get("ssgl_yw") + " / " + m.get("ssbc_yw"));
3295 3388 // m.put("ssgl_other", m.get("ssgl_other") + " / " + m.get("ssbc_other"));
3296   - }
3297   -
3298   - int size = 0;
3299   - Map<String, Object> tempMap = new HashMap<String, Object>();
3300   - for(int i = 0; i < list2.size(); i++){
3301   - Object obj = (Object)list2.get(i);
3302   - Object[] objs = (Object[])obj;
3303   - if(size == 5){
3304   - size = 0;
3305   - dataList2.add(tempMap);
3306   - tempMap = new HashMap<String, Object>();
3307   - }
3308   - tempMap.put("lp" + size, objs[3]);
3309   - tempMap.put("ch" + size, objs[2]);
3310   - tempMap.put("jz" + size, objs[1] + "/" + objs[4]);
3311   - tempMap.put("sz" + size, "");
3312   - tempMap.put("jw" + size, "");
3313   - tempMap.put("sw" + size, "");
3314   -
3315   - size++;
3316   - }
3317   - if(size < 5){
3318   - for(;size < 5; size++){
3319   - tempMap.put("lp" + size, "");
3320   - tempMap.put("ch" + size, "");
3321   - tempMap.put("jz" + size, "");
3322   - tempMap.put("sz" + size, "");
3323   - tempMap.put("jw" + size, "");
3324   - tempMap.put("sw" + size, "");
3325   - }
3326   - }
3327   -
3328   - dataList2.add(tempMap);
3329   -
3330   - size = 0;
3331   - tempMap = new HashMap<String, Object>();
3332   - for(ScheduleRealInfo schedule : list3){
3333   - if(size == 3){
3334   - size = 0;
3335   - dataList3.add(tempMap);
3336   - tempMap = new HashMap<String, Object>();
3337   - }
3338   - tempMap.put("lpName" + size, schedule.getLpName());
3339   - tempMap.put("qdzName" + size, schedule.getQdzName());
3340   - tempMap.put("zdsj" + size, schedule.getZdsj());
3341   - tempMap.put("zdsjActual" + size, schedule.getZdsjActual()!=null?schedule.getZdsjActual():"");
3342   - tempMap.put("zdsjk" + size, "");
3343   - tempMap.put("zdsjm" + size, "");
3344   - tempMap.put("fcsj" + size, schedule.getFcsj());
3345   - tempMap.put("fcsjActual" + size, schedule.getFcsjActual()!=null?schedule.getFcsjActual():"");
3346   - tempMap.put("fcsjk" + size, "");
3347   - tempMap.put("fcsjm" + size, "");
3348   - tempMap.put("remarks" + size, schedule.getRemarks()!=null?schedule.getRemarks():"");
3349   -
3350   - size++;
3351   - }
3352   - if(size < 3){
3353   - for(; size < 3; size++){
3354   - tempMap.put("lpName" + size, "");
3355   - tempMap.put("qdzName" + size, "");
3356   - tempMap.put("zdsj" + size, "");
3357   - tempMap.put("zdsjActual" + size, "");
3358   - tempMap.put("zdsjk" + size, "");
3359   - tempMap.put("zdsjm" + size, "");
3360   - tempMap.put("fcsj" + size, "");
3361   - tempMap.put("fcsjActual" + size, "");
3362   - tempMap.put("fcsjk" + size, "");
3363   - tempMap.put("fcsjm" + size, "");
3364   - tempMap.put("remarks" + size, "");
3365   - }
3366   - }
3367   -
3368   - dataList3.add(tempMap);
  3389 + }
  3390 +
  3391 + int size = 0;
  3392 + Map<String, Object> tempMap = new HashMap<String, Object>();
  3393 + for (int i = 0; i < list2.size(); i++) {
  3394 + Object obj = (Object) list2.get(i);
  3395 + Object[] objs = (Object[]) obj;
  3396 + if (size == 5) {
  3397 + size = 0;
  3398 + dataList2.add(tempMap);
  3399 + tempMap = new HashMap<String, Object>();
  3400 + }
  3401 + tempMap.put("lp" + size, objs[3]);
  3402 + tempMap.put("ch" + size, objs[2]);
  3403 + tempMap.put("jz" + size, objs[1] + "/" + objs[4]);
  3404 + tempMap.put("sz" + size, "");
  3405 + tempMap.put("jw" + size, "");
  3406 + tempMap.put("sw" + size, "");
  3407 +
  3408 + size++;
  3409 + }
  3410 + if (size < 5) {
  3411 + for (; size < 5; size++) {
  3412 + tempMap.put("lp" + size, "");
  3413 + tempMap.put("ch" + size, "");
  3414 + tempMap.put("jz" + size, "");
  3415 + tempMap.put("sz" + size, "");
  3416 + tempMap.put("jw" + size, "");
  3417 + tempMap.put("sw" + size, "");
  3418 + }
  3419 + }
  3420 +
  3421 + dataList2.add(tempMap);
  3422 +
  3423 + size = 0;
  3424 + tempMap = new HashMap<String, Object>();
  3425 + for (ScheduleRealInfo schedule : list3) {
  3426 + if (size == 3) {
  3427 + size = 0;
  3428 + dataList3.add(tempMap);
  3429 + tempMap = new HashMap<String, Object>();
  3430 + }
  3431 + tempMap.put("lpName" + size, schedule.getLpName());
  3432 + tempMap.put("qdzName" + size, schedule.getQdzName());
  3433 + tempMap.put("zdsj" + size, schedule.getZdsj());
  3434 + tempMap.put("zdsjActual" + size, schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  3435 + tempMap.put("zdsjk" + size, "");
  3436 + tempMap.put("zdsjm" + size, "");
  3437 + tempMap.put("fcsj" + size, schedule.getFcsj());
  3438 + tempMap.put("fcsjActual" + size, schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  3439 + tempMap.put("fcsjk" + size, "");
  3440 + tempMap.put("fcsjm" + size, "");
  3441 + tempMap.put("remarks" + size, schedule.getRemarks() != null ? schedule.getRemarks() : "");
  3442 +
  3443 + size++;
  3444 + }
  3445 + if (size < 3) {
  3446 + for (; size < 3; size++) {
  3447 + tempMap.put("lpName" + size, "");
  3448 + tempMap.put("qdzName" + size, "");
  3449 + tempMap.put("zdsj" + size, "");
  3450 + tempMap.put("zdsjActual" + size, "");
  3451 + tempMap.put("zdsjk" + size, "");
  3452 + tempMap.put("zdsjm" + size, "");
  3453 + tempMap.put("fcsj" + size, "");
  3454 + tempMap.put("fcsjActual" + size, "");
  3455 + tempMap.put("fcsjk" + size, "");
  3456 + tempMap.put("fcsjm" + size, "");
  3457 + tempMap.put("remarks" + size, "");
  3458 + }
  3459 + }
  3460 +
  3461 + dataList3.add(tempMap);
3369 3462  
3370 3463 if (type.equals("export")) {
3371   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3372   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
3373   - Map<String, Object> m = new HashMap<String, Object>();
3374   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3375   - ReportUtils ee = new ReportUtils();
3376   - try {
3377   - listI.add(list1.iterator());
3378   - listI.add(dataList2.iterator());
3379   - listI.add(dataList3.iterator());
3380   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
3381   - String sourcePath = path+"mould/scheduleDaily.xls";
3382   - if(date.length() == 7){
3383   - sdfMonth = new SimpleDateFormat("yyyy-MM");
3384   - sdfSimple = new SimpleDateFormat("yyyyMM");
3385   - sourcePath = path+"mould/scheduleDaily_m.xls";
3386   - }
3387   - ee.excelReplace(listI, new Object[] { m }, sourcePath,
3388   - path+"export/调度日报" + sdfSimple.format(sdfMonth.parse(date))+".xls");
3389   - } catch (Exception e) {
3390   - // TODO: handle exception
3391   - e.printStackTrace();
3392   - }
  3464 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3465 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3466 + Map<String, Object> m = new HashMap<String, Object>();
  3467 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3468 + ReportUtils ee = new ReportUtils();
  3469 + try {
  3470 + listI.add(list1.iterator());
  3471 + listI.add(dataList2.iterator());
  3472 + listI.add(dataList3.iterator());
  3473 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3474 + String sourcePath = path + "mould/scheduleDaily.xls";
  3475 + if (date.length() == 7) {
  3476 + sdfMonth = new SimpleDateFormat("yyyy-MM");
  3477 + sdfSimple = new SimpleDateFormat("yyyyMM");
  3478 + sourcePath = path + "mould/scheduleDaily_m.xls";
  3479 + }
  3480 + ee.excelReplace(listI, new Object[]{m}, sourcePath,
  3481 + path + "export/调度日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  3482 + } catch (Exception e) {
  3483 + // TODO: handle exception
  3484 + e.printStackTrace();
  3485 + }
3393 3486 }
3394   -
3395   - return new ArrayList<Map<String, Object>>();
3396   - }
3397   -
3398   - @Override
3399   - public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
3400   - String date = map.get("date").toString();
3401   - String line = map.get("line").toString();
3402   - List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
3403   - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/export/";
3404   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
3405   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
3406   - int num = 0;
3407   - File file = null;
3408   - try {
3409   - while (true) {
3410   - String fileUrl = path+"行车路单"+sdfSimple.format(sdfMonth.parse(date));
3411   - file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
3412   - if(file.exists()){
3413   - num++;
3414   - } else {
3415   - break;
3416   - }
3417   - }
3418   - file.mkdirs();
3419   -
3420   - for(List<String> list : lists){
3421   - String jName = list.get(0);
3422   - String clZbh = list.get(1);
3423   - String lpName = list.get(2);
3424   - this.exportWaybill(jName, clZbh, lpName, date, line);
3425   - File temp = new File(path+date+"-"+jName+"-"+clZbh+"-"+lpName+"-行车路单.xls");
3426   - String fileName = file.getName();
3427   - temp.renameTo(new File(path + fileName + "/" + temp.getName()));
3428   -
3429   - File[] listFiles = file.listFiles();
3430   - ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path+file.getName()+".zip")));
  3487 +
  3488 + return new ArrayList<Map<String, Object>>();
  3489 + }
  3490 +
  3491 + @Override
  3492 + public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
  3493 + String date = map.get("date").toString();
  3494 + String line = map.get("line").toString();
  3495 + List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
  3496 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
  3497 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  3498 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  3499 + int num = 0;
  3500 + File file = null;
  3501 + try {
  3502 + while (true) {
  3503 + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date));
  3504 + file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
  3505 + if (file.exists()) {
  3506 + num++;
  3507 + } else {
  3508 + break;
  3509 + }
  3510 + }
  3511 + file.mkdirs();
  3512 +
  3513 + for (List<String> list : lists) {
  3514 + String jName = list.get(0);
  3515 + String clZbh = list.get(1);
  3516 + String lpName = list.get(2);
  3517 + this.exportWaybill(jName, clZbh, lpName, date, line);
  3518 + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
  3519 + String fileName = file.getName();
  3520 + temp.renameTo(new File(path + fileName + "/" + temp.getName()));
  3521 +
  3522 + File[] listFiles = file.listFiles();
  3523 + ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
3431 3524 // zos.setEncoding("gbk");
3432 3525 // zos.putNextEntry(new ZipEntry(fileName + "/"));
3433   - for(int i = 0; i < listFiles.length; i++){
3434   - zos.putNextEntry(new ZipEntry(fileName+"/"+listFiles[i].getName()));
3435   - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
3436   - BufferedOutputStream bos = new BufferedOutputStream(zos);
3437   - int bytesRead = 0;
3438   - for(byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1);){
  3526 + for (int i = 0; i < listFiles.length; i++) {
  3527 + zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
  3528 + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
  3529 + BufferedOutputStream bos = new BufferedOutputStream(zos);
  3530 + int bytesRead = 0;
  3531 + for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
3439 3532 // zos.write(buffer, 0, bytesRead);
3440 3533 // zos.flush();
3441   - bos.write(buffer, 0, bytesRead);
3442   - bos.flush();
3443   - }
3444   - }
3445   - zos.close();
3446   - }
3447   -
3448   - } catch (Exception e) {
3449   - // TODO: handle exception
3450   - e.printStackTrace();
3451   - }
3452   -
3453   - map.put("fileName", file.getName());
3454   - return map;
3455   - }
  3534 + bos.write(buffer, 0, bytesRead);
  3535 + bos.flush();
  3536 + }
  3537 + }
  3538 + zos.close();
  3539 + }
  3540 +
  3541 + } catch (Exception e) {
  3542 + // TODO: handle exception
  3543 + e.printStackTrace();
  3544 + }
  3545 +
  3546 + map.put("fileName", file.getName());
  3547 + return map;
  3548 + }
3456 3549  
3457 3550 @Autowired
3458 3551 SchedulePlanInfoService schPlanService;
  3552 +
3459 3553 @Override
3460 3554 public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) {
3461 3555 List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode);
3462 3556  
3463   - if(rs==null || rs.size()==0){
  3557 + if (rs == null || rs.size() == 0) {
3464 3558 //尝试刷新内存
3465 3559 Map<String, Object> data = new HashMap<>();
3466 3560 data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode));
3467 3561 data.put("xlBm_eq", lineCode);
3468 3562 List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator());
3469 3563  
3470   - if(planItr.size() > 0){
  3564 + if (planItr.size() > 0) {
3471 3565 dayOfSchedule.schedulePlanMap.put(lineCode, planItr);
3472 3566 return planItr;
3473 3567 }
... ... @@ -3479,34 +3573,53 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3479 3573 @Override
3480 3574 public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) {
3481 3575 Map<String, Object> rs = new HashMap<>();
3482   - List<ScheduleRealInfo> ts = new ArrayList<>();
  3576 + Set<ScheduleRealInfo> ts = new HashSet<>();
3483 3577 try {
3484 3578 List<String> leftList = Splitter.on(",").splitToList(leftIdx);
3485 3579 List<String> rightList = Splitter.on(",").splitToList(rightIdx);
3486   - if(leftList.size() != rightList.size()){
3487   - rs.put("status", ResponseCode.ERROR);
3488   - rs.put("msg", "不对称的对调!");
3489   - return rs;
  3580 +
  3581 + //有班次变更的车辆
  3582 + Set<String> cars = new HashSet<>();
  3583 +
  3584 + List<ScheduleRealInfo> largeList, smallList;
  3585 + if (leftList.size() > rightList.size()) {
  3586 + largeList = getByIdx(leftList);
  3587 + smallList = getByIdx(rightList);
  3588 + } else {
  3589 + largeList = getByIdx(rightList);
  3590 + smallList = getByIdx(leftList);
3490 3591 }
3491 3592  
3492   - ScheduleRealInfo leftSch, rightSch;
3493   - for(int i = 0; i < leftList.size(); i ++){
3494   - leftSch = dayOfSchedule.get(Long.parseLong(leftList.get(i)));
3495   - rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i)));
  3593 + ScheduleRealInfo leftSch, rightSch = null;
  3594 + boolean changeRealTime = true;
  3595 + for (int i = 0; i < largeList.size(); i++) {
  3596 + leftSch = largeList.get(i);
  3597 + if (i < smallList.size()) {
  3598 + rightSch = smallList.get(i);
  3599 + ts.add(rightSch);
  3600 + } else
  3601 + changeRealTime = false;
3496 3602  
3497 3603 //调换路牌
3498   - lpChange(leftSch, rightSch, type);
3499   -
  3604 + lpChange(leftSch, rightSch, type, changeRealTime);
3500 3605 ts.add(leftSch);
3501   - ts.add(rightSch);
3502 3606  
3503   - dayOfSchedule.save(leftSch);
3504   - dayOfSchedule.save(rightSch);
  3607 + cars.add(leftSch.getClZbh());
  3608 + cars.add(rightSch.getClZbh());
  3609 + }
  3610 +
  3611 + //重新计算起点应到时间
  3612 + for(String nbbm : cars){
  3613 + ts.addAll(dayOfSchedule.updateQdzTimePlan(nbbm));
  3614 + }
  3615 +
  3616 + for (ScheduleRealInfo sch : ts) {
  3617 + dayOfSchedule.save(sch);
3505 3618 }
3506 3619  
3507 3620 rs.put("status", ResponseCode.SUCCESS);
3508 3621 rs.put("ts", ts);
3509   - }catch(Exception e){
  3622 + } catch (Exception e) {
3510 3623 logger.error("", e);
3511 3624 rs.put("status", ResponseCode.ERROR);
3512 3625 rs.put("msg", e.getMessage());
... ... @@ -3515,13 +3628,28 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3515 3628 return rs;
3516 3629 }
3517 3630  
  3631 + private List<ScheduleRealInfo> getByIdx(List<String> idList) {
  3632 + List<ScheduleRealInfo> list = new ArrayList<>();
  3633 + for (String id : idList) {
  3634 + list.add(dayOfSchedule.get(Long.parseLong(id)));
  3635 + }
  3636 + return list;
  3637 + }
  3638 +
3518 3639 @Override
3519   - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
  3640 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime) {
3520 3641 LpData leftData = new LpData(leftSch);
3521 3642 LpData rightData = new LpData(rightSch);
3522 3643  
3523   - leftData.appendTo(rightSch, type);
3524   - rightData.appendTo(leftSch, type);
  3644 + leftData.appendTo(rightSch, type, changeRealTime);
  3645 + rightData.appendTo(leftSch, type, changeRealTime);
  3646 +
  3647 + //更新车辆和班次映射信息
  3648 + dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());
  3649 + dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm());
  3650 +
  3651 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  3652 + dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm());
3525 3653 }
3526 3654  
3527 3655 @Override
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -850,8 +850,17 @@ svg rect.offline{
850 850  
851 851 .operation-real-text{
852 852 position: absolute;
853   - top: 10px;
  853 + top: 9px;
854 854 width: 100%;
855 855 left: 0;
856 856 text-align: center;
  857 + pointer-events: none;
  858 +}
  859 +
  860 +.operation-real-text span{
  861 + padding: 15px;
  862 + background: #ff4f4f;
  863 + color: white;
  864 + box-shadow: 0px 4px 6px 0 rgba(0, 0, 0, 0.2), 0px 4px 10px 0 rgba(0, 0, 0, 0.19);
  865 + border-radius: 1px 1px 4px 4px;
857 866 }
858 867 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -33,7 +33,9 @@
33 33 <div class="uk-form-row">
34 34 <label class="uk-form-label" >车辆编码</label>
35 35 <div class="uk-form-controls">
36   - <input type="text" value="{{sch.clZbh}}" disabled>
  36 + <div class="uk-autocomplete uk-form car-autocom">
  37 + <input type="text" value="{{sch.clZbh}}" name="clZbh" required>
  38 + </div>
37 39 </div>
38 40 </div>
39 41 </div>
... ... @@ -52,7 +54,9 @@
52 54 <div class="uk-form-row">
53 55 <label class="uk-form-label" >驾驶员</label>
54 56 <div class="uk-form-controls">
55   - <input type="text" value="{{sch.jGh}}/{{sch.jName}}" disabled>
  57 + <div class="uk-autocomplete uk-form jsy-autocom">
  58 + <input type="text" value="{{sch.jGh}}/{{sch.jName}}" name="jsy" required>
  59 + </div>
56 60 </div>
57 61 </div>
58 62 </div>
... ... @@ -60,7 +64,9 @@
60 64 <div class="uk-form-row">
61 65 <label class="uk-form-label" >售票员</label>
62 66 <div class="uk-form-controls">
63   - <input type="text" value="{{sch.sGh}}/{{sch.sName}}" disabled>
  67 + <div class="uk-autocomplete uk-form spy-autocom">
  68 + <input type="text" value="{{sch.sGh}}/{{sch.sName}}" name="spy">
  69 + </div>
64 70 </div>
65 71 </div>
66 72 </div>
... ... @@ -170,6 +176,15 @@
170 176 //字典转换
171 177 dictionaryUtils.transformDom($('.nt-dictionary', modal));
172 178  
  179 + //车辆自动补全
  180 + $.get('/basic/cars', function (rs) {
  181 + gb_common.carAutocomplete($('.car-autocom', modal), rs);
  182 + });
  183 + //驾驶员自动补全
  184 + gb_common.personAutocomplete($('.jsy-autocom', modal));
  185 + //售票员
  186 + gb_common.personAutocomplete($('.spy-autocom', modal));
  187 +
173 188 //submit
174 189 var f = $('form', modal).formValidation(gb_form_validation_opts);
175 190 f.on('success.form.fv', function(e) {
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lp_change.html
... ... @@ -4,11 +4,9 @@
4 4 <div class="uk-modal-header">
5 5 <h2>路牌对调</h2></div>
6 6  
7   - <!--<div class="operation-real-text">
8   - <span>
9   - 不同路牌才能对调
10   - </span>
11   - </div>-->
  7 + <div class="operation-real-text">
  8 + <span></span>
  9 + </div>
12 10 <div class="uk-grid uk-grid-divider">
13 11 <div class="uk-width-1-2">
14 12 <form class="uk-form uk-form-horizontal">
... ... @@ -72,7 +70,7 @@
72 70 </div>
73 71 <button type="button" class="uk-button uk-modal-close">取消</button>
74 72 <button type="submit" data-type="0" class="uk-button uk-button-success"><i class="uk-icon-user"></i> &nbsp;只调人</button>
75   - <button type="submit" data-type="1" class="uk-button uk-button-success"><i class="uk-icon-bus"></i> &nbsp;只调车</button>
  73 + <button title="如起点站相同,则实发时间跟随车辆对调!" data-uk-tooltip type="submit" data-type="1" class="uk-button uk-button-success"><i class="uk-icon-bus"></i> &nbsp;只调车</button>
76 74 <button type="submit" data-type="2" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;调人并调车</button>
77 75 </div>
78 76 </div>
... ... @@ -80,7 +78,7 @@
80 78 <script id="schedule-lp_change-list-temp" type="text/html">
81 79 {{if order == 0}}
82 80 {{each array as sch i}}
83   - <dl data-id="{{sch.id}}">
  81 + <dl data-id="{{sch.id}}" data-jsy="{{sch.jGh}}/{{sch.jName}}" data-nbbm="{{sch.clZbh}}">
84 82 <dd><input type="checkbox"></dd>
85 83 <dd>{{sch.jGh}}/{{sch.jName}}</dd>
86 84 <dd>{{sch.clZbh}}</dd>
... ... @@ -102,7 +100,7 @@
102 100 {{/each}}
103 101 {{else if order == 1}}
104 102 {{each array as sch i}}
105   - <dl data-id="{{sch.id}}">
  103 + <dl data-id="{{sch.id}}" data-jsy="{{sch.jGh}}/{{sch.jName}}" data-nbbm="{{sch.clZbh}}">
106 104 <dd><input type="checkbox"></dd>
107 105 <dd>{{sch.dfsj}}{{if sch.bcType == "out"}}
108 106 <span class="uk-badge uk-badge-success">出</span>
... ... @@ -128,6 +126,9 @@
128 126 (function () {
129 127 var modal = '#schedule-lp_change-modal'
130 128 , sch, list = [{}, {}];
  129 +
  130 + var opTextPanel = $('.operation-real-text span');
  131 +
131 132 $(modal).on('init', function (e, data) {
132 133 e.stopPropagation();
133 134 sch = data.sch;
... ... @@ -213,26 +214,137 @@
213 214 dl.removeClass('active');
214 215 dl.find('input[type=checkbox]')[0].checked = false;
215 216 }
216   -
  217 +
  218 + /**
  219 + * 校验左右数据是否可对调
  220 + **/
217 221 function disabledSubmitBtn() {
218   - //同一个路牌不能对调
219   - var leftLP = $('[name=lineSelect]:eq(0)', modal).val() + '_' + $('[name=lpName]:eq(0)', modal).val();
220   - var rightLP = $('[name=lineSelect]:eq(1)', modal).val() + '_' + $('[name=lpName]:eq(1)', modal).val();
  222 + opTextPanel.text('').show();
221 223 var $submitBtn = $('button[type=submit]', modal);
222   - if(leftLP == rightLP)
  224 +
  225 + var leftArray = $('.sch-list:eq(0) .ct_table_body dl.active', modal);
  226 + var rightArray = $('.sch-list:eq(1) .ct_table_body dl.active', modal);
  227 + if(leftArray.length == 0 && rightArray.length==0){
  228 + opTextPanel.text('请勾选班次');
  229 + $submitBtn.attr('disabled', 'disabled');
  230 + return;
  231 + }
  232 +
  233 + if(leftArray.length == 0){
  234 + opTextPanel.text('请勾选左侧班次');
  235 + $submitBtn.attr('disabled', 'disabled');
  236 + return;
  237 + }
  238 +
  239 + if(rightArray.length == 0){
  240 + opTextPanel.text('请勾选右侧班次');
223 241 $submitBtn.attr('disabled', 'disabled');
  242 + return;
  243 + }
  244 +
  245 +
  246 + //是否可调人
  247 + var $perSubmit = $('button[type=submit][data-type=0]', modal);
  248 + if(!isTransferPerson(leftArray, rightArray)){
  249 + $perSubmit.attr('disabled', 'disabled');
  250 + }
  251 + else
  252 + $perSubmit.removeAttr('disabled');
  253 +
  254 + //是否可调车
  255 + var $carSubmit = $('button[type=submit][data-type=1]', modal);
  256 + if(!isTransferCar(leftArray, rightArray)){
  257 + $carSubmit.attr('disabled', 'disabled');
  258 + }
  259 + else
  260 + $carSubmit.removeAttr('disabled');
  261 +
  262 +
  263 + //人车都可以调
  264 + var $threeSubmitBtn = $('button[type=submit][data-type=2]', modal);
  265 + if(!$perSubmit.attr('disabled') && !$carSubmit.attr('disabled')){
  266 + $threeSubmitBtn.removeAttr('disabled');
  267 + opTextPanel.hide();
  268 + }
  269 + else
  270 + $threeSubmitBtn.attr('disabled', 'disabled');
  271 + }
  272 +
  273 + function appendText(text) {
  274 + opTextPanel.text(opTextPanel.text() + text);
  275 + }
  276 +
  277 + function isTransferPerson(leftArray, rightArray) {
  278 + if(extractPerson(leftArray).toString() == extractPerson(rightArray).toString()){
  279 + appendText('(无法调人)同一个驾驶员');
  280 + return false;
  281 + }
  282 +
  283 + if(leftArray.length != rightArray.length){
  284 + if(extractPerson(leftArray).length > 1){
  285 + appendText('(无法调人)不对称时,左侧勾选班次只能有一个驾驶员');
  286 + return false;
  287 + }
  288 + if(extractPerson(rightArray).length > 1){
  289 + appendText('(无法调人)不对称时,右侧勾选班次只能有一个驾驶员');
  290 + return false;
  291 + }
  292 +
  293 + return true;
  294 + }
224 295 else{
  296 + return true;
  297 + }
  298 + }
  299 +
  300 + function isTransferCar(leftArray, rightArray) {
  301 + if(extractCar(leftArray).toString() == extractCar(rightArray).toString()){
  302 + appendText('(无法调车)同一辆车');
  303 + return false;
  304 + }
225 305  
226   - var leftSize = $('.sch-list:eq(0) dl.active', modal).length;
227   - var rightSize = $('.sch-list:eq(1) dl.active', modal).length;
228   - if(leftSize != rightSize)
229   - $submitBtn.attr('disabled', 'disabled');
230   - else if(leftSize != 0)
231   - $submitBtn.removeAttr('disabled');
  306 + if(leftArray.length != rightArray.length){
  307 + if(extractCar(leftArray).length > 1){
  308 + appendText('(无法调车)不对称时,左侧勾选班次只能有一辆车');
  309 + return false;
  310 + }
  311 + if(extractCar(rightArray).length > 1){
  312 + appendText('(无法调车)不对称时,右侧勾选班次只能有一辆车');
  313 + return false;
  314 + }
  315 +
  316 + return true;
  317 + }
  318 + else{
  319 + return true;
232 320 }
233 321 }
234 322  
235 323  
  324 + /**
  325 + * 从dl 里提取出所有的驾驶员
  326 + * @param list
  327 + */
  328 + function extractPerson(list){
  329 + var jsyMap = {};
  330 + $.each(list, function () {
  331 + jsyMap[$(this).data('jsy')] = 1;
  332 + });
  333 + return gb_common.get_keys(jsyMap);
  334 + }
  335 +
  336 + /**
  337 + *从dl 里提取出所有的车辆
  338 + * @param list
  339 + */
  340 + function extractCar(list) {
  341 + var carMap = {};
  342 + $.each(list, function () {
  343 + carMap[$(this).data('nbbm')] = 1;
  344 + });
  345 + return gb_common.get_keys(carMap);
  346 + }
  347 +
236 348 //全选
237 349 $('.global_box', modal).on('click', function () {
238 350 var $table = $(this).parents('.ct_table.sch-list');
... ... @@ -261,10 +373,10 @@
261 373 var leftList = $('.sch-list:eq(0) .ct_table_body dl.active', modal);
262 374 var rightList = $('.sch-list:eq(1) .ct_table_body dl.active', modal);
263 375  
264   - if(leftList.length != rightList.length){
  376 + /*if(leftList.length != rightList.length){
265 377 alert('左右不对称,无法提交!!');
266 378 return;
267   - }
  379 + }*/
268 380  
269 381 var leftIdx = '', rightIdx = '';
270 382 $.each(leftList, function () {
... ... @@ -301,6 +413,7 @@
301 413 this.checked = false;
302 414 });
303 415 }
  416 +
304 417 })();
305 418 </script>
306 419 </div>
... ...