Commit b403d8996b5ca95119b396e9782a6cb6385eda28

Authored by 廖磊
1 parent a32cf542

报表油量

src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -119,8 +119,15 @@ public class YlbController extends BaseController<Ylb, Integer>{
119 119  
120 120 Direction d;
121 121 map.put("xlbm_like", map.get("xlbm_like").toString().trim());
122   -// try {
123 122 String rq=map.get("rq").toString();
  123 + int lx=Integer.parseInt(map.get("sxtj").toString().trim());
  124 + if(lx>0){
  125 + map.put("nbbm_in", yblService.checkNbmmNum(rq, map.get("ssgsdm_like").toString(),
  126 + map.get("fgsdm_like").toString(), map.get("xlbm_like").toString(),
  127 + map.get("nbbm_eq").toString(),lx));
  128 + }
  129 +// try {
  130 +
124 131 if(!(rq=="")){
125 132 //
126 133 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -155,6 +162,11 @@ public class YlbController extends BaseController<Ylb, Integer>{
155 162 return yblService.oilListMonth(line, date);
156 163 }
157 164  
  165 + @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
  166 + public List<Object[]> sumYlb(@RequestParam Map<String, Object> map){
  167 + List<Object[]> list=yblService.sumYlb(map);
  168 + return list;
  169 + }
158 170  
159 171 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
160 172 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
... ...
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -69,6 +69,11 @@ public class PredicatesBuilder {
69 69 return cb.in(expression).value(list);
70 70 }
71 71  
  72 +
  73 + public static Predicate ins(CriteriaBuilder cb,Path<?> expression, List<String> list){
  74 + return cb.in(expression).value(list);
  75 + }
  76 +
72 77 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){
73 78 try {
74 79 return cb.gt(expression, nf.parse(object.toString()));
... ...
src/main/java/com/bsth/entity/search/SearchOperator.java
... ... @@ -27,5 +27,6 @@ public enum SearchOperator {
27 27 isf, //假 isFalse,boolean
28 28 ist, //真 isTrue,boolean
29 29 date, //时间
30   - in //数组
  30 + in, //数组
  31 + ins //传参 List<String>
31 32 }
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -53,4 +53,39 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
53 53 @Modifying
54 54 @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc ,sum(sh) as sh from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true)
55 55 List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm);
  56 +
  57 + /**
  58 + *
  59 + * @param nbbm
  60 + * @param rq
  61 + * @param xlbm
  62 + * @return
  63 + */
  64 + @Transactional
  65 + @Modifying
  66 + @Query(value="select nbbm,count(nbbm) from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  67 + + " ssgsdm like %?2% "
  68 + + " and fgsdm like %?3%"
  69 + + " and xlbm like %?4% and nbbm like %?5% "
  70 + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  71 + List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  72 +
  73 +
  74 + @Query(value="select sum(s.jzl),sum(s.yh),sum(s.sh) from Ylb s "
  75 + + " where to_days(?1)=to_days(s.rq) "
  76 + + " and s.ssgsdm like %?2% "
  77 + + " and s.fgsdm like %?3%"
  78 + + " and s.xlbm like %?4% "
  79 + + " and s.nbbm in ?5 ")
  80 + List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  81 +
  82 + @Transactional
  83 + @Modifying
  84 + @Query(value="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
  85 + + " where to_days(?1)=to_days(rq) "
  86 + + " and ssgsdm like %?2% "
  87 + + " and fgsdm like %?3%"
  88 + + " and xlbm like %?4% "
  89 + + " and nbbm like %?5%",nativeQuery=true)
  90 + List<Object[]> sumYlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
56 91 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -86,18 +86,23 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
86 86 + " and clZbh like %?5% order by s.fcsj")
87 87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
88 88  
  89 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
89 90 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
90 91 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
91 92  
  93 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
92 94 @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
93 95 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
94 96  
95   - @Query(value="select s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")
96   - List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
  97 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  98 + @Query(value="select 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")
  99 + List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
97 100  
  101 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
98 102 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
99 103 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);
100 104  
  105 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
