Commit 68598adc440226e18ab4ded7f2b1adba7a31cadf

Authored by 潘钊
2 parents d1c07f52 3f77071f

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong

src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
@@ -46,9 +46,13 @@ public class CalcOilThread extends Thread{ @@ -46,9 +46,13 @@ public class CalcOilThread extends Thread{
46 logger.info("开始计算班次准点率...."); 46 logger.info("开始计算班次准点率....");
47 sheetService.saveSheetList(""); 47 sheetService.saveSheetList("");
48 logger.info("计算班次准点率结束!"); 48 logger.info("计算班次准点率结束!");
  49 +
  50 + logger.info("开始保存重新统计数据....");
  51 + calcWaybillService.autoGenerate("", "");
  52 + logger.info("重新统计保存结束!");
49 logger.info("开始保存统计日报...."); 53 logger.info("开始保存统计日报....");
50 calcWaybillService.calcDaily("", ""); 54 calcWaybillService.calcDaily("", "");
51 - logger.info("统计日报保存完成!"); 55 + logger.info("统计日报保存结束!");
52 } catch(Exception e){ 56 } catch(Exception e){
53 logger.error("计算路单里程加注量失败",e); 57 logger.error("计算路单里程加注量失败",e);
54 } 58 }
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -49,4 +49,13 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ @@ -49,4 +49,13 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ
49 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2") 49 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2")
50 List<ScheduleRealInfo> findAllSchedule(String schDate, String lineCode); 50 List<ScheduleRealInfo> findAllSchedule(String schDate, String lineCode);
51 51
  52 + /**
  53 + * 根据日期获取班次信息
  54 + * @param schDate
  55 + * @return
  56 + */
  57 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  58 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
  59 + List<ScheduleRealInfo> findAllScheduleByDate(String schDate);
  60 +
52 } 61 }
src/main/java/com/bsth/service/calc/CalcToolService.java
@@ -4,6 +4,7 @@ import java.util.List; @@ -4,6 +4,7 @@ import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
6 import com.bsth.entity.calc.CalcWaybill; 6 import com.bsth.entity.calc.CalcWaybill;
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
7 import com.bsth.entity.sys.Interval; 8 import com.bsth.entity.sys.Interval;
8 9
9 /** 10 /**
@@ -11,6 +12,6 @@ import com.bsth.entity.sys.Interval; @@ -11,6 +12,6 @@ import com.bsth.entity.sys.Interval;
11 */ 12 */
12 public interface CalcToolService { 13 public interface CalcToolService {
13 14
14 - List<CalcWaybill> findAll(String date, String line, List<Map<String, Object>> xlList, List<Interval> djgList); 15 + List<CalcWaybill> findAll(String date, String line, List<ScheduleRealInfo> list, List<Map<String, Object>> xlList, List<Interval> djgList);
15 16
16 } 17 }
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -12,6 +12,12 @@ import com.bsth.service.BaseService; @@ -12,6 +12,12 @@ import com.bsth.service.BaseService;
12 */ 12 */
13 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { 13 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> {
14 14
  15 + /**
  16 + * @param date 格式如:2018-03-30(留空""默认当前日期两天前)
  17 + * @param line (留空""默认全部线路)
  18 + */
  19 + Map<String, Object> autoGenerate(String date, String line) throws Exception;
  20 +
15 Map<String, Object> generateNew(String date, String line) throws Exception; 21 Map<String, Object> generateNew(String date, String line) throws Exception;
16 22
17 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 23 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type);
src/main/java/com/bsth/service/calc/impl/CalcCulateMileageServiceImpl.java
@@ -451,10 +451,10 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -451,10 +451,10 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
451 for (int i = 0; i < lists.size(); i++) { 451 for (int i = 0; i < lists.size(); i++) {
452 ScheduleRealInfo scheduleRealInfo=lists.get(i); 452 ScheduleRealInfo scheduleRealInfo=lists.get(i);
453 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 453 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
454 - if (isInOut(scheduleRealInfo)) { 454 +// if (isInOut(scheduleRealInfo)) {
455 if(scheduleRealInfo.isSflj()){ 455 if(scheduleRealInfo.isSflj()){
456 if(childTaskPlans.isEmpty()){ 456 if(childTaskPlans.isEmpty()){
457 - if(!scheduleRealInfo.isDestroy()) 457 + if(!scheduleRealInfo.isDestroy() && isInOut(scheduleRealInfo))
458 ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); 458 ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
459 }else{ 459 }else{
460 Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); 460 Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
@@ -470,47 +470,48 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -470,47 +470,48 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
470 } 470 }
471 } 471 }
472 } 472 }
473 - }else{  
474 - if(childTaskPlans.isEmpty()){  
475 - double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();  
476 - double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();  
477 - double zjlc=Arith.sub(jhlc, jhlcOrig);  
478 - if(zjlc>0){  
479 - ljgl=Arith.add(zjlc, ljgl);  
480 - }  
481 - }else{  
482 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
483 - while (it.hasNext()) {  
484 - ChildTaskPlan childTaskPlan = it.next();  
485 - if("empty".equals(childTaskPlan.getMileageType())  
486 - &&"临加".equals(childTaskPlan.getType1())  
487 - && childTaskPlan.getCcId() == null  
488 - && (!childTaskPlan.isNoClerk())){  
489 - if (!childTaskPlan.isDestroy()) {  
490 - Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
491 - ljgl=Arith.add(ljgl,jhgl);  
492 - }  
493 - }  
494 - }  
495 - }  
496 } 473 }
497 - }else{  
498 - if (!childTaskPlans.isEmpty()) {  
499 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
500 - while (it.hasNext()) {  
501 - ChildTaskPlan childTaskPlan = it.next();  
502 - if ("empty".equals(childTaskPlan.getMileageType())  
503 - && "临加".equals(childTaskPlan.getType1())  
504 - && childTaskPlan.getCcId() == null  
505 - && (!childTaskPlan.isNoClerk())) {  
506 - if (!childTaskPlan.isDestroy()) {  
507 - Float jhgl = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
508 - ljgl = Arith.add(ljgl, jhgl);  
509 - }  
510 - }  
511 - }  
512 - }  
513 - } 474 +// }else{
  475 +// if(childTaskPlans.isEmpty()){
  476 +// double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  477 +// double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();
  478 +// double zjlc=Arith.sub(jhlc, jhlcOrig);
  479 +// if(zjlc>0){
  480 +// ljgl=Arith.add(zjlc, ljgl);
  481 +// }
  482 +// }else{
  483 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  484 +// while (it.hasNext()) {
  485 +// ChildTaskPlan childTaskPlan = it.next();
  486 +// if("empty".equals(childTaskPlan.getMileageType())
  487 +// &&"临加".equals(childTaskPlan.getType1())
  488 +// && childTaskPlan.getCcId() == null
  489 +// && (!childTaskPlan.isNoClerk())){
  490 +// if (!childTaskPlan.isDestroy()) {
  491 +// Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  492 +// ljgl=Arith.add(ljgl,jhgl);
  493 +// }
  494 +// }
  495 +// }
  496 +// }
  497 +// }
  498 +// }else{
  499 +// if (!childTaskPlans.isEmpty()) {
  500 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  501 +// while (it.hasNext()) {
  502 +// ChildTaskPlan childTaskPlan = it.next();
  503 +// if ("empty".equals(childTaskPlan.getMileageType())
  504 +// && "临加".equals(childTaskPlan.getType1())
  505 +// && childTaskPlan.getCcId() == null
  506 +// && (!childTaskPlan.isNoClerk())) {
  507 +// if (!childTaskPlan.isDestroy()) {
  508 +// Float jhgl = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  509 +// ljgl = Arith.add(ljgl, jhgl);
  510 +// }
  511 +// }
  512 +// }
  513 +// }
  514 +// }
