Commit 84a0f33ffc911d744b45c27b751e0f0c84f27fef

Authored by 廖磊
1 parent a433e0a9

闵行车辆停靠站报表 调度日报导出格式

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 12 import org.springframework.web.bind.annotation.RequestParam;
13 13 import org.springframework.web.bind.annotation.RestController;
14 14  
  15 +import com.bsth.entity.StationRoute;
15 16 import com.bsth.entity.excep.ArrivalInfo;
16 17 import com.bsth.entity.realcontrol.ScheduleRealInfo;
17 18 import com.bsth.service.report.ReportService;
... ... @@ -75,6 +76,17 @@ public class ReportController {
75 76 }
76 77  
77 78  
  79 + @RequestMapping(value="/queryStrinon" ,method = RequestMethod.GET)
  80 + public List<StationRoute> queryStrinon(@RequestParam String line,
  81 + @RequestParam int zd){
  82 + return service.queryStrinon(line,zd);
  83 + }
  84 + @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET)
  85 + public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line,
  86 + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){
  87 + return service.queryInOutStrtion(line,date,zd,lzsj);
  88 + }
  89 +
78 90 @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET)
79 91 public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line,
80 92 @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
... ... @@ -84,6 +96,8 @@ public class ReportController {
84 96  
85 97  
86 98  
  99 +
  100 +
87 101 @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET)
88 102 public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line,
89 103 @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -90,11 +90,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
90 90 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
91 91  
92 92 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
93   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj")
  93 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
94 94 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
95 95  
96 96 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
97   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj")
  97 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
98 98 List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line);
99 99  
100 100 // @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
... ... @@ -105,9 +105,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
105 105 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj")
106 106 List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date);
107 107  
  108 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  109 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual")
  110 + List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd);
108 111  
109 112 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
110   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,dfsj")
  113 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
111 114 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
112 115  
113 116 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -4012,13 +4012,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4012 4012 String xlName = map.get("xlName").toString();
4013 4013 String state = map.get("state").toString();
4014 4014 String type = map.get("type").toString();
4015   -
  4015 +
4016 4016 List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
4017 4017 List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
4018 4018 List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
4019 4019 List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
4020 4020 List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
4021 4021  
  4022 + Map<String, Object> nMap=new HashMap<String, Object>();
  4023 + nMap.put("date", date);
  4024 + nMap.put("jls", list1.get(0).get("jls"));
  4025 + nMap.put("sjgl", list1.get(0).get("sjgl"));
