Commit b4634acb81a42f736e3330be8cd08fa2eae92177

Authored by 娄高锋
2 parents 92dc3b45 d819c2ca

Merge branch 'pudong_jdk8' of 192.168.168.201:panzhaov5/bsth_control into pudong_jdk8

src/main/java/com/bsth/data/report_register/entity/ReportRegister.java
1 package com.bsth.data.report_register.entity; 1 package com.bsth.data.report_register.entity;
2 2
3 -import javax.persistence.Column;  
4 -import javax.persistence.Entity;  
5 -import javax.persistence.GeneratedValue;  
6 -import javax.persistence.Id;  
7 -import javax.persistence.Table; 3 +import javax.persistence.*;
8 import java.text.DateFormat; 4 import java.text.DateFormat;
9 import java.text.SimpleDateFormat; 5 import java.text.SimpleDateFormat;
10 import java.util.Date; 6 import java.util.Date;
@@ -15,7 +11,7 @@ import java.util.Date; @@ -15,7 +11,7 @@ import java.util.Date;
15 public class ReportRegister { 11 public class ReportRegister {
16 12
17 @Id 13 @Id
18 - @GeneratedValue 14 + @GeneratedValue(strategy = GenerationType.IDENTITY)
19 private long ID; 15 private long ID;
20 16
21 /** 类型*/ 17 /** 类型*/
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
1 -package com.bsth.repository.realcontrol;  
2 -  
3 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.repository.BaseRepository;  
6 -import org.springframework.data.domain.Page;  
7 -import org.springframework.data.domain.Pageable;  
8 -import org.springframework.data.jpa.domain.Specification;  
9 -import org.springframework.data.jpa.repository.EntityGraph;  
10 -import org.springframework.data.jpa.repository.Modifying;  
11 -import org.springframework.data.jpa.repository.Query;  
12 -import org.springframework.stereotype.Repository;  
13 -  
14 -import javax.transaction.Transactional;  
15 -import java.util.List;  
16 -import java.util.Map;  
17 -  
18 -@Repository  
19 -public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealInfo, Long>{  
20 -  
21 - @Query("select s from ScheduleRealInfo s where s.xlBm in ?1")  
22 - List<ScheduleRealInfo> findByLines(List<String> lines);  
23 -  
24 -  
25 - @Query(value="select s from ScheduleRealInfo s where s.id = ?1 ")  
26 - ScheduleRealInfo scheduleById(Long id);  
27 -  
28 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,dfsj")  
29 - List<ScheduleRealInfo> scheduleDailyQp(String line,String date);  
30 -  
31 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)")  
32 - List<ScheduleRealInfo> queryUserInfo(String line,String date);  
33 -  
34 - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,min(s.jName) from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.jGh,s.clZbh,s.lpName order by (lpName+1)")  
35 - List<ScheduleRealInfo> queryUserInfo2(String line,String date);  
36 -  
37 - @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.clZbh ")  
38 - List<ScheduleRealInfo> queryUserInfo3(String line,String date);  
39 -  
40 - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")  
41 - List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);  
42 -  
43 - //把sum(addMileage) 替换为0 数据表去掉了 add_mileage 字段  
44 - @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,"  
45 - + "0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where"  
46 - + " s.xlBm = ?1 and s.scheduleDateStr = ?2 group by clZbh,jGh,jName")  
47 - List<Map<String, Object>> dailyInfo(String line,String date);  
48 -  
49 - @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from "  
50 - + " bsth_v_directive_60 d where d.line_code=?1 and d.timestamp >=?2 and "  
51 - + "d.timestamp <=?3 and d.device_id like %?4% ",nativeQuery=true)  
52 - List<Object[]> historyMessage(String line,long d,long t,String code);  
53 -  
54 - @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs "  
55 - + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "  
56 - + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "  
57 - + " r.schedule_date_str = ?2 and r.cl_zbh like %?3% group by "  
58 - + " lp_name,xl_name,cl_zbh",nativeQuery=true)  
59 - List<Object[]> historyMessageCount(String line,String date,String code);  
60 -  
61 - @Query(value="SELECT r.xl_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content "  
62 - + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "  
63 - + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "  
64 - + " r.schedule_date_str = ?2 and r.cl_zbh =?3 ",nativeQuery=true)  
65 - List<Object[]> historyMessageList(String line,String date,String code);  
66 -  
67 - @Query(value = "select max(id) from ScheduleRealInfo")  
68 - Long getMaxId();  
69 -  
70 - @Query(value = "select count(*) from ScheduleRealInfo s where s.scheduleDateStr = ?1")  
71 - int countByDate(String date);  
72 -  
73 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
74 - @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1")  
75 - List<ScheduleRealInfo> findByDate(String dateStr);  
76 -  
77 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
78 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and cl_zbh=?3 order by bcs")  
79 - List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh);  
80 -  
81 - @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1")  
82 - int findCjbc(String jName,String clZbh,String lpName);  
83 -  
84 - @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and sflj != 0")  
85 - int findLjbc(String jName,String clZbh,String lpName);  
86 -  
87 - @Query(value="SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ,device_id FROM bsth_v_report_80 WHERE FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = ?2 AND line_id = ?1 and device_id like %?3%",nativeQuery=true)  
88 - List<Object[]> account(String line,String date,String code);  
89 -  
90 - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 "  
91 - + " and s.scheduleDateStr <= ?3 and s.lpName like %?4% "  
92 - + " and clZbh like %?5% order by s.fcsj")  
93 - List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);  
94 -  
95 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
96 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj")  
97 - List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);  
98 -  
99 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
100 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj")  
101 - List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line);  
102 -  
103 -// @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
104 -// @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,fcsj")  
105 -// List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);  
106 -  
107 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
108 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.realExecDate,s.fcsj")  
109 - List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date);  
110 -  
111 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
112 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual")  
113 - List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd);  
114 -  
115 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
116 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDateStr = ?2 and xlBm =?3 order by realExecDate,fcsj")  
117 - List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);  
118 -  
119 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
120 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDateStr = ?3 and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,dfsj")  
121 - List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);  
122 -  
123 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
124 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.scheduleDateStr >=?3 and s.scheduleDateStr <=?4 order by bcs")  
125 - List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);  
126 -  
127 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
128 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2")  
129 - List<ScheduleRealInfo> scheduleDaily(String line,String date);  
130 -  
131 - @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")  
132 - int countByLineCodeAndDate(String xlBm, String schDate);  
133 -  
134 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
135 - @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2 and ccService=false")  
136 - List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate);  
137 -  
138 - @Modifying  
139 - @Transactional  
140 - @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")  
141 - void deleteByLineCodeAndDate(String xlBm, String schDate);  
142 -  
143 - //去掉了 xlBm is not null  
144 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
145 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName")  
146 - List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);  
147 -  
148 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
149 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 order by s.lpName, s.realExecDate,s.fcsj")  
150 - List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);  
151 -  
152 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
153 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.ccService=false order by s.lpName, s.realExecDate,s.fcsj")  
154 - List<ScheduleRealInfo> scheduleDdrb(String line,String date);  
155 -  
156 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
157 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr= ?2 and s.ccService=false order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")  
158 - List<ScheduleRealInfo> scheduleDdrb2(String line,String date);  
159 -  
160 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
161 - @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")  
162 - List<ScheduleRealInfo> scheduleByDateAndLineByGs_(String gsdm,String fgsdm,String date);  
163 -  
164 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
165 - @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")  
166 - List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);  
167 -  
168 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
169 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr= ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")  
170 - List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);  
171 -  
172 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
173 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.realExecDate,s.fcsj")  
174 - List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);  
175 -  
176 - //按月统计  
177 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
178 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm")  
179 - List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);  
180 -  
181 - //按照时间段统计  
182 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
183 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm like %?5% order by s.fgsBm, s.xlBm")  
184 - List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);  
185 -  
186 - //按照时间段统计  
187 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
188 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.fgsBm,s.xlBm")  
189 - List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);  
190 - //月报表  
191 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
192 - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm")  
193 - List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);  
194 -  
195 -  
196 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate")  
197 - List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm);  
198 -  
199 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate")  
200 - List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm);  
201 -  
202 - @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")  
203 - List<ScheduleRealInfo> setLD(String date);  
204 -  
205 - @Query(value="select new map(xlBm as xlBm,lpName as lpName,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh")  
206 - List<Map<String,Object>> setLDGroup(String date);  
207 -  
208 - @Query(value="select new map(xlBm as xlBm,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh")  
209 - List<Map<String,Object>> setLCYHGroup(String date);  
210 -  
211 - @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm ORDER BY xlBm")  
212 - List<Map<String,Object>> setDDRBGroup(String date);  
213 -  
214 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
215 - @Override  
216 - Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable);  
217 -  
218 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
219 - @Override  
220 - List<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec);  
221 -  
222 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
223 - @Override  
224 - List<ScheduleRealInfo> findAll();  
225 -  
226 - @Modifying  
227 - @Transactional  
228 - @Query(value = "update ScheduleRealInfo s set s.lpChange=1 where s.id=?1 ")  
229 - Integer updateLpChange(Long id);  
230 -  
231 - @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4")  
232 - Long isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);  
233 -  
234 -} 1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.repository.BaseRepository;
  6 +import org.springframework.data.domain.Page;
  7 +import org.springframework.data.domain.Pageable;
  8 +import org.springframework.data.jpa.domain.Specification;
  9 +import org.springframework.data.jpa.repository.EntityGraph;
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +import javax.transaction.Transactional;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +@Repository
  19 +public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealInfo, Long>{
  20 +
  21 + @Query("select s from ScheduleRealInfo s where s.xlBm in ?1")
  22 + List<ScheduleRealInfo> findByLines(List<String> lines);
  23 +
  24 +
  25 + @Query(value="select s from ScheduleRealInfo s where s.id = ?1 ")
  26 + ScheduleRealInfo scheduleById(Long id);
  27 +
  28 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and bc_type not in ('in','out') order by (lpName+1),clZbh,realExecDate,dfsj")
  29 + List<ScheduleRealInfo> scheduleDailyQp(String line,String date);
  30 +
  31 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)")
  32 + List<ScheduleRealInfo> queryUserInfo(String line,String date);
  33 +
  34 + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,min(s.jName) from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.jGh,s.clZbh,s.lpName order by (lpName+1)")
  35 + List<Object[]> queryUserInfo2(String line,String date);
  36 +
  37 + @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 GROUP BY s.clZbh ")
  38 + List<Object[]> queryUserInfo3(String line,String date);
  39 +
  40 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by bcs")
  41 + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
  42 +
  43 + //把sum(addMileage) 替换为0 数据表去掉了 add_mileage 字段
  44 + @Query(value="select new map(clZbh as clZbh,jGh as jGh,jName as jName,sum(jhlc) as zgl,"
  45 + + "0 as ksgl,count(jName) as bcs) from ScheduleRealInfo s where"
  46 + + " s.xlBm = ?1 and s.scheduleDateStr = ?2 group by clZbh,jGh,jName")
  47 + List<Map<String, Object>> dailyInfo(String line,String date);
  48 +
  49 + @Query(value="select d.device_id,d.sender,d.txt_content,d.timestamp,d.line_code from "
  50 + + " bsth_v_directive_60 d where d.line_code=?1 and d.timestamp >=?2 and "
  51 + + "d.timestamp <=?3 and d.device_id like %?4% ",nativeQuery=true)
  52 + List<Object[]> historyMessage(String line,long d,long t,String code);
  53 +
  54 + @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs "
  55 + + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "
  56 + + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "
  57 + + " r.schedule_date_str = ?2 and r.cl_zbh like %?3% group by "
  58 + + " lp_name,xl_name,cl_zbh",nativeQuery=true)
  59 + List<Object[]> historyMessageCount(String line,String date,String code);
  60 +
  61 + @Query(value="SELECT r.xl_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content "
  62 + + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d "
  63 + + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND "
  64 + + " r.schedule_date_str = ?2 and r.cl_zbh =?3 ",nativeQuery=true)
  65 + List<Object[]> historyMessageList(String line,String date,String code);
  66 +
  67 + @Query(value = "select max(id) from ScheduleRealInfo")
  68 + Long getMaxId();
  69 +
  70 + @Query(value = "select count(*) from ScheduleRealInfo s where s.scheduleDateStr = ?1")
  71 + int countByDate(String date);
  72 +
  73 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  74 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1")
  75 + List<ScheduleRealInfo> findByDate(String dateStr);
  76 +
  77 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  78 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and cl_zbh=?3 order by bcs")
  79 + List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh);
  80 +
  81 + @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1")
  82 + int findCjbc(String jName,String clZbh,String lpName);
  83 +
  84 + @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and sflj != 0")
  85 + int findLjbc(String jName,String clZbh,String lpName);
  86 +
  87 + @Query(value="SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ,device_id FROM bsth_v_report_80 WHERE FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = ?2 AND line_id = ?1 and device_id like %?3%",nativeQuery=true)
  88 + List<Object[]> account(String line,String date,String code);
  89 +
  90 + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 "
  91 + + " and s.scheduleDateStr <= ?3 and s.lpName like %?4% "
  92 + + " and clZbh like %?5% order by s.fcsj")
  93 + List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
  94 +
  95 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  96 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj")
  97 + List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
  98 +
  99 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  100 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDateStr = ?4 and s.xlBm=?5 order by realExecDate,fcsj")
  101 + List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line);
  102 +
  103 +// @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  104 +// @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,fcsj")
  105 +// List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
  106 +
  107 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  108 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 order by s.xlBm,s.clZbh,s.jGh,s.realExecDate,s.fcsj")
  109 + List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date);
  110 +
  111 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  112 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual")
  113 + List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd);
  114 +
  115 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  116 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDateStr = ?2 and xlBm =?3 order by realExecDate,fcsj")
  117 + List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
  118 +
  119 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  120 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDateStr = ?3 and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,dfsj")
  121 + List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
  122 +
  123 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  124 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.scheduleDateStr >=?3 and s.scheduleDateStr <=?4 order by bcs")
  125 + List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);
  126 +
  127 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  128 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2")
  129 + List<ScheduleRealInfo> scheduleDaily(String line,String date);
  130 +
  131 + @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
  132 + int countByLineCodeAndDate(String xlBm, String schDate);
  133 +
  134 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  135 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2 and ccService=false")
  136 + List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate);
  137 +
  138 + @Modifying
  139 + @Transactional
  140 + @Query(value = "delete ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
  141 + void deleteByLineCodeAndDate(String xlBm, String schDate);
  142 +
  143 + //去掉了 xlBm is not null
  144 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  145 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName")
  146 + List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
  147 +
  148 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  149 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 order by s.lpName, s.realExecDate,s.fcsj")
  150 + List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
  151 +
  152 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  153 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.ccService=false order by s.lpName, s.realExecDate,s.fcsj")
  154 + List<ScheduleRealInfo> scheduleDdrb(String line,String date);
  155 +
  156 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  157 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr= ?2 and s.ccService=false order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  158 + List<ScheduleRealInfo> scheduleDdrb2(String line,String date);
  159 +
  160 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  161 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  162 + List<ScheduleRealInfo> scheduleByDateAndLineByGs_(String gsdm,String fgsdm,String date);
  163 +
  164 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  165 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and s.scheduleDateStr = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  166 + List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
  167 +
  168 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  169 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr= ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  170 + List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
  171 +
  172 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  173 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.realExecDate,s.fcsj")
  174 + List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
  175 +
  176 + //按月统计
  177 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  178 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm")
  179 + List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
  180 +
  181 + //按照时间段统计
  182 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  183 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm like %?5% order by s.fgsBm, s.xlBm")
  184 + List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
  185 +
  186 + //按照时间段统计
  187 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  188 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.fgsBm,s.xlBm")
  189 + List<ScheduleRealInfo> scheduleByDateAndLineTj2(String line,String date,String date2);
  190 + //月报表
  191 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  192 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr<= ?3 order by s.xlBm")
  193 + List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);
  194 +
  195 +
  196 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate")
  197 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm);
  198 +
  199 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate")
  200 + List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm);
  201 +
  202 + @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
  203 + List<ScheduleRealInfo> setLD(String date);
  204 +
  205 + @Query(value="select new map(xlBm as xlBm,lpName as lpName,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,lpName,clZbh ORDER BY xlBm,lpName,clZbh")
  206 + List<Map<String,Object>> setLDGroup(String date);
  207 +
  208 + @Query(value="select new map(xlBm as xlBm,clZbh as clZbh) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm,clZbh ORDER BY xlBm,clZbh")
  209 + List<Map<String,Object>> setLCYHGroup(String date);
  210 +
  211 + @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where s.scheduleDateStr = ?1 GROUP BY xlBm ORDER BY xlBm")
  212 + List<Map<String,Object>> setDDRBGroup(String date);
  213 +
  214 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  215 + @Override
  216 + Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable);
  217 +
  218 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  219 + @Override
  220 + List<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec);
  221 +
  222 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  223 + @Override
  224 + List<ScheduleRealInfo> findAll();
  225 +
  226 + @Modifying
  227 + @Transactional
  228 + @Query(value = "update ScheduleRealInfo s set s.lpChange=1 where s.id=?1 ")
  229 + Integer updateLpChange(Long id);
  230 +
  231 + @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4")
  232 + Long isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
  233 +
  234 +}
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -134,6 +134,8 @@ import com.github.stuxuhai.jpinyin.PinyinHelper; @@ -134,6 +134,8 @@ import com.github.stuxuhai.jpinyin.PinyinHelper;
134 import com.google.common.base.Splitter; 134 import com.google.common.base.Splitter;
135 import com.google.common.collect.Lists; 135 import com.google.common.collect.Lists;
136 136
  137 +import javax.ws.rs.HEAD;
  138 +