514 } 515 }
515 return ljgl; 516 return ljgl;
516 } 517 }
@@ -521,7 +522,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -521,7 +522,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
521 double ljgl =0; 522 double ljgl =0;
522 for (int i = 0; i < lists.size(); i++) { 523 for (int i = 0; i < lists.size(); i++) {
523 ScheduleRealInfo scheduleRealInfo=lists.get(i); 524 ScheduleRealInfo scheduleRealInfo=lists.get(i);
524 - if (!isInOut(scheduleRealInfo)) { 525 +// if (!isInOut(scheduleRealInfo)) {
525 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 526 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
526 if(scheduleRealInfo.isSflj()){ 527 if(scheduleRealInfo.isSflj()){
527 if(!childTaskPlans.isEmpty()){ 528 if(!childTaskPlans.isEmpty()){
@@ -538,23 +539,23 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -538,23 +539,23 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
538 } 539 }
539 } 540 }
540 } 541 }
541 - }else{  
542 - if(childTaskPlans.isEmpty()){  
543 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
544 - while (it.hasNext()) {  
545 - ChildTaskPlan childTaskPlan = it.next();  
546 - if("empty".equals(childTaskPlan.getMileageType())  
547 - &&"临加".equals(childTaskPlan.getType1())  
548 - && childTaskPlan.getCcId()==null  
549 - && childTaskPlan.isNoClerk()){  
550 - if (!childTaskPlan.isDestroy()) {  
551 - Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
552 - ljgl=Arith.add(ljgl,jhgl);  
553 - }  
554 - }  
555 - }  
556 - }  
557 - } 542 +// }else{
  543 +// if(childTaskPlans.isEmpty()){
  544 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  545 +// while (it.hasNext()) {
  546 +// ChildTaskPlan childTaskPlan = it.next();
  547 +// if("empty".equals(childTaskPlan.getMileageType())
  548 +// &&"临加".equals(childTaskPlan.getType1())
  549 +// && childTaskPlan.getCcId()==null
  550 +// && childTaskPlan.isNoClerk()){
  551 +// if (!childTaskPlan.isDestroy()) {
  552 +// Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  553 +// ljgl=Arith.add(ljgl,jhgl);
  554 +// }
  555 +// }
  556 +// }
  557 +// }
  558 +// }
558 } 559 }
559 } 560 }
560 return ljgl; 561 return ljgl;
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
@@ -5,12 +5,11 @@ import java.sql.SQLException; @@ -5,12 +5,11 @@ import java.sql.SQLException;
5 import java.util.ArrayList; 5 import java.util.ArrayList;
6 import java.util.Date; 6 import java.util.Date;
7 import java.util.HashMap; 7 import java.util.HashMap;
  8 +import java.util.HashSet;