4022 4026 for (Map<String, Object> m : list1) {
4023 4027 // m.put("ssgl", m.get("ssgl"));
4024 4028 // m.put("ssbc", m.get("ssbc"));
... ... @@ -4132,7 +4136,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4132 4136 sdfSimple = new SimpleDateFormat("yyyyMM");
4133 4137 sourcePath = path + "mould/scheduleDaily_m.xls";
4134 4138 }
4135   - ee.excelReplace(listI, new Object[]{m}, sourcePath,
  4139 + ee.excelReplace(listI, new Object[]{nMap}, sourcePath,
4136 4140 path + "export/调度日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
4137 4141 } catch (Exception e) {
4138 4142 // TODO: handle exception
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -3,6 +3,7 @@ package com.bsth.service.report;
3 3 import java.util.List;
4 4 import java.util.Map;
5 5  
  6 +import com.bsth.entity.StationRoute;
6 7 import com.bsth.entity.excep.ArrivalInfo;
7 8 import com.bsth.entity.realcontrol.ScheduleRealInfo;
8 9  
... ... @@ -14,7 +15,8 @@ public interface ReportService {
14 15 List<ArrivalInfo> queryListZdxx(String line,String date,String clzbh,String sjfc,String sjdd);
15 16  
16 17 List<ArrivalInfo> queryListClzd(String line,String zd,String zdlx,String fcsj,String ddsj);
17   -
  18 + List<StationRoute> queryStrinon(String line,int zd);
  19 + List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj);
18 20 List<Map<String, String>> sreachZd(String line,int zdlx,String zd);
19 21  
20 22 List<Object[]> historyMessageCount(String line, String date, String code);
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -59,6 +59,8 @@ public class ReportServiceImpl implements ReportService{
59 59 CulateMileageService culateService;
60 60 @Autowired
61 61 LineRepository lineRepository;
  62 + @Autowired
  63 + StationRouteRepository stationRouteRepository;
62 64 @Override
63 65 public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) {
64 66 // TODO Auto-generated method stub
... ... @@ -1469,4 +1471,185 @@ public class ReportServiceImpl implements ReportService{
1469 1471 }
1470 1472 return list;
1471 1473 }
  1474 +
  1475 + public List<ArrivalInfo> load3(String line, String date, int zd){
  1476 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1477 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  1478 + Long date1=0L;
  1479 + Long date2=0L;
  1480 + Calendar cal = Calendar.getInstance();
  1481 + try {
  1482 + Date dates1 = simpleDateFormat.parse(date+" 00:00:01");
  1483 + Date dates2=simpleDateFormat.parse(date+" 23:59:59");
  1484 + date1=dates1.getTime();
  1485 + date2=dates2.getTime();
  1486 + cal.setTime(dates1);
  1487 + } catch (ParseException e1) {
  1488 + // TODO Auto-generated catch block
  1489 + e1.printStackTrace();
  1490 + }
  1491 + //周数,表分区字段
  1492 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  1493 + List<ArrivalInfo> list = null;
  1494 + Connection conn = null;
  1495 + PreparedStatement ps = null;
  1496 + ResultSet rs = null;
  1497 +
  1498 + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
  1499 + + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
  1500 + try{
  1501 + conn = DBUtils_MS.getConnection();
  1502 + ps = conn.prepareStatement(sql);
  1503 + ps.setString(1, line);
  1504 + ps.setInt(2, weeks_year1);
  1505 + ps.setLong(3, date1);
  1506 + ps.setLong(4, date2);
  1507 + ps.setInt(5, zd);
  1508 + rs = ps.executeQuery();
  1509 +
  1510 + list = resultSet2Set(rs);
  1511 + }catch(Exception e){
  1512 + logger.error("", e);
  1513 + }finally {
  1514 + DBUtils_MS.close(rs, ps, conn);
  1515 + }
  1516 + return list;
  1517 + }
  1518 + @Override
  1519 + public List<Map<String, Object>> queryInOutStrtion(String line, String date, int zd,String lzsj) {
  1520 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1521 + //查询线路所有的站点
  1522 + List<ArrivalInfo> arrInfoList=this.load3(line, date, zd);
  1523 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  1524 + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
  1525 + //保存的所以的站点信息
  1526 + Map<String, Object> map1=new HashMap<String,Object>();
  1527 + map1.put("bc", "");
  1528 + map1.put("nbbm", "");
  1529 +
  1530 + //所有的班次信息(实际排班排序)
  1531 + List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineInOut(line, date,zd+"");
  1532 + for (int i = 0; i < listStation.size(); i++) {
  1533 + map1.put(listStation.get(i).getStationCode()+"in"
  1534 + , listStation.get(i).getStationName());
  1535 + map1.put(listStation.get(i).getStationCode()+"out"
  1536 + , (i+1));
  1537 + }
  1538 + inoutList.add(map1);
  1539 +
  1540 + for (int i = 0; i < realList.size(); i++) {
  1541 + ScheduleRealInfo sinfo=realList.get(i);
  1542 + String devuceId=BasicData.deviceId2NbbmMap.inverse().get(sinfo.getClZbh());
  1543 + String sjfcsj=sinfo.getRealExecDate()+" "+sinfo.getFcsjActual()+":00";
  1544 + String sjddsj=sinfo.getRealExecDate()+" "+sinfo.getZdsjActual()+":59";
  1545 +
  1546 + try {
  1547 + Date dates1 = simpleDateFormat.parse(sjfcsj);
  1548 + Date dates2=simpleDateFormat.parse(sjddsj);
  1549 + Long date1=dates1.getTime();
  1550 + Long date2=dates2.getTime();
  1551 + List<ArrivalInfo> arrList=new ArrayList<ArrivalInfo>();
  1552 + for (int j = 0; j < arrInfoList.size(); j++) {
  1553 + ArrivalInfo a=arrInfoList.get(j);
  1554 + if(a.getDeviceId().equals(devuceId) && a.getTs()>=date1 && a.getTs()<=date2){
  1555 + arrList.add(a);
  1556 + }
  1557 + }
  1558 +
  1559 + Map<String, Object> map2=new HashMap<String,Object>();
  1560 + map2.put("bc", (i+1));
  1561 + map2.put("nbbm", sinfo.getClZbh());
  1562 +
  1563 + for (int j = 0; j < listStation.size(); j++) {
  1564 + StationRoute s=listStation.get(j);
  1565 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  1566 + for (int j2 = 0; j2 < arrList.size(); j2++) {
  1567 + ArrivalInfo a=arrList.get(j2);
  1568 + if(s.getStationCode().equals(a.getStopNo())){
  1569 + arrivalList.add(a);
  1570 + }
  1571 + }
  1572 + Map<String, String> m=this.strInOut(arrivalList,lzsj);
  1573 +
  1574 + map2.put(s.getStationCode()+"in", m.get("in"));
  1575 + map2.put(s.getStationCode()+"out", m.get("out"));
  1576 + map2.put(s.getStationCode(), m.get("type"));
  1577 + }
  1578 + inoutList.add(map2);
  1579 + } catch (ParseException e) {
  1580 + // TODO Auto-generated catch block
  1581 + e.printStackTrace();
  1582 + }
  1583 + }
  1584 + return inoutList;
  1585 + }
  1586 +
  1587 + public Map<String, String> strInOut(List<ArrivalInfo> lists,String lzsj){
  1588 + String inout="";
  1589 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  1590 + Long in=0L;
  1591 + Long out=0L;
  1592 + for(int i=0;i<lists.size();i++){
  1593 + ArrivalInfo t1=lists.get(i);
  1594 + if(t1.getInOut()==0){
  1595 + in=t1.getTs();
  1596 + t1.setJzsj(sdf.format(new Date(t1.getTs())));
  1597 + for(int j=0;j<lists.size();j++){
  1598 + ArrivalInfo t2=lists.get(j);
  1599 + if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
  1600 + && t2.getStopNo().equals(t1.getStopNo())
  1601 + && t2.getTs()>t1.getTs()){
  1602 + t1.setCzsj(sdf.format(new Date(t2.getTs())));
  1603 + out =t2.getTs();
  1604 + break;
  1605 + }
  1606 + }
  1607 +
  1608 + }else{
  1609 + out =t1.getTs();
  1610 + t1.setCzsj(sdf.format(new Date(t1.getTs())));
  1611 + for(int j=0;j<lists.size();j++){
  1612 + ArrivalInfo t2=lists.get(j);
  1613 + if(t2.getInOut()==0 && t2.getDeviceId().equals(t1.getDeviceId())
  1614 + && t2.getStopNo().equals(t1.getStopNo())
  1615 + && t2.getTs()>t1.getTs()){
  1616 + in =t2.getTs();
  1617 + t1.setJzsj(sdf.format(new Date(t2.getTs())));
  1618 + break;
  1619 + }
  1620 + }
  1621 + }
  1622 + }
  1623 +
  1624 + Map<String, String> map=new HashMap<String,String>();
  1625 + if(in>0 ){
  1626 + map.put("in",sdf.format(new Date(in)));
  1627 +
  1628 + }else{
  1629 + map.put("in", "");
  1630 + }
  1631 + if(out>0){
  1632 + map.put("out", sdf.format(new Date(out)));
  1633 + }else{
  1634 + map.put("out", "");
  1635 + }
  1636 + Long sj=1000000000L;
  1637 + if(!lzsj.trim().equals("")){
  1638 + sj =Long.parseLong(lzsj);
  1639 + }
  1640 + if(in>0 && out >0){
  1641 + if((out-in)/1000>sj){
  1642 + map.put("type", "y");
  1643 + }else{
  1644 + map.put("type", "n");
  1645 + }
  1646 + }
  1647 + return map;
  1648 + }
  1649 + @Override
  1650 + public List<StationRoute> queryStrinon(String line, int zd) {
  1651 + // TODO Auto-generated method stub
  1652 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  1653 + return listStation;
  1654 + }
1472 1655 }
... ...
src/main/resources/static/pages/forms/mould/scheduleDaily.xls
No preview for this file type
src/main/resources/static/pages/report/inoutstation.html
... ... @@ -96,7 +96,7 @@
96 96 <td width="23%">班车计划(实际)发车时刻</td>
97 97 <td width="22%">车牌号码</td>
98 98 <td width="15%">行驶里程</td>
99   - <td width="15%">路牌</td>
  99 + <td width="15%">路牌</td>
