Commit 8da79c586b9696f3a924717730cffb5bc1e40f4c
1 parent
7c9978b2
Update
Showing
4 changed files
with
257 additions
and
117 deletions
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -4,7 +4,6 @@ import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.service.schedule.rules.rerun.RerunRule_input; |
| 5 | 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | 6 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; |
| 7 | -import org.apache.commons.lang3.StringUtils; | |
| 8 | 7 | |
| 9 | 8 | import javax.persistence.*; |
| 10 | 9 | import java.sql.PreparedStatement; |
| ... | ... | @@ -181,28 +180,28 @@ public class SchedulePlanInfo extends BEntity { |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | 182 | this.j = employeeConfigInfo.getJsy().getId(); |
| 184 | -// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | |
| 185 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 186 | - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 187 | - if (jsy_temp.length > 1) { | |
| 188 | - this.jGh = jsy_temp[1]; | |
| 189 | - } else { | |
| 190 | - this.jGh = jsy_temp[0]; | |
| 191 | - } | |
| 192 | - } | |
| 183 | + this.jGh = employeeConfigInfo.getJsy().getJobCodeori(); | |
| 184 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 185 | +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 186 | +// if (jsy_temp.length > 1) { | |
| 187 | +// this.jGh = jsy_temp[1]; | |
| 188 | +// } else { | |
| 189 | +// this.jGh = jsy_temp[0]; | |
| 190 | +// } | |
| 191 | +// } | |
| 193 | 192 | this.jName = employeeConfigInfo.getJsy().getPersonnelName(); |
| 194 | 193 | // 关联的售票员 |
| 195 | 194 | if (employeeConfigInfo.getSpy() != null) { |
| 196 | 195 | this.s = employeeConfigInfo.getSpy().getId(); |
| 197 | -// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | |
| 198 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 199 | - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 200 | - if (spy_temp.length > 1) { | |
| 201 | - this.sGh = spy_temp[1]; | |
| 202 | - } else { | |
| 203 | - this.sGh = spy_temp[0]; | |
| 204 | - } | |
| 205 | - } | |
| 196 | + this.sGh = employeeConfigInfo.getSpy().getJobCodeori(); | |
| 197 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 198 | +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 199 | +// if (spy_temp.length > 1) { | |
| 200 | +// this.sGh = spy_temp[1]; | |
| 201 | +// } else { | |
| 202 | +// this.sGh = spy_temp[0]; | |
| 203 | +// } | |
| 204 | +// } | |
| 206 | 205 | |
| 207 | 206 | this.sName = employeeConfigInfo.getSpy().getPersonnelName(); |
| 208 | 207 | } |
| ... | ... | @@ -230,28 +229,28 @@ public class SchedulePlanInfo extends BEntity { |
| 230 | 229 | } |
| 231 | 230 | |
| 232 | 231 | this.j = employeeConfigInfo.getJsy().getId(); |
| 233 | -// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | |
| 234 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 235 | - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 236 | - if (jsy_temp.length > 1) { | |
| 237 | - this.jGh = jsy_temp[1]; | |
| 238 | - } else { | |
| 239 | - this.jGh = jsy_temp[0]; | |
| 240 | - } | |
| 241 | - } | |
| 232 | + this.jGh = employeeConfigInfo.getJsy().getJobCodeori(); | |
| 233 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 234 | +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 235 | +// if (jsy_temp.length > 1) { | |
| 236 | +// this.jGh = jsy_temp[1]; | |
| 237 | +// } else { | |
| 238 | +// this.jGh = jsy_temp[0]; | |
| 239 | +// } | |
| 240 | +// } | |
| 242 | 241 | this.jName = employeeConfigInfo.getJsy().getPersonnelName(); |
| 243 | 242 | // 关联的售票员 |
| 244 | 243 | if (employeeConfigInfo.getSpy() != null) { |
| 245 | 244 | this.s = employeeConfigInfo.getSpy().getId(); |
| 246 | -// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | |
| 247 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 248 | - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 249 | - if (spy_temp.length > 1) { | |
| 250 | - this.sGh = spy_temp[1]; | |
| 251 | - } else { | |
| 252 | - this.sGh = spy_temp[0]; | |
| 253 | - } | |
| 254 | - } | |
| 245 | + this.sGh = employeeConfigInfo.getSpy().getJobCodeori(); | |
| 246 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 247 | +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 248 | +// if (spy_temp.length > 1) { | |
| 249 | +// this.sGh = spy_temp[1]; | |
| 250 | +// } else { | |
| 251 | +// this.sGh = spy_temp[0]; | |
| 252 | +// } | |
| 253 | +// } | |
| 255 | 254 | |
| 256 | 255 | this.sName = employeeConfigInfo.getSpy().getPersonnelName(); |
| 257 | 256 | } |
| ... | ... | @@ -316,28 +315,28 @@ public class SchedulePlanInfo extends BEntity { |
| 316 | 315 | } |
| 317 | 316 | |
| 318 | 317 | this.j = employeeConfigInfo.getJsy().getId(); |
| 319 | -// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | |
| 320 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 321 | - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 322 | - if (jsy_temp.length > 1) { | |
| 323 | - this.jGh = jsy_temp[1]; | |
| 324 | - } else { | |
| 325 | - this.jGh = jsy_temp[0]; | |
| 326 | - } | |
| 327 | - } | |
| 318 | + this.jGh = employeeConfigInfo.getJsy().getJobCodeori(); | |
| 319 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 320 | +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 321 | +// if (jsy_temp.length > 1) { | |
| 322 | +// this.jGh = jsy_temp[1]; | |
| 323 | +// } else { | |
| 324 | +// this.jGh = jsy_temp[0]; | |
| 325 | +// } | |
| 326 | +// } | |
| 328 | 327 | this.jName = employeeConfigInfo.getJsy().getPersonnelName(); |
| 329 | 328 | // 关联的售票员 |
| 330 | 329 | if (employeeConfigInfo.getSpy() != null) { |
| 331 | 330 | this.s = employeeConfigInfo.getSpy().getId(); |
| 332 | -// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | |
| 333 | - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 334 | - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 335 | - if (spy_temp.length > 1) { | |
| 336 | - this.sGh = spy_temp[1]; | |
| 337 | - } else { | |
| 338 | - this.sGh = spy_temp[0]; | |
| 339 | - } | |
| 340 | - } | |
| 331 | + this.sGh = employeeConfigInfo.getSpy().getJobCodeori(); | |
| 332 | +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 333 | +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 334 | +// if (spy_temp.length > 1) { | |
| 335 | +// this.sGh = spy_temp[1]; | |
| 336 | +// } else { | |
| 337 | +// this.sGh = spy_temp[0]; | |
| 338 | +// } | |
| 339 | +// } | |
| 341 | 340 | |
| 342 | 341 | this.sName = employeeConfigInfo.getSpy().getPersonnelName(); |
| 343 | 342 | } | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
| ... | ... | @@ -99,7 +99,7 @@ InternalLpObj.prototype.getBcCount = function() { |
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * 获取最小(最早)班次对象。 |
| 102 | - * @return [{圈index},{班次index}] | |
| 102 | + * @returns [{圈index},{班次index}] | |
| 103 | 103 | */ |
| 104 | 104 | InternalLpObj.prototype.getMinBcObjPosition = function() { |
| 105 | 105 | var i; |
| ... | ... | @@ -119,6 +119,28 @@ InternalLpObj.prototype.getMinBcObjPosition = function() { |
| 119 | 119 | return bIndex; |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | +/** | |
| 123 | + * 获取最大(最晚)班次对象。 | |
| 124 | + * @returns [{圈index},{班次index}] | |
| 125 | + */ | |
| 126 | +InternalLpObj.prototype.getMaxBcObjPosition = function() { | |
| 127 | + var i; | |
| 128 | + var bIndex = []; | |
| 129 | + for (i = this._$_groupBcArray.length - 1; i >= 0; i--) { | |
| 130 | + if (this._$_groupBcArray[i].getBc2()) { | |
| 131 | + bIndex.push(i); | |
| 132 | + bIndex.push(1); | |
| 133 | + break; | |
| 134 | + } | |
| 135 | + if (this._$_groupBcArray[i].getBc1()) { | |
| 136 | + bIndex.push(i); | |
| 137 | + bIndex.push(0); | |
| 138 | + break; | |
| 139 | + } | |
| 140 | + } | |
| 141 | + return bIndex; | |
| 142 | +}; | |
| 143 | + | |
| 122 | 144 | // TODO |
| 123 | 145 | |
| 124 | 146 | /** |
| ... | ... | @@ -250,6 +272,14 @@ InternalLpObj.prototype.initDataFromLbBcArray = function( |
| 250 | 272 | }; |
| 251 | 273 | |
| 252 | 274 | /** |
| 275 | + * 获取圈 | |
| 276 | + * @param qIndex 圈index | |
| 277 | + */ | |
| 278 | +InternalLpObj.prototype.getGroup = function(qIndex) { | |
| 279 | + return this._$_groupBcArray[qIndex]; | |
| 280 | +}; | |
| 281 | + | |
| 282 | +/** | |
| 253 | 283 | * 获取班次。 |
| 254 | 284 | * @param qIndex 第几圈 |
| 255 | 285 | * @param bcIndex 第几个班次 | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| ... | ... | @@ -309,6 +309,124 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 309 | 309 | console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); |
| 310 | 310 | }; |
| 311 | 311 | |
| 312 | + //-------------------- 重要的内部方法 -----------------------// | |
| 313 | + /** | |
| 314 | + * 在指定位置生成班次(内部重要方法)。 | |
| 315 | + * @param lpIndex 第几个路牌 | |
| 316 | + * @param qIndex 第几圈 | |
| 317 | + * @param bcIndex 第几个班次 | |
| 318 | + * @returns InternalBcObj | |
| 319 | + */ | |
| 320 | + var _generateBc = function(lpIndex, qIndex, bcIndex) { | |
| 321 | + // 在初始化布局后使用,否则没有参照班次加不了 | |
| 322 | + // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数 | |
| 323 | + // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次 | |
| 324 | + | |
| 325 | + // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加 | |
| 326 | + // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加 | |
| 327 | + | |
| 328 | + // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础 | |
| 329 | + // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔 | |
| 330 | + // 3、如果班次发车时间越界不管,有其余方法排除这种情况 | |
| 331 | + | |
| 332 | + // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的) | |
| 333 | + var _i; | |
| 334 | + var _bcObj; | |
| 335 | + for (_i = lpIndex - 1; _i >= 0; _i--) { | |
| 336 | + _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex); | |
| 337 | + if (_bcObj) { | |
| 338 | + break; | |
| 339 | + } | |
| 340 | + } | |
| 341 | + if (!_bcObj) { | |
| 342 | + return false; | |
| 343 | + //alert("无法在指定位置生成班次"); | |
| 344 | + //throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次"; | |
| 345 | + } | |
| 346 | + | |
| 347 | + // 2、计算发车间隔 | |
| 348 | + var _intervalTime = 0; | |
| 349 | + for (_i = _i + 1; _i <= lpIndex; _i++) { | |
| 350 | + _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime(); | |
| 351 | + } | |
| 352 | + | |
| 353 | + // 3、计算班次并添加班次 | |
| 354 | + var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime); | |
| 355 | + _bcObj = _factory.createBcObj( | |
| 356 | + "normal", _bcObj.isUp(), | |
| 357 | + _lpArray[lpIndex].lpNo, | |
| 358 | + 1, _kssj, _paramObj); | |
| 359 | + | |
| 360 | + return _bcObj; | |
| 361 | + | |
| 362 | + // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题 | |
| 363 | + // TODO:主要是由于中标线的问题,但是误差不会很大, | |
| 364 | + // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间) | |
| 365 | + }; | |
| 366 | + | |
| 367 | + /** | |
| 368 | + * 在指定位置生成班次并添加到路牌指定位置中。 | |
| 369 | + * @param lpIndex 第几个路牌 | |
| 370 | + * @param qIndex 第几圈 | |
| 371 | + * @param bcIndex 第几个班次 | |
| 372 | + */ | |
| 373 | + var _generateBcAndSetBc = function(lpIndex, qIndex, bcIndex) { | |
| 374 | + var _bcObj = _generateBc(lpIndex, qIndex, bcIndex); | |
| 375 | + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj); | |
| 376 | + | |
| 377 | + }; | |
| 378 | + | |
| 379 | + /** | |
| 380 | + * 查找指定时间落在哪两个班次之间(很重要的内部方法)。 | |
| 381 | + * @param timeObj 查找时间 | |
| 382 | + * @param isUp 是否上行 | |
| 383 | + * @returns [上界班次index,下界班次index],班次index=[圈index, 班次index] | |
| 384 | + */ | |
| 385 | + var _findBcIndexWithTime = function(timeObj, isUp) { | |
| 386 | + var _lpObj; | |
| 387 | + var _groupObj; | |
| 388 | + var _bcObj; | |
| 389 | + var _i; | |
| 390 | + var _j; | |
| 391 | + var timediff; // 时间差取绝对值 | |
| 392 | + | |
| 393 | + var _up_gIndex; | |
| 394 | + var _up_bIndex; | |
| 395 | + | |
| 396 | + // TODO:找上界 | |
| 397 | + for (_i = 0; _i < _qCount; _i++) { | |
| 398 | + for (_j = 0; _j < _internalLpArray.length; _j++) { | |
| 399 | + _lpObj = _internalLpArray[_j]; | |
| 400 | + _groupObj = _lpObj.getGroup(_i); | |
| 401 | + _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2(); | |
| 402 | + if (_bcObj) { // 没有班次动态生成一个,可能生成不出的 | |
| 403 | + _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1); | |
| 404 | + } | |
| 405 | + if (_bcObj) { | |
| 406 | + if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) { | |
| 407 | + if (!timediff) { | |
| 408 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | |
| 409 | + _up_gIndex = _i; | |
| 410 | + _up_bIndex = isUp == _qIsUp ? 0 : 1; | |
| 411 | + } else { | |
| 412 | + if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) { | |
| 413 | + timediff = timeObj.diff(_bcObj.getFcTimeObj()); | |
| 414 | + _up_gIndex = _i; | |
| 415 | + _up_bIndex = isUp == _qIsUp ? 0 : 1; | |
| 416 | + } | |
| 417 | + } | |
| 418 | + } | |
| 419 | + } | |
| 420 | + } | |
| 421 | + } | |
| 422 | + | |
| 423 | + // TODO: | |
| 424 | + var bcindex = []; | |
| 425 | + bcindex.push(_up_gIndex); | |
| 426 | + bcindex.push(_up_bIndex); | |
| 427 | + | |
| 428 | + return bcindex; | |
| 429 | + }; | |
| 312 | 430 | |
| 313 | 431 | return { |
| 314 | 432 | //------------- 布局初始化方法 ------------// |
| ... | ... | @@ -369,8 +487,49 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 369 | 487 | // TODO: |
| 370 | 488 | |
| 371 | 489 | /** |
| 372 | - * 根据每个路牌的连班班型补充班次。 | |
| 373 | - * 补充连班的班次,参照上标线,中标线补充不足的班次 | |
| 490 | + * 补充做5休2的班型班次。 | |
| 491 | + * 1、做5休2的路牌总工时不能超过7个小时 | |
| 492 | + * 2、5休2的路牌全部从早晚高峰班次开始往前补充1个班次,组成早晚2圈 | |
| 493 | + * 3、再根据余下工时及早晚高峰开始时间,确定向前或者向后加班次 | |
| 494 | + */ | |
| 495 | + calcuLpBx_5_2: function() { | |
| 496 | + // 1、先在早晚高峰班次前加1个班次压压惊 | |
| 497 | + var i; | |
| 498 | + var _lp; | |
| 499 | + var _zgfbcpos; // 早高峰班次位置 | |
| 500 | + var _wgfbcpos; // 晚高峰班次位置 | |
| 501 | + var _qIndex; | |
| 502 | + var _bIndex; | |
| 503 | + | |
| 504 | + for (i = 0; i < _internalLpArray.length; i++) { | |
| 505 | + _lp = _internalLpArray[i]; | |
| 506 | + if (_lp.isBxFb5_2()) { | |
| 507 | + _zgfbcpos = _lp.getMinBcObjPosition(); | |
| 508 | + _wgfbcpos = _lp.getMaxBcObjPosition(); | |
| 509 | + | |
| 510 | + // TODO:测试向前添加一个班次 | |
| 511 | + _qIndex = _zgfbcpos[0]; | |
| 512 | + _bIndex = _zgfbcpos[1]; | |
| 513 | + _bIndex == 0 ? | |
| 514 | + _generateBcAndSetBc(i, _qIndex - 1, 1) : | |
| 515 | + _generateBcAndSetBc(i, _qIndex, 0); | |
| 516 | + | |
| 517 | + _qIndex = _wgfbcpos[0]; | |
| 518 | + _bIndex = _wgfbcpos[1]; | |
| 519 | + _bIndex == 0 ? | |
| 520 | + _generateBcAndSetBc(i, _qIndex - 1, 1) : | |
| 521 | + _generateBcAndSetBc(i, _qIndex, 0); | |
| 522 | + | |
| 523 | + } | |
| 524 | + } | |
| 525 | + | |
| 526 | + // 2、 | |
| 527 | + }, | |
| 528 | + | |
| 529 | + /** | |
| 530 | + * 补充连班路牌班次。 | |
| 531 | + * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢 | |
| 532 | + * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢 | |
| 374 | 533 | */ |
| 375 | 534 | calcuLpBx_lb: function() { |
| 376 | 535 | // 补充连班的班次,参照上标线,中标线补充不足的班次 |
| ... | ... | @@ -419,10 +578,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 419 | 578 | if (_bIndex == 0) { |
| 420 | 579 | _qIndex --; |
| 421 | 580 | _bIndex = 1; |
| 422 | - this._generateBc(i, _qIndex, _bIndex); | |
| 581 | + _generateBcAndSetBc(i, _qIndex, _bIndex); | |
| 423 | 582 | } else if (_bIndex == 1) { |
| 424 | 583 | _bIndex --; |
| 425 | - this._generateBc(i, _qIndex, _bIndex); | |
| 584 | + _generateBcAndSetBc(i, _qIndex, _bIndex); | |
| 426 | 585 | } |
| 427 | 586 | } |
| 428 | 587 | } |
| ... | ... | @@ -439,10 +598,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 439 | 598 | if (_bIndex == 0) { |
| 440 | 599 | _qIndex --; |
| 441 | 600 | _bIndex = 1; |
| 442 | - this._generateBc(i, _qIndex, _bIndex); | |
| 601 | + _generateBcAndSetBc(i, _qIndex, _bIndex); | |
| 443 | 602 | } else if (_bIndex == 1) { |
| 444 | 603 | _bIndex --; |
| 445 | - this._generateBc(i, _qIndex, _bIndex); | |
| 604 | + _generateBcAndSetBc(i, _qIndex, _bIndex); | |
| 446 | 605 | } |
| 447 | 606 | } |
| 448 | 607 | } |
| ... | ... | @@ -547,58 +706,6 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { |
| 547 | 706 | console.log("5休2分班路牌indexes=" + _5_2_fbIndexes); |
| 548 | 707 | }, |
| 549 | 708 | |
| 550 | - /** | |
| 551 | - * 在指定位置生成班次(内部重要方法)。 | |
| 552 | - * @param lpIndex 第几个路牌 | |
| 553 | - * @param qIndex 第几圈 | |
| 554 | - * @param bcIndex 第几个班次 | |
| 555 | - */ | |
| 556 | - _generateBc: function(lpIndex, qIndex, bcIndex) { | |
| 557 | - // 在初始化布局后使用,否则没有参照班次加不了 | |
| 558 | - // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数 | |
| 559 | - // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次 | |
| 560 | - | |
| 561 | - // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加 | |
| 562 | - // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加 | |
| 563 | - | |
| 564 | - // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础 | |
| 565 | - // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔 | |
| 566 | - // 3、如果班次发车时间越界不管,有其余方法排除这种情况 | |
| 567 | - | |
| 568 | - // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的) | |
| 569 | - var _i; | |
| 570 | - var _bcObj; | |
| 571 | - for (_i = lpIndex - 1; _i >= 0; _i--) { | |
| 572 | - _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex); | |
| 573 | - if (_bcObj) { | |
| 574 | - break; | |
| 575 | - } | |
| 576 | - } | |
| 577 | - if (!_bcObj) { | |
| 578 | - alert("无法在指定位置生成班次"); | |
| 579 | - throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次"; | |
| 580 | - } | |
| 581 | - | |
| 582 | - // 2、计算发车间隔 | |
| 583 | - var _intervalTime = 0; | |
| 584 | - for (_i = _i + 1; _i <= lpIndex; _i++) { | |
| 585 | - _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime(); | |
| 586 | - } | |
| 587 | - | |
| 588 | - // 3、计算班次并添加班次 | |
| 589 | - var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime); | |
| 590 | - _bcObj = _factory.createBcObj( | |
| 591 | - "normal", _bcObj.isUp(), | |
| 592 | - _lpArray[lpIndex].lpNo, | |
| 593 | - 1, _kssj, _paramObj); | |
| 594 | - | |
| 595 | - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj); | |
| 596 | - | |
| 597 | - // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题 | |
| 598 | - // TODO:主要是由于中标线的问题,但是误差不会很大, | |
| 599 | - // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间) | |
| 600 | - }, | |
| 601 | - | |
| 602 | 709 | //------------- 其他方法 -------------// |
| 603 | 710 | /** |
| 604 | 711 | * 内部数据转化成显示用的班次数组。 | ... | ... |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| ... | ... | @@ -81,13 +81,17 @@ var Main_v2 = function() { |
| 81 | 81 | // 1、初始化行车计划 |
| 82 | 82 | var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); |
| 83 | 83 | schedule.initDataWithBxLayout(); |
| 84 | - | |
| 85 | 84 | // 2、计算每个路牌的班型及对应工时 |
| 86 | 85 | schedule.calcuLpBx_fg(); |
| 87 | - | |
| 88 | - // 3、根据班型补充所有的不足班次 | |
| 86 | + // 3、将连班路牌的班次补足 | |
| 89 | 87 | schedule.calcuLpBx_lb(); |
| 90 | 88 | |
| 89 | + // 4、TODO:修正上下行班次,添加高峰不足的班次,删除高峰多余的班次 | |
| 90 | + | |
| 91 | + | |
| 92 | + // 4、根据班型补充所有的不足班次 | |
| 93 | + schedule.calcuLpBx_5_2(); | |
| 94 | + | |
| 91 | 95 | // TODO:4、确定末班车 |
| 92 | 96 | |
| 93 | 97 | // TODO:5、补进出场班次 | ... | ... |