Commit 9b27c59df6e38e290531c641e18d431ed56d517e

Authored by 廖磊
1 parent 23716be8

油量计算新增状态

路单数据报表重做
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -190,9 +190,6 @@ public class ExportController {
190 190 m.put("clzbh", l.getClzbh());
191 191 m.put("jsy", l.getJsy());
192 192 m.put("jName", l.getjName());
193   -
194   -
195   -
196 193 m.put("sgh", l.getSgh());
197 194 m.put("sName", l.getsName());
198 195 m.put("jhlc", l.getJhlc());
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -78,6 +78,13 @@ public class MCY_FormsController {
78 78  
79 79 return formsService.singledata(map);
80 80 }
  81 +
  82 + // 路单数据
  83 + @RequestMapping(value = "/singledatanew", method = RequestMethod.GET)
  84 + public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) {
  85 +
  86 + return formsService.singledata(map);
  87 + }
81 88  
82 89 // 车辆加注
83 90 @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET)
... ...
src/main/java/com/bsth/entity/oil/Ylxxb.java
... ... @@ -38,7 +38,7 @@ public class Ylxxb {
38 38 private Integer nylx;
39 39 @Transient
40 40 private String ldgh;
41   - //0为接口数据,1为手工输入
  41 + //0为接口数据,1为手工输入,2为改变车号,3为改变驾驶员
42 42 private Integer jylx=0;
43 43 @Transient
44 44 private String gsname;
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -146,6 +146,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
146 146 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj")
147 147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
148 148  
  149 +
  150 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  151 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
  152 + List<ScheduleRealInfo> scheduleByDateAndLineByGs_(String gsdm,String fgsdm,String date);
  153 +
149 154 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
150 155 @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
151 156 List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
... ...
src/main/java/com/bsth/service/forms/FormsService.java
... ... @@ -30,6 +30,7 @@ public interface FormsService {
30 30 public List<Shifday> shifday(Map<String, Object> map);
31 31  
32 32 public List<Singledata> singledata(Map<String, Object> map);
  33 + public List<Singledata> singledatanew(Map<String, Object> map);
33 34  
34 35 public List<Vehicleloading> vehicleloading(String line,String data);
35 36  
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -8,6 +8,8 @@ import java.text.NumberFormat;
8 8 import java.text.ParseException;
9 9 import java.text.SimpleDateFormat;
10 10 import java.util.ArrayList;
  11 +import java.util.Collections;
  12 +import java.util.Comparator;
11 13 import java.util.Date;
12 14 import java.util.HashMap;
13 15 import java.util.HashSet;
... ... @@ -598,7 +600,7 @@ public class FormsServiceImpl implements FormsService {
598 600  
599 601 // 路单数据
600 602 @Override
601   - public List<Singledata> singledata(Map<String, Object> map) {
  603 + public List<Singledata> singledatanew(Map<String, Object> map) {
602 604  
603 605 String gsdm="";
604 606 if(map.get("gsdmSing")!=null){
... ... @@ -651,7 +653,7 @@ public class FormsServiceImpl implements FormsService {
651 653 sql += " and r.xl_bm = '"+xlbm+"'";
652 654 }
653 655 sql += " group by r.s_gh,r.s_name,"
654   - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm";
  656 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
655 657  
656 658 List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
657 659 //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -735,6 +737,199 @@ public class FormsServiceImpl implements FormsService {
735 737 return list;
736 738 }
737 739  
  740 +
  741 + // 路单数据
  742 + @Override
  743 + public List<Singledata> singledata(Map<String, Object> map) {
  744 +
  745 + String gsdm="";
  746 + if(map.get("gsdmSing")!=null){
  747 + gsdm=map.get("gsdmSing").toString();
  748 + }
  749 + String fgsdm="";
  750 + if(map.get("fgsdmSing")!=null){
  751 + fgsdm=map.get("fgsdmSing").toString();
  752 + }
  753 +
  754 + String tjtype=map.get("tjtype").toString();
  755 + String xlbm=map.get("line").toString().trim();
  756 + startDate = map.get("startDate").toString();
  757 +
  758 + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();
  759 + if(xlbm.equals("")){
  760 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate);
  761 + }else{
  762 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate);
  763 + }
  764 + List<Singledata> list=new ArrayList<Singledata>();
  765 + List<Singledata> listY=new ArrayList<Singledata>();
  766 + List<Singledata> listD=new ArrayList<Singledata>();
  767 +
  768 + if(tjtype.equals("jsy")){
  769 + DecimalFormat df = new DecimalFormat("0.00");
  770 + List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  771 + for (int i = 0; i < listYlb.size(); i++) {
  772 + Ylb y=listYlb.get(i);
  773 + String jsy=y.getJsy();
  774 + String line=y.getXlbm();
  775 + String clzbh=y.getNbbm();
  776 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  777 + for (int j = 0; j < listReal.size(); j++) {
  778 + ScheduleRealInfo s=listReal.get(j);
  779 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
  780 + &&s.getXlBm().equals(line)){
  781 + newList.add(s);
  782 + }
  783 + }
  784 + double jhgl=culateMileageService.culateJhgl(newList);
  785 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  786 + double yygl=culateMileageService.culateSjgl(newList);
  787 + double ljgl=culateMileageService.culateLjgl(newList);
  788 + double ksgl=culateMileageService.culateKsgl(newList);
  789 + double jcgl=culateMileageService.culateJccgl(newList);
  790 +
  791 + double zyygl=Arith.add(yygl, ljgl);
  792 + double zksgl=Arith.add(ksgl, jcgl);
  793 +
  794 + Singledata sin=new Singledata();
  795 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  796 +
  797 + sin.setEmptMileage(String.valueOf(zksgl));
  798 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  799 + sin.setxL(BasicData.lineCode2NameMap.get(y.getXlbm()));
  800 + sin.setClzbh(clzbh);
  801 + sin.setJsy(jsy);
  802 + sin.setrQ(startDate);
  803 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  804 + sin.setSgh("");
  805 + sin.setsName("");
  806 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  807 + sin.setHyl(df.format(y.getYh()));
  808 + sin.setJzl(df.format(y.getJzl()));
  809 + sin.setUnyyyl(df.format(y.getSh()));
  810 + listY.add(sin);
  811 + }
  812 +
  813 + List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  814 + for (int i = 0; i < listDlb.size(); i++) {
  815 +
  816 + Dlb y=listDlb.get(i);
  817 + String jsy=y.getJsy();
  818 + String line=y.getXlbm();
  819 + String clzbh=y.getNbbm();
  820 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  821 + for (int j = 0; j < listReal.size(); j++) {
  822 + ScheduleRealInfo s=listReal.get(j);
  823 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
  824 + &&s.getXlBm().equals(line)){
  825 + newList.add(s);
  826 + }
  827 + }
  828 + double jhgl=culateMileageService.culateJhgl(newList);
  829 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  830 + double yygl=culateMileageService.culateSjgl(newList);
  831 + double ljgl=culateMileageService.culateLjgl(newList);
  832 + double ksgl=culateMileageService.culateKsgl(newList);
  833 + double jcgl=culateMileageService.culateJccgl(newList);
  834 +
  835 + double zyygl=Arith.add(yygl, ljgl);
  836 + double zksgl=Arith.add(ksgl, jcgl);
  837 +
  838 + Singledata sin=new Singledata();
  839 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  840 +
  841 + sin.setEmptMileage(String.valueOf(zksgl));
  842 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  843 + sin.setxL(BasicData.lineCode2NameMap.get(y.getXlbm()));
  844 + sin.setClzbh(clzbh);
  845 + sin.setJsy(jsy);
  846 + sin.setrQ(startDate);
  847 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  848 + sin.setSgh("");
  849 + sin.setsName("");
  850 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  851 + sin.setHyl(df.format(y.getHd()));
  852 + sin.setJzl(df.format(y.getCdl()));
  853 + sin.setUnyyyl(df.format(y.getSh()));
  854 + listD.add(sin);
  855 + }
  856 +
  857 + Collections.sort(listY,new SingledataByXlbm());
  858 + Collections.sort(listD,new SingledataByXlbm());
  859 + list.addAll(listY);
  860 + list.addAll(listD);
  861 + }else{
  862 + String sql="select r.s_gh,r.s_name, "
  863 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  864 + + " from bsth_c_s_sp_info_real r where "
  865 + + " r.schedule_date_str = '"+startDate+"'"
  866 + + " and r.s_gh !='' and r.s_gh is not null ";
  867 + if(xlbm.equals("")){
  868 + sql +="and r.gs_bm='"+gsdm+"' "
  869 + + " and r.fgs_bm='"+fgsdm+"'";
  870 + }else{
  871 + sql += " and r.xl_bm = '"+xlbm+"'";
  872 + }
  873 + sql += " group by r.s_gh,r.s_name,"
  874 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  875 +
  876 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  877 + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  878 + @Override
  879 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  880 + Singledata sin = new Singledata();
  881 + sin.setrQ(startDate);
  882 + sin.setxL(arg0.getString("xl_bm"));
  883 + sin.setClzbh(arg0.getString("cl_zbh"));
  884 + sin.setSgh(arg0.getString("s_gh"));
  885 + sin.setsName(arg0.getString("s_name"));
  886 + return sin;
  887 + }
  888 + });
  889 +
  890 + for (int i = 0; i < list.size(); i++) {
  891 + Singledata sin=list.get(i);
  892 + String jsy=sin.getSgh();
  893 + String line=sin.getxL();
  894 + String clzbh=sin.getClzbh();
  895 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  896 + for (int j = 0; j < listReal.size(); j++) {
  897 + ScheduleRealInfo s=listReal.get(j);
  898 + if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh)
  899 + &&s.getXlBm().equals(line)){
  900 + newList.add(s);
  901 + }
  902 + }
  903 + double jhgl=culateMileageService.culateJhgl(newList);
  904 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  905 + double yygl=culateMileageService.culateSjgl(newList);
  906 + double ljgl=culateMileageService.culateLjgl(newList);
  907 + double ksgl=culateMileageService.culateKsgl(newList);
  908 + double jcgl=culateMileageService.culateJccgl(newList);
  909 +
  910 + double zyygl=Arith.add(yygl, ljgl);
  911 + double zksgl=Arith.add(ksgl, jcgl);
  912 +
  913 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  914 +
  915 + sin.setEmptMileage(String.valueOf(zksgl));
  916 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  917 + sin.setxL(BasicData.lineCode2NameMap.get(line));
  918 + sin.setClzbh(clzbh);
  919 + sin.setJsy("");
  920 + sin.setjName("");
  921 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  922 + sin.setHyl("");
  923 + sin.setJzl("");
  924 + sin.setUnyyyl("");
  925 + }
  926 + Collections.sort(list,new SingledataByXlbm());
  927 + }
  928 +
  929 + return list;
  930 +
  931 + }
  932 +
