Commit 4df7af3b14417b64fd5c1468857d1eb2f9c9f937

Authored by yiming
1 parent f8ca8fe2

路单数据,加车辆自编号和司机工号搜索。

src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -9,6 +9,7 @@ import org.springframework.data.jpa.domain.Specification;
9 9 import org.springframework.data.jpa.repository.EntityGraph;
10 10 import org.springframework.data.jpa.repository.Modifying;
11 11 import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.data.repository.query.Param;
12 13 import org.springframework.stereotype.Repository;
13 14  
14 15 import javax.transaction.Transactional;
... ... @@ -110,7 +111,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI
110 111 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
111 112 @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")
112 113 List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date);
113   -
  114 +
  115 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  116 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and s.scheduleDateStr >= ?2 and s.scheduleDateStr <= ?3 order by s.xlBm,s.clZbh,s.jGh,s.realExecDate,s.fcsj")
  117 + List<ScheduleRealInfo> scheduleByDateStartEndAndLineTjrb(String line,String dateS,String dateE);
  118 +
114 119 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
115 120 @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")
116 121 List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd);
... ... @@ -261,4 +266,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
261 266 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
262 267 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
263 268 List<ScheduleRealInfo> findAllSchDate(String schDate);
  269 +
  270 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  271 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %:gsdm% and fgsBm like %:fgsdm% and s.scheduleDateStr = :date and (:nbbm IS NULL OR s.clZbh = :nbbm) and (:jGh IS NULL OR s.jGh = :jGh) and (:sGh IS NULL OR s.sGh = :sGh) order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  272 + List<ScheduleRealInfo> scheduleByDateAndLineByGs_(@Param("gsdm")String gsdm, @Param("fgsdm")String fgsdm, @Param("date")String date, @Param("nbbm") String nbbm, @Param("jGh") String jGh, @Param("sGh") String sGh);
  273 +
  274 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  275 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =:line and s.scheduleDateStr = :date and (:nbbm IS NULL OR s.clZbh = :nbbm) and (:jGh IS NULL OR s.jGh = :jGh) and (:sGh IS NULL OR s.sGh = :sGh) order by s.lpName, s.realExecDate,s.fcsj")
  276 + List<ScheduleRealInfo> scheduleByDateAndLineQp(@Param("line")String line,@Param("date")String date,@Param("nbbm") String nbbm,@Param("jGh") String jGh,@Param("sGh") String sGh);
264 277 }
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -899,12 +899,27 @@ public class FormsServiceImpl implements FormsService {
899 899 String tjtype=map.get("tjtype").toString();
900 900 String xlbm=map.get("line").toString().trim();
901 901 startDate = map.get("startDate").toString();
  902 +
  903 + String nbbm = null;
  904 + if(map.get("nbbm")!=null && !map.get("nbbm").equals("")){
  905 + nbbm=map.get("nbbm").toString();
  906 + }
  907 +
  908 + String jGh = null;
  909 + if(map.get("gh")!=null && !map.get("gh").equals("") && tjtype.equals("jsy")){
  910 + jGh=map.get("gh").toString();
  911 + }
  912 +
  913 + String sGh = null;
  914 + if(map.get("gh")!=null && !map.get("gh").equals("") && tjtype.equals("spy")){
  915 + sGh=map.get("gh").toString();
  916 + }
902 917  
903 918 List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();
904 919 if(xlbm.equals("")){
905   - listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate);
  920 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate, nbbm,jGh,sGh);
906 921 }else{
907   - listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate);
  922 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate, nbbm,jGh,sGh);
