Commit 96a975d07896c559072c80b0d618130b0085d25e
1 parent
85481355
timetable update
Showing
3 changed files
with
106 additions
and
1 deletions
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
| @@ -97,6 +97,28 @@ InternalLpObj.prototype.getBcCount = function() { | @@ -97,6 +97,28 @@ InternalLpObj.prototype.getBcCount = function() { | ||
| 97 | return bccount; | 97 | return bccount; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | +/** | ||
| 101 | + * 获取最小(最早)班次对象。 | ||
| 102 | + * @return [{圈index},{班次index}] | ||
| 103 | + */ | ||
| 104 | +InternalLpObj.prototype.getMinBcObjPosition = function() { | ||
| 105 | + var i; | ||
| 106 | + var bIndex = []; | ||
| 107 | + for (i = 0; i < this._$_groupBcArray.length; i++) { | ||
| 108 | + if (this._$_groupBcArray[i].getBc1()) { | ||
| 109 | + bIndex.push(i); | ||
| 110 | + bIndex.push(0); | ||
| 111 | + break; | ||
| 112 | + } | ||
| 113 | + if (this._$_groupBcArray[i].getBc2()) { | ||
| 114 | + bIndex.push(i); | ||
| 115 | + bIndex.push(1); | ||
| 116 | + break; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + return bIndex; | ||
| 120 | +}; | ||
| 121 | + | ||
| 100 | // TODO | 122 | // TODO |
| 101 | 123 | ||
| 102 | /** | 124 | /** |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| @@ -369,6 +369,88 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -369,6 +369,88 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 369 | // TODO: | 369 | // TODO: |
| 370 | 370 | ||
| 371 | /** | 371 | /** |
| 372 | + * 根据每个路牌的连班班型补充班次。 | ||
| 373 | + * 补充连班的班次,参照上标线,中标线补充不足的班次 | ||
| 374 | + */ | ||
| 375 | + calcuLpBx_lb: function() { | ||
| 376 | + // 补充连班的班次,参照上标线,中标线补充不足的班次 | ||
| 377 | + var _zgffcsj; // 早高峰发车时间 | ||
| 378 | + var _etsj = // 结束时间 | ||
| 379 | + _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ? | ||
| 380 | + _paramObj.getDownLastDTimeObj() : | ||
| 381 | + _paramObj.getUpLastDtimeObj(); | ||
| 382 | + | ||
| 383 | + var _lp; | ||
| 384 | + var _minbcPos; | ||
| 385 | + var _bcObj; | ||
| 386 | + var i; | ||
| 387 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 388 | + _lp = _internalLpArray[i]; | ||
| 389 | + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 390 | + _minbcPos = _lp.getMinBcObjPosition(); | ||
| 391 | + _bcObj = _lp.getBc(_minbcPos[0], _minbcPos[1]); | ||
| 392 | + _zgffcsj = _bcObj.getFcTimeObj(); | ||
| 393 | + // 重新初始化连班班型班次 | ||
| 394 | + _lp.initDataFromTimeToTime( | ||
| 395 | + _zgffcsj, | ||
| 396 | + _etsj, | ||
| 397 | + _bcObj.isUp(), | ||
| 398 | + _minbcPos[0], | ||
| 399 | + _paramObj, | ||
| 400 | + _factory | ||
| 401 | + ); | ||
| 402 | + } | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + // 还要补充缺失的班次,差上标线几个班次要往前补上 | ||
| 406 | + var _bccount; | ||
| 407 | + var j; | ||
| 408 | + var _qIndex; | ||
| 409 | + var _bIndex; | ||
| 410 | + // 补上标线到中标线之间的连班路牌的班次 | ||
| 411 | + for (i = 0; i < _zbx_lpIndex; i++) { | ||
| 412 | + _lp = _internalLpArray[i]; | ||
| 413 | + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 414 | + _minbcPos = _lp.getMinBcObjPosition(); | ||
| 415 | + _qIndex = _minbcPos[0]; | ||
| 416 | + _bIndex = _minbcPos[1]; | ||
| 417 | + _bccount = (_qIndex - 1) * 2 + _bIndex; // 距离上标线起始站点差几个班次 | ||
| 418 | + for (j = 0; j < _bccount; j++) { | ||
| 419 | + if (_bIndex == 0) { | ||
| 420 | + _qIndex --; | ||
| 421 | + _bIndex = 1; | ||
| 422 | + this._generateBc(i, _qIndex, _bIndex); | ||
| 423 | + } else if (_bIndex == 1) { | ||
| 424 | + _bIndex --; | ||
| 425 | + this._generateBc(i, _qIndex, _bIndex); | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | + } | ||
| 430 | + // 补中标线以下的连班路牌的班次 | ||
| 431 | + for (i = _zbx_lpIndex; i < _internalLpArray.length; i++) { | ||
| 432 | + _lp = _internalLpArray[i]; | ||
| 433 | + if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 434 | + _minbcPos = _lp.getMinBcObjPosition(); | ||
| 435 | + _qIndex = _minbcPos[0]; | ||
| 436 | + _bIndex = _minbcPos[1]; | ||
| 437 | + _bccount = (_qIndex - 0) * 2 + _bIndex - 1; // 距离上标线起始站点差几个班次 | ||
| 438 | + for (j = 0; j < _bccount; j++) { | ||
| 439 | + if (_bIndex == 0) { | ||
| 440 | + _qIndex --; | ||
| 441 | + _bIndex = 1; | ||
| 442 | + this._generateBc(i, _qIndex, _bIndex); | ||
| 443 | + } else if (_bIndex == 1) { | ||
| 444 | + _bIndex --; | ||
| 445 | + this._generateBc(i, _qIndex, _bIndex); | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + } | ||
| 449 | + } | ||
| 450 | + | ||
| 451 | + }, | ||
| 452 | + | ||
| 453 | + /** | ||
| 372 | * 计算每个路牌的班型及工时对应的圈数。 | 454 | * 计算每个路牌的班型及工时对应的圈数。 |
| 373 | * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌 | 455 | * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌 |
| 374 | * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了, | 456 | * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了, |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| @@ -85,7 +85,8 @@ var Main_v2 = function() { | @@ -85,7 +85,8 @@ var Main_v2 = function() { | ||
| 85 | // 2、计算每个路牌的班型及对应工时 | 85 | // 2、计算每个路牌的班型及对应工时 |
| 86 | schedule.calcuLpBx_fg(); | 86 | schedule.calcuLpBx_fg(); |
| 87 | 87 | ||
| 88 | - // TODO:3、根据班型补充所有的不足班次 | 88 | + // 3、根据班型补充所有的不足班次 |
| 89 | + schedule.calcuLpBx_lb(); | ||
| 89 | 90 | ||
| 90 | // TODO:4、确定末班车 | 91 | // TODO:4、确定末班车 |
| 91 | 92 |