8 import java.util.List; 9 import java.util.List;
9 import java.util.Map; 10 import java.util.Map;
10 import java.util.Set; 11 import java.util.Set;
11 12
12 -import javax.swing.text.Keymap;  
13 -  
14 import com.bsth.entity.calc.CalcInterval; 13 import com.bsth.entity.calc.CalcInterval;
15 import com.bsth.entity.calc.CalcWaybill; 14 import com.bsth.entity.calc.CalcWaybill;
16 import com.bsth.entity.realcontrol.ChildTaskPlan; 15 import com.bsth.entity.realcontrol.ChildTaskPlan;
@@ -53,26 +52,29 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -53,26 +52,29 @@ public class CalcToolServiceImpl implements CalcToolService {
53 52
54 53
55 @Override 54 @Override
56 - public List<CalcWaybill> findAll(String rq, String lineCode, List<Map<String, Object>> xlList, List<Interval> djgList) { 55 + public List<CalcWaybill> findAll(String rq, String lineCode, List<ScheduleRealInfo> list, List<Map<String, Object>> xlList, List<Interval> djgList) {
57 List<CalcWaybill> listCal=new ArrayList<CalcWaybill>(); 56 List<CalcWaybill> listCal=new ArrayList<CalcWaybill>();
58 - List<ScheduleRealInfo> list = clacRepository.findAllSchedule(rq,lineCode);  
59 - String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM"  
60 - + " bsth_c_s_sp_info_real r where "  
61 - + " r.schedule_date_str='"+rq+"' and r.xl_bm = '"+lineCode+"'"  
62 - + " GROUP BY r.j_gh,r.s_gh,r.cl_zbh,r.xl_bm,r.lp_name ";  
63 -  
64 - List<Map<String, String>> listMap = jdbcTemplate.query(sql, new RowMapper<Map<String, String>>() {  
65 - @Override  
66 - public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {  
67 - Map<String, String> c = new HashMap<String,String>();  
68 - c.put("jGh", arg0.getString("j_gh"));  
69 - c.put("sGh", arg0.getString("s_gh")==null?"":arg0.getString("s_gh"));  
70 - c.put("clZbh", arg0.getString("cl_zbh"));  
71 - c.put("xlBm", arg0.getString("xl_bm"));  
72 - c.put("lpName", arg0.getString("lp_name"));  
73 - return c; 57 +
  58 + List<Map<String, String>> listMap = new ArrayList<Map<String, String>>();
  59 + Set<String> tempSet = new HashSet<String>();
  60 + for(ScheduleRealInfo s : list){
  61 + String jGh = s.getjGh()!=null?s.getjGh().trim():"";
  62 + String sGh = s.getsGh()!=null?s.getsGh().trim():"";
  63 + String clZbh = s.getClZbh()!=null?s.getClZbh().trim():"";
  64 + String xlBm = s.getXlBm()!=null?s.getXlBm().trim():"";
  65 + String lpName = s.getLpName()!=null?s.getLpName().trim():"";
  66 + String key = jGh + sGh + clZbh + xlBm + lpName;
  67 + if(tempSet.add(key)){
  68 + Map<String, String> m = new HashMap<String, String>();
  69 + m.put("jGh", jGh);
  70 + m.put("sGh", sGh);
  71 + m.put("clZbh", clZbh);
  72 + m.put("xlBm", xlBm);
  73 + m.put("lpName", lpName);
  74 + listMap.add(m);
74 } 75 }
75 - }); 76 + }
  77 +
76 for (int i = 0; i < listMap.size(); i++) { 78 for (int i = 0; i < listMap.size(); i++) {
77 Map<String, String> m=listMap.get(i); 79 Map<String, String> m=listMap.get(i);
78 String jGh=m.get("jGh"); 80 String jGh=m.get("jGh");
@@ -100,7 +102,7 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -100,7 +102,7 @@ public class CalcToolServiceImpl implements CalcToolService {
100 lists_.add(s); 102 lists_.add(s);
101 }else{ 103 }else{
102 if(s.getZdsjActual()!=null 104 if(s.getZdsjActual()!=null
103 - && s.getFcsjActual() !=null){ 105 + && s.getFcsjActual()!=null){
104 lists_.add(s); 106 lists_.add(s);
105 } 107 }
106 } 108 }
@@ -126,10 +128,33 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -126,10 +128,33 @@ public class CalcToolServiceImpl implements CalcToolService {
126 interval.setRqStr(s.getScheduleDateStr()); 128 interval.setRqStr(s.getScheduleDateStr());
127 interval.setXl(s.getXlBm()); 129 interval.setXl(s.getXlBm());
128 interval.setXlName(s.getXlName()); 130 interval.setXlName(s.getXlName());
129 - interval.setDjg(Integer.valueOf(culateDjg.get("djgcsq").toString()));  
130 - interval.setDjgM(Integer.valueOf(culateDjg.get("djgcsz").toString()));  
131 - interval.setDjgA(Integer.valueOf(culateDjg.get("djgcsw").toString()));  
132 - interval.setDjgTime(Integer.valueOf(culateDjg.get("djgsj").toString())); 131 + if(culateDjg.keySet().size() > 0){
  132 + if(culateDjg.containsKey("djgcsq")){
  133 + interval.setDjg(Integer.valueOf(culateDjg.get("djgcsq").toString()));
  134 + } else {
  135 + interval.setDjg(0);
  136 + }
  137 + if(culateDjg.containsKey("djgcsz")){
  138 + interval.setDjgM(Integer.valueOf(culateDjg.get("djgcsz").toString()));
  139 + } else {
  140 + interval.setDjgM(0);
  141 + }
  142 + if(culateDjg.containsKey("djgcsw")){
  143 + interval.setDjgA(Integer.valueOf(culateDjg.get("djgcsw").toString()));
  144 + } else {
  145 + interval.setDjgA(0);
  146 + }
  147 + if(culateDjg.containsKey("djgsj")){
  148 + interval.setDjgTime(Integer.valueOf(culateDjg.get("djgsj").toString()));
  149 + } else {
  150 + interval.setDjgTime(0);
  151 + }
  152 + } else {
  153 + interval.setDjg(0);
  154 + interval.setDjgM(0);
  155 + interval.setDjgA(0);
  156 + interval.setDjgTime(0);
  157 + }
133 culcIntervalRepository.save(interval); 158 culcIntervalRepository.save(interval);
134 } 159 }
135 160
@@ -173,6 +198,7 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -173,6 +198,7 @@ public class CalcToolServiceImpl implements CalcToolService {
173 //list_ 全部班次 lists_执行了的班次(实到实发不为空) 198 //list_ 全部班次 lists_执行了的班次(实到实发不为空)
174 private List<CalcWaybill> cul(List<ScheduleRealInfo> list_,List<ScheduleRealInfo> list_s, List<Map<String, Object>> xlList, List<Interval> djgList){ 199 private List<CalcWaybill> cul(List<ScheduleRealInfo> list_,List<ScheduleRealInfo> list_s, List<Map<String, Object>> xlList, List<Interval> djgList){
175 List<CalcWaybill> list=new ArrayList<CalcWaybill>(); 200 List<CalcWaybill> list=new ArrayList<CalcWaybill>();
  201 + List<CalcWaybill> list2=new ArrayList<CalcWaybill>();
176 if(list_.size()>0){ 202 if(list_.size()>0){
177 Date date=list_.get(0).getScheduleDate(); 203 Date date=list_.get(0).getScheduleDate();
178 String dateStr=list_.get(0).getScheduleDateStr(); 204 String dateStr=list_.get(0).getScheduleDateStr();
@@ -333,8 +359,28 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -333,8 +359,28 @@ public class CalcToolServiceImpl implements CalcToolService {
333 t_.setDtbczgf(0); 359 t_.setDtbczgf(0);
334 t_.setDtbcwgf(0); 360 t_.setDtbcwgf(0);
335 list.add(t_); 361 list.add(t_);
  362 + list2.add(t_);
336 } 363 }
337 } 364 }
  365 + for(CalcWaybill c2 : list2){
  366 + boolean flag = true;
  367 + String key2 = c2.getjGh() + c2.getsGh()==null?"":c2.getsGh().trim()
  368 + + c2.getCl() + c2.getXl() + c2.getLp();
  369 + for(CalcWaybill c : list){
  370 + String key = c.getjGh() + c.getsGh()==null?"":c.getsGh().trim()
  371 + + c.getCl() + c.getXl() + c.getLp();
  372 + if(key2.equals(key)){
  373 + c.setSjyylc(Arith.add(c.getSjyylc(), c2.getSjyylc()));
  374 + c.setSjfyylc(Arith.add(c.getSjfyylc(), c2.getSjfyylc()));
  375 + c.setLjyylc(Arith.add(c.getLjyylc(), c2.getLjyylc()));
  376 + c.setLjfyylc(Arith.add(c.getLjfyylc(), c2.getLjfyylc()));
  377 + flag = false;
  378 + break;
  379 + }
  380 + }
  381 + if(flag)
  382 + list.add(c2);
  383 + }
338 return list; 384 return list;
339 } 385 }
340 386
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -33,6 +33,7 @@ import com.bsth.service.calc.CalcWaybillService; @@ -33,6 +33,7 @@ import com.bsth.service.calc.CalcWaybillService;
33 import com.bsth.service.impl.BaseServiceImpl; 33 import com.bsth.service.impl.BaseServiceImpl;
34 import com.bsth.service.report.CulateMileageService; 34 import com.bsth.service.report.CulateMileageService;
35 import com.bsth.util.Arith; 35 import com.bsth.util.Arith;
  36 +import com.bsth.util.BatchSaveUtils;
36 import com.bsth.util.ReportUtils; 37 import com.bsth.util.ReportUtils;
37 import com.github.stuxuhai.jpinyin.PinyinException; 38 import com.github.stuxuhai.jpinyin.PinyinException;
38 import com.github.stuxuhai.jpinyin.PinyinFormat; 39 import com.github.stuxuhai.jpinyin.PinyinFormat;
@@ -76,6 +77,19 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -76,6 +77,19 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
76 Logger logger = LoggerFactory.getLogger(this.getClass()); 77 Logger logger = LoggerFactory.getLogger(this.getClass());
77 78
78 79
  80 + public Map<String, Object> autoGenerate(String date, String line) throws Exception {
  81 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  82 + if(date == null || date.trim().length() == 0){
  83 + Date d = new Date();
  84 + d.setTime(d.getTime() - (4 * 1000 * 60 * 60 * 24));
  85 + date = sdf.format(d);
  86 + }
  87 + if(line == null || line.trim().length() == 0){
  88 + line = "";
  89 + }
  90 + return generateNew(date, line);
  91 + }
  92 +
79 @Transactional 93 @Transactional
80 @Override 94 @Override
81 public Map<String, Object> generateNew(String date, String line) throws Exception { 95 public Map<String, Object> generateNew(String date, String line) throws Exception {
@@ -101,19 +115,21 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -101,19 +115,21 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
101 return newMap; 115 return newMap;
102 } 116 }
103 117
104 - String sql = "select c.id,c.out_config,c.start_opt,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";  
105 - if(line.length() != 0){  
106 - sql += " where t.line_code = " + line;  
107 - }  
108 -// List<LineConfig> listLineConfig = //jdbcTemplate.query(sql, new BeanPropertyRowMapper(LineConfig.class)); 118 +// String sql = "select c.id,c.out_config,c.start_opt,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";
  119 + String sql="select xl_bm as line_code from bsth_c_s_sp_info_real where schedule_date_str = '"+date+"'";
  120 + if(line.trim().length() > 0){
  121 + sql += " and xl_bm = '"+line+"'";
  122 +// sql += " where t.line_code = " + line;
  123 + }
  124 + sql += " group by xl_bm";
109 List<Map<String, Object>> listLineConfig = jdbcTemplate.query(sql, 125 List<Map<String, Object>> listLineConfig = jdbcTemplate.query(sql,
110 new RowMapper<Map<String, Object>>(){ 126 new RowMapper<Map<String, Object>>(){
111 @Override 127 @Override
112 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 128 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
113 Map<String, Object> m = new HashMap<String, Object>(); 129 Map<String, Object> m = new HashMap<String, Object>();
114 - m.put("id", rs.getLong("id"));  
115 - m.put("out_config", rs.getString("out_config"));  
116 - m.put("start_opt", rs.getString("start_opt")); 130 +// m.put("id", rs.getLong("id"));
  131 +// m.put("out_config", rs.getString("out_config"));
  132 +// m.put("start_opt", rs.getString("start_opt"));
117 m.put("line_code", rs.getString("line_code")); 133 m.put("line_code", rs.getString("line_code"));
118 return m; 134 return m;
119 }}); 135 }});
@@ -133,7 +149,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -133,7 +149,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
133 Map<String, List<Map<String, Object>>> xlMap = new HashMap<String, List<Map<String, Object>>>(); 149 Map<String, List<Map<String, Object>>> xlMap = new HashMap<String, List<Map<String, Object>>>();
134 for(Map<String, Object> m : xlList){ 150 for(Map<String, Object> m : xlList){
135 if(m.containsKey("line") && m.get("line").toString().trim().length() > 0){ 151 if(m.containsKey("line") && m.get("line").toString().trim().length() > 0){
136 - String key = m.get("line").toString(); 152 + String key = m.get("line").toString().trim();
137 if(!xlMap.containsKey(key)) 153 if(!xlMap.containsKey(key))
138 xlMap.put(key, new ArrayList<Map<String, Object>>()); 154 xlMap.put(key, new ArrayList<Map<String, Object>>());
139 xlMap.get(key).add(m); 155 xlMap.get(key).add(m);
@@ -151,7 +167,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -151,7 +167,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
151 return m; 167 return m;
152 }}); 168 }});
153 169
  170 + Map<String, List<ScheduleRealInfo>> scheMap = new HashMap<String, List<ScheduleRealInfo>>();
  171 + List<ScheduleRealInfo> list = calcRepository.findAllScheduleByDate(date);
  172 + for(ScheduleRealInfo s : list){
  173 + String xlBm = s.getXlBm();
  174 + if(!scheMap.containsKey(xlBm)){
  175 + scheMap.put(xlBm, new ArrayList<ScheduleRealInfo>());
  176 + }
  177 + scheMap.get(xlBm).add(s);
  178 + }
  179 +