101 106 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
102 107 List<ScheduleRealInfo> scheduleDaily(String line,String date);
103 108  
... ...
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java
... ... @@ -101,7 +101,7 @@ public class CommonServiceImpl implements CommonService{
101 101 + " order by bcs";
102 102  
103 103  
104   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
  104 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"","");
105 105  
106 106 DecimalFormat format = new DecimalFormat("0.00");
107 107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
... ...
src/main/java/com/bsth/service/oil/YlbService.java
... ... @@ -15,5 +15,9 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
15 15  
16 16 Map<String, Object> checkYl(Map<String, Object> map);
17 17  
  18 + List<Object[]> sumYlb(Map<String, Object> map);
  19 +
18 20 List<Ylb> oilListMonth(String line,String date);
  21 +
  22 + StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
19 23 }
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -283,9 +283,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
283 283 break;
284 284 }
285 285 }
286   -
287 286 }
288   -
289 287 }
290 288 }
291 289 }
... ... @@ -708,6 +706,96 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
708 706 });
709 707 return list;
710 708 }
  709 +
  710 + @Override
  711 + public StringBuffer checkNbmmNum(String rq, String gsbm, String fgsbm, String xlbm,String nbbm,int lx) {
  712 + StringBuffer stringList =new StringBuffer();
  713 + List<Object[]> objectList=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  714 + for (int i = 0; i < objectList.size(); i++) {
  715 + String clbm=objectList.get(i)[0].toString()+",";
  716 + int cs=Integer.parseInt(objectList.get(i)[1].toString());
  717 + //一车一单
  718 + if(lx==1){
  719 + if(cs==1){
  720 + stringList.append(clbm);
  721 + }
  722 + }
  723 + //一车多单
  724 + if(lx==2){
  725 + if(cs>1){
  726 + stringList.append(clbm);
  727 + }
  728 +
  729 + }
  730 + }
  731 + return stringList;
  732 + }
  733 +
  734 +
  735 +
  736 + @Override
  737 + public List<Object[]> sumYlb(Map<String, Object> map) {
  738 + // TODO Auto-generated method stub
  739 + List<String> stringList=new ArrayList<String>();
  740 + String rq=map.get("rq").toString();
  741 + String gsbm=map.get("ssgsdm_like").toString();
  742 + String fgsbm=map.get("fgsdm_like").toString();
  743 + String xlbm=map.get("xlbm_like").toString().trim();
  744 + String nbbm=map.get("nbbm_eq").toString();
  745 + String sxtj=map.get("sxtj").toString();
  746 + if(nbbm.trim()!=""){
  747 + stringList.add(nbbm);
  748 + }else{
  749 + if(!sxtj.equals("0")){
  750 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  751 + for (int i = 0; i < objectLists.size(); i++) {
  752 + String clbm=objectLists.get(i)[0].toString();
  753 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  754 + //一车一单
  755 +
  756 + if(sxtj.equals("1")){
  757 + if(cs==1){
  758 + stringList.add(clbm);
  759 + }
  760 + }
  761 + //一车多单
  762 + if(sxtj.equals("2")){
  763 + if(cs>1){
  764 + stringList.add(clbm);
  765 + }
  766 + }
  767 + }
  768 + }
  769 + }
  770 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  771 + if(sxtj.equals("0")){
  772 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
  773 + }else{
  774 + if(stringList.size()>0){
  775 +
  776 +// String strings[]=new String[stringList.size()];
  777 +// for(int i=0;i<stringList.size();i++){
  778 +// strings[i]=stringList.get(i);
  779 +// }
  780 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  781 + }else{
  782 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  783 + }
  784 +
  785 + }
  786 +
  787 +
  788 +// String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
  789 +// + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
  790 +// + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
  791 +// + " and fgsdm like '%"+map.get("fgsdm_like").toString()+"%' "
  792 +// + " and xlbm like '%"+map.get("xlbm_like").toString()+ "%'"
  793 +// + " and nbbm like '%"+map.get("nbbm_eq").toString()+"% '";
  794 +// if(map.get("nbbm_in")!=null){
  795 +//// sql +=" and nbbm in ("
  796 +// }
  797 + return sumYlbList;
  798 + }
