Commit 7d3ef5eab6f0e3c3d99c99f257a86ff291fced99
Merge branch 'minhang' of
http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
9 changed files
with
761 additions
and
487 deletions
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
| ... | ... | @@ -49,7 +49,7 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 49 | 49 | "where info.xl = ?1 and " + |
| 50 | 50 | "info.schedule_date = ?2 " + |
| 51 | 51 | "group by info.xl_name, info.schedule_date, info.lp, info.lp_name, info.cl, info.cl_zbh " + |
| 52 | - "order by info.xl_name, info.schedule_date, info.lp ", nativeQuery = true) | |
| 52 | + "order by info.xl_name, info.schedule_date, info.lp, info.fcno ", nativeQuery = true) | |
| 53 | 53 | List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate); |
| 54 | 54 | |
| 55 | 55 | @Modifying | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.Business; | |
| 4 | 3 | import com.bsth.entity.Line; |
| 5 | -import com.bsth.entity.schedule.*; | |
| 4 | +import com.bsth.entity.schedule.SchedulePlan; | |
| 5 | +import com.bsth.entity.schedule.TTInfo; | |
| 6 | 6 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 7 | 7 | import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 8 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| ... | ... | @@ -12,7 +12,6 @@ import com.bsth.service.schedule.*; |
| 12 | 12 | import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; |
| 13 | 13 | import com.bsth.service.schedule.rules.plan.PlanResult; |
| 14 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 15 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 16 | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 17 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 18 | 17 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| ... | ... | @@ -21,8 +20,6 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; |
| 21 | 20 | import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; |
| 22 | 21 | import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; |
| 23 | 22 | import com.bsth.service.schedule.rules.ttinfo2.Result; |
| 24 | -import com.google.common.collect.Multimap; | |
| 25 | -import org.apache.commons.lang3.StringUtils; | |
| 26 | 23 | import org.joda.time.DateTime; |
| 27 | 24 | import org.kie.api.KieBase; |
| 28 | 25 | import org.kie.api.runtime.KieSession; |
| ... | ... | @@ -209,6 +206,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 209 | 206 | session.setGlobal("tTInfoDetailService", ttInfoDetailService); |
| 210 | 207 | session.setGlobal("carConfigInfoService", carConfigInfoService); |
| 211 | 208 | session.setGlobal("employeeConfigInfoService", employeeConfigInfoService); |
| 209 | + session.setGlobal("lineService", lineService); | |
| 210 | + session.setGlobal("businessService", businessService); | |
| 212 | 211 | session.setGlobal("log", logger); // 设置日志 |
| 213 | 212 | |
| 214 | 213 | // 载入数据 |
| ... | ... | @@ -233,168 +232,177 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 233 | 232 | // 3、计划输出 |
| 234 | 233 | PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); |
| 235 | 234 | |
| 236 | - // TODO: | |
| 235 | + schedulePlan.getSchedulePlanInfoList().addAll(planResult.getSchedulePlanInfos()); | |
| 236 | + schedulePlan.setTtInfoId("todo"); // TODO:待修正 | |
| 237 | + schedulePlan.setTtInfoNames("todo"); // TODO:待修正 | |
| 238 | + | |
| 239 | + super.save(schedulePlan); | |
| 237 | 240 | |
| 238 | 241 | return new SchedulePlan(); |
| 239 | 242 | } |
| 240 | 243 | |
| 241 | 244 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 242 | 245 | public SchedulePlan save(SchedulePlan schedulePlan) { |
| 243 | - // 测试 | |
| 244 | -// return save2(schedulePlan); | |
| 245 | - | |
| 246 | - // 1-1、查找线路具体信息 | |
| 247 | - Line xl = strategy.getLine(schedulePlan.getXl().getId()); | |
| 248 | - // 1-2、查出指定线路的所有规则 | |
| 249 | - TTInfo ttInfo = strategy.getTTInfo(xl.getId()).get(0); // 时刻表id | |
| 250 | - schedulePlan.setTtInfo(ttInfo); // TODO:关联的时刻表,之后改掉 | |
| 251 | - | |
| 252 | - // 2-1、构造drools规则输入数据,输出数据 | |
| 253 | - // 全局计算参数 | |
| 254 | - ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); | |
| 255 | - // 每个规则对应的输入参数 | |
| 256 | - List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>(); | |
| 257 | - Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator(); | |
| 258 | - while (scheduleRule1FlatIterator.hasNext()) { | |
| 259 | - ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next(); | |
| 260 | - ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp); | |
| 261 | - scheduleRule_inputs.add(scheduleRule_input); | |
| 262 | - } | |
| 263 | - // 规则输出数据 | |
| 264 | - ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); | |
| 265 | - | |
| 266 | - // 2-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 267 | - // 创建session,内部配置的是stateful | |
| 268 | - KieSession session = kieBase.newKieSession(); | |
| 269 | - // 设置gloable对象,在drl中通过别名使用 | |
| 270 | - session.setGlobal("scheduleResult", scheduleResults_output); | |
| 271 | - session.setGlobal("log", logger); // 设置日志 | |
| 272 | - | |
| 273 | - // 载入数据 | |
| 274 | - session.insert(scheduleCalcuParam_input); | |
| 275 | - for (ScheduleRule_input scheduleRule_input : scheduleRule_inputs) { | |
| 276 | - session.insert(scheduleRule_input); | |
| 277 | - } | |
| 278 | - // 执行rule | |
| 279 | - session.fireAllRules(); | |
| 280 | - | |
| 281 | - // 执行完毕销毁,有日志的也要关闭 | |
| 282 | - session.dispose(); | |
| 283 | - | |
| 284 | - System.out.println(scheduleResults_output.showGuideboardDesc1()); | |
| 285 | - | |
| 286 | 246 | // 2-3、如果排班的数据之前已经有了,删除之前的数据 |
| 287 | 247 | schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual( |
| 288 | - xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime() | |
| 248 | + schedulePlan.getXl().getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime() | |
| 289 | 249 | ); |
| 290 | 250 | |
| 291 | - // 3、根据规则返回,组合最后的输出数据 | |
| 292 | - // 3-1、根据注入的策略服务,获取原始数据 | |
| 293 | - Map<Date, Multimap<Long, TTInfoDetail>> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps( | |
| 294 | - xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()); | |
| 295 | - | |
| 296 | - Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息 | |
| 297 | - Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息 | |
| 298 | - | |
| 299 | - // 3-2、循环规则输出 | |
| 300 | - Map<Long, String> ttInfoMap = new HashMap<>(); // 时刻表映射,id和名字 | |
| 301 | - List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); | |
| 302 | - for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) { | |
| 303 | - // 车辆配置对应的车辆 | |
| 304 | - CarConfigInfo configInfo = carConfigMaps.get(Long.valueOf(scheduleResult_output.getCarConfigId())); | |
| 305 | - // 人员配置对应的人员,这里需要分班处理的 | |
| 306 | - List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>(); | |
| 307 | - String[] eids = scheduleResult_output.getEmployeeConfigId().split("-"); | |
| 308 | - for (String eid : eids) { | |
| 309 | - employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid))); | |
| 310 | - } | |
| 311 | - // 排班明细(这个要迭代的) | |
| 312 | - Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 313 | - Long.parseLong(scheduleResult_output.getGuideboardId())); | |
| 314 | - List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_); | |
| 315 | - | |
| 316 | - // 排序ttInfoDetails | |
| 317 | - Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() { | |
| 318 | - @Override | |
| 319 | - public int compare(TTInfoDetail o1, TTInfoDetail o2) { | |
| 320 | - return o1.getFcno().compareTo(o2.getFcno()); | |
| 321 | - } | |
| 322 | - }); | |
| 323 | - | |
| 324 | - Boolean isFb = false; // 是否分班 | |
| 325 | - for (int i = 0; i < ttInfoDetails.size(); i++) { | |
| 326 | - TTInfoDetail ttInfoDetail = ttInfoDetails.get(i); | |
| 327 | - | |
| 328 | - if (ttInfoDetail.getIsFB()) | |
| 329 | - isFb = ttInfoDetail.getIsFB(); | |
| 330 | - | |
| 331 | - SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( | |
| 332 | - xl, | |
| 333 | - scheduleResult_output, | |
| 334 | - ttInfoDetail, | |
| 335 | - isFb, | |
| 336 | - configInfo, | |
| 337 | - employeeConfigInfoList, | |
| 338 | - schedulePlan, | |
| 339 | - i == 0, | |
| 340 | - i == ttInfoDetails.size() - 1); | |
| 341 | - | |
| 342 | - // 获取公司,分公司信息 | |
| 343 | - String gsbm = xl.getCompany(); | |
| 344 | - String fgsbm = xl.getBrancheCompany(); | |
| 345 | - Business gs = null; | |
| 346 | - Business fgs = null; | |
| 347 | - | |
| 348 | - Map<String, Object> param = new HashMap<>(); | |
| 349 | - | |
| 350 | - if (StringUtils.isNotEmpty(gsbm)) { | |
| 351 | - param.clear(); | |
| 352 | - param.put("businessCode_eq", gsbm); | |
| 353 | - Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 354 | - if (businessIterator.hasNext()) { | |
| 355 | - gs = businessIterator.next(); | |
| 356 | - } | |
| 357 | - } | |
| 358 | - if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) { | |
| 359 | - param.clear();; | |
| 360 | - param.put("upCode_eq", gsbm); | |
| 361 | - param.put("businessCode_eq", fgsbm); | |
| 362 | - Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 363 | - if (businessIterator.hasNext()) { | |
| 364 | - fgs = businessIterator.next(); | |
| 365 | - } | |
| 366 | - } | |
| 367 | - | |
| 368 | - if (gs != null) { | |
| 369 | - schedulePlanInfo.setGsBm(gs.getBusinessCode()); | |
| 370 | - schedulePlanInfo.setGsName(gs.getBusinessName()); | |
| 371 | - } | |
| 372 | - if (fgs != null) { | |
| 373 | - schedulePlanInfo.setFgsBm(fgs.getBusinessCode()); | |
| 374 | - schedulePlanInfo.setFgsName(fgs.getBusinessName()); | |
| 375 | - } | |
| 376 | - | |
| 377 | - // 操作人,操作时间 | |
| 378 | - schedulePlanInfo.setCreateBy(schedulePlan.getCreateBy()); | |
| 379 | - schedulePlanInfo.setCreateDate(schedulePlan.getCreateDate()); | |
| 380 | - schedulePlanInfo.setUpdateBy(schedulePlan.getUpdateBy()); | |
| 381 | - schedulePlanInfo.setUpdateDate(schedulePlan.getUpdateDate()); | |
| 382 | - | |
| 383 | - schedulePlanInfos.add(schedulePlanInfo); | |
| 384 | - ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); | |
| 385 | - | |
| 386 | - } | |
| 387 | - | |
| 388 | - } | |
| 389 | - | |
| 390 | - schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ",")); | |
| 391 | - schedulePlan.setTtInfoNames(StringUtils.join(ttInfoMap.values(), ",")); | |
| 392 | - | |
| 393 | - // 3-2、保存生成的排班和明细 | |
| 394 | - schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息 | |
| 395 | - super.save(schedulePlan); | |
| 396 | - | |
| 397 | - return new SchedulePlan(); | |
| 251 | + // 测试 | |
| 252 | + return save2(schedulePlan); | |
| 253 | + | |
| 254 | +// // 1-1、查找线路具体信息 | |
| 255 | +// Line xl = strategy.getLine(schedulePlan.getXl().getId()); | |
| 256 | +// // 1-2、查出指定线路的所有规则 | |
| 257 | +// TTInfo ttInfo = strategy.getTTInfo(xl.getId()).get(0); // 时刻表id | |
| 258 | +// schedulePlan.setTtInfo(ttInfo); // TODO:关联的时刻表,之后改掉 | |
| 259 | +// | |
| 260 | +// // 2-1、构造drools规则输入数据,输出数据 | |
| 261 | +// // 全局计算参数 | |
| 262 | +// ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); | |
| 263 | +// // 每个规则对应的输入参数 | |
| 264 | +// List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>(); | |
| 265 | +// Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator(); | |
| 266 | +// while (scheduleRule1FlatIterator.hasNext()) { | |
| 267 | +// ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next(); | |
| 268 | +// ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp); | |
| 269 | +// scheduleRule_inputs.add(scheduleRule_input); | |
| 270 | +// } | |
| 271 | +// // 规则输出数据 | |
| 272 | +// ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); | |
| 273 | +// | |
| 274 | +// // 2-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 275 | +// // 创建session,内部配置的是stateful | |
| 276 | +// KieSession session = kieBase.newKieSession(); | |
| 277 | +// // 设置gloable对象,在drl中通过别名使用 | |
| 278 | +// session.setGlobal("scheduleResult", scheduleResults_output); | |
| 279 | +// session.setGlobal("log", logger); // 设置日志 | |
| 280 | +// | |
| 281 | +// // 载入数据 | |
| 282 | +// session.insert(scheduleCalcuParam_input); | |
| 283 | +// for (ScheduleRule_input scheduleRule_input : scheduleRule_inputs) { | |
| 284 | +// session.insert(scheduleRule_input); | |
| 285 | +// } | |
| 286 | +// // 执行rule | |
| 287 | +// session.fireAllRules(); | |
| 288 | +// | |
| 289 | +// // 执行完毕销毁,有日志的也要关闭 | |
| 290 | +// session.dispose(); | |
| 291 | +// | |
| 292 | +// System.out.println(scheduleResults_output.showGuideboardDesc1()); | |
| 293 | +// | |
| 294 | +// // 2-3、如果排班的数据之前已经有了,删除之前的数据 | |
| 295 | +// schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual( | |
| 296 | +// xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime() | |
| 297 | +// ); | |
| 298 | +// | |
| 299 | +// // 3、根据规则返回,组合最后的输出数据 | |
| 300 | +// // 3-1、根据注入的策略服务,获取原始数据 | |
| 301 | +// Map<Date, Multimap<Long, TTInfoDetail>> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps( | |
| 302 | +// xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()); | |
| 303 | +// | |
| 304 | +// Map<Long, CarConfigInfo> carConfigMaps = strategy.getCarConfigMaps(xl.getId()); // 车辆配置对应车辆信息 | |
| 305 | +// Map<Long, EmployeeConfigInfo> employeeConfigMaps = strategy.getEmployeeConfigMaps(xl.getId()); // 人员配置对应的人员信息 | |
| 306 | +// | |
| 307 | +// // 3-2、循环规则输出 | |
| 308 | +// Map<Long, String> ttInfoMap = new HashMap<>(); // 时刻表映射,id和名字 | |
| 309 | +// List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); | |
| 310 | +// for (ScheduleResult_output scheduleResult_output : scheduleResults_output.getResults()) { | |
| 311 | +// // 车辆配置对应的车辆 | |
| 312 | +// CarConfigInfo configInfo = carConfigMaps.get(Long.valueOf(scheduleResult_output.getCarConfigId())); | |
| 313 | +// // 人员配置对应的人员,这里需要分班处理的 | |
| 314 | +// List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>(); | |
| 315 | +// String[] eids = scheduleResult_output.getEmployeeConfigId().split("-"); | |
| 316 | +// for (String eid : eids) { | |
| 317 | +// employeeConfigInfoList.add(employeeConfigMaps.get(Long.valueOf(eid))); | |
| 318 | +// } | |
| 319 | +// // 排班明细(这个要迭代的) | |
| 320 | +// Collection<TTInfoDetail> ttInfoDetails_ = gbdTTinfoMaps.get(scheduleResult_output.getSd().toDate()).get( | |
| 321 | +// Long.parseLong(scheduleResult_output.getGuideboardId())); | |
| 322 | +// List<TTInfoDetail> ttInfoDetails = new ArrayList<>(ttInfoDetails_); | |
| 323 | +// | |
| 324 | +// // 排序ttInfoDetails | |
| 325 | +// Collections.sort(ttInfoDetails, new Comparator<TTInfoDetail>() { | |
| 326 | +// @Override | |
| 327 | +// public int compare(TTInfoDetail o1, TTInfoDetail o2) { | |
| 328 | +// return o1.getFcno().compareTo(o2.getFcno()); | |
| 329 | +// } | |
| 330 | +// }); | |
| 331 | +// | |
| 332 | +// Boolean isFb = false; // 是否分班 | |
| 333 | +// for (int i = 0; i < ttInfoDetails.size(); i++) { | |
| 334 | +// TTInfoDetail ttInfoDetail = ttInfoDetails.get(i); | |
| 335 | +// | |
| 336 | +// if (ttInfoDetail.getIsFB()) | |
| 337 | +// isFb = ttInfoDetail.getIsFB(); | |
| 338 | +// | |
| 339 | +// SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( | |
| 340 | +// xl, | |
| 341 | +// scheduleResult_output, | |
| 342 | +// ttInfoDetail, | |
| 343 | +// isFb, | |
| 344 | +// configInfo, | |
| 345 | +// employeeConfigInfoList, | |
| 346 | +// schedulePlan, | |
| 347 | +// i == 0, | |
| 348 | +// i == ttInfoDetails.size() - 1); | |
| 349 | +// | |
| 350 | +// // 获取公司,分公司信息 | |
| 351 | +// String gsbm = xl.getCompany(); | |
| 352 | +// String fgsbm = xl.getBrancheCompany(); | |
| 353 | +// Business gs = null; | |
| 354 | +// Business fgs = null; | |
| 355 | +// | |
| 356 | +// Map<String, Object> param = new HashMap<>(); | |
| 357 | +// | |
| 358 | +// if (StringUtils.isNotEmpty(gsbm)) { | |
| 359 | +// param.clear(); | |
| 360 | +// param.put("businessCode_eq", gsbm); | |
| 361 | +// Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 362 | +// if (businessIterator.hasNext()) { | |
| 363 | +// gs = businessIterator.next(); | |
| 364 | +// } | |
| 365 | +// } | |
| 366 | +// if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) { | |
| 367 | +// param.clear();; | |
| 368 | +// param.put("upCode_eq", gsbm); | |
| 369 | +// param.put("businessCode_eq", fgsbm); | |
| 370 | +// Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 371 | +// if (businessIterator.hasNext()) { | |
| 372 | +// fgs = businessIterator.next(); | |
| 373 | +// } | |
| 374 | +// } | |
| 375 | +// | |
| 376 | +// if (gs != null) { | |
| 377 | +// schedulePlanInfo.setGsBm(gs.getBusinessCode()); | |
| 378 | +// schedulePlanInfo.setGsName(gs.getBusinessName()); | |
| 379 | +// } | |
| 380 | +// if (fgs != null) { | |
| 381 | +// schedulePlanInfo.setFgsBm(fgs.getBusinessCode()); | |
| 382 | +// schedulePlanInfo.setFgsName(fgs.getBusinessName()); | |
| 383 | +// } | |
| 384 | +// | |
| 385 | +// // 操作人,操作时间 | |
| 386 | +// schedulePlanInfo.setCreateBy(schedulePlan.getCreateBy()); | |
| 387 | +// schedulePlanInfo.setCreateDate(schedulePlan.getCreateDate()); | |
| 388 | +// schedulePlanInfo.setUpdateBy(schedulePlan.getUpdateBy()); | |
| 389 | +// schedulePlanInfo.setUpdateDate(schedulePlan.getUpdateDate()); | |
| 390 | +// | |
| 391 | +// schedulePlanInfos.add(schedulePlanInfo); | |
| 392 | +// ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); | |
| 393 | +// | |
| 394 | +// } | |
| 395 | +// | |
| 396 | +// } | |
| 397 | +// | |
| 398 | +// schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ",")); | |
| 399 | +// schedulePlan.setTtInfoNames(StringUtils.join(ttInfoMap.values(), ",")); | |
| 400 | +// | |
| 401 | +// // 3-2、保存生成的排班和明细 | |
| 402 | +// schedulePlan.getSchedulePlanInfoList().addAll(schedulePlanInfos); // 关联的排班明细信息 | |
| 403 | +// super.save(schedulePlan); | |
| 404 | +// | |
| 405 | +// return new SchedulePlan(); | |
| 398 | 406 | } |
| 399 | 407 | |
| 400 | 408 | @Override | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java
| ... | ... | @@ -8,8 +8,10 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; |
| 8 | 8 | * 排班规则-规则输入参数。 |
| 9 | 9 | */ |
| 10 | 10 | public class PlanCalcuParam_input { |
| 11 | - /** 线路id */ | |
| 12 | - private Integer xlId; | |
| 11 | + /** 线路Id */ | |
| 12 | + private String xlId; | |
| 13 | + /** 计划主对象 */ | |
| 14 | + private SchedulePlan schedulePlan; | |
| 13 | 15 | /** 循环规则输出 */ |
| 14 | 16 | private ScheduleResults_output scheduleResults_output; |
| 15 | 17 | /** 时刻表选择规则输出 */ |
| ... | ... | @@ -21,16 +23,17 @@ public class PlanCalcuParam_input { |
| 21 | 23 | SchedulePlan schedulePlan, |
| 22 | 24 | ScheduleResults_output scheduleResults_output, |
| 23 | 25 | TTInfoResults_output ttInfoResults_output) { |
| 24 | - this.xlId = schedulePlan.getXl().getId(); | |
| 26 | + this.schedulePlan = schedulePlan; | |
| 27 | + this.xlId = String.valueOf(schedulePlan.getXl().getId()); | |
| 25 | 28 | this.scheduleResults_output = scheduleResults_output; |
| 26 | 29 | this.ttInfoResults_output = ttInfoResults_output; |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | - public Integer getXlId() { | |
| 32 | + public String getXlId() { | |
| 30 | 33 | return xlId; |
| 31 | 34 | } |
| 32 | 35 | |
| 33 | - public void setXlId(Integer xlId) { | |
| 36 | + public void setXlId(String xlId) { | |
| 34 | 37 | this.xlId = xlId; |
| 35 | 38 | } |
| 36 | 39 | |
| ... | ... | @@ -49,4 +52,12 @@ public class PlanCalcuParam_input { |
| 49 | 52 | public void setTtInfoResults_output(TTInfoResults_output ttInfoResults_output) { |
| 50 | 53 | this.ttInfoResults_output = ttInfoResults_output; |
| 51 | 54 | } |
| 55 | + | |
| 56 | + public SchedulePlan getSchedulePlan() { | |
| 57 | + return schedulePlan; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setSchedulePlan(SchedulePlan schedulePlan) { | |
| 61 | + this.schedulePlan = schedulePlan; | |
| 62 | + } | |
| 52 | 63 | } | ... | ... |
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbTimeFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.shiftloop; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 4 | +import org.joda.time.LocalTime; | |
| 5 | +import org.joda.time.format.DateTimeFormat; | |
| 6 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 7 | + | |
| 8 | +import java.io.*; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 时刻表路牌下的分班时间(起始时间)。 | |
| 12 | + */ | |
| 13 | +public class GidFbTimeFunction implements AccumulateFunction { | |
| 14 | + @Override | |
| 15 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 16 | + } | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 20 | + } | |
| 21 | + | |
| 22 | + protected static class GidFbTimeData implements Externalizable { | |
| 23 | + public LocalTime fbsj; | |
| 24 | + public String fbsj_str; | |
| 25 | + public TTInfoDetail ttInfoDetail; | |
| 26 | + | |
| 27 | + public GidFbTimeData() {} | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 31 | + fbsj_str = (String) in.readObject(); | |
| 32 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | |
| 33 | + } | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 37 | + out.writeObject(fbsj_str); | |
| 38 | + out.writeObject(ttInfoDetail); | |
| 39 | + } | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public Serializable createContext() { | |
| 44 | + return new GidFbTimeData(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public void init(Serializable context) throws Exception { | |
| 49 | + GidFbTimeData gidFbTimeData = (GidFbTimeData) context; | |
| 50 | + gidFbTimeData.fbsj_str = "NULL"; // 注意:因为空的时间也要规则执行,所以返回一个表示空的字符串 | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public void accumulate(Serializable context, Object value) { | |
| 55 | + GidFbTimeData gidFbTimeData = (GidFbTimeData) context; | |
| 56 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 57 | + | |
| 58 | + // 1块路牌有多个分班班次,取最早的时间作为起始分班时间 | |
| 59 | + if (ttInfoDetail.getIsFB()) { | |
| 60 | + LocalTime localTime = LocalTime.parse(ttInfoDetail.getFcsj(), DateTimeFormat.forPattern("HH:mm")); | |
| 61 | + | |
| 62 | + if (gidFbTimeData.fbsj == null) { | |
| 63 | + gidFbTimeData.fbsj = localTime; | |
| 64 | + gidFbTimeData.fbsj_str = ttInfoDetail.getFcsj(); | |
| 65 | + } else if (localTime.isBefore(gidFbTimeData.fbsj)) { | |
| 66 | + gidFbTimeData.fbsj = localTime; | |
| 67 | + gidFbTimeData.fbsj_str = ttInfoDetail.getFcsj(); | |
| 68 | + } | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public void reverse(Serializable serializable, Object o) throws Exception { | |
| 74 | + | |
| 75 | + } | |
| 76 | + | |
| 77 | + @Override | |
| 78 | + public boolean supportsReverse() { | |
| 79 | + return false; | |
| 80 | + } | |
| 81 | + | |
| 82 | + @Override | |
| 83 | + public Class<?> getResultType() { | |
| 84 | + return String.class; | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public Object getResult(Serializable context) throws Exception { | |
| 89 | + GidFbTimeData gidFbTimeData = (GidFbTimeData) context; | |
| 90 | + return gidFbTimeData.fbsj_str; | |
| 91 | + } | |
| 92 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidsCountFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.shiftloop; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 5 | + | |
| 6 | +import java.io.*; | |
| 7 | +import java.util.ArrayList; | |
| 8 | +import java.util.HashSet; | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Set; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 计算时刻表里的路爬列表。 | |
| 14 | + */ | |
| 15 | +public class GidsCountFunction implements AccumulateFunction { | |
| 16 | + @Override | |
| 17 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 18 | + } | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 22 | + } | |
| 23 | + | |
| 24 | + protected static class GidsCountData implements Externalizable { | |
| 25 | + public List<String> gids = new ArrayList<>(); | |
| 26 | + public Set<String> gids_temp = new HashSet<>(); | |
| 27 | + public TTInfoDetail ttInfoDetail; | |
| 28 | + | |
| 29 | + public GidsCountData() {} | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 33 | + gids = (List<String>) in.readObject(); | |
| 34 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | |
| 35 | + } | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 39 | + out.writeObject(gids); | |
| 40 | + out.writeObject(ttInfoDetail); | |
| 41 | + } | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public Serializable createContext() { | |
| 46 | + return new GidsCountData(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @Override | |
| 50 | + public void init(Serializable context) throws Exception { | |
| 51 | + GidsCountData gidsCountData = (GidsCountData) context; | |
| 52 | + gidsCountData.gids = new ArrayList<>(); | |
| 53 | + gidsCountData.gids_temp = new HashSet<>(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public void accumulate(Serializable context, Object value) { | |
| 58 | + GidsCountData gidsCountData = (GidsCountData) context; | |
| 59 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 60 | + | |
| 61 | + if (ttInfoDetail.getLp() != null) { | |
| 62 | + gidsCountData.gids_temp.add( | |
| 63 | + String.valueOf(ttInfoDetail.getLp().getId())); | |
| 64 | + gidsCountData.gids.clear(); | |
| 65 | + gidsCountData.gids.addAll(gidsCountData.gids_temp); | |
| 66 | + } | |
| 67 | + | |
| 68 | + // TODO:以后还需要按照路牌排序 | |
| 69 | + } | |
| 70 | + | |
| 71 | + @Override | |
| 72 | + public void reverse(Serializable serializable, Object o) throws Exception { | |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public boolean supportsReverse() { | |
| 78 | + return false; | |
| 79 | + } | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public Object getResult(Serializable context) throws Exception { | |
| 83 | + GidsCountData gidsCountData = (GidsCountData) context; | |
| 84 | + return gidsCountData.gids; | |
| 85 | + | |
| 86 | + } | |
| 87 | + | |
| 88 | + @Override | |
| 89 | + public Class<?> getResultType() { | |
| 90 | + return List.class; | |
| 91 | + } | |
| 92 | +} | ... | ... |
src/main/resources/rules/functions.drl
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | -import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; | |
| 4 | 3 | \ No newline at end of file |
| 4 | +import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; | |
| 5 | +import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; | |
| 6 | +import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; | |
| 5 | 7 | \ No newline at end of file | ... | ... |
src/main/resources/rules/plan.drl
| ... | ... | @@ -10,10 +10,15 @@ import com.bsth.service.schedule.TTInfoService; |
| 10 | 10 | import com.bsth.service.schedule.TTInfoDetailService; |
| 11 | 11 | import com.bsth.service.schedule.CarConfigInfoService; |
| 12 | 12 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 13 | +import com.bsth.service.LineService; | |
| 14 | +import com.bsth.service.BusinessService; | |
| 15 | + | |
| 13 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 14 | 17 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 15 | 18 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; |
| 16 | 19 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; |
| 20 | +import com.bsth.entity.Line; | |
| 21 | +import com.bsth.entity.Business; | |
| 17 | 22 | |
| 18 | 23 | import com.bsth.entity.schedule.CarConfigInfo; |
| 19 | 24 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| ... | ... | @@ -21,7 +26,9 @@ import com.bsth.entity.schedule.TTInfo; |
| 21 | 26 | import com.bsth.entity.schedule.TTInfoDetail; |
| 22 | 27 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 23 | 28 | |
| 24 | -import org.slf4j.Logger; | |
| 29 | +import org.slf4j.Logger | |
| 30 | +import org.joda.time.format.DateTimeFormat | |
| 31 | +import org.apache.commons.lang3.StringUtils; | |
| 25 | 32 | |
| 26 | 33 | |
| 27 | 34 | // 全局日志类(一般使用调用此规则的service类) |
| ... | ... | @@ -30,6 +37,8 @@ global TTInfoDetailService tTInfoDetailService; |
| 30 | 37 | global TTInfoService tTInfoService; |
| 31 | 38 | global CarConfigInfoService carConfigInfoService; |
| 32 | 39 | global EmployeeConfigInfoService employeeConfigInfoService; |
| 40 | +global LineService lineService; | |
| 41 | +global BusinessService businessService; | |
| 33 | 42 | |
| 34 | 43 | // 输出 |
| 35 | 44 | global PlanResult planResult; |
| ... | ... | @@ -40,24 +49,46 @@ function Map ttidParams(String ttid) { |
| 40 | 49 | return param; |
| 41 | 50 | } |
| 42 | 51 | |
| 43 | -function Map xlidParams(Integer xlid) { | |
| 52 | +function Map xlidParams(String xlid) { | |
| 44 | 53 | Map param = new HashMap(); |
| 45 | - param.put("xl.id_eq", xlid); | |
| 54 | + param.put("xl.id_eq", Integer.valueOf(xlid)); | |
| 46 | 55 | return param; |
| 47 | 56 | } |
| 48 | 57 | |
| 58 | +function List ecList(EmployeeConfigInfoService service, String ecids) { | |
| 59 | + List<String> ids = Arrays.asList(ecids.split("-")); | |
| 60 | + List rst = new ArrayList(); | |
| 61 | + for (int i = 0; i < ids.size(); i++) { | |
| 62 | + rst.add(service.findById(Long.parseLong(ids.get(i)))); | |
| 63 | + } | |
| 64 | + return rst; | |
| 65 | +} | |
| 66 | + | |
| 67 | +function LocalTime fcsjTime(String fcsj) { | |
| 68 | + if ("NULL".equals(fcsj)) { | |
| 69 | + return null; | |
| 70 | + } | |
| 71 | + return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm")); | |
| 72 | +} | |
| 73 | + | |
| 74 | +function String ttInfoId_sd(Map map, DateTime sd) { | |
| 75 | + TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd); | |
| 76 | + return ttInfoResult_output.getTtInfoId(); | |
| 77 | +} | |
| 78 | + | |
| 49 | 79 | /* |
| 50 | 80 | 规则说明: |
| 51 | - 1、根据循环规则输出,时刻表选择规则输出,计算排班明细 | |
| 81 | + 根据循环规则输出,时刻表选择规则输出,组合计算排班明细 | |
| 52 | 82 | */ |
| 53 | 83 | |
| 54 | 84 | //-------------------- 第一阶段、计算迭代数据 -----------------// |
| 55 | 85 | declare Loop_result |
| 56 | - xlId: Integer // 线路id | |
| 86 | + xlId: String // 线路id | |
| 87 | + | |
| 57 | 88 | ruleLoop: List // 每天分配的规则 List<ScheduleResult_output> |
| 89 | + | |
| 58 | 90 | ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>> |
| 59 | 91 | ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output> |
| 60 | - | |
| 61 | 92 | ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output> |
| 62 | 93 | end |
| 63 | 94 | |
| ... | ... | @@ -107,31 +138,7 @@ end |
| 107 | 138 | |
| 108 | 139 | //-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------// |
| 109 | 140 | |
| 110 | -declare TTInfoDetail_Wrap | |
| 111 | - ttInfoId: String // 时刻表id(cast字符串-方便比较) | |
| 112 | - gid: String // 路牌id(cast字符串-方便比较) | |
| 113 | - | |
| 114 | - self: TTInfoDetail // 原始数据 | |
| 115 | -end | |
| 116 | - | |
| 117 | -rule "calcu_TTInfoDetail_Wrap" | |
| 118 | - salience 800 | |
| 119 | - when | |
| 120 | - $lr: Loop_result($xlId: xlId) | |
| 121 | - $ttInfoId: String() from $lr.getTtInfoMap().keySet() | |
| 122 | - $ttInfoDetail: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttInfoId)) | |
| 123 | - then | |
| 124 | - TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap(); | |
| 125 | - ttInfoDetail_wrap.setTtInfoId($ttInfoId); | |
| 126 | - ttInfoDetail_wrap.setGid(String.valueOf($ttInfoDetail.getLp().getId())); | |
| 127 | - ttInfoDetail_wrap.setSelf($ttInfoDetail); | |
| 128 | - | |
| 129 | -// log.info("时刻表id={}", $ttInfoId); | |
| 130 | -// log.info("时刻表明细id={}", $ttInfoDetail.getId()); | |
| 131 | - | |
| 132 | - insert(ttInfoDetail_wrap); | |
| 133 | -end | |
| 134 | - | |
| 141 | +//--------------- 车辆配置信息载入 -------------// | |
| 135 | 142 | declare CarConfig_Wrap |
| 136 | 143 | id: String // 车辆配置id(cast字符串-方便比较) |
| 137 | 144 | |
| ... | ... | @@ -151,6 +158,7 @@ rule "calcu_CarConfig_Wrap" |
| 151 | 158 | insert(carConfig_wrap); |
| 152 | 159 | end |
| 153 | 160 | |
| 161 | +//--------------- 人员配置信息载入 --------------// | |
| 154 | 162 | declare EmployeeConfig_Wrap |
| 155 | 163 | id: String // 人员配置id(cast字符串-方便比较) |
| 156 | 164 | |
| ... | ... | @@ -170,56 +178,171 @@ rule "calcu_EmployeeConfig_Wrap" |
| 170 | 178 | insert(employeeConfig_wrap); |
| 171 | 179 | end |
| 172 | 180 | |
| 173 | -declare ScheduleResult_output_Wrap | |
| 174 | - xlId: Integer // 线路id | |
| 175 | - sd: DateTime // 日期 | |
| 176 | - ruleId: String // 规则Id | |
| 177 | - eciIds: List // 人员配置ids | |
| 181 | +//----------------- 时刻表班次信息载入 -----------------// | |
| 182 | +declare TTInfo_gid_stat | |
| 183 | + xlId: String // 线路id(cast字符串-方便比较) | |
| 184 | + ttInfoId: String // 时刻表id(cast字符串-方便比较) | |
| 185 | + gid: String // 路牌id(cast字符串-方便比较) | |
| 186 | + | |
| 187 | + maxFcno: Integer // 最大发车顺序号 | |
| 188 | + | |
| 189 | + fbTime: LocalTime // 分班时间 | |
| 190 | +end | |
| 191 | + | |
| 192 | +rule "calcu_TTInfo_gid_stat" | |
| 193 | + salience 800 | |
| 194 | + when | |
| 195 | + $lr: Loop_result($xlId: xlId) | |
| 196 | + $ttInfoId: String() from $lr.getTtInfoMap().keySet() | |
| 197 | + $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttInfoId)), gidscount($ttd)) | |
| 198 | + $gid: String() from $gids | |
| 199 | + $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId)), gidfbtime($ttd)) | |
| 200 | + $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId)), max($ttd.getFcno())) | |
| 201 | + then | |
| 202 | + TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat(); | |
| 203 | + ttInfo_gid_stat.setXlId($xlId); | |
| 204 | + ttInfo_gid_stat.setTtInfoId($ttInfoId); | |
| 205 | + ttInfo_gid_stat.setGid($gid); | |
| 206 | + | |
| 207 | + ttInfo_gid_stat.setMaxFcno($maxfcno.intValue()); | |
| 208 | + ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str)); | |
| 209 | + | |
| 210 | + insert(ttInfo_gid_stat); | |
| 211 | + | |
| 212 | + log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={}", | |
| 213 | + $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime()); | |
| 214 | + | |
| 215 | +end | |
| 216 | + | |
| 217 | +declare TTInfoDetail_Wrap | |
| 218 | + xlId: String // 线路id(cast字符串-方便比较) | |
| 219 | + ttInfoId: String // 时刻表id(cast字符串-方便比较) | |
| 220 | + gid: String // 路牌id(cast字符串-方便比较) | |
| 178 | 221 | |
| 179 | - self: ScheduleResult_output // 原始数据 | |
| 222 | + isFirstBc: Boolean = false // 是否是当前路牌的第一个班次 | |
| 223 | + isLastBc: Boolean = false // 是否是当前路牌的最后一个班次 | |
| 224 | + isFb: Boolean = false // 是否分班 | |
| 225 | + | |
| 226 | + self: TTInfoDetail // 原始数据 | |
| 180 | 227 | end |
| 181 | 228 | |
| 182 | -rule "calcu_ScheduleResult_output_Wrap" | |
| 229 | +rule "calcu_TTInfoDetail_Wrap" | |
| 183 | 230 | salience 800 |
| 184 | 231 | when |
| 185 | 232 | $lr: Loop_result($xlId: xlId) |
| 186 | - $sro: ScheduleResult_output() from $lr.getRuleLoop() | |
| 233 | + $ttInfoId: String() from $lr.getTtInfoMap().keySet() | |
| 234 | + $ttInfoStat: TTInfo_gid_stat( | |
| 235 | + ttInfoId == $ttInfoId, | |
| 236 | + $gid: gid, $maxFcno: maxFcno) | |
| 237 | + $ttInfoDetail: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailService.list(ttidParams($ttInfoId)) | |
| 187 | 238 | then |
| 188 | - ScheduleResult_output_Wrap scheduleResult_output_wrap = new ScheduleResult_output_Wrap(); | |
| 189 | - scheduleResult_output_wrap.setXlId($xlId); | |
| 190 | - scheduleResult_output_wrap.setSd($sro.getSd()); | |
| 191 | - scheduleResult_output_wrap.setRuleId($sro.getRuleId()); | |
| 192 | - scheduleResult_output_wrap.setEciIds(Arrays.asList( | |
| 193 | - $sro.getEmployeeConfigId().split("-"))); | |
| 194 | - scheduleResult_output_wrap.setSelf($sro); | |
| 195 | - | |
| 196 | - insert(scheduleResult_output_wrap); | |
| 239 | + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap(); | |
| 240 | + ttInfoDetail_wrap.setXlId($xlId); | |
| 241 | + ttInfoDetail_wrap.setTtInfoId($ttInfoId); | |
| 242 | + ttInfoDetail_wrap.setGid($gid); | |
| 243 | + ttInfoDetail_wrap.setIsFirstBc(1 == $ttInfoDetail.getFcno()); | |
| 244 | + ttInfoDetail_wrap.setIsLastBc($maxFcno == $ttInfoDetail.getFcno()); | |
| 245 | + | |
| 246 | + LocalTime fcsj = fcsjTime($ttInfoDetail.getFcsj()); | |
| 247 | + LocalTime fbsj = $ttInfoStat.getFbTime(); | |
| 248 | + ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj))); | |
| 249 | + | |
| 250 | + ttInfoDetail_wrap.setSelf($ttInfoDetail); | |
| 251 | + | |
| 252 | + insert(ttInfoDetail_wrap); | |
| 253 | + | |
| 254 | + log.info("xlid={},ttid={},gid={},isFirstBc={},isLastBc={},isFb={},fcsj={}", | |
| 255 | + $xlId, $ttInfoId, $gid, | |
| 256 | + ttInfoDetail_wrap.getIsFirstBc(), | |
| 257 | + ttInfoDetail_wrap.getIsLastBc(), | |
| 258 | + ttInfoDetail_wrap.getIsFb(), | |
| 259 | + $ttInfoDetail.getFcsj()); | |
| 197 | 260 | end |
| 198 | 261 | |
| 199 | 262 | //-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------// |
| 200 | 263 | |
| 201 | -// TODO:暂时不考虑分班 | |
| 202 | - | |
| 203 | -//rule "Calcu_SchedulePlanInfo" | |
| 204 | -// salience 600 | |
| 205 | -// when | |
| 206 | -// $lr: Loop_result($xlId: xlId) | |
| 207 | -// $sro: ScheduleResult_output($sd: sd) from $lr.getRuleLoop() | |
| 208 | -// ScheduleResult_output_Wrap( | |
| 209 | -// xlId == $xlId, sd == $sro.sd, ruleId == $sro.ruleId, | |
| 210 | -// $eciIds: eciIds, $sr: self) | |
| 211 | -// $ecId: String() from $eciIds | |
| 212 | -// CarConfig_Wrap(id == $sro.carConfigId, $cc: self) | |
| 213 | -// EmployeeConfig_Wrap(id == $ecId, $ec: self) | |
| 214 | -// TTInfoDetail_Wrap( | |
| 215 | -// ttInfoId == ((TTInfoResult_output) $lr.getTtInfoMapLoop($sd))., | |
| 216 | -// gid == $sr.guideboardId, | |
| 217 | -// $ttInfoDetail: self | |
| 218 | -// ) | |
| 219 | -// then | |
| 220 | -// log.info("Calcu_SchedulePlanInfo"); | |
| 221 | -// | |
| 222 | -//end | |
| 264 | +rule "Calcu_SchedulePlanInfo" | |
| 265 | + salience 600 | |
| 266 | + when | |
| 267 | + $param: PlanCalcuParam_input($xlId: xlId) | |
| 268 | + $lr: Loop_result(xlId == $xlId) | |
| 269 | + $sro: ScheduleResult_output($sd: sd, $gid: guideboardId) from $lr.getRuleLoop() | |
| 270 | + CarConfig_Wrap(id == $sro.carConfigId, $cc: self) | |
| 271 | + TTInfoDetail_Wrap( | |
| 272 | + ttInfoId == ttInfoId_sd($lr.getTtInfoMapLoop(), $sd), | |
| 273 | + gid == $gid, | |
| 274 | + $isFb: isFb, $isFirstBc: isFirstBc, $isLastBc: isLastBc, | |
| 275 | + $ttInfoDetail: self | |
| 276 | + ) | |
| 277 | + then | |
| 278 | + // 线路 | |
| 279 | + Line xl = lineService.findById(Integer.valueOf($xlId)); | |
| 280 | + | |
| 281 | + SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo( | |
| 282 | + xl, | |
| 283 | + $sro, | |
| 284 | + $ttInfoDetail, | |
| 285 | + $isFb, | |
| 286 | + $cc, | |
| 287 | + ecList(employeeConfigInfoService, $sro.getEmployeeConfigId()), | |
| 288 | + $param.getSchedulePlan(), | |
| 289 | + $isFirstBc, | |
| 290 | + $isLastBc | |
| 291 | + ); | |
| 292 | + | |
| 293 | + // 获取公司,分公司信息 | |
| 294 | + String gsbm = xl.getCompany(); | |
| 295 | + String fgsbm = xl.getBrancheCompany(); | |
| 296 | + Business gs = null; | |
| 297 | + Business fgs = null; | |
| 298 | + | |
| 299 | + Map<String, Object> param = new HashMap<>(); | |
| 300 | + | |
| 301 | + if (StringUtils.isNotEmpty(gsbm)) { | |
| 302 | + param.clear(); | |
| 303 | + param.put("businessCode_eq", gsbm); | |
| 304 | + Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 305 | + if (businessIterator.hasNext()) { | |
| 306 | + gs = businessIterator.next(); | |
| 307 | + } | |
| 308 | + } | |
| 309 | + if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) { | |
| 310 | + param.clear();; | |
| 311 | + param.put("upCode_eq", gsbm); | |
| 312 | + param.put("businessCode_eq", fgsbm); | |
| 313 | + Iterator<Business> businessIterator = businessService.list(param).iterator(); | |
| 314 | + if (businessIterator.hasNext()) { | |
| 315 | + fgs = businessIterator.next(); | |
| 316 | + } | |
| 317 | + } | |
| 318 | + | |
| 319 | + if (gs != null) { | |
| 320 | + schedulePlanInfo.setGsBm(gs.getBusinessCode()); | |
| 321 | + schedulePlanInfo.setGsName(gs.getBusinessName()); | |
| 322 | + } | |
| 323 | + if (fgs != null) { | |
| 324 | + schedulePlanInfo.setFgsBm(fgs.getBusinessCode()); | |
| 325 | + schedulePlanInfo.setFgsName(fgs.getBusinessName()); | |
| 326 | + } | |
| 327 | + | |
| 328 | + // 操作人,操作时间 | |
| 329 | + schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy()); | |
| 330 | + schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate()); | |
| 331 | + schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy()); | |
| 332 | + schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate()); | |
| 333 | + | |
| 334 | + // TODO: | |
| 335 | + $param.getSchedulePlan().setTtInfo($ttInfoDetail.getTtinfo()); | |
| 336 | + | |
| 337 | + // result 输出 | |
| 338 | + planResult.getSchedulePlanInfos().add(schedulePlanInfo); | |
| 339 | + | |
| 340 | + log.info("gid={},ecid={},ttInfoId={}", | |
| 341 | + $gid, ecList(employeeConfigInfoService, $sro.getEmployeeConfigId()), | |
| 342 | + ttInfoId_sd($lr.getTtInfoMapLoop(), $sd)); | |
| 343 | + | |
| 344 | +end | |
| 345 | + | |
| 223 | 346 | |
| 224 | 347 | |
| 225 | 348 | ... | ... |
src/main/resources/static/pages/forms/statement/waybillBf.html
| ... | ... | @@ -22,90 +22,48 @@ |
| 22 | 22 | </div> |
| 23 | 23 | </div> |
| 24 | 24 | |
| 25 | - | |
| 26 | 25 | <div class="row"> |
| 27 | - | |
| 28 | 26 | <div class="col-md-12"> |
| 29 | - | |
| 30 | 27 | <div class="portlet light porttlet-fit bordered"> |
| 31 | - | |
| 32 | 28 | <div class="portlet-title"> |
| 33 | - | |
| 34 | 29 | <form class="form-inline" action=""> |
| 35 | - | |
| 36 | 30 | <div style="display: inline-block;"> |
| 37 | - | |
| 38 | 31 | <span class="item-label" style="width: 80px;">线路: </span> |
| 39 | 32 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| 40 | - | |
| 41 | 33 | </div> |
| 42 | - | |
| 43 | 34 | <div style="display: inline-block;margin-left: 15px;"> |
| 44 | - | |
| 45 | 35 | <span class="item-label" style="width: 80px;">时间: </span> |
| 46 | - | |
| 47 | 36 | <input class="form-control" type="text" id="date" style="width: 180px;"/> |
| 48 | - | |
| 49 | 37 | </div> |
| 50 | - | |
| 51 | 38 | <div class="form-group" style="display: inline-block;margin-left: 15px;"> |
| 52 | - | |
| 53 | 39 | <input class="btn btn-default" type="button" id="query" value="查询"/> |
| 54 | - | |
| 55 | 40 | <input class="btn btn-default" type="button" id="export" value="导出"/> |
| 56 | - | |
| 57 | 41 | <input class="btn btn-default" type="button" id="print" value="打印"/> |
| 58 | - | |
| 59 | 42 | <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> |
| 60 | - | |
| 61 | 43 | </div> |
| 62 | - | |
| 63 | 44 | </form> |
| 64 | - | |
| 65 | 45 | </div> |
| 66 | - | |
| 67 | 46 | <div class="portlet-body"> |
| 68 | - | |
| 69 | 47 | <div class="row"> |
| 70 | - | |
| 71 | 48 | <div class="col-md-3"> |
| 72 | - | |
| 73 | 49 | <div class="" style="margin-top: 10px;overflow:auto;height: 860px"> |
| 74 | - | |
| 75 | 50 | <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info"> |
| 76 | - | |
| 77 | 51 | <thead> |
| 78 | - | |
| 79 | 52 | <tr class="hidden"> |
| 80 | - | |
| 81 | - <th>人员</th> | |
| 82 | - | |
| 83 | - <th>自编号</th> | |
| 84 | - | |
| 85 | - <th>路牌</th> | |
| 86 | - | |
| 53 | + <th class="rypx" style="cursor:pointer ">人员</th> | |
| 54 | + <th class="zbhpx" style="cursor:pointer ">自编号</th> | |
| 55 | + <th class="lppx" style="cursor:pointer ">路牌</th> | |
| 87 | 56 | </tr> |
| 88 | - | |
| 89 | 57 | </thead> |
| 90 | - | |
| 91 | 58 | <tbody> |
| 92 | - | |
| 93 | 59 | |
| 94 | - | |
| 95 | 60 | </tbody> |
| 96 | - | |
| 97 | 61 | </table> |
| 98 | - | |
| 99 | 62 | </div> |
| 100 | - | |
| 101 | 63 | </div> |
| 102 | - | |
| 103 | 64 | <div class="col-md-9" id="printArea"> |
| 104 | - | |
| 105 | 65 | <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> |
| 106 | - | |
| 107 | 66 | <table class="table table-bordered table-checkable" id="forms"> |
| 108 | - | |
| 109 | 67 | <tbody class="ludan_1"> |
| 110 | 68 | |
| 111 | 69 | </tbody> |
| ... | ... | @@ -118,45 +76,46 @@ |
| 118 | 76 | <tbody class="ludan_4"> |
| 119 | 77 | |
| 120 | 78 | </tbody> |
| 121 | - | |
| 122 | 79 | </table> |
| 123 | - | |
| 124 | 80 | </div> |
| 125 | - | |
| 126 | 81 | </div> |
| 127 | - | |
| 128 | 82 | </div> |
| 129 | - | |
| 130 | 83 | </div> |
| 131 | - | |
| 132 | 84 | </div> |
| 133 | - | |
| 134 | 85 | </div> |
| 135 | - | |
| 136 | 86 | </div> |
| 137 | 87 | |
| 138 | - | |
| 139 | - | |
| 140 | 88 | <script> |
| 141 | - | |
| 142 | 89 | $(function(){ |
| 143 | - | |
| 144 | 90 | // 关闭左侧栏 |
| 145 | - | |
| 146 | 91 | if (!$('body').hasClass('page-sidebar-closed')) |
| 147 | - | |
| 148 | 92 | $('.menu-toggler.sidebar-toggler').click(); |
| 149 | 93 | |
| 150 | - | |
| 151 | 94 | $("#date").datetimepicker({ |
| 152 | - | |
| 153 | 95 | format : 'YYYY-MM-DD', |
| 154 | - | |
| 155 | 96 | locale : 'zh-cn' |
| 156 | - | |
| 157 | 97 | }); |
| 98 | + | |
| 99 | + var d = new Date(); | |
| 100 | + var year = d.getFullYear(); | |
| 101 | + var month = d.getMonth() + 1; | |
| 102 | + var day = d.getDate(); | |
| 103 | + if(month < 10) | |
| 104 | + month = "0" + month; | |
| 105 | + if(day < 10) | |
| 106 | + day = "0" + day; | |
| 107 | + $("#date").val(year + "-" + month + "-" + day); | |
| 108 | + $.get('/basic/lineCode2Name',function(result){ | |
| 109 | + var data=[]; | |
| 110 | + | |
| 111 | + for(var code in result){ | |
| 112 | + data.push({id: code, text: result[code]}); | |
| 113 | + } | |
| 114 | + initPinYinSelect2('#line',data,''); | |
| 115 | + | |
| 116 | + }) | |
| 158 | 117 | |
| 159 | - $('#line').select2({ | |
| 118 | + /* $('#line').select2({ | |
| 160 | 119 | ajax: { |
| 161 | 120 | url: '/realSchedule/findLine', |
| 162 | 121 | type: 'post', |
| ... | ... | @@ -194,80 +153,163 @@ |
| 194 | 153 | } |
| 195 | 154 | } |
| 196 | 155 | }); |
| 156 | + */ | |
| 197 | 157 | |
| 198 | 158 | var date = ''; |
| 199 | - | |
| 159 | + var line =''; | |
| 200 | 160 | $("#query").on("click",function(){ |
| 201 | - | |
| 202 | - var line = $("#line").val(); | |
| 203 | - | |
| 161 | + line = $("#line").val(); | |
| 204 | 162 | date = $("#date").val(); |
| 205 | 163 | $(".hidden").removeClass("hidden"); |
| 206 | - | |
| 207 | - $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){ | |
| 208 | - | |
| 164 | + $get('/realSchedule/queryUserInfo',{line:line,date:date,state:2},function(result){ | |
| 209 | 165 | // 把数据填充到模版中 |
| 210 | - | |
| 211 | 166 | var tbodyHtml = template('list_info',{list:result}); |
| 212 | - | |
| 213 | 167 | // 把渲染好的模版html文本追加到表格中 |
| 214 | - | |
| 215 | 168 | $('#info tbody').html(tbodyHtml); |
| 216 | - | |
| 217 | 169 | }); |
| 218 | - | |
| 219 | 170 | }); |
| 171 | + var type="desc"; | |
| 172 | + $(".rypx").on("click",function(){ | |
| 173 | + line = $("#line").val(); | |
| 174 | + date = $("#date").val(); | |
| 175 | + $(".hidden").removeClass("hidden"); | |
| 176 | + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"j_Gh",type:type},function(result){ | |
| 177 | + if(type=="desc"){ | |
| 178 | + type ="asc"; | |
| 179 | + }else{ | |
| 180 | + type ="desc"; | |
| 181 | + } | |
| 182 | + // 把数据填充到模版中 | |
| 183 | + var tbodyHtml = template('list_info_px',{list:result}); | |
| 184 | + // 把渲染好的模版html文本追加到表格中 | |
| 185 | + $('#info tbody').html(tbodyHtml); | |
| 186 | + }); | |
| 187 | + }) | |
| 188 | + | |
| 189 | + $(".zbhpx").on("click",function(){ | |
| 190 | + line = $("#line").val(); | |
| 191 | + date = $("#date").val(); | |
| 192 | + $(".hidden").removeClass("hidden"); | |
| 193 | + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"clZbh",type:type},function(result){ | |
| 194 | + if(type=="desc"){ | |
| 195 | + type ="asc"; | |
| 196 | + }else{ | |
| 197 | + type ="desc"; | |
| 198 | + } | |
| 199 | + // 把数据填充到模版中 | |
| 200 | + var tbodyHtml = template('list_info_px',{list:result}); | |
| 201 | + // 把渲染好的模版html文本追加到表格中 | |
| 202 | + $('#info tbody').html(tbodyHtml); | |
| 203 | + }); | |
| 204 | + }) | |
| 205 | + | |
| 206 | + $(".lppx").on("click",function(){ | |
| 207 | + line = $("#line").val(); | |
| 208 | + date = $("#date").val(); | |
| 209 | + $(".hidden").removeClass("hidden"); | |
| 210 | + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"lpName",type:type},function(result){ | |
| 211 | + if(type=="desc"){ | |
| 212 | + type ="asc"; | |
| 213 | + }else{ | |
| 214 | + type ="desc"; | |
| 215 | + } | |
| 216 | + // 把数据填充到模版中 | |
| 217 | + var tbodyHtml = template('list_info_px',{list:result}); | |
| 218 | + // 把渲染好的模版html文本追加到表格中 | |
| 219 | + $('#info tbody').html(tbodyHtml); | |
| 220 | + }); | |
| 221 | + }) | |
| 220 | 222 | |
| 221 | 223 | var params = new Array(); |
| 222 | 224 | var jName = ''; |
| 223 | - | |
| 224 | 225 | $("#info tbody").on("click","tr",function(){ |
| 225 | 226 | if($(this).children().size() < 2){ |
| 226 | 227 | return; |
| 227 | 228 | } |
| 228 | - | |
| 229 | 229 | |
| 230 | - | |
| 231 | 230 | $(this).children().each(function(index){ |
| 232 | - | |
| 233 | 231 | params[index] = $(this).text(); |
| 234 | - | |
| 235 | 232 | }); |
| 236 | 233 | jName = params[0].split("\\")[0]; |
| 237 | 234 | var id = $("#"+params[1]).val(); |
| 238 | - $get('/realSchedule/'+id,null,function(result){ | |
| 235 | + $get('/realSchedule/MapById',{id:id},function(result){ | |
| 239 | 236 | result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); |
| 240 | 237 | var ludan_1 = template('ludan_1',result); |
| 241 | - //var ludan_4 = template('ludan_4',result); | |
| 242 | 238 | // 把渲染好的模版html文本追加到表格中 |
| 243 | 239 | $('#forms .ludan_1').html(ludan_1); |
| 244 | - //$('#forms .ludan_4').html(ludan_4); | |
| 245 | 240 | }); |
| 246 | - | |
| 247 | - $post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ | |
| 241 | + $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ | |
| 248 | 242 | getTime(result); |
| 249 | - | |
| 250 | 243 | var ludan_2 = template('ludan_2',{list:result}); |
| 251 | - | |
| 252 | 244 | // 把渲染好的模版html文本追加到表格中 |
| 253 | - | |
| 254 | 245 | $('#forms .ludan_2').html(ludan_2); |
| 255 | - | |
| 256 | 246 | }); |
| 257 | - $post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ | |
| 247 | + $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ | |
| 248 | + | |
| 249 | + var gl=accAdd(result.ksgl,result.jcclc); | |
| 250 | + result.ljgl=gl; | |
| 251 | + | |
| 252 | + var ljjcc1=accAdd(result.ksgl,result.jcclc); | |
| 253 | + //临加进出场公里 | |
| 254 | + var ljjcc=numSubtr(result.zkslc,ljjcc1); | |
| 255 | + result.zlcgl=numSubtr(result.realMileage,ljjcc); | |
| 256 | + | |
| 258 | 257 | var ludan_3 = template('ludan_3',result); |
| 259 | 258 | $('#forms .ludan_3').html(ludan_3); |
| 260 | 259 | }); |
| 261 | 260 | |
| 262 | - | |
| 263 | 261 | }); |
| 264 | 262 | |
| 263 | + var accAdd = function (a, b) { | |
| 264 | + var c, d, e; | |
| 265 | + try { | |
| 266 | + c = a.toString().split(".")[1].length; | |
| 267 | + } catch (f) { | |
| 268 | + c = 0; | |
| 269 | + } | |
| 270 | + try { | |
| 271 | + d = b.toString().split(".")[1].length; | |
| 272 | + } catch (f) { | |
| 273 | + d = 0; | |
| 274 | + } | |
| 275 | + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; | |
| 276 | + }; | |
| 277 | + | |
| 278 | + var numSubtr = function (a, b) { | |
| 279 | + var c, d, e; | |
| 280 | + try { | |
| 281 | + c = a.toString().split(".")[1].length; | |
| 282 | + } catch (f) { | |
| 283 | + c = 0; | |
| 284 | + } | |
| 285 | + try { | |
| 286 | + d = b.toString().split(".")[1].length; | |
| 287 | + } catch (f) { | |
| 288 | + d = 0; | |
| 289 | + } | |
| 290 | + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; | |
| 291 | + }; | |
| 292 | + | |
| 293 | + function mul(a, b) { | |
| 294 | + var c = 0, | |
| 295 | + d = a.toString(), | |
| 296 | + e = b.toString(); | |
| 297 | + try { | |
| 298 | + c += d.split(".")[1].length; | |
| 299 | + } catch (f) { | |
| 300 | + } | |
| 301 | + try { | |
| 302 | + c += e.split(".")[1].length; | |
| 303 | + } catch (f) { | |
| 304 | + } | |
| 305 | + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); | |
| 306 | + } | |
| 265 | 307 | $("#export").on("click",function(){ |
| 266 | 308 | if(params.length < 1){ |
| 267 | 309 | return; |
| 268 | 310 | } |
| 269 | - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ | |
| 270 | - window.open("/downloadFile/download?fileName="+jName); | |
| 311 | + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ | |
| 312 | + window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"); | |
| 271 | 313 | }); |
| 272 | 314 | }); |
| 273 | 315 | |
| ... | ... | @@ -276,9 +318,17 @@ |
| 276 | 318 | }); |
| 277 | 319 | |
| 278 | 320 | $("#exportMore").on("click",function(){ |
| 279 | - return; | |
| 280 | - $post('/realSchedule/exportWaybillMore',{date:date},function(result){ | |
| 281 | - window.open("/downloadFile/download?fileName="+jName); | |
| 321 | + if($("#info tbody tr td").length <= 1) | |
| 322 | + return; | |
| 323 | + var param = new Array(); | |
| 324 | + $("#info tbody tr").each(function(index){ | |
| 325 | + param[index] = new Array(); | |
| 326 | + $(this).children().each(function(i){ | |
| 327 | + param[index][i] = $(this).text().split("\\")[0]; | |
| 328 | + }); | |
| 329 | + }); | |
| 330 | + $post('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | |
| 331 | + window.open("/downloadFile/downloadList?fileName="+result.fileName); | |
| 282 | 332 | }); |
| 283 | 333 | }); |
| 284 | 334 | |
| ... | ... | @@ -296,37 +346,35 @@ |
| 296 | 346 | } |
| 297 | 347 | }); |
| 298 | 348 | } |
| 299 | - | |
| 300 | 349 | }); |
| 301 | - | |
| 302 | 350 | </script> |
| 303 | - | |
| 304 | 351 | <script type="text/html" id="list_info"> |
| 305 | - | |
| 306 | 352 | {{each list as obj i}} |
| 307 | - | |
| 308 | 353 | <tr> |
| 309 | - | |
| 310 | 354 | <td width="45%">{{obj[4]}}\{{obj[1]}}</td> |
| 311 | - | |
| 312 | 355 | <td width="32%">{{obj[2]}}</td> |
| 313 | - | |
| 314 | 356 | <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td> |
| 315 | - | |
| 316 | 357 | </tr> |
| 317 | - | |
| 318 | 358 | {{/each}} |
| 319 | - | |
| 320 | 359 | {{if list.length == 0}} |
| 321 | - | |
| 322 | 360 | <tr> |
| 323 | - | |
| 324 | 361 | <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td> |
| 325 | - | |
| 326 | 362 | </tr> |
| 327 | - | |
| 328 | 363 | {{/if}} |
| 329 | - | |
| 364 | +</script> | |
| 365 | +<script type="text/html" id="list_info_px"> | |
| 366 | + {{each list as obj i}} | |
| 367 | + <tr> | |
| 368 | + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td> | |
| 369 | + <td width="32%">{{obj.clZbh}}</td> | |
| 370 | + <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td> | |
| 371 | + </tr> | |
| 372 | + {{/each}} | |
| 373 | + {{if list.length == 0}} | |
| 374 | + <tr> | |
| 375 | + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td> | |
| 376 | + </tr> | |
| 377 | + {{/if}} | |
| 330 | 378 | </script> |
| 331 | 379 | <script type="text/html" id="ludan_1"> |
| 332 | 380 | <tr> |
| ... | ... | @@ -336,11 +384,11 @@ |
| 336 | 384 | <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派: 日期:{{scheduleDate}}</td> |
| 337 | 385 | </tr> |
| 338 | 386 | <tr> |
| 339 | - <td colspan="2">出场存油 升</td> | |
| 340 | - <td colspan="2">加注油量 升</td> | |
| 341 | - <td colspan="2">进场存油 升</td> | |
| 387 | + <td colspan="2">出场存油 {{ccyl}};升</td> | |
| 388 | + <td colspan="2">加注油量 {{jzl}}升</td> | |
| 389 | + <td colspan="2">进场存油 {{jcyl}}升</td> | |
| 342 | 390 | <td colspan="4">加注机油 升</td> |
| 343 | - <td colspan="4">本日耗油 升</td> | |
| 391 | + <td colspan="4">本日耗油 {{yh}}升</td> | |
| 344 | 392 | </tr> |
| 345 | 393 | <tr> |
| 346 | 394 | <td rowspan="2">调度章</td> |
| ... | ... | @@ -388,175 +436,65 @@ |
| 388 | 436 | <td colspan="1">慢</td> |
| 389 | 437 | </tr> |
| 390 | 438 | </script> |
| 391 | - | |
| 392 | 439 | <script type="text/html" id="ludan_2"> |
| 393 | - | |
| 394 | 440 | {{each list as obj i}} |
| 395 | - | |
| 396 | 441 | <tr> |
| 397 | - | |
| 398 | - <td>{{i+1}}</td> | |
| 399 | - | |
| 400 | - <td>{{obj.jName}}</td> | |
| 401 | - | |
| 402 | - <td>{{obj.sName}}</td> | |
| 403 | - | |
| 442 | + <td>{{obj.adjustExps}}</td> | |
| 443 | + <td>{{obj.jGh}}{{obj.jName}}</td> | |
| 444 | + <td>{{if obj.sGh !=null}} | |
| 445 | + {{obj.sGh}}{{obj.sName}} | |
| 446 | + {{/if}} | |
| 447 | + </td> | |
| 404 | 448 | <td> </td> |
| 405 | - | |
| 406 | 449 | <td>{{obj.qdzName}}</td> |
| 407 | - | |
| 408 | 450 | <td>{{obj.zdzName}}</td> |
| 409 | - | |
| 410 | 451 | <td>{{obj.fcsj}}</td> |
| 411 | - | |
| 412 | 452 | <td>{{obj.fcsjActual}}</td> |
| 413 | - | |
| 414 | 453 | <td>{{obj.zdsj}}</td> |
| 415 | - | |
| 416 | 454 | <td>{{obj.zdsjActual}}</td> |
| 417 | - | |
| 418 | 455 | <td>{{obj.fast}}</td> |
| 419 | - | |
| 420 | 456 | <td>{{obj.slow}}</td> |
| 421 | - | |
| 422 | 457 | <td>{{obj.jhlc}}</td> |
| 423 | - <td>{{obj.remarks}}</td> | |
| 424 | - | |
| 458 | + <td > | |
| 459 | + {{obj.remarks}} | |
| 460 | + </td> | |
| 425 | 461 | </tr> |
| 426 | - | |
| 427 | 462 | {{/each}} |
| 428 | 463 | {{if list.length == 0}} |
| 429 | 464 | <tr> |
| 430 | 465 | <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td> |
| 431 | 466 | </tr> |
| 432 | 467 | {{/if}} |
| 433 | - | |
| 434 | 468 | </script> |
| 435 | 469 | <script type="text/html" id="ludan_3"> |
| 436 | 470 | <tr> |
| 437 | - <td colspan="2">计划公里</td> | |
| 438 | - <td>{{jhlc}}</td> | |
| 439 | - <td colspan="2">烂班公里</td> | |
| 440 | - <td>{{remMileage}}</td> | |
| 441 | - <td colspan="2">临加公里</td> | |
| 442 | - <td>{{addMileage}}</td> | |
| 443 | - <td colspan="2">营运公里</td> | |
| 444 | - <td colspan="3">{{yygl}}</td> | |
| 445 | - </tr> | |
| 446 | - <tr> | |
| 447 | - <td colspan="2">空驶公里</td> | |
| 448 | - <td>{{ksgl}}</td> | |
| 449 | - <td colspan="2">总公里</td> | |
| 450 | - <td>{{realMileage}}</td> | |
| 451 | 471 | <td colspan="2">计划班次</td> |
| 452 | 472 | <td>{{jhbc}}</td> |
| 473 | + <td colspan="2">计划公里</td> | |
| 474 | + <td>{{jhlc}}</td> | |
| 453 | 475 | <td colspan="2">烂班班次</td> |
| 454 | - <td colspan="3">{{cjbc}}</td> | |
| 476 | + <td>{{cjbc}}</td> | |
| 477 | + <td colspan="3"> 烂班公里</td> | |
| 478 | + <td colspan="2">{{remMileage}}</td> | |
| 455 | 479 | </tr> |
| 456 | 480 | <tr> |
| 457 | - <td colspan="2">增加班次</td> | |
| 481 | + <td colspan="2">临加班次</td> | |
| 458 | 482 | <td>{{ljbc}}</td> |
| 483 | + <td colspan="2">临加公里</td> | |
| 484 | + <td>{{addMileage}}</td> | |
| 459 | 485 | <td colspan="2">实际班次</td> |
| 460 | 486 | <td>{{sjbc}}</td> |
| 487 | + <td colspan="3">营运公里</td> | |
| 488 | + <td colspan="2">{{yygl}}</td> | |
| 489 | + </tr> | |
| 490 | + <tr> | |
| 491 | + <td colspan="2">空驶公里</td> | |
| 492 | + <td>{{ljgl}}</td> | |
| 493 | + <td colspan="2">总公里</td> | |
| 494 | + <td>{{zlcgl}}</td> | |
| 461 | 495 | <td colspan="2"></td> |
| 462 | 496 | <td></td> |
| 463 | - <td colspan="2"></td> | |
| 464 | 497 | <td colspan="3"></td> |
| 498 | + <td colspan="2"></td> | |
| 465 | 499 | </tr> |
| 466 | 500 | </script> |
| 467 | -<script type="text/html" id="ludan_4"> | |
| 468 | - <tr> | |
| 469 | - <td colspan="12">认真做好终点项目的例保保修工作,杜绝机械火警事故!</td> | |
| 470 | - <td>轮胎</td> | |
| 471 | - <td> </td> | |
| 472 | - </tr> | |
| 473 | - <tr> | |
| 474 | - <td colspan="3">重点例保项目</td> | |
| 475 | - <td>1</td> | |
| 476 | - <td>2</td> | |
| 477 | - <td>3</td> | |
| 478 | - <td colspan="3">重点例保项目</td> | |
| 479 | - <td>1</td> | |
| 480 | - <td>2</td> | |
| 481 | - <td>3</td> | |
| 482 | - <td>灭火机</td> | |
| 483 | - <td> </td> | |
| 484 | - </tr> | |
| 485 | - <tr> | |
| 486 | - <td colspan="3">各类制动</td> | |
| 487 | - <td> </td> | |
| 488 | - <td> </td> | |
| 489 | - <td> </td> | |
| 490 | - <td colspan="3">各类灯光</td> | |
| 491 | - <td> </td> | |
| 492 | - <td> </td> | |
| 493 | - <td> </td> | |
| 494 | - <td colspan="2">出场路码表里程</td> | |
| 495 | - </tr> | |
| 496 | - <tr> | |
| 497 | - <td colspan="3">方向机</td> | |
| 498 | - <td> </td> | |
| 499 | - <td> </td> | |
| 500 | - <td> </td> | |
| 501 | - <td colspan="3">各类仪表</td> | |
| 502 | - <td> </td> | |
| 503 | - <td> </td> | |
| 504 | - <td> </td> | |
| 505 | - <td colspan="2" rowspan="2"> </td> | |
| 506 | - </tr> | |
| 507 | - <tr> | |
| 508 | - <td colspan="3">欠压报警器</td> | |
| 509 | - <td> </td> | |
| 510 | - <td> </td> | |
| 511 | - <td> </td> | |
| 512 | - <td colspan="3">各类皮带</td> | |
| 513 | - <td> </td> | |
| 514 | - <td> </td> | |
| 515 | - <td> </td> | |
| 516 | - </tr> | |
| 517 | - <tr> | |
| 518 | - <td colspan="3">发动机清洁及响声</td> | |
| 519 | - <td> </td> | |
| 520 | - <td> </td> | |
| 521 | - <td> </td> | |
| 522 | - <td colspan="3">油箱及托架</td> | |
| 523 | - <td> </td> | |
| 524 | - <td> </td> | |
| 525 | - <td> </td> | |
| 526 | - <td colspan="2">出场路码表里程</td> | |
| 527 | - </tr> | |
| 528 | - <tr> | |
| 529 | - <td colspan="3">地盘响声</td> | |
| 530 | - <td> </td> | |
| 531 | - <td> </td> | |
| 532 | - <td> </td> | |
| 533 | - <td colspan="3">轮胎、半轴螺栓螺母</td> | |
| 534 | - <td> </td> | |
| 535 | - <td> </td> | |
| 536 | - <td> </td> | |
| 537 | - <td colspan="2" rowspan="3"> </td> | |
| 538 | - </tr> | |
| 539 | - <tr> | |
| 540 | - <td colspan="3">化油器及油路</td> | |
| 541 | - <td> </td> | |
| 542 | - <td> </td> | |
| 543 | - <td> </td> | |
| 544 | - <td colspan="3">油、电、水、气</td> | |
| 545 | - <td> </td> | |
| 546 | - <td> </td> | |
| 547 | - <td> </td> | |
| 548 | - </tr> | |
| 549 | - <tr> | |
| 550 | - <td colspan="3">进排歧管及排气管</td> | |
| 551 | - <td> </td> | |
| 552 | - <td> </td> | |
| 553 | - <td> </td> | |
| 554 | - <td colspan="3">内外车身及附件</td> | |
| 555 | - <td> </td> | |
| 556 | - <td> </td> | |
| 557 | - <td> </td> | |
| 558 | - </tr> | |
| 559 | - <tr> | |
| 560 | - <td colspan="14">1 首次出场,2 复使中途,3 某次进场。√正常,ⓧ报修,×尚未报修</td> | |
| 561 | - </tr> | |
| 562 | -</script> | |
| 563 | 501 | \ No newline at end of file | ... | ... |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/add_temp_sch.html
| ... | ... | @@ -182,6 +182,14 @@ |
| 182 | 182 | delete data.spy; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | + //公司信息 | |
| 186 | + var line = gb_data_basic.findLineByCodes([data.xlBm]); | |
| 187 | + if(line && line.length > 0){ | |
| 188 | + line = line[0]; | |
| 189 | + data.gsBm = line.company; | |
| 190 | + data.fgsBm = line.brancheCompany; | |
| 191 | + } | |
| 192 | + | |
| 185 | 193 | gb_common.$post('/realSchedule', data, function (rs) { |
| 186 | 194 | //插入 |
| 187 | 195 | gb_schedule_table.insertSchedule(rs.t, rs.ts); | ... | ... |