137 @Service 139 @Service
138 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> 140 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
139 implements ScheduleRealInfoService, InitializingBean, DisposableBean { 141 implements ScheduleRealInfoService, InitializingBean, DisposableBean {
@@ -262,8 +264,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -262,8 +264,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
262 * 校验人车 和 班次的公司和分公司归属 264 * 校验人车 和 班次的公司和分公司归属
263 * 265 *
264 * @param schId 266 * @param schId
265 - * @param jsy  
266 - * @param spy 267 + * @param jGh
  268 + * @param sGh
267 * @param nbbm 269 * @param nbbm
268 * @return -2 跨营运公司,校验不过 270 * @return -2 跨营运公司,校验不过
269 * -1 跨分公司,二次确认 271 * -1 跨分公司,二次确认
@@ -955,12 +957,32 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -955,12 +957,32 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
955 957
956 @Override 958 @Override
957 public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) { 959 public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) {
  960 + List<ScheduleRealInfo> scheduleRealInfos = new ArrayList<>();
  961 + List<Object[]> objects = null;
958 if (state.equals("2")) { 962 if (state.equals("2")) {
959 - return scheduleRealInfoRepository.queryUserInfo2(line, date); 963 + objects = scheduleRealInfoRepository.queryUserInfo2(line, date);
  964 + for (Object[] objs : objects) {
  965 + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo();
  966 + scheduleRealInfo.setId((Long)objs[0]);
  967 + scheduleRealInfo.setjGh((String)objs[1]);
  968 + scheduleRealInfo.setClZbh((String)objs[2]);
  969 + scheduleRealInfo.setLpName((String)objs[3]);
  970 + scheduleRealInfo.setjName((String)objs[4]);
  971 +
  972 + scheduleRealInfos.add(scheduleRealInfo);
  973 + }
960 } else { 974 } else {
961 - return scheduleRealInfoRepository.queryUserInfo3(line, date); 975 + objects = scheduleRealInfoRepository.queryUserInfo3(line, date);
  976 + for (Object[] objs : objects) {
  977 + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo();
  978 + scheduleRealInfo.setId((Long)objs[0]);
  979 + scheduleRealInfo.setClZbh((String)objs[1]);
  980 +
  981 + scheduleRealInfos.add(scheduleRealInfo);
  982 + }
962 } 983 }
963 984
  985 + return scheduleRealInfos;
964 } 986 }
965 987
966 @Override 988 @Override
src/main/resources/static/pages/forms/statement/waybill.html
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 -</style>  
18 -  
19 -<div class="page-head">  
20 - <div class="page-title">  
21 - <h1>行车路单</h1>  
22 - </div>  
23 -</div>  
24 -  
25 -<div class="row">  
26 - <div class="col-md-12">  
27 - <div class="portlet light porttlet-fit bordered">  
28 - <div class="portlet-title">  
29 - <form class="form-inline" action="">  
30 - <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_xcld">  
31 - <span class="item-label" style="width: 80px;">公司: </span>  
32 - <select class="form-control" name="company" id="gsdmXcld" style="width: 180px;"></select>  
33 - </div>  
34 - <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_xcld">  
35 - <span class="item-label" style="width: 80px;">分公司: </span>  
36 - <select class="form-control" name="subCompany" id="fgsdmXcld" style="width: 180px;"></select>  
37 - </div>  
38 - <div style="margin-top: 2px"></div>  
39 - <div style="display: inline-block; margin-left: 33px;">  
40 - <span class="item-label" style="width: 80px;">线路: </span>  
41 - <select class="form-control" name="line" id="line" style="width: 180px;"></select>  
42 - </div>  
43 - <div style="display: inline-block;margin-left: 24px;">  
44 - <span class="item-label" style="width: 80px;">&nbsp;时间: </span>  
45 - <input class="form-control" type="text" id="date" style="width: 180px;"/>  
46 - </div>  
47 - <div class="form-group" style="display: inline-block;margin-left: 15px;">  
48 - <input class="btn btn-default" type="button" id="query" value="查询"/>  
49 - <input class="btn btn-default" type="button" id="export" value="导出"/>  
50 - <input class="btn btn-default" type="button" id="print" value="打印"/>  
51 - <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>  
52 - </div>  
53 - </form>  
54 - </div>  
55 - <div class="portlet-body">  
56 - <div class="row">  
57 - <div class="col-md-3">  
58 - <div class="" id="left_height" style="margin-top: 10px;overflow:auto;">  
59 - <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info">  
60 - <thead>  
61 - <tr class="hidden">  
62 - <th class="rypx" style="cursor:pointer ">人员</th>  
63 - <th class="zbhpx" style="cursor:pointer ">自编号</th>  
64 - <th class="lppx" style="cursor:pointer ">路牌</th>  
65 - </tr>  
66 - </thead>  
67 - <tbody>  
68 -  
69 - </tbody>  
70 - </table>  
71 - </div>  
72 - </div>  
73 - <div class="col-md-9" id="printArea">  
74 - <div class="table-container" id="xcld_height" style="margin-top: 10px;overflow:auto;min-width: 906px;">  
75 - <table class="table table-bordered table-checkable" id="forms">  
76 - <tbody class="ludan_1">  
77 -  
78 - </tbody>  
79 - <tbody class="ludan_2">  
80 -  
81 - </tbody>  
82 - <tbody class="ludan_3">  
83 -  
84 - </tbody>  
85 - <tbody class="ludan_4">  
86 -  
87 - </tbody>  
88 - </table>  
89 - </div>  
90 - </div>  
91 - </div>  
92 - </div>  
93 - </div>  
94 - </div>  
95 -</div>  
96 -  
97 -<script>  
98 - $(function(){  
99 - var fage=false;  
100 - // 关闭左侧栏  
101 - if (!$('body').hasClass('page-sidebar-closed'))  
102 - $('.menu-toggler.sidebar-toggler').click();  
103 -  
104 - $("#date").datetimepicker({  
105 - format : 'YYYY-MM-DD',  
106 - locale : 'zh-cn'  
107 - });  
108 -  
109 - $("#left_height").height($(window).height()-100);  
110 - $("#xcld_height").height($(window).height()-100);  
111 -  
112 - var d = new Date();  
113 - var year = d.getFullYear();  
114 - var month = d.getMonth() + 1;  
115 - var day = d.getDate();  
116 - if(month < 10)  
117 - month = "0" + month;  
118 - if(day < 10)  
119 - day = "0" + day;  
120 - $("#date").val(year + "-" + month + "-" + day);  
121 -  
122 - var obj = [];  
123 - var xlList;  
124 - $.get('/report/lineList',function(result){  
125 - xlList=result;  
126 -  
127 - $.get('/user/companyData', function(result){  
128 - obj = result;  
129 - console.log(obj);  
130 - var options = '';  
131 - for(var i = 0; i < obj.length; i++){  
132 - options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';  
133 - }  
134 -  
135 - if(obj.length ==0){  
136 - $("#gsdmDiv_xcld").css('display','none');  
137 - }else if(obj.length ==1){  
138 - $("#gsdmDiv_xcld").css('display','none');  
139 - if(obj[0].children.length == 1 || obj[0].children.length ==0)  
140 - $('#fgsdmDiv_xcld').css('display','none');  
141 - }  
142 - $('#gsdmXcld').html(options);  
143 -  
144 - updateCompany();  
145 - });  
146 - });  
147 -  
148 - $("#gsdmXcld").on("change",updateCompany);  
149 - function updateCompany(){  
150 - var company = $('#gsdmXcld').val();  
151 - var options = '';  
152 - for(var i = 0; i < obj.length; i++){  
153 - if(obj[i].companyCode == company){  
154 - var children = obj[i].children;  
155 - for(var j = 0; j < children.length; j++){  
156 - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';  
157 - }  
158 - }  
159 - }  
160 - $('#fgsdmXcld').html(options);  
161 -// initXl();  
162 - }  
163 -  
164 -  
165 -  
166 -  
167 -// $("#fgsdmXcld").on("change",initXl);  
168 - /* function initXl(){  
169 - var data=[];  
170 - if(fage){  
171 - $("#line").select2("destroy").html('');  
172 - }  
173 - var fgs=$('#fgsdmXcld').val();  
174 - var gs=$('#gsdmXcld').val();  
175 - for(var i=0;i<xlList.length;i++){  
176 - if(gs!=""){  
177 - if(fgs!=""){  
178 - if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){  
179 - data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});  
180 - }  
181 - }else{  
182 - if(xlList[i]["gsbm"]==gs){  
183 - data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});  
184 - }  
185 - }  
186 - }  
187 - }  
188 - initPinYinSelect2('#line',data,'');  
189 - fage=true;  
190 - } */  
191 -  
192 - var tempData = {};  
193 - $.get('/report/lineList',function(xlList){  
194 - var data = [];  
195 -// data.push({id: " ", text: "全部线路"});  
196 - $.get('/user/companyData', function(result){  
197 - for(var i = 0; i < result.length; i++){  
198 - var companyCode = result[i].companyCode;  
199 - var children = result[i].children;  
200 - for(var j = 0; j < children.length; j++){  
201 - var code = children[j].code;  
202 - for(var k=0;k < xlList.length;k++ ){  
203 - if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){  
204 - data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});  
205 - tempData[xlList[k]["xlbm"]] = companyCode+":"+code;  
206 - }  
207 - }  
208 - }  
209 - }  
210 - initPinYinSelect2('#line',data,'');  
211 -  
212 - });  
213 - });  
214 -  
215 - $("#line").on("change", function(){  
216 - if($("#line").val() == " "){  
217 - $("#gsdmXcld").attr("disabled", false);  
218 - $("#fgsdmXcld").attr("disabled", false);  
219 - } else {  
220 - var temp = tempData[$("#line").val()].split(":");  
221 - $("#gsdmXcld").val(temp[0]);  
222 - updateCompany();  
223 - $("#fgsdmXcld").val(temp[1]);  
224 - $("#gsdmXcld").attr("disabled", true);  
225 - $("#fgsdmXcld").attr("disabled", true);  
226 - }  
227 - });  
228 - var date = '';  
229 - var line = '';  
230 - var lineName;  
231 - $("#query").on("click",function(){  
232 - $("#left_height").height($(window).height()-100);  
233 - line = $("#line").val();  
234 - date = $("#date").val();  
235 - lineName = $('#line option:selected').text();  
236 - $(".hidden").removeClass("hidden");  
237 - $get('/realSchedule/queryUserInfo',{line:line,date:date,state:2},function(result){  
238 - // 把数据填充到模版中  
239 - var tbodyHtml = template('list_info',{list:result});  
240 - // 把渲染好的模版html文本追加到表格中  
241 - $('#info tbody').html(tbodyHtml);  
242 - });  
243 - });  
244 - var type="desc";  
245 - $(".rypx").on("click",function(){  
246 - line = $("#line").val();  
247 - date = $("#date").val();  
248 - $(".hidden").removeClass("hidden");  
249 - $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"jGh",type:type},function(result){  
250 - if(type=="desc"){  
251 - type ="asc";  
252 - }else{  
253 - type ="desc";  
254 - }  
255 - // 把数据填充到模版中  
256 - var tbodyHtml = template('list_info_px',{list:result});  
257 - // 把渲染好的模版html文本追加到表格中  
258 - $('#info tbody').html(tbodyHtml);  
259 - });  
260 - })  
261 -  
262 - $(".zbhpx").on("click",function(){  
263 - line = $("#line").val();  
264 - date = $("#date").val();  
265 - $(".hidden").removeClass("hidden");  
266 - $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"clZbh",type:type},function(result){  
267 - if(type=="desc"){  
268 - type ="asc";  
269 - }else{  
270 - type ="desc";  
271 - }  
272 - // 把数据填充到模版中  
273 - var tbodyHtml = template('list_info_px',{list:result});  
274 - // 把渲染好的模版html文本追加到表格中  
275 - $('#info tbody').html(tbodyHtml);  
276 - });  
277 - })  
278 -  
279 - $(".lppx").on("click",function(){  
280 - line = $("#line").val();  
281 - date = $("#date").val();  
282 - $(".hidden").removeClass("hidden");  
283 - $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"lpName",type:type},function(result){  
284 - if(type=="desc"){  
285 - type ="asc";  
286 - }else{  
287 - type ="desc";  
288 - }  
289 - // 把数据填充到模版中  
290 - var tbodyHtml = template('list_info_px',{list:result});  
291 - // 把渲染好的模版html文本追加到表格中  
292 - $('#info tbody').html(tbodyHtml);  
293 - });  
294 - })  
295 -  
296 - var params = new Array();  
297 - var jName = '';  
298 - var jGh = '';  
299 - $("#info tbody").on("click","tr",function(){  
300 - if($(this).children().size() < 2){  
301 - return;  
302 - }  
303 - $("#xcld_height").height($(window).height()-100);  
304 - $(this).children().each(function(index){  
305 - params[index] = $(this).text();  
306 - });  
307 - jName = params[0].split("\\")[0];  
308 - jGh = params[0].split("\\")[1];  
309 - var id = params[3];  
310 - var obj = $(this);  
311 - $get('/realSchedule/MapById',{id:id},function(result){  
312 - result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");  
313 - var ludan_1 = template('ludan_1',result);  
314 - // 把渲染好的模版html文本追加到表格中  
315 - $('#forms .ludan_1').html(ludan_1);  
316 - });  
317 - $get('/realSchedule/queryListWaybill',{jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){  
318 - getTime(result);  
319 - /* $get('/realSchedule/MapById',{id:result[0].id},function(result){  
320 - result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");  
321 - var ludan_1 = template('ludan_1',result);  
322 - // 把渲染好的模版html文本追加到表格中  
323 - $('#forms .ludan_1').html(ludan_1);  
324 - }); */  
325 - var ludan_2 = template('ludan_2',{list:result});  
326 - // 把渲染好的模版html文本追加到表格中  
327 - $('#forms .ludan_2').html(ludan_2);  
328 - });  
329 - $get('/realSchedule/findKMBC',{jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){  
330 - var ludan_3 = template('ludan_3',result);  
331 - $('#forms .ludan_3').html(ludan_3);  
332 - $("#info tbody tr").css('background-color', '');  
333 - obj.css('background-color', '#99CCFF');  
334 - });  
335 -  
336 -  
337 - });  
338 -  
339 - $("#export").on("click",function(){  
340 - if(params.length < 1){  
341 - return;  
342 - }  
343 - var i = layer.load(2);  
344 - $get('/realSchedule/exportWaybill',{jName:jName,jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){  
345 - var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单";  
346 - window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName));  
347 - layer.close(i);  
348 - });  
349 - });  
350 -  
351 - $("#print").click(function(){  
352 - $("#printArea").printArea();  
353 - });  
354 -  
355 - $("#exportMore").on("click",function(){  
356 - if($("#info tbody tr td").length <= 1)  
357 - return;  
358 - var i = layer.load(2);  
359 - var param = new Array();  
360 - $("#info tbody tr").each(function(index){  
361 - param[index] = new Array();  
362 - $(this).children().each(function(i){  
363 - if(i<3){  
364 - param[index][i] = $(this).text().split("\\")[0];  
365 - if(i==0){  
366 - param[index][3] = $(this).text().split("\\")[1];  
367 -  
368 - }  
369 - }  
370 - });  
371 - });  
372 -// $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){  
373 -// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包  
374 - $get('/busInterval/exportWaybillMore',{date:date,line:line,lineName:lineName,strs:JSON.stringify(param)},function(result){  
375 - window.open("/downloadFile/download?fileName="+result.fileName);  
376 - layer.close(i);  
377 - });  
378 - });  
379 -  
380 - function getTime(list){  
381 - $.each(list, function(i, obj) {  
382 - if(obj.zdsj != null && obj.zdsjActual != null ){  
383 - var zdsjActual = (obj.zdsjActual).split(":");  
384 - var zdsj = (obj.zdsj).split(":");  
385 - if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){  
386 - if(zdsjActual[0]*60+Number(zdsjActual[1]) - zdsj[0]*60+Number(zdsj[1]) > 1000){  
387 - obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) + 1440;  
388 - } else {  
389 - obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));  
390 - }  
391 - }  
392 - else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){  
393 - if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) > 1000){  
394 - obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])) + 1440;  
395 - } else {  
396 - obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));  
397 - }  
398 - }  
399 - }  
400 - });  
401 - }  
402 - });  
403 -</script>  
404 -<script type="text/html" id="list_info">  
405 - {{each list as obj i}}  
406 - <tr>  
407 - <td width="45%">{{obj[4]}}\{{obj[1]}}</td>  
408 - <td width="32%">{{obj[2]}}</td>  
409 - <td width="20%">{{obj[3]}}</td>  
410 - <td width="3%" hidden="true">{{obj[0]}}</td>  
411 - </tr>  
412 - {{/each}}  
413 - {{if list.length == 0}}  
414 - <tr>  
415 - <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>  
416 - </tr>  
417 - {{/if}}  
418 -</script>  
419 -<script type="text/html" id="list_info_px">  
420 - {{each list as obj i}}  
421 - <tr>  
422 -  
423 - <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>  
424 - <td width="32%">{{obj.clZbh}}</td>  
425 - <td width="23%">{{obj.lpName}}</td>  
426 - <td hidden="true">{{obj.id}}</td>  
427 - </tr>  
428 - {{/each}}  
429 - {{if list.length == 0}}  
430 - <tr>  
431 - <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>  
432 - </tr>  
433 - {{/if}}  
434 -</script>  
435 -<script type="text/html" id="ludan_1">  
436 - <tr>  
437 - <td colspan="14">行车路单</td>  
438 - </tr>  
439 - <tr>  
440 - <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}}({{plate}}) 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:{{dbdp}} 日期:{{scheduleDate}}</td>  
441 - </tr>  
442 - <tr>  
443 - {{if type==0}}  
444 - <td colspan="2">出场存油 {{ccyl}}升</td>  
445 - <td colspan="2">加注量 {{jzl}}升</td>  
446 - <td colspan="2">进场存油 {{jcyl}}升</td>  
447 - <td colspan="2">加注机油 &nbsp;升</td>  
448 - <td colspan="3">{{rylx}}</td>  
449 - <td colspan="3">本日耗油 {{yh}}升</td>  
450 - {{/if}}  
451 - {{if type==1}}  
452 - <td colspan="2">出场存电 {{ccyl}}%</td>  
453 - <td colspan="2">充电量 {{jzl}}度</td>  
454 - <td colspan="2">进场存电 {{jcyl}}%</td>  
455 - <td colspan="4">加注机油 &nbsp;升</td>  
456 - <td colspan="4">本日耗电 {{yh}}度</td>  
457 - {{/if}}  
458 - {{if type==2}}  
459 - <td colspan="2">出场存电 {{ccyl}}%</td>  
460 - <td colspan="2">充电量 {{jzl}}度</td>  
461 - <td colspan="2">进场存电 {{jcyl}}%</td>  
462 - <td colspan="4">加注机油 &nbsp;升</td>  
463 - <td colspan="4">本日耗电 {{yh}}度</td>  
464 - {{/if}}  
465 - </tr>  
466 - <tr>  
467 - <td rowspan="2">调度章</td>  
468 - <td colspan="1">&nbsp;</td>  
469 - <td rowspan="2">早班</td>  
470 - <td colspan="1">&nbsp;</td>  
471 - <td rowspan="2">夜班</td>  
472 - <td colspan="1">&nbsp;</td>  
473 - <td rowspan="2" colspan="2">交叉</td>  
474 - <td colspan="2">&nbsp;</td>  
475 - <td rowspan="2">其他</td>  
476 - <td colspan="1">&nbsp;</td>  
477 - <td colspan="1">&nbsp;</td>  
478 - <td colspan="1">&nbsp;</td>  
479 - </tr>  
480 - <tr>  
481 - <td colspan="1">&nbsp;</td>  
482 - <td colspan="1">&nbsp;</td>  
483 - <td colspan="1">&nbsp;</td>  
484 - <td colspan="2">&nbsp;</td>  
485 - <td colspan="1">&nbsp;</td>  
486 - <td colspan="1">&nbsp;</td>  
487 - <td colspan="1">&nbsp;</td>  
488 - </tr>  
489 - <tr>  
490 - <td rowspan="2">车次</td>  
491 - <td colspan="2">工号</td>  
492 - <td rowspan="2">公里耗油</td>  
493 - <td colspan="2">起讫站</td>  
494 - <td colspan="4">时间</td>  
495 - <td colspan="2">误点</td>  
496 - <td rowspan="2" width="66px">里程(公里)计划</td>  
497 - <td rowspan="2">备注</td>  
498 - </tr>  
499 - <tr>  
500 - <td colspan="1" width="60px">司&nbsp;机</td>  
501 - <td colspan="1" width="60px">售&nbsp;票</td>  
502 - <td colspan="1">起点</td>  
503 - <td colspan="1">终点</td>  
504 - <td colspan="1">计发</td>  
505 - <td colspan="1">实发</td>  
506 - <td colspan="1">应到</td>  
507 - <td colspan="1">实到</td>  
508 - <td colspan="1">快</td>  
509 - <td colspan="1">慢</td>  
510 - </tr>  
511 -</script>  
512 -<script type="text/html" id="ludan_2">  
513 - {{each list as obj i}}  
514 - <tr>  
515 - <td>{{obj.adjustExps}}</td>  
516 - <td>{{obj.jGh}}{{obj.jName}}</td>  
517 - <td>{{if obj.sGh !=null}}  
518 - {{obj.sGh}}{{obj.sName}}  
519 - {{/if}}  
520 - </td>  
521 - <td>&nbsp;</td>  
522 - <td>{{obj.qdzName}}</td>  
523 - <td>{{obj.zdzName}}</td>  
524 - <td>{{obj.fcsj}}</td>  
525 - <td>{{obj.fcsjActual}}</td>  
526 - <td>{{obj.zdsj}}</td>  
527 - <td>{{obj.zdsjActual}}</td>  
528 - <td>{{obj.fast}}</td>  
529 - <td>{{obj.slow}}</td>  
530 - <td>  
531 - {{if obj.zdsjActual!=null}}  
532 - {{obj.jhlc}}  
533 - {{/if}}  
534 - </td>  
535 - <td >  
536 - {{obj.remarks}}  
537 - </td>  
538 - </tr>  
539 - {{/each}}  
540 - {{if list.length == 0}}  
541 - <tr>  
542 - <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td>  
543 - </tr>  
544 - {{/if}}  
545 -</script>  
546 -<script type="text/html" id="ludan_3">  
547 - <tr>  
548 - <td colspan="2">计划班次</td>  
549 - <td>{{jhbc}}</td>  
550 - <td colspan="2">计划公里</td>  
551 - <td>{{jhlc}}</td>  
552 - <td colspan="2">烂班班次</td>  
553 - <td>{{cjbc}}</td>  
554 - <td colspan="3"> 烂班公里</td>  
555 - <td colspan="2">{{remMileage}}</td>  
556 - </tr>  
557 - <tr>  
558 - <td colspan="2">临加班次</td>  
559 - <td>{{ljbc}}</td>  
560 - <td colspan="2">临加公里</td>  
561 - <td>{{addMileage}}</td>  
562 - <td colspan="2">实际班次</td>  
563 - <td>{{sjbc}}</td>  
564 - <td colspan="3">营运公里</td>  
565 - <td colspan="2">{{yygl}}</td>  
566 - </tr>  
567 - <tr>  
568 - <td colspan="2">空驶公里</td>  
569 - <td>{{zkslc}}</td>  
570 - <td colspan="2">总公里</td>  
571 - <td>{{realMileage}}</td>  
572 - <td colspan="2"></td>  
573 - <td></td>  
574 - <td colspan="3"></td>  
575 - <td colspan="2"></td>  
576 - </tr>  
577 -</script> 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 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>行车路单</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_xcld">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdmXcld" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_xcld">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdmXcld" style="width: 180px;"></select>
  37 + </div>
  38 + <div style="margin-top: 2px"></div>
  39 + <div style="display: inline-block; margin-left: 33px;">
  40 + <span class="item-label" style="width: 80px;">线路: </span>
  41 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  42 + </div>
  43 + <div style="display: inline-block;margin-left: 24px;">
  44 + <span class="item-label" style="width: 80px;">&nbsp;时间: </span>
  45 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  46 + </div>
  47 + <div class="form-group" style="display: inline-block;margin-left: 15px;">
  48 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  49 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  50 + <input class="btn btn-default" type="button" id="print" value="打印"/>
  51 + <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
  52 + </div>
  53 + </form>
  54 + </div>
  55 + <div class="portlet-body">
  56 + <div class="row">
  57 + <div class="col-md-3">
  58 + <div class="" id="left_height" style="margin-top: 10px;overflow:auto;">
  59 + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info">
  60 + <thead>
  61 + <tr class="hidden">
  62 + <th class="rypx" style="cursor:pointer ">人员</th>
  63 + <th class="zbhpx" style="cursor:pointer ">自编号</th>
  64 + <th class="lppx" style="cursor:pointer ">路牌</th>
  65 + </tr>
  66 + </thead>
  67 + <tbody>
  68 +
  69 + </tbody>
  70 + </table>
  71 + </div>
  72 + </div>
  73 + <div class="col-md-9" id="printArea">
  74 + <div class="table-container" id="xcld_height" style="margin-top: 10px;overflow:auto;min-width: 906px;">
  75 + <table class="table table-bordered table-checkable" id="forms">
  76 + <tbody class="ludan_1">
  77 +
  78 + </tbody>
  79 + <tbody class="ludan_2">
  80 +
  81 + </tbody>
  82 + <tbody class="ludan_3">
  83 +
  84 + </tbody>
  85 + <tbody class="ludan_4">
  86 +
  87 + </tbody>
  88 + </table>
  89 + </div>
  90 + </div>
  91 + </div>
  92 + </div>
  93 + </div>
  94 + </div>
  95 +</div>
  96 +
  97 +<script>
  98 + $(function(){
  99 + var fage=false;
  100 + // 关闭左侧栏
  101 + if (!$('body').hasClass('page-sidebar-closed'))
  102 + $('.menu-toggler.sidebar-toggler').click();
  103 +
  104 + $("#date").datetimepicker({
  105 + format : 'YYYY-MM-DD',
  106 + locale : 'zh-cn'
  107 + });
  108 +
  109 + $("#left_height").height($(window).height()-100);
  110 + $("#xcld_height").height($(window).height()-100);
  111 +
  112 + var d = new Date();
  113 + var year = d.getFullYear();
  114 + var month = d.getMonth() + 1;
  115 + var day = d.getDate();
  116 + if(month < 10)
  117 + month = "0" + month;
  118 + if(day < 10)
  119 + day = "0" + day;
  120 + $("#date").val(year + "-" + month + "-" + day);
  121 +
  122 + var obj = [];
  123 + var xlList;
  124 + $.get('/report/lineList',function(result){
  125 + xlList=result;
  126 +
  127 + $.get('/user/companyData', function(result){
  128 + obj = result;
  129 + console.log(obj);
  130 + var options = '';
  131 + for(var i = 0; i < obj.length; i++){
  132 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  133 + }
  134 +
  135 + if(obj.length ==0){
  136 + $("#gsdmDiv_xcld").css('display','none');
  137 + }else if(obj.length ==1){
  138 + $("#gsdmDiv_xcld").css('display','none');
  139 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  140 + $('#fgsdmDiv_xcld').css('display','none');
  141 + }
  142 + $('#gsdmXcld').html(options);
  143 +
  144 + updateCompany();
  145 + });
  146 + });
  147 +
  148 + $("#gsdmXcld").on("change",updateCompany);
  149 + function updateCompany(){
  150 + var company = $('#gsdmXcld').val();
  151 + var options = '';
  152 + for(var i = 0; i < obj.length; i++){
  153 + if(obj[i].companyCode == company){
  154 + var children = obj[i].children;
  155 + for(var j = 0; j < children.length; j++){
  156 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  157 + }
  158 + }
  159 + }
  160 + $('#fgsdmXcld').html(options);
  161 +// initXl();
  162 + }
  163 +
  164 +
  165 +
  166 +
  167 +// $("#fgsdmXcld").on("change",initXl);
  168 + /* function initXl(){
  169 + var data=[];
  170 + if(fage){
  171 + $("#line").select2("destroy").html('');
  172 + }
  173 + var fgs=$('#fgsdmXcld').val();
  174 + var gs=$('#gsdmXcld').val();
  175 + for(var i=0;i<xlList.length;i++){
  176 + if(gs!=""){
  177 + if(fgs!=""){
  178 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  179 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  180 + }
  181 + }else{
  182 + if(xlList[i]["gsbm"]==gs){
  183 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  184 + }
  185 + }
  186 + }
  187 + }
  188 + initPinYinSelect2('#line',data,'');
  189 + fage=true;
  190 + } */
  191 +
  192 + var tempData = {};
  193 + $.get('/report/lineList',function(xlList){
  194 + var data = [];
  195 +// data.push({id: " ", text: "全部线路"});
  196 + $.get('/user/companyData', function(result){
  197 + for(var i = 0; i < result.length; i++){
  198 + var companyCode = result[i].companyCode;
  199 + var children = result[i].children;
  200 + for(var j = 0; j < children.length; j++){
  201 + var code = children[j].code;
  202 + for(var k=0;k < xlList.length;k++ ){
  203 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  204 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  205 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  206 + }
  207 + }
  208 + }
  209 + }
  210 + initPinYinSelect2('#line',data,'');
  211 +
  212 + });
  213 + });
  214 +
  215 + $("#line").on("change", function(){
  216 + if($("#line").val() == " "){
  217 + $("#gsdmXcld").attr("disabled", false);
  218 + $("#fgsdmXcld").attr("disabled", false);
  219 + } else {
  220 + var temp = tempData[$("#line").val()].split(":");
  221 + $("#gsdmXcld").val(temp[0]);
  222 + updateCompany();
  223 + $("#fgsdmXcld").val(temp[1]);
  224 + $("#gsdmXcld").attr("disabled", true);
  225 + $("#fgsdmXcld").attr("disabled", true);
  226 + }
  227 + });
  228 + var date = '';
  229 + var line = '';
  230 + var lineName;
  231 + $("#query").on("click",function(){
  232 + $("#left_height").height($(window).height()-100);
  233 + line = $("#line").val();
  234 + date = $("#date").val();
  235 + lineName = $('#line option:selected').text();
  236 + $(".hidden").removeClass("hidden");
  237 + $get('/realSchedule/queryUserInfo',{line:line,date:date,state:2},function(result){
  238 + // 把数据填充到模版中
  239 + var tbodyHtml = template('list_info',{list:result});
  240 + // 把渲染好的模版html文本追加到表格中
  241 + $('#info tbody').html(tbodyHtml);
  242 + });
  243 + });
  244 + var type="desc";
  245 + $(".rypx").on("click",function(){
  246 + line = $("#line").val();
  247 + date = $("#date").val();
  248 + $(".hidden").removeClass("hidden");
  249 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"jGh",type:type},function(result){
  250 + if(type=="desc"){
  251 + type ="asc";
  252 + }else{
  253 + type ="desc";
  254 + }
  255 + // 把数据填充到模版中
  256 + var tbodyHtml = template('list_info_px',{list:result});
  257 + // 把渲染好的模版html文本追加到表格中
  258 + $('#info tbody').html(tbodyHtml);
  259 + });
  260 + })
  261 +
  262 + $(".zbhpx").on("click",function(){
  263 + line = $("#line").val();
  264 + date = $("#date").val();
  265 + $(".hidden").removeClass("hidden");
  266 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"clZbh",type:type},function(result){
  267 + if(type=="desc"){
  268 + type ="asc";
  269 + }else{
  270 + type ="desc";
  271 + }
  272 + // 把数据填充到模版中
  273 + var tbodyHtml = template('list_info_px',{list:result});
  274 + // 把渲染好的模版html文本追加到表格中
  275 + $('#info tbody').html(tbodyHtml);
  276 + });
  277 + })
  278 +
  279 + $(".lppx").on("click",function(){
  280 + line = $("#line").val();
  281 + date = $("#date").val();
  282 + $(".hidden").removeClass("hidden");
  283 + $get('/realSchedule/queryUserInfoPx',{line:line,date:date,state:"lpName",type:type},function(result){
  284 + if(type=="desc"){
  285 + type ="asc";
  286 + }else{
  287 + type ="desc";
  288 + }
  289 + // 把数据填充到模版中
  290 + var tbodyHtml = template('list_info_px',{list:result});
  291 + // 把渲染好的模版html文本追加到表格中
  292 + $('#info tbody').html(tbodyHtml);
  293 + });
  294 + })
  295 +
  296 + var params = new Array();
  297 + var jName = '';
  298 + var jGh = '';
  299 + $("#info tbody").on("click","tr",function(){
  300 + if($(this).children().size() < 2){
  301 + return;
  302 + }
  303 + $("#xcld_height").height($(window).height()-100);
  304 + $(this).children().each(function(index){
  305 + params[index] = $(this).text();
  306 + });
  307 + jName = params[0].split("\\")[0];
  308 + jGh = params[0].split("\\")[1];
  309 + var id = params[3];
  310 + var obj = $(this);
  311 + $get('/realSchedule/MapById',{id:id},function(result){
  312 + result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
  313 + var ludan_1 = template('ludan_1',result);
  314 + // 把渲染好的模版html文本追加到表格中
  315 + $('#forms .ludan_1').html(ludan_1);
  316 + });
  317 + $get('/realSchedule/queryListWaybill',{jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  318 + getTime(result);
  319 + /* $get('/realSchedule/MapById',{id:result[0].id},function(result){
  320 + result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
  321 + var ludan_1 = template('ludan_1',result);
  322 + // 把渲染好的模版html文本追加到表格中
  323 + $('#forms .ludan_1').html(ludan_1);
  324 + }); */
  325 + var ludan_2 = template('ludan_2',{list:result});
  326 + // 把渲染好的模版html文本追加到表格中
  327 + $('#forms .ludan_2').html(ludan_2);
  328 + });
  329 + $get('/realSchedule/findKMBC',{jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  330 + var ludan_3 = template('ludan_3',result);
  331 + $('#forms .ludan_3').html(ludan_3);
  332 + $("#info tbody tr").css('background-color', '');
  333 + obj.css('background-color', '#99CCFF');
  334 + });
  335 +
  336 +
  337 + });
  338 +
  339 + $("#export").on("click",function(){
  340 + if(params.length < 1){
  341 + return;
  342 + }
  343 + var i = layer.load(2);
  344 + $get('/realSchedule/exportWaybill',{jName:jName,jGh:jGh,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  345 + var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单";
  346 + window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName));
  347 + layer.close(i);
  348 + });
  349 + });
  350 +
  351 + $("#print").click(function(){
  352 + $("#printArea").printArea();
  353 + });
  354 +
  355 + $("#exportMore").on("click",function(){
  356 + if($("#info tbody tr td").length <= 1)
  357 + return;
  358 + var i = layer.load(2);
  359 + var param = new Array();
  360 + $("#info tbody tr").each(function(index){
  361 + param[index] = new Array();
  362 + $(this).children().each(function(i){
  363 + if(i<3){
  364 + param[index][i] = $(this).text().split("\\")[0];
  365 + if(i==0){
  366 + param[index][3] = $(this).text().split("\\")[1];
  367 +
  368 + }
  369 + }
  370 + });
  371 + });
  372 +// $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
  373 +// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包
  374 + $get('/busInterval/exportWaybillMore',{date:date,line:line,lineName:lineName,strs:JSON.stringify(param)},function(result){
  375 + window.open("/downloadFile/download?fileName="+result.fileName);
  376 + layer.close(i);
  377 + });
  378 + });
  379 +
  380 + function getTime(list){
  381 + $.each(list, function(i, obj) {
  382 + if(obj.zdsj != null && obj.zdsjActual != null ){
  383 + var zdsjActual = (obj.zdsjActual).split(":");
  384 + var zdsj = (obj.zdsj).split(":");
  385 + if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
  386 + if(zdsjActual[0]*60+Number(zdsjActual[1]) - zdsj[0]*60+Number(zdsj[1]) > 1000){
  387 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) + 1440;
  388 + } else {
  389 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
  390 + }
  391 + }
  392 + else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
  393 + if((zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])) > 1000){
  394 + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])) + 1440;
  395 + } else {
  396 + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
  397 + }
  398 + }
  399 + }
  400 + });
  401 + }
  402 + });
  403 +</script>
  404 +<script type="text/html" id="list_info">
  405 + {{each list as obj i}}
  406 + <tr>
  407 + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
  408 + <td width="32%">{{obj.clZbh}}</td>
  409 + <td width="23%">{{obj.lpName}}</td>
  410 + <td hidden="true">{{obj.id}}</td>
  411 + </tr>
  412 + {{/each}}
  413 + {{if list.length == 0}}
  414 + <tr>
  415 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  416 + </tr>
  417 + {{/if}}
  418 +</script>
  419 +<script type="text/html" id="list_info_px">
  420 + {{each list as obj i}}
  421 + <tr>
  422 +
  423 + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
  424 + <td width="32%">{{obj.clZbh}}</td>
  425 + <td width="23%">{{obj.lpName}}</td>
  426 + <td hidden="true">{{obj.id}}</td>
  427 + </tr>
  428 + {{/each}}
  429 + {{if list.length == 0}}
  430 + <tr>
  431 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  432 + </tr>
  433 + {{/if}}
  434 +</script>
  435 +<script type="text/html" id="ludan_1">
  436 + <tr>
  437 + <td colspan="14">行车路单</td>
  438 + </tr>
  439 + <tr>
  440 + <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}}({{plate}}) 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:{{dbdp}} 日期:{{scheduleDate}}</td>
  441 + </tr>
  442 + <tr>
  443 + {{if type==0}}
  444 + <td colspan="2">出场存油 {{ccyl}}升</td>
  445 + <td colspan="2">加注量 {{jzl}}升</td>
  446 + <td colspan="2">进场存油 {{jcyl}}升</td>
  447 + <td colspan="2">加注机油 &nbsp;升</td>
  448 + <td colspan="3">{{rylx}}</td>
  449 + <td colspan="3">本日耗油 {{yh}}升</td>
  450 + {{/if}}
  451 + {{if type==1}}
  452 + <td colspan="2">出场存电 {{ccyl}}%</td>
  453 + <td colspan="2">充电量 {{jzl}}度</td>
  454 + <td colspan="2">进场存电 {{jcyl}}%</td>
  455 + <td colspan="4">加注机油 &nbsp;升</td>
  456 + <td colspan="4">本日耗电 {{yh}}度</td>
  457 + {{/if}}
  458 + {{if type==2}}
  459 + <td colspan="2">出场存电 {{ccyl}}%</td>
  460 + <td colspan="2">充电量 {{jzl}}度</td>
  461 + <td colspan="2">进场存电 {{jcyl}}%</td>
  462 + <td colspan="4">加注机油 &nbsp;升</td>
  463 + <td colspan="4">本日耗电 {{yh}}度</td>
  464 + {{/if}}
  465 + </tr>
  466 + <tr>
  467 + <td rowspan="2">调度章</td>
  468 + <td colspan="1">&nbsp;</td>
  469 + <td rowspan="2">早班</td>
  470 + <td colspan="1">&nbsp;</td>
  471 + <td rowspan="2">夜班</td>
  472 + <td colspan="1">&nbsp;</td>
  473 + <td rowspan="2" colspan="2">交叉</td>
  474 + <td colspan="2">&nbsp;</td>
  475 + <td rowspan="2">其他</td>
  476 + <td colspan="1">&nbsp;</td>
  477 + <td colspan="1">&nbsp;</td>
  478 + <td colspan="1">&nbsp;</td>
  479 + </tr>
  480 + <tr>
  481 + <td colspan="1">&nbsp;</td>
  482 + <td colspan="1">&nbsp;</td>
  483 + <td colspan="1">&nbsp;</td>
  484 + <td colspan="2">&nbsp;</td>
  485 + <td colspan="1">&nbsp;</td>
  486 + <td colspan="1">&nbsp;</td>
  487 + <td colspan="1">&nbsp;</td>
  488 + </tr>
  489 + <tr>
  490 + <td rowspan="2">车次</td>
  491 + <td colspan="2">工号</td>
  492 + <td rowspan="2">公里耗油</td>
  493 + <td colspan="2">起讫站</td>
  494 + <td colspan="4">时间</td>
  495 + <td colspan="2">误点</td>
  496 + <td rowspan="2" width="66px">里程(公里)计划</td>
  497 + <td rowspan="2">备注</td>
  498 + </tr>
  499 + <tr>
  500 + <td colspan="1" width="60px">司&nbsp;机</td>
  501 + <td colspan="1" width="60px">售&nbsp;票</td>
  502 + <td colspan="1">起点</td>
  503 + <td colspan="1">终点</td>
  504 + <td colspan="1">计发</td>
  505 + <td colspan="1">实发</td>
  506 + <td colspan="1">应到</td>
  507 + <td colspan="1">实到</td>
  508 + <td colspan="1">快</td>
  509 + <td colspan="1">慢</td>
  510 + </tr>
  511 +</script>
  512 +<script type="text/html" id="ludan_2">
  513 + {{each list as obj i}}
  514 + <tr>
  515 + <td>{{obj.adjustExps}}</td>
  516 + <td>{{obj.jGh}}{{obj.jName}}</td>
  517 + <td>{{if obj.sGh !=null}}
  518 + {{obj.sGh}}{{obj.sName}}
  519 + {{/if}}
  520 + </td>
  521 + <td>&nbsp;</td>
  522 + <td>{{obj.qdzName}}</td>
  523 + <td>{{obj.zdzName}}</td>
  524 + <td>{{obj.fcsj}}</td>
  525 + <td>{{obj.fcsjActual}}</td>
  526 + <td>{{obj.zdsj}}</td>
  527 + <td>{{obj.zdsjActual}}</td>
  528 + <td>{{obj.fast}}</td>
  529 + <td>{{obj.slow}}</td>
  530 + <td>
  531 + {{if obj.zdsjActual!=null}}
  532 + {{obj.jhlc}}
  533 + {{/if}}
  534 + </td>
  535 + <td >
  536 + {{obj.remarks}}
  537 + </td>
  538 + </tr>
  539 + {{/each}}
  540 + {{if list.length == 0}}
  541 + <tr>
  542 + <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td>
  543 + </tr>
  544 + {{/if}}
  545 +</script>
  546 +<script type="text/html" id="ludan_3">
  547 + <tr>
  548 + <td colspan="2">计划班次</td>
  549 + <td>{{jhbc}}</td>
  550 + <td colspan="2">计划公里</td>
  551 + <td>{{jhlc}}</td>
  552 + <td colspan="2">烂班班次</td>
  553 + <td>{{cjbc}}</td>
  554 + <td colspan="3"> 烂班公里</td>
  555 + <td colspan="2">{{remMileage}}</td>
  556 + </tr>
  557 + <tr>
  558 + <td colspan="2">临加班次</td>
  559 + <td>{{ljbc}}</td>
  560 + <td colspan="2">临加公里</td>
  561 + <td>{{addMileage}}</td>
  562 + <td colspan="2">实际班次</td>
  563 + <td>{{sjbc}}</td>
  564 + <td colspan="3">营运公里</td>
  565 + <td colspan="2">{{yygl}}</td>
  566 + </tr>
  567 + <tr>
  568 + <td colspan="2">空驶公里</td>
  569 + <td>{{zkslc}}</td>
  570 + <td colspan="2">总公里</td>
  571 + <td>{{realMileage}}</td>
  572 + <td colspan="2"></td>
  573 + <td></td>
  574 + <td colspan="3"></td>
  575 + <td colspan="2"></td>
  576 + </tr>
  577 +</script>