Commit e48ded293cd48cbfdf8fb25c72cf5afac6fa5a30
1 parent
516f358a
update...
Showing
5 changed files
with
49 additions
and
24 deletions
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -36,4 +36,14 @@ public class Constants { |
| 36 | 36 | |
| 37 | 37 | public static final String SESSION_USERNAME = "sessionUserName"; |
| 38 | 38 | public static final String COMPANY_AUTHORITYS = "cmyAuths"; |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 解除调度指令和班次的外键约束 | |
| 42 | + */ | |
| 43 | + public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 批量解除调度指令和班次的外键约束 | |
| 47 | + */ | |
| 48 | + public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | |
| 39 | 49 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/late_adjust/LateAdjustHandle.java
0 → 100644
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.schedule; |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.bsth.Application; |
| 6 | +import com.bsth.common.Constants; | |
| 6 | 7 | import com.bsth.common.ResponseCode; |
| 7 | 8 | import com.bsth.data.BasicData; |
| 8 | 9 | import com.bsth.data.LineConfigData; |
| ... | ... | @@ -27,6 +28,8 @@ import org.slf4j.LoggerFactory; |
| 27 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | 29 | import org.springframework.boot.CommandLineRunner; |
| 29 | 30 | import org.springframework.core.annotation.Order; |
| 31 | +import org.springframework.dao.DataIntegrityViolationException; | |
| 32 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 30 | 33 | import org.springframework.stereotype.Component; |
| 31 | 34 | |
| 32 | 35 | import java.text.ParseException; |
| ... | ... | @@ -855,6 +858,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 855 | 858 | return false; |
| 856 | 859 | } |
| 857 | 860 | |
| 861 | + | |
| 862 | + @Autowired | |
| 863 | + JdbcTemplate jdbcTemplate; | |
| 858 | 864 | /** |
| 859 | 865 | * 删除实际排班 |
| 860 | 866 | * @param lineCode |
| ... | ... | @@ -866,20 +872,33 @@ public class DayOfSchedule implements CommandLineRunner { |
| 866 | 872 | try { |
| 867 | 873 | String rq = currSchDateMap.get(lineCode); |
| 868 | 874 | if(StringUtils.isNotEmpty(rq)){ |
| 875 | + List<ScheduleRealInfo> all = findByLineCode(lineCode); | |
| 869 | 876 | //解除gps 和班次之间的关联 |
| 870 | - List<ScheduleRealInfo> unions = calcUnion(findByLineCode(lineCode), carExecutePlanMap.values()); | |
| 877 | + List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values()); | |
| 871 | 878 | for(ScheduleRealInfo sch : unions){ |
| 872 | 879 | removeExecPlan(sch.getClZbh()); |
| 873 | 880 | } |
| 881 | + //解除调度指令和班次的外键约束 | |
| 882 | + StringBuilder inStr = new StringBuilder("("); | |
| 883 | + for(ScheduleRealInfo sch : all){ | |
| 884 | + inStr.append(sch.getId() + ","); | |
| 885 | + } | |
| 886 | + inStr.deleteCharAt(inStr.length() - 1).append(")"); | |
| 887 | + jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString()); | |
| 874 | 888 | |
| 875 | 889 | //删除班次数据 |
| 876 | 890 | removeRealSch(lineCode, rq); |
| 877 | 891 | //删除相关班次修正记录 |
| 892 | + | |
| 878 | 893 | } |
| 879 | 894 | rs.put("status", ResponseCode.SUCCESS); |
| 880 | 895 | }catch (Exception e){ |
| 881 | 896 | logger.error("", e); |
| 882 | 897 | rs.put("status", ResponseCode.ERROR); |
| 898 | + if(e instanceof DataIntegrityViolationException) | |
| 899 | + rs.put("msg", "失败,违反数据约束!!"); | |
| 900 | + else | |
| 901 | + rs.put("msg", e.getMessage()); | |
| 883 | 902 | } |
| 884 | 903 | |
| 885 | 904 | return rs; | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.realcontrol.impl; |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | +import com.bsth.common.Constants; | |
| 6 | 7 | import com.bsth.common.ResponseCode; |
| 7 | 8 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 8 | 9 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| ... | ... | @@ -413,7 +414,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 413 | 414 | } |
| 414 | 415 | |
| 415 | 416 | //解除和调度指令的外键约束 |
| 416 | - jdbcTemplate.update("update bsth_v_directive_60 set sch=NULL where sch=" + id); | |
| 417 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 417 | 418 | |
| 418 | 419 | //数据库删除 |
| 419 | 420 | rs = super.delete(id); | ... | ... |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| ... | ... | @@ -181,27 +181,6 @@ var gb_schedule_table = (function () { |
| 181 | 181 | |
| 182 | 182 | //重新渲染表格 |
| 183 | 183 | reRenderTable(sch.xlBm); |
| 184 | - /*//重新渲染表格 | |
| 185 | - var data = gb_common.get_vals(line2Schedule[sch.xlBm]).sort(schedule_sort), | |
| 186 | - dirData = gb_common.groupBy(data, 'xlDir'), | |
| 187 | - tabCont = $('li.line_schedule[data-id=' + sch.xlBm + ']'); | |
| 188 | - | |
| 189 | - for (var upDown in dirData) { | |
| 190 | - htmlStr = temps['line-schedule-table-temp']({ | |
| 191 | - dir: upDown, | |
| 192 | - line: gb_data_basic.codeToLine[sch.xlBm], | |
| 193 | - list: dirData[upDown] | |
| 194 | - }); | |
| 195 | - $('.schedule-wrap .card-panel:eq(' + upDown + ')', tabCont).html(htmlStr); | |
| 196 | - } | |
| 197 | - //图例相关 | |
| 198 | - gb_sch_legend.init(tabCont); | |
| 199 | - //标记末班 | |
| 200 | - markerLastByLine(sch.xlBm); | |
| 201 | - //计算应发未发 | |
| 202 | - calc_yfwf_num(sch.xlBm); | |
| 203 | - //重新固定表头 | |
| 204 | - gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap'));*/ | |
| 205 | 184 | //定位到新添加的班次 |
| 206 | 185 | scroToDl(sch); |
| 207 | 186 | }; |
| ... | ... | @@ -234,7 +213,14 @@ var gb_schedule_table = (function () { |
| 234 | 213 | //计算应发未发 |
| 235 | 214 | calc_yfwf_num(lineCode); |
| 236 | 215 | //重新固定表头 |
| 237 | - gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap')); | |
| 216 | + gb_ct_table.fixedHead($('.line_schedule .ct_table_wrap', tabCont)); | |
| 217 | + | |
| 218 | + //重新初始化排序 | |
| 219 | + gb_ct_table.enableSort($('.ct_table', tabCont), reset_seq_no, gb_schedule_table_dbclick.init); | |
| 220 | + //重新初始化双击待发调整 | |
| 221 | + gb_schedule_table_dbclick.init(); | |
| 222 | + //重新初始化双击实发发车信息微调 | |
| 223 | + gb_schedule_table_dbclick.sfsjCellClick($('dd.fcsjActualCell', tabCont)); | |
| 238 | 224 | } |
| 239 | 225 | }; |
| 240 | 226 | ... | ... |