Commit 6c7b45f2ae777b0b1672e1fac613fb6a32d9d907

Authored by 潘钊
2 parents ed801d19 64331184

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

src/main/java/com/bsth/controller/oil/YlbController.java
@@ -119,8 +119,15 @@ public class YlbController extends BaseController<Ylb, Integer>{ @@ -119,8 +119,15 @@ public class YlbController extends BaseController<Ylb, Integer>{
119 119
120 Direction d; 120 Direction d;
121 map.put("xlbm_like", map.get("xlbm_like").toString().trim()); 121 map.put("xlbm_like", map.get("xlbm_like").toString().trim());
122 -// try {  
123 String rq=map.get("rq").toString(); 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 if(!(rq=="")){ 131 if(!(rq=="")){
125 // 132 //
126 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 133 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
@@ -155,6 +162,11 @@ public class YlbController extends BaseController<Ylb, Integer>{ @@ -155,6 +162,11 @@ public class YlbController extends BaseController<Ylb, Integer>{
155 return yblService.oilListMonth(line, date); 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 @RequestMapping(value = "/listExport",method = RequestMethod.POST) 171 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
160 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ 172 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
src/main/java/com/bsth/controller/realcontrol/OilStationSocietyController.java
1 -package com.bsth.controller.realcontrol;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.realcontrol.OilStationSociety;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RestController;  
7 -  
8 -/**  
9 - * Created by panzhao on 2017/3/16.  
10 - */  
11 -@RestController  
12 -@RequestMapping("/oilStation")  
13 -public class OilStationSocietyController extends BaseController<OilStationSociety, String>{  
14 -} 1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.realcontrol.OilStationSociety;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@RestController
  12 +@RequestMapping("/oilStation")
  13 +public class OilStationSocietyController extends BaseController<OilStationSociety, String>{
  14 +}
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java
1 -package com.bsth.entity.realcontrol;  
2 -  
3 -import javax.persistence.Entity;  
4 -import javax.persistence.Id;  
5 -import javax.persistence.Table;  
6 -  
7 -/**  
8 - * 社会加油站  
9 - * Created by panzhao on 2017/3/16.  
10 - */  
11 -@Entity  
12 -@Table(name = "bsth_c_oil_station")  
13 -public class OilStationSociety {  
14 -  
15 - @Id  
16 - private String lineCode;  
17 -  
18 - /**  
19 - * 加油站名称  
20 - */  
21 - private String stationName;  
22 -  
23 - /**  
24 - * 上行进场距离  
25 - */  
26 - private Double upInMile;  
27 - /**  
28 - * 上行出场距离  
29 - */  
30 - private Double upOutMile;  
31 -  
32 - /**  
33 - * 下行进场距离  
34 - */  
35 - private Double downInMile;  
36 - /**  
37 - * 下行出场距离  
38 - */  
39 - private Double downOutMile;  
40 -  
41 -  
42 - /**  
43 - * 上行进场时间 分钟  
44 - */  
45 - private int upInTime;  
46 - /**  
47 - * 上行出场时间 分钟  
48 - */  
49 - private int upOutTime;  
50 -  
51 - /**  
52 - * 下行进场时间 分钟  
53 - */  
54 - private int downInTime;  
55 - /**  
56 - * 下行出场时间 分钟  
57 - */  
58 - private int downOutTime;  
59 -  
60 -  
61 - public String getLineCode() {  
62 - return lineCode;  
63 - }  
64 -  
65 - public void setLineCode(String lineCode) {  
66 - this.lineCode = lineCode;  
67 - }  
68 -  
69 - public String getStationName() {  
70 - return stationName;  
71 - }  
72 -  
73 - public void setStationName(String stationName) {  
74 - this.stationName = stationName;  
75 - }  
76 -  
77 - public Double getUpInMile() {  
78 - return upInMile;  
79 - }  
80 -  
81 - public void setUpInMile(Double upInMile) {  
82 - this.upInMile = upInMile;  
83 - }  
84 -  
85 - public Double getUpOutMile() {  
86 - return upOutMile;  
87 - }  
88 -  
89 - public void setUpOutMile(Double upOutMile) {  
90 - this.upOutMile = upOutMile;  
91 - }  
92 -  
93 - public Double getDownInMile() {  
94 - return downInMile;  
95 - }  
96 -  
97 - public void setDownInMile(Double downInMile) {  
98 - this.downInMile = downInMile;  
99 - }  
100 -  
101 - public Double getDownOutMile() {  
102 - return downOutMile;  
103 - }  
104 -  
105 - public void setDownOutMile(Double downOutMile) {  
106 - this.downOutMile = downOutMile;  
107 - }  
108 -  
109 - public int getUpInTime() {  
110 - return upInTime;  
111 - }  
112 -  
113 - public void setUpInTime(int upInTime) {  
114 - this.upInTime = upInTime;  
115 - }  
116 -  
117 - public int getUpOutTime() {  
118 - return upOutTime;  
119 - }  
120 -  
121 - public void setUpOutTime(int upOutTime) {  
122 - this.upOutTime = upOutTime;  
123 - }  
124 -  
125 - public int getDownInTime() {  
126 - return downInTime;  
127 - }  
128 -  
129 - public void setDownInTime(int downInTime) {  
130 - this.downInTime = downInTime;  
131 - }  
132 -  
133 - public int getDownOutTime() {  
134 - return downOutTime;  
135 - }  
136 -  
137 - public void setDownOutTime(int downOutTime) {  
138 - this.downOutTime = downOutTime;  
139 - }  
140 -} 1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 社会加油站
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_oil_station")
  13 +public class OilStationSociety {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 加油站名称
  20 + */
  21 + private String stationName;
  22 +
  23 + /**
  24 + * 上行进场距离
  25 + */
  26 + private Double upInMile;
  27 + /**
  28 + * 上行出场距离
  29 + */
  30 + private Double upOutMile;
  31 +
  32 + /**
  33 + * 下行进场距离
  34 + */
  35 + private Double downInMile;
  36 + /**
  37 + * 下行出场距离
  38 + */
  39 + private Double downOutMile;
  40 +
  41 +
  42 + /**
  43 + * 上行进场时间 分钟
  44 + */
  45 + private int upInTime;
  46 + /**
  47 + * 上行出场时间 分钟
  48 + */
  49 + private int upOutTime;
  50 +
  51 + /**
  52 + * 下行进场时间 分钟
  53 + */
  54 + private int downInTime;
  55 + /**
  56 + * 下行出场时间 分钟
  57 + */
  58 + private int downOutTime;
  59 +
  60 +
  61 + public String getLineCode() {
  62 + return lineCode;
  63 + }
  64 +
  65 + public void setLineCode(String lineCode) {
  66 + this.lineCode = lineCode;
  67 + }
  68 +
  69 + public String getStationName() {
  70 + return stationName;
  71 + }
  72 +
  73 + public void setStationName(String stationName) {
  74 + this.stationName = stationName;
  75 + }
  76 +
  77 + public Double getUpInMile() {
  78 + return upInMile;
  79 + }
  80 +
  81 + public void setUpInMile(Double upInMile) {
  82 + this.upInMile = upInMile;
  83 + }
  84 +
  85 + public Double getUpOutMile() {
  86 + return upOutMile;
  87 + }
  88 +
  89 + public void setUpOutMile(Double upOutMile) {
  90 + this.upOutMile = upOutMile;
  91 + }
  92 +
  93 + public Double getDownInMile() {
  94 + return downInMile;
  95 + }
  96 +
  97 + public void setDownInMile(Double downInMile) {
  98 + this.downInMile = downInMile;
  99 + }
  100 +
  101 + public Double getDownOutMile() {
  102 + return downOutMile;
  103 + }
  104 +
  105 + public void setDownOutMile(Double downOutMile) {
  106 + this.downOutMile = downOutMile;
  107 + }
  108 +
  109 + public int getUpInTime() {
  110 + return upInTime;
  111 + }
  112 +
  113 + public void setUpInTime(int upInTime) {
  114 + this.upInTime = upInTime;
  115 + }
  116 +
  117 + public int getUpOutTime() {
  118 + return upOutTime;
  119 + }
  120 +
  121 + public void setUpOutTime(int upOutTime) {
  122 + this.upOutTime = upOutTime;
  123 + }
  124 +
  125 + public int getDownInTime() {
  126 + return downInTime;
  127 + }
  128 +
  129 + public void setDownInTime(int downInTime) {
  130 + this.downInTime = downInTime;
  131 + }
  132 +
  133 + public int getDownOutTime() {
  134 + return downOutTime;
  135 + }
  136 +
  137 + public void setDownOutTime(int downOutTime) {
  138 + this.downOutTime = downOutTime;
  139 + }
  140 +}
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
@@ -69,6 +69,11 @@ public class PredicatesBuilder { @@ -69,6 +69,11 @@ public class PredicatesBuilder {
69 return cb.in(expression).value(list); 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 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){ 77 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){
73 try { 78 try {
74 return cb.gt(expression, nf.parse(object.toString())); 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,5 +27,6 @@ public enum SearchOperator {
27 isf, //假 isFalse,boolean 27 isf, //假 isFalse,boolean
28 ist, //真 isTrue,boolean 28 ist, //真 isTrue,boolean
29 date, //时间 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,4 +53,39 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
53 @Modifying 53 @Modifying
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) 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 List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm); 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/OilStationSocietyRepository.java
1 -package com.bsth.repository.realcontrol;  
2 -  
3 -import com.bsth.entity.realcontrol.OilStationSociety;  
4 -import com.bsth.repository.BaseRepository;  
5 -import org.springframework.stereotype.Repository;  
6 -  
7 -/**  
8 - * Created by panzhao on 2017/3/16.  
9 - */  
10 -@Repository  
11 -public interface OilStationSocietyRepository extends BaseRepository<OilStationSociety, String>{  
12 -} 1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/3/16.
  9 + */
  10 +@Repository
  11 +public interface OilStationSocietyRepository extends BaseRepository<OilStationSociety, String>{
  12 +}
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -86,18 +86,23 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -86,18 +86,23 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
86 + " and clZbh like %?5% order by s.fcsj") 86 + " and clZbh like %?5% order by s.fcsj")
87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); 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 @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 @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 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); 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 @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") 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 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); 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 @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") 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 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate); 103 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);
100 104
  105 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
101 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") 106 @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
102 List<ScheduleRealInfo> scheduleDaily(String line,String date); 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,7 +101,7 @@ public class CommonServiceImpl implements CommonService{
101 + " order by bcs"; 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 DecimalFormat format = new DecimalFormat("0.00"); 106 DecimalFormat format = new DecimalFormat("0.00");
107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -15,6 +15,7 @@ import com.bsth.service.TrafficManageService; @@ -15,6 +15,7 @@ import com.bsth.service.TrafficManageService;
15 import com.bsth.util.TimeUtils; 15 import com.bsth.util.TimeUtils;
16 import com.bsth.util.db.DBUtils_MS; 16 import com.bsth.util.db.DBUtils_MS;
17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType; 17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
  18 +import com.bsth.webService.trafficManage.geotool.services.Internal;
18 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 20 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
20 import org.apache.commons.lang.time.DateUtils; 21 import org.apache.commons.lang.time.DateUtils;
@@ -25,10 +26,7 @@ import org.springframework.data.domain.Sort; @@ -25,10 +26,7 @@ import org.springframework.data.domain.Sort;
25 import org.springframework.data.domain.Sort.Direction; 26 import org.springframework.data.domain.Sort.Direction;
26 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
27 28
28 -import java.io.BufferedOutputStream;  
29 -import java.io.File;  
30 -import java.io.FileOutputStream;  
31 -import java.io.IOException; 29 +import java.io.*;
32 import java.sql.Connection; 30 import java.sql.Connection;
33 import java.sql.PreparedStatement; 31 import java.sql.PreparedStatement;
34 import java.sql.ResultSet; 32 import java.sql.ResultSet;
@@ -188,6 +186,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -188,6 +186,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
188 sBuffer.append("</XLs>"); 186 sBuffer.append("</XLs>");
189 System.out.println(sBuffer.toString()); 187 System.out.println(sBuffer.toString());
190 if(sBuffer.indexOf("<XL>") != -1){ 188 if(sBuffer.indexOf("<XL>") != -1){
  189 + portType = new Internal().getInternalHttpSoap11Endpoint();
191 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString()); 190 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString());
192 String portArray[] = portResult.split("\n"); 191 String portArray[] = portResult.split("\n");
193 if(portArray.length >= 4){ 192 if(portArray.length >= 4){
@@ -386,6 +385,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -386,6 +385,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{
386 } 385 }
387 386
388 /** 387 /**
  388 + * 从文件中读取xml
  389 + * @param fileName 例:D:/test.txt
  390 + * @return
  391 + * @throws Exception
  392 + */
  393 + private String readXmlFromFile(String fileName) throws Exception {
  394 + StringBuffer sf = new StringBuffer("");
  395 + File file = new File(fileName);
  396 + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-8");
  397 + BufferedReader bufferedReader = new BufferedReader(reader);
  398 + String lineTxt = "";
  399 + while((lineTxt = bufferedReader.readLine()) != null){
  400 + sf.append(lineTxt);
  401 + }
  402 + reader.close();
  403 + return sf.toString().replaceAll("\t","");
  404 + }
  405 + /**
389 * 上传里程油耗 406 * 上传里程油耗
390 * @return 上传成功标识 407 * @return 上传成功标识
391 */ 408 */
@@ -890,7 +907,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -890,7 +907,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
890 int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024); 907 int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);
891 908
892 System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)"); 909 System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");
893 - 910 + portType = new Internal().getInternalHttpSoap11Endpoint();
894 byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123"); 911 byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");
895 String filePath = "E:\\ygc"; 912 String filePath = "E:\\ygc";
896 BufferedOutputStream bos = null; 913 BufferedOutputStream bos = null;
src/main/java/com/bsth/service/oil/YlbService.java
@@ -15,5 +15,9 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{ @@ -15,5 +15,9 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
15 15
16 Map<String, Object> checkYl(Map<String, Object> map); 16 Map<String, Object> checkYl(Map<String, Object> map);
17 17
  18 + List<Object[]> sumYlb(Map<String, Object> map);
  19 +
18 List<Ylb> oilListMonth(String line,String date); 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,9 +283,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
283 break; 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,6 +706,96 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
708 }); 706 });
709 return list; 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/OilStationSocietyService.java
1 -package com.bsth.service.realcontrol;  
2 -  
3 -import com.bsth.entity.realcontrol.OilStationSociety;  
4 -import com.bsth.service.BaseService;  
5 -  
6 -/**  
7 - * Created by panzhao on 2017/3/16.  
8 - */  
9 -public interface OilStationSocietyService extends BaseService<OilStationSociety, String> {  
10 -} 1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/3/16.
  8 + */
  9 +public interface OilStationSocietyService extends BaseService<OilStationSociety, String> {
  10 +}