100 100 </tr>
101 101 </thead>
102 102 <tbody class="ludan_ll_2">
... ...
src/main/resources/static/pages/report/inoutstation/inoutstation.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +
  18 + #forms tr> td >label{
  19 + word-break: keep-all;white-space:nowrap;
  20 + }
  21 +</style>
  22 +
  23 +<div class="page-head">
  24 + <div class="page-title">
  25 + <h1>站点停靠时间记录</h1>
  26 + </div>
  27 +</div>
  28 +
  29 +<div class="row">
  30 + <div class="col-md-12">
  31 + <div class="portlet light porttlet-fit bordered">
  32 + <div class="portlet-title">
  33 + <form class="form-inline" action="">
  34 + <div>
  35 + <!-- <div style="display: inline-block; margin-left: 33px;"
  36 + id="gsdmDiv">
  37 + <span class="item-label" style="width: 80px;">公司: </span> <select
  38 + class="form-control" name="company" id="gsdm"
  39 + style="width: 180px;"></select>
  40 + </div>
  41 + <div style="display: inline-block; margin-left: 24px;"
  42 + id="fgsdmDiv">
  43 + <span class="item-label" style="width: 80px;">分公司: </span> <select
  44 + class="form-control" name="subCompany" id="fgsdm"
  45 + style="width: 180px;"></select>
  46 + </div> -->
  47 + <div style="display: inline-block; margin-left: 15px;">
  48 + <span class="item-label" style="width: 80px;">线路: </span> <select
  49 + class="form-control sreach-zd" name="line" id="line"
  50 + style="width: 180px;"></select>
  51 + </div>
  52 + <div style="display: inline-block; margin-left: 5px;">
  53 + <span class="item-label" style="width: 80px;">时间: </span> <input
  54 + class="form-control" type="text" id="date" style="width: 180px;" />
  55 + </div>
  56 + <div style="display: inline-block; margin-left: 5px;">
  57 + <span class="item-label" style="width: 80px;">站点: </span> <select
  58 + class="form-control" id="zdlx" class="sreach-zd">
  59 + <option value="">请选择</option>
  60 + <option value="0">上行</option>
  61 + <option value="1">下行</option>
  62 + </select>
  63 + </div>
  64 + <div style="display: inline-block; margin-left: 5px;">
  65 + <span class="item-label" style="width: 80px;">赖站时间(秒): </span> <input
  66 + class="form-control" type="text" id="lzsj"
  67 + onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  68 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  69 + style="width: 80px;" />
  70 + </div>
  71 + <div style="display: inline-block; margin-left: 5px;">
  72 + <input class="btn btn-default" type="button" id="query" value="查询" />
  73 +<!-- <input class="btn btn-default" type="button" id="export" value="导出" /> -->
  74 + </div>
  75 + </div>
  76 +
  77 + </form>
  78 + </div>
  79 + <div class="portlet-body" >
  80 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 506px;height: 400px">
  81 + <table class="table table-bordered table-hover table-checkable" id="forms">
  82 + <tbody class="ludan_ll_1">
  83 +
  84 + </tbody>
  85 + </table>
  86 + </div>
  87 + </div>
  88 + </div>
  89 + </div>
  90 +</div>
  91 +
  92 +<script>
  93 + $(function(){
  94 +
  95 +
  96 + // 关闭左侧栏
  97 + if (!$('body').hasClass('page-sidebar-closed'))
  98 + $('.menu-toggler.sidebar-toggler').click();
  99 +
  100 + $("#date").datetimepicker({
  101 + format : 'YYYY-MM-DD',
  102 + locale : 'zh-cn'
  103 + });
  104 +
  105 +
  106 +
  107 + $.get('/basic/lineCode2Name',function(result){
  108 + var data=[];
  109 +
  110 + for(var code in result){
  111 + data.push({id: code, text: result[code]});
  112 + }
  113 + initPinYinSelect2('#line',data,'');
  114 +
  115 + })
  116 + /* var fage=false;
  117 + var obj = [];
  118 + var xlList;
  119 + $.get('/report/lineList',function(result){
  120 + xlList=result;
  121 +
  122 + $.get('/user/companyData', function(result){
  123 + obj = result;
  124 + console.log(obj);
  125 + var options = '';
  126 + for(var i = 0; i < obj.length; i++){
  127 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  128 + }
  129 +
  130 + if(obj.length ==0){
  131 + $("#gsdmDiv").css('display','none');
  132 + }else if(obj.length ==1){
  133 + $("#gsdmDiv").css('display','none');
  134 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  135 + $('#fgsdmDiv').css('display','none');
  136 + }
  137 + $('#gsdm').html(options);
  138 +
  139 + updateCompany();
  140 + });
  141 + });
  142 +
  143 + $("#gsdm").on("change",updateCompany);
  144 + function updateCompany(){
  145 + var company = $('#gsdm').val();
  146 + var options = '';
  147 + for(var i = 0; i < obj.length; i++){
  148 + if(obj[i].companyCode == company){
  149 + var children = obj[i].children;
  150 + for(var j = 0; j < children.length; j++){
  151 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  152 + }
  153 + }
  154 + }
  155 + $('#fgsdm').html(options);
  156 + initXl();
  157 + initCl();
  158 + }
  159 +
  160 +
  161 +
  162 +
  163 + $("#fgsdm").on("change",initXl);
  164 + function initXl(){
  165 + var data=[];
  166 + if(fage){
  167 + $("#line").select2("destroy").html('');
  168 + }
  169 + var fgs=$('#fgsdm').val();
  170 + var gs=$('#gsdm').val();
  171 + for(var i=0;i<xlList.length;i++){
  172 + if(gs!=""){
  173 + if(fgs!=""){
  174 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  175 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  176 + }
  177 + }else{
  178 + if(xlList[i]["gsbm"]==gs){
  179 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  180 + }
  181 + }
  182 + }
  183 + }
  184 + initPinYinSelect2('#line',data,'');
  185 + fage=true;
  186 + }
  187 + */
  188 +
  189 + $("#query").on("click",function(){
  190 + var line = $("#line").val();
  191 + var date = $("#date").val();
  192 + var zdlx= $("#zdlx").val();
  193 + var lzsj =$("#lzsj").val();
  194 + if( line=="" || line==null){
  195 + layer.msg("请选择线路");
  196 + }else if(date ==null || date==""){
  197 + layer.msg("请选择时间");
  198 + }else if(zdlx=="" || zdlx==null){
  199 + layer.msg("请选择方向");
  200 + }else{
  201 + $get('/report/queryStrinon',{line:line,zd:zdlx},function(result){
  202 + $get('/report/queryInOutStrtion',{line:line,date:date,zd:zdlx,lzsj:lzsj},function(result2){
  203 + console.log(result2);
  204 + /* getTime(result); */
  205 + var ludan_ll_1 = template('ludan_ll_1',{list:result2,lists:result});
  206 + // 把渲染好的模版html文本追加到表格中
  207 + $('#forms .ludan_ll_1').html(ludan_ll_1);
  208 + });
  209 + });
  210 + }
  211 + });
  212 +
  213 + var params = new Array();
  214 + var jName = '';
  215 +// $("#print").click(function(){
  216 +// $("#printArea").printArea();
  217 +// });
  218 +
  219 +// $("#exportMore").on("click",function(){
  220 +// return;
  221 +// $post('/realSchedule/exportWaybillMore',{date:date},function(result){
  222 +// window.open("/downloadFile/download?fileName="+jName);
  223 +// });
  224 +// });
  225 +
  226 + function getTime(list){
  227 + $.each(list, function(i, obj) {
  228 + if(obj.zdsj != null && obj.zdsjActual != null ){
  229 + var zdsjActual = (obj.zdsjActual).split(":");
  230 + var zdsj = (obj.zdsj).split(":");
  231 + if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
  232 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  233 + }
  234 + else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
  235 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  236 + }
  237 + }
  238 + });
  239 + }
  240 +
  241 +
  242 +
  243 +
  244 +
  245 + $("#export").on("click",function(){
  246 + var rq=$("#date").val();
  247 + var line=$("#line").val();
  248 + var nbbm=$("#nbbm").val();
  249 + var fcsj=$("#fcsj_xx").val();
  250 + var ddsj=$("#ddsj_xx").val();
  251 + if(fcsj==""){
  252 + layer.msg("没数据");
  253 + }else{
  254 + $get('/report/exportQueryListZdxx',{clzbh:nbbm,date:rq,line:line,fcsj:fcsj,ddsj:ddsj},function(result){
  255 + window.open("/downloadFile/download?fileName=班次到离站");
  256 + });
  257 + }
  258 +
  259 + });
  260 +
  261 + });
  262 +
  263 +</script>
  264 +<script type="text/html" id="ludan_ll_1">
  265 + {{each list as obj i}}
  266 +
  267 + <tr>
  268 + <td>{{obj.bc}}</td>
  269 + <td><label>{{obj.nbbm}}</label></td>
  270 + {{each lists as o j}}
  271 + {{if i==0}}
  272 + <td>
  273 + <label>{{obj[(o.stationCode)+'in']}}
  274 + ({{obj[(o.stationCode)+'out']}})
  275 + </label>
  276 + </td>
  277 + {{else}}
  278 + <td {{if obj[o.stationCode] =='y'}}style="color: red"{{/if}}>
  279 + {{if obj[(o.stationCode)+'in']!=''}}
  280 + <label> I {{obj[(o.stationCode)+'in']}}</label>
  281 + {{/if}}
  282 + <br/>
  283 + {{if obj[(o.stationCode)+'out']!=''}}
  284 + <label> O {{obj[(o.stationCode)+'out']}}</label>
  285 + {{/if}}
  286 + </td>
  287 + {{/if}}
  288 + {{/each}}
  289 +
  290 + </tr>
  291 + {{/each}}
  292 + {{if list.length == 0}}
  293 + <tr>
  294 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  295 + </tr>
  296 + {{/if}}
  297 +</script>
... ...