154 Set<String> lineSet = new HashSet<String>(); 180 Set<String> lineSet = new HashSet<String>();
  181 + List<CalcWaybill> all = new ArrayList<CalcWaybill>();
155 for (int i = 0; i < listLineConfig.size(); i++) { 182 for (int i = 0; i < listLineConfig.size(); i++) {
156 Map<String, Object> m =listLineConfig.get(i); 183 Map<String, Object> m =listLineConfig.get(i);
157 String lineCode=m.get("line_code").toString().trim(); 184 String lineCode=m.get("line_code").toString().trim();
@@ -164,13 +191,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -164,13 +191,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
164 tempList = xlMap.get(lineCode); 191 tempList = xlMap.get(lineCode);
165 } 192 }
166 193
167 - List<CalcWaybill> findAll = calcToolService.findAll(date, lineCode, tempList, djgList); 194 + if(!scheMap.containsKey(lineCode))
  195 + continue;
  196 + List<CalcWaybill> findAll = calcToolService.findAll(date, lineCode, scheMap.get(lineCode), tempList, djgList);
  197 + all.addAll(findAll);
168 198
169 -// new BatchSaveUtils<CalcWaybill>().saveList2(findAll, CalcWaybill.class);  
170 -  
171 -// if(xlMap.get(lineCode).size() == 0)  
172 - calcRepository.save(findAll);  
173 } 199 }
  200 +// new BatchSaveUtils<CalcWaybill>().saveList2(all, CalcWaybill.class);
  201 + calcRepository.save(all);
174 202
175 newMap.put("status", ResponseCode.SUCCESS); 203 newMap.put("status", ResponseCode.SUCCESS);
176 } catch (Exception e) { 204 } catch (Exception e) {
@@ -243,6 +271,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -243,6 +271,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
243 calc.setLblcYw(Arith.add(calc.getLblcYw(), c.getLblcYw())); 271 calc.setLblcYw(Arith.add(calc.getLblcYw(), c.getLblcYw()));
244 calc.setLblcQt(Arith.add(calc.getLblcQt(), c.getLblcQt())); 272 calc.setLblcQt(Arith.add(calc.getLblcQt(), c.getLblcQt()));
245 calc.setLjyylc(Arith.add(calc.getLjyylc(), c.getLjyylc())); 273 calc.setLjyylc(Arith.add(calc.getLjyylc(), c.getLjyylc()));
  274 + calc.setLjfyylc(Arith.add(calc.getLjfyylc(), c.getLjfyylc()));
246 calc.setJhyybc(calc.getJhyybc() + c.getJhyybc()); 275 calc.setJhyybc(calc.getJhyybc() + c.getJhyybc());
247 calc.setJhyybczgf(calc.getJhyybczgf() + c.getJhyybczgf()); 276 calc.setJhyybczgf(calc.getJhyybczgf() + c.getJhyybczgf());
248 calc.setJhyybcwgf(calc.getJhyybcwgf() + c.getJhyybcwgf()); 277 calc.setJhyybcwgf(calc.getJhyybcwgf() + c.getJhyybcwgf());
@@ -260,6 +289,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -260,6 +289,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
260 calc.setDtbcwgf(calc.getDtbcwgf() + c.getDtbcwgf()); 289 calc.setDtbcwgf(calc.getDtbcwgf() + c.getDtbcwgf());
261 } 290 }
262 calc.setSjyylc(Arith.add(calc.getSjyylc(), calc.getLjyylc())); 291 calc.setSjyylc(Arith.add(calc.getSjyylc(), calc.getLjyylc()));
  292 + calc.setSjfyylc(Arith.add(calc.getSjfyylc(), calc.getLjfyylc()));
263 lists.add(calc); 293 lists.add(calc);
264 } 294 }
265 CalcInterval sum_ = new CalcInterval(); 295 CalcInterval sum_ = new CalcInterval();
@@ -304,7 +334,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -304,7 +334,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
304 sum.setLblcQh(Arith.add(sum.getLblcQh()!=null?sum.getLblcQh():0, c.getLblcQh())); 334 sum.setLblcQh(Arith.add(sum.getLblcQh()!=null?sum.getLblcQh():0, c.getLblcQh()));
305 sum.setLblcYw(Arith.add(sum.getLblcYw()!=null?sum.getLblcYw():0, c.getLblcYw())); 335 sum.setLblcYw(Arith.add(sum.getLblcYw()!=null?sum.getLblcYw():0, c.getLblcYw()));
306 sum.setLblcQt(Arith.add(sum.getLblcQt()!=null?sum.getLblcQt():0, c.getLblcQt())); 336 sum.setLblcQt(Arith.add(sum.getLblcQt()!=null?sum.getLblcQt():0, c.getLblcQt()));
307 - sum.setLjyylc(Arith.add(sum.getLjyylc()!=null?sum.getLjyylc():0, c.getLjyylc()));  
308 sum.setJhyybc(sum.getJhyybc() + c.getJhyybc()); 337 sum.setJhyybc(sum.getJhyybc() + c.getJhyybc());
309 sum.setJhyybczgf(sum.getJhyybczgf() + c.getJhyybczgf()); 338 sum.setJhyybczgf(sum.getJhyybczgf() + c.getJhyybczgf());
310 sum.setJhyybcwgf(sum.getJhyybcwgf() + c.getJhyybcwgf()); 339 sum.setJhyybcwgf(sum.getJhyybcwgf() + c.getJhyybcwgf());
@@ -331,9 +360,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -331,9 +360,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
331 m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); 360 m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
332 m.put("jhlc", c.getJhyylc()); 361 m.put("jhlc", c.getJhyylc());
333 m.put("jcclc", c.getJhfyylc()); 362 m.put("jcclc", c.getJhfyylc());
334 - m.put("sjzgl", Arith.add(Arith.add(c.getSjyylc(), c.getLjyylc()), Arith.add(c.getSjfyylc(), c.getLjfyylc())));  
335 - m.put("sjgl", Arith.add(c.getSjyylc(), c.getLjyylc()));  
336 - m.put("sjksgl", Arith.add(c.getSjfyylc(), c.getLjfyylc())); 363 +// m.put("sjzgl", Arith.add(Arith.add(c.getSjyylc(), c.getLjyylc()), Arith.add(c.getSjfyylc(), c.getLjfyylc())));
  364 +// m.put("sjgl", Arith.add(c.getSjyylc(), c.getLjyylc()));
  365 +// m.put("sjksgl", Arith.add(c.getSjfyylc(), c.getLjfyylc()));
  366 + m.put("sjzgl", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  367 + m.put("sjgl", c.getSjyylc());
  368 + m.put("sjksgl", c.getSjfyylc());
337 m.put("ssgl", c.getLblc()); 369 m.put("ssgl", c.getLblc());
338 m.put("ssbc", c.getLbbc()); 370 m.put("ssbc", c.getLbbc());
339 m.put("ssgl_lz", c.getLblcLz()); 371 m.put("ssgl_lz", c.getLblcLz());
@@ -386,7 +418,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -386,7 +418,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
386 } 418 }
387 419
388 /** 420 /**
389 - * @param rq 格式如:2018-03-22(留空""默认当前日期前天) 421 + * @param rq 格式如:2018-03-22(留空""默认当前日期前天)
390 * @param line (留空""默认全部线路) 422 * @param line (留空""默认全部线路)
391 */ 423 */
392 @Transactional 424 @Transactional
@@ -400,7 +432,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -400,7 +432,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
400 Date dBefore = new Date(); 432 Date dBefore = new Date();
401 Calendar calendar = Calendar.getInstance(); //得到日历 433 Calendar calendar = Calendar.getInstance(); //得到日历
402 calendar.setTime(dNow);//把当前时间赋给日历 434 calendar.setTime(dNow);//把当前时间赋给日历
403 - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 435 + calendar.add(Calendar.DAY_OF_MONTH, -2); //设置为前一天
404 dBefore = calendar.getTime(); //得到前一天的时间 436 dBefore = calendar.getTime(); //得到前一天的时间
405 rq = sdf.format(dBefore); 437 rq = sdf.format(dBefore);
406 } else { 438 } else {
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -527,11 +527,17 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -527,11 +527,17 @@ public class TrafficManageServiceImpl implements TrafficManageService{
527 } 527 }
528 e.printStackTrace(); 528 e.printStackTrace();
529 }finally{ 529 }finally{
530 - //发送邮件  
531 - EmailBean mail = new EmailBean();  
532 - mail.setSubject("路单日志数据"+date);  
533 - mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure);  
534 - sendEmailController.sendMail(emailSendToAddress, mail); 530 + try {
  531 + //发送邮件
  532 + EmailBean mail = new EmailBean();
  533 + mail.setSubject("路单日志数据"+date);
  534 + mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure);
  535 + sendEmailController.sendMail(emailSendToAddress, mail);
  536 + logger.info("setLD-sendMail:邮件发送成功!");
  537 + }catch (Exception e){
  538 + e.printStackTrace();
  539 + logger.error("setLD-sendMail:",e);
  540 + }
