Commit 3e44b0cacd4b603e836f26a73f86a95a34b06d4b
1 parent
a9a85907
时刻表v2.2
1、纵向间隔明细到每圈每个方向上都有间隔,间隔表示下一个路牌距离当前路牌的间隔,从下而上 2、纵向添加班次的时候,全部以上标线的班次为开始点计算 3、中标线必须在连班路牌上 4、分隔发计算各种班型的路牌,直接分隔,不用之前的比率分隔
Showing
5 changed files
with
724 additions
and
598 deletions
src/main/resources/static/pages/base/timesmodel/js/v2/ParameterObj.js
| @@ -896,163 +896,186 @@ var ParameterObj = function() { | @@ -896,163 +896,186 @@ var ParameterObj = function() { | ||
| 896 | 896 | ||
| 897 | /** | 897 | /** |
| 898 | * 获取固定的停站时间(固定停站时间都是选的最大值) | 898 | * 获取固定的停站时间(固定停站时间都是选的最大值) |
| 899 | - * @param timeObj 时间对象 | ||
| 900 | - * @param isUp 是否上行 | ||
| 901 | - * @returns number | 899 | + * @param oTimeObj 时间对象 |
| 900 | + * @param bIsUp 是否上行 | ||
| 901 | + * @param iXXTime 行驶时间 | ||
| 902 | + * @returns int 停站时间 | ||
| 902 | */ | 903 | */ |
| 903 | - calcuFixedStopNumber: function(timeObj, isUp) { | 904 | + fnCalcuFixedStopNumber: function(oTimeObj, bIsUp, iXXTime) { |
| 904 | _validInternal(); // 验证 | 905 | _validInternal(); // 验证 |
| 905 | - var paramObj = this; | 906 | + var oParam = this; |
| 907 | + | ||
| 908 | + var iPeakStopTime; // 高峰停站时间 | ||
| 909 | + var iTroughStopTime; // 低谷停站时间 | ||
| 910 | + var iSecondaryStopTime; // 副站停站时间 | ||
| 906 | 911 | ||
| 907 | - var peakStopTime; // 高峰停站时间 | ||
| 908 | - var troughStopTime; // 低谷停站时间 | ||
| 909 | - var secondaryStopTime; // 副站停站时间 | 912 | + var iXXTime_temp; |
| 910 | 913 | ||
| 911 | // 双向停站 | 914 | // 双向停站 |
| 912 | - if (paramObj.isTwoWayStop()) { | ||
| 913 | - if (isUp) { // 上行 | ||
| 914 | - if (this.isMPeakBc(timeObj)) { // 早高峰 | ||
| 915 | - peakStopTime = Math.floor(paramObj.getUpMPeakTime() * 0.1); // 行驶时间的10% | ||
| 916 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 917 | - peakStopTime = 3; | 915 | + if (oParam.isTwoWayStop()) { |
| 916 | + if (bIsUp) { // 上行 | ||
| 917 | + if (this.isMPeakBc(oTimeObj)) { // 早高峰 | ||
| 918 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime; | ||
| 919 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 920 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 921 | + iPeakStopTime = 3; | ||
| 918 | } | 922 | } |
| 919 | - return peakStopTime; | ||
| 920 | - } else if (this.isEPeakBc(timeObj)) { // 晚高峰 | ||
| 921 | - peakStopTime = Math.floor(paramObj.getUpEPeakTime() * 0.1); // 行驶时间的10% | ||
| 922 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 923 | - peakStopTime = 3; | 923 | + return iPeakStopTime; |
| 924 | + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰 | ||
| 925 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime; | ||
| 926 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 927 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 928 | + iPeakStopTime = 3; | ||
| 924 | } | 929 | } |
| 925 | - return peakStopTime; | 930 | + return iPeakStopTime; |
| 926 | } else { // 低谷 | 931 | } else { // 低谷 |
| 927 | - if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前 | ||
| 928 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20% | ||
| 929 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 930 | - troughStopTime = 10; | 932 | + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前 |
| 933 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; | ||
| 934 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 935 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 936 | + iTroughStopTime = 10; | ||
| 931 | } | 937 | } |
| 932 | - return troughStopTime; | ||
| 933 | - } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后 | ||
| 934 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20% | ||
| 935 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 936 | - troughStopTime = 10; | 938 | + return iTroughStopTime; |
| 939 | + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后 | ||
| 940 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; | ||
| 941 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 942 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 943 | + iTroughStopTime = 10; | ||
| 937 | } | 944 | } |
| 938 | - return troughStopTime; | 945 | + return iTroughStopTime; |
| 939 | } else { // 早高峰,晚高峰之间 | 946 | } else { // 早高峰,晚高峰之间 |
| 940 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.15); // 行驶时间15% | ||
| 941 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 942 | - troughStopTime = 10; | 947 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; |
| 948 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15% | ||
| 949 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 950 | + iTroughStopTime = 10; | ||
| 943 | } | 951 | } |
| 944 | - return troughStopTime; | 952 | + return iTroughStopTime; |
| 945 | } | 953 | } |
| 946 | } | 954 | } |
| 947 | } else { // 下行 | 955 | } else { // 下行 |
| 948 | - if (this.isMPeakBc(timeObj)) { // 早高峰 | ||
| 949 | - peakStopTime = Math.floor(paramObj.getDownMPeakTime() * 0.1); // 行驶时间的10% | ||
| 950 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 951 | - peakStopTime = 3; | 956 | + if (this.isMPeakBc(oTimeObj)) { // 早高峰 |
| 957 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime; | ||
| 958 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 959 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 960 | + iPeakStopTime = 3; | ||
| 952 | } | 961 | } |
| 953 | - return peakStopTime; | ||
| 954 | - } else if (this.isEPeakBc(timeObj)) { // 晚高峰 | ||
| 955 | - peakStopTime = Math.floor(paramObj.getDownEPeakTime() * 0.1); // 行驶时间的10% | ||
| 956 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 957 | - peakStopTime = 3; | 962 | + return iPeakStopTime; |
| 963 | + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰 | ||
| 964 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime; | ||
| 965 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 966 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 967 | + iPeakStopTime = 3; | ||
| 958 | } | 968 | } |
| 959 | - return peakStopTime; | 969 | + return iPeakStopTime; |
| 960 | } else { // 低谷 | 970 | } else { // 低谷 |
| 961 | - if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前 | ||
| 962 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20% | ||
| 963 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 964 | - troughStopTime = 10; | 971 | + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前 |
| 972 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; | ||
| 973 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 974 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 975 | + iTroughStopTime = 10; | ||
| 965 | } | 976 | } |
| 966 | - return troughStopTime; | ||
| 967 | - } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后 | ||
| 968 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20% | ||
| 969 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 970 | - troughStopTime = 10; | 977 | + return iTroughStopTime; |
| 978 | + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后 | ||
| 979 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; | ||
| 980 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 981 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 982 | + iTroughStopTime = 10; | ||
| 971 | } | 983 | } |
| 972 | - return troughStopTime; | 984 | + return iTroughStopTime; |
| 973 | } else { // 早高峰,晚高峰之间 | 985 | } else { // 早高峰,晚高峰之间 |
| 974 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.15); // 行驶时间15% | ||
| 975 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 976 | - troughStopTime = 10; | 986 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; |
| 987 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15% | ||
| 988 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 989 | + iTroughStopTime = 10; | ||
| 977 | } | 990 | } |
| 978 | - return troughStopTime; | 991 | + return iTroughStopTime; |
| 979 | } | 992 | } |
| 980 | } | 993 | } |
| 981 | } | 994 | } |
| 982 | } else { // 主站停站 | 995 | } else { // 主站停站 |
| 983 | - if (isUp == paramObj.isUpOneWayStop()) { | ||
| 984 | - if (isUp) { // 上行 | ||
| 985 | - if (this.isMPeakBc(timeObj)) { // 早高峰 | ||
| 986 | - peakStopTime = Math.floor(paramObj.getUpMPeakTime() * 0.1); // 行驶时间的10% | ||
| 987 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 988 | - peakStopTime = 3; | 996 | + if (bIsUp == oParam.isUpOneWayStop()) { |
| 997 | + if (bIsUp) { // 上行 | ||
| 998 | + if (this.isMPeakBc(oTimeObj)) { // 早高峰 | ||
| 999 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpMPeakTime() : iXXTime; | ||
| 1000 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 1001 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 1002 | + iPeakStopTime = 3; | ||
| 989 | } | 1003 | } |
| 990 | - return peakStopTime; | ||
| 991 | - } else if (this.isEPeakBc(timeObj)) { // 晚高峰 | ||
| 992 | - peakStopTime = Math.floor(paramObj.getUpEPeakTime() * 0.1); // 行驶时间的10% | ||
| 993 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 994 | - peakStopTime = 3; | 1004 | + return iPeakStopTime; |
| 1005 | + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰 | ||
| 1006 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpEPeakTime() : iXXTime; | ||
| 1007 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 1008 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 1009 | + iPeakStopTime = 3; | ||
| 995 | } | 1010 | } |
| 996 | - return peakStopTime; | 1011 | + return iPeakStopTime; |
| 997 | } else { // 低谷 | 1012 | } else { // 低谷 |
| 998 | - if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前 | ||
| 999 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20% | ||
| 1000 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1001 | - troughStopTime = 10; | 1013 | + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前 |
| 1014 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; | ||
| 1015 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 1016 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1017 | + iTroughStopTime = 10; | ||
| 1002 | } | 1018 | } |
| 1003 | - return troughStopTime; | ||
| 1004 | - } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后 | ||
| 1005 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.2); // 行驶时间20% | ||
| 1006 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1007 | - troughStopTime = 10; | 1019 | + return iTroughStopTime; |
| 1020 | + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后 | ||
| 1021 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; | ||
| 1022 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 1023 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1024 | + iTroughStopTime = 10; | ||
| 1008 | } | 1025 | } |
| 1009 | - return troughStopTime; | 1026 | + return iTroughStopTime; |
| 1010 | } else { // 早高峰,晚高峰之间 | 1027 | } else { // 早高峰,晚高峰之间 |
| 1011 | - troughStopTime = Math.floor(paramObj.getUpTroughTime() * 0.15); // 行驶时间15% | ||
| 1012 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1013 | - troughStopTime = 10; | 1028 | + iXXTime_temp = iXXTime == undefined ? oParam.getUpTroughTime() : iXXTime; |
| 1029 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15% | ||
| 1030 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1031 | + iTroughStopTime = 10; | ||
| 1014 | } | 1032 | } |
| 1015 | - return troughStopTime; | 1033 | + return iTroughStopTime; |
| 1016 | } | 1034 | } |
| 1017 | } | 1035 | } |
| 1018 | } else { // 下行 | 1036 | } else { // 下行 |
| 1019 | - if (this.isMPeakBc(timeObj)) { // 早高峰 | ||
| 1020 | - peakStopTime = Math.floor(paramObj.getDownMPeakTime() * 0.1); // 行驶时间的10% | ||
| 1021 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 1022 | - peakStopTime = 3; | 1037 | + if (this.isMPeakBc(oTimeObj)) { // 早高峰 |
| 1038 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownMPeakTime() : iXXTime; | ||
| 1039 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 1040 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 1041 | + iPeakStopTime = 3; | ||
| 1023 | } | 1042 | } |
| 1024 | - return peakStopTime; | ||
| 1025 | - } else if (this.isEPeakBc(timeObj)) { // 晚高峰 | ||
| 1026 | - peakStopTime = Math.floor(paramObj.getDownEPeakTime() * 0.1); // 行驶时间的10% | ||
| 1027 | - if (peakStopTime < 3) { // 不少于3分钟 | ||
| 1028 | - peakStopTime = 3; | 1043 | + return iPeakStopTime; |
| 1044 | + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰 | ||
| 1045 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownEPeakTime() : iXXTime; | ||
| 1046 | + iPeakStopTime = Math.floor(iXXTime_temp * 0.1); // 行驶时间的10% | ||
| 1047 | + if (iPeakStopTime < 3) { // 不少于3分钟 | ||
| 1048 | + iPeakStopTime = 3; | ||
| 1029 | } | 1049 | } |
| 1030 | - return peakStopTime; | 1050 | + return iPeakStopTime; |
| 1031 | } else { // 低谷 | 1051 | } else { // 低谷 |
| 1032 | - if (this.isTroughBeforMPeakStartBc(timeObj)) { // 早高峰开始前 | ||
| 1033 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20% | ||
| 1034 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1035 | - troughStopTime = 10; | 1052 | + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前 |
| 1053 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; | ||
| 1054 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 1055 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1056 | + iTroughStopTime = 10; | ||
| 1036 | } | 1057 | } |
| 1037 | - return troughStopTime; | ||
| 1038 | - } else if (this.isTroughAfterEPeakEndBc(timeObj)) { // 晚高峰结束后 | ||
| 1039 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.2); // 行驶时间20% | ||
| 1040 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1041 | - troughStopTime = 10; | 1058 | + return iTroughStopTime; |
| 1059 | + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后 | ||
| 1060 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; | ||
| 1061 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.2); // 行驶时间20% | ||
| 1062 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1063 | + iTroughStopTime = 10; | ||
| 1042 | } | 1064 | } |
| 1043 | - return troughStopTime; | 1065 | + return iTroughStopTime; |
| 1044 | } else { // 早高峰,晚高峰之间 | 1066 | } else { // 早高峰,晚高峰之间 |
| 1045 | - troughStopTime = Math.floor(paramObj.getDownTroughTime() * 0.15); // 行驶时间15% | ||
| 1046 | - if (troughStopTime < 10) { // 不少于10分钟 | ||
| 1047 | - troughStopTime = 10; | 1067 | + iXXTime_temp = iXXTime == undefined ? oParam.getDownTroughTime() : iXXTime; |
| 1068 | + iTroughStopTime = Math.floor(iXXTime_temp * 0.15); // 行驶时间15% | ||
| 1069 | + if (iTroughStopTime < 10) { // 不少于10分钟 | ||
| 1070 | + iTroughStopTime = 10; | ||
| 1048 | } | 1071 | } |
| 1049 | - return troughStopTime; | 1072 | + return iTroughStopTime; |
| 1050 | } | 1073 | } |
| 1051 | } | 1074 | } |
| 1052 | } | 1075 | } |
| 1053 | } else { // 副站停战,2到3分钟 | 1076 | } else { // 副站停战,2到3分钟 |
| 1054 | - secondaryStopTime = 3; | ||
| 1055 | - return secondaryStopTime; // 直接返回3分钟 | 1077 | + iSecondaryStopTime = 3; |
| 1078 | + return iSecondaryStopTime; // 直接返回3分钟 | ||
| 1056 | } | 1079 | } |
| 1057 | } | 1080 | } |
| 1058 | 1081 | ||
| @@ -1138,9 +1161,9 @@ var ParameterObj = function() { | @@ -1138,9 +1161,9 @@ var ParameterObj = function() { | ||
| 1138 | var _time = paramObj.getMPeakStartTimeObj(); | 1161 | var _time = paramObj.getMPeakStartTimeObj(); |
| 1139 | var _zzsj = // 早高峰上行行驶时间+停站时间+早高峰下行行驶时间+停站时间 | 1162 | var _zzsj = // 早高峰上行行驶时间+停站时间+早高峰下行行驶时间+停站时间 |
| 1140 | this.calcuTravelTime(_time, true) + | 1163 | this.calcuTravelTime(_time, true) + |
| 1141 | - this.calcuFixedStopNumber(_time, true) + | 1164 | + this.fnCalcuFixedStopNumber(_time, true) + |
| 1142 | this.calcuTravelTime(_time, false) + | 1165 | this.calcuTravelTime(_time, false) + |
| 1143 | - this.calcuFixedStopNumber(_time, false); | 1166 | + this.fnCalcuFixedStopNumber(_time, false); |
| 1144 | return _zzsj; | 1167 | return _zzsj; |
| 1145 | }, | 1168 | }, |
| 1146 | 1169 | ||
| @@ -1156,9 +1179,9 @@ var ParameterObj = function() { | @@ -1156,9 +1179,9 @@ var ParameterObj = function() { | ||
| 1156 | var _time = this.addMinute(paramObj.getMPeakStartTimeObj(), -1); // 使用任意一个低谷时间 | 1179 | var _time = this.addMinute(paramObj.getMPeakStartTimeObj(), -1); // 使用任意一个低谷时间 |
| 1157 | var _zzsj = // 低谷上行行驶时间+停站时间+低谷下行行驶时间+停站时间 | 1180 | var _zzsj = // 低谷上行行驶时间+停站时间+低谷下行行驶时间+停站时间 |
| 1158 | this.calcuTravelTime(_time, true) + | 1181 | this.calcuTravelTime(_time, true) + |
| 1159 | - this.calcuFixedStopNumber(_time, true) + | 1182 | + this.fnCalcuFixedStopNumber(_time, true) + |
| 1160 | this.calcuTravelTime(_time, false) + | 1183 | this.calcuTravelTime(_time, false) + |
| 1161 | - this.calcuFixedStopNumber(_time, false); | 1184 | + this.fnCalcuFixedStopNumber(_time, false); |
| 1162 | 1185 | ||
| 1163 | return _zzsj; | 1186 | return _zzsj; |
| 1164 | }, | 1187 | }, |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
| @@ -38,10 +38,21 @@ var InternalBcObj = function( | @@ -38,10 +38,21 @@ var InternalBcObj = function( | ||
| 38 | this._$_qdzid = otherParamObj.qdzid; // 起点站id | 38 | this._$_qdzid = otherParamObj.qdzid; // 起点站id |
| 39 | this._$_zdzid = otherParamObj.zdzid; // 终点站id | 39 | this._$_zdzid = otherParamObj.zdzid; // 终点站id |
| 40 | 40 | ||
| 41 | + // 标记参数,这个班次用于计算,最后必须删除 | ||
| 42 | + this._$_bDelFlag = false; | ||
| 43 | + | ||
| 41 | }; | 44 | }; |
| 42 | 45 | ||
| 43 | //------------------- get/set 方法 -------------------// | 46 | //------------------- get/set 方法 -------------------// |
| 44 | 47 | ||
| 48 | +InternalBcObj.prototype.fnSetDelFlag = function(bFlag) { | ||
| 49 | + this._$_bDelFlag = bFlag; | ||
| 50 | +}; | ||
| 51 | + | ||
| 52 | +InternalBcObj.prototype.fnIsDelFlag = function() { | ||
| 53 | + return this._$_bDelFlag; | ||
| 54 | +}; | ||
| 55 | + | ||
| 45 | /** | 56 | /** |
| 46 | * 设置路牌对象。 | 57 | * 设置路牌对象。 |
| 47 | * @param lpObj InternalLpObj路牌对象 | 58 | * @param lpObj InternalLpObj路牌对象 |
| @@ -86,6 +97,13 @@ InternalBcObj.prototype.getArrTimeObj = function() { | @@ -86,6 +97,13 @@ InternalBcObj.prototype.getArrTimeObj = function() { | ||
| 86 | return this._$_arrtime; | 97 | return this._$_arrtime; |
| 87 | }; | 98 | }; |
| 88 | /** | 99 | /** |
| 100 | + * 设置到达时间。 | ||
| 101 | + * @param oTime | ||
| 102 | + */ | ||
| 103 | +InternalBcObj.prototype.setArrTimeObj = function(oTime) { | ||
| 104 | + this._$_arrtime = oTime; | ||
| 105 | +}; | ||
| 106 | +/** | ||
| 89 | * 获取班次时间。 | 107 | * 获取班次时间。 |
| 90 | * @returns int | 108 | * @returns int |
| 91 | */ | 109 | */ |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
| @@ -12,11 +12,6 @@ var InternalLpObj = function( | @@ -12,11 +12,6 @@ var InternalLpObj = function( | ||
| 12 | 12 | ||
| 13 | this._$_isUp = isUp; | 13 | this._$_isUp = isUp; |
| 14 | 14 | ||
| 15 | - // 距离上一个路牌的最小发车间隔时间 | ||
| 16 | - // 用于纵向添加班次的时候使用 | ||
| 17 | - // 默认第一个路牌为0 | ||
| 18 | - this._$_minVerticalIntervalTime = 0; | ||
| 19 | - | ||
| 20 | // 路牌的圈数,注意每个路牌的圈数都是一致的, | 15 | // 路牌的圈数,注意每个路牌的圈数都是一致的, |
| 21 | // 但并不是每一圈都有值 | 16 | // 但并不是每一圈都有值 |
| 22 | // 第1圈从上标线开始 | 17 | // 第1圈从上标线开始 |
| @@ -32,7 +27,23 @@ var InternalLpObj = function( | @@ -32,7 +27,23 @@ var InternalLpObj = function( | ||
| 32 | this, this._$_isUp, undefined, undefined); | 27 | this, this._$_isUp, undefined, undefined); |
| 33 | } | 28 | } |
| 34 | 29 | ||
| 35 | - // 班型的相关变量 | 30 | + // 距离上一个路牌的最小发车间隔时间 |
| 31 | + // 用于纵向添加班次的时候使用 | ||
| 32 | + // 默认第一个路牌为0 | ||
| 33 | + this._$_minVerticalIntervalTime = 0; | ||
| 34 | + | ||
| 35 | + // 详细记录每圈每个方向上的发车间隔时间 | ||
| 36 | + // 第一维度表示圈数,第二维度表示第一个方向,第二个方向 | ||
| 37 | + // 第一个方向是否上行由 _$_isUp 决定 | ||
| 38 | + // 这里的间隔表示下一个路牌上的班次距离本路牌的班次发车时间间隔 | ||
| 39 | + // 如果当前是最后一个路牌,表示第一个路牌的下一圈同方向班次距离本班次的间隔 | ||
| 40 | + this._$_aVerticalIntervalTime = new Array(this._$_qCount); | ||
| 41 | + var i; | ||
| 42 | + for (i = 0; i < this._$_aVerticalIntervalTime.length; i++) { | ||
| 43 | + this._$_aVerticalIntervalTime[i] = new Array(2); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + // 班型的相关变量 | ||
| 36 | this._$_bx_isLb = false; // 是否连班 | 47 | this._$_bx_isLb = false; // 是否连班 |
| 37 | this._$_bx_isfb = false; // 是否分班 | 48 | this._$_bx_isfb = false; // 是否分班 |
| 38 | this._$_bx_isfb_5_2 = false; // 是否5休2分班 | 49 | this._$_bx_isfb_5_2 = false; // 是否5休2分班 |
| @@ -171,6 +182,25 @@ InternalLpObj.prototype.getVerticalMinIntervalTime = function() { | @@ -171,6 +182,25 @@ InternalLpObj.prototype.getVerticalMinIntervalTime = function() { | ||
| 171 | return this._$_minVerticalIntervalTime; | 182 | return this._$_minVerticalIntervalTime; |
| 172 | }; | 183 | }; |
| 173 | 184 | ||
| 185 | +/** | ||
| 186 | + * 设置纵向发车间隔。 | ||
| 187 | + * @param iQindex 圈index | ||
| 188 | + * @param iBindex 班次index | ||
| 189 | + * @param iTime 间隔时间 | ||
| 190 | + */ | ||
| 191 | +InternalLpObj.prototype.fnSetVerticalIntervalTime = function(iQindex, iBindex, iTime) { | ||
| 192 | + this._$_aVerticalIntervalTime[iQindex][iBindex] = iTime; | ||
| 193 | +}; | ||
| 194 | + | ||
| 195 | +/** | ||
| 196 | + * 返回纵向发车间隔。 | ||
| 197 | + * @param iQindex 圈index | ||
| 198 | + * @param iBindex 班次index | ||
| 199 | + */ | ||
| 200 | +InternalLpObj.prototype.fnGetVerticalIntervalTime = function(iQindex, iBindex) { | ||
| 201 | + return this._$_aVerticalIntervalTime[iQindex][iBindex]; | ||
| 202 | +}; | ||
| 203 | + | ||
| 174 | //-------------------- 班次操作方法(查询,统计,删除) -----------------------// | 204 | //-------------------- 班次操作方法(查询,统计,删除) -----------------------// |
| 175 | 205 | ||
| 176 | /** | 206 | /** |
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
| @@ -25,7 +25,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -25,7 +25,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 25 | {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0} | 25 | {'sType':'无工休', 'fHoursV':5.43, 'fBcCount': 0, 'fAverTime': 0} |
| 26 | ]; | 26 | ]; |
| 27 | 27 | ||
| 28 | - var _initFun1 = function() { // 初始化方法1 | 28 | + var _fnInitFun1 = function() { // 初始化方法1 |
| 29 | + console.log("//---------------- 行车计划,初始化方法1 start ----------------//"); | ||
| 29 | 30 | ||
| 30 | //----------------------- 1、确定上标线的方向,圈的方向 -------------------// | 31 | //----------------------- 1、确定上标线的方向,圈的方向 -------------------// |
| 31 | 32 | ||
| @@ -57,7 +58,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -57,7 +58,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 57 | var _kssj = st; // 开始时间 | 58 | var _kssj = st; // 开始时间 |
| 58 | var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时 | 59 | var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时 |
| 59 | var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间 | 60 | var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间 |
| 60 | - var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp); // 停站时间 | 61 | + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); // 停站时间 |
| 61 | 62 | ||
| 62 | do { | 63 | do { |
| 63 | bcFcsjArrays.push(_kssj); | 64 | bcFcsjArrays.push(_kssj); |
| @@ -66,7 +67,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -66,7 +67,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 66 | _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime); | 67 | _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime); |
| 67 | _bcsj = paramObj.calcuTravelTime(_kssj, isUp); | 68 | _bcsj = paramObj.calcuTravelTime(_kssj, isUp); |
| 68 | _arrsj = paramObj.addMinute(_kssj, _bcsj); | 69 | _arrsj = paramObj.addMinute(_kssj, _bcsj); |
| 69 | - _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp); | 70 | + _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); |
| 70 | 71 | ||
| 71 | bcCount ++; | 72 | bcCount ++; |
| 72 | isUp = !isUp; | 73 | isUp = !isUp; |
| @@ -135,8 +136,71 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -135,8 +136,71 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 135 | _aBxDesc[i].fBcCount = ((_aBxDesc[i].fHoursV * 60) / _aBxDesc[i].fAverTime) * 2; | 136 | _aBxDesc[i].fBcCount = ((_aBxDesc[i].fHoursV * 60) / _aBxDesc[i].fAverTime) * 2; |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 139 | + // 在第一个班次之前再添加一个模拟班次,用于中标线的作用 | ||
| 140 | + // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除 | ||
| 141 | + var iFirstStopTime = | ||
| 142 | + _paramObj.fnCalcuFixedStopNumber( | ||
| 143 | + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -10), | ||
| 144 | + _qIsUp | ||
| 145 | + ); | ||
| 146 | + var iXXTime = _qIsUp ? _paramObj.getDownTroughTime() : _paramObj.getUpTroughTime(); | ||
| 147 | + var oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 148 | + _internalLpArray[0], | ||
| 149 | + "normal", | ||
| 150 | + !_qIsUp, | ||
| 151 | + 1, | ||
| 152 | + _paramObj.addMinute(aBcArray[0].getFcTimeObj(), -(iFirstStopTime + iXXTime)), | ||
| 153 | + _paramObj | ||
| 154 | + ); | ||
| 155 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 156 | + | ||
| 157 | + _internalLpArray[0].setBc(0, 1, oFlagBc); | ||
| 158 | + | ||
| 159 | + // 在最后一圈也补上一个或者2个模拟班次,暂时标记,最后需要删除 | ||
| 160 | + var aMaxBcIndex = _internalLpArray[0].getMaxBcObjPosition(); | ||
| 161 | + if (aMaxBcIndex[0] == _qCount - 1) { // 可能加半圈 | ||
| 162 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 163 | + _internalLpArray[0], | ||
| 164 | + "normal", | ||
| 165 | + !_qIsUp, | ||
| 166 | + 1, | ||
| 167 | + _paramObj.addMinute( | ||
| 168 | + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 169 | + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 170 | + _paramObj | ||
| 171 | + ); | ||
| 172 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 173 | + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 174 | + | ||
| 175 | + } else { // 加完整的一圈 | ||
| 176 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 177 | + _internalLpArray[0], | ||
| 178 | + "normal", | ||
| 179 | + _qIsUp, | ||
| 180 | + 1, | ||
| 181 | + _paramObj.addMinute( | ||
| 182 | + _internalLpArray[0].getBc(_qCount - 2, 1).getArrTimeObj(), | ||
| 183 | + _internalLpArray[0].getBc(_qCount - 2, 1).getStopTime()), | ||
| 184 | + _paramObj | ||
| 185 | + ); | ||
| 186 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 187 | + _internalLpArray[0].setBc(_qCount - 1, 0, oFlagBc); | ||
| 188 | + | ||
| 189 | + oFlagBc = _factory.createBcObj( // 标记班次 | ||
| 190 | + _internalLpArray[0], | ||
| 191 | + "normal", | ||
| 192 | + !_qIsUp, | ||
| 193 | + 1, | ||
| 194 | + _paramObj.addMinute( | ||
| 195 | + _internalLpArray[0].getBc(_qCount - 1, 0).getArrTimeObj(), | ||
| 196 | + _internalLpArray[0].getBc(_qCount - 1, 0).getStopTime()), | ||
| 197 | + _paramObj | ||
| 198 | + ); | ||
| 199 | + oFlagBc.fnSetDelFlag(true); // 标记了删除记号 | ||
| 200 | + _internalLpArray[0].setBc(_qCount - 1, 1, oFlagBc); | ||
| 201 | + | ||
| 202 | + } | ||
| 138 | 203 | ||
| 139 | - console.log("//---------------- 行车计划,初始化方法1 start ----------------//"); | ||
| 140 | console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") + | 204 | console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") + |
| 141 | "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm")); | 205 | "上行末班车时间:" + _paramObj.getUpLastDtimeObj().format("HH:mm")); |
| 142 | console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") + | 206 | console.log("下行首班车时间:" + _paramObj.getDownFirstDTimeObj().format("HH:mm") + |
| @@ -145,6 +209,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -145,6 +209,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 145 | console.log("圈的方向isUP:" + _qIsUp); | 209 | console.log("圈的方向isUP:" + _qIsUp); |
| 146 | console.log("班型描述(以下):"); | 210 | console.log("班型描述(以下):"); |
| 147 | console.log(_aBxDesc); | 211 | console.log(_aBxDesc); |
| 212 | + console.log("所有路牌间隔描述(以下):"); | ||
| 213 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 214 | + console.log(_internalLpArray[i]._$_aVerticalIntervalTime); | ||
| 215 | + } | ||
| 148 | console.log("//---------------- 行车计划,初始化方法1 end ----------------//"); | 216 | console.log("//---------------- 行车计划,初始化方法1 end ----------------//"); |
| 149 | 217 | ||
| 150 | }; | 218 | }; |
| @@ -155,12 +223,57 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -155,12 +223,57 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 155 | var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出 | 223 | var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出 |
| 156 | var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行) | 224 | var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行) |
| 157 | 225 | ||
| 158 | - // 同一圈同一方向班次发车间隔的最小值 | ||
| 159 | - // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明 | ||
| 160 | - var _qbcMinIntervalValue; | 226 | + var _fnInitFun2 = function() { // 初始化方法2 |
| 227 | + console.log("//---------------- 行车计划,初始化方法2 start ----------------//"); | ||
| 228 | + | ||
| 229 | + //------------------------ 1、计算车辆总数 ------------------------// | ||
| 230 | + // 是用高峰上行周转时间除以高峰平均间隔得到的 | ||
| 231 | + // 这样算还算合理,车辆不多不少,待以后有新的算法再修正 | ||
| 232 | + var iClCount = _paramObj.calcuClzx(); | ||
| 161 | 233 | ||
| 162 | - var _initFun2 = function() { // 初始化方法2 | ||
| 163 | - //------------------------ 1、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | 234 | + //------------------------ 2、计算所有路牌的发车在各个圈中的间隔 --------------------// |
| 235 | + var i; | ||
| 236 | + var j; | ||
| 237 | + var iBindex = 1; | ||
| 238 | + var iZzsj; | ||
| 239 | + var oLp; | ||
| 240 | + var iC1; | ||
| 241 | + var iC2; | ||
| 242 | + | ||
| 243 | + for (i = 0; i < _qCount - 1; i++) { | ||
| 244 | + while (iBindex <= 1) { | ||
| 245 | + // 每圈每个方向的周转时间不一致,以上标线为主 | ||
| 246 | + oLp = _internalLpArray[0]; | ||
| 247 | + iZzsj = oLp.getBc(i + 1, iBindex).getFcTimeObj().diff( | ||
| 248 | + oLp.getBc(i, iBindex).getFcTimeObj(), "m" | ||
| 249 | + ); | ||
| 250 | + | ||
| 251 | + iC1 = Math.floor(iZzsj / iClCount); | ||
| 252 | + iC2 = iZzsj % iClCount; | ||
| 253 | + | ||
| 254 | + for (j = 0; j < iClCount - iC2; j++) { | ||
| 255 | + oLp = _internalLpArray[j]; | ||
| 256 | + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1); | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + for (j = 0; j < iC2; j++) { | ||
| 260 | + oLp = _internalLpArray[iClCount - iC2 + j]; | ||
| 261 | + oLp.fnSetVerticalIntervalTime(i, iBindex, iC1 + 1); | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + iBindex ++; | ||
| 265 | + | ||
| 266 | + } | ||
| 267 | + iBindex = 0; | ||
| 268 | + } | ||
| 269 | + // 最后一圈没有下一圈的参照,周转时间没发获取,由于都是低谷,所以使用倒数第二圈的间隔最为最后一圈的间隔 | ||
| 270 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 271 | + oLp = _internalLpArray[i]; | ||
| 272 | + oLp.fnSetVerticalIntervalTime(_qCount - 1, 0, oLp.fnGetVerticalIntervalTime(_qCount - 2, 0)); | ||
| 273 | + oLp.fnSetVerticalIntervalTime(_qCount - 1, 1, oLp.fnGetVerticalIntervalTime(_qCount - 2, 1)); | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + //------------------------ 3、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | ||
| 164 | 277 | ||
| 165 | // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次 | 278 | // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次 |
| 166 | // 以这个班次为早高峰起点,全部出车策略 | 279 | // 以这个班次为早高峰起点,全部出车策略 |
| @@ -168,46 +281,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -168,46 +281,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 168 | _paramObj.getMPeakStartTimeObj(), true, true); | 281 | _paramObj.getMPeakStartTimeObj(), true, true); |
| 169 | var qIndex = qbcIndexArray[0]; // 第几圈 | 282 | var qIndex = qbcIndexArray[0]; // 第几圈 |
| 170 | var bIndex = qbcIndexArray[1]; // 第几个班次 | 283 | var bIndex = qbcIndexArray[1]; // 第几个班次 |
| 171 | - var startbc = _internalLpArray[0].getBc(qIndex, bIndex); | ||
| 172 | - | ||
| 173 | - // 计算早高峰 | ||
| 174 | - var _clCount = _paramObj.calcuClzx(); | ||
| 175 | - var _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount); | ||
| 176 | - var _c2 = _paramObj.calcuPeakZzsj() % _clCount; | ||
| 177 | - var _kssj = startbc.getFcTimeObj(); | ||
| 178 | 284 | ||
| 179 | - var i; | ||
| 180 | - for (i = 2; i <= _clCount - _c2; i++) { | ||
| 181 | - _kssj = _paramObj.addMinute(_kssj, _c1); | ||
| 182 | - _internalLpArray[i - 1].setBc( | ||
| 183 | - qIndex, | ||
| 184 | - bIndex, | ||
| 185 | - _factory.createBcObj( | ||
| 186 | - _internalLpArray[i - 1], | ||
| 187 | - "normal", startbc.isUp(), | ||
| 188 | - 1, _kssj, paramObj) | ||
| 189 | - ); | ||
| 190 | - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,不能整除的话,小的放在前面的路牌 | ||
| 191 | - _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1); | ||
| 192 | - } | ||
| 193 | - for (i = 1; i <= _c2; i++) { | ||
| 194 | - _kssj = _paramObj.addMinute(_kssj, _c1 + 1); | ||
| 195 | - _internalLpArray[_clCount - _c2 + i - 1].setBc( | ||
| 196 | - qIndex, | ||
| 197 | - bIndex, | ||
| 198 | - _factory.createBcObj( | ||
| 199 | - _internalLpArray[_clCount - _c2 + i - 1], | ||
| 200 | - "normal", startbc.isUp(), | ||
| 201 | - 1, _kssj, paramObj) | ||
| 202 | - ); | ||
| 203 | - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,,不能整除的话,大的放在后面的路牌 | ||
| 204 | - _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1 + 1); | 285 | + for (i = 1; i < _internalLpArray.length; i++) { |
| 286 | + _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 205 | } | 287 | } |
| 206 | 288 | ||
| 207 | _approximate_zgfQIndex = qIndex; | 289 | _approximate_zgfQIndex = qIndex; |
| 208 | _approximate_zgfBIndex = bIndex; | 290 | _approximate_zgfBIndex = bIndex; |
| 209 | 291 | ||
| 210 | - //------------------------ 2、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// | 292 | + //------------------------ 4、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------// |
| 211 | 293 | ||
| 212 | // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次 | 294 | // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次 |
| 213 | // 以这个班次为早高峰起点,全部出车策略 | 295 | // 以这个班次为早高峰起点,全部出车策略 |
| @@ -215,73 +297,163 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -215,73 +297,163 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 215 | _paramObj.getEPeakStartTimeObj(), true, true); | 297 | _paramObj.getEPeakStartTimeObj(), true, true); |
| 216 | qIndex = qbcIndexArray[0]; // 第几圈 | 298 | qIndex = qbcIndexArray[0]; // 第几圈 |
| 217 | bIndex = qbcIndexArray[1]; // 第几个班次 | 299 | bIndex = qbcIndexArray[1]; // 第几个班次 |
| 218 | - startbc = _internalLpArray[0].getBc(qIndex, bIndex); | ||
| 219 | - | ||
| 220 | - // 计算晚高峰 | ||
| 221 | - _clCount = _paramObj.calcuClzx(); | ||
| 222 | - _c1 = Math.floor(_paramObj.calcuPeakZzsj() / _clCount); | ||
| 223 | - _c2 = _paramObj.calcuPeakZzsj() % _clCount; | ||
| 224 | - _kssj = startbc.getFcTimeObj(); | ||
| 225 | - | ||
| 226 | - for (i = 2; i <= _clCount - _c2; i++) { | ||
| 227 | - _kssj = _paramObj.addMinute(_kssj, _c1); | ||
| 228 | - _internalLpArray[i - 1].setBc( | ||
| 229 | - qIndex, | ||
| 230 | - bIndex, | ||
| 231 | - _factory.createBcObj( | ||
| 232 | - _internalLpArray[i - 1], | ||
| 233 | - "normal", startbc.isUp(), | ||
| 234 | - 1, _kssj, _paramObj) | ||
| 235 | - ); | ||
| 236 | - } | ||
| 237 | - for (i = 1; i <= _c2; i++) { | ||
| 238 | - _kssj = _paramObj.addMinute(_kssj, _c1 + 1); | ||
| 239 | - _internalLpArray[_clCount - _c2 + i - 1].setBc( | ||
| 240 | - qIndex, | ||
| 241 | - bIndex, | ||
| 242 | - _factory.createBcObj( | ||
| 243 | - _internalLpArray[_clCount - _c2 + i - 1], | ||
| 244 | - "normal", startbc.isUp(), | ||
| 245 | - 1, _kssj, _paramObj) | ||
| 246 | - ); | 300 | + |
| 301 | + for (i = 1; i < _internalLpArray.length; i++) { | ||
| 302 | + _fnGenerateBcAndSetBc(i, qIndex, bIndex); | ||
| 247 | } | 303 | } |
| 248 | 304 | ||
| 249 | _approximate_wgfQIndex = qIndex; | 305 | _approximate_wgfQIndex = qIndex; |
| 250 | _approximate_wgfBIndex = bIndex; | 306 | _approximate_wgfBIndex = bIndex; |
| 251 | - _qbcMinIntervalValue = _c1; | ||
| 252 | 307 | ||
| 253 | - console.log("//---------------- 行车计划,初始化方法2 start ----------------//"); | ||
| 254 | console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟"); | 308 | console.log("早高峰周转时间(固定最大停战时间):" + _paramObj.calcuPeakZzsj() + "分钟"); |
| 255 | console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟"); | 309 | console.log("早高峰发车时间范围:" + _paramObj.getMPeakMinFcjx() + "分钟 --- " + _paramObj.getMPeakMaxFcjx() + "分钟"); |
| 256 | console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出"); | 310 | console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出"); |
| 257 | console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出"); | 311 | console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出"); |
| 258 | - console.log("预估同圈同方向班次最小间隔:" + _qbcMinIntervalValue + "分钟"); | ||
| 259 | console.log("//---------------- 行车计划,初始化方法2 end ----------------//"); | 312 | console.log("//---------------- 行车计划,初始化方法2 end ----------------//"); |
| 260 | }; | 313 | }; |
| 261 | 314 | ||
| 262 | - //----------------------- 初始化方法3,以及计算关联的内部变量 ----------------// | ||
| 263 | - var _zbx_lpIndex; // 中标线对应第几个路牌 | 315 | + //----------------------- 初始化方法3,计算连班分班的路牌分布 ----------------// |
| 316 | + var _iBx_lb_lpcount; // 连班路牌数 | ||
| 317 | + var _iBx_5_2_fb_lpcount; // 5休2分班路牌数 | ||
| 318 | + var _iBx_other_fb_lpcount; // 其他分班路牌数 | ||
| 264 | 319 | ||
| 265 | - var _initFun3 = function() { // 初始化方法3 | ||
| 266 | - //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------// | 320 | + var _fnInitFun3 = function() { // 初始化方法3 |
| 321 | + console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | ||
| 322 | + | ||
| 323 | + //--------------------- 1、计算分班连班班型车辆分布数 --------------------// | ||
| 324 | + // 总共车辆数(高峰最大车辆数) | ||
| 325 | + var iCls = _paramObj.calcuClzx(); | ||
| 326 | + // 低谷最少配车(连班车数量) | ||
| 327 | + var iDgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx()); | ||
| 328 | + // 加班车路牌数(做5休2的路牌数) | ||
| 329 | + var i_5_2_lpes = _paramObj.getJBLpes(); | ||
| 330 | + | ||
| 331 | + // 做些简单的验证 | ||
| 332 | + if (iCls < iDgminpc) { | ||
| 333 | + alert("总配车数小于低谷最小配车"); | ||
| 334 | + throw "总配车数小于低谷最小配车"; | ||
| 335 | + } | ||
| 336 | + if (iDgminpc < 2) { | ||
| 337 | + alert("连班路牌小于2,办不到啊"); | ||
| 338 | + throw "连班路牌小于2,办不到啊"; | ||
| 339 | + } | ||
| 340 | + if (iCls - iDgminpc < i_5_2_lpes) { | ||
| 341 | + alert("总分班路牌数小于加班路牌数"); | ||
| 342 | + throw "总分班路牌数小于加班路牌数"; | ||
| 343 | + } | ||
| 267 | 344 | ||
| 345 | + _iBx_lb_lpcount = iDgminpc; | ||
| 346 | + _iBx_5_2_fb_lpcount = i_5_2_lpes; | ||
| 347 | + _iBx_other_fb_lpcount = iCls - iDgminpc - i_5_2_lpes; | ||
| 348 | + | ||
| 349 | + //------------------------ 2、利用间隔法计算连班路牌分布 --------------------// | ||
| 350 | + var i; | ||
| 351 | + var j; | ||
| 352 | + var iC1 = Math.floor(_internalLpArray.length / _iBx_lb_lpcount); | ||
| 353 | + var iC2 = _internalLpArray.length % _iBx_lb_lpcount; | ||
| 354 | + var iLpIndex; | ||
| 355 | + | ||
| 356 | + for (i = 0; i < _iBx_lb_lpcount - iC2; i++) { | ||
| 357 | + iLpIndex = i * iC1; | ||
| 358 | + _internalLpArray[iLpIndex].setBxLb(true); | ||
| 359 | + _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 360 | + } | ||
| 361 | + for (j = 0; j < iC2; j++) { | ||
| 362 | + iLpIndex = i * iC1 + j * (iC1 + 1); | ||
| 363 | + _internalLpArray[iLpIndex].setBxLb(true); | ||
| 364 | + _internalLpArray[iLpIndex].setBxDesc("连班"); | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + //------------------------ 3、利用间隔法计算分班班型路牌分布 --------------------// | ||
| 368 | + // 获取分班路牌索引 | ||
| 369 | + var aNotLbIndexes = []; | ||
| 370 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 371 | + if (!_internalLpArray[i].isBxLb()) { | ||
| 372 | + aNotLbIndexes.push(i); | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + // 先5休2分班 | ||
| 376 | + iC1 = Math.floor(aNotLbIndexes.length / _iBx_5_2_fb_lpcount); | ||
| 377 | + iC2 = aNotLbIndexes.length % _iBx_5_2_fb_lpcount; | ||
| 378 | + | ||
| 379 | + for (i = 0; i < _iBx_5_2_fb_lpcount - iC2; i++) { | ||
| 380 | + iLpIndex = aNotLbIndexes[i * iC1]; | ||
| 381 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 382 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 383 | + _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 384 | + _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 385 | + } | ||
| 386 | + for (i = 0; i < iC2; i++) { | ||
| 387 | + iLpIndex = aNotLbIndexes[_iBx_lb_lpcount - iC2 + i * (iC1 + 1)]; | ||
| 388 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 389 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 390 | + _internalLpArray[iLpIndex].setBxFb5_2(true); | ||
| 391 | + _internalLpArray[iLpIndex].setBxDesc("5休2分班"); | ||
| 392 | + } | ||
| 393 | + // 其他分班 | ||
| 394 | + for (i = 0; i < aNotLbIndexes.length; i++) { | ||
| 395 | + iLpIndex = aNotLbIndexes[i]; | ||
| 396 | + if (!_internalLpArray[iLpIndex].isBxFb5_2()) { | ||
| 397 | + _internalLpArray[iLpIndex].setBxLb(false); | ||
| 398 | + _internalLpArray[iLpIndex].setBxFb(true); | ||
| 399 | + _internalLpArray[iLpIndex].setBxFb5_2(false); | ||
| 400 | + _internalLpArray[iLpIndex].setBxDesc("其他分班"); | ||
| 401 | + } | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + | ||
| 405 | + console.log("连班路牌数:" + _iBx_lb_lpcount); | ||
| 406 | + console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount); | ||
| 407 | + console.log("其他分班路牌数:" + _iBx_other_fb_lpcount); | ||
| 408 | + var aLbIndexes = []; | ||
| 409 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 410 | + if (_internalLpArray[i].isBxLb()) { | ||
| 411 | + aLbIndexes.push(i); | ||
| 412 | + } | ||
| 413 | + } | ||
| 414 | + console.log("连班路牌indexes=" + aLbIndexes); | ||
| 415 | + var a_5_2_fbIndexes = []; | ||
| 416 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 417 | + if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) { | ||
| 418 | + a_5_2_fbIndexes.push(i); | ||
| 419 | + } | ||
| 420 | + } | ||
| 421 | + console.log("5休2分班路牌indexes=" + a_5_2_fbIndexes); | ||
| 422 | + var a_other_fbIndexes = []; | ||
| 423 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 424 | + if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) { | ||
| 425 | + a_other_fbIndexes.push(i); | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + console.log("其他分班路牌indexes=" + a_other_fbIndexes); | ||
| 429 | + | ||
| 430 | + console.log("//---------------- 行车计划,初始化方法3 end ----------------//"); | ||
| 431 | + }; | ||
| 432 | + | ||
| 433 | + //----------------------- 初始化方法4,计算中标线位置 -------------------------// | ||
| 434 | + var _iZbx_lpIndex; // 中标线对应第几个路牌 | ||
| 435 | + | ||
| 436 | + var _fnInitFun4 = function() { // 初始化方法4 | ||
| 437 | + console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | ||
| 438 | + | ||
| 439 | + //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------// | ||
| 268 | // 构造中标线 | 440 | // 构造中标线 |
| 269 | // 中标线开始时间,就是方向的首班车时间 | 441 | // 中标线开始时间,就是方向的首班车时间 |
| 270 | - var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); | 442 | + var oSt = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); |
| 271 | // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | 443 | // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 |
| 272 | // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 | 444 | // 上标线结束时间,使用最晚的末班车时间,结束时间的班次方向 |
| 273 | - var et; | 445 | + var oEt; |
| 274 | if (_paramObj.getUpLastDtimeObj().isBefore( | 446 | if (_paramObj.getUpLastDtimeObj().isBefore( |
| 275 | _paramObj.getDownLastDTimeObj())) { | 447 | _paramObj.getDownLastDTimeObj())) { |
| 276 | - et = _paramObj.getDownLastDTimeObj(); | 448 | + oEt = _paramObj.getDownLastDTimeObj(); |
| 277 | } else { | 449 | } else { |
| 278 | - et = _paramObj.getUpLastDtimeObj(); | 450 | + oEt = _paramObj.getUpLastDtimeObj(); |
| 279 | } | 451 | } |
| 280 | 452 | ||
| 281 | - var tempLpObj = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp); | ||
| 282 | - tempLpObj.initDataFromTimeToTime( | ||
| 283 | - st, | ||
| 284 | - et, | 453 | + var oTempLp = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp); |
| 454 | + oTempLp.initDataFromTimeToTime( | ||
| 455 | + oSt, | ||
| 456 | + oEt, | ||
| 285 | !_qIsUp, | 457 | !_qIsUp, |
| 286 | 0, | 458 | 0, |
| 287 | _paramObj, | 459 | _paramObj, |
| @@ -289,109 +461,125 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -289,109 +461,125 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 289 | ); | 461 | ); |
| 290 | 462 | ||
| 291 | //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------// | 463 | //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------// |
| 292 | - // TODO:中标线的早高峰发车班次,和插入位置的早高分班次的时间会有误差的 | ||
| 293 | - // TODO:这里是直接把中标线班次覆盖,没有根据误差调整,以后改 | ||
| 294 | - | ||
| 295 | // 找出中标线对应的早高峰的班次对象 | 464 | // 找出中标线对应的早高峰的班次对象 |
| 296 | - var _zb_bcobj = tempLpObj.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); | 465 | + var oZb_gf_bc = oTempLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); |
| 297 | 466 | ||
| 298 | - // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌 | ||
| 299 | - var _tempq_array = []; | ||
| 300 | - var _temp_group; | ||
| 301 | - var _temp_bc; | 467 | + // 把所有连班路牌高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌 |
| 468 | + // 中标线和上标线一样在连班路牌上 | ||
| 469 | + var aTempq = []; | ||
| 470 | + var oTempq; | ||
| 471 | + var oTempb; | ||
| 302 | var i; | 472 | var i; |
| 473 | + var oLp; | ||
| 474 | + | ||
| 475 | + var aLbIndexes = []; // 连班的路牌索引 | ||
| 303 | for (i = 0; i < _internalLpArray.length; i++) { | 476 | for (i = 0; i < _internalLpArray.length; i++) { |
| 304 | - _temp_bc = _internalLpArray[i].getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); | ||
| 305 | - if (_temp_bc.isUp() == _qIsUp) { | ||
| 306 | - _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, _temp_bc, undefined); | 477 | + if (_internalLpArray[i].isBxLb()) { |
| 478 | + aLbIndexes.push(i); | ||
| 479 | + } | ||
| 480 | + } | ||
| 481 | + | ||
| 482 | + for (i = 0; i < aLbIndexes.length; i++) { | ||
| 483 | + oLp = _internalLpArray[aLbIndexes[i]]; | ||
| 484 | + | ||
| 485 | + oTempb = oLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex); | ||
| 486 | + if (oTempb.isUp() == _qIsUp) { | ||
| 487 | + oTempq = new InternalGroupObj(oLp, _qIsUp, oTempb, undefined); | ||
| 307 | } else { | 488 | } else { |
| 308 | - _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, undefined, _temp_bc); | 489 | + oTempq = new InternalGroupObj(oLp, _qIsUp, undefined, oTempb); |
| 309 | } | 490 | } |
| 310 | - _tempq_array.push(_temp_group); | 491 | + aTempq.push(oTempq); |
| 492 | + | ||
| 311 | } | 493 | } |
| 312 | 494 | ||
| 313 | - var _ttindex_ = tempLpObj.getgetQBcIndexWithFcTimeFromGroupArray( | ||
| 314 | - _zb_bcobj.getFcTimeObj(), | ||
| 315 | - _tempq_array, | 495 | + var aTtindex = oTempLp.getgetQBcIndexWithFcTimeFromGroupArray( |
| 496 | + oZb_gf_bc.getFcTimeObj(), | ||
| 497 | + aTempq, | ||
| 316 | true, | 498 | true, |
| 317 | true | 499 | true |
| 318 | ); | 500 | ); |
| 319 | - _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌 | ||
| 320 | - tempLpObj.setLp(_lpArray[_zbx_lpIndex]); // 设置原始路牌对象 | ||
| 321 | - tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔 | ||
| 322 | - _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime() | ||
| 323 | - ); | ||
| 324 | 501 | ||
| 325 | - // 注意:因为中标线很横向创建的,而高峰的替换路牌的班次班次是纵向间隔创建的 | ||
| 326 | - // 做法1:直接把中标线数据替换到指定路牌位置 | ||
| 327 | - // TODO:由初始化方法1,初始化方法2得到的2个高峰的班次会被中标线对应班次覆盖 | ||
| 328 | - // TODO:目前使用中标线的班次覆盖,以后相互动态调整 | ||
| 329 | - // _internalLpArray[_zbx_lpIndex] = tempLpObj; | 502 | + _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌 |
| 503 | + oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象 | ||
| 504 | + oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔 | ||
| 505 | + oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb()); | ||
| 506 | + oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb()); | ||
| 507 | + oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2()); | ||
| 330 | 508 | ||
| 331 | - // 做法2:将中标线除头班次外所有班次用间隔法重新创建替换 | ||
| 332 | - var iTempIndex = 0; | 509 | + // 修正除了第一个班次外,其余其他班次 |
| 510 | + var iBcindex = 0; | ||
| 333 | for (i = 1; i < _qCount; i++) { | 511 | for (i = 1; i < _qCount; i++) { |
| 334 | - while (iTempIndex <= 1) { | ||
| 335 | - _temp_bc = tempLpObj.getBc(i, iTempIndex); | ||
| 336 | - if (_temp_bc) { // 中标线存在此路牌,才替换 | ||
| 337 | - tempLpObj.setBc( | ||
| 338 | - i, iTempIndex, | ||
| 339 | - _generateBc(_zbx_lpIndex, i , iTempIndex) | ||
| 340 | - ); | 512 | + while (iBcindex <= 1) { |
| 513 | + if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次 | ||
| 514 | + oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex)); | ||
| 341 | } | 515 | } |
| 342 | - | ||
| 343 | - iTempIndex ++; | 516 | + iBcindex ++; |
| 344 | } | 517 | } |
| 345 | - iTempIndex = 0; | ||
| 346 | - | 518 | + iBcindex = 0; |
| 347 | } | 519 | } |
| 348 | - _internalLpArray[_zbx_lpIndex] = tempLpObj; | ||
| 349 | 520 | ||
| 350 | - console.log("//---------------- 行车计划,初始化方法3 start ----------------//"); | ||
| 351 | - console.log("中标线对应第" + (_zbx_lpIndex + 1) + "个路牌"); | ||
| 352 | - console.log("//---------------- 行车计划,初始化方法3 end ----------------//"); | 521 | + _internalLpArray[_iZbx_lpIndex] = oTempLp; |
| 353 | 522 | ||
| 354 | - }; | 523 | + console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌"); |
| 355 | 524 | ||
| 356 | - //----------------------- 初始化方法4,以及计算关联的内部变量 ----------------// | ||
| 357 | - var _bx_lb_lpcount; // 连班路牌数 | ||
| 358 | - var _bx_5_2_fb_lpcount; // 5休2分班路牌数 | ||
| 359 | - var _bx_other_fb_lpcount; // 其他分班路牌数 | 525 | + console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); |
| 526 | + }; | ||
| 360 | 527 | ||
| 361 | - var _initFun4 = function() { // 初始化方法4 | ||
| 362 | - // 总共车辆数(高峰最大车辆数) | ||
| 363 | - var cls = _paramObj.calcuClzx(); | ||
| 364 | - // 低谷最少配车(连班车数量) | ||
| 365 | - var dgminpc = Math.round(_paramObj.calcuTroughZzsj() / _paramObj.getTroughMaxFcjx()); | ||
| 366 | - // 加班车路牌数(做5休2的路牌数) | ||
| 367 | - var _5_2_lpes = _paramObj.getJBLpes(); | 528 | + //-------------------- 重要的内部方法 -----------------------// |
| 529 | + /** | ||
| 530 | + * 核心方法,利用路牌间隔纵向生成班次。 | ||
| 531 | + * @param iLpindex 路牌索引 | ||
| 532 | + * @param iQindex 圈索引 | ||
| 533 | + * @param iBcindex 班次索引 | ||
| 534 | + * @returns object InternalBcObj,失败 false | ||
| 535 | + */ | ||
| 536 | + var _fnGenerateBc = function(iLpindex, iQindex, iBcindex) { | ||
| 537 | + // 以上标线为起始点,使用路牌在不同圈,班次索引的发车间隔,计算班次 | ||
| 538 | + // 注意,发车间隔是指下一个班次应该距离当前班次间隔,是从下往上的 | ||
| 368 | 539 | ||
| 369 | - // 做些简单的验证 | ||
| 370 | - if (cls < dgminpc) { | ||
| 371 | - alert("总配车数小于低谷最小配车"); | ||
| 372 | - throw "总配车数小于低谷最小配车"; | 540 | + // 1、参数验证 |
| 541 | + if (iLpindex == 0) { // 上标线的班次不需要生成 | ||
| 542 | + return false; | ||
| 373 | } | 543 | } |
| 374 | - if (dgminpc < 2) { | ||
| 375 | - alert("连班路牌小于2,办不到啊"); | ||
| 376 | - throw "连班路牌小于2,办不到啊"; | 544 | + |
| 545 | + // 2、计算间隔 | ||
| 546 | + var i; | ||
| 547 | + var oLp; | ||
| 548 | + var iTime = 0; | ||
| 549 | + for (i = 0; i < iLpindex; i++) { | ||
| 550 | + oLp = _internalLpArray[i]; | ||
| 551 | + iTime += oLp.fnGetVerticalIntervalTime(iQindex, iBcindex); | ||
| 377 | } | 552 | } |
| 378 | - if (cls - dgminpc < _5_2_lpes) { | ||
| 379 | - alert("总分班路牌数小于加班路牌数"); | ||
| 380 | - throw "总分班路牌数小于加班路牌数"; | 553 | + |
| 554 | + // 3、生成班次 | ||
| 555 | + var _oKsbc = _internalLpArray[0].getBc(iQindex, iBcindex); | ||
| 556 | + if (!_oKsbc) { | ||
| 557 | + return false; | ||
| 381 | } | 558 | } |
| 559 | + var _oKssj = _paramObj.addMinute(_oKsbc.getFcTimeObj(), iTime); | ||
| 560 | + var _oBc = _factory.createBcObj( | ||
| 561 | + _internalLpArray[iLpindex], | ||
| 562 | + "normal", _oKsbc.isUp(), | ||
| 563 | + 1, _oKssj, _paramObj); | ||
| 382 | 564 | ||
| 383 | - _bx_lb_lpcount = dgminpc; | ||
| 384 | - _bx_5_2_fb_lpcount = _5_2_lpes; | ||
| 385 | - _bx_other_fb_lpcount = cls - dgminpc - _5_2_lpes; | 565 | + return _oBc; |
| 386 | 566 | ||
| 387 | - console.log("//---------------- 行车计划,初始化方法4 start ----------------//"); | ||
| 388 | - console.log("连班路牌数:" + _bx_lb_lpcount); | ||
| 389 | - console.log("5休2分班路牌数:" + _bx_5_2_fb_lpcount); | ||
| 390 | - console.log("其他分班路牌数:" + _bx_other_fb_lpcount); | ||
| 391 | - console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); | ||
| 392 | }; | 567 | }; |
| 393 | 568 | ||
| 394 | - //-------------------- 重要的内部方法 -----------------------// | 569 | + /** |
| 570 | + * 核心方法,在指定位置生成班次并添加到路牌指定位置中。 | ||
| 571 | + * @param lpIndex 第几个路牌 | ||
| 572 | + * @param qIndex 第几圈 | ||
| 573 | + * @param bcIndex 第几个班次 | ||
| 574 | + */ | ||
| 575 | + var _fnGenerateBcAndSetBc = function(lpIndex, qIndex, bcIndex) { | ||
| 576 | + var _bcObj = _fnGenerateBc(lpIndex, qIndex, bcIndex); | ||
| 577 | + if (_bcObj) { | ||
| 578 | + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj); | ||
| 579 | + } | ||
| 580 | + }; | ||
| 581 | + | ||
| 582 | + | ||
| 395 | /** | 583 | /** |
| 396 | * 在指定位置生成班次(内部重要方法)。 | 584 | * 在指定位置生成班次(内部重要方法)。 |
| 397 | * @param lpIndex 第几个路牌 | 585 | * @param lpIndex 第几个路牌 |
| @@ -594,15 +782,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -594,15 +782,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 594 | /** | 782 | /** |
| 595 | * 初始化数据,使用标线初始化 | 783 | * 初始化数据,使用标线初始化 |
| 596 | */ | 784 | */ |
| 597 | - initDataWithBxLayout: function() { | 785 | + fnInitDataWithBxLayout: function() { |
| 598 | // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中 | 786 | // 初始化布局1,构造上标线,计算圈数,把上标线数据放入第一个路牌中 |
| 599 | - _initFun1(); | ||
| 600 | - // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次 | ||
| 601 | - _initFun2(); | ||
| 602 | - // 初始化布局3,构造中标线,根据高峰班次,将中标线放入合适的路牌中 | ||
| 603 | - _initFun3(); | ||
| 604 | - // 初始化4,计算连班,分班相关路牌数 | ||
| 605 | - _initFun4(); | 787 | + _fnInitFun1(); |
| 788 | + // 初始化布局2,从上标线的某个班次开始,构造所有路牌的早高峰班次,晚高峰班次,计算路牌在各个圈中的间隔 | ||
| 789 | + _fnInitFun2(); | ||
| 790 | + // 初始化布局3,计算连班分班路牌分布 | ||
| 791 | + _fnInitFun3(); | ||
| 792 | + // 初始化布局4,计算中标线位置 | ||
| 793 | + _fnInitFun4(); | ||
| 606 | 794 | ||
| 607 | }, | 795 | }, |
| 608 | 796 | ||
| @@ -614,75 +802,75 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -614,75 +802,75 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 614 | * @param isZgf 是否早高峰 | 802 | * @param isZgf 是否早高峰 |
| 615 | * @param isUp 是否上行 | 803 | * @param isUp 是否上行 |
| 616 | */ | 804 | */ |
| 617 | - adjustGfbc : function(isZgf, isUp) { | ||
| 618 | - var startTime; // 开始时间 | ||
| 619 | - var endTime; // 结束时间 | ||
| 620 | - var startBcIndex; // 开始班次索引 | ||
| 621 | - var endBcIndex; // 结束班次索引 | ||
| 622 | - | ||
| 623 | - startTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj(); | ||
| 624 | - endTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj(); | ||
| 625 | - | ||
| 626 | - startBcIndex = _findUpClosedBcIndexWithTime(startTime, isUp); | ||
| 627 | - endBcIndex = _findDownClosedBcIndexWithTime(endTime, isUp); | ||
| 628 | - | ||
| 629 | - var _lpIndex; | ||
| 630 | - var _qIndex; | ||
| 631 | - var _bcIndex; | ||
| 632 | - var _qInternelCount; // 高峰时间段中间包含的圈数 | 805 | + fnAdjustGfbc : function(isZgf, isUp) { |
| 806 | + var oStartTime; // 开始时间 | ||
| 807 | + var oEndTime; // 结束时间 | ||
| 808 | + var iStartBcIndex; // 开始班次索引 | ||
| 809 | + var iEndBcIndex; // 结束班次索引 | ||
| 810 | + | ||
| 811 | + oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj(); | ||
| 812 | + oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj(); | ||
| 813 | + | ||
| 814 | + aStartBcIndex = _findUpClosedBcIndexWithTime(oStartTime, isUp); | ||
| 815 | + aEndBcIndex = _findDownClosedBcIndexWithTime(oEndTime, isUp); | ||
| 816 | + | ||
| 817 | + var iLpIndex; | ||
| 818 | + var iQIndex; | ||
| 819 | + var iBcIndex; | ||
| 820 | + var iQInternelCount; // 高峰时间段中间包含的圈数 | ||
| 633 | var i; | 821 | var i; |
| 634 | var j; | 822 | var j; |
| 635 | 823 | ||
| 636 | - var _lp; | 824 | + var oLp; |
| 637 | 825 | ||
| 638 | - if (startBcIndex && endBcIndex) { | ||
| 639 | - _lpIndex = startBcIndex[0]; | ||
| 640 | - _qIndex = startBcIndex[1]; | ||
| 641 | - _bcIndex = startBcIndex[2]; | 826 | + if (aStartBcIndex && aEndBcIndex) { |
| 827 | + iLpIndex = aStartBcIndex[0]; | ||
| 828 | + iQIndex = aStartBcIndex[1]; | ||
| 829 | + iBcIndex = aStartBcIndex[2]; | ||
| 642 | 830 | ||
| 643 | // 处理头 | 831 | // 处理头 |
| 644 | // 删除头部多余班次 | 832 | // 删除头部多余班次 |
| 645 | - for (j = 0; j < _lpIndex; j++) { | ||
| 646 | - _lp = _internalLpArray[j]; | ||
| 647 | - if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) { | ||
| 648 | - _lp.removeBc(_qIndex, _bcIndex); | 833 | + for (j = 0; j < iLpIndex; j++) { |
| 834 | + oLp = _internalLpArray[j]; | ||
| 835 | + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 836 | + oLp.removeBc(iQIndex, iBcIndex); | ||
| 649 | } | 837 | } |
| 650 | } | 838 | } |
| 651 | 839 | ||
| 652 | - for (j = _lpIndex; j < _internalLpArray.length; j++) { | ||
| 653 | - _lp = _internalLpArray[j]; | ||
| 654 | - if (!_lp.getBc(_qIndex, _bcIndex)) { | ||
| 655 | - _generateBcAndSetBc(j, _qIndex, _bcIndex); | 840 | + for (j = iLpIndex; j < _internalLpArray.length; j++) { |
| 841 | + oLp = _internalLpArray[j]; | ||
| 842 | + if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 843 | + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 656 | } | 844 | } |
| 657 | } | 845 | } |
| 658 | 846 | ||
| 659 | // 处理中间 | 847 | // 处理中间 |
| 660 | - _qInternelCount = endBcIndex[1] - startBcIndex[1] - 1; | ||
| 661 | - for (i = 1; i <= _qInternelCount; i++) { | ||
| 662 | - _lp = _internalLpArray[_qIndex + i]; | ||
| 663 | - if (!_lp.getBc(_qIndex + i, _bcIndex)) { | ||
| 664 | - _generateBcAndSetBc(i, _qIndex + i, _bcIndex); | 848 | + iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1; |
| 849 | + for (i = 1; i <= iQInternelCount; i++) { | ||
| 850 | + oLp = _internalLpArray[iQIndex + i]; | ||
| 851 | + if (!oLp.getBc(iQIndex + i, iBcIndex)) { | ||
| 852 | + _fnGenerateBcAndSetBc(i, iQIndex + i, iBcIndex); | ||
| 665 | } | 853 | } |
| 666 | } | 854 | } |
| 667 | 855 | ||
| 668 | // 处理尾部 | 856 | // 处理尾部 |
| 669 | - _lpIndex = endBcIndex[0]; | ||
| 670 | - _qIndex = endBcIndex[1]; | ||
| 671 | - _bcIndex = endBcIndex[2]; | 857 | + iLpIndex = aEndBcIndex[0]; |
| 858 | + iQIndex = aEndBcIndex[1]; | ||
| 859 | + iBcIndex = aEndBcIndex[2]; | ||
| 672 | 860 | ||
| 673 | // 删除尾部多余的班次 | 861 | // 删除尾部多余的班次 |
| 674 | - for (j = _lpIndex; j < _internalLpArray.length; j++) { | ||
| 675 | - _lp = _internalLpArray[j]; | ||
| 676 | - if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) { | ||
| 677 | - _lp.removeBc(_qIndex, _bcIndex); | 862 | + for (j = iLpIndex; j < _internalLpArray.length; j++) { |
| 863 | + oLp = _internalLpArray[j]; | ||
| 864 | + if (oLp.isBxFb() && oLp.getBc(iQIndex, iBcIndex)) { | ||
| 865 | + oLp.removeBc(iQIndex, iBcIndex); | ||
| 678 | } | 866 | } |
| 679 | } | 867 | } |
| 680 | 868 | ||
| 681 | - if (startBcIndex[1] != endBcIndex[1]) { // 指定时间范围跨圈 | ||
| 682 | - for (j = 0; j < _lpIndex; j++) { | ||
| 683 | - _lp = _internalLpArray[j]; | ||
| 684 | - if (!_lp.getBc(_qIndex, _bcIndex)) { | ||
| 685 | - _generateBcAndSetBc(j, _qIndex, _bcIndex); | 869 | + if (aStartBcIndex[1] != aEndBcIndex[1]) { // 指定时间范围跨圈 |
| 870 | + for (j = 0; j < iLpIndex; j++) { | ||
| 871 | + oLp = _internalLpArray[j]; | ||
| 872 | + if (!oLp.getBc(iQIndex, iBcIndex)) { | ||
| 873 | + _fnGenerateBcAndSetBc(j, iQIndex, iBcIndex); | ||
| 686 | } | 874 | } |
| 687 | } | 875 | } |
| 688 | } else { | 876 | } else { |
| @@ -698,7 +886,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -698,7 +886,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 698 | * 早高峰7:45分以前出场运营, | 886 | * 早高峰7:45分以前出场运营, |
| 699 | * 晚高峰16:10分以前出场运营 | 887 | * 晚高峰16:10分以前出场运营 |
| 700 | */ | 888 | */ |
| 701 | - calcuLpBc_yy: function() { | 889 | + fnCalcuLpBc_yy: function() { |
| 702 | // 补班次的时候,针对的是分班班型 | 890 | // 补班次的时候,针对的是分班班型 |
| 703 | var i; | 891 | var i; |
| 704 | var _oLp; | 892 | var _oLp; |
| @@ -731,7 +919,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -731,7 +919,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 731 | _paramObj.getUpOutTime(); | 919 | _paramObj.getUpOutTime(); |
| 732 | } | 920 | } |
| 733 | if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | 921 | if (_zgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { |
| 734 | - _generateBcAndSetBc( | 922 | + _fnGenerateBcAndSetBc( |
| 735 | i, | 923 | i, |
| 736 | _bIndex == 0 ? _qIndex - 1 : _qIndex, | 924 | _bIndex == 0 ? _qIndex - 1 : _qIndex, |
| 737 | _bIndex == 0 ? 1 : 0 | 925 | _bIndex == 0 ? 1 : 0 |
| @@ -758,7 +946,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -758,7 +946,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 758 | _paramObj.getUpOutTime(); | 946 | _paramObj.getUpOutTime(); |
| 759 | } | 947 | } |
| 760 | if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { | 948 | if (_wgfCDate.isBefore(_paramObj.addMinute(_oBc.getFcTimeObj(), -_ccsj))) { |
| 761 | - _generateBcAndSetBc( | 949 | + _fnGenerateBcAndSetBc( |
| 762 | i, | 950 | i, |
| 763 | _bIndex == 0 ? _qIndex - 1 : _qIndex, | 951 | _bIndex == 0 ? _qIndex - 1 : _qIndex, |
| 764 | _bIndex == 0 ? 1 : 0 | 952 | _bIndex == 0 ? 1 : 0 |
| @@ -778,7 +966,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -778,7 +966,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 778 | * 5、加班次时都是往车次链前方加 | 966 | * 5、加班次时都是往车次链前方加 |
| 779 | * 6、如果前面车次链不能再加班次了,从后面车次链加 | 967 | * 6、如果前面车次链不能再加班次了,从后面车次链加 |
| 780 | */ | 968 | */ |
| 781 | - calcuLpBx_5_2: function() { | 969 | + fnCalcuLpBx_5_2: function() { |
| 782 | // 计算做5休2班型所需的班次数 | 970 | // 计算做5休2班型所需的班次数 |
| 783 | var iBxBcount = _aBxDesc[6].fBcCount; | 971 | var iBxBcount = _aBxDesc[6].fBcCount; |
| 784 | if (iBxBcount - Math.floor(iBxBcount) > 0.7) { | 972 | if (iBxBcount - Math.floor(iBxBcount) > 0.7) { |
| @@ -808,22 +996,22 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -808,22 +996,22 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 808 | iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q; | 996 | iQindex = oBcChain1.s_b == 0 ? oBcChain1.s_q - 1 : oBcChain1.s_q; |
| 809 | iBindex = oBcChain1.s_b == 0 ? 1 : 0; | 997 | iBindex = oBcChain1.s_b == 0 ? 1 : 0; |
| 810 | // 往车次链往前不能加,就往后加 | 998 | // 往车次链往前不能加,就往后加 |
| 811 | - if (_generateBc(i, iQindex, iBindex)) { | ||
| 812 | - _generateBcAndSetBc(i, iQindex, iBindex); | 999 | + if (_fnGenerateBc(i, iQindex, iBindex)) { |
| 1000 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); | ||
| 813 | } else { | 1001 | } else { |
| 814 | iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | 1002 | iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; |
| 815 | iBindex = oBcChain1.e_b == 0 ? 1 : 0; | 1003 | iBindex = oBcChain1.e_b == 0 ? 1 : 0; |
| 816 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1004 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 817 | } | 1005 | } |
| 818 | 1006 | ||
| 819 | } else if (oBcChain1.bcount > oBcChain2.bcount) { | 1007 | } else if (oBcChain1.bcount > oBcChain2.bcount) { |
| 820 | iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | 1008 | iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; |
| 821 | iBindex = oBcChain2.s_b == 0 ? 1 : 0; | 1009 | iBindex = oBcChain2.s_b == 0 ? 1 : 0; |
| 822 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1010 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 823 | } else { | 1011 | } else { |
| 824 | iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; | 1012 | iQindex = oBcChain2.s_b == 0 ? oBcChain2.s_q - 1 : oBcChain2.s_q; |
| 825 | iBindex = oBcChain2.s_b == 0 ? 1 : 0; | 1013 | iBindex = oBcChain2.s_b == 0 ? 1 : 0; |
| 826 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1014 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 827 | } | 1015 | } |
| 828 | } | 1016 | } |
| 829 | } | 1017 | } |
| @@ -835,7 +1023,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -835,7 +1023,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 835 | * 补其他分班班型班次。 | 1023 | * 补其他分班班型班次。 |
| 836 | * 从车次链的后面开始加 | 1024 | * 从车次链的后面开始加 |
| 837 | */ | 1025 | */ |
| 838 | - calcuLpBx_other: function() { | 1026 | + fnCalcuLpBx_other: function() { |
| 839 | // TODO:暂时使用做2休1的班型 | 1027 | // TODO:暂时使用做2休1的班型 |
| 840 | // 计算做5休2班型所需的班次数 | 1028 | // 计算做5休2班型所需的班次数 |
| 841 | var iBxBcount = _aBxDesc[4].fBcCount; | 1029 | var iBxBcount = _aBxDesc[4].fBcCount; |
| @@ -865,15 +1053,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -865,15 +1053,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 865 | if (oBcChain1.bcount < oBcChain2.bcount) { | 1053 | if (oBcChain1.bcount < oBcChain2.bcount) { |
| 866 | iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; | 1054 | iQindex = oBcChain1.e_b == 0 ? oBcChain1.e_q : oBcChain1.e_q + 1; |
| 867 | iBindex = oBcChain1.e_b == 0 ? 1 : 0; | 1055 | iBindex = oBcChain1.e_b == 0 ? 1 : 0; |
| 868 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1056 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 869 | } else if (oBcChain1.bcount > oBcChain2.bcount) { | 1057 | } else if (oBcChain1.bcount > oBcChain2.bcount) { |
| 870 | iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | 1058 | iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; |
| 871 | iBindex = oBcChain2.e_b == 0 ? 1 : 0; | 1059 | iBindex = oBcChain2.e_b == 0 ? 1 : 0; |
| 872 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1060 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 873 | } else { | 1061 | } else { |
| 874 | iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; | 1062 | iQindex = oBcChain2.e_b == 0 ? oBcChain2.e_q : oBcChain2.e_q + 1; |
| 875 | iBindex = oBcChain2.e_b == 0 ? 1 : 0; | 1063 | iBindex = oBcChain2.e_b == 0 ? 1 : 0; |
| 876 | - _generateBcAndSetBc(i, iQindex, iBindex); | 1064 | + _fnGenerateBcAndSetBc(i, iQindex, iBindex); |
| 877 | } | 1065 | } |
| 878 | } | 1066 | } |
| 879 | } | 1067 | } |
| @@ -886,255 +1074,106 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -886,255 +1074,106 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 886 | * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢 | 1074 | * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢 |
| 887 | * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢 | 1075 | * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢 |
| 888 | */ | 1076 | */ |
| 889 | - calcuLpBx_lb: function() { | 1077 | + fnCalcuLpBx_lb: function() { |
| 890 | // 补充连班的班次,参照上标线,中标线补充不足的班次 | 1078 | // 补充连班的班次,参照上标线,中标线补充不足的班次 |
| 891 | - var _zgffcsj; // 早高峰发车时间 | ||
| 892 | - var _etsj = // 结束时间 | 1079 | + |
| 1080 | + var aLbLpindexes = []; // 除上标线,中标线的连班路牌索引 | ||
| 1081 | + var i; | ||
| 1082 | + for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1083 | + if (_internalLpArray[i].isBxLb() && i != 0 && i != _iZbx_lpIndex) { | ||
| 1084 | + aLbLpindexes.push(i); | ||
| 1085 | + } | ||
| 1086 | + } | ||
| 1087 | + | ||
| 1088 | + var oEndsj = // 结束时间 | ||
| 893 | _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ? | 1089 | _paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj()) ? |
| 894 | _paramObj.getDownLastDTimeObj() : | 1090 | _paramObj.getDownLastDTimeObj() : |
| 895 | _paramObj.getUpLastDtimeObj(); | 1091 | _paramObj.getUpLastDtimeObj(); |
| 896 | 1092 | ||
| 897 | - var _lp; | ||
| 898 | - var _minbcPos; | ||
| 899 | - var _bcObj; | ||
| 900 | - var i; | 1093 | + var oLp; |
| 1094 | + var aMinbcPos; | ||
| 1095 | + var oBc; | ||
| 901 | var j; | 1096 | var j; |
| 902 | var iTempBcIndex; | 1097 | var iTempBcIndex; |
| 903 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 904 | - _lp = _internalLpArray[i]; | ||
| 905 | - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 906 | - _minbcPos = _lp.getMinBcObjPosition(); | ||
| 907 | - | ||
| 908 | - // 使用纵向分隔补充班次 | ||
| 909 | - iTempBcIndex = _minbcPos[1] == 0 ? 1 : 0; | ||
| 910 | - j = iTempBcIndex == 0 ? _minbcPos[0] + 1 : _minbcPos[0]; | ||
| 911 | - for (; j < _qCount; j++) { | ||
| 912 | - while (iTempBcIndex <= 1) { | ||
| 913 | - _bcObj = _generateBc(i, j, iTempBcIndex); | ||
| 914 | - if (_bcObj && _bcObj.getFcTimeObj().isBefore(_etsj) && _bcObj.getArrTimeObj().isBefore(_etsj)) { | ||
| 915 | - _lp.setBc(j, iTempBcIndex, _bcObj); | ||
| 916 | - } | ||
| 917 | 1098 | ||
| 918 | - iTempBcIndex++; | 1099 | + // 1、从最小班次开始,往后补充班次 |
| 1100 | + for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1101 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1102 | + | ||
| 1103 | + // 最小班次索引 | ||
| 1104 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1105 | + // 使用纵向分隔补充班次,从最小班次向后补 | ||
| 1106 | + iTempBcIndex = aMinbcPos[1] == 0 ? 1 : 0; | ||
| 1107 | + j = iTempBcIndex == 0 ? aMinbcPos[0] + 1 : aMinbcPos[0]; | ||
| 1108 | + | ||
| 1109 | + while (j < _qCount) { | ||
| 1110 | + while (iTempBcIndex <= 1) { | ||
| 1111 | + oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex); | ||
| 1112 | + if (oBc && | ||
| 1113 | + oBc.getFcTimeObj().isBefore(oEndsj) && | ||
| 1114 | + oBc.getArrTimeObj().isBefore(oEndsj)) { | ||
| 1115 | + oLp.setBc(j, iTempBcIndex, oBc); | ||
| 919 | } | 1116 | } |
| 920 | - iTempBcIndex = 0; | ||
| 921 | - | 1117 | + iTempBcIndex++; |
| 922 | } | 1118 | } |
| 923 | - | ||
| 924 | - //_bcObj = _lp.getBc(_minbcPos[0], _minbcPos[1]); | ||
| 925 | - | ||
| 926 | - //_zgffcsj = _bcObj.getFcTimeObj(); | ||
| 927 | - //// 重新初始化连班班型班次 | ||
| 928 | - //_lp.initDataFromTimeToTime( | ||
| 929 | - // _zgffcsj, | ||
| 930 | - // _etsj, | ||
| 931 | - // _bcObj.isUp(), | ||
| 932 | - // _minbcPos[0], | ||
| 933 | - // _paramObj, | ||
| 934 | - // _factory | ||
| 935 | - //); | 1119 | + iTempBcIndex = 0; |
| 1120 | + j++; | ||
| 936 | } | 1121 | } |
| 1122 | + | ||
| 937 | } | 1123 | } |
| 938 | 1124 | ||
| 1125 | + // 2、上标线中标线之间的路牌,从最小的班次往前补充班次 | ||
| 1126 | + | ||
| 939 | // 还要补充缺失的班次,差上标线几个班次要往前补上 | 1127 | // 还要补充缺失的班次,差上标线几个班次要往前补上 |
| 940 | - var _bccount; | ||
| 941 | - var _qIndex; | ||
| 942 | - var _bIndex; | 1128 | + var iBccount; |
| 1129 | + var iQindex; | ||
| 1130 | + var iBindex; | ||
| 943 | // 补上标线到中标线之间的连班路牌的班次 | 1131 | // 补上标线到中标线之间的连班路牌的班次 |
| 944 | - for (i = 0; i < _zbx_lpIndex; i++) { | ||
| 945 | - _lp = _internalLpArray[i]; | ||
| 946 | - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 947 | - _minbcPos = _lp.getMinBcObjPosition(); | ||
| 948 | - _qIndex = _minbcPos[0]; | ||
| 949 | - _bIndex = _minbcPos[1]; | ||
| 950 | - _bccount = (_qIndex - 1) * 2 + _bIndex; // 距离上标线起始站点差几个班次 | ||
| 951 | - for (j = 0; j < _bccount; j++) { | ||
| 952 | - if (_bIndex == 0) { | ||
| 953 | - _qIndex --; | ||
| 954 | - _bIndex = 1; | ||
| 955 | - _generateBcAndSetBc(i, _qIndex, _bIndex); | ||
| 956 | - } else if (_bIndex == 1) { | ||
| 957 | - _bIndex --; | ||
| 958 | - _generateBcAndSetBc(i, _qIndex, _bIndex); | 1132 | + for (i = 0; i < aLbLpindexes.length; i++) { |
| 1133 | + if (aLbLpindexes[i] > 0 && aLbLpindexes[i] < _iZbx_lpIndex) { | ||
| 1134 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1135 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1136 | + iQindex = aMinbcPos[0]; | ||
| 1137 | + iBindex = aMinbcPos[1]; | ||
| 1138 | + iBccount = (iQindex - 1) * 2 + iBindex; // 距离上标线起始站点差几个班次 | ||
| 1139 | + for (j = 0; j < iBccount; j++) { | ||
| 1140 | + if (iBindex == 0) { | ||
| 1141 | + iQindex --; | ||
| 1142 | + iBindex = 1; | ||
| 1143 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1144 | + } else if (iBindex == 1) { | ||
| 1145 | + iBindex --; | ||
| 1146 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 959 | } | 1147 | } |
| 960 | } | 1148 | } |
| 961 | - } | ||
| 962 | - } | ||
| 963 | - // 补中标线以下的连班路牌的班次 | ||
| 964 | - for (i = _zbx_lpIndex; i < _internalLpArray.length; i++) { | ||
| 965 | - _lp = _internalLpArray[i]; | ||
| 966 | - if (_lp.isBxLb() && i != 0 && i != _zbx_lpIndex) { | ||
| 967 | - _minbcPos = _lp.getMinBcObjPosition(); | ||
| 968 | - _qIndex = _minbcPos[0]; | ||
| 969 | - _bIndex = _minbcPos[1]; | ||
| 970 | - _bccount = (_qIndex - 0) * 2 + _bIndex - 1; // 距离上标线起始站点差几个班次 | ||
| 971 | - for (j = 0; j < _bccount; j++) { | ||
| 972 | - if (_bIndex == 0) { | ||
| 973 | - _qIndex --; | ||
| 974 | - _bIndex = 1; | ||
| 975 | - _generateBcAndSetBc(i, _qIndex, _bIndex); | ||
| 976 | - } else if (_bIndex == 1) { | ||
| 977 | - _bIndex --; | ||
| 978 | - _generateBcAndSetBc(i, _qIndex, _bIndex); | ||
| 979 | - } | ||
| 980 | - } | ||
| 981 | - } | ||
| 982 | - } | ||
| 983 | - | ||
| 984 | - }, | ||
| 985 | - | ||
| 986 | - /** | ||
| 987 | - * 计算每个路牌的班型及工时对应的圈数。 | ||
| 988 | - * 1、将连班,分班路牌分配到各个路牌上(分隔法),上标线,中标线上连班路牌 | ||
| 989 | - * 2、确定班型的工时,其中连班路牌的工时由上标线,中标线确定好了,5休2路牌工时也确定了, | ||
| 990 | - * 其余分班路牌的工时由高峰低谷最大,最小发车间隔计算 | ||
| 991 | - */ | ||
| 992 | - calcuLpBx_fg: function() { | ||
| 993 | - // 间隔法 | ||
| 994 | - | ||
| 995 | - //--------------------------- 1、间隔法分隔连班路牌 ----------------------// | ||
| 996 | - | ||
| 997 | - // 除去上标线,中标线的连班路牌个数 | ||
| 998 | - var _lblbcount = _bx_lb_lpcount - 2; | ||
| 999 | - // 计算由标线隔开的两个区域的路牌数比率 | ||
| 1000 | - var _p1 = (_zbx_lpIndex + 1) / (_internalLpArray.length + 1); | ||
| 1001 | - var _p2 = (_internalLpArray.length - _zbx_lpIndex) / (_internalLpArray.length + 1); | ||
| 1002 | - var _p1_lpcount = _lblbcount * _p1; | ||
| 1003 | - var _p2_lpcount = _lblbcount * _p2; | ||
| 1004 | - if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除 | ||
| 1005 | - _p1_lpcount = Math.floor(_p1_lpcount); | ||
| 1006 | - _p2_lpcount = Math.floor(_p2_lpcount) + 1; | ||
| 1007 | - } | ||
| 1008 | 1149 | ||
| 1009 | - // 设定第一个区域的连班路牌 | ||
| 1010 | - var i; | ||
| 1011 | - var _count = _p1_lpcount + 1; | ||
| 1012 | - var _c1 = Math.floor(_zbx_lpIndex / _count); | ||
| 1013 | - var _c2 = _zbx_lpIndex % _count; | ||
| 1014 | - var _c2_start_index; | ||
| 1015 | - for (i = 1; i <= _count - _c2; i++) { | ||
| 1016 | - _internalLpArray[(i - 1) * _c1].setBxLb(true); | ||
| 1017 | - _internalLpArray[(i - 1) * _c1].setBxDesc("连班"); | ||
| 1018 | - _c2_start_index = (i - 1) * _c1; | ||
| 1019 | - } | ||
| 1020 | - for (i = 1; i <= _c2; i++) { | ||
| 1021 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true); | ||
| 1022 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班"); | ||
| 1023 | - } | ||
| 1024 | - | ||
| 1025 | - // 设定第二个区域的连班路牌 | ||
| 1026 | - _count = _p2_lpcount + 1; | ||
| 1027 | - _c1 = Math.floor((_internalLpArray.length - _zbx_lpIndex - 1) / _count); | ||
| 1028 | - _c2 = (_internalLpArray.length - _zbx_lpIndex - 1) % _count; | ||
| 1029 | - for (i = 1; i <= _count - _c2; i++) { | ||
| 1030 | - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true); | ||
| 1031 | - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false); | ||
| 1032 | - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false); | ||
| 1033 | - _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxDesc("连班"); | ||
| 1034 | - _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex; | ||
| 1035 | - } | ||
| 1036 | - for (i = 1; i <= _c2; i++) { | ||
| 1037 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true); | ||
| 1038 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false); | ||
| 1039 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false); | ||
| 1040 | - _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班"); | ||
| 1041 | - } | ||
| 1042 | - | ||
| 1043 | - //---------------------------- 2、分隔法,分隔分班路牌 -------------------------// | ||
| 1044 | - | ||
| 1045 | - // 设定分班路牌 | ||
| 1046 | - var notlbIndexes = []; // 去除连班的路牌index列表 | ||
| 1047 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1048 | - if (!_internalLpArray[i].isBxLb()) { | ||
| 1049 | - notlbIndexes.push(i); | ||
| 1050 | - } | ||
| 1051 | - } | ||
| 1052 | - // 获取离中标线最近的分班路牌索引 | ||
| 1053 | - var _temp_fg_index; | ||
| 1054 | - for (i = 0; i < notlbIndexes.length; i++) { | ||
| 1055 | - if (notlbIndexes[i] == _zbx_lpIndex - 1) { | ||
| 1056 | - _temp_fg_index = i; | ||
| 1057 | - break; | ||
| 1058 | } | 1150 | } |
| 1059 | - } | ||
| 1060 | 1151 | ||
| 1061 | - // 使用上面的分隔比率,分隔其他班型 | ||
| 1062 | - _p1_lpcount = _bx_5_2_fb_lpcount * _p1; | ||
| 1063 | - _p2_lpcount = _bx_5_2_fb_lpcount * _p2; | ||
| 1064 | - if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除 | ||
| 1065 | - _p1_lpcount = Math.floor(_p1_lpcount); | ||
| 1066 | - _p2_lpcount = Math.floor(_p2_lpcount) + 1; | ||
| 1067 | - } | ||
| 1068 | - // 第一个区域 | ||
| 1069 | - _count = _p1_lpcount; | ||
| 1070 | - _c1 = Math.floor(_temp_fg_index / _count); | ||
| 1071 | - _c2 = _temp_fg_index % _count; | ||
| 1072 | - for (i = 1; i <= _count - _c2; i++) { | ||
| 1073 | - _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxLb(false); | ||
| 1074 | - _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb(true); | ||
| 1075 | - _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb5_2(true); | ||
| 1076 | - _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxDesc("5休2分班"); | ||
| 1077 | - _c2_start_index = (i - 1) * _c1; | ||
| 1078 | - } | ||
| 1079 | - for (i = 1; i <= _c2; i++) { | ||
| 1080 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false); | ||
| 1081 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb(true); | ||
| 1082 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true); | ||
| 1083 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班"); | ||
| 1084 | - } | ||
| 1085 | - // 第二个区域 | ||
| 1086 | - _count = _p2_lpcount; | ||
| 1087 | - _c1 = Math.floor((notlbIndexes.length - _temp_fg_index - 1) / _count); | ||
| 1088 | - _c2 = (notlbIndexes.length - _temp_fg_index - 1) % _count; | ||
| 1089 | - for (i = 1; i <= _count - _c2; i++) { | ||
| 1090 | - _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxLb(false); | ||
| 1091 | - _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb(true); | ||
| 1092 | - _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb5_2(true); | ||
| 1093 | - _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxDesc("5休2分班"); | ||
| 1094 | - _c2_start_index = (i - 1) * _c1 + _temp_fg_index + 1; | ||
| 1095 | - } | ||
| 1096 | - for (i = 1; i <= _c2; i++) { | ||
| 1097 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false); | ||
| 1098 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb(true); | ||
| 1099 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true); | ||
| 1100 | - _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班"); | ||
| 1101 | } | 1152 | } |
| 1102 | 1153 | ||
| 1103 | - //-------------------------- 3、余下班次就是5休2类型 ----------------------// | ||
| 1104 | - | ||
| 1105 | - for (i = 0; i < notlbIndexes.length; i++) { | ||
| 1106 | - if (!_internalLpArray[notlbIndexes[i]].isBxFb5_2()) { | ||
| 1107 | - _internalLpArray[notlbIndexes[i]].setBxLb(false); | ||
| 1108 | - _internalLpArray[notlbIndexes[i]].setBxFb(true); | ||
| 1109 | - _internalLpArray[notlbIndexes[i]].setBxFb5_2(false); | ||
| 1110 | - _internalLpArray[notlbIndexes[i]].setBxDesc("其他分班"); | ||
| 1111 | - } | ||
| 1112 | - } | 1154 | + // 3、中标线之后的路牌,从最小的班次往前补充班次 |
| 1113 | 1155 | ||
| 1114 | - // 测试打印 | ||
| 1115 | - var lbIndexes = []; | ||
| 1116 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1117 | - if (_internalLpArray[i].isBxLb()) { | ||
| 1118 | - lbIndexes.push(i); | ||
| 1119 | - } | ||
| 1120 | - } | ||
| 1121 | - console.log("连班路牌indexes=" + lbIndexes); | ||
| 1122 | - | ||
| 1123 | - var _other_fbIndexes = []; | ||
| 1124 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1125 | - if (_internalLpArray[i].isBxFb() && !_internalLpArray[i].isBxFb5_2()) { | ||
| 1126 | - _other_fbIndexes.push(i); | 1156 | + // 补中标线以下的连班路牌的班次 |
| 1157 | + for (i = 0; i < aLbLpindexes.length; i++) { | ||
| 1158 | + if (aLbLpindexes[i] > _iZbx_lpIndex) { | ||
| 1159 | + oLp = _internalLpArray[aLbLpindexes[i]]; | ||
| 1160 | + aMinbcPos = oLp.getMinBcObjPosition(); | ||
| 1161 | + iQindex = aMinbcPos[0]; | ||
| 1162 | + iBindex = aMinbcPos[1]; | ||
| 1163 | + iBccount = (iQindex - 0) * 2 + iBindex - 1; // 距离上标线起始站点差几个班次 | ||
| 1164 | + for (j = 0; j < iBccount; j++) { | ||
| 1165 | + if (iBindex == 0) { | ||
| 1166 | + iQindex --; | ||
| 1167 | + iBindex = 1; | ||
| 1168 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1169 | + } else if (iBindex == 1) { | ||
| 1170 | + iBindex --; | ||
| 1171 | + _fnGenerateBcAndSetBc(aLbLpindexes[i], iQindex, iBindex); | ||
| 1172 | + } | ||
| 1173 | + } | ||
| 1127 | } | 1174 | } |
| 1128 | } | 1175 | } |
| 1129 | - console.log("其他分班路牌indexes=" + _other_fbIndexes); | ||
| 1130 | 1176 | ||
| 1131 | - var _5_2_fbIndexes = []; | ||
| 1132 | - for (i = 0; i < _internalLpArray.length; i++) { | ||
| 1133 | - if (_internalLpArray[i].isBxFb() && _internalLpArray[i].isBxFb5_2()) { | ||
| 1134 | - _5_2_fbIndexes.push(i); | ||
| 1135 | - } | ||
| 1136 | - } | ||
| 1137 | - console.log("5休2分班路牌indexes=" + _5_2_fbIndexes); | ||
| 1138 | }, | 1177 | }, |
| 1139 | 1178 | ||
| 1140 | /** | 1179 | /** |
| @@ -1143,7 +1182,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1143,7 +1182,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1143 | * 2、从后往前找到与这个班次最匹配的班次的位置(第几个路牌,第几圈,第几个班次),然后覆盖 | 1182 | * 2、从后往前找到与这个班次最匹配的班次的位置(第几个路牌,第几圈,第几个班次),然后覆盖 |
| 1144 | * 3、从第2步找的位置,往上找与另一个末班车匹配的班次位置,然后覆盖 | 1183 | * 3、从第2步找的位置,往上找与另一个末班车匹配的班次位置,然后覆盖 |
| 1145 | */ | 1184 | */ |
| 1146 | - calcuLastBc: function() { | 1185 | + fnCalcuLastBc: function() { |
| 1147 | //-------------------- 1、确定末班车早的方向,时间 -----------------------// | 1186 | //-------------------- 1、确定末班车早的方向,时间 -----------------------// |
| 1148 | var _oLastTime; | 1187 | var _oLastTime; |
| 1149 | var _bLastIsUp; | 1188 | var _bLastIsUp; |
| @@ -1191,7 +1230,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1191,7 +1230,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1191 | if (_oLp.isBxLb()) { | 1230 | if (_oLp.isBxLb()) { |
| 1192 | _oBc = _oLp.getBc(_aBcIndex[1], _aBcIndex[2]); | 1231 | _oBc = _oLp.getBc(_aBcIndex[1], _aBcIndex[2]); |
| 1193 | if (_oBc == undefined) { | 1232 | if (_oBc == undefined) { |
| 1194 | - _oBc = _generateBc(i, _aBcIndex[1], _aBcIndex[2]); | 1233 | + _oBc = _fnGenerateBc(i, _aBcIndex[1], _aBcIndex[2]); |
| 1195 | } | 1234 | } |
| 1196 | _aBcIndexes.push({ | 1235 | _aBcIndexes.push({ |
| 1197 | lpIndex: i, | 1236 | lpIndex: i, |
| @@ -1240,7 +1279,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1240,7 +1279,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1240 | _oBcIndex_find.bcIndex == 0 ? 1 : 0 | 1279 | _oBcIndex_find.bcIndex == 0 ? 1 : 0 |
| 1241 | ); | 1280 | ); |
| 1242 | if (_oBc == undefined) { | 1281 | if (_oBc == undefined) { |
| 1243 | - _oBc = _generateBc( | 1282 | + _oBc = _fnGenerateBc( |
| 1244 | i, | 1283 | i, |
| 1245 | _oBcIndex_find.bcIndex == 0 ? _oBcIndex_find.qIndex : _oBcIndex_find.qIndex + 1, | 1284 | _oBcIndex_find.bcIndex == 0 ? _oBcIndex_find.qIndex : _oBcIndex_find.qIndex + 1, |
| 1246 | _oBcIndex_find.bcIndex == 0 ? 1 : 0 | 1285 | _oBcIndex_find.bcIndex == 0 ? 1 : 0 |
| @@ -1294,7 +1333,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1294,7 +1333,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1294 | /** | 1333 | /** |
| 1295 | * 添加吃饭班次。 | 1334 | * 添加吃饭班次。 |
| 1296 | */ | 1335 | */ |
| 1297 | - calcuEatBc: function() { | 1336 | + fnCalcuEatBc: function() { |
| 1298 | // 吃午饭时间范围,10:15 到 12:15 | 1337 | // 吃午饭时间范围,10:15 到 12:15 |
| 1299 | // 吃晚饭时间范围,18:00 到 19:00 | 1338 | // 吃晚饭时间范围,18:00 到 19:00 |
| 1300 | 1339 | ||
| @@ -1349,7 +1388,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1349,7 +1388,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1349 | if (i == aLbIndex.length - 1) { | 1388 | if (i == aLbIndex.length - 1) { |
| 1350 | for (j = aLbIndex[i]; j < _internalLpArray.length; j++) { | 1389 | for (j = aLbIndex[i]; j < _internalLpArray.length; j++) { |
| 1351 | oLp = _internalLpArray[j]; | 1390 | oLp = _internalLpArray[j]; |
| 1352 | - if (oLp.isBxFb()) { | 1391 | + if (oLp.isBxFb()) { // 5休2班型不调整 |
| 1353 | // 修正午饭之后路牌班次的发车时间 | 1392 | // 修正午饭之后路牌班次的发车时间 |
| 1354 | oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); | 1393 | oLp.fnAddMinuteToBcFcsj(iLEQIndex, iLEBIndex, iLTime); |
| 1355 | oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); | 1394 | oLp.fnAddMinuteToBcFcsj(iDEQIndex, iDEBIndex, iDtime); |
| @@ -1372,7 +1411,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1372,7 +1411,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1372 | /** | 1411 | /** |
| 1373 | * 补每个路牌的其他班次(进出场,例保班次)。 | 1412 | * 补每个路牌的其他班次(进出场,例保班次)。 |
| 1374 | */ | 1413 | */ |
| 1375 | - calcuOtherBc: function() { | 1414 | + fnCalcuOtherBc: function() { |
| 1376 | var i; | 1415 | var i; |
| 1377 | var _lpObj; | 1416 | var _lpObj; |
| 1378 | var _minBcIndex; | 1417 | var _minBcIndex; |
| @@ -1399,6 +1438,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1399,6 +1438,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1399 | _minBc.getFcTimeObj(), | 1438 | _minBc.getFcTimeObj(), |
| 1400 | _paramObj | 1439 | _paramObj |
| 1401 | )); | 1440 | )); |
| 1441 | + | ||
| 1442 | + _maxBc.setArrTimeObj(_paramObj.addMinute(_maxBc.getFcTimeObj(), _maxBc.getBcTime())); | ||
| 1402 | _maxBc.setStopTime(0); | 1443 | _maxBc.setStopTime(0); |
| 1403 | _otherbc.push(_factory.createBcObj( | 1444 | _otherbc.push(_factory.createBcObj( |
| 1404 | _lpObj, "in", true, 1, | 1445 | _lpObj, "in", true, 1, |
| @@ -1417,6 +1458,20 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | @@ -1417,6 +1458,20 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { | ||
| 1417 | }, | 1458 | }, |
| 1418 | 1459 | ||
| 1419 | /** | 1460 | /** |
| 1461 | + * 祛除上标线有删除标记的班次。 | ||
| 1462 | + */ | ||
| 1463 | + fnRemoveDelFlagBc: function() { | ||
| 1464 | + var oLp = _internalLpArray[0]; | ||
| 1465 | + var aMinBcIndex = oLp.getMinBcObjPosition(); | ||
| 1466 | + oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]); | ||
| 1467 | + | ||
| 1468 | + var aMaxBcIndex = oLp.getMaxBcObjPosition(); | ||
| 1469 | + if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) { | ||
| 1470 | + oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]); | ||
| 1471 | + } | ||
| 1472 | + }, | ||
| 1473 | + | ||
| 1474 | + /** | ||
| 1420 | * 调整班次纵向间隔(发车时间调整)。 | 1475 | * 调整班次纵向间隔(发车时间调整)。 |
| 1421 | * 1、只调整分班班次的发车时间 | 1476 | * 1、只调整分班班次的发车时间 |
| 1422 | * 2、调整每两个连班之间的分班班次组 | 1477 | * 2、调整每两个连班之间的分班班次组 |
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
| @@ -18,7 +18,7 @@ var Main_v2 = function() { | @@ -18,7 +18,7 @@ var Main_v2 = function() { | ||
| 18 | var _fcsj = fcTimeObj; | 18 | var _fcsj = fcTimeObj; |
| 19 | var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); | 19 | var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp); |
| 20 | var _arrsj = paramObj.addMinute(_fcsj, _bcsj); | 20 | var _arrsj = paramObj.addMinute(_fcsj, _bcsj); |
| 21 | - var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp); | 21 | + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj); |
| 22 | var _tccid = paramObj.getTTinfoId(); | 22 | var _tccid = paramObj.getTTinfoId(); |
| 23 | var _ttinfoid = paramObj.getTTinfoId(); | 23 | var _ttinfoid = paramObj.getTTinfoId(); |
| 24 | var _xl = paramObj.getXlId(); | 24 | var _xl = paramObj.getXlId(); |
| @@ -151,38 +151,38 @@ var Main_v2 = function() { | @@ -151,38 +151,38 @@ var Main_v2 = function() { | ||
| 151 | 151 | ||
| 152 | // 1、初始化行车计划 | 152 | // 1、初始化行车计划 |
| 153 | var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); | 153 | var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); |
| 154 | - schedule.initDataWithBxLayout(); | ||
| 155 | - // 2、计算每个路牌的班型及对应工时 | ||
| 156 | - schedule.calcuLpBx_fg(); | ||
| 157 | - // 3、将连班路牌的班次补足 | ||
| 158 | - schedule.calcuLpBx_lb(); | 154 | + schedule.fnInitDataWithBxLayout(); |
| 155 | + // 2、将连班路牌的班次补足 | ||
| 156 | + schedule.fnCalcuLpBx_lb(); | ||
| 159 | 157 | ||
| 160 | - // 4、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除 | ||
| 161 | - schedule.adjustGfbc(true, true); // 修正上行早高峰 | ||
| 162 | - schedule.adjustGfbc(true, false); // 修正下行早高峰 | ||
| 163 | - schedule.adjustGfbc(false, true); // 修正上行晚高峰 | ||
| 164 | - schedule.adjustGfbc(false, false); // 修正下行晚高峰 | 158 | + // 3、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除 |
| 159 | + schedule.fnAdjustGfbc(true, true); // 修正上行早高峰 | ||
| 160 | + schedule.fnAdjustGfbc(true, false); // 修正下行早高峰 | ||
| 161 | + schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰 | ||
| 162 | + schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰 | ||
| 165 | 163 | ||
| 166 | - // 5、按照车辆投入运营要求补充班次 | ||
| 167 | - schedule.calcuLpBc_yy(); | 164 | + // 4、按照车辆投入运营要求补充班次 |
| 165 | + schedule.fnCalcuLpBc_yy(); | ||
| 168 | 166 | ||
| 169 | - // 6、根据班型补充所有的不足班次 | ||
| 170 | - schedule.calcuLpBx_5_2(); | ||
| 171 | - schedule.calcuLpBx_other(); | 167 | + // 5、根据班型补充所有的不足班次 |
| 168 | + schedule.fnCalcuLpBx_5_2(); | ||
| 169 | + schedule.fnCalcuLpBx_other(); | ||
| 172 | 170 | ||
| 173 | - // 7、补吃饭班次 | ||
| 174 | - schedule.calcuEatBc(); | 171 | + // 6、补吃饭班次 |
| 172 | + schedule.fnCalcuEatBc(); | ||
| 173 | + | ||
| 174 | + // 7、祛除有删除标记的班次 | ||
| 175 | + schedule.fnRemoveDelFlagBc(); | ||
| 175 | 176 | ||
| 176 | // 8、调整纵向班次间隔 | 177 | // 8、调整纵向班次间隔 |
| 177 | schedule.fnAdjust_vertical_bc_interval(); | 178 | schedule.fnAdjust_vertical_bc_interval(); |
| 178 | // TODO:横向调整 | 179 | // TODO:横向调整 |
| 179 | 180 | ||
| 180 | // 9、确定末班车 | 181 | // 9、确定末班车 |
| 181 | - schedule.calcuLastBc(); | ||
| 182 | - | 182 | + schedule.fnCalcuLastBc(); |
| 183 | 183 | ||
| 184 | // 10、补进出场例保班次 | 184 | // 10、补进出场例保班次 |
| 185 | - schedule.calcuOtherBc(); | 185 | + schedule.fnCalcuOtherBc(); |
| 186 | 186 | ||
| 187 | //-------------------- 输出ganut图上的班次,班型描述 ----------------------// | 187 | //-------------------- 输出ganut图上的班次,班型描述 ----------------------// |
| 188 | var gBcData = schedule.fnToGanttBcArray(); | 188 | var gBcData = schedule.fnToGanttBcArray(); |