src/main/java/com/bsth/service/realcontrol/impl/OilStationSocietyServiceImpl.java
1 -package com.bsth.service.realcontrol.impl;  
2 -  
3 -import com.bsth.entity.realcontrol.OilStationSociety;  
4 -import com.bsth.service.impl.BaseServiceImpl;  
5 -import com.bsth.service.realcontrol.OilStationSocietyService;  
6 -import org.springframework.stereotype.Service;  
7 -  
8 -/**  
9 - * Created by panzhao on 2017/3/16.  
10 - */  
11 -@Service  
12 -public class OilStationSocietyServiceImpl extends BaseServiceImpl<OilStationSociety, String> implements OilStationSocietyService {  
13 -} 1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import com.bsth.service.realcontrol.OilStationSocietyService;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Service
  12 +public class OilStationSocietyServiceImpl extends BaseServiceImpl<OilStationSociety, String> implements OilStationSocietyService {
  13 +}
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1219,7 +1219,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1219,7 +1219,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1219 1219
1220 @Override 1220 @Override
1221 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) { 1221 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
1222 - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date); 1222 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date,"","");
1223 1223
1224 DecimalFormat format = new DecimalFormat("0.00"); 1224 DecimalFormat format = new DecimalFormat("0.00");
1225 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 1225 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
@@ -2868,9 +2868,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2868,9 +2868,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2868 //前一天日期 2868 //前一天日期
2869 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); 2869 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2870 // String date = "2016-09-20"; 2870 // String date = "2016-09-20";
  2871 + System.out.println("shijian1:"+new Date());