738 933 // 运营服务阶段报表
739 934 @Override
740 935 public List<Operationservice> operationservice(Map<String, Object> map) {
... ... @@ -1398,4 +1593,12 @@ public class FormsServiceImpl implements FormsService {
1398 1593 }
1399 1594 return list;
1400 1595 }
  1596 +
  1597 + class SingledataByXlbm implements Comparator<Singledata>{
  1598 + @Override
  1599 + public int compare(Singledata o1, Singledata o2) {
  1600 + // TODO Auto-generated method stub
  1601 + return o2.getxL().compareTo(o1.getxL());
  1602 + }
  1603 + }
1401 1604 }
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -58,7 +58,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
58 58 String sql=" select * from ("
59 59 + "select *,CONCAT(nbbm,jsy) as nj "
60 60 + " from bsth_c_ylxxb where yyrq='"+rq+"' "
61   - + " and gsdm ='"+gsdm+"' and jylx ='0') x where x.nj not in ("
  61 + + " and gsdm ='"+gsdm+"' and jylx !='1') x where x.nj not in ("
62 62 + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
63 63 + " where rq='"+rq+"'"
64 64 + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
... ... @@ -66,7 +66,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
66 66 + " where rq='"+rq+"'"
67 67 + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') "
68 68 + " and x.nbbm not in (select nbbm from bsth_c_ylxxb"
69   - + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx ='1')";
  69 + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx !='0')";