535 } 541 }
536 return result; 542 return result;
537 } 543 }
src/main/resources/static/pages/base/timesmodel/countadd.html
@@ -25,8 +25,8 @@ @@ -25,8 +25,8 @@
25 <div class="modal-footer"> 25 <div class="modal-footer">
26 <button type="button" class="btn default" data-dismiss="modal">关闭</button> 26 <button type="button" class="btn default" data-dismiss="modal">关闭</button>
27 </div> 27 </div>
28 - </div>  
29 - </div> 28 + </div>
  29 + </div>
30 </div> 30 </div>
31 <script type="text/html" id="countAdd_temp"> 31 <script type="text/html" id="countAdd_temp">
32 {{each list as obj i }} 32 {{each list as obj i }}
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -44,6 +44,9 @@ @@ -44,6 +44,9 @@
44 <div class="btn-group btn-group-devided countbtn" data-toggle="buttons"> 44 <div class="btn-group btn-group-devided countbtn" data-toggle="buttons">
45 <a class="btn btn-circle blue countAdd" href="javascript:;" data-pjax><i class="fa fa-database"></i> 统计数据</a> 45 <a class="btn btn-circle blue countAdd" href="javascript:;" data-pjax><i class="fa fa-database"></i> 统计数据</a>
46 </div> 46 </div>
  47 + <div class="btn-group btn-group-devided parambtn" data-toggle="buttons">
  48 + <a class="btn btn-circle blue paramAdd" href="javascript:;" data-pjax><i class="fa fa-list-ol" aria-hidden="true"></i> 重新生成</a>
  49 + </div>
