Commit 8a6e4a7572d1c9f869b5324c37fdbd2a87aa2913

Authored by 徐烜
1 parent a5753f0b

1、修改调度值勤日报,添加预览视图可编辑班次信息功能(具体查看相关代码)

Showing 21 changed files with 617 additions and 96 deletions
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -20,10 +20,13 @@ import org.springframework.stereotype.Repository;
20 20 */
21 21 @Repository
22 22 public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanInfo, Long> {
23   -
  23 +
  24 + @Query(value = "select max(info.fcno) as mx from bsth_c_s_sp_info info where info.xl =?1 and info.schedule_date =?2", nativeQuery = true)
  25 + Long findMaxFcno(Integer xlid, Date scheduleDate);
  26 +
24 27 @Query(value = "select s from SchedulePlanInfo s where scheduleDate=?1")
25 28 List<SchedulePlanInfo> findByDate(Date date);
26   -
  29 +
27 30 @Query(value = "select s from SchedulePlanInfo s where scheduleDate >= ?1 and scheduleDate <= ?2 order by scheduleDate, xl_name, lp_name, bcs")
28 31 List<SchedulePlanInfo> findByDates(Date date1, Date date2);
29 32  
... ... @@ -124,7 +127,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
124 127 @Param("p5") Date scheduleDate,
125 128 @Param("p6") String lpName,
126 129 @Param("p7") Integer spyId_src);
127   -
  130 +
128 131 @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 order by s.xlBm,clZbh,lp,xlDir")
129 132 List<SchedulePlanInfo> findLineScheduleBc(String scheduleDate);
130 133  
... ... @@ -136,7 +139,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
136 139 ")a group by schedule_date, gs_bm, xl_bm " +
137 140 ")b group by gs_bm, xl_bm ", nativeQuery = true)
138 141 List<Object[]> findPlanGroupCar(Date date1, Date date2);
139   -
  142 +
140 143 @Query(value = " select gs_bm, xl_bm, max(num) num from ( " +
141 144 "select schedule_date, gs_bm, xl_bm, count(*) num from ( " +
142 145 "select schedule_date, gs_bm, xl_bm, j_gh from bsth_c_s_sp_info " +
... ... @@ -145,7 +148,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
145 148 ")a group by schedule_date, gs_bm, xl_bm " +
146 149 ")b group by gs_bm, xl_bm ", nativeQuery = true)
147 150 List<Object[]> findPlanGroupDriver(Date date1, Date date2);
148   -
  151 +
149 152 @Query(value = " select gs_bm, xl_bm, max(num) num from ( " +
150 153 "select schedule_date, gs_bm, xl_bm, count(*) num from ( " +
151 154 "select schedule_date, gs_bm, xl_bm, s_gh from bsth_c_s_sp_info " +
... ... @@ -155,16 +158,16 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
155 158 ")a group by schedule_date, gs_bm, xl_bm " +
156 159 ")b group by gs_bm, xl_bm ", nativeQuery = true)
157 160 List<Object[]> findPlanGroupBusConductor(Date date1, Date date2);
158   -
  161 +
159 162 @Query(value = " select schedule_date, xl_bm, j_gh, s_gh from bsth_c_s_sp_info " +
160 163 "where schedule_date >= ?1 and schedule_date <= ?2 " +
161 164 "group by schedule_date, xl_bm, j_gh, s_gh ", nativeQuery = true)
162 165 List<Object[]> findPersonnelSchedule(Date date1, Date date2);
163   -
  166 +
164 167 @Query(value="select s from SchedulePlanInfo s where s.xlBm = ?1 and s.ttInfo = ?2 "
165 168 + "and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 order by s.lpName,bcs")
166 169 List<SchedulePlanInfo> findPlanByTTinfo(String xlBm, Long ttInfo, String scheduleDate);
167   -
  170 +
168 171 @Query(value="select s from SchedulePlanInfo s where s.xlBm = ?1 "
169 172 + "and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName,bcs")
170 173 List<SchedulePlanInfo> findPlanByXlAndDate(String xlBm, String scheduleDate);
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
5 4 import com.bsth.service.schedule.exception.ScheduleException;
  5 +import com.bsth.service.schedule.timetable.strategy.TimetableExcelWithPlanInfoViewStrategy;