2871 List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm); 2872 List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
2872 -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);  
2873 - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date); 2873 + System.out.println("shijian2:"+new Date());
  2874 + // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2875 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
  2876 + System.out.println("shijian3:"+new Date());
2874 for (int x = 0; x < yesterdayDataList.size(); x++) { 2877 for (int x = 0; x < yesterdayDataList.size(); x++) {
2875 String jName = yesterdayDataList.get(x).get("jGh").toString(); 2878 String jName = yesterdayDataList.get(x).get("jGh").toString();
2876 String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); 2879 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
@@ -2896,7 +2899,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2896,7 +2899,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2896 //计划班次,烂班班次,增加班次 2899 //计划班次,烂班班次,增加班次
2897 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 2900 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
2898 if (scheduleRealInfo.isSflj()) { 2901 if (scheduleRealInfo.isSflj()) {
2899 - addMileage += tempJhlc; 2902 + if(scheduleRealInfo.getStatus() == -1){
  2903 + addMileage += tempJhlc;
  2904 + }
2900 } else { 2905 } else {
2901 if (!(scheduleRealInfo.getBcType().equals("in") 2906 if (!(scheduleRealInfo.getBcType().equals("in")
2902 || scheduleRealInfo.getBcType().equals("out"))) { 2907 || scheduleRealInfo.getBcType().equals("out"))) {
@@ -2952,36 +2957,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2952,36 +2957,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2952 yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc); 2957 yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
2953 2958
2954 } 2959 }
2955 -  
2956 - /* for(ScheduleRealInfo scheduleRealInfo:list){  
2957 - if(scheduleRealInfo != null){  
2958 - for(int i=0;i<yesterdayDataList.size();i++){  
2959 - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))  
2960 - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){  
2961 - //根据线路代码获取公司  
2962 - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());  
2963 - yesterdayDataList.get(i).put("company", li.getCompany());  
2964 - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());  
2965 - //计算总公里  
2966 - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();  
2967 - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班  
2968 - if(childTaskPlans.isEmpty()){  
2969 - if(scheduleRealInfo.getStatus() == 2){  
2970 - 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")));  
2971 - }  
2972 - }else{  
2973 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
2974 - while(it.hasNext()){  
2975 - ChildTaskPlan childTaskPlan = it.next();  
2976 - if(!childTaskPlan.isDestroy()){  
2977 - 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")));  
2978 - }  
2979 - }  
2980 - }  
2981 - }  
2982 - }  
2983 - }  
2984 - }*/ 2960 + System.out.println();
2985 //增加顺序号 2961 //增加顺序号
2986 for (int i = 0; i < yesterdayDataList.size(); i++) { 2962 for (int i = 0; i < yesterdayDataList.size(); i++) {
2987 if (i == 0) { 2963 if (i == 0) {
src/main/resources/static/pages/oil/list_ph.html
@@ -58,56 +58,99 @@ @@ -58,56 +58,99 @@
58 id="datatable_ylb"> 58 id="datatable_ylb">
59 <thead> 59 <thead>
60 <tr role="row" class="filter"> 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 </tr> 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 <tr role="row" class="heading"> 154 <tr role="row" class="heading">
112 <th width="2%">#</th> 155 <th width="2%">#</th>
113 <th width="8%">日期</th> 156 <th width="8%">日期</th>
@@ -226,18 +269,7 @@ @@ -226,18 +269,7 @@
226 $("#checkYl").on('click', function () { 269 $("#checkYl").on('click', function () {
227 console.log("核对加注量"); 270 console.log("核对加注量");
228 if ($("#rq").val() != "") { 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 var i = layer.load(2); 273 var i = layer.load(2);
242 $get('/ylb/checkYl', params, function () { 274 $get('/ylb/checkYl', params, function () {
243 layer.close(i); 275 layer.close(i);
@@ -252,18 +284,7 @@ @@ -252,18 +284,7 @@
252 $("#outAndIn").on('click', function () { 284 $("#outAndIn").on('click', function () {
253 console.log("进场油量等于出场油量"); 285 console.log("进场油量等于出场油量");
254 if ($("#rq").val() != "") { 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 var i = layer.load(2); 288 var i = layer.load(2);
268 $get('/ylb/outAndIn', params, function () { 289 $get('/ylb/outAndIn', params, function () {
269 layer.close(i); 290 layer.close(i);
@@ -294,18 +315,7 @@ @@ -294,18 +315,7 @@
294 var i = layer.load(2); 315 var i = layer.load(2);
295 $get('/ylb/sort', params, function () { 316 $get('/ylb/sort', params, function () {
296 layer.close(i); 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 jsDoQuery(params1, true); 319 jsDoQuery(params1, true);
310 }); 320 });
311 321
@@ -318,18 +328,8 @@ @@ -318,18 +328,8 @@
318 $("#obtain").on('click', function () { 328 $("#obtain").on('click', function () {
319 console.log("获取加存"); 329 console.log("获取加存");
320 if ($("#rq").val() != "") { 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 var i = layer.load(2); 333 var i = layer.load(2);
334 $get('/ylb/obtain', params, function () { 334 $get('/ylb/obtain', params, function () {
335 layer.close(i); 335 layer.close(i);
@@ -352,8 +352,8 @@ @@ -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,23 +365,39 @@
365 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){ 365 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
366 layer.msg('请选择公司和分公司.'); 366 layer.msg('请选择公司和分公司.');
367 }else { 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 page = 0; 371 page = 0;
381 jsDoQuery(params, true); 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 // var gsqxdm=""; 402 // var gsqxdm="";
387 403
@@ -454,13 +470,15 @@ @@ -454,13 +470,15 @@
454 params['fgsdm_in']=fgsqx1; 470 params['fgsdm_in']=fgsqx1;
455 } 471 }
456 } */ 472 } */
  473 +
457 var l = layer.load(2); 474 var l = layer.load(2);
458 $get('/ylb', params, function (data) { 475 $get('/ylb', params, function (data) {
  476 +
459 $.each(data.content, function (i, obj) { 477 $.each(data.content, function (i, obj) {
460 obj.rq = moment(obj.rq).format("YYYY-MM-DD"); 478 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
461 }); 479 });
462 var bodyHtm = template('ylb_list_temp', {list: data.content}); 480 var bodyHtm = template('ylb_list_temp', {list: data.content});
463 - 481 +
464 $('#datatable_ylb tbody').html(bodyHtm) 482 $('#datatable_ylb tbody').html(bodyHtm)
465 .find('.icheck').iCheck(icheckOptions) 483 .find('.icheck').iCheck(icheckOptions)
466 .on('ifChanged', iCheckChange); 484 .on('ifChanged', iCheckChange);
@@ -470,7 +488,12 @@ @@ -470,7 +488,12 @@
470 showPagination(data); 488 showPagination(data);
471 } 489 }
472 layer.close(l); 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 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); 497 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
475 startOptShylLink($('#ll_oil_list .in_carpark_shyl')); 498 startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
476 }); 499 });
@@ -549,18 +572,7 @@ @@ -549,18 +572,7 @@
549 return; 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 page = num - 1; 576 page = num - 1;
565 jsDoQuery(params, true); 577 jsDoQuery(params, true);
566 } 578 }
@@ -636,18 +648,7 @@ @@ -636,18 +648,7 @@
636 648
637 $("#export").on("click", function () { 649 $("#export").on("click", function () {
638 if ($("#rq").val() != "") { 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 $post('/ylb/listExport', params, function (result) { 652 $post('/ylb/listExport', params, function (result) {
652 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD")); 653 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
653 }); 654 });
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_oil.html
1 -<div class="uk-modal ct-form-modal" id="schedule-addsch_oil-modal">  
2 - <div class="uk-modal-dialog" style="width: 1201px;">  
3 - <a href="" class="uk-modal-close uk-close"></a>  
4 - <div class="uk-modal-header">  
5 - <h2>加油</h2></div>  
6 -  
7 - <div class="uk-grid">  
8 - <div class="uk-width-1-3">  
9 - <form class="uk-form uk-form-horizontal ">  
10 - <input type="hidden" name="type1" value="正常">  
11 - <input type="hidden" name="type2" value="1">  
12 - <input type="hidden" name="mileageType" value="service">  
13 -  
14 - <div class="uk-panel uk-panel-box uk-panel-box-primary">  
15 - <div class="uk-panel-badge uk-badge ">营运</div>  
16 - <h3 class="uk-panel-title">线路上站点间</h3>  
17 - <div class="uk-form-row">  
18 - <label class="uk-form-label">起点站</label>  
19 - <div class="uk-form-controls">  
20 - <input type="hidden" name="startStation">  
21 - <input type="text" name="startStationName" disabled>  
22 - </div>  
23 - </div>  
24 - <div class="uk-form-row">  
25 - <label class="uk-form-label">终点站</label>  
26 - <div class="uk-form-controls">  
27 - <input type="hidden" name="endStation">  
28 - <input type="text" name="endStationName" disabled>  
29 - </div>  
30 - </div>  
31 - <div class="uk-form-row">  
32 - <label class="uk-form-label">里程</label>  
33 - <div class="uk-form-controls">  
34 - <input type="number" step="0.01" name="mileage" max=222  
35 - data-fv-lessthan-inclusive="false"  
36 - disabled>  
37 - </div>  
38 - </div>  
39 - <div class="uk-form-row">  
40 - <label class="uk-form-label">开始时间</label>  
41 - <div class="uk-form-controls">  
42 - <input type="time" name="startDate" required>  
43 - </div>  
44 - </div>  
45 - <div class="uk-form-row">  
46 - <label class="uk-form-label">结束时间</label>  
47 - <div class="uk-form-controls">  
48 - <input type="time" name="endDate" required>  
49 - </div>  
50 - </div>  
51 - </div>  
52 - </form>  
53 - </div>  
54 -  
55 - <div class="uk-width-1-3">  
56 - <form class="uk-form uk-form-horizontal">  
57 - <input type="hidden" name="type1" value="临加">  
58 - <input type="hidden" name="type2" value="2">  
59 - <input type="hidden" name="mileageType" value="empty">  
60 -  
61 - <div class="uk-panel uk-panel-box uk-panel-box-secondary">  
62 - <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>  
63 - <h3 class="uk-panel-title">进场</h3>  
64 - <div class="uk-form-row">  
65 - <label class="uk-form-label">起点站</label>  
66 - <div class="uk-form-controls">  
67 - <select name="startStation" required>  
68 - </select>  
69 - <input type="hidden" name="startStationName" disabled>  
70 - </div>  
71 - </div>  
72 - <div class="uk-form-row">  
73 - <label class="uk-form-label">终点站</label>  
74 - <div class="uk-form-controls">  
75 - <select name="endStation" required>  
76 - </select>  
77 - <input type="hidden" name="endStationName" disabled>  
78 - </div>  
79 - </div>  
80 - <div class="uk-form-row">  
81 - <label class="uk-form-label">里程</label>  
82 - <div class="uk-form-controls">  
83 - <input type="number" step="0.01" name="mileage" max=222  
84 - data-fv-lessthan-inclusive="false"  
85 - required>  
86 - </div>  
87 - </div>  
88 - <div class="uk-form-row">  
89 - <label class="uk-form-label">开始时间</label>  
90 - <div class="uk-form-controls">  
91 - <input type="time" name="startDate" required>  
92 - </div>  
93 - </div>  
94 - <div class="uk-form-row">  
95 - <label class="uk-form-label">结束时间</label>  
96 - <div class="uk-form-controls">  
97 - <input type="time" name="endDate" required>  
98 - </div>  
99 - </div>  
100 - </div>  
101 - </form>  
102 - </div>  
103 -  
104 - <div class="uk-width-1-3">  
105 - <form class="uk-form uk-form-horizontal">  
106 - <input type="hidden" name="type1" value="临加">  
107 - <input type="hidden" name="type2" value="3">  
108 - <input type="hidden" name="mileageType" value="empty">  
109 -  
110 - <div class="uk-panel uk-panel-box uk-panel-box-secondary">  
111 - <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>  
112 - <h3 class="uk-panel-title">出场</h3>  
113 - <div class="uk-form-row">  
114 - <label class="uk-form-label">起点站</label>  
115 - <div class="uk-form-controls">  
116 - <select name="startStation" required>  
117 - </select>  
118 - <input type="hidden" name="startStationName" disabled>  
119 - </div>  
120 - </div>  
121 - <div class="uk-form-row">  
122 - <label class="uk-form-label">终点站</label>  
123 - <div class="uk-form-controls">  
124 - <select name="endStation" required>  
125 - </select>  
126 - <input type="hidden" name="endStationName" disabled>  
127 - </div>  
128 - </div>  
129 - <div class="uk-form-row">  
130 - <label class="uk-form-label">里程</label>  
131 - <div class="uk-form-controls">  
132 - <input type="number" step="0.01" name="mileage" max=222  
133 - data-fv-lessthan-inclusive="false"  
134 - required>  
135 - </div>  
136 - </div>  
137 - <div class="uk-form-row">  
138 - <label class="uk-form-label">开始时间</label>  
139 - <div class="uk-form-controls">  
140 - <input type="time" name="startDate" required>  
141 - </div>  
142 - </div>  
143 - <div class="uk-form-row">  
144 - <label class="uk-form-label">结束时间</label>  
145 - <div class="uk-form-controls">  
146 - <input type="time" name="endDate" required>  
147 - </div>  
148 - </div>  
149 - </div>  
150 - </form>  
151 - </div>  
152 - </div>  
153 - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">  
154 - <span class="bind_gas_station_panel" style="position: absolute;left: 30px;text-decoration: underline;"></span>  
155 - <button type="button" class="uk-button uk-modal-close">取消</button>  
156 - <button type="submit" id="submitChildTaskBtn" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>  
157 - </div>  
158 - </div>  
159 -  
160 - <script id="schedule-addsch_oil-form-temp" type="text/html">  
161 -  
162 - </script>  
163 -  
164 - <script>  
165 - (function () {  
166 - var modal = '#schedule-addsch_oil-modal',  
167 - sch, stationRoutes, parks, oilStation;  
168 - var yyForm = $('form', modal)[0];  
169 - var jcForm = $('form', modal)[1];  
170 - var ccForm = $('form', modal)[2];  
171 - var oilId;  
172 - var lineInfo;  
173 -  
174 - var folder = '/real_control_v2/fragments/line_schedule/context_menu';  
175 - $(modal).on('init', function (e, data) {  
176 - e.stopPropagation();  
177 - sch = data.sch;  
178 - oilId = sch.xlBm + '_oil_station';  
179 - lineInfo = gb_data_basic.codeToLine[sch.xlBm];  
180 -  
181 - //站点路由  
182 - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {  
183 - return a.stationRouteCode - b.stationRouteCode;  
184 - }), 'directions');  
185 -  
186 - setDefaultVal();  
187 - //停车场  
188 - $.get('/basic/parks', function (rs) {  
189 - parks = rs;  
190 - var opts = '';  
191 - for (var code in parks) {  
192 - opts += '<option value="' + code + '">' + parks[code] + '</option>';  
193 - }  
194 - $('[name=endStation]', jcForm).html(opts);  
195 - $('[name=startStation]', ccForm).html(opts);  
196 - });  
197 -  
198 - //切换空驶起终点  
199 - $('[name=endStation]', jcForm).on('change', reCalcIn);  
200 - $('[name=startStation]', jcForm).on('change', reCalcIn);  
201 -  
202 - $('[name=endStation]', ccForm).on('change', reCalcOut);  
203 - $('[name=startStation]', ccForm).on('change', reCalcOut);  
204 - //修改开始时间  
205 - $('[name=startDate]', jcForm).on('change', reCalcIn);  
206 - $('[name=startDate]', ccForm).on('change', reCalcOut);  
207 -  
208 - //绑定的社会加油站  
209 - $.get('/oilStation/'+sch.xlBm, function (rs) {  
210 - var htmlStr;  
211 - oilStation = rs;  
212 - if(oilStation){  
213 - htmlStr = '<a><i class="uk-icon-product-hunt"></i> '+oilStation.stationName+'</a>';  
214 -  
215 - var opt = '<option value="'+oilId+'" class="oil_station_opt">'+oilStation.stationName+'</option>';  
216 - $('[name=endStation]', jcForm).prepend(opt).val(oilId).change();  
217 - $('[name=startStation]', ccForm).prepend(opt).val(oilId).change();  
218 - }  
219 - else  
220 - htmlStr = '<a>为'+sch.xlName+'绑定一个社会加油站</a>';  
221 -  
222 - $('.bind_gas_station_panel', modal).html(htmlStr);  
223 - $('.bind_gas_station_panel a', modal).on('click', function () {  
224 - open_modal(folder + '/sub_task//oil_station.html', {  
225 - sch: sch  
226 - }, {center: false, bgclose: false, modal: false});  
227 - });  
228 - });  
229 - });  
230 -  
231 - var dataArray = [];  
232 - var fs = $('form', modal).formValidation({  
233 - framework: 'uikit',  
234 - locale: 'zh_CN'  
235 - });  
236 - fs.on('success.form.fv', function(e) {  
237 - e.preventDefault();  
238 - if($(this).is(':hidden'))  
239 - return;  
240 - dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this)  
241 - , {remarks: '加油', 'schedule.id': sch.id}));  
242 - $(this).data('valid', true);  
243 -  
244 - if(allValidSuccess()){  
245 - var i = 0;  
246 - (function () {  
247 - var f = arguments.callee;  
248 - if(i >= dataArray.length){  
249 - UIkit.modal(modal).hide();  
250 - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});  
251 - return;  
252 - }  
253 - var data = dataArray[i];  
254 - //里程为0的不保存  
255 - if(data.mileage==0){  
256 - i++;  
257 - f();  
258 - }  
259 - else{  
260 - gb_common.$post('/childTask', data, function (rs) {  
261 - notify_succ('子任务添加成功');  
262 - gb_schedule_table.updateSchedule(rs.t);  
263 - i++;  
264 - f();  
265 - });  
266 - }  
267 - })();  
268 - }  
269 - });  
270 -  
271 - //校验不过  
272 - fs.on('err.field.fv', function () {  
273 - $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled');  
274 - });  
275 -  
276 - //submit  
277 - $('#submitChildTaskBtn', modal).on('click', function () {  
278 - //空驶的进场终点名称  
279 - if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)  
280 - $('[name=endStationName]', jcForm).val('');  
281 - else  
282 - $('[name=endStationName]', jcForm).val(oilStation.stationName);  
283 -  
284 - //空驶的出场起点名称  
285 - if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)  
286 - $('[name=startStationName]', ccForm).val('');  
287 - else  
288 - $('[name=startStationName]', ccForm).val(oilStation.stationName);  
289 -  
290 -  
291 - //提交表单  
292 - $(this).addClass('disabled').attr('disabled','disabled');  
293 - dataArray = [];  
294 - fs.data('valid', false);  
295 - fs.formValidation('validate');  
296 - //fs.submit();  
297 - });  
298 -  
299 - //获取表单disabled 项的值  
300 - function getDisabledVal(f) {  
301 - var rs = {};  
302 - $('input,select', f).each(function () {  
303 - if($(this).attr('disabled')){  
304 - rs[$(this).attr('name')]=$(this).val();  
305 - }  
306 - });  
307 - return rs;  
308 - }  
309 -  
310 - function allValidSuccess() {  
311 - var flag = true;  
312 - $('form:visible', modal).each(function (i, f) {  
313 - if(!$(f).data('valid')){  
314 - flag = false;  
315 - return false;  
316 - }  
317 - });  
318 - return flag;  
319 - }  
320 -  
321 - function setDefaultVal() {  
322 - //营运班次  
323 - $('[name=startStation]', yyForm).val(sch.qdzCode);  
324 - $('[name=startStationName]', yyForm).val(sch.qdzName);  
325 - $('[name=endStation]', yyForm).val(sch.zdzCode);  
326 - $('[name=endStationName]', yyForm).val(sch.zdzName);  
327 - $('[name=mileage]', yyForm).val(sch.jhlc);  
328 - $('[name=startDate]', yyForm).val(sch.fcsjActual==null?sch.dfsj:sch.fcsjActual);  
329 - $('[name=endDate]', yyForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);  
330 -  
331 - //设置进场默认值  
332 - $('[name=startStation]', jcForm).html(createStationOpts(stationRoutes[sch.xlDir]));  
333 - $('[name=startDate]', jcForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);  
334 - $('[name=startStation]', jcForm).val(sch.zdzCode);  
335 -  
336 - //设置出场默认值  
337 - $('[name=endStation]', ccForm).html(createStationOpts(stationRoutes[sch.xlDir]));  
338 - $('[name=endStation]', ccForm).val(sch.zdzCode);  
339 - }  
340 -  
341 - function createStationOpts(list) {  
342 - var opts = '';  
343 - $.each(list, function () {  
344 - opts += '<option value="'+this.station.stationCod+'">'+this.stationName+'</option>';  
345 - });  
346 - return opts;  
347 - }  
348 -  
349 - function reCalcIn() {  
350 - if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)  
351 - return;  
352 -  
353 - var data;  
354 - var qdz = $('[name=startStation]', jcForm).find("option:selected").text();  
355 - if(qdz == lineInfo.startStationName){  
356 - //起点进场  
357 - data = {  
358 - mileage: oilStation.upInMile,  
359 - time: oilStation.upInTime  
360 - }  
361 - }  
362 - else if(qdz == lineInfo.endStationName){  
363 - //终点进场  
364 - data = {  
365 - mileage: oilStation.downInMile,  
366 - time: oilStation.downInTime  
367 - }  
368 - }  
369 - if(!data)  
370 - return;  
371 -  
372 - $('[name=mileage]', jcForm).val(data.mileage);  
373 - var st = $('[name=startDate]', jcForm).val();  
374 - if(!st)  
375 - return;  
376 - var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');  
377 - $('[name=endDate]', jcForm).val(ets);  
378 -  
379 - //出场时间 + 1 分钟  
380 - $('[name=startDate]', ccForm).val(moment(ets, 'HH:mm').add(1, 'minute').format('HH:mm'));  
381 - }  
382 -  
383 - function reCalcOut() {  
384 - if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)  
385 - return;  
386 -  
387 - var data;  
388 - var zdz = $('[name=endStation]', ccForm).find("option:selected").text();  
389 - if(zdz == lineInfo.startStationName){  
390 - //出场到起点  
391 - data = {  
392 - mileage: oilStation.upOutMile,  
393 - time: oilStation.upOutTime  
394 - }  
395 - }  
396 - else if(zdz == lineInfo.endStationName){  
397 - //出场到终点  
398 - data = {  
399 - mileage: oilStation.downOutMile,  
400 - time: oilStation.downOutTime  
401 - }  
402 - }  
403 - if(!data)  
404 - return;  
405 -  
406 - $('[name=mileage]', ccForm).val(data.mileage);  
407 - var st = $('[name=startDate]', ccForm).val();  
408 - if(!st)  
409 - return;  
410 - var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');  
411 - $('[name=endDate]', ccForm).val(ets);  
412 - }  
413 - })();  
414 - </script>  
415 -</div> 1 +<div class="uk-modal ct-form-modal" id="schedule-addsch_oil-modal">
  2 + <div class="uk-modal-dialog" style="width: 1201px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>加油</h2></div>
  6 +
  7 + <div class="uk-grid">
  8 + <div class="uk-width-1-3">
  9 + <form class="uk-form uk-form-horizontal ">
  10 + <input type="hidden" name="type1" value="正常">
  11 + <input type="hidden" name="type2" value="1">
  12 + <input type="hidden" name="mileageType" value="service">
  13 +
  14 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  15 + <div class="uk-panel-badge uk-badge ">营运</div>
  16 + <h3 class="uk-panel-title">线路上站点间</h3>
  17 + <div class="uk-form-row">
  18 + <label class="uk-form-label">起点站</label>
  19 + <div class="uk-form-controls">
  20 + <input type="hidden" name="startStation">
  21 + <input type="text" name="startStationName" disabled>
  22 + </div>
  23 + </div>
  24 + <div class="uk-form-row">
  25 + <label class="uk-form-label">终点站</label>
  26 + <div class="uk-form-controls">
  27 + <input type="hidden" name="endStation">
  28 + <input type="text" name="endStationName" disabled>
  29 + </div>
  30 + </div>
  31 + <div class="uk-form-row">
  32 + <label class="uk-form-label">里程</label>
  33 + <div class="uk-form-controls">
  34 + <input type="number" step="0.01" name="mileage" max=222
  35 + data-fv-lessthan-inclusive="false"
  36 + disabled>
  37 + </div>
  38 + </div>
  39 + <div class="uk-form-row">
  40 + <label class="uk-form-label">开始时间</label>
  41 + <div class="uk-form-controls">
  42 + <input type="time" name="startDate" required>
  43 + </div>
  44 + </div>
  45 + <div class="uk-form-row">
  46 + <label class="uk-form-label">结束时间</label>
  47 + <div class="uk-form-controls">
  48 + <input type="time" name="endDate" required>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + </form>
  53 + </div>
  54 +
  55 + <div class="uk-width-1-3">
  56 + <form class="uk-form uk-form-horizontal">
  57 + <input type="hidden" name="type1" value="临加">
  58 + <input type="hidden" name="type2" value="2">
  59 + <input type="hidden" name="mileageType" value="empty">
  60 +
  61 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  62 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  63 + <h3 class="uk-panel-title">进场</h3>
  64 + <div class="uk-form-row">
  65 + <label class="uk-form-label">起点站</label>
  66 + <div class="uk-form-controls">
  67 + <select name="startStation" required>
  68 + </select>
  69 + <input type="hidden" name="startStationName" disabled>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">终点站</label>
  74 + <div class="uk-form-controls">
  75 + <select name="endStation" required>
  76 + </select>
  77 + <input type="hidden" name="endStationName" disabled>
  78 + </div>
  79 + </div>
  80 + <div class="uk-form-row">
  81 + <label class="uk-form-label">里程</label>
  82 + <div class="uk-form-controls">
  83 + <input type="number" step="0.01" name="mileage" max=222
  84 + data-fv-lessthan-inclusive="false"
  85 + required>
  86 + </div>
  87 + </div>
  88 + <div class="uk-form-row">
  89 + <label class="uk-form-label">开始时间</label>
  90 + <div class="uk-form-controls">
  91 + <input type="time" name="startDate" required>
  92 + </div>
  93 + </div>
  94 + <div class="uk-form-row">
  95 + <label class="uk-form-label">结束时间</label>
  96 + <div class="uk-form-controls">
  97 + <input type="time" name="endDate" required>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </form>
  102 + </div>
  103 +
  104 + <div class="uk-width-1-3">
  105 + <form class="uk-form uk-form-horizontal">
  106 + <input type="hidden" name="type1" value="临加">
  107 + <input type="hidden" name="type2" value="3">
  108 + <input type="hidden" name="mileageType" value="empty">
  109 +
  110 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  111 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  112 + <h3 class="uk-panel-title">出场</h3>
  113 + <div class="uk-form-row">
  114 + <label class="uk-form-label">起点站</label>
  115 + <div class="uk-form-controls">
  116 + <select name="startStation" required>
  117 + </select>
  118 + <input type="hidden" name="startStationName" disabled>
  119 + </div>
  120 + </div>
  121 + <div class="uk-form-row">
  122 + <label class="uk-form-label">终点站</label>
  123 + <div class="uk-form-controls">
  124 + <select name="endStation" required>
  125 + </select>
  126 + <input type="hidden" name="endStationName" disabled>
  127 + </div>
  128 + </div>
  129 + <div class="uk-form-row">
  130 + <label class="uk-form-label">里程</label>
  131 + <div class="uk-form-controls">
  132 + <input type="number" step="0.01" name="mileage" max=222
  133 + data-fv-lessthan-inclusive="false"
  134 + required>
  135 + </div>
  136 + </div>
  137 + <div class="uk-form-row">
  138 + <label class="uk-form-label">开始时间</label>
  139 + <div class="uk-form-controls">
  140 + <input type="time" name="startDate" required>
  141 + </div>
  142 + </div>
  143 + <div class="uk-form-row">
  144 + <label class="uk-form-label">结束时间</label>
  145 + <div class="uk-form-controls">
  146 + <input type="time" name="endDate" required>
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </form>
  151 + </div>
  152 + </div>
  153 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  154 + <span class="bind_gas_station_panel" style="position: absolute;left: 30px;text-decoration: underline;"></span>
  155 + <button type="button" class="uk-button uk-modal-close">取消</button>
  156 + <button type="submit" id="submitChildTaskBtn" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  157 + </div>
  158 + </div>
  159 +
  160 + <script id="schedule-addsch_oil-form-temp" type="text/html">
  161 +
  162 + </script>
  163 +
  164 + <script>
  165 + (function () {
  166 + var modal = '#schedule-addsch_oil-modal',
  167 + sch, stationRoutes, parks, oilStation;
  168 + var yyForm = $('form', modal)[0];
  169 + var jcForm = $('form', modal)[1];
  170 + var ccForm = $('form', modal)[2];
  171 + var oilId;
  172 + var lineInfo;
  173 +
  174 + var folder = '/real_control_v2/fragments/line_schedule/context_menu';
  175 + $(modal).on('init', function (e, data) {
  176 + e.stopPropagation();
  177 + sch = data.sch;
  178 + oilId = sch.xlBm + '_oil_station';
  179 + lineInfo = gb_data_basic.codeToLine[sch.xlBm];
  180 +
  181 + //站点路由
  182 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  183 + return a.stationRouteCode - b.stationRouteCode;
  184 + }), 'directions');
  185 +
  186 + setDefaultVal();
  187 + //停车场
  188 + $.get('/basic/parks', function (rs) {
  189 + parks = rs;
  190 + var opts = '';
  191 + for (var code in parks) {
  192 + opts += '<option value="' + code + '">' + parks[code] + '</option>';
  193 + }
  194 + $('[name=endStation]', jcForm).html(opts);
  195 + $('[name=startStation]', ccForm).html(opts);
  196 + });
  197 +
  198 + //切换空驶起终点
  199 + $('[name=endStation]', jcForm).on('change', reCalcIn);
  200 + $('[name=startStation]', jcForm).on('change', reCalcIn);
  201 +
  202 + $('[name=endStation]', ccForm).on('change', reCalcOut);
  203 + $('[name=startStation]', ccForm).on('change', reCalcOut);
  204 + //修改开始时间
  205 + $('[name=startDate]', jcForm).on('change', reCalcIn);
  206 + $('[name=startDate]', ccForm).on('change', reCalcOut);
  207 +
  208 + //绑定的社会加油站
  209 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  210 + var htmlStr;
  211 + oilStation = rs;
  212 + if(oilStation){
  213 + htmlStr = '<a><i class="uk-icon-product-hunt"></i> '+oilStation.stationName+'</a>';
  214 +
  215 + var opt = '<option value="'+oilId+'" class="oil_station_opt">'+oilStation.stationName+'</option>';
  216 + $('[name=endStation]', jcForm).prepend(opt).val(oilId).change();
  217 + $('[name=startStation]', ccForm).prepend(opt).val(oilId).change();
  218 + }
  219 + else
  220 + htmlStr = '<a>为'+sch.xlName+'绑定一个社会加油站</a>';
  221 +
  222 + $('.bind_gas_station_panel', modal).html(htmlStr);
  223 + $('.bind_gas_station_panel a', modal).on('click', function () {
  224 + open_modal(folder + '/sub_task//oil_station.html', {
  225 + sch: sch
  226 + }, {center: false, bgclose: false, modal: false});
  227 + });
  228 + });
  229 + });
  230 +
  231 + var dataArray = [];
  232 + var fs = $('form', modal).formValidation({
  233 + framework: 'uikit',
  234 + locale: 'zh_CN'
  235 + });
  236 + fs.on('success.form.fv', function(e) {
  237 + e.preventDefault();
  238 + if($(this).is(':hidden'))
  239 + return;
  240 + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this)
  241 + , {remarks: '加油', 'schedule.id': sch.id}));
  242 + $(this).data('valid', true);
  243 +
  244 + if(allValidSuccess()){
  245 + var i = 0;
  246 + (function () {
  247 + var f = arguments.callee;
  248 + if(i >= dataArray.length){
  249 + UIkit.modal(modal).hide();
  250 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  251 + return;
  252 + }
  253 + var data = dataArray[i];
  254 + //里程为0的不保存
  255 + if(data.mileage==0){
  256 + i++;
  257 + f();
  258 + }
  259 + else{
  260 + gb_common.$post('/childTask', data, function (rs) {
  261 + notify_succ('子任务添加成功');
  262 + gb_schedule_table.updateSchedule(rs.t);
  263 + i++;
  264 + f();
  265 + });
  266 + }
  267 + })();
  268 + }
  269 + });
  270 +
  271 + //校验不过
  272 + fs.on('err.field.fv', function () {
  273 + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled');
  274 + });
  275 +
  276 + //submit
  277 + $('#submitChildTaskBtn', modal).on('click', function () {
  278 + //空驶的进场终点名称
  279 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  280 + $('[name=endStationName]', jcForm).val('');
  281 + else
  282 + $('[name=endStationName]', jcForm).val(oilStation.stationName);
  283 +
  284 + //空驶的出场起点名称
  285 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  286 + $('[name=startStationName]', ccForm).val('');
  287 + else
  288 + $('[name=startStationName]', ccForm).val(oilStation.stationName);
  289 +
  290 +
  291 + //提交表单
  292 + $(this).addClass('disabled').attr('disabled','disabled');
  293 + dataArray = [];
  294 + fs.data('valid', false);
  295 + fs.formValidation('validate');
  296 + //fs.submit();
  297 + });
  298 +
  299 + //获取表单disabled 项的值
  300 + function getDisabledVal(f) {
  301 + var rs = {};
  302 + $('input,select', f).each(function () {
  303 + if($(this).attr('disabled')){
  304 + rs[$(this).attr('name')]=$(this).val();
  305 + }
  306 + });
  307 + return rs;
  308 + }
  309 +
  310 + function allValidSuccess() {
  311 + var flag = true;
  312 + $('form:visible', modal).each(function (i, f) {
  313 + if(!$(f).data('valid')){
  314 + flag = false;
  315 + return false;
  316 + }
  317 + });
  318 + return flag;
  319 + }
  320 +
  321 + function setDefaultVal() {
  322 + //营运班次
  323 + $('[name=startStation]', yyForm).val(sch.qdzCode);
  324 + $('[name=startStationName]', yyForm).val(sch.qdzName);
  325 + $('[name=endStation]', yyForm).val(sch.zdzCode);
  326 + $('[name=endStationName]', yyForm).val(sch.zdzName);
  327 + $('[name=mileage]', yyForm).val(sch.jhlc);
  328 + $('[name=startDate]', yyForm).val(sch.fcsjActual==null?sch.dfsj:sch.fcsjActual);
  329 + $('[name=endDate]', yyForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  330 +
  331 + //设置进场默认值
  332 + $('[name=startStation]', jcForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  333 + $('[name=startDate]', jcForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  334 + $('[name=startStation]', jcForm).val(sch.zdzCode);
  335 +
  336 + //设置出场默认值
  337 + $('[name=endStation]', ccForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  338 + $('[name=endStation]', ccForm).val(sch.zdzCode);
  339 + }
  340 +
  341 + function createStationOpts(list) {
  342 + var opts = '';
  343 + $.each(list, function () {
  344 + opts += '<option value="'+this.station.stationCod+'">'+this.stationName+'</option>';
  345 + });
  346 + return opts;
  347 + }
  348 +
  349 + function reCalcIn() {
  350 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  351 + return;
  352 +
  353 + var data;
  354 + var qdz = $('[name=startStation]', jcForm).find("option:selected").text();
  355 + if(qdz == lineInfo.startStationName){
  356 + //起点进场
  357 + data = {
  358 + mileage: oilStation.upInMile,
  359 + time: oilStation.upInTime
  360 + }
  361 + }
  362 + else if(qdz == lineInfo.endStationName){
  363 + //终点进场
  364 + data = {
  365 + mileage: oilStation.downInMile,
  366 + time: oilStation.downInTime
  367 + }
  368 + }
  369 + if(!data)
  370 + return;
  371 +
  372 + $('[name=mileage]', jcForm).val(data.mileage);
  373 + var st = $('[name=startDate]', jcForm).val();
  374 + if(!st)
  375 + return;
  376 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  377 + $('[name=endDate]', jcForm).val(ets);
  378 +
  379 + //出场时间 + 1 分钟
  380 + $('[name=startDate]', ccForm).val(moment(ets, 'HH:mm').add(1, 'minute').format('HH:mm'));
  381 + }
  382 +
  383 + function reCalcOut() {
  384 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  385 + return;
  386 +
  387 + var data;
  388 + var zdz = $('[name=endStation]', ccForm).find("option:selected").text();
  389 + if(zdz == lineInfo.startStationName){
  390 + //出场到起点
  391 + data = {
  392 + mileage: oilStation.upOutMile,
  393 + time: oilStation.upOutTime
  394 + }
  395 + }
  396 + else if(zdz == lineInfo.endStationName){
  397 + //出场到终点
  398 + data = {
  399 + mileage: oilStation.downOutMile,
  400 + time: oilStation.downOutTime
  401 + }
  402 + }
  403 + if(!data)
  404 + return;
  405 +
  406 + $('[name=mileage]', ccForm).val(data.mileage);
  407 + var st = $('[name=startDate]', ccForm).val();
  408 + if(!st)
  409 + return;
  410 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  411 + $('[name=endDate]', ccForm).val(ets);
  412 + }
  413 + })();
  414 + </script>
  415 +</div>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/oil_station.html
1 -<div class="uk-modal ct-form-modal" id="oil_station-modal">  
2 - <div class="uk-modal-dialog" style="width: 450px;">  
3 - <a href="" class="uk-modal-close uk-close"></a>  
4 - <div class="uk-modal-header">  
5 - <h2>社会加油站</h2></div>  
6 -  
7 - <form class="uk-form uk-form-horizontal " style="margin-bottom: 0 !important;">  
8 - <div class="uk-form-row">  
9 - <label class="uk-form-label">线路</label>  
10 - <div class="uk-form-icon">  
11 - <input type="hidden" name="lineCode">  
12 - <input type="text" name="qdzName" disabled>  
13 - </div>  
14 - </div>  
15 - <div class="uk-form-row">  
16 - <label class="uk-form-label">加油站名称</label>  
17 - <div class="uk-form-icon">  
18 - <input type="text" name="stationName" value="社会加油站" required>  
19 - </div>  
20 - </div>  
21 - <div class="uk-form-row">  
22 - <label class="uk-form-label">起点进场里程</label>  
23 - <div class="uk-form-icon">  
24 - <i class="uk-icon-mile"></i>  
25 - <input type="number" name="upInMile" step="0.01" required>  
26 - </div>  
27 - </div>  
28 - <div class="uk-form-row">  
29 - <label class="uk-form-label">终点进场里程</label>  
30 - <div class="uk-form-icon">  
31 - <i class="uk-icon-mile"></i>  
32 - <input type="number" name="downInMile" step="0.01" required>  
33 - </div>  
34 - </div>  
35 - <div class="uk-form-row">  
36 - <label class="uk-form-label">起点进场时间</label>  
37 - <div class="uk-form-icon">  
38 - <i class="uk-icon-minute"></i>  
39 - <input type="text" name="upInTime" required>  
40 - </div>  
41 - </div>  
42 - <div class="uk-form-row">  
43 - <label class="uk-form-label">终点进场时间</label>  
44 - <div class="uk-form-icon">  
45 - <i class="uk-icon-minute"></i>  
46 - <input type="text" name="downInTime" required>  
47 - </div>  
48 - </div>  
49 -  
50 - <hr>  
51 - <div class="uk-form-row">  
52 - <label class="uk-form-label">出场到起点里程</label>  
53 - <div class="uk-form-icon">  
54 - <i class="uk-icon-mile"></i>  
55 - <input type="number" name="upOutMile" step="0.01" required>  
56 - </div>  
57 - </div>  
58 - <div class="uk-form-row">  
59 - <label class="uk-form-label">出场到终点里程</label>  
60 - <div class="uk-form-icon">  
61 - <i class="uk-icon-mile"></i>  
62 - <input type="number" name="downOutMile" step="0.01" required>  
63 - </div>  
64 - </div>  
65 - <div class="uk-form-row">  
66 - <label class="uk-form-label">出场到起点时间</label>  
67 - <div class="uk-form-icon">  
68 - <i class="uk-icon-minute"></i>  
69 - <input type="text" name="upOutTime" required>  
70 - </div>  
71 - </div>  
72 - <div class="uk-form-row">  
73 - <label class="uk-form-label">出场到终点时间</label>  
74 - <div class="uk-form-icon">  
75 - <i class="uk-icon-minute"></i>  
76 - <input type="text" name="downOutTime" required>  
77 - </div>  
78 - </div>  
79 - <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">  
80 - <button type="button" class="uk-button uk-modal-close">取消</button>  
81 - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>  
82 - </div>  
83 - </form>  
84 - </div>  
85 -  
86 - <script id="" type="text/html">  
87 -  
88 - </script>  
89 -  
90 - <script>  
91 - (function () {  
92 - var modal = '#oil_station-modal',  
93 - sch, oilStation;  
94 -  
95 - var cognates = {  
96 - 'upInMile': 'upOutMile',  
97 - 'downInMile': 'downOutMile',  
98 - 'upInTime': 'upOutTime',  
99 - 'downInTime': 'downOutTime'  
100 - };  
101 - $(modal).on('init', function (e, data) {  
102 - e.stopPropagation();  
103 - sch = data.sch;  
104 -  
105 - $.get('/oilStation/'+sch.xlBm, function (rs) {  
106 - oilStation = rs;  
107 - setDefaultVal(oilStation);  
108 - });  
109 -  
110 - $('form [name=qdzName]', modal).val(sch.xlName);  
111 - $('form [name=lineCode]', modal).val(sch.xlBm);  
112 -  
113 - //submit  
114 - var f = $('form', modal).formValidation(gb_form_validation_opts);  
115 - f.on('success.form.fv', function(e) {  
116 - e.preventDefault();  
117 - var data = $(this).serializeJSON();  
118 -  
119 - gb_common.$post('/oilStation', data, function (rs) {  
120 - notify_succ('添加成功!');  
121 - UIkit.modal(modal).hide();  
122 - $('#schedule-addsch_oil-modal').trigger('init', {sch: sch});  
123 - });  
124 - });  
125 -  
126 - $('form input', modal).on('input', function () {  
127 - var name = $(this).attr('name');  
128 - if(cognates[name]){  
129 - $('form [name='+cognates[name]+']', modal).val($(this).val());  
130 - }  
131 - });  
132 - });  
133 -  
134 - function setDefaultVal(obj) {  
135 - if(!obj)  
136 - return;  
137 - $('form input', modal).each(function () {  
138 - var name = $(this).attr('name');  
139 - if(obj[name])  
140 - $(this).val(obj[name]);  
141 - });  
142 - }  
143 - })();  
144 - </script>  
145 -</div> 1 +<div class="uk-modal ct-form-modal" id="oil_station-modal">
  2 + <div class="uk-modal-dialog" style="width: 450px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>社会加油站</h2></div>
  6 +
  7 + <form class="uk-form uk-form-horizontal " style="margin-bottom: 0 !important;">
  8 + <div class="uk-form-row">
  9 + <label class="uk-form-label">线路</label>
  10 + <div class="uk-form-icon">
  11 + <input type="hidden" name="lineCode">
  12 + <input type="text" name="qdzName" disabled>
  13 + </div>
  14 + </div>
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">加油站名称</label>
  17 + <div class="uk-form-icon">
  18 + <input type="text" name="stationName" value="社会加油站" required>
  19 + </div>
  20 + </div>
  21 + <div class="uk-form-row">
  22 + <label class="uk-form-label">起点进场里程</label>
  23 + <div class="uk-form-icon">
  24 + <i class="uk-icon-mile"></i>
  25 + <input type="number" name="upInMile" step="0.01" required>
  26 + </div>
  27 + </div>
  28 + <div class="uk-form-row">
  29 + <label class="uk-form-label">终点进场里程</label>
  30 + <div class="uk-form-icon">
  31 + <i class="uk-icon-mile"></i>
  32 + <input type="number" name="downInMile" step="0.01" required>
  33 + </div>
  34 + </div>
  35 + <div class="uk-form-row">
  36 + <label class="uk-form-label">起点进场时间</label>
  37 + <div class="uk-form-icon">
  38 + <i class="uk-icon-minute"></i>
  39 + <input type="text" name="upInTime" required>
  40 + </div>
  41 + </div>
  42 + <div class="uk-form-row">
  43 + <label class="uk-form-label">终点进场时间</label>
  44 + <div class="uk-form-icon">
  45 + <i class="uk-icon-minute"></i>
  46 + <input type="text" name="downInTime" required>
  47 + </div>
  48 + </div>
  49 +
  50 + <hr>
  51 + <div class="uk-form-row">
  52 + <label class="uk-form-label">出场到起点里程</label>
  53 + <div class="uk-form-icon">
  54 + <i class="uk-icon-mile"></i>
  55 + <input type="number" name="upOutMile" step="0.01" required>
  56 + </div>
  57 + </div>
  58 + <div class="uk-form-row">
  59 + <label class="uk-form-label">出场到终点里程</label>
  60 + <div class="uk-form-icon">
  61 + <i class="uk-icon-mile"></i>
  62 + <input type="number" name="downOutMile" step="0.01" required>
  63 + </div>
  64 + </div>
  65 + <div class="uk-form-row">
  66 + <label class="uk-form-label">出场到起点时间</label>
  67 + <div class="uk-form-icon">
  68 + <i class="uk-icon-minute"></i>
  69 + <input type="text" name="upOutTime" required>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">出场到终点时间</label>
  74 + <div class="uk-form-icon">
  75 + <i class="uk-icon-minute"></i>
  76 + <input type="text" name="downOutTime" required>
  77 + </div>
  78 + </div>
  79 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  80 + <button type="button" class="uk-button uk-modal-close">取消</button>
  81 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  82 + </div>
  83 + </form>
  84 + </div>
  85 +
  86 + <script id="" type="text/html">
  87 +
  88 + </script>
  89 +
  90 + <script>
  91 + (function () {
  92 + var modal = '#oil_station-modal',
  93 + sch, oilStation;
  94 +
  95 + var cognates = {
  96 + 'upInMile': 'upOutMile',
  97 + 'downInMile': 'downOutMile',
  98 + 'upInTime': 'upOutTime',
  99 + 'downInTime': 'downOutTime'
  100 + };
  101 + $(modal).on('init', function (e, data) {
  102 + e.stopPropagation();
  103 + sch = data.sch;
  104 +
  105 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  106 + oilStation = rs;
  107 + setDefaultVal(oilStation);
  108 + });
  109 +
  110 + $('form [name=qdzName]', modal).val(sch.xlName);
  111 + $('form [name=lineCode]', modal).val(sch.xlBm);
  112 +
  113 + //submit
  114 + var f = $('form', modal).formValidation(gb_form_validation_opts);
  115 + f.on('success.form.fv', function(e) {
  116 + e.preventDefault();
  117 + var data = $(this).serializeJSON();
  118 +
  119 + gb_common.$post('/oilStation', data, function (rs) {
  120 + notify_succ('添加成功!');
  121 + UIkit.modal(modal).hide();
  122 + $('#schedule-addsch_oil-modal').trigger('init', {sch: sch});
  123 + });
  124 + });
  125 +
  126 + $('form input', modal).on('input', function () {
  127 + var name = $(this).attr('name');
  128 + if(cognates[name]){
  129 + $('form [name='+cognates[name]+']', modal).val($(this).val());
  130 + }
  131 + });
  132 + });
  133 +
  134 + function setDefaultVal(obj) {
  135 + if(!obj)
  136 + return;
  137 + $('form input', modal).each(function () {
  138 + var name = $(this).attr('name');
  139 + if(obj[name])
  140 + $(this).val(obj[name]);
  141 + });
  142 + }
  143 + })();
  144 + </script>
  145 +</div>