Commit babfdcd9a56b6f31afb8d1e2b5b36b8c0f05421a

Authored by 徐烜
1 parent 05c92ff9

Update

src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
... ... @@ -805,6 +805,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
805 805 */
806 806 calcuLpBx_fg: function() {
807 807 // 间隔法
  808 +
  809 + //--------------------------- 1、间隔法分隔连班路牌 ----------------------//
  810 +
808 811 // 除去上标线,中标线的连班路牌个数
809 812 var _lblbcount = _bx_lb_lpcount - 2;
810 813 // 计算由标线隔开的两个区域的路牌数比率
... ... @@ -851,6 +854,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
851 854 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班");
852 855 }
853 856  
  857 + //---------------------------- 2、分隔法,分隔分班路牌 -------------------------//
  858 +
854 859 // 设定分班路牌
855 860 var notlbIndexes = []; // 去除连班的路牌index列表
856 861 for (i = 0; i < _internalLpArray.length; i++) {
... ... @@ -858,20 +863,66 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
858 863 notlbIndexes.push(i);
859 864 }
860 865 }
861   - // 先把全部放置分班路牌,在全部放置5休2路牌
862   - for (i = 0; i < _bx_other_fb_lpcount; i++) {
863   - _internalLpArray[notlbIndexes[i]].setBxFb(false);
864   - _internalLpArray[notlbIndexes[i]].setBxFb(true);
865   - _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);
866   - _internalLpArray[notlbIndexes[i]].setBxDesc("其他分班");
  866 + // 获取离中标线最近的分班路牌索引
  867 + var _temp_fg_index;
  868 + for (i = 0; i < notlbIndexes.length; i++) {
  869 + if (notlbIndexes[i] == _zbx_lpIndex - 1) {
  870 + _temp_fg_index = i;
  871 + break;
  872 + }
  873 + }
  874 +
  875 + // 使用上面的分隔比率,分隔5休2班型
  876 + _p1_lpcount = _bx_5_2_fb_lpcount * _p1;
  877 + _p2_lpcount = _bx_5_2_fb_lpcount * _p2;
  878 + if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除
  879 + _p1_lpcount = Math.floor(_p1_lpcount);
  880 + _p2_lpcount = Math.floor(_p2_lpcount) + 1;
  881 + }
  882 + // 第一个区域
  883 + _count = _p1_lpcount;
  884 + _c1 = Math.floor(_temp_fg_index / _count);
  885 + _c2 = _temp_fg_index % _count;
  886 + for (i = 1; i <= _count - _c2; i++) {
  887 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxLb(false);
  888 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb(true);
  889 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb5_2(true);
  890 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxDesc("5休2分班");
  891 + _c2_start_index = (i - 1) * _c1;
  892 + }
  893 + for (i = 1; i <= _c2; i++) {
  894 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  895 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(true);
  896 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  897 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
  898 + }
  899 + // 第二个区域
  900 + _count = _p2_lpcount;
  901 + _c1 = Math.floor((notlbIndexes.length - _temp_fg_index - 1) / _count);
  902 + _c2 = (notlbIndexes.length - _temp_fg_index - 1) % _count;
  903 + for (i = 1; i <= _count - _c2; i++) {
  904 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxLb(false);
  905 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb(true);
  906 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb5_2(true);
  907 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxDesc("5休2分班");
  908 + _c2_start_index = (i - 1) * _c1 + _temp_fg_index + 1;
  909 + }
  910 + for (i = 1; i <= _c2; i++) {
  911 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  912 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb(true);
  913 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  914 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
867 915 }
868   - while (i < _bx_other_fb_lpcount + _bx_5_2_fb_lpcount) {
869   - _internalLpArray[notlbIndexes[i]].setBxFb(false);
870   - _internalLpArray[notlbIndexes[i]].setBxFb(true);
871   - _internalLpArray[notlbIndexes[i]].setBxFb5_2(true);
872   - _internalLpArray[notlbIndexes[i]].setBxDesc("5休2分班");
873 916  
874   - i++;
  917 + //-------------------------- 3、余下班次就是其他分班类型 ----------------------//
  918 +
  919 + for (i = 0; i < notlbIndexes.length; i++) {
  920 + if (!_internalLpArray[notlbIndexes[i]].isBxFb5_2()) {
  921 + _internalLpArray[notlbIndexes[i]].setBxLb(false);
  922 + _internalLpArray[notlbIndexes[i]].setBxFb(true);
  923 + _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);
  924 + _internalLpArray[notlbIndexes[i]].setBxDesc("其他分班");
  925 + }
875 926 }
876 927  
877 928 // 测试打印
... ...