6 6 import com.bsth.service.schedule.utils.DataToolsFile;
7 7 import org.apache.commons.lang3.StringUtils;
8 8 import org.joda.time.DateTime;
... ... @@ -35,7 +35,7 @@ public interface SchedulePlanInfoService extends BService&lt;SchedulePlanInfo, Long
35 35 * @return
36 36 * @throws ScheduleException
37 37 */
38   - TTInfoDetailForEdit.EditInfo getDirectiveDataWithPlanInfo(
  38 + TimetableExcelWithPlanInfoViewStrategy.PlanInfoEditInfo getDirectiveDataWithPlanInfo(
39 39 Integer xlId, Date scheduleDate) throws ScheduleException;
40 40  
41 41 /**
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanInfoServiceImpl.java
... ... @@ -4,9 +4,9 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import com.bsth.repository.LineRepository;
5 5 import com.bsth.repository.schedule.SchedulePlanInfoRepository;
6 6 import com.bsth.service.schedule.SchedulePlanInfoService;
7   -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
8 7 import com.bsth.service.schedule.exception.ScheduleException;
9 8 import com.bsth.service.schedule.timetable.TimetableExcelData;
  9 +import com.bsth.service.schedule.timetable.strategy.TimetableExcelWithPlanInfoViewStrategy;
10 10 import com.bsth.service.schedule.timetable.strategy.impl.TimetableExcelWithPlanInfoExportStrategyImpl;
11 11 import com.bsth.service.schedule.timetable.strategy.impl.TimetableExcelWithPlanInfoViewStrategyImpl;
12 12 import com.bsth.service.schedule.utils.DataToolsFile;
... ... @@ -59,13 +59,14 @@ public class SchedulePlanInfoServiceImpl extends BServiceImpl&lt;SchedulePlanInfo,
59 59 }
60 60  
61 61 @Override
62   - public TTInfoDetailForEdit.EditInfo getDirectiveDataWithPlanInfo(Integer xlId, Date scheduleDate) throws ScheduleException {
  62 + public TimetableExcelWithPlanInfoViewStrategy.PlanInfoEditInfo getDirectiveDataWithPlanInfo(Integer xlId, Date scheduleDate) throws ScheduleException {
63 63 TimetableExcelData timetableExcelData = TimetableExcelData.withPlanInfoExcelViewBuilder()
64 64 .setXlId(xlId)
65 65 .setScheduleDate(scheduleDate)
66 66 .setLineRepository(this.lineRepository)
67 67 .setDataToolsService(this.dataToolsService)
68 68 .setDataToolsProperties(this.dataToolsProperties)
  69 + .setSchedulePlanInfoRepository(this.schedulePlanInfoRepository)
69 70 .setTimetableExcelWithPlanInfoViewStrategy(new TimetableExcelWithPlanInfoViewStrategyImpl())
70 71 .build();
71 72 return timetableExcelData.doGetDirectiveDataWithPlanInfo();
... ...
src/main/java/com/bsth/service/schedule/plan/strategy/说明.txt 0 → 100644
  1 +如果后续排班计划的预览视图还要修正的话,
  2 +建议创建一个类 PlanViewData,把TimetableExcelData相关排班信息导出的代码迁移出来
... ...
src/main/java/com/bsth/service/schedule/timetable/TimetableExcelData.java
... ... @@ -6,12 +6,12 @@ import com.bsth.entity.schedule.GuideboardInfo;
6 6 import com.bsth.entity.schedule.TTInfo;
7 7 import com.bsth.entity.schedule.TTInfoDetail;
8 8 import com.bsth.repository.LineRepository;
  9 +import com.bsth.repository.schedule.SchedulePlanInfoRepository;
9 10 import com.bsth.repository.schedule.TTInfoDetailRepository;
10 11 import com.bsth.repository.schedule.TTInfoRepository;
11 12 import com.bsth.service.LineService;
12 13 import com.bsth.service.LsStationRouteService;
13 14 import com.bsth.service.schedule.GuideboardInfoService;
14   -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
15 15 import com.bsth.service.schedule.exception.ScheduleException;
16 16 import com.bsth.service.schedule.timetable.strategy.*;
17 17 import com.bsth.service.schedule.timetable.strategy.impl.TimetableExcelWithPlanInfoViewStrategyImpl;
... ... @@ -198,17 +198,21 @@ public class TimetableExcelData {
198 198 * 注意:dataToolsService和dataToolsProperties共用导入相关属性
199 199 */
200 200  
  201 + /** 指定线路,排班日期最大发车顺序号 */
  202 + private Long maxfcno;
  203 +
201 204 /** 获取显示数据策略 */
202 205 private TimetableExcelWithPlanInfoViewStrategy timetableExcelWithPlanInfoViewStrategy;
203 206 /**
204 207 * 获取前端angular指令用数据。
205 208 */
206   - public TTInfoDetailForEdit.EditInfo doGetDirectiveDataWithPlanInfo() throws ScheduleException {
  209 + public TimetableExcelWithPlanInfoViewStrategy.PlanInfoEditInfo doGetDirectiveDataWithPlanInfo() throws ScheduleException {
207 210 return this.timetableExcelWithPlanInfoViewStrategy.doGetDirectiveDataWithPlanInfo(
208 211 this.line,
209 212 this.scheduleDate,
210 213 this.dataToolsService,
211   - this.dataToolsProperties);
  214 + this.dataToolsProperties,
  215 + maxfcno);
212 216 }
213 217  
214 218 // ----------- 构造函数 ---------- //
... ... @@ -274,6 +278,7 @@ public class TimetableExcelData {
274 278 this.scheduleDate = planInfoExcelViewBuilder.scheduleDate;
275 279 this.dataToolsService = planInfoExcelViewBuilder.dataToolsService;
276 280 this.dataToolsProperties = planInfoExcelViewBuilder.dataToolsProperties;
  281 + this.maxfcno = planInfoExcelViewBuilder.maxfcno;
277 282 // 获取显示数据策略
278 283 this.timetableExcelWithPlanInfoViewStrategy =
279 284 planInfoExcelViewBuilder.timetableExcelWithPlanInfoViewStrategy;
... ... @@ -727,6 +732,8 @@ public class TimetableExcelData {
727 732 private DataToolsService dataToolsService;
728 733 /** 配置数据导入导出用到的配置信息 */
729 734 private DataToolsProperties dataToolsProperties;
  735 + /** 排班计划明细Repo */
  736 + private SchedulePlanInfoRepository schedulePlanInfoRepository;
730 737 /** view策略 */
731 738 private TimetableExcelWithPlanInfoViewStrategyImpl timetableExcelWithPlanInfoViewStrategy;
732 739  
... ... @@ -755,6 +762,11 @@ public class TimetableExcelData {
755 762 return this;
756 763 }
757 764  
  765 + public PlanInfoExcelViewBuilder setSchedulePlanInfoRepository(SchedulePlanInfoRepository schedulePlanInfoRepository) {
  766 + this.schedulePlanInfoRepository = schedulePlanInfoRepository;
  767 + return this;
  768 + }
  769 +
758 770 public PlanInfoExcelViewBuilder setTimetableExcelWithPlanInfoViewStrategy(TimetableExcelWithPlanInfoViewStrategyImpl timetableExcelWithPlanInfoViewStrategy) {
759 771 this.timetableExcelWithPlanInfoViewStrategy = timetableExcelWithPlanInfoViewStrategy;
760 772 return this;
... ... @@ -763,6 +775,8 @@ public class TimetableExcelData {
763 775 // ---------------- 内部生成的属性 ---------------- //
764 776 /** 线路信息 */
765 777 private Line line;
  778 + /** 指定线路,排班日期最大发车顺序号 */
  779 + private Long maxfcno;
766 780  
767 781 public TimetableExcelData build() {
768 782 // 1、参数验证
... ... @@ -771,12 +785,18 @@ public class TimetableExcelData {
771 785 Assert.notNull(this.lineRepository, "线路repo为空!");
772 786 Assert.notNull(this.dataToolsService, "数据工具服务为空!");
773 787 Assert.notNull(this.dataToolsProperties, "配置数据导入导出用到的配置信息为空!");
  788 + Assert.notNull(this.schedulePlanInfoRepository, "排班明细Repo为空!");
774 789 Assert.notNull(this.timetableExcelWithPlanInfoViewStrategy, "获取显示数据策略为空!");
775 790  
776 791 // 2、获取线路信息
777 792 Optional<Line> optionalLine = this.lineRepository.findById(this.xlId);
778 793 Assert.isTrue(optionalLine.isPresent(), "线路[id=" + this.xlId + "]为空!");
779 794 this.line = optionalLine.get();
  795 + // 3、获取maxfcno
  796 + Long maxfcno = this.schedulePlanInfoRepository.findMaxFcno(this.xlId, this.scheduleDate);
  797 + Assert.notNull(maxfcno, "maxfcno为空,排班信息可能为空!");
  798 + Assert.isTrue(maxfcno > 0L, "maxfcno <= 0,排班信息可能为空!");
  799 + this.maxfcno = maxfcno;
780 800  
781 801 return new TimetableExcelData(this);
782 802 }
... ...
src/main/java/com/bsth/service/schedule/timetable/strategy/TimetableExcelWithPlanInfoViewStrategy.java
1 1 package com.bsth.service.schedule.timetable.strategy;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
  4 +import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.service.schedule.exception.ScheduleException;
6 6 import com.bsth.service.schedule.utils.DataToolsProperties;
7 7 import com.bsth.service.schedule.utils.DataToolsService;
8 8  
  9 +import java.util.ArrayList;
9 10 import java.util.Date;
  11 +import java.util.List;
10 12  
11 13 /**
12 14 * 排班时刻数据(时刻表的格式,附加驾驶员,车牌信息)前端angular指令数据策略接口。
... ... @@ -19,11 +21,39 @@ public interface TimetableExcelWithPlanInfoViewStrategy {
19 21 * @param scheduleDate 排班日期
20 22 * @param dataToolsService dataToolsService
21 23 * @param dataToolsProperties dataToolsProperties
  24 + * @param maxfcno 指定线路,排班日期最大发车顺序号
22 25 */
23   - TTInfoDetailForEdit.EditInfo doGetDirectiveDataWithPlanInfo(
  26 + PlanInfoEditInfo doGetDirectiveDataWithPlanInfo(
24 27 Line xl,
25 28 Date scheduleDate,
26 29 DataToolsService dataToolsService,
27   - DataToolsProperties dataToolsProperties
  30 + DataToolsProperties dataToolsProperties,
  31 + Long maxfcno
28 32 ) throws ScheduleException;
  33 +
  34 + /**
  35 + * 排班信息编辑用的返回数据。
  36 + */
  37 + class PlanInfoEditInfo {
  38 + /** 标题数据 */
  39 + private List<String> header = new ArrayList<>();
  40 + /** 内容数据 */
  41 + private List<List<SchedulePlanInfo>> contents = new ArrayList<>();
  42 +
  43 + public List<String> getHeader() {
  44 + return header;
  45 + }
  46 +
  47 + public void setHeader(List<String> header) {
  48 + this.header = header;
  49 + }
  50 +
  51 + public List<List<SchedulePlanInfo>> getContents() {
  52 + return contents;
  53 + }
  54 +
  55 + public void setContents(List<List<SchedulePlanInfo>> contents) {
  56 + this.contents = contents;
  57 + }
  58 + }
29 59 }
... ...
src/main/java/com/bsth/service/schedule/timetable/strategy/impl/TimetableExcelWithPlanInfoViewStrategyImpl.java
1 1 package com.bsth.service.schedule.timetable.strategy.impl;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
  4 +import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.service.schedule.exception.ScheduleException;
6 6 import com.bsth.service.schedule.timetable.strategy.TimetableExcelWithPlanInfoViewStrategy;
7 7 import com.bsth.service.schedule.utils.*;
8   -import org.apache.poi.ss.usermodel.Row;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.joda.time.DateTime;
9 10 import org.slf4j.Logger;
10 11 import org.slf4j.LoggerFactory;
11 12  
... ... @@ -22,11 +23,12 @@ public class TimetableExcelWithPlanInfoViewStrategyImpl implements TimetableExce
22 23 private final static Logger LOG = LoggerFactory.getLogger(TimetableExcelWithPlanInfoViewStrategyImpl.class);
23 24  
24 25 @Override
25   - public TTInfoDetailForEdit.EditInfo doGetDirectiveDataWithPlanInfo(
  26 + public PlanInfoEditInfo doGetDirectiveDataWithPlanInfo(
26 27 Line xl,
27 28 Date scheduleDate,
28 29 DataToolsService dataToolsService,
29   - DataToolsProperties dataToolsProperties) throws ScheduleException {
  30 + DataToolsProperties dataToolsProperties,
  31 + Long maxfcno) throws ScheduleException {
30 32  
31 33 LOG.info("---------------- 开始获取显示数据 线路=[{}],日期=[{}]排班时刻信息... --------------", xl.getName(), scheduleDate);
32 34  
... ... @@ -34,31 +36,31 @@ public class TimetableExcelWithPlanInfoViewStrategyImpl implements TimetableExce
34 36 // ---------- 1、ktr生成的导出文件 --------- //
35 37 // ---------- 1-1、创建ktr参数 --------- //
36 38 Map<String, Object> ktrParams = new HashMap<>();
37   - // 导出用元数据ktr
38   - File ktrMetaFile = new File(this.getClass().getResource(
39   - dataToolsProperties.getTtinfodetailPlaninfoMetaoutput()).toURI());
40   - // 导出ktr
  39 + // 导出edit数据ktr
41 40 File ktrFile = new File(this.getClass().getResource(
42   - dataToolsProperties.getTtinfodetailPlaninfoOutput()).toURI());
  41 + dataToolsProperties.getTtinfodetailPlaninfoOutputEdit()).toURI());
43 42  
44 43 // 通用参数,转换文件路径,excel输出文件名
45   - ktrParams.put("transpath", ktrMetaFile.getAbsolutePath());
46   - ktrParams.put("filename", "排班时刻表导出数据temp");
  44 + ktrParams.put("transpath", ktrFile.getAbsolutePath());
  45 + ktrParams.put("filename", "排班时刻表导出edit数据");
47 46 // ktr附加命名参数
48 47 ktrParams.put("xlid", xl.getId()); // 线路Id
49   - ktrParams.put("injectktrfile", ktrFile.getAbsolutePath()); // 注入元数据的ktr文件
50 48 ktrParams.put("sdate", scheduleDate.toInstant()
51 49 .atZone(ZoneId.systemDefault()).toLocalDate()
52 50 .format(DateTimeFormatter.ISO_DATE)); // 排班日期
53 51  
  52 + String outputFilePath = String.format("schedulePlanInfoForTtinfoDetail_(xlid=%s)_foredit-%s",
  53 + String.valueOf(xl.getId()), new DateTime().toString("yyyyMMddHHmmss"));
  54 + ktrParams.put("filepath", dataToolsProperties.getTransTempdir() + File.separator + outputFilePath); // 数据输出文件路径
  55 +
  56 +
54 57 // ---------- 1-2、执行ktr --------- //
55 58 DataToolsFile exportFile = dataToolsService.exportData(ktrParams);
56 59  
57 60 // ---------- 2、处理生成的导出文件 --------- //
58   - TTInfoDetailForEdit.EditInfo viewData = new TTInfoDetailForEdit.EditInfo();
  61 + PlanInfoEditInfo viewData = new PlanInfoEditInfo();
59 62  
60   - // 将导出的数据表头重新处理一遍,祛除->数字
61   - // poi api,并读取第一行数据
  63 + // ---------- 2-1、获取sheet ------------ //
62 64 org.apache.poi.ss.usermodel.Workbook poi_workbook;
63 65 org.apache.poi.ss.usermodel.Sheet poi_sheet;
64 66 if (DataToolsFileType.XLS.isThisType(exportFile.getFile())) {
... ... @@ -68,35 +70,74 @@ public class TimetableExcelWithPlanInfoViewStrategyImpl implements TimetableExce
68 70 } else {
69 71 throw new Exception("不是xls xlsx文件!");
70 72 }
71   - poi_sheet = poi_workbook.getSheet("Sheet1");
  73 + poi_sheet = poi_workbook.getSheetAt(0); // 获取第一个Sheet值
72 74 if (poi_sheet == null || poi_sheet.getRow(0) == null) { // 空sheet
73 75 return viewData;
74 76 }
75 77  
76   - int rownums = poi_sheet.getLastRowNum() + 1;
77   - int colnums = poi_sheet.getRow(0).getLastCellNum();
78   - Row firstrow = poi_sheet.getRow(0);
79   - for (int i = 0; i < colnums; i++) {
80   - org.apache.poi.ss.usermodel.Cell cell = firstrow.getCell(i);
81   - viewData.getHeader().add(
82   - PoiUtils.getStringValueFromCell(cell).trim().replaceAll("(->\\d+)", ""));
83   - }
84   -
85   - for (int i = 1; i < rownums; i++) { // 第二行开始
86   - List<TTInfoDetailForEdit.FcInfo> fcInfoList = new ArrayList<>();
87   - for (int j = 0; j < colnums; j++) {
  78 + // ---------- 2-2、处理sheet ------------ //
  79 + String[] headarrays = new String[maxfcno.intValue() + 4];
  80 + headarrays[0] = "路牌"; // 第一列
  81 + headarrays[1] = "驾驶员"; // 第二列
  82 + headarrays[2] = "自编号"; // 第三列
  83 + headarrays[3] = "车牌号"; // 第四列
  84 +
  85 + int rows = poi_sheet.getLastRowNum() + 1; // 总行数
  86 + for (int r = 1; r < rows; r++) { // 从第二行开始
  87 + List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>();
  88 + for (int c = 0; c < headarrays.length; c++) {
88 89 // poi读
89   - String cellContent = PoiUtils.getStringValueFromCell(
90   - poi_sheet.getRow(i).getCell(j)
91   - ).replaceAll("\\s*", "");
  90 + String content_str = PoiUtils.getStringValueFromCell(
  91 + poi_sheet.getRow(r).getCell(c)
  92 + );
  93 +
  94 + if (c == 0) { // 路牌列
  95 + SchedulePlanInfo lpCol = new SchedulePlanInfo();
  96 + lpCol.setLpName(content_str);
  97 + schedulePlanInfoList.add(lpCol);
  98 + } else if (c == 1) { // 驾驶员列
  99 + SchedulePlanInfo jsyCol = new SchedulePlanInfo();
  100 + jsyCol.setjName(content_str);
  101 + schedulePlanInfoList.add(jsyCol);
  102 + } else if (c == 2) { // 自编号列
  103 + SchedulePlanInfo zbhCol = new SchedulePlanInfo();
  104 + zbhCol.setClZbh(content_str);
  105 + schedulePlanInfoList.add(zbhCol);
  106 + } else if (c == 3) { // 车牌号列
  107 + SchedulePlanInfo cphCol = new SchedulePlanInfo();
  108 + cphCol.setClZbh(content_str); // 注意:车牌号也放在自编号字段中
  109 + schedulePlanInfoList.add(cphCol);
  110 + } else {
  111 + if (StringUtils.isEmpty(content_str)) {
  112 + // content_str为空,说明当前发车顺序号对应的班次为空,插入一个字段为空的对象
  113 + SchedulePlanInfo emptyCol = new SchedulePlanInfo();
  114 + schedulePlanInfoList.add(emptyCol);
  115 + } else {
  116 + String[] content = content_str.split(",");
  117 +
  118 + SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo();
  119 + schedulePlanInfo.setId(Long.parseLong(content[0])); // 排班明细Id
  120 + schedulePlanInfo.setXlDir(content[1]); // 上下行
  121 + schedulePlanInfo.setQdzName(content[2]); // 起点站名字
  122 + schedulePlanInfo.setZdzName(content[3]); // 终点站名字
  123 + schedulePlanInfo.setFcsj(content[4]); // 发车时间
  124 + schedulePlanInfo.setJhlc(Double.valueOf(content[5])); // 计划里程
  125 + schedulePlanInfo.setBcsj(Integer.valueOf(content[6])); // 班次时间
  126 + schedulePlanInfo.setBcType(content[7]); // 班次类型
  127 +
  128 + if (headarrays[c] == null) {
  129 + headarrays[c] = content[8]; // 计算的发车站名
  130 + }
  131 +
  132 + schedulePlanInfoList.add(schedulePlanInfo);
  133 + }
  134 +
  135 + }
92 136  
93   - TTInfoDetailForEdit.FcInfo fcInfo = new TTInfoDetailForEdit.FcInfo();
94   - fcInfo.setFcsj(cellContent);
95   - fcInfoList.add(fcInfo);
96 137 }
97   - viewData.getContents().add(fcInfoList);
  138 + viewData.getContents().add(schedulePlanInfoList);
98 139 }
99   -
  140 + viewData.getHeader().addAll(Arrays.asList(headarrays));
100 141  
101 142 return viewData;
102 143 } catch (Exception exp) {
... ...
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
... ... @@ -127,6 +127,8 @@ public class DataToolsProperties {
127 127 @NotNull
128 128 /** 时刻表导出数据(带排班信息)ktr转换 */
129 129 private String ttinfodetailPlaninfoOutput;
  130 + /** 时刻表导出数据(带排班信息)编辑用ktr转换 */
  131 + private String ttinfodetailPlaninfoOutputEdit;
130 132  
131 133 //------------------------ 数据同步ktr -----------------------//
132 134 @NotNull
... ... @@ -425,4 +427,12 @@ public class DataToolsProperties {
425 427 public void setTtinfodetailPlaninfoOutput(String ttinfodetailPlaninfoOutput) {
426 428 this.ttinfodetailPlaninfoOutput = ttinfodetailPlaninfoOutput;
427 429 }
  430 +
  431 + public String getTtinfodetailPlaninfoOutputEdit() {
  432 + return ttinfodetailPlaninfoOutputEdit;
  433 + }
  434 +
  435 + public void setTtinfodetailPlaninfoOutputEdit(String ttinfodetailPlaninfoOutputEdit) {
  436 + this.ttinfodetailPlaninfoOutputEdit = ttinfodetailPlaninfoOutputEdit;
  437 + }
428 438 }
... ...
src/main/resources/datatools/config-cloud.properties
... ... @@ -83,6 +83,8 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
83 83 datatools.ttinfodetail_planinfo_metaoutput=/datatools/ktrs/planWithScheduleTypeOutputMetaData.ktr
84 84 # 时刻表导出数据(带排班信息)ktr转换
85 85 datatools.ttinfodetail_planinfo_output=/datatools/ktrs/planWithScheduleTypeOutput.ktr
  86 +# 时刻表导出数据(带排班信息)编辑用ktr转换
  87 +datatools.ttinfodetail_planinfo_output_edit=/datatools/ktrs/planWithScheduleTypeOutputForEdit.ktr
86 88  
87 89 ##--------------------------- 数据同步ktr ------------------------##
88 90 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
... ...
src/main/resources/datatools/config-dev.properties
... ... @@ -82,7 +82,8 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
82 82 datatools.ttinfodetail_planinfo_metaoutput=/datatools/ktrs/planWithScheduleTypeOutputMetaData.ktr
83 83 # 时刻表导出数据(带排班信息)ktr转换
84 84 datatools.ttinfodetail_planinfo_output=/datatools/ktrs/planWithScheduleTypeOutput.ktr
85   -
  85 +# 时刻表导出数据(带排班信息)编辑用ktr转换
  86 +datatools.ttinfodetail_planinfo_output_edit=/datatools/ktrs/planWithScheduleTypeOutputForEdit.ktr
86 87  
87 88 ##--------------------------- 数据同步ktr ------------------------##
88 89 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
... ...
src/main/resources/datatools/config-prod.properties
... ... @@ -83,6 +83,8 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
83 83 datatools.ttinfodetail_planinfo_metaoutput=/datatools/ktrs/planWithScheduleTypeOutputMetaData.ktr
84 84 # 时刻表导出数据(带排班信息)ktr转换
85 85 datatools.ttinfodetail_planinfo_output=/datatools/ktrs/planWithScheduleTypeOutput.ktr
  86 +# 时刻表导出数据(带排班信息)编辑用ktr转换
  87 +datatools.ttinfodetail_planinfo_output_edit=/datatools/ktrs/planWithScheduleTypeOutputForEdit.ktr
86 88  
87 89 ##--------------------------- 数据同步ktr ------------------------##
88 90 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
... ...
src/main/resources/datatools/config-test.properties
... ... @@ -83,6 +83,8 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
83 83 datatools.ttinfodetail_planinfo_metaoutput=/datatools/ktrs/planWithScheduleTypeOutputMetaData.ktr
84 84 # 时刻表导出数据(带排班信息)ktr转换
85 85 datatools.ttinfodetail_planinfo_output=/datatools/ktrs/planWithScheduleTypeOutput.ktr
  86 +# 时刻表导出数据(带排班信息)编辑用ktr转换
  87 +datatools.ttinfodetail_planinfo_output_edit=/datatools/ktrs/planWithScheduleTypeOutputForEdit.ktr
86 88  
87 89 ##--------------------------- 数据同步ktr ------------------------##
88 90 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
... ...
src/main/resources/datatools/ktrs/planWithScheduleTypeOutput.ktr
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <transformation>
3 3 <info>
4   - <name>&#x6392;&#x73ed;&#x8ba1;&#x5212;&#x660e;&#x7ec6;&#xff08;&#x65f6;&#x523b;&#x8868;&#x683c;&#x5f0f;&#xff09;</name>
  4 + <name>&#x6392;&#x73ed;&#x8ba1;&#x5212;&#x660e;&#x7ec6;&#xff08;&#x65f6;&#x523b;&#x8868;&#x683c;&#x5f0f;&#xff09;&#x5bfc;&#x51fa;</name>
5 5 <description/>
6 6 <extended_description/>
7 7 <trans_version/>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoView.js
... ... @@ -12,7 +12,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
12 12 restrict: 'E',
13 13 templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoViewTemplate.html',
14 14 scope: { // 独立作用域
15   - ds: "=ngModel"
  15 + ds: "=ngModel",
  16 + celldbclickFn: "&celldbclick",
16 17 },
17 18 controllerAs: "$saPlanInfoViewCtrl",
18 19 bindToController: true,
... ... @@ -34,8 +35,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(
34 35 throw new Error("saPlanInfoView指令 name属性required");
35 36 }
36 37  
  38 + var $attr_celldbclick = tAttrs["celldbclick"]; // 单元格双击事件名
  39 +
37 40 // 内部controlAs名字
38   - var ctrlAs = '$saTimeTableCtrl';
  41 + var ctrlAs = '$saPlanInfoViewCtrl';
39 42  
40 43 return {
41 44 pre: function(scope, element, attr) {
... ... @@ -44,6 +47,23 @@ angular.module(&#39;ScheduleApp&#39;).directive(
44 47 },
45 48 post: function(scope, element, attr) {
46 49 // TODO:
  50 +
  51 + // ------------------- dom事件处理function -----------------//
  52 + scope[ctrlAs].$$cell_click = function(rowindex, colindex, cell) {
  53 + console.log("click " + "row=" + rowindex + ",col=" + colindex);
  54 + if (cell.id) { // 有排班明细id的cell才能操作
  55 + cell.sel = !cell.sel; // 是否选中toggle
  56 + }
  57 +
  58 + };
  59 + scope[ctrlAs].$$cell_dbclick = function(rowindex, colindex, cell) {
  60 + if (cell.id) { // 有排班明细id的cell才能操作
  61 + if ($attr_celldbclick) {
  62 + // 注意调用方法
  63 + scope[ctrlAs].celldbclickFn()(rowindex, colindex);
  64 + }
  65 + }
  66 + };
47 67 }
48 68  
49 69 };
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoViewTemplate.html
... ... @@ -402,14 +402,24 @@
402 402  
403 403 <dd ng-repeat="cell in info track by $index"
404 404 ng-init="colIndex = $index"
405   - ng-if="$index <= 2" >
406   - {{cell.fcsj}}
  405 + ng-if="$index == 0" >
  406 + {{cell.lpName}}
  407 + </dd>
  408 + <dd ng-repeat="cell in info track by $index"
  409 + ng-init="colIndex = $index"
  410 + ng-if="$index == 1" >
  411 + {{cell.jName}}
  412 + </dd>
  413 + <dd ng-repeat="cell in info track by $index"
  414 + ng-init="colIndex = $index"
  415 + ng-if="$index == 2" >
  416 + {{cell.clZbh}}
407 417 </dd>
408 418  
409 419 <dd ng-repeat="cell in info track by $index"
410 420 ng-init="colIndex = $index"
411 421 ng-if="$index == 3" style="border-right: 2px solid #96b9d7;">
412   - {{cell.fcsj}}
  422 + {{cell.clZbh}}
413 423 </dd>
414 424  
415 425 </dl>
... ... @@ -438,16 +448,18 @@
438 448  
439 449 <dd ng-repeat="cell in info track by $index"
440 450 ng-init="colIndex = $index"
  451 + ng-click="$saPlanInfoViewCtrl.$$cell_click(rowIndex, colIndex, cell)"
  452 + ng-dblclick="$saPlanInfoViewCtrl.$$cell_dbclick(rowIndex, colIndex, cell)"
441 453 ng-if="$index > 3"
442 454 ng-class="{
443 455 lpName: true,
444 456 error: false,
445   - active: false,
  457 + active: cell.sel,
446 458 ists: false,
447 459 region: false,
448 460 isfb: false,
449   - outbc: cell.bc_type == 'out',
450   - inbc: cell.bc_type == 'in'
  461 + outbc: cell.bcType == 'out',
  462 + inbc: cell.bcType == 'in'
451 463 }">
452 464 {{cell.fcsj}}
453 465 </dd>
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -6622,7 +6622,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(
6622 6622 restrict: 'E',
6623 6623 templateUrl: '/pages/scheduleApp/module/common/dts2/scheduleplan/saPlanInfoViewTemplate.html',
6624 6624 scope: { // 独立作用域
6625   - ds: "=ngModel"
  6625 + ds: "=ngModel",
  6626 + celldbclickFn: "&celldbclick",
6626 6627 },
6627 6628 controllerAs: "$saPlanInfoViewCtrl",
6628 6629 bindToController: true,
... ... @@ -6644,8 +6645,10 @@ angular.module(&#39;ScheduleApp&#39;).directive(
6644 6645 throw new Error("saPlanInfoView指令 name属性required");
6645 6646 }
6646 6647  
  6648 + var $attr_celldbclick = tAttrs["celldbclick"]; // 单元格双击事件名
  6649 +
6647 6650 // 内部controlAs名字
6648   - var ctrlAs = '$saTimeTableCtrl';
  6651 + var ctrlAs = '$saPlanInfoViewCtrl';
6649 6652  
6650 6653 return {
6651 6654 pre: function(scope, element, attr) {
... ... @@ -6654,6 +6657,23 @@ angular.module(&#39;ScheduleApp&#39;).directive(
6654 6657 },
6655 6658 post: function(scope, element, attr) {
6656 6659 // TODO:
  6660 +
  6661 + // ------------------- dom事件处理function -----------------//
  6662 + scope[ctrlAs].$$cell_click = function(rowindex, colindex, cell) {
  6663 + console.log("click " + "row=" + rowindex + ",col=" + colindex);
  6664 + if (cell.id) { // 有排班明细id的cell才能操作
  6665 + cell.sel = !cell.sel; // 是否选中toggle
  6666 + }
  6667 +
  6668 + };
  6669 + scope[ctrlAs].$$cell_dbclick = function(rowindex, colindex, cell) {
  6670 + if (cell.id) { // 有排班明细id的cell才能操作
  6671 + if ($attr_celldbclick) {
  6672 + // 注意调用方法
  6673 + scope[ctrlAs].celldbclickFn()(rowindex, colindex);
  6674 + }
  6675 + }
  6676 + };
6657 6677 }
6658 6678  
6659 6679 };
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
... ... @@ -970,7 +970,7 @@ ScheduleApp.config([
970 970 }]
971 971 }
972 972 })
973   - .state("schedulePlanInfoExtFormManage_edit", { // 修改套跑form
  973 + .state("schedulePlanInfoExtFormManage_edit", { // 调整路牌班次人员
974 974 url: '/schedulePlanInfoExtFormManage_edit/:xlId/:xlName/:sd/:lpId/:lpName',
975 975 views: {
976 976 "": {templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html'}
... ... @@ -988,10 +988,30 @@ ScheduleApp.config([
988 988 });
989 989 }]
990 990 }
  991 + })
  992 + .state("schedulePlanReportExtManageListEdit", { // 修改班次信息
  993 + url: '/schedulePlanReportExtManageListEdit/:spInfoId',
  994 + views: {
  995 + "": {templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit-detail.html'}
  996 + },
  997 + resolve: {
  998 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  999 + return $ocLazyLoad.load({
  1000 + name: 'schedulePlanManage_module',
  1001 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  1002 + files: [
  1003 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  1004 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  1005 + "pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js"
  1006 + ]
  1007 + });
  1008 + }]
  1009 + }
991 1010 });
992 1011  
993 1012 }
994   -]);
  1013 +]);
  1014 +
995 1015 // ui route 配置
996 1016  
997 1017 /** 排班规则模块配置route */
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit-detail.html 0 → 100644
  1 +<div ng-controller="SchedulePlanReportExtManageListEditCtrl as ctrl">
  2 + <div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改班次信息</h1>
  5 + </div>
  6 + </div>
  7 +
  8 + <ul class="page-breadcrumb breadcrumb">
  9 + <li>
  10 + <a href="/pages/home.html" data-pjax>首页</a>
  11 + <i class="fa fa-circle"></i>
  12 + </li>
  13 + <li>
  14 + <span class="active">运营计划管理</span>
  15 + <i class="fa fa-circle"></i>
  16 + </li>
  17 + <li>
  18 + <a ui-sref="schedulePlanReportExtManage">调度值勤日报</a>
  19 + <i class="fa fa-circle"></i>
  20 + </li>
  21 + <li>
  22 + <span class="active">修改班次信息</span>
  23 + </li>
  24 + </ul>
  25 +
  26 + <div class="portlet light bordered">
  27 + <div class="portlet-title">
  28 + <div class="caption caption-subject font-red-sunglo bold uppercase">
  29 + <span ng-bind="ctrl.headInfo.xlName"></span>
  30 + 当前排班日期
  31 + <span ng-bind="ctrl.schedulePlanInfoForSave.scheduleDate | date: 'yyyy年MM月dd日'"></span>
  32 + </div>
  33 + </div>
  34 +
  35 + <div class="portlet-body form">
  36 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  37 + <div class="form-body">
  38 + <div class="form-group has-success has-feedback">
  39 + <label class="col-md-2 control-label">线路:</label>
  40 + <div class="col-md-3">
  41 + <input type="text" class="form-control"
  42 + ng-value="ctrl.headInfo.xlName"
  43 + readonly/>
  44 + </div>
  45 +
  46 + </div>
  47 + <div class="form-group has-success has-feedback">
  48 + <label class="col-md-2 control-label">路牌:</label>
  49 + <div class="col-md-3">
  50 + <input type="text" class="form-control"
  51 + ng-value="ctrl.headInfo.lpName"
  52 + readonly/>
  53 + </div>
  54 +
  55 + </div>
  56 + <div class="form-group has-success has-feedback">
  57 + <label class="col-md-2 control-label">驾驶员:</label>
  58 + <div class="col-md-3">
  59 + <input type="text" class="form-control"
  60 + ng-value="ctrl.headInfo.jName"
  61 + readonly/>
  62 + </div>
  63 +
  64 + </div>
  65 +
  66 + <div class="form-group has-success has-feedback">
  67 + <label class="col-md-2 control-label">自编号:</label>
  68 + <div class="col-md-3">
  69 + <input type="text" class="form-control"
  70 + ng-value="ctrl.headInfo.clZbh"
  71 + readonly/>
  72 + </div>
  73 +
  74 + </div>
  75 +
  76 + <div class="form-group has-success has-feedback">
  77 + <label class="col-md-2 control-label">车牌号:</label>
  78 + <div class="col-md-3">
  79 + <input type="text" class="form-control"
  80 + ng-value="ctrl.headInfo.clCph"
  81 + readonly/>
  82 + </div>
  83 +
  84 + </div>
  85 +
  86 + <!--<div class="form-group has-success has-feedback">-->
  87 + <!--<label class="col-md-2 control-label">方向*:</label>-->
  88 + <!--<div class="col-md-3">-->
  89 + <!--<sa-Radiogroup model="ctrl.TimeTableDetailForSave.xlDir" dicgroup="LineTrend" name="xlDir" required></sa-Radiogroup>-->
  90 + <!--</div>-->
  91 + <!--&lt;!&ndash; 隐藏块,显示验证信息 &ndash;&gt;-->
  92 + <!--<div class="alert alert-danger well-sm" ng-show="myForm.xlDir.$error.required">-->
  93 + <!--请选择线路上下行-->
  94 + <!--</div>-->
  95 +
  96 + <!--</div>-->
  97 +
  98 + <div class="form-group has-success has-feedback">
  99 + <label class="col-md-2 control-label">起点站:</label>
  100 + <div class="col-md-3">
  101 + <input type="text" class="form-control"
  102 + ng-value="ctrl.schedulePlanInfoForSave.qdzName"
  103 + readonly/>
  104 + </div>
  105 +
  106 + </div>
  107 +
  108 + <div class="form-group has-success has-feedback">
  109 + <label class="col-md-2 control-label">终点站:</label>
  110 + <div class="col-md-3">
  111 + <input type="text" class="form-control"
  112 + ng-value="ctrl.schedulePlanInfoForSave.zdzName"
  113 + readonly/>
  114 + </div>
  115 +
  116 + </div>
  117 +
  118 + <div class="form-group has-success has-feedback">
  119 + <label class="col-md-2 control-label">发车时间*:</label>
  120 + <div class="col-md-3">
  121 + <input type="text" class="form-control" name="fcsj"
  122 + ng-model="ctrl.schedulePlanInfoForSave.fcsj"
  123 + ng-pattern="ctrl.time_regex"
  124 + required />
  125 + </div>
  126 + <!-- 隐藏块,显示验证信息 -->
  127 + <div class="alert alert-danger well-sm" ng-show="myForm.fcsj.$error.required">
  128 + 发车时间必须填写
  129 + </div>
  130 + <div class="alert alert-danger well-sm" ng-show="myForm.fcsj.$error.pattern">
  131 + 时间格式错误,应该是格式hh:mm,如:06:39
  132 + </div>
  133 +
  134 + </div>
  135 +
  136 + <div class="form-group has-success has-feedback">
  137 + <label class="col-md-2 control-label">计划里程*:</label>
  138 + <div class="col-md-3">
  139 + <input type="text" class="form-control" name="jhlc"
  140 + ng-model="ctrl.schedulePlanInfoForSave.jhlc" required ng-pattern="ctrl.float_regex"
  141 + />
  142 + </div>
  143 + <!-- 隐藏块,显示验证信息 -->
  144 + <div class="alert alert-danger well-sm" ng-show="myForm.jhlc.$error.required">
  145 + 计划里程必须填写
  146 + </div>
  147 + <div class="alert alert-danger well-sm" ng-show="myForm.jhlc.$error.pattern">
  148 + 输入数字
  149 + </div>
  150 +
  151 + </div>
  152 + <div class="form-group has-success has-feedback">
  153 + <label class="col-md-2 control-label">班次历时*:</label>
  154 + <div class="col-md-3">
  155 + <input type="text" class="form-control" name="bcsj"
  156 + ng-model="ctrl.schedulePlanInfoForSave.bcsj" required ng-pattern="ctrl.number_regex"
  157 + />
  158 + </div>
  159 + <!-- 隐藏块,显示验证信息 -->
  160 + <div class="alert alert-danger well-sm" ng-show="myForm.bcsj.$error.required">
  161 + 班次时间必须填写
  162 + </div>
  163 + <div class="alert alert-danger well-sm" ng-show="myForm.bcsj.$error.pattern">
  164 + 输入整数
  165 + </div>
  166 +
  167 + </div>
  168 +
  169 + <div class="form-group has-success has-feedback">
  170 + <label class="col-md-2 control-label">班次类型*:</label>
  171 + <div class="col-md-3">
  172 + <sa-Select5 name="bcType"
  173 + model="ctrl.schedulePlanInfoForSave"
  174 + cmaps="{'bcType': 'code'}"
  175 + dcname="bcType"
  176 + icname="code"
  177 + dsparams="{{ {type: 'dic', param: 'ScheduleType' } | json }}"
  178 + iterobjname="item"
  179 + iterobjexp="item.name"
  180 + searchph="请选择班次类型..."
  181 + searchexp="this.name"
  182 + required
  183 + >
  184 + </sa-Select5>
  185 + </div>
  186 + <!-- 隐藏块,显示验证信息 -->
  187 + <div class="alert alert-danger well-sm" ng-show="myForm.bcType.$error.required">
  188 + 班次类型必须选择
  189 + </div>
  190 +
  191 + </div>
  192 +
  193 + </div>
  194 +
  195 + <div class="form-actions">
  196 + <div class="row">
  197 + <div class="col-md-offset-3 col-md-4">
  198 + <button type="submit" class="btn green"
  199 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  200 + <a type="button" class="btn default"
  201 + href="javascript:" ng-click="ctrl.cancel()" ><i class="fa fa-times"></i> 取消</a>
  202 + </div>
  203 + </div>
  204 + </div>
  205 + </form>
  206 +
  207 + </div>
  208 + </div>
  209 +
  210 +
  211 +
  212 +
  213 +</div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/list.html
... ... @@ -32,7 +32,7 @@
32 32 </div>
33 33 </div>
34 34  
35   - <sa-Planinfoview name="saPlanView" ng-model="ctrl.saPlanInfoViewData.infos" ng-model-options="{ getterSetter: true }" >
  35 + <sa-Planinfoview name="saPlanView" ng-model="ctrl.saPlanInfoViewData.infos" ng-model-options="{ getterSetter: true }" celldbclick="ctrl.singleEditBcDetail">
36 36 </sa-Planinfoview>
37 37 </div>
38 38  
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js
... ... @@ -9,11 +9,27 @@ angular.module(&#39;ScheduleApp&#39;).factory(
9 9 function(service, service2, $q) {
10 10 /** 当前的查询条件信息 */
11 11 var currentSearchCondition = {};
  12 + /** 当前视图Id 0:值勤日报视图 1:预览编辑视图 */
  13 + var viewId = 0;
12 14  
13 15 // 查询对象
14 16 var queryClass = service.rest;
15 17  
16 18 return {
  19 + getViewId: function() {
  20 + return viewId;
  21 + },
  22 + // callbackFun回调函数,参数1:上一个视图id,参数2:当前视图Id
  23 + switchView: function(callbackFun) {
  24 + if (viewId === 0) {
  25 + viewId = 1;
  26 + callbackFun(0, 1);
  27 + } else {
  28 + viewId = 0;
  29 + callbackFun(1, 0);
  30 + }
  31 + },
  32 +
17 33 getQueryClass: function() {
18 34 return queryClass;
19 35 },
... ... @@ -290,32 +306,35 @@ angular.module(&#39;ScheduleApp&#39;).controller(
290 306 self.saPlanInfoViewData = {
291 307 infos: {}
292 308 };
293   - self.viewId = 0;
  309 + self.viewId = service.getViewId();
  310 +
  311 + if (self.viewId === 1) { // 是从其他state转换过来的,数据也需要初始化一次
  312 + service.getSaPlanInfoViewData().then(
  313 + function(rst) {
  314 + self.saPlanInfoViewData.infos = rst;
  315 +
  316 + console.log(self.saPlanInfoViewData.infos);
  317 + },
  318 + function(err) {
  319 +
  320 + }
  321 + );
  322 + }
  323 +
294 324 self.switchView = function() {
295   - if (self.viewId === 0) {
296   - self.viewId = 1;
297   - if (service.getSaPlanInfoViewData() != null) {
298   - service.getSaPlanInfoViewData().then(
  325 + var saPlanInfoViewDataPromise = service.getSaPlanInfoViewData();
  326 + if (saPlanInfoViewDataPromise == null) {
  327 + alert("请选择线路和排班日期!");
  328 + return;
  329 + }
  330 +
  331 + service.switchView(function(preViewId, currentViewId) {
  332 + self.viewId = currentViewId;
  333 + if (currentViewId === 1) {
  334 + saPlanInfoViewDataPromise.then(
299 335 function(rst) {
300 336 self.saPlanInfoViewData.infos = rst;
301 337  
302   - /*
303   - 注意:后台是没有传过来班次类型,这里通过head来判定是否进出场班次
304   - TODO:如果以后要标识新的班次类型,甚至要修改班次内容,后台可能要大改(可能要改回时刻表编辑的做法)
305   - TODO:注意,调度执勤日报时刻表视图后台etl用的是导出的etl,所以要加复杂功能的话可能还得拆成2个etl
306   - */
307   - var _headers = rst.header;
308   - for (var i = 0; i < rst.contents.length; i++) {
309   - for (var j = 0; j < rst.contents[i].length; j++) {
310   - if (_headers[j].indexOf("出场") >= 0) {
311   - self.saPlanInfoViewData.infos.contents[i][j].bc_type = "out";
312   - }
313   - if (_headers[j].indexOf("进场") >= 0) {
314   - self.saPlanInfoViewData.infos.contents[i][j].bc_type = "in";
315   - }
316   - }
317   - }
318   -
319 338 console.log(self.saPlanInfoViewData.infos);
320 339 },
321 340 function(err) {
... ... @@ -323,19 +342,103 @@ angular.module(&#39;ScheduleApp&#39;).controller(
323 342 }
324 343 );
325 344 }
326   - } else {
327   - self.viewId = 0;
328   - }
  345 + });
329 346 };
330 347  
331 348 self.ttHeight = 500; // sa-Planinfoview组件的高度
332 349  
333 350  
  351 +
  352 + /**
  353 + * 单独修改班次明细。
  354 + */
  355 + self.singleEditBcDetail = function(rowNum, colNum) {
  356 +
  357 + console.log(rowNum + "," + colNum);
  358 +
  359 + $state.go('schedulePlanReportExtManageListEdit',
  360 + {
  361 + spInfoId: self.saPlanInfoViewData.infos.contents[rowNum][colNum]["id"]
  362 + });
  363 + };
  364 +
334 365 }
335 366  
336 367 ]
337 368 );
338 369  
  370 +// edit.detail页面
  371 +angular.module('ScheduleApp').controller(
  372 + 'SchedulePlanReportExtManageListEditCtrl',
  373 + [
  374 + 'SchedulePlanInfoManageService_g',
  375 + 'BusInfoManageService_g',
  376 + '$stateParams',
  377 + '$state',
  378 + 'SaTimeTableUtils',
  379 + function(spInfoservice, carService, $stateParams, $state, SaTimeTableUtils) {
  380 + var self = this;
  381 +
  382 + console.log($stateParams.spInfoId);
  383 +
  384 + // 其他的显示数据
  385 + self.headInfo = {
  386 + xlName: '', // 线路名称
  387 + lpName: '', // 路牌名称
  388 + jName: '', // 驾驶员
  389 + clZbh: '', // 自编号
  390 + clCph: '', // 车牌号
  391 + };
  392 +
  393 + // 排班明细对象
  394 + var SchedulePlanInfo = spInfoservice.rest;
  395 + // 车辆信息对象
  396 + var Cars = carService.rest;
  397 +
  398 + // 保存的排班明细数据
  399 + self.schedulePlanInfoForSave = {};
  400 + // 获取数据
  401 + SchedulePlanInfo.get({id: $stateParams.spInfoId}, function(value) {
  402 + self.schedulePlanInfoForSave = value;
  403 +
  404 + self.headInfo['xlName'] = value['xlName'];
  405 + self.headInfo['lpName'] = value['lpName'];
  406 + self.headInfo['jName'] = value['jName'];
  407 + self.headInfo['clZbh'] = value['clZbh'];
  408 +
  409 + Cars.get({id: value.cl}, function(value2) {
  410 + self.headInfo['clCph'] = value2['carPlate'];
  411 + });
  412 + });
  413 +
  414 + // 时间正则表达式(格式hh:mm,如:06:39)
  415 + self.time_regex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
  416 + // 整数
  417 + self.number_regex = /^-?\d+$/;
  418 + // 小数
  419 + self.float_regex = /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/;
  420 +
  421 + // 提交方法
  422 + self.submit = function() {
  423 + self.schedulePlanInfoForSave.$save(function() {
  424 + $state.go("schedulePlanReportExtManage");
  425 + });
  426 + };
  427 + // 取消方法
  428 + self.cancel = function() {
  429 + $state.go("schedulePlanReportExtManage");
  430 + };
  431 +
  432 + }
  433 + ]
  434 +);
  435 +
  436 +
  437 +
  438 +
  439 +
  440 +
  441 +
339 442 // edit.html页面
340 443 angular.module('ScheduleApp').controller(
341 444 'ScheduleRuleManageExtFormCtrl',
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/report/ext/route.js
... ... @@ -34,7 +34,7 @@ ScheduleApp.config([
34 34 }]
35 35 }
36 36 })
37   - .state("schedulePlanInfoExtFormManage_edit", { // 修改套跑form
  37 + .state("schedulePlanInfoExtFormManage_edit", { // 调整路牌班次人员
38 38 url: '/schedulePlanInfoExtFormManage_edit/:xlId/:xlName/:sd/:lpId/:lpName',
39 39 views: {
40 40 "": {templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit.html'}
... ... @@ -52,7 +52,26 @@ ScheduleApp.config([
52 52 });
53 53 }]
54 54 }
  55 + })
  56 + .state("schedulePlanReportExtManageListEdit", { // 修改班次信息
  57 + url: '/schedulePlanReportExtManageListEdit/:spInfoId',
  58 + views: {
  59 + "": {templateUrl: 'pages/scheduleApp/module/core/schedulePlanManage/report/ext/edit-detail.html'}
  60 + },
  61 + resolve: {
  62 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  63 + return $ocLazyLoad.load({
  64 + name: 'schedulePlanManage_module',
  65 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  66 + files: [
  67 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  68 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  69 + "pages/scheduleApp/module/core/schedulePlanManage/report/ext/module.js"
  70 + ]
  71 + });
  72 + }]
  73 + }
55 74 });
56 75  
57 76 }
58   -]);
59 77 \ No newline at end of file
  78 +]);
... ...