908 923 }
909 924 List<Singledata> list=new ArrayList<Singledata>();
910 925 List<Singledata> list_=new ArrayList<Singledata>();
... ... @@ -922,10 +937,14 @@ public class FormsServiceImpl implements FormsService {
922 937 if(fgsdm.length() != 0){
923 938 sql += " and r.fgs_bm ='"+fgsdm+"'";
924 939 }
  940 + if(nbbm!=null){
  941 + sql += " and r.cl_zbh ='"+nbbm+"'";
  942 + }
  943 + if(jGh!=null){
  944 + sql += " and r.j_gh ='"+jGh+"'";
  945 + }
925 946 sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh " +
926 947 "order by r.xl_bm,r.cl_zbh";
927   -
928   -
929 948 list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
930 949 @Override
931 950 public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
... ... @@ -951,6 +970,12 @@ public class FormsServiceImpl implements FormsService {
951 970 if(!fgsdm.equals("")){
952 971 linesql +=" and fgsdm ='"+fgsdm+"' ";
953 972 }
  973 + if(nbbm!=null){
  974 + linesql += " and nbbm ='"+nbbm+"'";
  975 + }
  976 + if(jGh!=null){
  977 + linesql += " and jsy ='"+jGh+"'";
  978 + }
954 979 String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
955 980 + " WHERE rq = '"+startDate+"'"
956 981 + linesql
... ... @@ -1094,6 +1119,12 @@ public class FormsServiceImpl implements FormsService {
1094 1119 if(!fgsdm.equals("")){
1095 1120 sql += " and r.fgs_bm = '"+fgsdm+"'";
1096 1121 }
  1122 + if(nbbm!=null){
  1123 + sql += " and r.cl_zbh ='"+nbbm+"'";
  1124 + }
  1125 + if(sGh!=null){
  1126 + sql += " and r.s_gh ='"+sGh+"'";
  1127 + }
1097 1128 sql += " group by r.s_gh,r.s_name,"
1098 1129 + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1099 1130  
... ...
src/main/resources/static/pages/mforms/singledatas/singledata.html
... ... @@ -40,6 +40,15 @@
40 40 <span class="item-label" style="width: 80px;">线路: </span>
41 41 <select class="form-control" name="line" id="line" style="width: 140px;"></select>
42 42 </div>
  43 + <div style="display: inline-block;margin-left: 15px">
  44 + <span class="item-label" style="width: 140px;">内部编码: </span>
  45 + <select class="form-control" name="nbbm" id="nbbm" style="width: 140px;"></select>
  46 + <input class="btn btn-default" type="button" id="czcl" value="X"/>
  47 + </div>
  48 + <div style="display: inline-block;margin-left: 33px;">
  49 + <span class="item-label" style="width: 140px;">工号: </span>
  50 + <input class="form-control" type="text" id="gh" style="width: 140px;"/>
  51 + </div>
43 52 <div style="margin-top: 10px"></div>
44 53 <!-- <div style="display: inline-block; margin-left: 5px">
45 54 <span class="item-label" style="width: 80px;">是否营运: </span>
... ... @@ -212,10 +221,12 @@
212 221 var gsdmSing = $("#gsdmSing").val();
213 222 var fgsdmSing = $("#fgsdmSing").val();
214 223 var tjtype=$("#tjtype").val();
  224 + var nbbm=$("#nbbm").val();
  225 + var gh=$("#gh").val();
215 226 var params = {};
216 227 var i = layer.load(2);
217 228 if(tjtype=='jsy'){
218   - $get("/mcy_forms/singledatatj",{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,lpName:lpName,tjtype:tjtype},function(result){
  229 + $get("/mcy_forms/singledatatj",{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,lpName:lpName,tjtype:tjtype,nbbm:nbbm,gh:gh},function(result){
219 230 layer.close(i);
220 231 var singledata = template('singledata',{list:result});
221 232 // 把渲染好的模版html文本追加到表格中
... ... @@ -223,7 +234,7 @@
223 234  
224 235 });
225 236 }else{
226   - $get("/mcy_forms/singledatatj2",{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,lpName:lpName,tjtype:tjtype},function(result){
  237 + $get("/mcy_forms/singledatatj",{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,lpName:lpName,tjtype:tjtype,nbbm:nbbm,gh:gh},function(result){
227 238 layer.close(i);
228 239 var singledata = template('singledata',{list:result});
229 240 // 把渲染好的模版html文本追加到表格中
... ... @@ -246,9 +257,11 @@
246 257 var lineName = $('#line option:selected').text();
247 258 if(lineName == "全部线路")
248 259 lineName = $('#fgsdmSing option:selected').text();
  260 + var nbbm=$("#nbbm").val();
  261 + var gh=$("#gh").val();
249 262 var i = layer.load(2);
250 263 // if(tjtype=='jsy'){
251   - $get('/mcy_export/singledataExportTj',{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export',lineName:lineName},function(result){
  264 + $get('/mcy_export/singledataExportTj',{sfyy:sfyy,gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export',lineName:lineName,nbbm:nbbm,gh:gh},function(result){
252 265 window.open("/downloadFile/download?fileName="
253 266 +moment(startDate).format("YYYYMMDD")
254 267 +"-"+lineName+"-路单数据");
... ... @@ -261,6 +274,48 @@
261 274 // }
262 275  
263 276 });
  277 + $('#nbbm').select2({
  278 + ajax: {
  279 + url: '/realSchedule/sreachVehic',
  280 + dataType: 'json',
  281 + delay: 150,
  282 + data: function(params){
  283 + return{nbbm: params.term};
  284 + },
  285 + processResults: function (data) {
  286 + return {
  287 + results: data
  288 + };
  289 + },
  290 + cache: true
  291 + },
  292 + templateResult: function(repo){
  293 + if (repo.loading) return repo.text;
  294 + var h = '<span>'+repo.text+'</span>';
  295 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  296 + return h;
  297 + },
  298 + escapeMarkup: function (markup) { return markup; },
  299 + minimumInputLength: 1,
  300 + templateSelection: function(repo){
  301 + return repo.text;
  302 + },
  303 + language: {
  304 + noResults: function(){
  305 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  306 + },
  307 + inputTooShort : function(e) {
  308 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  309 + },
  310 + searching : function() {
  311 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  312 + }
  313 + }
  314 + });
  315 + //重置
  316 + $('#czcl').on('click', function () {
  317 + $('#nbbm').val('').change();
  318 + });
264 319 });
265 320 </script>
266 321 <script type="text/html" id="singledata">
... ...