Commit 4d6144bf591c5ccc541039b4daac667b5a628285
1 parent
67754b96
时刻表v2.7.6
1、修改分班路牌数确定规则,[连班路牌小于2,则5休2之外的车辆数则为连班车辆数],[总分班路牌数小于加班路牌数,则忽略其他分班路牌数]
2、生成时刻表时,需要选择站点路由版本,和导入时刻表一致,后台导出逻辑里使用StationRouteService查找站点路由名字
3、修正导出生成的时刻表的格式,最后的几个班次为进场,到场,离场
4、修正导出生成的时刻表的格式,每个路牌的统计小时分钟使用冒号分割,不用中文
5、修改PoiUtils,CellType为String时,需要添加 [xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@"));]
Showing
6 changed files
with
117 additions
and
40 deletions
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| 1 | package com.bsth.service.schedule.datatools; | 1 | package com.bsth.service.schedule.datatools; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.Station; | 3 | import com.bsth.entity.Station; |
| 4 | +import com.bsth.entity.StationRoute; | ||
| 5 | +import com.bsth.service.StationRouteService; | ||
| 4 | import com.bsth.service.StationService; | 6 | import com.bsth.service.StationService; |
| 5 | import com.bsth.service.schedule.exception.ScheduleException; | 7 | import com.bsth.service.schedule.exception.ScheduleException; |
| 6 | import com.bsth.service.schedule.utils.*; | 8 | import com.bsth.service.schedule.utils.*; |
| @@ -18,6 +20,8 @@ import org.apache.poi.xssf.usermodel.XSSFRow; | @@ -18,6 +20,8 @@ import org.apache.poi.xssf.usermodel.XSSFRow; | ||
| 18 | import org.apache.poi.xssf.usermodel.XSSFSheet; | 20 | import org.apache.poi.xssf.usermodel.XSSFSheet; |
| 19 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; | 21 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| 20 | import org.joda.time.DateTime; | 22 | import org.joda.time.DateTime; |
| 23 | +import org.joda.time.LocalTime; | ||
| 24 | +import org.joda.time.format.DateTimeFormat; | ||
| 21 | import org.slf4j.Logger; | 25 | import org.slf4j.Logger; |
| 22 | import org.slf4j.LoggerFactory; | 26 | import org.slf4j.LoggerFactory; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -42,9 +46,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -42,9 +46,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 42 | /** 日志记录器 */ | 46 | /** 日志记录器 */ |
| 43 | private final static Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailDataToolsImpl.class); | 47 | private final static Logger LOGGER = LoggerFactory.getLogger(TTInfoDetailDataToolsImpl.class); |
| 44 | 48 | ||
| 45 | - // TODO:之后改了 | ||
| 46 | @Autowired | 49 | @Autowired |
| 47 | - private StationService stationService; | 50 | + private StationRouteService stationRouteService; |
| 48 | 51 | ||
| 49 | @Autowired | 52 | @Autowired |
| 50 | @Qualifier(value = "dataToolsServiceImpl") | 53 | @Qualifier(value = "dataToolsServiceImpl") |
| @@ -441,8 +444,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -441,8 +444,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 441 | 444 | ||
| 442 | // 构造表头 | 445 | // 构造表头 |
| 443 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | 446 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); |
| 444 | - Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | ||
| 445 | - Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | 447 | + StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1()); |
| 448 | + StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2()); | ||
| 446 | for (int i = 0; i < groupCount; i++) { | 449 | for (int i = 0; i < groupCount; i++) { |
| 447 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), | 450 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1), |
| 448 | station1.getStationName(), new Color(0x96b9d7)); | 451 | station1.getStationName(), new Color(0x96b9d7)); |
| @@ -553,8 +556,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -553,8 +556,8 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 553 | 556 | ||
| 554 | // 构造表头,添加一个进场,添加一个出场 | 557 | // 构造表头,添加一个进场,添加一个出场 |
| 555 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); | 558 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); |
| 556 | - Station station1 = stationService.findById(lpObjList.get(0).getStationRouteId1()); | ||
| 557 | - Station station2 = stationService.findById(lpObjList.get(1).getStationRouteId2()); | 559 | + StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1()); |
| 560 | + StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2()); | ||
| 558 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1), | 561 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1), |
| 559 | "报到", new Color(0x96b9d7)); | 562 | "报到", new Color(0x96b9d7)); |
| 560 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (2), | 563 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (2), |
| @@ -565,23 +568,28 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -565,23 +568,28 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 565 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2), | 568 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2), |
| 566 | station2.getStationName(), new Color(0x96b9d7)); | 569 | station2.getStationName(), new Color(0x96b9d7)); |
| 567 | } | 570 | } |
| 571 | + | ||
| 572 | + // 最后一个进场需要变成三个班次 | ||
| 573 | + // 1个分班进场班次,1个到场班次,1个离场班次 | ||
| 568 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 3), | 574 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 3), |
| 569 | - "进场", new Color(0x96b9d7)); | 575 | + station2.getStationName(), new Color(0x96b9d7)); |
| 570 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 4), | 576 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 4), |
| 577 | + "到场", new Color(0x96b9d7)); | ||
| 578 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 5), | ||
| 571 | "离场", new Color(0x96b9d7)); | 579 | "离场", new Color(0x96b9d7)); |
| 572 | 580 | ||
| 573 | // 路牌统计字段 | 581 | // 路牌统计字段 |
| 574 | - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 5), | ||
| 575 | - "总公里", new Color(0x96b9d7)); | ||
| 576 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 6), | 582 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 6), |
| 577 | - "营业公里", new Color(0x96b9d7)); | 583 | + "总公里", new Color(0x96b9d7)); |
| 578 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 7), | 584 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 7), |
| 579 | - "空驶公里", new Color(0x96b9d7)); | 585 | + "营业公里", new Color(0x96b9d7)); |
| 580 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 8), | 586 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 8), |
| 581 | - "总工时", new Color(0x96b9d7)); | 587 | + "空驶公里", new Color(0x96b9d7)); |
| 582 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 9), | 588 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 9), |
| 583 | - "营业工时", new Color(0x96b9d7)); | 589 | + "总工时", new Color(0x96b9d7)); |
| 584 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 10), | 590 | PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 10), |
| 591 | + "营业工时", new Color(0x96b9d7)); | ||
| 592 | + PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 11), | ||
| 585 | "营运班次", new Color(0x96b9d7)); | 593 | "营运班次", new Color(0x96b9d7)); |
| 586 | 594 | ||
| 587 | // 构建每个路牌的班次数据 | 595 | // 构建每个路牌的班次数据 |
| @@ -598,6 +606,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -598,6 +606,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 598 | 606 | ||
| 599 | PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 3)); | 607 | PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 3)); |
| 600 | PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 4)); | 608 | PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 4)); |
| 609 | + PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 5)); | ||
| 601 | 610 | ||
| 602 | for (BcObj bcObj : lpObj.getBcObjList()) { | 611 | for (BcObj bcObj : lpObj.getBcObjList()) { |
| 603 | if (bcObj.getBcType() == BcType.NORMAL) { | 612 | if (bcObj.getBcType() == BcType.NORMAL) { |
| @@ -626,7 +635,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -626,7 +635,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 626 | } else if (bcObj.getBcType() == BcType.IN) { | 635 | } else if (bcObj.getBcType() == BcType.IN) { |
| 627 | if (bcObj.getGroupNo() == -2) { | 636 | if (bcObj.getGroupNo() == -2) { |
| 628 | Cell cell = lpRow.getCell((short) (groupCount * 2 + 3)); | 637 | Cell cell = lpRow.getCell((short) (groupCount * 2 + 3)); |
| 629 | - cell.setCellValue(bcObj.getFcsj()); | 638 | + cell.setCellValue(bcObj.getFcsj() + "X"); |
| 630 | } else if (bcObj.getGroupNo() > 0) { //分班进场 | 639 | } else if (bcObj.getGroupNo() > 0) { //分班进场 |
| 631 | Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3)); | 640 | Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 3)); |
| 632 | // 停驶用 ※ | 641 | // 停驶用 ※ |
| @@ -635,22 +644,27 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -635,22 +644,27 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 635 | 644 | ||
| 636 | } else if (bcObj.getBcType() == BcType.LC) { | 645 | } else if (bcObj.getBcType() == BcType.LC) { |
| 637 | if (bcObj.getGroupNo() == -2) { | 646 | if (bcObj.getGroupNo() == -2) { |
| 647 | + // 这个是到场,准备离场班次 | ||
| 638 | Cell cell = lpRow.getCell((short) (groupCount * 2 + 4)); | 648 | Cell cell = lpRow.getCell((short) (groupCount * 2 + 4)); |
| 639 | cell.setCellValue(bcObj.getFcsj()); | 649 | cell.setCellValue(bcObj.getFcsj()); |
| 650 | + // 加10分钟表示真正离场时间 | ||
| 651 | + cell = lpRow.getCell((short) (groupCount * 2 + 5)); | ||
| 652 | + LocalTime localTime = LocalTime.parse(bcObj.getFcsj(), DateTimeFormat.forPattern("HH:mm")); | ||
| 653 | + cell.setCellValue(localTime.plusMinutes(10).toString(DateTimeFormat.forPattern("HH:mm"))); | ||
| 640 | } | 654 | } |
| 641 | 655 | ||
| 642 | } | 656 | } |
| 643 | } | 657 | } |
| 644 | 658 | ||
| 645 | // 路牌统计字段 | 659 | // 路牌统计字段 |
| 646 | - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 5), lpObj.getZlc()); | ||
| 647 | - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getYylc()); | ||
| 648 | - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getKslc()); | ||
| 649 | - PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 8), | ||
| 650 | - String.format("%d小时%d分钟", (int) (lpObj.getZgs() / 60), (int) (lpObj.getZgs() % 60))); | 660 | + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getZlc()); |
| 661 | + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getYylc()); | ||
| 662 | + PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 8), lpObj.getKslc()); | ||
| 651 | PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 9), | 663 | PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 9), |
| 652 | - String.format("%d小时%d分钟", (int) (lpObj.getYygs() / 60), (int) (lpObj.getYygs() % 60))); | ||
| 653 | - PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 10), lpObj.getYybc()); | 664 | + String.format("%d%s%d", (int) (lpObj.getZgs() / 60), ":", (int) (lpObj.getZgs() % 60))); |
| 665 | + PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 10), | ||
| 666 | + String.format("%d%s%d", (int) (lpObj.getYygs() / 60), ":", (int) (lpObj.getYygs() % 60))); | ||
| 667 | + PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 11), lpObj.getYybc()); | ||
| 654 | 668 | ||
| 655 | } | 669 | } |
| 656 | 670 | ||
| @@ -670,6 +684,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | @@ -670,6 +684,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail | ||
| 670 | sheet.autoSizeColumn(groupCount * 2 + 8); | 684 | sheet.autoSizeColumn(groupCount * 2 + 8); |
| 671 | sheet.autoSizeColumn(groupCount * 2 + 9); | 685 | sheet.autoSizeColumn(groupCount * 2 + 9); |
| 672 | sheet.autoSizeColumn(groupCount * 2 + 10); | 686 | sheet.autoSizeColumn(groupCount * 2 + 10); |
| 687 | + sheet.autoSizeColumn(groupCount * 2 + 11); | ||
| 673 | } | 688 | } |
| 674 | 689 | ||
| 675 | @Override | 690 | @Override |
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java
| @@ -58,7 +58,7 @@ public class PoiUtils { | @@ -58,7 +58,7 @@ public class PoiUtils { | ||
| 58 | public static XSSFCell createStringXSSFCell( | 58 | public static XSSFCell createStringXSSFCell( |
| 59 | XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value, | 59 | XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value, |
| 60 | Color backgroundColor) { | 60 | Color backgroundColor) { |
| 61 | - return createXSSFCell( | 61 | + XSSFCell xssfCell = createXSSFCell( |
| 62 | xssfWorkbook, xssfRow, column, | 62 | xssfWorkbook, xssfRow, column, |
| 63 | value, XSSFCell.CELL_TYPE_STRING, | 63 | value, XSSFCell.CELL_TYPE_STRING, |
| 64 | HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | 64 | HorizontalAlignment.CENTER, VerticalAlignment.CENTER, |
| @@ -66,11 +66,14 @@ public class PoiUtils { | @@ -66,11 +66,14 @@ public class PoiUtils { | ||
| 66 | (short) 13, new Color(0x2765A7), "宋体", | 66 | (short) 13, new Color(0x2765A7), "宋体", |
| 67 | backgroundColor, FillPatternType.SOLID_FOREGROUND | 67 | backgroundColor, FillPatternType.SOLID_FOREGROUND |
| 68 | ); | 68 | ); |
| 69 | + DataFormat dataFormat = xssfWorkbook.createDataFormat(); | ||
| 70 | + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@")); | ||
| 71 | + return xssfCell; | ||
| 69 | } | 72 | } |
| 70 | 73 | ||
| 71 | public static XSSFCell createStringXSSFCell( | 74 | public static XSSFCell createStringXSSFCell( |
| 72 | XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value) { | 75 | XSSFWorkbook xssfWorkbook, XSSFRow xssfRow, short column, String value) { |
| 73 | - return createXSSFCell( | 76 | + XSSFCell xssfCell = createXSSFCell( |
| 74 | xssfWorkbook, xssfRow, column, | 77 | xssfWorkbook, xssfRow, column, |
| 75 | value, XSSFCell.CELL_TYPE_STRING, | 78 | value, XSSFCell.CELL_TYPE_STRING, |
| 76 | HorizontalAlignment.CENTER, VerticalAlignment.CENTER, | 79 | HorizontalAlignment.CENTER, VerticalAlignment.CENTER, |
| @@ -78,6 +81,9 @@ public class PoiUtils { | @@ -78,6 +81,9 @@ public class PoiUtils { | ||
| 78 | (short) 13, new Color(0x2765A7), "宋体", | 81 | (short) 13, new Color(0x2765A7), "宋体", |
| 79 | new Color(0xffffff), FillPatternType.SOLID_FOREGROUND | 82 | new Color(0xffffff), FillPatternType.SOLID_FOREGROUND |
| 80 | ); | 83 | ); |
| 84 | + DataFormat dataFormat = xssfWorkbook.createDataFormat(); | ||
| 85 | + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@")); | ||
| 86 | + return xssfCell; | ||
| 81 | } | 87 | } |
| 82 | 88 | ||
| 83 | public static XSSFCell createDoubleXSSFCell( | 89 | public static XSSFCell createDoubleXSSFCell( |
| @@ -150,8 +156,9 @@ public class PoiUtils { | @@ -150,8 +156,9 @@ public class PoiUtils { | ||
| 150 | 156 | ||
| 151 | // 设定值 | 157 | // 设定值 |
| 152 | if (valueType == XSSFCell.CELL_TYPE_STRING) { | 158 | if (valueType == XSSFCell.CELL_TYPE_STRING) { |
| 153 | - cell.setCellValue(creationHelper.createRichTextString( | ||
| 154 | - WorkbookUtil.createSafeSheetName(String.valueOf(value)))); | 159 | +// cell.setCellValue(creationHelper.createRichTextString( |
| 160 | +// WorkbookUtil.createSafeSheetName(String.valueOf(value)))); | ||
| 161 | + cell.setCellValue(creationHelper.createRichTextString(String.valueOf(value))); | ||
| 155 | } else if (valueType == XSSFCell.CELL_TYPE_NUMERIC) { | 162 | } else if (valueType == XSSFCell.CELL_TYPE_NUMERIC) { |
| 156 | if (value instanceof Date) { // 日期 | 163 | if (value instanceof Date) { // 日期 |
| 157 | cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-mm-dd")); | 164 | cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-mm-dd")); |
src/main/resources/static/pages/base/timesmodel/add.html
| @@ -120,7 +120,21 @@ | @@ -120,7 +120,21 @@ | ||
| 120 | </div> | 120 | </div> |
| 121 | </div> | 121 | </div> |
| 122 | <!-- 线路名称 (* 必填项) END --> | 122 | <!-- 线路名称 (* 必填项) END --> |
| 123 | - </div> | 123 | + |
| 124 | + </div> | ||
| 125 | + | ||
| 126 | + <div class="form-group"> | ||
| 127 | + <!-- 线路版本 --> | ||
| 128 | + <div class="col-md-6"> | ||
| 129 | + <label class="control-label col-md-5"> | ||
| 130 | + <span class="required"> * </span> 站点路由版本 : | ||
| 131 | + </label> | ||
| 132 | + <div class="col-md-6"> | ||
| 133 | + <select name="lineVersion" class="form-control input-medium" id="lineVersionSelect"></select> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + </div> | ||
| 137 | + | ||
| 124 | <!-- 表单分组组件 form-group END --> | 138 | <!-- 表单分组组件 form-group END --> |
| 125 | </div> | 139 | </div> |
| 126 | <!-- 获取参数 --> | 140 | <!-- 获取参数 --> |
| @@ -132,10 +146,10 @@ | @@ -132,10 +146,10 @@ | ||
| 132 | <div class="col-md-9"> | 146 | <div class="col-md-9"> |
| 133 | <div class="icheck-list"> | 147 | <div class="icheck-list"> |
| 134 | <label > | 148 | <label > |
| 135 | - <input type="radio" class="icheck" name="baseRes" value=1 checked> 班型/人次/车辆 | 149 | + <input type="radio" class="icheck" name="baseRes" value=1> 班型/人次/车辆 |
| 136 | </label> | 150 | </label> |
| 137 | <label> | 151 | <label> |
| 138 | - <input type="radio" class="icheck" name="baseRes" value=2> 发车间隔分析 | 152 | + <input type="radio" class="icheck" name="baseRes" value=2 checked> 发车间隔分析 |
| 139 | </label> | 153 | </label> |
| 140 | <label> | 154 | <label> |
| 141 | <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 | 155 | <input type="radio" class="icheck" name="baseRes" value=0> 客流大数据分析 |
src/main/resources/static/pages/base/timesmodel/js/add-form-reload.js
| @@ -201,6 +201,25 @@ | @@ -201,6 +201,25 @@ | ||
| 201 | $get('/tic_ec/' + skbId ,null, function(d){ | 201 | $get('/tic_ec/' + skbId ,null, function(d){ |
| 202 | if(d.status=='SUCCESS') { | 202 | if(d.status=='SUCCESS') { |
| 203 | $("#lineSelect").select2("val", d.data.xl.id + '_' + d.data.xl.lineCode + '_' + d.data.xl.name); | 203 | $("#lineSelect").select2("val", d.data.xl.id + '_' + d.data.xl.lineCode + '_' + d.data.xl.name); |
| 204 | + | ||
| 205 | + // 获取线路版本信息 | ||
| 206 | + $get('/tic_ec/stationroute/' + d.data.xl.id, null, function(rs){ | ||
| 207 | + // 构造select2内容 | ||
| 208 | + var iSelVersion = 0; | ||
| 209 | + var aOption = []; | ||
| 210 | + aOption.push('<option value="">请选择...</option><optgroup label="线路版本">'); | ||
| 211 | + $.each(rs.data, function(i, g) { | ||
| 212 | + aOption.push('<option value="'+ g.version + '">' + g.desc + '</option>'); | ||
| 213 | + if (i == 0) { | ||
| 214 | + iSelVersion = g.version; | ||
| 215 | + } | ||
| 216 | + }); | ||
| 217 | + aOption.push('</optgroup>'); | ||
| 218 | + $('#lineVersionSelect').html(aOption.join("")).select2(); | ||
| 219 | + if (iSelVersion > 0) { | ||
| 220 | + $("#lineVersionSelect").select2("val", iSelVersion); | ||
| 221 | + } | ||
| 222 | + }); | ||
| 204 | } | 223 | } |
| 205 | }); | 224 | }); |
| 206 | } | 225 | } |
src/main/resources/static/pages/base/timesmodel/js/add-form-wizard.js
| @@ -395,10 +395,26 @@ var SKBFormWizard = function() { | @@ -395,10 +395,26 @@ var SKBFormWizard = function() { | ||
| 395 | // 返回参数详情模版. | 395 | // 返回参数详情模版. |
| 396 | return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); | 396 | return cb && cb ({'forminput':template(tempName,{map:map}),'datadisplay': template(tempName +'config',{map:null})}); |
| 397 | }else if (n==2) { | 397 | }else if (n==2) { |
| 398 | - return cb && cb({ | 398 | + // 更具站点路由版本获取起点终点站 |
| 399 | + var iversion = $('#lineVersionSelect').val(); | ||
| 400 | + $get('/stationroute/all',{'line.id_eq':lineId,'destroy_eq':0, 'versions_eq': iversion},function(result) { | ||
| 401 | + $.each(result, function(i, d) { | ||
| 402 | + if (d.stationMark == 'B' && d.directions == 0) { | ||
| 403 | + // alert(d.stationName); | ||
| 404 | + map.line.startStationName = d.stationName; | ||
| 405 | + } else if (d.stationMark == 'E' && d.directions == 0) { | ||
| 406 | + // alert(d.stationName); | ||
| 407 | + map.line.endStationName = d.stationName; | ||
| 408 | + } | ||
| 409 | + }); | ||
| 410 | + | ||
| 411 | + | ||
| 412 | + return cb && cb({ | ||
| 399 | 'forminput': template(tempName, {map: map}), | 413 | 'forminput': template(tempName, {map: map}), |
| 400 | 'datadisplay': template(tempName + '_config', {map: null}) | 414 | 'datadisplay': template(tempName + '_config', {map: null}) |
| 401 | }); | 415 | }); |
| 416 | + }); | ||
| 417 | + | ||
| 402 | } | 418 | } |
| 403 | }); | 419 | }); |
| 404 | } | 420 | } |
| @@ -476,6 +492,7 @@ var SKBFormWizard = function() { | @@ -476,6 +492,7 @@ var SKBFormWizard = function() { | ||
| 476 | rules : { | 492 | rules : { |
| 477 | 'skbName' : {required : true,},// 时刻表名称,必填项. | 493 | 'skbName' : {required : true,},// 时刻表名称,必填项. |
| 478 | 'lineName' : {required : true,},// 线路名称,必填项. | 494 | 'lineName' : {required : true,},// 线路名称,必填项. |
| 495 | + 'lineVersion': {required: true}, // 站点路由版本,必填项, | ||
| 479 | // 'krl' : {isBaseRes : true,number : true,digits : true,},// 客容量,当选择为客流方式时必填项、整数 | 496 | // 'krl' : {isBaseRes : true,number : true,digits : true,},// 客容量,当选择为客流方式时必填项、整数 |
| 480 | 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. | 497 | 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项. |
| 481 | 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. | 498 | 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项. |
| @@ -598,20 +615,20 @@ var SKBFormWizard = function() { | @@ -598,20 +615,20 @@ var SKBFormWizard = function() { | ||
| 598 | var argus = form.serializeJSON(); | 615 | var argus = form.serializeJSON(); |
| 599 | console.log(argus); | 616 | console.log(argus); |
| 600 | // 获取站点路由. | 617 | // 获取站点路由. |
| 601 | - $get('/stationroute/all',{'line.id_eq':argus.lineName.split('_')[0],'destroy_eq':0},function(result) { | 618 | + $get('/stationroute/all',{'line.id_eq':argus.lineName.split('_')[0],'destroy_eq':0, 'versions_eq': argus.lineVersion},function(result) { |
| 602 | // 判断. | 619 | // 判断. |
| 603 | if(result) { | 620 | if(result) { |
| 604 | // 定义上行起点站,上行终点站,下行起点站,下行终点站. | 621 | // 定义上行起点站,上行终点站,下行起点站,下行终点站. |
| 605 | var upB ='',upE='',downB='',downE=''; | 622 | var upB ='',upE='',downB='',downE=''; |
| 606 | for(var r = 0 ; r<result.length;r++) { | 623 | for(var r = 0 ; r<result.length;r++) { |
| 607 | if(result[r].directions==0 && result[r].stationMark =='B') | 624 | if(result[r].directions==0 && result[r].stationMark =='B') |
| 608 | - upB = result[r].station.id; | 625 | + upB = result[r].id; |
| 609 | if(result[r].directions==0 && result[r].stationMark =='E') | 626 | if(result[r].directions==0 && result[r].stationMark =='E') |
| 610 | - upE = result[r].station.id; | 627 | + upE = result[r].id; |
| 611 | if(result[r].directions==1 && result[r].stationMark =='B') | 628 | if(result[r].directions==1 && result[r].stationMark =='B') |
| 612 | - downB = result[r].station.id; | 629 | + downB = result[r].id; |
| 613 | if(result[r].directions==1 && result[r].stationMark =='E') | 630 | if(result[r].directions==1 && result[r].stationMark =='E') |
| 614 | - downE = result[r].station.id; | 631 | + downE = result[r].id; |
| 615 | } | 632 | } |
| 616 | argus.up_s = upB + '_' + upE; | 633 | argus.up_s = upB + '_' + upE; |
| 617 | argus.down_s = downB + '_' + downE; | 634 | argus.down_s = downB + '_' + downE; |
| @@ -628,7 +645,7 @@ var SKBFormWizard = function() { | @@ -628,7 +645,7 @@ var SKBFormWizard = function() { | ||
| 628 | $get('/tidc/all',{'ttinfo.id_eq':parseInt(argus.skbName)},function(data) { | 645 | $get('/tidc/all',{'ttinfo.id_eq':parseInt(argus.skbName)},function(data) { |
| 629 | if(data.status=='SUCCESS' && data.data.length>0) { | 646 | if(data.status=='SUCCESS' && data.data.length>0) { |
| 630 | argus.istidc = 1; | 647 | argus.istidc = 1; |
| 631 | - layer.confirm('系统已存在该时刻表【'+ | 648 | + layer.confirm('系统已存在该时刻表【'+ |
| 632 | $("#skbNameSelect").select2("data")[0].text + | 649 | $("#skbNameSelect").select2("data")[0].text + |
| 633 | '】明细,是否使用已有数据渲染模型?', { | 650 | '】明细,是否使用已有数据渲染模型?', { |
| 634 | btn: ['确定并使用','取消并继续'] //按钮 | 651 | btn: ['确定并使用','取消并继续'] //按钮 |
| @@ -648,7 +665,7 @@ var SKBFormWizard = function() { | @@ -648,7 +665,7 @@ var SKBFormWizard = function() { | ||
| 648 | layer.msg('系统不存在该线路的上、下行起终点站!'); | 665 | layer.msg('系统不存在该线路的上、下行起终点站!'); |
| 649 | } | 666 | } |
| 650 | }); | 667 | }); |
| 651 | - | 668 | + |
| 652 | // 表单提交. | 669 | // 表单提交. |
| 653 | function submit(p,argus) { | 670 | function submit(p,argus) { |
| 654 | var baseRes2 = $('#submit_argus_form input[name="baseRes"]:checked').val();// 获取参数方式值. | 671 | var baseRes2 = $('#submit_argus_form input[name="baseRes"]:checked').val();// 获取参数方式值. |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| @@ -354,13 +354,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -354,13 +354,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 354 | alert("总配车数小于低谷最小配车"); | 354 | alert("总配车数小于低谷最小配车"); |
| 355 | throw "总配车数小于低谷最小配车"; | 355 | throw "总配车数小于低谷最小配车"; |
| 356 | } | 356 | } |
| 357 | + | ||
| 357 | if (iDgminpc < 2) { | 358 | if (iDgminpc < 2) { |
| 358 | - alert("连班路牌小于2,办不到啊"); | ||
| 359 | - throw "连班路牌小于2,办不到啊"; | 359 | + // alert("连班路牌小于2,办不到啊"); |
| 360 | + // throw "连班路牌小于2,办不到啊"; | ||
| 361 | + console.log("连班路牌小于2,则5休2之外的车辆数则为连班车辆数"); | ||
| 362 | + iDgminpc = iCls - i_5_2_lpes; | ||
| 360 | } | 363 | } |
| 361 | if (iCls - iDgminpc < i_5_2_lpes) { | 364 | if (iCls - iDgminpc < i_5_2_lpes) { |
| 362 | - alert("总分班路牌数小于加班路牌数"); | ||
| 363 | - throw "总分班路牌数小于加班路牌数"; | 365 | + // alert("总分班路牌数小于加班路牌数"); |
| 366 | + // throw "总分班路牌数小于加班路牌数"; | ||
| 367 | + console.log("总分班路牌数小于加班路牌数,则忽略其他分班路牌数"); | ||
| 368 | + iDgminpc = iCls - i_5_2_lpes; | ||
| 364 | } | 369 | } |
| 365 | 370 | ||
| 366 | //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20 | 371 | //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20 |