711 799  
712 800  
713 801 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -1216,7 +1216,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1216 1216  
1217 1217 @Override
1218 1218 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
1219   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1219 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date,"","");
1220 1220  
1221 1221 DecimalFormat format = new DecimalFormat("0.00");
1222 1222 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
... ... @@ -2865,9 +2865,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2865 2865 //前一天日期
2866 2866 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2867 2867 // String date = "2016-09-20";
  2868 + System.out.println("shijian1:"+new Date());
2868 2869 List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
2869   -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2870   - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date);
  2870 + System.out.println("shijian2:"+new Date());
  2871 + // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2872 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
  2873 + System.out.println("shijian3:"+new Date());
2871 2874 for (int x = 0; x < yesterdayDataList.size(); x++) {
2872 2875 String jName = yesterdayDataList.get(x).get("jGh").toString();
2873 2876 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
... ... @@ -2893,7 +2896,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2893 2896 //计划班次,烂班班次,增加班次
2894 2897 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
2895 2898 if (scheduleRealInfo.isSflj()) {
2896   - addMileage += tempJhlc;
  2899 + if(scheduleRealInfo.getStatus() == -1){
  2900 + addMileage += tempJhlc;
  2901 + }
2897 2902 } else {
2898 2903 if (!(scheduleRealInfo.getBcType().equals("in")
2899 2904 || scheduleRealInfo.getBcType().equals("out"))) {
... ... @@ -2949,36 +2954,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2949 2954 yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
2950 2955  
2951 2956 }
2952   -
2953   - /* for(ScheduleRealInfo scheduleRealInfo:list){
2954   - if(scheduleRealInfo != null){
2955   - for(int i=0;i<yesterdayDataList.size();i++){
2956   - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
2957   - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
2958   - //根据线路代码获取公司
2959   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
2960   - yesterdayDataList.get(i).put("company", li.getCompany());
2961   - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
2962   - //计算总公里
2963   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2964   - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
2965   - if(childTaskPlans.isEmpty()){
2966   - if(scheduleRealInfo.getStatus() == 2){
2967   - yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
2968   - }
2969   - }else{
2970   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2971   - while(it.hasNext()){
2972   - ChildTaskPlan childTaskPlan = it.next();
2973   - if(!childTaskPlan.isDestroy()){
2974   - yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
2975   - }
2976   - }
2977   - }
2978   - }
2979   - }
2980   - }
2981   - }*/
  2957 + System.out.println();
2982 2958 //增加顺序号
2983 2959 for (int i = 0; i < yesterdayDataList.size(); i++) {
2984 2960 if (i == 0) {
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -58,56 +58,99 @@
58 58 id="datatable_ylb">
59 59 <thead>
60 60 <tr role="row" class="filter">
61   - <td> 公司:</td>
62   - <td colspan="2">
63   -
64   - <select class="form-control" name="ssgsdm_like" id="ylbListGsdmId" ></select>
65   -
66   - </td>
67   - <td>
68   - 分公司:
69   - </td>
70   - <td colspan="2">
71   -
72   - <select class="form-control" name="fgsdm_like" id="ylbListFgsdmId" ></select>
73   - </td>
74   -
75   - <td>
76   - 日期:
77   - </td>
78   - <td>
79   - <input type="text" style="width: 80px" name="rq" id="rq"/>
80   - </td>
81   - <td >
82   - 线路:
83   - </td>
84   - <td colspan="2">
85   - <select class="form-control" name="xlbm_like" id="xlbm" style="width: 120px;"></select>
86   - </td>
87   - <td >
88   - 内部编码:
89   - </td>
90   - <td colspan="4">
91   - <div style="float:left;">
92   - <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select>
93   - </div>
94   - <div style="float:left;">
95   - <button class="btn btn-sm #000 btn-outline filter-cancel" style="margin-right:0px">
96   - <i class="fa fa-times"></i>
97   - </button>
98   - </div>
99   - </td>
100   - <td colspan="1">
101   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
102   - <i class="fa fa-search"></i> 搜索
103   - </button>
  61 + <td colspan="2">
  62 + <div style="float: right; " >&nbsp;公司&nbsp;</div>
  63 + </td>
  64 + <td colspan="3">
  65 + <div style="float: left;width: 150px">
  66 + <select class="form-control" name="ssgsdm_like"
  67 + id="ylbListGsdmId"></select>
  68 + </div>
  69 + </td>
  70 + <td colspan="2">
  71 + <div style="float: right; " >&nbsp;分公司&nbsp;</div>
  72 + </td>
  73 + <td colspan="4">
  74 + <div style="float: left;">
  75 + <select class="form-control" name="fgsdm_like"
  76 + id="ylbListFgsdmId" style="width: 150px"></select>
  77 + </div>
  78 + </td>
  79 + <td >
  80 + <div style="float: right; ">日期</div>
  81 + </td>
  82 + <td colspan="3">
  83 + <div style="float: left;">
  84 + <input type="text" style="width: 120px" name="rq" id="rq" />
  85 + </div>
  86 + </td>
  87 + <td rowspan="2" colspan="2">
  88 + <div style="float: left;">
  89 + &nbsp;<button
  90 + class="btn btn-sm green btn-outline filter-submit margin-bottom"
  91 + style="margin-right: 0px">
  92 + <i class="fa fa-search"></i> 搜索
  93 + </button> <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
  94 + <!-- <i class="fa fa-times"></i> 重置 -->
  95 + <!-- </button> -->
104 96  
105   -<!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
106   -<!-- <i class="fa fa-times"></i> 重置 -->
107   -<!-- </button> -->
108   -
109   - </td>
  97 + </div>
  98 + </td>
110 99 </tr>
  100 + <tr class="filter2">
  101 + <td colspan="2">
  102 + <div style="float: right; ">&nbsp;线路</div>
  103 + </td>
  104 + <td colspan="3">
  105 + <div style="float: left;">
  106 + <select class="form-control" name="xlbm_like" id="xlbm"
  107 + style="width: 150px;"></select>
  108 + </div>
  109 + </td>
  110 + <td colspan="2">
  111 + <div style="float: right;">&nbsp;内部编码</div>
  112 + </td>
  113 + <td colspan="4">
  114 + <div style="float: left;">
  115 + <select class="form-control" name="nbbm_eq" id="nbbm"
  116 + style="width: 120px;"></select>
  117 + </div>
  118 + <div style="float: left;">
  119 + <button class="btn btn-sm #000 btn-outline filter-cancel"
  120 + style="margin-right: 0px">
  121 + <i class="fa fa-times"></i>
  122 + </button>
  123 + </div>
  124 + </td>
  125 + <td >
  126 + <div style="float: right;">
  127 + 类型
  128 + </div>
  129 + </td>
  130 + <td colspan="3">
  131 + <div style="float: left;">
  132 + <select class="form-control" name="sxtj">
  133 + <option value="0">全部</option>
  134 + <option value="1">一车一单</option>
  135 + <option value="2">一车多单</option>
  136 + </select>
  137 + </div>
  138 +
  139 + </td>
  140 + </tr>
  141 + <tr>
  142 + <td colspan="17">
  143 + <div style="float: left;">
  144 + 总计
  145 + &nbsp;&nbsp;
  146 + 加注量:&nbsp;<label id="sumJzl"></label>
  147 + &nbsp;&nbsp;
  148 + 耗油量:&nbsp;<label id="sumYh"></label>
  149 + &nbsp;&nbsp;
  150 + 损耗量:&nbsp;<label id="sumSh"></label>
  151 + </div>
  152 + </td>
  153 + </tr>
111 154 <tr role="row" class="heading">
112 155 <th width="2%">#</th>
113 156 <th width="8%">日期</th>
... ... @@ -226,18 +269,7 @@
226 269 $("#checkYl").on('click', function () {
227 270 console.log("核对加注量");
228 271 if ($("#rq").val() != "") {
229   - var cells = $('tr.filter')[0].cells
230   - , params = {}
231   - , name;
232   - $.each(cells, function (i, cell) {
233   - var items = $('input,select', cell);
234   - for (var j = 0, item; item = items[j++];) {
235   - name = $(item).attr('name');
236   - if (name) {
237   - params[name] = $(item).val();
238   - }
239   - }
240   - });
  272 + var params=getParamsList();
241 273 var i = layer.load(2);
242 274 $get('/ylb/checkYl', params, function () {
243 275 layer.close(i);
... ... @@ -252,18 +284,7 @@
252 284 $("#outAndIn").on('click', function () {
253 285 console.log("进场油量等于出场油量");
254 286 if ($("#rq").val() != "") {
255   - var cells = $('tr.filter')[0].cells
256   - , params = {}
257   - , name;
258   - $.each(cells, function (i, cell) {
259   - var items = $('input,select', cell);
260   - for (var j = 0, item; item = items[j++];) {
261   - name = $(item).attr('name');
262   - if (name) {
263   - params[name] = $(item).val();
264   - }
265   - }
266   - });
  287 + var params=getParamsList();
267 288 var i = layer.load(2);
268 289 $get('/ylb/outAndIn', params, function () {
269 290 layer.close(i);
... ... @@ -294,18 +315,7 @@
294 315 var i = layer.load(2);
295 316 $get('/ylb/sort', params, function () {
296 317 layer.close(i);
297   - var cells = $('tr.filter')[0].cells
298   - , params1 = {}
299   - , name;
300   - $.each(cells, function (i, cell) {
301   - var items = $('input,select', cell);
302   - for (var j = 0, item; item = items[j++];) {
303   - name = $(item).attr('name');
304   - if (name) {
305   - params1[name] = $(item).val();
306   - }
307   - }
308   - });
  318 + var params1 =getParamsList();
309 319 jsDoQuery(params1, true);
310 320 });
311 321  
... ... @@ -318,18 +328,8 @@
318 328 $("#obtain").on('click', function () {
319 329 console.log("获取加存");
320 330 if ($("#rq").val() != "") {
321   - var cells = $('tr.filter')[0].cells
322   - , params = {}
323   - , name;
324   - $.each(cells, function (i, cell) {
325   - var items = $('input,select', cell);
326   - for (var j = 0, item; item = items[j++];) {
327   - name = $(item).attr('name');
328   - if (name) {
329   - params[name] = $(item).val();
330   - }
331   - }
332   - });
  331 + var params =getParamsList();
  332 +
333 333 var i = layer.load(2);
334 334 $get('/ylb/obtain', params, function () {
335 335 layer.close(i);
... ... @@ -352,8 +352,8 @@
352 352 }
353 353  
354 354 //重置
355   - $('tr.filter .filter-cancel').on('click', function () {
356   - $('tr.filter , #nbbm').val('').change();
  355 + $('tr.filter2 .filter-cancel').on('click', function () {
  356 + $('tr.filter2 , #nbbm').val('').change();
357 357 });
358 358  
359 359 //提交
... ... @@ -365,23 +365,39 @@
365 365 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
366 366 layer.msg('请选择公司和分公司.');
367 367 }else {
368   - var cells = $('tr.filter')[0].cells
369   - , params = {}
370   - , name;
371   - $.each(cells, function (i, cell) {
372   - var items = $('input,select', cell);
373   - for (var j = 0, item; item = items[j++];) {
374   - name = $(item).attr('name');
375   - if (name) {
376   - params[name] = $(item).val();
377   - }
378   - }
379   - });
  368 + var params = getParamsList();
  369 +
  370 +
380 371 page = 0;
381 372 jsDoQuery(params, true);
382 373 }
383 374 });
384 375  
  376 + function getParamsList(){
  377 + var cells = $('tr.filter')[0].cells
  378 + , cells1 = $('tr.filter2')[0].cells,params = {}
  379 + , name;
  380 + $.each(cells, function (i, cell) {
  381 + var items = $('input,select', cell);
  382 + for (var j = 0, item; item = items[j++];) {
  383 + name = $(item).attr('name');
  384 + if (name) {
  385 + params[name] = $(item).val();
  386 + }
  387 + }
  388 + });
  389 + $.each(cells1, function (i, cell) {
  390 + var items = $('input,select', cell);
  391 + for (var j = 0, item; item = items[j++];) {
  392 + name = $(item).attr('name');
  393 + if (name) {
  394 + params[name] = $(item).val();
  395 + }
  396 + }
  397 + });
  398 +
  399 + return params;
  400 + }
385 401  
386 402 // var gsqxdm="";
387 403  
... ... @@ -454,13 +470,15 @@
454 470 params['fgsdm_in']=fgsqx1;
455 471 }
456 472 } */
  473 +
457 474 var l = layer.load(2);
458 475 $get('/ylb', params, function (data) {
  476 +
459 477 $.each(data.content, function (i, obj) {
460 478 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
461 479 });
462 480 var bodyHtm = template('ylb_list_temp', {list: data.content});
463   -
  481 +
464 482 $('#datatable_ylb tbody').html(bodyHtm)
465 483 .find('.icheck').iCheck(icheckOptions)
466 484 .on('ifChanged', iCheckChange);
... ... @@ -470,7 +488,12 @@
470 488 showPagination(data);
471 489 }
472 490 layer.close(l);
473   -
  491 + $get('/ylb/sumYlb',params,function(returns){
  492 + console.log(returns[0])
  493 + $("#sumJzl").html(returns[0][0]);
  494 + $("#sumYh").html(returns[0][1]);
  495 + $("#sumSh").html(returns[0][2]);
  496 + });
474 497 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
475 498 startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
476 499 });
... ... @@ -549,18 +572,7 @@
549 572 return;
550 573 }
551 574  
552   - var cells = $('tr.filter')[0].cells
553   - , params = {}
554   - , name;
555   - $.each(cells, function (i, cell) {
556   - var items = $('input,select', cell);
557   - for (var j = 0, item; item = items[j++];) {
558   - name = $(item).attr('name');
559   - if (name) {
560   - params[name] = $(item).val();
561   - }
562   - }
563   - });
  575 + var params=getParamsList();
564 576 page = num - 1;
565 577 jsDoQuery(params, true);
566 578 }
... ... @@ -636,18 +648,7 @@
636 648  
637 649 $("#export").on("click", function () {
638 650 if ($("#rq").val() != "") {
639   - var cells = $('tr.filter')[0].cells
640   - , params = {}
641   - , name;
642   - $.each(cells, function (i, cell) {
643   - var items = $('input,select', cell);
644   - for (var j = 0, item; item = items[j++];) {
645   - name = $(item).attr('name');
646   - if (name) {
647   - params[name] = $(item).val();
648   - }
649   - }
650   - });
  651 + var params=getParamsList();
651 652 $post('/ylb/listExport', params, function (result) {
652 653 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
653 654 });
... ...