47 <!--<div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">--> 50 <!--<div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">-->
48 <!--<a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>--> 51 <!--<a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>-->
49 <!--</div>--> 52 <!--</div>-->
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
@@ -312,6 +312,23 @@ $(&#39;.editlp&#39;).on(&#39;click&#39;,function() { @@ -312,6 +312,23 @@ $(&#39;.editlp&#39;).on(&#39;click&#39;,function() {
312 /************************************************************************************************************************************************/ 312 /************************************************************************************************************************************************/
313 313
314 /** 314 /**
  315 + * @description : (TODO) 重新生成事件.
  316 + *
  317 + * @status OK.
  318 + ************************************************************************************************************************************************/
  319 +$('.parambtn').on('click', function() {
  320 + // 弹出层mobal页面
  321 + $.get('/pages/base/timesmodel/paramadd.html', function(m){
  322 + $(pjaxContainer).append(m);
  323 + // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。
  324 + $('#paramadd_mobal').trigger('paramAddMobal.show', $_GlobalGraph);
  325 + });
  326 +});
  327 +
  328 +/************************************************************************************************************************************************/
  329 +
  330 +
  331 +/**
315 * @description : (TODO) 监听统计数据事件. 332 * @description : (TODO) 监听统计数据事件.
316 * 333 *
317 * @status OK. 334 * @status OK.
src/main/resources/static/pages/base/timesmodel/paramadd.html 0 → 100644
  1 +<!-- 统计数据 -->
  2 +<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog" style="margin-left: 200px;">
  4 + <div class="modal-content" style="width: 900px;">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">参数数据 </h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate">
  11 + <div class="form-body">
  12 + <div class="alert alert-danger display-hide">
  13 + <button class="close" data-close="alert"></button>
  14 + 您的输入有误,请检查下面的输入项
  15 + </div>
  16 + <div class="alert alert-success display-none">
  17 + <button class="close" data-dismiss="alert"></button>
  18 + 验证成功!
  19 + </div>
  20 +
  21 + </div>
  22 +
  23 + <div class="tab-pane" id="ptab">
  24 +
  25 + </div>
  26 + </form>
  27 + </div>
  28 +
  29 + <div class="modal-footer">
  30 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  31 + <button type="button" class="btn btn-primary" id="paramnext">确定</button>
  32 + </div>
  33 +
  34 + </div>
  35 + </div>
  36 +</div>
  37 +
  38 +<script type="text/html" id = "paramAdd_temp">
  39 + <div class="form-group">
  40 + <div class="col-md-6">
  41 + <label class="control-label col-md-5">
  42 + <span class="required"> * </span> 上行首班时间 :
  43 + </label>
  44 + <div class="col-md-5">
  45 + <input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id"
  46 + placeholder="请输入起始站首班时间">
  47 + </div>
  48 + </div>
  49 + <div class="col-md-6">
  50 + <label class="control-label col-md-5">
  51 + <span class="required"> * </span> 上行末班时间 :
  52 + </label>
  53 + <div class="col-md-5">
  54 + <input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id"
  55 + placeholder="请输入起始站末班时间">
  56 + </div>
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="form-group">
  61 + <div class="col-md-6">
  62 + <label class="control-label col-md-5">
  63 + <span class="required"> * </span> 下行首班时间 :
  64 + </label>
  65 + <div class="col-md-5">
  66 + <input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id"
  67 + placeholder="请输入终点站首班时间">
  68 + </div>
  69 + </div>
  70 + <div class="col-md-6">
  71 + <label class="control-label col-md-5">
  72 + <span class="required"> * </span> 下行末班时间 :
  73 + </label>
  74 + <div class="col-md-5">
  75 + <input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id"
  76 + placeholder="请输入终点站末班时间">
  77 + </div>
  78 + </div>
  79 + </div>
  80 +
  81 + <div class="form-group">
  82 + <div class="col-md-6">
  83 + <label class="control-label col-md-5">
  84 + <span class="required"> * </span> 早高峰开始时间 :
  85 + </label>
  86 + <div class="col-md-5">
  87 + <input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id"
  88 + placeholder="请输入早高峰开始时间">
  89 + </div>
  90 + </div>
  91 + <div class="col-md-6">
  92 + <label class="control-label col-md-5">
  93 + <span class="required"> * </span> 早高峰结束时间 :
  94 + </label>
  95 + <div class="col-md-5">
  96 + <input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id"
  97 + placeholder="请输入早高峰结束时间">
  98 + </div>
  99 + </div>
  100 + </div>
  101 +
  102 + <div class="form-group">
  103 + <div class="col-md-6">
  104 + <label class="control-label col-md-5">
  105 + <span class="required"> * </span> 晚高峰开始时间 :
  106 + </label>
  107 + <div class="col-md-5">
  108 + <input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id"
  109 + placeholder="请输入晚高峰开始时间">
  110 + </div>
  111 + </div>
  112 + <div class="col-md-6">
  113 + <label class="control-label col-md-5">
  114 + <span class="required"> * </span> 晚高峰结束时间 :
  115 + </label>
  116 + <div class="col-md-5">
  117 + <input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id"
  118 + placeholder="请输入晚高峰结束时间">
  119 + </div>
  120 + </div>
  121 + </div>
  122 +
  123 + <div class="form-group">
  124 + <div class="col-md-6">
  125 + <label class="control-label col-md-5">上行进场时间  :
  126 + </label>
  127 + <div class="col-md-5">
  128 + <input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"
  129 + placeholder="请输入上行进场时间">
  130 + </div>
  131 + </div>
  132 + <div class="col-md-6">
  133 + <label class="control-label col-md-5">上行出场时间  :
  134 + </label>
  135 + <div class="col-md-5">
  136 + <input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"
  137 + placeholder="请输入上行出场时间">
  138 + </div>
  139 + </div>
  140 + </div>
  141 +
  142 + <div class="form-group">
  143 + <div class="col-md-6">
  144 + <label class="control-label col-md-5">下行进场时间  :
  145 + </label>
  146 + <div class="col-md-5">
  147 + <input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"
  148 + placeholder="请输入下行进场时间">
  149 + </div>
  150 + </div>
  151 + <div class="col-md-6">
  152 + <label class="control-label col-md-5">下行出场时间  :
  153 + </label>
  154 + <div class="col-md-5">
  155 + <input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"
  156 + placeholder="请输入下行出场时间">
  157 + </div>
  158 + </div>
  159 + </div>
  160 +
  161 + <div class="form-group">
  162 + <div class="col-md-6">
  163 + <label class="control-label col-md-5">早高峰上行时间 :</label>
  164 + <div class="col-md-5">
  165 + <input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime}}" id="earlyUpTime_id"
  166 + placeholder="请输入早高峰上行时间">
  167 + </div>
  168 + </div>
  169 + <div class="col-md-6">
  170 + <label class="control-label col-md-5">早高峰下行时间 :</label>
  171 + <div class="col-md-5">
  172 + <input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime}}" id="earlyDownTime_id"
  173 + placeholder="请输入早高峰下行时间">
  174 + </div>
  175 + </div>
  176 + </div>
  177 +
  178 + <div class="form-group">
  179 + <div class="col-md-6">
  180 + <label class="control-label col-md-5">晚高峰上行时间 :</label>
  181 + <div class="col-md-5">
  182 + <input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime}}" id="lateUpTime_id"
  183 + placeholder="请输入晚高峰上行时间">
  184 + </div>
  185 + </div>
  186 + <div class="col-md-6">
  187 + <label class="control-label col-md-5">晚高峰下行时间 :</label>
  188 + <div class="col-md-5">
  189 + <input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime}}" id="lateDownTime_id"
  190 + placeholder="请输入晚高峰下行时间">
  191 + </div>
  192 + </div>
  193 + </div>
  194 +
  195 + <div class="form-group">
  196 + <div class="col-md-6">
  197 + <label class="control-label col-md-5">低谷上行时间  :</label>
  198 + <div class="col-md-5">
  199 + <input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime}}" id="troughUpTime_id"
  200 + placeholder="请输入低谷上行时间">
  201 + </div>
  202 + </div>
  203 + <div class="col-md-6">
  204 + <label class="control-label col-md-5">低谷下行时间  :</label>
  205 + <div class="col-md-5">
  206 + <input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime}}" id="troughDownTime_id"
  207 + placeholder="请输入低谷下行时间">
  208 + </div>
  209 + </div>
  210 + </div>
  211 +
  212 + <div class="form-group">
  213 + <div class="col-md-6">
  214 + <label class="control-label col-md-5">
  215 + <span class="required"> * </span> 线路规划类型  :
  216 + </label>
  217 + <div class="col-md-5">
  218 + <select name="linePlayType" class="form-control" id="linePlayType_id">
  219 + <option value="">-- 请选择线路类型 --</option>
  220 + <option value="0">双向</option>
  221 + <option value="1">环线</option>
  222 + </select>
  223 + </div>
  224 + </div>
  225 + <div class="col-md-6">
  226 + <label class="control-label col-md-5">吃饭地点    :</label>
  227 + <div class="col-md-5">
  228 + <select type="text" class="form-control" name="cfdd" id="cfdd_id">
  229 + <option value="">请选择...</option>
  230 + <option value="0">{{map.startStationName}}</option>
  231 + <option value="1">{{map.endStationName}}</option>
  232 + <option value="allYes">起终点站都可以</option>
  233 + </select>
  234 + </div>
  235 + </div>
  236 + </div>
  237 +
  238 + <div class="form-group">
  239 + <div class="col-md-6">
  240 + <label class="control-label col-md-5">早晚例行保养  :</label>
  241 + <div class="col-md-5">
  242 + <input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id"
  243 + placeholder="请输入早晚例行保养">
  244 + </div>
  245 + </div>
  246 + <div class="col-md-6">
  247 + <label class="control-label col-md-5">停车场     :</label>
  248 + <div class="col-md-5">
  249 + <select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select>
  250 + </div>
  251 + </div>
  252 + </div>
  253 +
  254 +
  255 + <div class="form-group">
  256 + <div class="col-md-6">
  257 + <label class="control-label col-md-5">工作餐午餐时间 :</label>
  258 + <div class="col-md-5">
  259 + <input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id"
  260 + placeholder="请输入工作餐午餐时间">
  261 + </div>
  262 + </div>
  263 + <div class="col-md-6">
  264 + <label class="control-label col-md-5">工作餐晚餐时间 :</label>
  265 + <div class="col-md-5">
  266 + <input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id"
  267 + placeholder="请输入工作餐晚餐时间">
  268 + </div>
  269 + </div>
  270 + </div>
  271 +
  272 + <div class="form-group">
  273 + <div class="col-md-6">
  274 + <label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label>
  275 + <div class="col-md-3" style="padding-right: 0px;">
  276 + <input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id"
  277 + placeholder="最小间隔">
  278 + </div>
  279 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  280 + <div class="col-md-3" style="padding-left: 0px;">
  281 + <input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id"
  282 + placeholder="最大间隔">
  283 + </div>
  284 + </div>
  285 + <div class="col-md-6">
  286 + <label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label>
  287 + <div class="col-md-3" style="padding-right: 0px;">
  288 + <input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id"
  289 + placeholder="最小间隔">
  290 + </div>
  291 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  292 + <div class="col-md-3" style="padding-left: 0px;">
  293 + <input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id"
  294 + placeholder="最大间隔">
  295 + </div>
  296 + </div>
  297 + </div>
  298 +
  299 + <div class="form-group">
  300 + <div class="col-md-6">
  301 + <label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label>
  302 + <div class="col-md-3" style="padding-right: 0px;">
  303 + <input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id"
  304 + placeholder="最小间隔">
  305 + </div>
  306 + <div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
  307 + <div class="col-md-3" style="padding-left: 0px;">
  308 + <input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id"
  309 + placeholder="最大间隔">
  310 + </div>
  311 + </div>
  312 + <div class="col-md-6">
  313 + <label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label>
  314 + <div class="col-md-5">
  315 + <input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id"
  316 + placeholder="为0表示是周末时刻表">
  317 + </div>
  318 + </div>
  319 + </div>
  320 +
  321 + <!-- 隐藏字段-时间 -->
  322 + <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/>
  323 + <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/>
  324 + <input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/>
  325 + <input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/>
  326 + <input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/>
  327 +
  328 + <!-- 上下行行驶时间 -->
  329 + <input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/>
  330 + <input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/>
  331 +
  332 + <!-- 隐藏字段-里程 -->
  333 + <!-- 上下行行驶里程 -->
  334 + <input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/>
  335 + <input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/>
  336 + <!-- 上下行进场出场里程 -->
  337 + <input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/>
  338 + <input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/>
  339 + <input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/>
  340 + <input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/>
  341 +
  342 +
  343 +</script>
  344 +
  345 +<script type="text/javascript">
  346 + $('#paramadd_mobal').on('paramAddMobal.show', function(e, g_){
  347 + // 加载延迟200毫秒显示mobal
  348 + setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
  349 + var param = JSON.parse(window.localStorage.Gantt_AgursData);
  350 +
  351 + // 获取表单元素
  352 + var form = $('#param_form');
  353 + // 错误提示元素
  354 + var paramAlert = $('.alert-danger', form);
  355 + // 确定事件点击
  356 + $('#paramnext').on('click', function() {
  357 + form.submit();// 表单提交
  358 + });
  359 +
  360 + // 表单验证
  361 + form.validate({
  362 + errorElement : 'span',
  363 + errorClass : 'help-block help-block-error',
  364 + focusInvalid : false,
  365 + rules: {
  366 + 'skbName' : {required : true,},// 时刻表名称,必填项.
  367 + 'lineName' : {required : true,},// 线路名称,必填项.
  368 + 'lineVersion': {required: true}, // 站点路由版本,必填项,
  369 + 'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项.
  370 + 'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项.
  371 + 'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项.
  372 + 'endStationEndTime' : {required : true}, // 终点站末班时间,必填项.
  373 + 'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 .
  374 + 'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 .
  375 + 'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 .
  376 + 'lateEndTime' : {required : true},// 晚高峰结束时间,必填项.
  377 + 'upInTimer' : {number : true},// 上行进场时间,必须为数字.
  378 + 'upOutTimer' : {number : true},// 上行出场时间,必须为数字.
  379 + 'downInTimer' : {number : true},// 下行进场时间,必须为数字.
  380 + 'downOutTimer' : {number : true},// 下行出场时间,必须为数字.
  381 + 'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字.
  382 + 'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字.
  383 + 'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字.
  384 + 'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字.
  385 + 'troughUpTime' : {number : true},// 低谷上行时间,必须为数字.
  386 + 'troughDownTime' : {number : true},// 低谷下行时间,必须为数字.
  387 + 'linePlayType' : {required : true},// 线路规划类型,必填项
  388 + 'lb' : {number : true},// 早晚例行保养,必须为数字.
  389 + 'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字.
  390 + 'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字.
  391 + 'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔.
  392 + 'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔.
  393 + 'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔.
  394 + 'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔.
  395 + 'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔.
  396 + 'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔.
  397 + 'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数
  398 + 'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数.
  399 + 'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数.
  400 + 'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数.
  401 + 'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数.
  402 + 'upInMileage' : {number : true},// 上行进场里程,必须为数字.
  403 + 'upOutMileage' : {number : true},// 上行出场里程,必须为数字.
  404 + 'downInMileage' : {number : true},// 下行进场里程,必须为数字.
  405 + 'downOutMileage' : {number : true}// 下行出场里程,必须为数字.
  406 +
  407 + // TODO
  408 + },
  409 + invalidHandler : function(event, validator) {
  410 + paramAlert.show();
  411 + App.scrollTo(paramAlert, -200);
  412 + },
  413 + highlight : function(element) {
  414 + $(element).closest('.form-group').addClass('has-error');
  415 + },
  416 + unhighlight : function(element) {
  417 + $(element).closest('.form-group').removeClass('has-error');
  418 + },
  419 + success : function(label) {
  420 + label.closest('.form-group').removeClass('has-error');
  421 + },
  422 + submitHandler : function(f) {
  423 + // 1、 获取表单内容,并序列化
  424 + var fp = form.serializeJSON();
  425 +
  426 + // 2、重新刷新表单数据
  427 + var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData);
  428 + var key;
  429 + for (key in fp) {
  430 + if (ganttMap[key]) {
  431 + if (ganttMap[key] != fp[key]) {
  432 + ganttMap[key] = fp[key];
  433 + }
  434 + }
  435 + }
  436 + window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap));
  437 +
  438 + // TODO
  439 + var pp = getParamObjAndDataMap();
  440 + var paramObj = pp[0];
  441 + var dataMap = pp[1];
  442 + var csMap = getCSMap(paramObj);
  443 + console.log(graph);
  444 + var data = Main_v2.BXPplaceClassesTime03(paramObj, csMap.maxCar);
  445 + Main_v2.exportDataConfig(data.aInternalLpObj);
  446 +
  447 + // var data = obj.getDataArray();
  448 + // // 2、 调整路牌对应的班次总数
  449 + // updFormParams(params,data);
  450 + // 删除图形.
  451 + $('svg.svg-chart').remove();
  452 + // 重新创建图形.
  453 + var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data));
  454 + // 根据数据重新渲染图形.
  455 + graph.data(data.json);
  456 + // 记录早操.并保存历史班次数据
  457 + graph.addHistory();
  458 + // 隐藏错误提示
  459 + paramAlert.hide();
  460 + // 隐藏 reladplus_mobal 弹出层
  461 + $('#paramadd_mobal').modal('hide');
  462 + layer.msg('成功!');
  463 + }
  464 + });
  465 +
  466 +
  467 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  468 + $('#paramadd_mobal').on('show.bs.modal', function () {
  469 + // TODO
  470 + // 把数据填充到模版中
  471 + // var tbodyHtml = template('countAdd_temp',{list:countDate});
  472 + // // 把渲染好的模版html文本追加到表格中
  473 + // $('#datatable_countadd tbody').html(tbodyHtml);
  474 + var htmldata = template('paramAdd_temp', {map : param});
  475 + $('#ptab').html(htmldata);
  476 +
  477 + // 线路规划类型
  478 + $('#linePlayType_id').val(param.linePlayType);
  479 + // 吃饭地点
  480 + $get('/stationroute/all', {
  481 + 'line.id_eq': param.lineName.split('_')[0],
  482 + 'destroy_eq': 0,
  483 + 'versions_eq': param.lineVersion},
  484 + function(result) {
  485 + var opt = [];
  486 + opt.push('<option value="">请选择...</option>');
  487 + $.each(result, function(i, d) {
  488 + if (d.stationMark == 'B' && d.directions == 0) {
  489 + opt.push("<option value='0'>" + d.stationName + "</option>");
  490 + } else if (d.stationMark == 'E' && d.directions == 0) {
  491 + opt.push("<option value='1'>" + d.stationName + "</option>");
  492 + }
  493 + });
  494 + opt.push("<option value='allYes'>起终点站都可以</option>");
  495 + $('#cfdd_id').html(opt.join(""));
  496 + $('#cfdd_id').val(param.cfdd);
  497 +
  498 + }
  499 + );
  500 + // 停车场
  501 + $get('/carpark/all',null, function(cd) {
  502 + var opt = [];
  503 + opt.push('<option value="">请选择...</option><optgroup label="停车场">');
  504 + var $_len = cd.length;
  505 + if($_len > 0) {
  506 + $.each(cd, function(i, d){
  507 + opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>');
  508 + });
  509 + }
  510 + opt.push('</optgroup>');
  511 + $('#carPark_id').html(opt.join(",")).select2();
  512 + $('#carPark_id').select2("val", param.carPark);
  513 + });
  514 +
  515 + // 上下行首末班日期控件
  516 + $('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  517 + $('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  518 + $('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  519 + $('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  520 +
  521 + // 早高峰晚高峰日期控件
  522 + $('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  523 + $('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  524 + $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  525 + $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  526 +
  527 +
  528 +
  529 + });
  530 + });
  531 +
  532 + function getMinDate(d1,d2) {
  533 + // 1、定义返回字符串.
  534 + var str = '';
  535 + // 2、判断时间大小.
  536 + if(strToTime(d1)>strToTime(d2))
  537 + str = d2;
  538 + else
  539 + str = d1;
  540 + // 3、返回最小时间(字符串).
  541 + return str;
  542 + }
  543 +
  544 + function strToTime(t) {
  545 + var d = new Date();
  546 + if(t) {
  547 + var _str = t.split(':');
  548 + d.setHours(parseInt(_str[0]));
  549 + d.setMinutes(parseInt(_str[1]));
  550 + }
  551 + return d;
  552 + }
  553 +
  554 + function getMaxDate(d1,d2) {
  555 + // 1、定义返回时间字符串.
  556 + var str = '';
  557 + // 2、判断时间大小.
  558 + if(strToTime(d1)>strToTime(d2))
  559 + str = d1;
  560 + else
  561 + str = d2;
  562 + // 3、返回一个最大时间(字符串).
  563 + return str;
  564 + }
  565 +
  566 + function getEndDate(date) {
  567 + var lastEndDate = Date.now();
  568 + if (date) {
  569 + var str = date.replace(/-/g,"/");
  570 + lastEndDate = new Date(str);
  571 + }
  572 + // Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间)
  573 + return lastEndDate;
  574 + }
  575 +
  576 + function formatPairing(v1,v2) {
  577 + v1 = v1 == '' ? 0 : parseInt(v1);
  578 + v2 = v2 == ''? 0 : parseInt(v2) ;
  579 + return [v1,v2];
  580 + }
  581 +
  582 + function qzdz(zd1,zd2) {
  583 + return [zd1,zd2];
  584 + }
  585 +
  586 + function formatksjssj(gp) {
  587 + return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}];
  588 + }
  589 +
  590 + function getsd(st,ed) {
  591 + return [{'st':st,'ed':ed}];
  592 + }
  593 +
  594 + function getDateTime(time) {
  595 + var dateTime = new Date();
  596 + var timeArr;
  597 + if(time !=null && time !='' && typeof(time) !='undefined') {
  598 + timeArr = time.split(':');
  599 + dateTime.setHours(parseInt(timeArr[0]));
  600 + dateTime.setMinutes(parseInt(timeArr[1]));
  601 + }
  602 + return dateTime;
  603 + }
  604 +
  605 + function getYAxisCarArray(len) {
  606 + var array = new Array();
  607 + if(len>0) {
  608 + for(var y = 0; y<len; y++) {
  609 + array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象
  610 + };
  611 + }
  612 + return array;
  613 + }
  614 +
  615 + function getylp(arr) {
  616 + var ra = new Array(),name = new Array();
  617 + for(var i = 0 ; i<arr.length;i++) {
  618 + ra.push(arr[i].lpNo);
  619 + name.push(arr[i].lpName);
  620 + }
  621 + return {'lpNoA':ra,'lpNameA':name,};
  622 + }
  623 +
  624 + function getParamObjAndDataMap() {
  625 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  626 + // seMap
  627 + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
  628 + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
  629 + // dirA
  630 + var dirA = ['relationshipGraph-up', 'relationshipGraph-down'];
  631 + // bcTypeArr
  632 + var bcTypeArr = {
  633 + 'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc',
  634 + 'major': 'major', 'venting': 'venting', 'region': 'region'
  635 + };
  636 + // seDate
  637 + var newDate = new Date();
  638 + var kssj = d3.time.hour.offset(getEndDate(
  639 + newDate.getFullYear()+ "-" +
  640 + (newDate.getMonth()+1) + "-" +
  641 + newDate.getDate() + ' ' +
  642 + seMap.s.split(':')[0] + ':00'),-1);
  643 +
  644 + var year = '' , month = '',dt = '';
  645 + if(newDate.getDate()+1>31)
  646 + dt = '01';
  647 + else
  648 + dt = newDate.getDate()+1;
  649 + if(newDate.getMonth()+1>12)
  650 + month = '01';
  651 + else if(newDate.getDate()+1>31)
  652 + month = newDate.getMonth()+2;
  653 + else
  654 + month = newDate.getMonth()+1;
  655 + if(newDate.getMonth()+1>12)
  656 + year = newDate.getFullYear()+1;
  657 + else
  658 + year = newDate.getFullYear();
  659 + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
  660 + seDate = {'kssj' : kssj, 'jssj' : jssj};
  661 +
  662 + // dataMap
  663 + var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下]
  664 + 'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下]
  665 + 'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下]
  666 + 'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下]
  667 + 'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下]
  668 + 'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime,
  669 + map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下]
  670 + 'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime,
  671 + map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下]
  672 + 'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下]
  673 + 'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下]
  674 + 'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下]
  675 + 'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚]
  676 + 'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间]
  677 + 'zgfsjd' : getsd(getDateTime(map.earlyStartTime),
  678 + getDateTime(map.earlyEndTime)), // 早高峰时间段
  679 + 'wgfsjd' : getsd(getDateTime(map.lateStartTime),
  680 + getDateTime(map.lateEndTime)),// 晚高峰时间段
  681 + 'gfzjsjd' : getsd(getDateTime(map.earlyEndTime),
  682 + getDateTime(map.lateStartTime)),//高峰之间时间段.
  683 + 'wgfzhsjd' : getsd(getDateTime(map.lateEndTime),
  684 + getDateTime(seMap.e)),// 晚高峰之后时间段
  685 + 'zgfzqsjd': getsd(getDateTime(seMap.s),
  686 + getDateTime(map.earlyStartTime)),//早高峰之前时间段.
  687 + 'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下]
  688 + 'bcTypeArr' : bcTypeArr,// 班次类型
  689 + 'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间.
  690 + // 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间.
  691 + // 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间.
  692 + // 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间.
  693 + 'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间.
  694 + 'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间.
  695 + 'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间.
  696 + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙.
  697 + 'map' : map,
  698 + 'zzsj':map.zzsj,// 周转时间.
  699 + };
  700 +
  701 + var _paramObj = Main_v2.getFactory().createParameterObj(map, dataMap);
  702 + map.clzs = _paramObj.calcuClzx();
  703 + return [_paramObj, dataMap];
  704 +
  705 + }
  706 +
  707 + function getCSMap(parmObj) {
  708 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  709 + return {'gattA':null,
  710 + 'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,
  711 + 'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),
  712 + 'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},
  713 + 'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))};
  714 + }
  715 +
  716 + function getGraphArgus(CSMap, dataMap, data) {
  717 + // TODO
  718 + var map = JSON.parse(window.localStorage.Gantt_AgursData);
  719 + var sxsj = parseInt(map.upTravelTime);// 上行时间.
  720 +
  721 + // seMap
  722 + var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
  723 + 'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
  724 +
  725 + // seDate
  726 + var newDate = new Date();
  727 + var kssj = d3.time.hour.offset(getEndDate(
  728 + newDate.getFullYear()+ "-" +
  729 + (newDate.getMonth()+1) + "-" +
  730 + newDate.getDate() + ' ' +
  731 + seMap.s.split(':')[0] + ':00'),-1);
  732 +
  733 + var year = '' , month = '',dt = '';
  734 + if(newDate.getDate()+1>31)
  735 + dt = '01';
  736 + else
  737 + dt = newDate.getDate()+1;
  738 + if(newDate.getMonth()+1>12)
  739 + month = '01';
  740 + else if(newDate.getDate()+1>31)
  741 + month = newDate.getMonth()+2;
  742 + else
  743 + month = newDate.getMonth()+1;
  744 + if(newDate.getMonth()+1>12)
  745 + year = newDate.getFullYear()+1;
  746 + else
  747 + year = newDate.getFullYear();
  748 + var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
  749 + seDate = {'kssj' : kssj, 'jssj' : jssj};
  750 +
  751 +
  752 + var bs = sxsj > 40 ? 4 : 2;
  753 + var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs;
  754 + var VALUEKEYNAME = 'Worldwide Gross' ,
  755 + DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240,
  756 + MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60,
  757 + STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true;
  758 + var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ;
  759 + // 计算出相差天数
  760 + var days=Math.floor(dx_time/(24*3600*1000));
  761 + // 计算出小时数
  762 + var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数
  763 + var hours=Math.floor(leave1/(3600*1000));
  764 + DXHOURS = days*24+hours;
  765 + WIDTH = DXHOURS*MINUTE*MULTIPLE;
  766 + // debugger;
  767 + var lpsplitA = getylp(CSMap.maxCar);
  768 +
  769 + var sxsj = parseInt(map.upTravelTime);// 上行时间.
  770 + var xxsj = parseInt(map.downTravelTime);// 下行时间.
  771 + var stopAraay = [{
  772 + 'sxsj':sxsj,// 上行时间.
  773 + 'xxsj':xxsj,// 下行时间.
  774 + 'zzsj':map.zzsj,// 周转时间.
  775 + 'wcsj':parseInt(map.workeLunch),// 午餐时间.
  776 + 'wcsj':parseInt(map.workeDinner),// 晚餐时间.
  777 + 'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间.
  778 + 'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间.
  779 + 'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间.
  780 + 'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间.
  781 + 'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间.
  782 + 'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间.
  783 + 'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间.
  784 + 'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间.
  785 + 'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程.
  786 + 'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程.
  787 + 'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程.
  788 + 'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程.
  789 + 'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间.
  790 + }];
  791 +
  792 + var args = {
  793 + 'valueKeyName': VALUEKEYNAME,
  794 + 'hours' : DXHOURS,
  795 + 'dxHours' : 24 - DXHOURS,
  796 + 'multiple': MULTIPLE,
  797 + 'width':WIDTH,
  798 + 'widtMargin':MARGINLEFT,
  799 + 'height':HEIGHT,
  800 + 'heightMargin':MARGINBOTTOM,
  801 + 'offsetX':OFFSETX,
  802 + 'offsetY':OFFSETY,
  803 + 'downDy':OFFSETDOWNY,
  804 + 'upDy':OFFSETUPY,
  805 + 'timeDomainStart' :STARTDATETIME,
  806 + 'timeDomainEnd' : ENDDATETIME,
  807 + 'startStr':'' + STARTDATETIME,
  808 + 'endStr': '' +ENDDATETIME,
  809 + 'taskTypes': TASKTYPES,
  810 + 'lpNoA':lpsplitA.lpNoA,
  811 + 'lpNameA':lpsplitA.lpNameA,
  812 + 'tickFormat': TICKFORMAT,
  813 + 'stopAraay' : stopAraay,
  814 + 'dataMap':dataMap,
  815 + 'showTooltips': SHOWTOOLTIPS,
  816 + 'bxrcgs':data.bxrcgs
  817 + }
  818 + return args;
  819 + }
  820 +</script>
0 \ No newline at end of file 821 \ No newline at end of file