70 70  
71 71  
72 72 /*String sql= "select v.*,u.jsy as ldgh from "
... ... @@ -184,7 +184,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
184 184 Ylxxb ylxxb=repository.findOne(id);
185 185 if(!ylxxb.getJsy().equals(jsy)){
186 186 ylxxb.setJsy(jsy);
187   - ylxxb.setJylx(1);
  187 + ylxxb.setJylx(3);
188 188 repository.save(ylxxb);
189 189 }
190 190 }
... ...
src/main/resources/static/pages/forms/mould/singledata.xls
No preview for this file type
src/main/resources/static/pages/mforms/singledatas/singledata.html
... ... @@ -47,6 +47,11 @@
47 47  
48 48 <div style="display: inline-block;margin-left: 15px">
49 49 <span class="item-label" style="width: 150px;">统计: </span>
  50 + <select class="form-control" name="tjtype" id="tjtype" style="width: 140px;">
  51 + <option value="jsy">驾驶员</option>
  52 + <option value="spy">售票员</option>
  53 + </select>
  54 +
50 55 </div>
51 56 <div class="form-group">
52 57 <input class="btn btn-default" type="button" id="query" value="筛选"/>
... ... @@ -183,17 +188,12 @@
183 188 var startDate = $("#startDate").val();
184 189 var lpName = $("#lpName").val();
185 190 var gsdmSing = $("#gsdmSing").val();
186   - var fgsdmSing = $("#fgsdmSing").val(); var params = {};
187   - $get("/mcy_forms/singledata",{ gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, line:line,startDate:startDate,lpName:lpName},function(result){
188   - var temp = {};
189   - var today_account = 0;
190   - temp["line"] = $("#line").text();
191   - $.each(result, function(i, obj) {
192   - if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){
193   - today_account++;
194   - }
195   - obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
196   - });
  191 + var fgsdmSing = $("#fgsdmSing").val();
  192 + var tjtype=$("#tjtype").val();
  193 + var params = {};
  194 + var i = layer.load(2);
  195 + $get("/mcy_forms/singledata",{ gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, line:line,startDate:startDate,lpName:lpName,tjtype:tjtype},function(result){
  196 + layer.close(i);
197 197 var singledata = template('singledata',{list:result});
198 198 // 把渲染好的模版html文本追加到表格中
199 199 $('#forms tbody').html(singledata);
... ... @@ -208,7 +208,8 @@
208 208 var lpName = $("#lpName").val();
209 209 var gsdmSing = $("#gsdmSing").val();
210 210 var fgsdmSing = $("#fgsdmSing").val();
211   - $get('/mcy_export/singledataExport',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,type:'export'},function(result){
  211 + var tjtype=$("#tjtype").val();
  212 + $get('/mcy_export/singledataExport',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export'},function(result){
212 213 window.open("/downloadFile/download?fileName=路单数据"+moment(startDate).format("YYYYMMDD"));
213 214 });
214 215 });
... ...
src/main/resources/static/pages/mforms/singledatas/singledatanew.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 + text-align: center; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>路单数据</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_sing">
  32 + <span class="item-label" style="width: 80px;">公司: </span>
  33 + <select class="form-control" name="company" id="gsdmSing" style="width: 140px;"></select>
  34 + </div>
  35 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_sing">
  36 + <span class="item-label" style="width: 80px;">分公司: </span>
  37 + <select class="form-control" name="subCompany" id="fgsdmSing" style="width: 140px;"></select>
  38 + </div>
  39 + <div style="display: inline-block;">
  40 + <span class="item-label" style="width: 80px;">&nbsp;线路: </span>
  41 + <select class="form-control" name="line" id="line" style="width: 140px;"></select>
  42 + </div>
  43 + <div style="display: inline-block;margin-left: 15px;">
  44 + <span class="item-label" style="width: 140px;">时间: </span>
  45 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  46 + </div>
  47 +
  48 + <div style="display: inline-block;margin-left: 15px">
  49 + <span class="item-label" style="width: 150px;">统计: </span>
  50 + </div>
  51 + <div class="form-group">
  52 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  53 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  54 + </div>
  55 + </form>
  56 + </div>
  57 + <div class="portlet-body">
  58 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  59 + <table class="table table-bordered table-hover table-checkable" id="forms">
  60 + <thead>
  61 + <tr>
  62 + <th>序号</th>
  63 + <th>日期</th>
  64 + <th>所属公司</th>
  65 + <th>线路</th>
  66 + <th>车号</th>
  67 + <th>司机职号</th>
  68 + <th>司机姓名</th>
  69 + <th>售票员职号</th>
  70 + <th>售票员姓名</th>
  71 + <th>行驶里程(包括空放)</th>
  72 + <th>空驶里程</th>
  73 + <th>耗油量</th>
  74 + <th>加注量</th>
  75 + <th>非营业用油</th>
  76 + <th>计划公里</th>
  77 + </tr>
  78 + </thead>
  79 + <tbody>
  80 +
  81 + </tbody>
  82 + </table>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + </div>
  87 +</div>
  88 +
  89 +<script>
  90 + $(function(){
  91 + // 关闭左侧栏
  92 + if (!$('body').hasClass('page-sidebar-closed'))
  93 + $('.menu-toggler.sidebar-toggler').click();
  94 +
  95 + $("#startDate,#endDate").datetimepicker({
  96 + format : 'YYYY-MM-DD',
  97 + locale : 'zh-cn'
  98 + });
  99 +
  100 + var fage=false;
  101 + var xlList;
  102 + var obj = [];
  103 +
  104 + $.get('/report/lineList',function(result){
  105 + xlList=result;
  106 + $.get('/user/companyData', function(result){
  107 + obj = result;
  108 + var options = '';
  109 + for(var i = 0; i < obj.length; i++){
  110 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  111 + }
  112 +
  113 + if(obj.length ==0){
  114 + $("#gsdmDiv_sing").css('display','none');
  115 + }else if(obj.length ==1){
  116 + $("#gsdmDiv_sing").css('display','none');
  117 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  118 + $('#fgsdmDiv_sing').css('display','none');
  119 + }
  120 + $('#gsdmSing').html(options);
  121 + updateCompany();
  122 + });
  123 + })
  124 + $("#gsdmSing").on("change",updateCompany);
  125 + function updateCompany(){
  126 + var company = $('#gsdmSing').val();
  127 + var options = '';
  128 + for(var i = 0; i < obj.length; i++){
  129 + if(obj[i].companyCode == company){
  130 + var children = obj[i].children;
  131 + for(var j = 0; j < children.length; j++){
  132 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  133 + }
  134 + }
  135 + }
  136 + $('#fgsdmSing').html(options);
  137 + }
  138 +
  139 + var tempData = {};
  140 + $.get('/report/lineList',function(xlList){
  141 + var data = [];
  142 + data.push({id: " ", text: "全部线路"});
  143 + $.get('/user/companyData', function(result){
  144 + for(var i = 0; i < result.length; i++){
  145 + var companyCode = result[i].companyCode;
  146 + var children = result[i].children;
  147 + for(var j = 0; j < children.length; j++){
  148 + var code = children[j].code;
  149 + for(var k=0;k < xlList.length;k++ ){
  150 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  151 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  152 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  153 + }
  154 + }
  155 + }
  156 + }
  157 + initPinYinSelect2('#line',data,'');
  158 +
  159 + });
  160 + });
  161 +
  162 + $("#line").on("change", function(){
  163 + if($("#line").val() == " "){
  164 + $("#gsdmSing").attr("disabled", false);
  165 + $("#fgsdmSing").attr("disabled", false);
  166 + } else {
  167 + var temp = tempData[$("#line").val()].split(":");
  168 + $("#gsdmSing").val(temp[0]);
  169 + updateCompany();
  170 + $("#fgsdmSing").val(temp[1]);
  171 + $("#gsdmSing").attr("disabled", true);
  172 + $("#fgsdmSing").attr("disabled", true);
  173 + }
  174 + });
  175 +
  176 +
  177 + $("#query").on("click",function(){
  178 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  179 + layer.msg("请选择时间!");
  180 + return;
  181 + }
  182 + var line = $("#line").val();
  183 + var startDate = $("#startDate").val();
  184 + var lpName = $("#lpName").val();
  185 + var gsdmSing = $("#gsdmSing").val();
  186 + var fgsdmSing = $("#fgsdmSing").val(); var params = {};
  187 + $get("/mcy_forms/singledata",{ gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, line:line,startDate:startDate,lpName:lpName},function(result){
  188 + var temp = {};
  189 + var today_account = 0;
  190 + temp["line"] = $("#line").text();
  191 + $.each(result, function(i, obj) {
  192 + if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){
  193 + today_account++;
  194 + }
  195 + obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss");
  196 + });
  197 + var singledata = template('singledata',{list:result});
  198 + // 把渲染好的模版html文本追加到表格中
  199 + $('#forms tbody').html(singledata);
  200 +
  201 + });
  202 + });
  203 +
  204 + $("#export").on("click",function(){
  205 + var line = $("#line").val();
  206 + var startDate = $("#startDate").val();
  207 + var endDate = $("#endDate").val();
  208 + var lpName = $("#lpName").val();
  209 + var gsdmSing = $("#gsdmSing").val();
  210 + var fgsdmSing = $("#fgsdmSing").val();
  211 + $get('/mcy_export/singledataExport',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,type:'export'},function(result){
  212 + window.open("/downloadFile/download?fileName=路单数据"+moment(startDate).format("YYYYMMDD"));
  213 + });
  214 + });
  215 + });
  216 +</script>
  217 +<script type="text/html" id="singledata">
  218 + {{each list as obj i}}
  219 + <tr>
  220 + <td>{{i+1}}</td>
  221 + <td>{{obj.rQ}}</td>
  222 + <td>{{obj.gS}}</td>
  223 + <td>{{obj.xL}}</td>
  224 + <td>{{obj.clzbh}}</td>
  225 + <td>{{obj.jsy}}</td>
  226 + <td>{{obj.jName}}</td>
  227 + <td>{{obj.sgh}}</td>
  228 + <td>{{obj.sName}}</td>
  229 + <td>{{obj.jhlc}}</td>
  230 + <td>{{obj.emptMileage}}</td>
  231 + <td>{{obj.hyl}}</td>
  232 + <td>{{obj.jzl}}</td>
  233 + <td>{{obj.unyyyl}}</td>
  234 + <td>{{obj.jhjl}}</td>
  235 + </tr>
  236 + {{/each}}
  237 + {{if list.length == 0}}
  238 + <tr>
  239 + <td colspan="16"><h6 class="muted">没有找到相关数据</h6></td>
  240 + </tr>
  241 + {{/if}}
  242 +</script>
  243 +</script>
0 244 \ No newline at end of file
... ...