Commit 87be28a3b52f568136a106a2be5f0fe3e7e1390d

Authored by 潘钊
2 parents d61af903 57889ddf

Merge branch 'minhang' into qingpu

# Conflicts:
#	src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
Showing 24 changed files with 1051 additions and 872 deletions
src/main/java/com/bsth/controller/oil/YlbController.java
@@ -63,7 +63,7 @@ public class YlbController extends BaseController<Ylb, Integer>{ @@ -63,7 +63,7 @@ public class YlbController extends BaseController<Ylb, Integer>{
63 } 63 }
64 64
65 65
66 - @RequestMapping(value = "/saveYlbList",method = RequestMethod.GET) 66 + @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST)
67 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){ 67 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
68 Map<String, Object> list=new HashMap<String, Object>(); 68 Map<String, Object> list=new HashMap<String, Object>();
69 try { 69 try {
@@ -79,7 +79,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -79,7 +79,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
79 * @param map 79 * @param map
80 * @return 80 * @return
81 */ 81 */
82 - @RequestMapping(value = "/sort",method = RequestMethod.GET) 82 + @RequestMapping(value = "/sort",method = RequestMethod.POST)
83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){ 83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){
84 Map<String, Object> list=new HashMap<String, Object>(); 84 Map<String, Object> list=new HashMap<String, Object>();
85 try { 85 try {
@@ -201,6 +201,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -201,6 +201,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
201 return yblService.oilListMonth(line, date); 201 return yblService.oilListMonth(line, date);
202 } 202 }
203 203
  204 + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
  205 + public String checkJsy(@RequestParam Map<String, Object> map){
  206 + String list=yblService.checkJsy(map);
  207 + return list;
  208 + }
  209 +
204 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) 210 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
205 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ 211 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
206 Map<String, Object> list=yblService.sumYlb(map); 212 Map<String, Object> list=yblService.sumYlb(map);
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
@@ -54,9 +54,9 @@ public class GpsRealData implements CommandLineRunner { @@ -54,9 +54,9 @@ public class GpsRealData implements CommandLineRunner {
54 54
55 @Override 55 @Override
56 public void run(String... arg0) throws Exception { 56 public void run(String... arg0) throws Exception {
57 - logger.info("gpsDataLoader,20,5"); 57 + logger.info("gpsDataLoader,20,3");
58 //定时从网关获取GPS数据 58 //定时从网关获取GPS数据
59 - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); 59 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS);
60 //定时扫描掉离线 60 //定时扫描掉离线
61 //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); 61 //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);
62 } 62 }
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
@@ -148,7 +148,7 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -148,7 +148,7 @@ public class InOutStationSignalHandle extends SignalHandle{
148 } 148 }
149 //出站既出场 149 //出站既出场
150 outStationAndOutPark(sch); 150 outStationAndOutPark(sch);
151 - logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual()); 151 + logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
152 } 152 }
153 else if(sch.getBcType().equals("out")){ 153 else if(sch.getBcType().equals("out")){
154 ScheduleRealInfo next = dayOfSchedule.nextSame(sch); 154 ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
@@ -163,10 +163,16 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -163,10 +163,16 @@ public class InOutStationSignalHandle extends SignalHandle{
163 163
164 private void outStationAndOutPark(ScheduleRealInfo sch){ 164 private void outStationAndOutPark(ScheduleRealInfo sch){
165 LineConfig config = lineConfigData.get(sch.getXlBm()); 165 LineConfig config = lineConfigData.get(sch.getXlBm());
  166 + //限定出站既出场的停车场
  167 + String park = config.getTwinsPark();
  168 + boolean limitPark = StringUtils.isNotEmpty(park);
  169 +
166 if (config != null && config.getOutConfig() == 2) { 170 if (config != null && config.getOutConfig() == 2) {
167 //出站既出场 171 //出站既出场
168 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); 172 ScheduleRealInfo schPrev = dayOfSchedule.prev(sch);
169 - if (schPrev != null && schPrev.getBcType().equals("out")) { 173 + if (schPrev != null && schPrev.getBcType().equals("out")
  174 + && (!limitPark || park.equals(schPrev.getQdzCode()))) {
  175 +
170 schPrev.setFcsjActualAll(sch.getFcsjActualTime()); 176 schPrev.setFcsjActualAll(sch.getFcsjActualTime());
171 schPrev.setZdsjActualAll(sch.getFcsjActualTime()); 177 schPrev.setZdsjActualAll(sch.getFcsjActualTime());
172 178
@@ -217,14 +223,6 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -217,14 +223,6 @@ public class InOutStationSignalHandle extends SignalHandle{
217 sendUtils.sendZdsj(sch, next, doneSum); 223 sendUtils.sendZdsj(sch, next, doneSum);
218 //持久化 224 //持久化
219 dayOfSchedule.save(sch); 225 dayOfSchedule.save(sch);
220 - if(next != null){  
221 - //下发调度指令  
222 - directiveService.send60Dispatch(next, doneSum, "到站@系统");  
223 - }  
224 - else if(sch.getBcType().equals("in")){  
225 - //终班进场,切换成非营运状态  
226 - directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统");  
227 - }  
228 226
229 //准备执行下一个班次 227 //准备执行下一个班次
230 if (next != null) { 228 if (next != null) {
@@ -234,6 +232,13 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -234,6 +232,13 @@ public class InOutStationSignalHandle extends SignalHandle{
234 inStationAndInPark(sch, next); 232 inStationAndInPark(sch, next);
235 //将gps转换为下一个班次走向的站内信号 233 //将gps转换为下一个班次走向的站内信号
236 transformUpdown(gps, next); 234 transformUpdown(gps, next);
  235 +
  236 + //下发调度指令
  237 + directiveService.send60Dispatch(next, doneSum, "到站@系统");
  238 + }
  239 + else if(sch.getBcType().equals("in")){
  240 + //终班进场,切换成非营运状态
  241 + directiveService.send60Operation(sch.getClZbh(), 1, Integer.parseInt(sch.getXlDir()), null, "进场@系统");
237 } 242 }
238 } 243 }
239 else { 244 else {
@@ -297,8 +302,14 @@ public class InOutStationSignalHandle extends SignalHandle{ @@ -297,8 +302,14 @@ public class InOutStationSignalHandle extends SignalHandle{
297 */ 302 */
298 private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next){ 303 private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next){
299 LineConfig config = lineConfigData.get(sch.getXlBm()); 304 LineConfig config = lineConfigData.get(sch.getXlBm());
300 - if (next.getBcType().equals("in") &&  
301 - config != null && config.getOutConfig() == 2) { 305 + //限定出站既出场的停车场
  306 + String park = config.getTwinsPark();
  307 + boolean limitPark = StringUtils.isNotEmpty(park);
  308 +
  309 +
  310 + if (next.getBcType().equals("in") && config.getOutConfig() == 2
  311 + && (!limitPark || park.equals(next.getZdzCode()))) {
  312 +
302 next.setFcsjActualAll(sch.getZdsjActualTime()); 313 next.setFcsjActualAll(sch.getZdsjActualTime());
303 next.setZdsjActualAll(sch.getZdsjActualTime()); 314 next.setZdsjActualAll(sch.getZdsjActualTime());
304 315
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
@@ -13,8 +13,8 @@ import org.springframework.stereotype.Component; @@ -13,8 +13,8 @@ import org.springframework.stereotype.Component;
13 @Component 13 @Component
14 public class OfflineSignalHandle extends SignalHandle{ 14 public class OfflineSignalHandle extends SignalHandle{
15 15
16 - //断开2分钟,标记为重连信号  
17 - private final static int OFFLINE_TIME = 1000 * 60 * 2; 16 + //断开4分钟,标记为重连信号
  17 + private final static int OFFLINE_TIME = 1000 * 60 * 4;
18 18
19 //断开70分钟,之前的信号不再有参考价值 19 //断开70分钟,之前的信号不再有参考价值
20 private final static int CLEAR_TIME = 1000 * 60 * 70; 20 private final static int CLEAR_TIME = 1000 * 60 * 70;
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
@@ -148,22 +148,28 @@ public class GpsDataRecovery implements ApplicationContextAware { @@ -148,22 +148,28 @@ public class GpsDataRecovery implements ApplicationContextAware {
148 try { 148 try {
149 //循环gps恢复数据 149 //循环gps恢复数据
150 CircleQueue<GpsEntity> prevs; 150 CircleQueue<GpsEntity> prevs;
151 - 151 + boolean task;
152 for (GpsEntity gps : list) { 152 for (GpsEntity gps : list) {
153 153
  154 + //是否有任务
  155 +
154 prevs = GeoCacheData.getGps(gps.getNbbm()); 156 prevs = GeoCacheData.getGps(gps.getNbbm());
155 //掉线处理 157 //掉线处理
156 offlineSignalHandle.handle(gps, prevs); 158 offlineSignalHandle.handle(gps, prevs);
157 //状态处理 159 //状态处理
158 - if (!correctSignalHandle.handle(gps, prevs))  
159 - continue; 160 + task = correctSignalHandle.handle(gps, prevs);
160 //场,站内外判断 161 //场,站内外判断
161 stationInsideHandle.handle(gps, prevs); 162 stationInsideHandle.handle(gps, prevs);
  163 + //异常判定(越界/超速)
  164 + //abnormalStateHandle.handle(gps, prevs);
  165 +
  166 + if(!task)
  167 + return; //无任务的,到这里就结束
  168 +
162 //反向处理 169 //反向处理
163 reverseSignalHandle.handle(gps, prevs); 170 reverseSignalHandle.handle(gps, prevs);
164 //进出站动作处理 171 //进出站动作处理
165 inOutStationSignalHandle.handle(gps, prevs); 172 inOutStationSignalHandle.handle(gps, prevs);
166 -  
167 GeoCacheData.putGps(gps); 173 GeoCacheData.putGps(gps);
168 } 174 }
169 } catch (Exception e) { 175 } catch (Exception e) {
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
@@ -95,7 +95,9 @@ public class GpsDataLoaderThread extends Thread { @@ -95,7 +95,9 @@ public class GpsDataLoaderThread extends Thread {
95 95
96 old = gpsRealData.get(gps.getDeviceId()); 96 old = gpsRealData.get(gps.getDeviceId());
97 if (old != null && 97 if (old != null &&
98 - old.getTimestamp() == gps.getTimestamp()) 98 + old.getTimestamp() == gps.getTimestamp() &&
  99 + old.getLat() == gps.getLat() &&
  100 + old.getLon() == gps.getLon())
99 continue; 101 continue;
100 102
101 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); 103 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -197,12 +197,22 @@ public class SchAttrCalculator { @@ -197,12 +197,22 @@ public class SchAttrCalculator {
197 String lineCode = list.get(0).getXlBm(); 197 String lineCode = list.get(0).getXlBm();
198 LineConfig conf = lineConfigData.get(lineCode); 198 LineConfig conf = lineConfigData.get(lineCode);
199 int outConfig = -1; 199 int outConfig = -1;
200 - if(conf != null) 200 + //限定出站既出场的停车场
  201 + String park = null;
  202 + if(conf != null){
201 outConfig = conf.getOutConfig(); 203 outConfig = conf.getOutConfig();
  204 + park = conf.getTwinsPark();
  205 + }
  206 + boolean limitPark = StringUtils.isNotEmpty(park);
202 207
203 for(ScheduleRealInfo sch : list){ 208 for(ScheduleRealInfo sch : list){
204 //如果是出站既出场,忽略出场班次 209 //如果是出站既出场,忽略出场班次
205 - if(outConfig == 2 && sch.getBcType().equals("out")) 210 + if(outConfig == 2 && sch.getBcType().equals("out")
  211 + && (!limitPark || park.equals(sch.getQdzCode())))
  212 + continue;
  213 +
  214 + //忽略烂班
  215 + if(sch.isDestroy())
206 continue; 216 continue;
207 217
208 //已执行 218 //已执行
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -96,18 +96,21 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -96,18 +96,21 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
96 + " and s.ssgsdm like %?2% " 96 + " and s.ssgsdm like %?2% "
97 + " and s.fgsdm like %?3%" 97 + " and s.fgsdm like %?3%"
98 + " and s.xlbm like %?4% " 98 + " and s.xlbm like %?4% "
99 - + " and s.nbbm in ?5 ") 99 + + " and s.nbbm in ?5 order by nbbm,jcsx")
100 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 100 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
101 101
102 102
103 @Transactional 103 @Transactional
104 @Modifying 104 @Modifying
105 @Query(value="UPDATE bsth_c_ylb SET " + 105 @Query(value="UPDATE bsth_c_ylb SET " +
106 - " jzyl = ?2, " +  
107 - " sh = ?3," +  
108 - " shyy = ?4," +  
109 - " ns = ?5," +  
110 - " rylx = ?6" + 106 + " czyl= ?2,"+
  107 + " jzyl = ?3, " +
  108 + " yh = ?4,"+
  109 + " sh = ?5," +
  110 + " shyy = ?6," +
  111 + " ns = ?7," +
  112 + " rylx = ?8," +
  113 + " yhlx = ?9"+
111 " WHERE id = ?1", nativeQuery=true) 114 " WHERE id = ?1", nativeQuery=true)
112 - public void ylbUpdate(Integer id,double jzyl,double sh,String shyy,double ns,String rylx); 115 + public void ylbUpdate(Integer id,double czyl,double jzyl,double yh, double sh,String shyy,double ns,String rylx,int yhlx);
113 } 116 }
src/main/java/com/bsth/service/oil/YlbService.java
@@ -9,6 +9,7 @@ import com.bsth.service.BaseService; @@ -9,6 +9,7 @@ import com.bsth.service.BaseService;
9 public interface YlbService extends BaseService<Ylb, Integer>{ 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 Map<String, Object> obtain(Map<String, Object> map) throws Exception; 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception; 11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
  12 + Map<String, Object> saveYlb(Ylb t);
12 String obtainDsq() throws Exception; 13 String obtainDsq() throws Exception;
13 Map<String, Object> sort(Map<String, Object> map) throws Exception; 14 Map<String, Object> sort(Map<String, Object> map) throws Exception;
14 15
@@ -17,8 +18,10 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{ @@ -17,8 +18,10 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
17 Map<String, Object> checkYl(Map<String, Object> map) throws Exception; 18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
18 19
19 Map<String, Object> sumYlb(Map<String, Object> map); 20 Map<String, Object> sumYlb(Map<String, Object> map);
20 - 21 + String checkJsy(Map<String, Object> map);
21 List<Ylb> oilListMonth(String line,String date); 22 List<Ylb> oilListMonth(String line,String date);
22 List<Ylb> listYlb(Map<String, Object> map); 23 List<Ylb> listYlb(Map<String, Object> map);
23 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx); 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
  25 +
  26 +
24 } 27 }
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
1 package com.bsth.service.oil.impl; 1 package com.bsth.service.oil.impl;
2 2
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Calendar;
  10 +import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.Iterator;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +import javax.transaction.Transactional;
  17 +
  18 +import org.apache.commons.lang3.StringEscapeUtils;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.data.domain.Sort;
  23 +import org.springframework.data.domain.Sort.Direction;
  24 +import org.springframework.jdbc.core.JdbcTemplate;
  25 +import org.springframework.jdbc.core.RowMapper;
  26 +import org.springframework.stereotype.Service;
  27 +
3 import com.alibaba.fastjson.JSONArray; 28 import com.alibaba.fastjson.JSONArray;
4 import com.alibaba.fastjson.JSONObject; 29 import com.alibaba.fastjson.JSONObject;
5 import com.bsth.common.ResponseCode; 30 import com.bsth.common.ResponseCode;
  31 +import com.bsth.data.BasicData;
6 import com.bsth.entity.Cars; 32 import com.bsth.entity.Cars;
7 import com.bsth.entity.oil.Cyl; 33 import com.bsth.entity.oil.Cyl;
8 import com.bsth.entity.oil.Ylb; 34 import com.bsth.entity.oil.Ylb;
@@ -17,21 +43,7 @@ import com.bsth.service.oil.YlbService; @@ -17,21 +43,7 @@ import com.bsth.service.oil.YlbService;
17 import com.bsth.service.realcontrol.ScheduleRealInfoService; 43 import com.bsth.service.realcontrol.ScheduleRealInfoService;
18 import com.bsth.util.Arith; 44 import com.bsth.util.Arith;
19 import com.bsth.util.BatchSaveUtils; 45 import com.bsth.util.BatchSaveUtils;
20 -import org.apache.commons.lang3.StringEscapeUtils;  
21 -import org.slf4j.Logger;  
22 -import org.slf4j.LoggerFactory;  
23 -import org.springframework.beans.factory.annotation.Autowired;  
24 -import org.springframework.jdbc.core.JdbcTemplate;  
25 -import org.springframework.jdbc.core.RowMapper;  
26 -import org.springframework.stereotype.Service;  
27 -  
28 -import javax.transaction.Transactional;  
29 -import java.sql.ResultSet;  
30 -import java.sql.SQLException;  
31 -import java.text.DecimalFormat;  
32 -import java.text.ParseException;  
33 -import java.text.SimpleDateFormat;  
34 -import java.util.*; 46 +import com.github.abel533.echarts.code.Y;
35 47
36 @Service 48 @Service
37 public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{ 49 public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{
@@ -457,45 +469,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -457,45 +469,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
457 469
458 repository.save(t); 470 repository.save(t);
459 } 471 }
460 -  
461 - // 设置存油量  
462 - Cyl cyl = null;  
463 - boolean fage = false;  
464 - for (int z = 0; z < cylList.size(); z++) {  
465 - cyl = cylList.get(z);  
466 - if (t.getNbbm().equals(cyl.getNbbm())) {  
467 - cyl.setCyl(t.getJzyl());  
468 - cyl.setUpdatetime(t.getRq());  
469 - fage = true;  
470 - break;  
471 - }  
472 - }  
473 - if (fage) {  
474 - cylRepository.save(cyl);  
475 - } else {  
476 - if(cylMapAdd.get(t.getNbbm())!=null){  
477 - for (int l = 0; l < cylListAdd.size(); l++) {  
478 - cyl=cylListAdd.get(l);  
479 - if(cyl.getNbbm().equals(t.getNbbm())){  
480 - cyl.setNbbm(t.getNbbm());  
481 - cyl.setCyl(t.getJzyl());  
482 - cyl.setGsdm(t.getSsgsdm());  
483 - cyl.setFgsdm(t.getFgsdm());  
484 - cyl.setUpdatetime(t.getRq());  
485 - }  
486 - }  
487 - }else{  
488 - cyl = new Cyl();  
489 - cyl.setNbbm(t.getNbbm());  
490 - cyl.setCyl(t.getJzyl());  
491 - cyl.setGsdm(t.getSsgsdm());  
492 - cyl.setFgsdm(t.getFgsdm());  
493 - cyl.setUpdatetime(t.getRq());  
494 - cylListAdd.add(cyl);  
495 - }  
496 -  
497 -  
498 - }  
499 map2.put("status", ResponseCode.SUCCESS); 472 map2.put("status", ResponseCode.SUCCESS);
500 } 473 }
501 } 474 }
@@ -514,6 +487,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -514,6 +487,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
514 /** 487 /**
515 * 拆分 488 * 拆分
516 */ 489 */
  490 + /*
517 @Transactional 491 @Transactional
518 @Override 492 @Override
519 public Map<String, Object> sort(Map<String, Object> map) throws Exception{ 493 public Map<String, Object> sort(Map<String, Object> map) throws Exception{
@@ -593,19 +567,19 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -593,19 +567,19 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
593 t.setSh(sh); 567 t.setSh(sh);
594 t.setShyy(shyy); 568 t.setShyy(shyy);
595 } 569 }
596 - t.setCzyl(nextJzyl);  
597 - Double yh =0.0;  
598 - if (t.getZlc() != 0) {  
599 - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));  
600 - }  
601 - nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));  
602 - long l=Math.round(nextJzyl);  
603 - double ylxs=l*100/100; 570 + t.setCzyl(nextJzyl);
  571 + Double yh =0.0;
  572 + if (t.getZlc() != 0) {
  573 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  574 + }
  575 + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
  576 + long l=Math.round(nextJzyl);
  577 + double ylxs=l*100/100;
604 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); 578 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
605 - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));  
606 - t.setJzyl(ylxs);  
607 - t.setYh(yh);  
608 - nextJzyl=ylxs; 579 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  580 + t.setJzyl(ylxs);
  581 + t.setYh(yh);
  582 + nextJzyl=ylxs;
609 } 583 }
610 repository.save(t); 584 repository.save(t);
611 585
@@ -657,7 +631,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -657,7 +631,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
657 throw e; 631 throw e;
658 } 632 }
659 return newMap; 633 return newMap;
660 - } 634 + }*/
661 635
662 /** 636 /**
663 * 核对,有加注没里程 637 * 核对,有加注没里程
@@ -715,32 +689,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -715,32 +689,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
715 t.setSsgsdm(y1.getGsdm()); 689 t.setSsgsdm(y1.getGsdm());
716 t.setXlbm(xlbm); 690 t.setXlbm(xlbm);
717 repository.save(t); 691 repository.save(t);
718 -  
719 - //设置存油量  
720 - Cyl cyl=null;  
721 - boolean status=false;  
722 - for(int z=0;z<cylList.size();z++){  
723 - cyl=cylList.get(z);  
724 - if(t.getNbbm().equals(cyl.getNbbm())){  
725 -// cyl.setCyl(cyl.getCyl()+t.getJzl());  
726 - cyl.setCyl(Arith.add(cyl.getCyl(),t.getJzl()));  
727 - cyl.setUpdatetime(t.getRq());  
728 - status=true;  
729 - break;  
730 - }  
731 - }  
732 - if(status){  
733 - cylRepository.save(cyl);  
734 - }else{  
735 - cyl=new Cyl();  
736 - cyl.setNbbm(t.getNbbm());  
737 - cyl.setCyl(t.getJzl());  
738 - cyl.setGsdm(t.getSsgsdm());  
739 - cyl.setUpdatetime(t.getRq());  
740 - cylRepository.save(cyl);  
741 - }  
742 -  
743 -  
744 } 692 }
745 } 693 }
746 newMap.put("status", ResponseCode.SUCCESS); 694 newMap.put("status", ResponseCode.SUCCESS);
@@ -953,20 +901,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -953,20 +901,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
953 for (int i = 0; i < jsonArray.size(); i++) { 901 for (int i = 0; i < jsonArray.size(); i++) {
954 // Ylb t=new Ylb(); 902 // Ylb t=new Ylb();
955 jsonObject=jsonArray.getJSONObject(i); 903 jsonObject=jsonArray.getJSONObject(i);
956 -  
957 - Double jzyl =jsonObject.getDoubleValue("jzyl");  
958 - Double sh =jsonObject.getDoubleValue("sh"); 904 + double czyl = jsonObject.getDoubleValue("czyl");
  905 + double jzl =jsonObject.getDoubleValue("jzl");
  906 + double jzyl =jsonObject.getDoubleValue("jzyl");
  907 + double sh =jsonObject.getDoubleValue("sh");
959 String shyy =jsonObject.getString("shyy"); 908 String shyy =jsonObject.getString("shyy");
960 - Double ns = jsonObject.getDoubleValue("ns"); 909 + double ns = jsonObject.getDoubleValue("ns");
961 String rylx =jsonObject.getString("rylx"); 910 String rylx =jsonObject.getString("rylx");
  911 + int yhlx =jsonObject.getIntValue("yhlx");
962 Integer id =jsonObject.getInteger("id"); 912 Integer id =jsonObject.getInteger("id");
  913 + double yh = Arith.sub(Arith.add(czyl, jzl), jzyl);
963 /*t.setJzyl(jzyl); 914 /*t.setJzyl(jzyl);
964 t.setSh(sh); 915 t.setSh(sh);
965 t.setShyy(shyy); 916 t.setShyy(shyy);
966 t.setNs(ns); 917 t.setNs(ns);
967 t.setRylx(rylx); 918 t.setRylx(rylx);
968 t.setId(jsonObject.getInteger("id"));*/ 919 t.setId(jsonObject.getInteger("id"));*/
969 - repository.ylbUpdate(id, jzyl, sh, shyy, ns, rylx); 920 + repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
970 } 921 }
971 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); 922 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
972 923
@@ -979,5 +930,139 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -979,5 +930,139 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
979 return newMap; 930 return newMap;
980 } 931 }
981 932
  933 + /**
  934 + * 拆分
  935 + */
  936 + @Transactional
  937 + @Override
  938 + public Map<String, Object> sort(Map<String, Object> map) throws Exception{
  939 + // TODO Auto-generated method stub
  940 + Map<String, Object> newMap = new HashMap<String, Object>();
  941 + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
  942 +
  943 + try {
  944 + List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  945 + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
  946 + JSONArray jsonArray=JSONArray.parseArray(json);
  947 + JSONObject jsonObject;
  948 + for (int x = 0; x < jsonArray.size(); x++) {
  949 + jsonObject=jsonArray.getJSONObject(x);
  950 + Double yl =jsonObject.getDoubleValue("jzyl");
  951 + Double sh =jsonObject.getDoubleValue("sh");
  952 + String shyy =jsonObject.getString("shyy");
  953 + Double ns = jsonObject.getDoubleValue("ns");
  954 + String rylx =jsonObject.getString("rylx");
  955 + Integer id =jsonObject.getInteger("id");
  956 + Ylb ylb = repository.findOne(id);
  957 + String nbbm_eq = ylb.getNbbm();
  958 + Date rq_eq = ylb.getRq();
  959 + // 得到一天总的加油和里程(根据车,时间)
  960 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  961 + // 保存总的加油量
  962 + Double jzl = 0.0;
  963 + // 保存总的里程
  964 + Double zlc = 0.0;
  965 + //保存总的损耗
  966 + Double zsh = 0.0;
  967 + for (int j = 0; j < sumList.size(); j++) {
  968 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  969 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  970 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  971 + }
  972 + jzl = Arith.sub(jzl, zsh);
  973 + //新的 损耗不等于 旧的损耗 总损耗从新算
  974 + if(Arith.sub(ylb.getSh(),sh )!=0){
  975 + zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
  976 + jzl =Arith.sub(jzl, zsh);
  977 + }else{
  978 + jzl =Arith.sub(jzl, zsh);
  979 + }
  980 + map.put("nbbm_eq", nbbm_eq);
  981 + map.put("rq_eq", rq_eq);
  982 +
  983 + List<Ylb> iterator2=repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),ylb.getXlbm(),
  984 + ylb.getNbbm(),"jcsx");
  985 + DecimalFormat df = new DecimalFormat("#.00");
  986 + Double zyl = 0.0;
  987 + Double nextJzyl = 0.0;
  988 + // 车的,进,出油量及耗油
  989 + Map<String, Object> cylMapAdd=new HashMap<String,Object>();
  990 + List<Cyl> cylListAdd=new ArrayList<Cyl>();
  991 + for (int i = 0; i < iterator2.size(); i++) {
  992 + Ylb t = iterator2.get(i);
  993 + if (t.getJcsx() == 1) {
  994 + if(t.getId()==id){
  995 + t.setSh(sh);
  996 + t.setShyy(shyy);
  997 + }
  998 + Double jcyl = t.getCzyl();
  999 + zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
  1000 + Double yh = 0.0;
  1001 + if (zlc > 0 && t.getZlc() > 0) {
  1002 + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1003 + }
  1004 + nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
  1005 + long l=Math.round(nextJzyl);
  1006 + double ylxs=l*100/100;
  1007 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1008 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1009 + t.setJzyl(ylxs);
  1010 + t.setYh(yh);
  1011 + nextJzyl=ylxs;
  1012 + } else {
  1013 + if(t.getId()==id){
  1014 + t.setSh(sh);
  1015 + t.setShyy(shyy);
  1016 + }
  1017 + t.setCzyl(nextJzyl);
  1018 + Double yh =0.0;
  1019 + if (t.getZlc() != 0) {
  1020 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1021 + }
  1022 + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
  1023 + long l=Math.round(nextJzyl);
  1024 + double ylxs=l*100/100;
  1025 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1026 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1027 + t.setJzyl(ylxs);
  1028 + t.setYh(yh);
  1029 + nextJzyl=ylxs;
  1030 + }
  1031 + repository.save(t);
  1032 + }
  1033 + for (int i = 0; i < cylListAdd.size(); i++) {
  1034 + cylRepository.save(cylListAdd.get(i));
  1035 + }
  1036 + newMap.put("status", ResponseCode.SUCCESS);
  1037 + }
  1038 + } catch (Exception e) {
  1039 + newMap.put("status", ResponseCode.ERROR);
  1040 + logger.error("save erro.", e);
  1041 + throw e;
  1042 + }
  1043 + return newMap;
  1044 + }
  1045 +
  1046 + @Override
  1047 + public String checkJsy(Map<String, Object> map) {
  1048 + // TODO Auto-generated method stub
  1049 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  1050 + String rq=map.get("date").toString();
  1051 + String nbbm=map.get("nbbm").toString();
  1052 + String jsy =map.get("jsy").toString();
  1053 + List<Ylb> list= repository.queryListYlb(rq, nbbm, jsy);
  1054 + String type="";
  1055 + if(list.size()>0){
  1056 + type="cunzai";
  1057 + }
  1058 + return type;
  1059 + }
  1060 +
  1061 + @Override
  1062 + public Map<String, Object> saveYlb(Ylb t) {
982 1063
  1064 + String gsbm="";
  1065 + String fgsbm="";
  1066 + return null;
  1067 + }
983 } 1068 }
984 \ No newline at end of file 1069 \ No newline at end of file
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -203,7 +203,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -203,7 +203,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
203 try { 203 try {
204 List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr)); 204 List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr));
205 205
206 - ScheduleRealInfo schedule = null, execSch, next; 206 + ScheduleRealInfo schedule = null, next;
207 for (String id : idList) { 207 for (String id : idList) {
208 schedule = dayOfSchedule.get(Long.parseLong(id)); 208 schedule = dayOfSchedule.get(Long.parseLong(id));
209 if (schedule.isDestroy()) { 209 if (schedule.isDestroy()) {
@@ -219,14 +219,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -219,14 +219,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
219 dayOfSchedule.save(schedule); 219 dayOfSchedule.save(schedule);
220 rsList.add(schedule); 220 rsList.add(schedule);
221 221
222 - //如果正在执行当前班次,跳下一个班次 222 + /*//如果正在执行当前班次,跳下一个班次
223 execSch = dayOfSchedule.executeCurr(schedule.getClZbh()); 223 execSch = dayOfSchedule.executeCurr(schedule.getClZbh());
224 if(execSch != null && execSch.getId().equals(schedule.getId())){ 224 if(execSch != null && execSch.getId().equals(schedule.getId())){
225 next = dayOfSchedule.next(schedule); 225 next = dayOfSchedule.next(schedule);
226 dayOfSchedule.addExecPlan(next); 226 dayOfSchedule.addExecPlan(next);
227 - } 227 + }*/
228 } 228 }
229 229
  230 + //重新计算当前执行班次
  231 + dayOfSchedule.reCalcExecPlan(schedule.getClZbh());
  232 +
230 map.put("status", ResponseCode.SUCCESS); 233 map.put("status", ResponseCode.SUCCESS);
231 } catch (Exception e) { 234 } catch (Exception e) {
232 logger.error("", e); 235 logger.error("", e);
@@ -368,8 +371,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -368,8 +371,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
368 //更新起点应到时间 371 //更新起点应到时间
369 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh()); 372 List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t.getClZbh());
370 373
  374 + //重新计算车辆当前执行班次
  375 + dayOfSchedule.reCalcExecPlan(t.getClZbh());
371 376
372 - rs.put("ts", ts); 377 +
  378 + rs.put("ts", ts);
373 rs.put("t", t); 379 rs.put("t", t);
374 } catch (Exception e) { 380 } catch (Exception e) {
375 logger.error("", e); 381 logger.error("", e);
@@ -1615,9 +1621,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1615,9 +1621,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1615 else if (date.length() == 7) 1621 else if (date.length() == 7)
1616 list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date); 1622 list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1617 1623
  1624 +
1618 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 1625 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1619 DecimalFormat format = new DecimalFormat("0.00"); 1626 DecimalFormat format = new DecimalFormat("0.00");
1620 - double jhlc = 0, tempJhlc = 0, childMileage = 0; 1627 + double jhlc = 0, tempJhlc = 0, childMileage = 0,jhlcOrig=0;
1621 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f; 1628 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
1622 //班次 1629 //班次
1623 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0; 1630 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
@@ -1642,21 +1649,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1642,21 +1649,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1642 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0; 1649 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
1643 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0; 1650 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
1644 Map<String, Object> map = null; 1651 Map<String, Object> map = null;
  1652 +
  1653 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
1645 for (int i = 0; i < list.size(); i++) { 1654 for (int i = 0; i < list.size(); i++) {
1646 ScheduleRealInfo scheduleRealInfo = list.get(i); 1655 ScheduleRealInfo scheduleRealInfo = list.get(i);
  1656 +
1647 if (scheduleRealInfo != null) { 1657 if (scheduleRealInfo != null) {
1648 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 1658 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1649 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程 1659 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1660 + if(!scheduleRealInfo.isSflj()){
  1661 + jhlc += tempJhlc;
  1662 + jhlcZ += tempJhlc;
  1663 + }
1650 if (childTaskPlans.isEmpty()) { 1664 if (childTaskPlans.isEmpty()) {
1651 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 1665 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1666 + jhlcOrig = scheduleRealInfo.getJhlcOrig() == null ? 0 : scheduleRealInfo.getJhlcOrig();
  1667 +
  1668 + if(jhlcOrig-tempJhlc>0){
  1669 + xgssgl +=jhlcOrig-tempJhlc;
  1670 + cj += jhlcOrig-tempJhlc;
  1671 + }else{
  1672 + xgljgl +=tempJhlc-jhlcOrig;
  1673 + lj +=tempJhlc-jhlcOrig;
  1674 + }
1652 //临加公里 1675 //临加公里
1653 if (scheduleRealInfo.isSflj()) { 1676 if (scheduleRealInfo.isSflj()) {
1654 ljgl += tempJhlc; 1677 ljgl += tempJhlc;
1655 ljglZ += tempJhlc; 1678 ljglZ += tempJhlc;
1656 - } else {  
1657 - jhlc += tempJhlc;  
1658 - jhlcZ += tempJhlc;  
1659 - } 1679 + }
  1680 +
1660 if (scheduleRealInfo.getStatus() == -1) { 1681 if (scheduleRealInfo.getStatus() == -1) {
1661 ssgl += tempJhlc; 1682 ssgl += tempJhlc;
1662 ssglZ += tempJhlc; 1683 ssglZ += tempJhlc;
@@ -1791,8 +1812,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1791,8 +1812,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1791 ssbc_otherZ++; 1812 ssbc_otherZ++;
1792 } 1813 }
1793 } else { 1814 } else {
1794 - sjgl += childMileage;  
1795 - sjglZ += childMileage; 1815 + if (scheduleRealInfo.isSflj()) {
  1816 + ljgl += tempJhlc;
  1817 + ljglZ += tempJhlc;
  1818 + } else{
  1819 + sjgl += childMileage;
  1820 + sjglZ += childMileage;
  1821 + }
1796 } 1822 }
1797 } 1823 }
1798 } 1824 }
@@ -1849,7 +1875,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1849,7 +1875,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1849 map.put("xlName", scheduleRealInfo.getXlName()); 1875 map.put("xlName", scheduleRealInfo.getXlName());
1850 map.put("jhlc", format.format(jhlc)); 1876 map.put("jhlc", format.format(jhlc));
1851 map.put("sjgl", format.format(sjgl)); 1877 map.put("sjgl", format.format(sjgl));
1852 - map.put("ssgl", format.format(ssgl)); 1878 + map.put("ssgl", format.format(ssgl+cj));
1853 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 1879 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1854 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 1880 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1855 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 1881 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -1873,7 +1899,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1873,7 +1899,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1873 map.put("ssbc_qh", ssbc_qh); 1899 map.put("ssbc_qh", ssbc_qh);
1874 map.put("ssbc_yw", ssbc_yw); 1900 map.put("ssbc_yw", ssbc_yw);
1875 map.put("ssbc_other", ssbc_other); 1901 map.put("ssbc_other", ssbc_other);
1876 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 1902 + map.put("ljgl", format.format(ljgl+lj));
1877 map.put("jhbc", jhbc); 1903 map.put("jhbc", jhbc);
1878 map.put("jhbc_m", jhbc_m); 1904 map.put("jhbc_m", jhbc_m);
1879 map.put("jhbc_a", jhbc_a); 1905 map.put("jhbc_a", jhbc_a);
@@ -1931,13 +1957,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1931,13 +1957,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1931 djg_m = 0; 1957 djg_m = 0;
1932 djg_a = 0; 1958 djg_a = 0;
1933 djg_time = 0; 1959 djg_time = 0;
  1960 + lj=0;
  1961 + cj=0;
1934 } 1962 }
1935 } else { 1963 } else {
1936 map = new HashMap<String, Object>(); 1964 map = new HashMap<String, Object>();
1937 map.put("xlName", scheduleRealInfo.getXlName()); 1965 map.put("xlName", scheduleRealInfo.getXlName());
1938 map.put("jhlc", format.format(jhlc)); 1966 map.put("jhlc", format.format(jhlc));
1939 map.put("sjgl", format.format(sjgl)); 1967 map.put("sjgl", format.format(sjgl));
1940 - map.put("ssgl", format.format(ssgl)); 1968 + map.put("ssgl", format.format(ssgl+cj));
1941 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 1969 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1942 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 1970 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1943 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 1971 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -1961,7 +1989,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1961,7 +1989,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1961 map.put("ssbc_qh", ssbc_qh); 1989 map.put("ssbc_qh", ssbc_qh);
1962 map.put("ssbc_yw", ssbc_yw); 1990 map.put("ssbc_yw", ssbc_yw);
1963 map.put("ssbc_other", ssbc_other); 1991 map.put("ssbc_other", ssbc_other);
1964 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 1992 + map.put("ljgl", format.format(ljgl+lj));
1965 map.put("jhbc", jhbc); 1993 map.put("jhbc", jhbc);
1966 map.put("jhbc_m", jhbc_m); 1994 map.put("jhbc_m", jhbc_m);
1967 map.put("jhbc_a", jhbc_a); 1995 map.put("jhbc_a", jhbc_a);
@@ -2019,6 +2047,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2019,6 +2047,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2019 djg_m = 0; 2047 djg_m = 0;
2020 djg_a = 0; 2048 djg_a = 0;
2021 djg_time = 0; 2049 djg_time = 0;
  2050 + lj=0;
  2051 + cj=0;
2022 } 2052 }
2023 } 2053 }
2024 } 2054 }
@@ -2026,7 +2056,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2026,7 +2056,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2026 map.put("xlName", "合计"); 2056 map.put("xlName", "合计");
2027 map.put("jhlc", format.format(jhlcZ)); 2057 map.put("jhlc", format.format(jhlcZ));
2028 map.put("sjgl", format.format(sjglZ)); 2058 map.put("sjgl", format.format(sjglZ));
2029 - map.put("ssgl", format.format(ssglZ)); 2059 + map.put("ssgl", format.format(ssglZ+xgssgl));
2030 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ)); 2060 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2031 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ)); 2061 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2032 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ)); 2062 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
@@ -2050,7 +2080,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2050,7 +2080,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2050 map.put("ssbc_qh", ssbc_qhZ); 2080 map.put("ssbc_qh", ssbc_qhZ);
2051 map.put("ssbc_yw", ssbc_ywZ); 2081 map.put("ssbc_yw", ssbc_ywZ);
2052 map.put("ssbc_other", ssbc_otherZ); 2082 map.put("ssbc_other", ssbc_otherZ);
2053 - map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ)); 2083 + map.put("ljgl", format.format(ljglZ+xgljgl));
2054 map.put("jhbc", jhbcZ); 2084 map.put("jhbc", jhbcZ);
2055 map.put("jhbc_m", jhbc_mZ); 2085 map.put("jhbc_m", jhbc_mZ);
2056 map.put("jhbc_a", jhbc_aZ); 2086 map.put("jhbc_a", jhbc_aZ);
@@ -2143,7 +2173,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2143,7 +2173,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2143 2173
2144 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 2174 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2145 DecimalFormat format = new DecimalFormat("0.00"); 2175 DecimalFormat format = new DecimalFormat("0.00");
2146 - double jhlc = 0, tempJhlc = 0, childMileage = 0; 2176 + double jhlc = 0, tempJhlc = 0, childMileage = 0,jhlcOrig=0;
2147 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f; 2177 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
2148 //班次 2178 //班次
2149 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0; 2179 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
@@ -2168,21 +2198,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2168,21 +2198,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2168 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0; 2198 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
2169 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0; 2199 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
2170 Map<String, Object> map = null; 2200 Map<String, Object> map = null;
  2201 +
  2202 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
2171 for (int i = 0; i < list.size(); i++) { 2203 for (int i = 0; i < list.size(); i++) {
2172 ScheduleRealInfo scheduleRealInfo = list.get(i); 2204 ScheduleRealInfo scheduleRealInfo = list.get(i);
  2205 +
2173 if (scheduleRealInfo != null) { 2206 if (scheduleRealInfo != null) {
2174 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 2207 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2175 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程 2208 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  2209 + if(!scheduleRealInfo.isSflj()){
  2210 + jhlc += tempJhlc;
  2211 + jhlcZ += tempJhlc;
  2212 + }
2176 if (childTaskPlans.isEmpty()) { 2213 if (childTaskPlans.isEmpty()) {
2177 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 2214 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2215 + jhlcOrig = scheduleRealInfo.getJhlcOrig() == null ? 0 : scheduleRealInfo.getJhlcOrig();
  2216 +
  2217 + if(jhlcOrig-tempJhlc>0){
  2218 + xgssgl +=jhlcOrig-tempJhlc;
  2219 + cj += jhlcOrig-tempJhlc;
  2220 + }else{
  2221 + xgljgl +=tempJhlc-jhlcOrig;
  2222 + lj +=tempJhlc-jhlcOrig;
  2223 + }
2178 //临加公里 2224 //临加公里
2179 if (scheduleRealInfo.isSflj()) { 2225 if (scheduleRealInfo.isSflj()) {
2180 ljgl += tempJhlc; 2226 ljgl += tempJhlc;
2181 ljglZ += tempJhlc; 2227 ljglZ += tempJhlc;
2182 - } else {  
2183 - jhlc += tempJhlc;  
2184 - jhlcZ += tempJhlc;  
2185 - } 2228 + }
  2229 +
2186 if (scheduleRealInfo.getStatus() == -1) { 2230 if (scheduleRealInfo.getStatus() == -1) {
2187 ssgl += tempJhlc; 2231 ssgl += tempJhlc;
2188 ssglZ += tempJhlc; 2232 ssglZ += tempJhlc;
@@ -2317,8 +2361,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2317,8 +2361,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2317 ssbc_otherZ++; 2361 ssbc_otherZ++;
2318 } 2362 }
2319 } else { 2363 } else {
2320 - sjgl += childMileage;  
2321 - sjglZ += childMileage; 2364 + if (scheduleRealInfo.isSflj()) {
  2365 + ljgl += tempJhlc;
  2366 + ljglZ += tempJhlc;
  2367 + } else{
  2368 + sjgl += childMileage;
  2369 + sjglZ += childMileage;
  2370 + }
2322 } 2371 }
2323 } 2372 }
2324 } 2373 }
@@ -2375,7 +2424,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2375,7 +2424,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2375 map.put("xlName", scheduleRealInfo.getXlName()); 2424 map.put("xlName", scheduleRealInfo.getXlName());
2376 map.put("jhlc", format.format(jhlc)); 2425 map.put("jhlc", format.format(jhlc));
2377 map.put("sjgl", format.format(sjgl)); 2426 map.put("sjgl", format.format(sjgl));
2378 - map.put("ssgl", format.format(ssgl)); 2427 + map.put("ssgl", format.format(ssgl+cj));
2379 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 2428 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2380 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 2429 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
2381 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 2430 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -2399,7 +2448,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2399,7 +2448,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2399 map.put("ssbc_qh", ssbc_qh); 2448 map.put("ssbc_qh", ssbc_qh);
2400 map.put("ssbc_yw", ssbc_yw); 2449 map.put("ssbc_yw", ssbc_yw);
2401 map.put("ssbc_other", ssbc_other); 2450 map.put("ssbc_other", ssbc_other);
2402 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 2451 + map.put("ljgl", (ljgl+lj) == 0 ? 0 : format.format(ljgl+lj));
2403 map.put("jhbc", jhbc); 2452 map.put("jhbc", jhbc);
2404 map.put("jhbc_m", jhbc_m); 2453 map.put("jhbc_m", jhbc_m);
2405 map.put("jhbc_a", jhbc_a); 2454 map.put("jhbc_a", jhbc_a);
@@ -2457,12 +2506,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2457,12 +2506,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2457 djg_m = 0; 2506 djg_m = 0;
2458 djg_a = 0; 2507 djg_a = 0;
2459 djg_time = 0; 2508 djg_time = 0;
  2509 + lj=0;
  2510 + cj=0;
2460 } 2511 }
2461 } else { 2512 } else {
2462 map = new HashMap<String, Object>(); 2513 map = new HashMap<String, Object>();
2463 map.put("xlName", scheduleRealInfo.getXlName()); 2514 map.put("xlName", scheduleRealInfo.getXlName());
2464 map.put("jhlc", format.format(jhlc)); 2515 map.put("jhlc", format.format(jhlc));
2465 - map.put("sjgl", format.format(sjgl)); 2516 + map.put("sjgl", format.format(sjgl+cj));
2466 map.put("ssgl", format.format(ssgl)); 2517 map.put("ssgl", format.format(ssgl));
2467 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 2518 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2468 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 2519 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
@@ -2487,7 +2538,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2487,7 +2538,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2487 map.put("ssbc_qh", ssbc_qh); 2538 map.put("ssbc_qh", ssbc_qh);
2488 map.put("ssbc_yw", ssbc_yw); 2539 map.put("ssbc_yw", ssbc_yw);
2489 map.put("ssbc_other", ssbc_other); 2540 map.put("ssbc_other", ssbc_other);
2490 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 2541 + map.put("ljgl", format.format(ljgl+lj));
2491 map.put("jhbc", jhbc); 2542 map.put("jhbc", jhbc);
2492 map.put("jhbc_m", jhbc_m); 2543 map.put("jhbc_m", jhbc_m);
2493 map.put("jhbc_a", jhbc_a); 2544 map.put("jhbc_a", jhbc_a);
@@ -2545,6 +2596,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2545,6 +2596,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2545 djg_m = 0; 2596 djg_m = 0;
2546 djg_a = 0; 2597 djg_a = 0;
2547 djg_time = 0; 2598 djg_time = 0;
  2599 + lj=0;
  2600 + cj=0;
2548 } 2601 }
2549 } 2602 }
2550 } 2603 }
@@ -2552,7 +2605,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2552,7 +2605,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2552 map.put("xlName", "合计"); 2605 map.put("xlName", "合计");
2553 map.put("jhlc", format.format(jhlcZ)); 2606 map.put("jhlc", format.format(jhlcZ));
2554 map.put("sjgl", format.format(sjglZ)); 2607 map.put("sjgl", format.format(sjglZ));
2555 - map.put("ssgl", format.format(ssglZ)); 2608 + map.put("ssgl", format.format(ssglZ+xgssgl));
2556 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ)); 2609 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2557 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ)); 2610 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2558 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ)); 2611 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
@@ -2576,7 +2629,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2576,7 +2629,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2576 map.put("ssbc_qh", ssbc_qhZ); 2629 map.put("ssbc_qh", ssbc_qhZ);
2577 map.put("ssbc_yw", ssbc_ywZ); 2630 map.put("ssbc_yw", ssbc_ywZ);
2578 map.put("ssbc_other", ssbc_otherZ); 2631 map.put("ssbc_other", ssbc_otherZ);
2579 - map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ)); 2632 + map.put("ljgl", format.format(ljglZ+xgljgl));
2580 map.put("jhbc", jhbcZ); 2633 map.put("jhbc", jhbcZ);
2581 map.put("jhbc_m", jhbc_mZ); 2634 map.put("jhbc_m", jhbc_mZ);
2582 map.put("jhbc_a", jhbc_aZ); 2635 map.put("jhbc_a", jhbc_aZ);
@@ -3548,7 +3601,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3548,7 +3601,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3548 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 3601 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
3549 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 3602 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
3550 int jhbc = 0, cjbc = 0, ljbc = 0; 3603 int jhbc = 0, cjbc = 0, ljbc = 0;
3551 - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; 3604 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0,ljjcclc=0;
3552 float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0; 3605 float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
3553 Map<String, Object> map = new HashMap<String, Object>(); 3606 Map<String, Object> map = new HashMap<String, Object>();
3554 for (ScheduleRealInfo scheduleRealInfo : list) { 3607 for (ScheduleRealInfo scheduleRealInfo : list) {
@@ -3560,7 +3613,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3560,7 +3613,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3560 double jh = 0, sj = 0; 3613 double jh = 0, sj = 0;
3561 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 3614 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
3562 if (scheduleRealInfo.isSflj()) { 3615 if (scheduleRealInfo.isSflj()) {
3563 - ljbc++; 3616 + if(!(scheduleRealInfo.getBcType().equals("in")
  3617 + || scheduleRealInfo.getBcType().equals("out"))){
  3618 + ljbc++;
  3619 + }
3564 } else { 3620 } else {
3565 if (!(scheduleRealInfo.getBcType().equals("in") 3621 if (!(scheduleRealInfo.getBcType().equals("in")
3566 || scheduleRealInfo.getBcType().equals("out"))) { 3622 || scheduleRealInfo.getBcType().equals("out"))) {
@@ -3578,14 +3634,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3578,14 +3634,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3578 if (childTaskPlans.isEmpty()) { 3634 if (childTaskPlans.isEmpty()) {
3579 if (scheduleRealInfo.getBcType().equals("in") || 3635 if (scheduleRealInfo.getBcType().equals("in") ||
3580 scheduleRealInfo.getBcType().equals("out")) { 3636 scheduleRealInfo.getBcType().equals("out")) {
3581 - jcclc += tempJhlc;  
3582 - }  
3583 -  
3584 - //主任务 放空班次属于营运  
3585 -// else if(scheduleRealInfo.getBcType().equals("venting")){  
3586 -// ksgl += tempJhlc;  
3587 -// }  
3588 - else { 3637 + if(scheduleRealInfo.getStatus() != -1){
  3638 + if(scheduleRealInfo.isSflj()){
  3639 + ljjcclc += tempJhlc;
  3640 + }else{
  3641 + jcclc += tempJhlc;
  3642 + }
  3643 + }
  3644 + }else {
3589 if (scheduleRealInfo.getStatus() != -1) { 3645 if (scheduleRealInfo.getStatus() != -1) {
3590 if (scheduleRealInfo.isSflj()) { 3646 if (scheduleRealInfo.isSflj()) {
3591 addMileage += tempJhlc; 3647 addMileage += tempJhlc;
@@ -3634,13 +3690,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3634,13 +3690,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3634 map.put("ksgl", format.format(ksgl)); 3690 map.put("ksgl", format.format(ksgl));
3635 map.put("yyglsj", format.format(yygl)); 3691 map.put("yyglsj", format.format(yygl));
3636 map.put("jhbc", jhbc); 3692 map.put("jhbc", jhbc);
3637 - map.put("jcclc", jcclc); 3693 + map.put("jcclc", format.format(jcclc+ljjcclc));
3638 3694
3639 map.put("ljgl", format.format(addMileage)); 3695 map.put("ljgl", format.format(addMileage));
3640 map.put("ssbc", cjbc); 3696 map.put("ssbc", cjbc);
3641 map.put("ysgl", format.format(yygl)); 3697 map.put("ysgl", format.format(yygl));
3642 map.put("sjbc", jhbc - cjbc + ljbc); 3698 map.put("sjbc", jhbc - cjbc + ljbc);
3643 - map.put("zgl", format.format(yygl + ksgl + jcclc)); 3699 + map.put("zgl", format.format(yygl + ksgl + jcclc+ljjcclc));
3644 map.put("ljbc", ljbc); 3700 map.put("ljbc", ljbc);
3645 3701
3646 return map; 3702 return map;
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -177,6 +177,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -177,6 +177,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
177 session.insert(ttInfo_input); 177 session.insert(ttInfo_input);
178 } 178 }
179 179
  180 +
  181 + // 载入数据2
  182 + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(schedulePlan.getXl().getId()).iterator();
  183 + while (scheduleRule1FlatIterator.hasNext()) {
  184 + ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next();
  185 + ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp);
  186 + session.insert(scheduleRule_input);
  187 + }
  188 +
180 // 执行rule 189 // 执行rule
181 session.fireAllRules(); 190 session.fireAllRules();
182 191
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -58,9 +58,9 @@ public class MyDroolsConfiguration { @@ -58,9 +58,9 @@ public class MyDroolsConfiguration {
58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() 58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()
59 .newInputStreamResource(this.getClass().getResourceAsStream( 59 .newInputStreamResource(this.getClass().getResourceAsStream(
60 "/rules/HelloWorld.drl"), "UTF-8")); 60 "/rules/HelloWorld.drl"), "UTF-8"));
61 - kfs.write("src/main/resources/shiftloop_fb.drl", kieServices.getResources() 61 + kfs.write("src/main/resources/shiftloop_fb_2.drl", kieServices.getResources()
62 .newInputStreamResource(this.getClass().getResourceAsStream( 62 .newInputStreamResource(this.getClass().getResourceAsStream(
63 - "/rules/shiftloop_fb.drl"), "UTF-8")); 63 + "/rules/shiftloop_fb_2.drl"), "UTF-8"));
64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() 64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
65 .newInputStreamResource(this.getClass().getResourceAsStream( 65 .newInputStreamResource(this.getClass().getResourceAsStream(
66 "/rules/ttinfo.drl"), "UTF-8")); 66 "/rules/ttinfo.drl"), "UTF-8"));
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -12,6 +12,9 @@ import java.util.List; @@ -12,6 +12,9 @@ import java.util.List;
12 * 排班规则_输入。 12 * 排班规则_输入。
13 */ 13 */
14 public class ScheduleRule_input { 14 public class ScheduleRule_input {
  15 + /** 线路Id */
  16 + private String xlId;
  17 +
15 /** 规则Id */ 18 /** 规则Id */
16 private String ruleId; 19 private String ruleId;
17 /** 规则启用日期 */ 20 /** 规则启用日期 */
@@ -36,6 +39,7 @@ public class ScheduleRule_input { @@ -36,6 +39,7 @@ public class ScheduleRule_input {
36 public ScheduleRule_input() {} 39 public ScheduleRule_input() {}
37 40
38 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) { 41 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) {
  42 + this.xlId = String.valueOf(scheduleRule1Flat.getXl().getId());
39 this.ruleId = String.valueOf(scheduleRule1Flat.getId()); 43 this.ruleId = String.valueOf(scheduleRule1Flat.getId());
40 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq()); 44 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq());
41 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds()); 45 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds());
@@ -135,4 +139,12 @@ public class ScheduleRule_input { @@ -135,4 +139,12 @@ public class ScheduleRule_input {
135 public void setWeekdays(List<Boolean> weekdays) { 139 public void setWeekdays(List<Boolean> weekdays) {
136 this.weekdays = weekdays; 140 this.weekdays = weekdays;
137 } 141 }
  142 +
  143 + public String getXlId() {
  144 + return xlId;
  145 + }
  146 +
  147 + public void setXlId(String xlId) {
  148 + this.xlId = xlId;
  149 + }
138 } 150 }
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import org.joda.time.DateTime;  
4 -  
5 -/**  
6 - * 每日路爬信息。  
7 - */  
8 -public class LpInfoResult_output {  
9 - /** 具体日期 */  
10 - private DateTime dateTime;  
11 - /** 路牌Id */  
12 - private String lpId;  
13 - /** 线路Id */  
14 - private String xlId;  
15 - /** 时刻表Id */  
16 - private String ttInfoId;  
17 -  
18 - public DateTime getDateTime() {  
19 - return dateTime;  
20 - }  
21 -  
22 - public void setDateTime(DateTime dateTime) {  
23 - this.dateTime = dateTime;  
24 - }  
25 -  
26 - public String getLpId() {  
27 - return lpId;  
28 - }  
29 -  
30 - public void setLpId(String lpId) {  
31 - this.lpId = lpId;  
32 - }  
33 -  
34 - public String getXlId() {  
35 - return xlId;  
36 - }  
37 -  
38 - public void setXlId(String xlId) {  
39 - this.xlId = xlId;  
40 - }  
41 -  
42 - public String getTtInfoId() {  
43 - return ttInfoId;  
44 - }  
45 -  
46 - public void setTtInfoId(String ttInfoId) {  
47 - this.ttInfoId = ttInfoId;  
48 - }  
49 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 每日路爬信息。
  7 + */
  8 +public class LpInfoResult_output {
  9 + /** 具体日期 */
  10 + private DateTime dateTime;
  11 + /** 路牌Id */
  12 + private String lpId;
  13 + /** 线路Id */
  14 + private String xlId;
  15 + /** 时刻表Id */
  16 + private String ttInfoId;
  17 +
  18 + public DateTime getDateTime() {
  19 + return dateTime;
  20 + }
  21 +
  22 + public void setDateTime(DateTime dateTime) {
  23 + this.dateTime = dateTime;
  24 + }
  25 +
  26 + public String getLpId() {
  27 + return lpId;
  28 + }
  29 +
  30 + public void setLpId(String lpId) {
  31 + this.lpId = lpId;
  32 + }
  33 +
  34 + public String getXlId() {
  35 + return xlId;
  36 + }
  37 +
  38 + public void setXlId(String xlId) {
  39 + this.xlId = xlId;
  40 + }
  41 +
  42 + public String getTtInfoId() {
  43 + return ttInfoId;
  44 + }
  45 +
  46 + public void setTtInfoId(String ttInfoId) {
  47 + this.ttInfoId = ttInfoId;
  48 + }
  49 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import com.bsth.entity.schedule.TTInfoDetail;  
4 -import org.kie.api.runtime.rule.AccumulateFunction;  
5 -  
6 -import java.io.*;  
7 -import java.util.ArrayList;  
8 -import java.util.HashMap;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -/**  
13 - * 路牌信息统计函数。  
14 - */  
15 -public class LpInfoResultsFunction implements AccumulateFunction {  
16 - @Override  
17 - public void writeExternal(ObjectOutput out) throws IOException {  
18 -  
19 - }  
20 -  
21 - @Override  
22 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
23 -  
24 - }  
25 -  
26 - protected static class LpInfoResultsData implements Externalizable {  
27 - public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();  
28 - public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>();  
29 - public TTInfoDetail ttInfoDetail;  
30 -  
31 - public LpInfoResultsData() {}  
32 -  
33 - @Override  
34 - public void writeExternal(ObjectOutput out) throws IOException {  
35 - out.writeObject(lpInfoResult_outputs);  
36 - out.writeObject(ttInfoDetail);  
37 - }  
38 -  
39 - @Override  
40 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
41 - lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject();  
42 - ttInfoDetail = (TTInfoDetail) in.readObject();  
43 - }  
44 - }  
45 -  
46 - @Override  
47 - public Serializable createContext() {  
48 - return new LpInfoResultsData();  
49 - }  
50 -  
51 - @Override  
52 - public void init(Serializable context) throws Exception {  
53 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
54 - lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>();  
55 - lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>();  
56 - }  
57 -  
58 - @Override  
59 - public void accumulate(Serializable context, Object value) {  
60 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
61 - TTInfoDetail ttInfoDetail = (TTInfoDetail) value;  
62 -  
63 - if (ttInfoDetail.getLp() != null) {  
64 - if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) {  
65 - LpInfoResult_output lpInfoResult_output = new LpInfoResult_output();  
66 - lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId()));  
67 - lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId()));  
68 - lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId()));  
69 -  
70 - lpInfoResultsData.lpInfoResult_outputMap.put(  
71 - ttInfoDetail.getLp().getId(),  
72 - lpInfoResult_output);  
73 - }  
74 - }  
75 -  
76 - lpInfoResultsData.lpInfoResult_outputs.clear();  
77 - lpInfoResultsData.lpInfoResult_outputs.addAll(  
78 - lpInfoResultsData.lpInfoResult_outputMap.values());  
79 - }  
80 -  
81 - @Override  
82 - public boolean supportsReverse() {  
83 - return true;  
84 - }  
85 -  
86 - @Override  
87 - public void reverse(Serializable context, Object value) throws Exception {  
88 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
89 - TTInfoDetail ttInfoDetail = (TTInfoDetail) value;  
90 -  
91 - lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId());  
92 -  
93 - lpInfoResultsData.lpInfoResult_outputs.clear();  
94 - lpInfoResultsData.lpInfoResult_outputs.addAll(  
95 - lpInfoResultsData.lpInfoResult_outputMap.values());  
96 -  
97 - }  
98 -  
99 - @Override  
100 - public Object getResult(Serializable context) throws Exception {  
101 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
102 - return lpInfoResultsData.lpInfoResult_outputs;  
103 - }  
104 -  
105 - @Override  
106 - public Class<?> getResultType() {  
107 - return List.class;  
108 - }  
109 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoDetail;
  4 +import org.kie.api.runtime.rule.AccumulateFunction;
  5 +
  6 +import java.io.*;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * 路牌信息统计函数。
  14 + */
  15 +public class LpInfoResultsFunction implements AccumulateFunction {
  16 + @Override
  17 + public void writeExternal(ObjectOutput out) throws IOException {
  18 +
  19 + }
  20 +
  21 + @Override
  22 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  23 +
  24 + }
  25 +
  26 + protected static class LpInfoResultsData implements Externalizable {
  27 + public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  28 + public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>();
  29 + public TTInfoDetail ttInfoDetail;
  30 +
  31 + public LpInfoResultsData() {}
  32 +
  33 + @Override
  34 + public void writeExternal(ObjectOutput out) throws IOException {
  35 + out.writeObject(lpInfoResult_outputs);
  36 + out.writeObject(ttInfoDetail);
  37 + }
  38 +
  39 + @Override
  40 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  41 + lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject();
  42 + ttInfoDetail = (TTInfoDetail) in.readObject();
  43 + }
  44 + }
  45 +
  46 + @Override
  47 + public Serializable createContext() {
  48 + return new LpInfoResultsData();
  49 + }
  50 +
  51 + @Override
  52 + public void init(Serializable context) throws Exception {
  53 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  54 + lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>();
  55 + lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>();
  56 + }
  57 +
  58 + @Override
  59 + public void accumulate(Serializable context, Object value) {
  60 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  61 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  62 +
  63 + if (ttInfoDetail.getLp() != null) {
  64 + if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) {
  65 + LpInfoResult_output lpInfoResult_output = new LpInfoResult_output();
  66 + lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId()));
  67 + lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId()));
  68 + lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId()));
  69 +
  70 + lpInfoResultsData.lpInfoResult_outputMap.put(
  71 + ttInfoDetail.getLp().getId(),
  72 + lpInfoResult_output);
  73 + }
  74 + }
  75 +
  76 + lpInfoResultsData.lpInfoResult_outputs.clear();
  77 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  78 + lpInfoResultsData.lpInfoResult_outputMap.values());
  79 + }
  80 +
  81 + @Override
  82 + public boolean supportsReverse() {
  83 + return true;
  84 + }
  85 +
  86 + @Override
  87 + public void reverse(Serializable context, Object value) throws Exception {
  88 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  89 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  90 +
  91 + lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId());
  92 +
  93 + lpInfoResultsData.lpInfoResult_outputs.clear();
  94 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  95 + lpInfoResultsData.lpInfoResult_outputMap.values());
  96 +
  97 + }
  98 +
  99 + @Override
  100 + public Object getResult(Serializable context) throws Exception {
  101 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  102 + return lpInfoResultsData.lpInfoResult_outputs;
  103 + }
  104 +
  105 + @Override
  106 + public Class<?> getResultType() {
  107 + return List.class;
  108 + }
  109 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 -/**  
7 - * Created by xu on 17/3/21.  
8 - */  
9 -public class LpInfoResults_output {  
10 -  
11 - private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();  
12 -  
13 - public List<LpInfoResult_output> getLpInfoResult_outputs() {  
14 - return lpInfoResult_outputs;  
15 - }  
16 -  
17 - public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) {  
18 - this.lpInfoResult_outputs = lpInfoResult_outputs;  
19 - }  
20 -  
21 - public void add(LpInfoResult_output lpInfoResult_output) {  
22 -  
23 - }  
24 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * Created by xu on 17/3/21.
  8 + */
  9 +public class LpInfoResults_output {
  10 +
  11 + private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  12 +
  13 + public List<LpInfoResult_output> getLpInfoResult_outputs() {
  14 + return lpInfoResult_outputs;
  15 + }
  16 +
  17 + public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) {
  18 + this.lpInfoResult_outputs = lpInfoResult_outputs;
  19 + }
  20 +
  21 + public void add(LpInfoResult_output lpInfoResult_output) {
  22 +
  23 + }
  24 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/MinRuleQyrqFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  4 +import org.joda.time.DateTime;
  5 +import org.kie.api.runtime.rule.AccumulateFunction;
  6 +
  7 +import java.io.*;
  8 +
  9 +/**
  10 + * 最小的规则启用日期。
  11 + */
  12 +public class MinRuleQyrqFunction implements AccumulateFunction {
  13 + @Override
  14 + public void writeExternal(ObjectOutput out) throws IOException {
  15 + }
  16 +
  17 + @Override
  18 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  19 +
  20 + }
  21 +
  22 + protected static class MinRuleQyrqData implements Externalizable {
  23 + public DateTime min;
  24 +
  25 + public MinRuleQyrqData() {}
  26 +
  27 + @Override
  28 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  29 + min = (DateTime) in.readObject();
  30 + }
  31 +
  32 + @Override
  33 + public void writeExternal(ObjectOutput out) throws IOException {
  34 + out.writeObject(min);
  35 + }
  36 + }
  37 +
  38 + @Override
  39 + public Serializable createContext() {
  40 + return new MinRuleQyrqData();
  41 + }
  42 +
  43 + @Override
  44 + public void init(Serializable context) throws Exception {
  45 + // TODO:
  46 + }
  47 +
  48 + @Override
  49 + public void accumulate(Serializable context, Object value) {
  50 + MinRuleQyrqData minRuleQyrqData = (MinRuleQyrqData) context;
  51 + ScheduleRule_input scheduleRule_input = (ScheduleRule_input) value;
  52 +
  53 + if (minRuleQyrqData.min == null) {
  54 + minRuleQyrqData.min = scheduleRule_input.getQyrq();
  55 + } else if (scheduleRule_input.getQyrq().isBefore(minRuleQyrqData.min)) {
  56 + minRuleQyrqData.min = scheduleRule_input.getQyrq();
  57 + }
  58 + }
  59 +
  60 + @Override
  61 + public boolean supportsReverse() {
  62 + return false;
  63 + }
  64 +
  65 + @Override
  66 + public void reverse(Serializable serializable, Object o) throws Exception {
  67 +
  68 + }
  69 +
  70 + @Override
  71 + public Class<?> getResultType() {
  72 + return DateTime.class;
  73 + }
  74 +
  75 + @Override
  76 + public Object getResult(Serializable context) throws Exception {
  77 + MinRuleQyrqData minRuleQyrqData = (MinRuleQyrqData) context;
  78 + return minRuleQyrqData.min;
  79 + }
  80 +}
  81 +
  82 +
  83 +
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +
  90 +
  91 +
  92 +
  93 +
  94 +
  95 +
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
1 package com.bsth.websocket.handler; 1 package com.bsth.websocket.handler;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.common.Constants;
4 import com.bsth.data.BasicData; 5 import com.bsth.data.BasicData;
5 import com.google.common.base.Splitter; 6 import com.google.common.base.Splitter;
6 import com.google.common.collect.ArrayListMultimap; 7 import com.google.common.collect.ArrayListMultimap;
@@ -107,6 +108,10 @@ public class RealControlSocketHandler implements WebSocketHandler { @@ -107,6 +108,10 @@ public class RealControlSocketHandler implements WebSocketHandler {
107 user.sendMessage(message); 108 user.sendMessage(message);
108 } 109 }
109 } catch (Exception e) { 110 } catch (Exception e) {
  111 + try{
  112 + logger.error("error user...."+user.getAttributes().get(Constants.SESSION_USERNAME));
  113 + }
  114 + catch(Exception e2){}
110 logger.error("sendMessageToLine error ...."+msg); 115 logger.error("sendMessageToLine error ...."+msg);
111 logger.error("sendMessageToLine error ....", e); 116 logger.error("sendMessageToLine error ....", e);
112 } 117 }
src/main/resources/rules/functions.drl
@@ -3,4 +3,5 @@ package com.bsth.service.schedule; @@ -3,4 +3,5 @@ package com.bsth.service.schedule;
3 import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; 3 import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;
4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; 4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; 5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
6 -import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;  
7 \ No newline at end of file 6 \ No newline at end of file
  7 +import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
  8 +import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq
8 \ No newline at end of file 9 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
1 -package com.bsth.service.schedule.shiftloop;  
2 -  
3 -import org.joda.time.*;  
4 -import java.util.*;  
5 -  
6 -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;  
7 -  
8 -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;  
9 -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;  
10 -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;  
11 -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;  
12 -  
13 -import org.slf4j.Logger;  
14 -  
15 -global Logger log;  
16 -global ScheduleResults_output scheduleResult;  
17 -  
18 -/*  
19 - 存在(翻班格式)  
20 -*/  
21 -  
22 -//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//  
23 -  
24 -declare Calcu_days_result_pre  
25 - ruleId: String // 规则Id  
26 -  
27 - calcu_index_lp : Integer // 计算之后路牌的起始索引  
28 - calcu_index_ry : Integer // 计算之后人员的起始索引  
29 -  
30 - // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)  
31 - calcu_start_date_1: DateTime // 第一部分开始计算日期  
32 - calcu_end_date_1: DateTime // 第一部分结束计算日期  
33 -  
34 - // 2、第二部分循环需要用到的数据  
35 - sdays : Integer // 总共需要排班的天数  
36 - calcu_start_date_2 : DateTime // 开始计算日期  
37 - calcu_end_date_2 : DateTime // 结束计算日期  
38 -  
39 -end  
40 -  
41 -/*  
42 - 计算启用日期,开始计算日期,结束计算日期,相差天数  
43 - 1、规则启用日期小于开始计算日期  
44 - 2、规则启用日期大于等于开始日期,小于等于结束日期  
45 -*/  
46 -// 1、启用日期 < 开始日期  
47 -rule "calcu_days_1_"  
48 - salience 1000  
49 - when  
50 - ScheduleCalcuParam_input(  
51 - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),  
52 - $fromDate : fromDate,  
53 - $toDate : toDate  
54 - )  
55 - ScheduleRule_input(  
56 - $ruleId : ruleId, $qyrq : qyrq,  
57 - $lpindex : startGbdIndex, $ryindex: startEIndex)  
58 - eval($qyrq.isBefore($fromDate))  
59 - then  
60 - // 构造Calcu_days_result_pre,用于路牌  
61 - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();  
62 - cdrp.setRuleId($ruleId);  
63 - cdrp.setCalcu_index_lp($lpindex);  
64 - cdrp.setCalcu_index_ry($ryindex);  
65 - cdrp.setCalcu_start_date_1($qyrq);  
66 - cdrp.setCalcu_end_date_1($fromDate);  
67 - Period p2 = new Period($fromDate, $toDate, PeriodType.days());  
68 - cdrp.setSdays(p2.getDays() + 1);  
69 - cdrp.setCalcu_start_date_2($fromDate);  
70 - cdrp.setCalcu_end_date_2($toDate);  
71 -  
72 - insert(cdrp);  
73 -  
74 - log.info("总共需要排班的天数 sdays={} ruleId={}", (p2.getDays() + 1), $ruleId);  
75 -  
76 -end  
77 -  
78 -// 启用日期 属于 [开始日期,结束日期]  
79 -rule "calcu_days_2_"  
80 - salience 1000  
81 - when  
82 - ScheduleCalcuParam_input(  
83 - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),  
84 - $fromDate : fromDate,  
85 - $toDate : toDate  
86 - )  
87 - ScheduleRule_input(  
88 - $ruleId : ruleId, $qyrq : qyrq,  
89 - $lpindex : startGbdIndex, $ryindex: startEIndex)  
90 - eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))  
91 - then  
92 - // 构造Calcu_days_result_pre,用于路牌  
93 - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();  
94 - cdrp.setRuleId($ruleId);  
95 - cdrp.setCalcu_index_lp($lpindex);  
96 - cdrp.setCalcu_index_ry($ryindex);  
97 - cdrp.setCalcu_start_date_1($qyrq);  
98 - cdrp.setCalcu_end_date_1($qyrq);  
99 - Period p2 = new Period($qyrq, $toDate, PeriodType.days());  
100 - cdrp.setSdays(p2.getDays() + 1);  
101 - cdrp.setCalcu_start_date_2($qyrq);  
102 - cdrp.setCalcu_end_date_2($toDate);  
103 -  
104 - insert(cdrp);  
105 -  
106 - log.info("总共需要排班的天数 sdays={} ruleId={}", (p2.getDays() + 1), $ruleId);  
107 -  
108 -end  
109 -  
110 -//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//  
111 -rule "Calcu_loop1_1_" // 时刻表的关联的路牌不存在,调整翻版规则  
112 - salience 900  
113 - when  
114 - $cdrp: Calcu_days_result_pre(  
115 - calcu_start_date_1.isBefore(calcu_end_date_1),  
116 - $csd1: calcu_start_date_1,  
117 - $ced1: calcu_end_date_1,  
118 - $ruleId: ruleId,  
119 - $lpindex: calcu_index_lp,  
120 - $ryindex: calcu_index_ry  
121 - )  
122 - $sri: ScheduleRule_input(  
123 - ruleId == $ruleId,  
124 - $gids: guideboardIds,  
125 - $lprangesize : guideboardIds.size(),  
126 - $ryrangesize: employeeConfigIds.size()  
127 - )  
128 - $liro: LpInfoResult_output(  
129 - dateTime.isEqual($csd1),  
130 - $gids.get($lpindex) == lpId,  
131 - $lpId: lpId  
132 - )  
133 - then  
134 - $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);  
135 - $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);  
136 - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));  
137 -  
138 - log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",  
139 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());  
140 -  
141 - update($cdrp);  
142 -end  
143 -  
144 -rule "Calcu_loop1_2_" // 时刻表的关联路牌存在,就翻  
145 - salience 800  
146 - when  
147 - $cdrp: Calcu_days_result_pre(  
148 - calcu_start_date_1.isBefore(calcu_end_date_1),  
149 - $csd1: calcu_start_date_1,  
150 - $ced1: calcu_end_date_1,  
151 - $ruleId: ruleId  
152 - )  
153 - $sri: ScheduleRule_input(  
154 - ruleId == $ruleId,  
155 - $rangesize : guideboardIds.size()  
156 - )  
157 - then  
158 - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));  
159 -  
160 - log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",  
161 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());  
162 -  
163 - update($cdrp);  
164 -end  
165 -  
166 -  
167 -//----------------------- 路牌范围循环计算 ------------------------//  
168 -  
169 -//declare Calcu_guideboard_index_result  
170 -// ruleId : String // 规则Id  
171 -// calcu_index : Integer // 计算之后的起始索引  
172 -//end  
173 -//  
174 -//// 启用日期等于开始日期  
175 -//rule "calcu_guideboard_index_qyrq_eq_startrq"  
176 -// when  
177 -// $calcu_days_result : Calcu_days_result(  
178 -// qyrq_days == 0,  
179 -// $ruleId: ruleId  
180 -// )  
181 -// $scheduleRule_input : ScheduleRule_input(  
182 -// ruleId == $ruleId,  
183 -// $oindex : startGbdIndex  
184 -// )  
185 -// then  
186 -// Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();  
187 -// cgir.setRuleId($ruleId);  
188 -// cgir.setCalcu_index($oindex);  
189 -//  
190 -// log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
191 -//  
192 -// insert(cgir);  
193 -//end  
194 -//  
195 -//// 开始日期大于启用日期  
196 -//rule "calcu_guideboard_index_startrq_gt_qyrq"  
197 -// when  
198 -// $calcu_days_result : Calcu_days_result(  
199 -// qyrq_days > 0,  
200 -// $ruleId: ruleId, $qyrq_days: qyrq_days,  
201 -// $calcu_start_date: calcu_start_date  
202 -// )  
203 -// $scheduleRule_input : ScheduleRule_input(  
204 -// ruleId == $ruleId,  
205 -// $qyrq: qyrq,  
206 -// $rangesize : guideboardIds.size(),  
207 -// $oindex : startGbdIndex,  
208 -// $weekdays: weekdays  
209 -// )  
210 -// then  
211 -// // 开始时间  
212 -// DateTime initDate = $qyrq;  
213 -// int index = $oindex;  
214 -// int resultIndex = index;  
215 -//  
216 -// while (!initDate.isAfter($calcu_start_date)) {  
217 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
218 -// resultIndex = index;  
219 -// index = (index + 1) % $rangesize;  
220 -// }  
221 -// initDate = initDate.plusDays(1);  
222 -// }  
223 -//  
224 -// Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();  
225 -// cgir.setRuleId($ruleId);  
226 -// cgir.setCalcu_index(resultIndex);  
227 -//  
228 -// log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
229 -//  
230 -// insert(cgir);  
231 -//end  
232 -//  
233 -////----------------------- 人员范围循环计算 ------------------------//  
234 -//  
235 -//declare Calcu_employee_index_result  
236 -// ruleId : String // 规则Id  
237 -// calcu_index : Integer // 计算之后的起始索引  
238 -//end  
239 -//  
240 -//// 启用日期等于开始日期  
241 -//rule "calcu_employee_index_qyrq_eq_startrq"  
242 -// when  
243 -// $calcu_days_result : Calcu_days_result(  
244 -// qyrq_days == 0,  
245 -// $ruleId: ruleId)  
246 -// $scheduleRule_input : ScheduleRule_input(  
247 -// ruleId == $ruleId,  
248 -// $oindex : startEIndex)  
249 -// then  
250 -// Calcu_employee_index_result cgir = new Calcu_employee_index_result();  
251 -// cgir.setRuleId($ruleId);  
252 -// cgir.setCalcu_index($oindex);  
253 -//  
254 -// log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
255 -//  
256 -// insert(cgir);  
257 -//end  
258 -//  
259 -//// 开始日期大于启用日期  
260 -//rule "calcu_employee_index_startrq_gt_qyrq"  
261 -// when  
262 -// $calcu_days_result : Calcu_days_result(  
263 -// qyrq_days > 0,  
264 -// $ruleId: ruleId, $qyrq_days: qyrq_days,  
265 -// $calcu_start_date: calcu_start_date  
266 -// )  
267 -// $scheduleRule_input : ScheduleRule_input(  
268 -// ruleId == $ruleId,  
269 -// $qyrq: qyrq,  
270 -// $rangesize : employeeConfigIds.size(),  
271 -// $oindex : startEIndex,  
272 -// $weekdays: weekdays  
273 -// )  
274 -// then  
275 -// // 开始时间  
276 -// DateTime initDate = $qyrq;  
277 -// int index = $oindex;  
278 -// int resultIndex = index;  
279 -//  
280 -// while (!initDate.isAfter($calcu_start_date)) {  
281 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
282 -// resultIndex = index;  
283 -// index = (index + 1) % $rangesize;  
284 -// }  
285 -// initDate = initDate.plusDays(1);  
286 -// }  
287 -//  
288 -// Calcu_employee_index_result cgir = new Calcu_employee_index_result();  
289 -// cgir.setRuleId($ruleId);  
290 -// cgir.setCalcu_index(resultIndex);  
291 -//  
292 -// log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
293 -//  
294 -// insert(cgir);  
295 -//  
296 -//end  
297 -//  
298 -////------------------------- 第三阶段、循环计算 ------------------------//  
299 -//  
300 -////----------------------- 路牌范围循环计算 ------------------------//  
301 -//declare loop_guideboard_result  
302 -// ruleId : String // 规则id  
303 -// go_list : List // 路牌循环的列表  
304 -//end  
305 -//  
306 -//// 循环路牌计算  
307 -//rule "Calcu_loop_guideboard_result"  
308 -// when  
309 -// Calcu_days_result(  
310 -// $ruleId: ruleId,  
311 -// $startDate : calcu_start_date,  
312 -// $calcu_end_date: calcu_end_date  
313 -// )  
314 -// $ruleData : ScheduleRule_input(  
315 -// ruleId == $ruleId,  
316 -// $rangesize : guideboardIds.size(),  
317 -// $weekdays: weekdays  
318 -// )  
319 -// $indexData : Calcu_guideboard_index_result(  
320 -// ruleId == $ruleId  
321 -// )  
322 -// then  
323 -// DateTime initDate = $startDate; // 开始时间  
324 -// DateTime endDate = $calcu_end_date; // 结束实际  
325 -// List<ScheduleResult_output> scheduleResult_outputs =  
326 -// new ArrayList<ScheduleResult_output>();  
327 -//  
328 -// int i = $indexData.getCalcu_index();  
329 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {  
330 -// i = (i + 1) % $rangesize;  
331 -// }  
332 -//  
333 -// while (!initDate.isAfter(endDate)) {  
334 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
335 -// ScheduleResult_output ro = new ScheduleResult_output();  
336 -// ro.setRuleId($ruleId);  
337 -// ro.setSd(initDate);  
338 -// ro.setGuideboardId($ruleData.getGuideboardIds().get(i));  
339 -// ro.setCarConfigId($ruleData.getCarConfigId());  
340 -// scheduleResult_outputs.add(ro);  
341 -//  
342 -// i = (i + 1) % $rangesize;  
343 -// }  
344 -//  
345 -// initDate = initDate.plusDays(1);  
346 -// }  
347 -//  
348 -// loop_guideboard_result clgr = new loop_guideboard_result();  
349 -// clgr.setRuleId($ruleId);  
350 -// clgr.setGo_list(scheduleResult_outputs);  
351 -//  
352 -// log.info(String.valueOf(scheduleResult_outputs.size()));  
353 -//  
354 -// insert(clgr);  
355 -//  
356 -//end  
357 -//  
358 -////----------------------- 人员范围循环计算 ------------------------//  
359 -//declare loop_employee_result  
360 -// ruleId : String // 规则id  
361 -// eo_list : List // 人员循环的列表  
362 -//end  
363 -//  
364 -//// 循环人员计算  
365 -//rule "Calcu_loop_employee_result"  
366 -// when  
367 -// Calcu_days_result(  
368 -// $ruleId: ruleId,  
369 -// $startDate : calcu_start_date,  
370 -// $calcu_end_date: calcu_end_date  
371 -// )  
372 -// $ruleData : ScheduleRule_input(  
373 -// ruleId == $ruleId,  
374 -// $rangesize : employeeConfigIds.size(),  
375 -// $weekdays: weekdays  
376 -// )  
377 -// $indexData : Calcu_employee_index_result(  
378 -// ruleId == $ruleId  
379 -// )  
380 -// then  
381 -// DateTime initDate = $startDate; // 开始时间  
382 -// DateTime endDate = $calcu_end_date; // 结束实际  
383 -// List<ScheduleResult_output> scheduleResult_outputs =  
384 -// new ArrayList<ScheduleResult_output>();  
385 -//  
386 -// int i = $indexData.getCalcu_index();  
387 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {  
388 -// i = (i + 1) % $rangesize;  
389 -// }  
390 -//  
391 -// while (!initDate.isAfter(endDate)) {  
392 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
393 -// ScheduleResult_output ro = new ScheduleResult_output();  
394 -// ro.setRuleId($ruleId);  
395 -// ro.setSd(initDate);  
396 -// ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));  
397 -// ro.setCarConfigId($ruleData.getCarConfigId());  
398 -// scheduleResult_outputs.add(ro);  
399 -//  
400 -// i = (i + 1) % $rangesize;  
401 -// }  
402 -//  
403 -// initDate = initDate.plusDays(1);  
404 -// }  
405 -//  
406 -// loop_employee_result clgr = new loop_employee_result();  
407 -// clgr.setRuleId($ruleId);  
408 -// clgr.setEo_list(scheduleResult_outputs);  
409 -//  
410 -// log.info(String.valueOf(scheduleResult_outputs.size()));  
411 -//  
412 -// insert(clgr);  
413 -//end  
414 -//  
415 -////------------------------- 第四阶段、范围组循环计算 ----------------------------//  
416 -//  
417 -//global ScheduleResults_output scheduleResult;  
418 -//  
419 -//rule "output"  
420 -// when  
421 -// loop_guideboard_result(  
422 -// go_list.size() > 0,  
423 -// $ruleId : ruleId, $go_list : go_list  
424 -// )  
425 -// loop_employee_result(  
426 -// ruleId == $ruleId,  
427 -// eo_list.size() == $go_list.size(),  
428 -// $eo_list : eo_list  
429 -// )  
430 -// then  
431 -// for (int i = 0; i < $go_list.size(); i++) {  
432 -// ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i);  
433 -// ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i);  
434 -// go.setEmployeeConfigId(eo.getEmployeeConfigId());  
435 -// scheduleResult.getResults().add(go);  
436 -// }  
437 -//  
438 -//end  
439 -//  
440 -//  
441 -//  
442 -//  
443 -//  
444 -//  
445 -//  
446 -//  
447 -//  
448 -//  
449 -//  
450 -//  
451 -//  
452 -//  
453 -  
454 - 1 +package com.bsth.service.schedule.shiftloop;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  7 +
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  10 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  11 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  12 +
  13 +import org.slf4j.Logger;
  14 +
  15 +global Logger log;
  16 +global ScheduleResults_output scheduleResult;
  17 +
  18 +/*
  19 + 存在(翻班格式)
  20 +*/
  21 +
  22 +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
  23 +
  24 +declare Calcu_days_result_pre
  25 + ruleId: String // 规则Id
  26 +
  27 + calcu_index_lp : Integer // 计算之后路牌的起始索引
  28 + calcu_index_ry : Integer // 计算之后人员的起始索引
  29 +
  30 + // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)
  31 + calcu_start_date_1: DateTime // 第一部分开始计算日期
  32 + calcu_end_date_1: DateTime // 第一部分结束计算日期
  33 +
  34 + // 2、第二部分循环需要用到的数据
  35 + sdays : Integer // 总共需要排班的天数
  36 + calcu_start_date_2 : DateTime // 开始计算日期
  37 + calcu_end_date_2 : DateTime // 结束计算日期
  38 +
  39 +end
  40 +
  41 +/*
  42 + 计算启用日期,开始计算日期,结束计算日期,相差天数
  43 + 1、规则启用日期小于开始计算日期
  44 + 2、规则启用日期大于等于开始日期,小于等于结束日期
  45 +*/
  46 +// 1、启用日期 < 开始日期
  47 +rule "calcu_days_1_"
  48 + salience 1000
  49 + when
  50 + ScheduleCalcuParam_input(
  51 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  52 + $fromDate : fromDate,
  53 + $toDate : toDate
  54 + )
  55 + ScheduleRule_input(
  56 + $ruleId : ruleId, $qyrq : qyrq,
  57 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  58 + eval($qyrq.isBefore($fromDate))
  59 + then
  60 + // 构造Calcu_days_result_pre,用于路牌
  61 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  62 + cdrp.setRuleId($ruleId);
  63 + cdrp.setCalcu_index_lp($lpindex);
  64 + cdrp.setCalcu_index_ry($ryindex);
  65 + cdrp.setCalcu_start_date_1($qyrq);
  66 + cdrp.setCalcu_end_date_1($fromDate);
  67 + Period p2 = new Period($fromDate, $toDate, PeriodType.days());
  68 + cdrp.setSdays(p2.getDays() + 1);
  69 + cdrp.setCalcu_start_date_2($fromDate);
  70 + cdrp.setCalcu_end_date_2($toDate);
  71 +
  72 + insert(cdrp);
  73 +
  74 + log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
  75 +
  76 +end
  77 +
  78 +// 启用日期 属于 [开始日期,结束日期]
  79 +rule "calcu_days_2_"
  80 + salience 1000
  81 + when
  82 + ScheduleCalcuParam_input(
  83 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  84 + $fromDate : fromDate,
  85 + $toDate : toDate
  86 + )
  87 + ScheduleRule_input(
  88 + $ruleId : ruleId, $qyrq : qyrq,
  89 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  90 + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
  91 + then
  92 + // 构造Calcu_days_result_pre,用于路牌
  93 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  94 + cdrp.setRuleId($ruleId);
  95 + cdrp.setCalcu_index_lp($lpindex);
  96 + cdrp.setCalcu_index_ry($ryindex);
  97 + cdrp.setCalcu_start_date_1($qyrq);
  98 + cdrp.setCalcu_end_date_1($qyrq);
  99 + Period p2 = new Period($qyrq, $toDate, PeriodType.days());
  100 + cdrp.setSdays(p2.getDays() + 1);
  101 + cdrp.setCalcu_start_date_2($qyrq);
  102 + cdrp.setCalcu_end_date_2($toDate);
  103 +
  104 + insert(cdrp);
  105 +
  106 + log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
  107 +
  108 +end
  109 +
  110 +//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//
  111 +rule "Calcu_loop1_1_" // 路牌在时刻表中存在,就翻
  112 + salience 900
  113 + when
  114 + $cdrp: Calcu_days_result_pre(
  115 + calcu_start_date_1.isBefore(calcu_end_date_1),
  116 + $csd1: calcu_start_date_1,
  117 + $ced1: calcu_end_date_1,
  118 + $ruleId: ruleId,
  119 + $lpindex: calcu_index_lp,
  120 + $ryindex: calcu_index_ry
  121 + )
  122 + $sri: ScheduleRule_input(
  123 + ruleId == $ruleId,
  124 + $gids: guideboardIds,
  125 + $lprangesize : guideboardIds.size(),
  126 + $ryrangesize: employeeConfigIds.size()
  127 + )
  128 + $liro: LpInfoResult_output(
  129 + dateTime.isEqual($csd1),
  130 + $gids.get($lpindex) == lpId,
  131 + $lpId: lpId
  132 + )
  133 + then
  134 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  135 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  136 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  137 +
  138 + log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",
  139 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
  140 +
  141 + update($cdrp);
  142 +end
  143 +
  144 +rule "Calcu_loop1_2_" // 路牌在时刻表中不存在,就不翻
  145 + salience 900
  146 + when
  147 + $cdrp: Calcu_days_result_pre(
  148 + calcu_start_date_1.isBefore(calcu_end_date_1),
  149 + $csd1: calcu_start_date_1,
  150 + $ced1: calcu_end_date_1,
  151 + $ruleId: ruleId
  152 + )
  153 + $sri: ScheduleRule_input(
  154 + ruleId == $ruleId,
  155 + $rangesize : guideboardIds.size()
  156 + )
  157 + then
  158 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  159 +
  160 + log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",
  161 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
  162 +
  163 + update($cdrp);
  164 +end
  165 +
  166 +//------------------------- 第三阶段、计算规则准备数据2(第二组循环) ----------------------------//
  167 +rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻
  168 + salience 800
  169 + when
  170 + $cdrp: Calcu_days_result_pre(
  171 + calcu_start_date_1.isEqual(calcu_end_date_1),
  172 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  173 + $csd2: calcu_start_date_2,
  174 + $ced2: calcu_end_date_2,
  175 + $ruleId: ruleId,
  176 + $lpindex: calcu_index_lp,
  177 + $ryindex: calcu_index_ry
  178 + )
  179 + $sri: ScheduleRule_input(
  180 + ruleId == $ruleId,
  181 + $cid: carConfigId,
  182 + $gids: guideboardIds,
  183 + $eids: employeeConfigIds,
  184 + $lprangesize : guideboardIds.size(),
  185 + $ryrangesize: employeeConfigIds.size()
  186 + )
  187 + $liro: LpInfoResult_output(
  188 + dateTime.isEqual($csd2),
  189 + $gids.get($lpindex) == lpId,
  190 + $lpId: lpId
  191 + )
  192 + then
  193 + ScheduleResult_output ro = new ScheduleResult_output();
  194 + ro.setRuleId($ruleId);
  195 + ro.setSd($csd2);
  196 + ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  197 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  198 + ro.setCarConfigId($cid);
  199 +
  200 + scheduleResult.getResults().add(ro);
  201 +
  202 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  203 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  204 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  205 +
  206 + log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  207 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  208 +
  209 + update($cdrp);
  210 +end
  211 +
  212 +rule "Calcu_loop2_2_" // 路牌在时刻表中不存在,就不翻
  213 + salience 800
  214 + when
  215 + $cdrp: Calcu_days_result_pre(
  216 + calcu_start_date_1.isEqual(calcu_end_date_1),
  217 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  218 + $csd2: calcu_start_date_2,
  219 + $ced2: calcu_end_date_2,
  220 + $ruleId: ruleId,
  221 + $lpindex: calcu_index_lp,
  222 + $ryindex: calcu_index_ry
  223 + )
  224 + $sri: ScheduleRule_input(
  225 + ruleId == $ruleId,
  226 + $cid: carConfigId,
  227 + $gids: guideboardIds,
  228 + $eids: employeeConfigIds
  229 +
  230 + )
  231 + then
  232 + ScheduleResult_output ro = new ScheduleResult_output();
  233 + ro.setRuleId($ruleId);
  234 + ro.setSd($csd2);
  235 + ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  236 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  237 + ro.setCarConfigId($cid);
  238 +
  239 + scheduleResult.getResults().add(ro);
  240 +
  241 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  242 +
  243 + log.info("Calcu_loop2_2_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  244 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  245 +
  246 + update($cdrp);
  247 +end
  248 +
  249 +
  250 +
  251 +
  252 +
  253 +
src/main/resources/rules/ttinfo.drl
@@ -10,6 +10,8 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; @@ -10,6 +10,8 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
10 import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; 10 import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
11 import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output; 11 import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output;
12 12
  13 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  14 +
13 import com.bsth.service.schedule.TTInfoDetailService; 15 import com.bsth.service.schedule.TTInfoDetailService;
14 16
15 import com.bsth.entity.schedule.TTInfo; 17 import com.bsth.entity.schedule.TTInfo;
@@ -38,7 +40,18 @@ function Map ttidParams(List ttinfolist) { @@ -38,7 +40,18 @@ function Map ttidParams(List ttinfolist) {
38 TODO:规则说明,以后待说明 40 TODO:规则说明,以后待说明
39 */ 41 */
40 42
41 -// TODO: 43 +//----------------- pre 预处理 param对象 -----------------------//
  44 +
  45 +rule "pre_calcu_TTInfoCalcuParam_input"
  46 + no-loop
  47 + salience 1000
  48 + when
  49 + $ttp: TTInfoCalcuParam_input($xlId : xlId)
  50 + $minqyrq: DateTime() from accumulate ($sri: ScheduleRule_input(xlId == $xlId), minruleqyrq($sri))
  51 + then
  52 + $ttp.setFromDate($minqyrq);
  53 + update($ttp);
  54 +end
42 55
43 //----------------- 第一阶段、计算规则准备数据(天数)----------------// 56 //----------------- 第一阶段、计算规则准备数据(天数)----------------//
44 57
src/main/resources/static/pages/oil/add.html
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <ul class="page-breadcrumb breadcrumb"> 7 <ul class="page-breadcrumb breadcrumb">
8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> 8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9 <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li> 9 <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
10 - <li><a href="list.html" data-pjax>进场场油量</a> <i class="fa fa-circle"></i></li> 10 + <li><a href="list_ph.html" data-pjax>进场场油量</a> <i class="fa fa-circle"></i></li>
11 <li><span class="active">进场站油量信息编辑</span></li> 11 <li><span class="active">进场站油量信息编辑</span></li>
12 </ul> 12 </ul>
13 13
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <div class="form-group"> 46 <div class="form-group">
47 <label class="col-md-3 control-label">开始营运日期</label> 47 <label class="col-md-3 control-label">开始营运日期</label>
48 <div class="col-md-4"> 48 <div class="col-md-4">
49 - <input type="text" class="form-control" name="jhsj" > 49 + <input type="time" class="form-control" name="jhsj" >
50 <span class="help-block"> 如:12:12</span> 50 <span class="help-block"> 如:12:12</span>
51 </div> 51 </div>
52 </div> 52 </div>
@@ -326,33 +326,26 @@ @@ -326,33 +326,26 @@
326 submitHandler : function(f) { 326 submitHandler : function(f) {
327 var params = form.serializeJSON(); 327 var params = form.serializeJSON();
328 error.hide(); 328 error.hide();
329 - 329 + var nbbm=$("#nbbm").val();
  330 + var date=$("#date").val();
  331 + var jsy=$("#jsy").val();
  332 + var map={};
  333 + map["nbbm"]=nbbm;
  334 + map["date"]=date;
  335 + map["jsy"]=jsy;
330 //检查一下用户是否存在 336 //检查一下用户是否存在
331 - $post('/ylb/saveYlb', params, function(){  
332 - layer.msg('添加信息成功.');  
333 - loadPage('list.html');  
334 - });  
335 -// $get('/user/all', {userName_eq: params.userName}, function(list){  
336 -// if(!list || list.length == 0){  
337 - /* console.log(params);  
338 - $.ajax({  
339 - url: '/ylb/saveYlb',  
340 - type: 'POST',  
341 - traditional: true,  
342 - data: params,  
343 - success: function(res){  
344 - layer.msg('添加信息成功.');  
345 - loadPage('list.html');  
346 - }  
347 - }); */  
348 - /* $post('/user', params, function(res){  
349 - layer.msg('添加用户成功.'); 337 + $get('/ylb/checkYl', map, function(fage){
  338 + console.log(fage);
  339 + if(fage!=""){
  340 + layer.msg('该驾驶员当天已存在.');
  341 + }else{
  342 + $post('/ylb/saveYlb', params, function(){
  343 + layer.msg('添加信息成功.');
350 loadPage('list.html'); 344 loadPage('list.html');
351 - }); */  
352 -// }  
353 -// else  
354 -// layer.alert('用户【' + params.userName + '】已存在', {icon: 2, title: '提交被拒绝'});  
355 -// }); 345 + });
  346 + }
  347 +
  348 + });
356 } 349 }
357 }); 350 });
358 }); 351 });
src/main/resources/static/pages/oil/list_ph.html
@@ -203,38 +203,46 @@ @@ -203,38 +203,46 @@
203 {{obj.xlname}} 203 {{obj.xlname}}
204 </td> 204 </td>
205 <td> 205 <td>
206 - {{obj.nbbm}} 206 + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
  207 +
207 </td> 208 </td>
208 <td> 209 <td>
209 {{obj.jsy}} 210 {{obj.jsy}}
210 </td> 211 </td>
211 <td> 212 <td>
212 - {{obj.jzl}} 213 +
  214 + <lable data-id="{{obj.id}}" class="in_carpark_jzl"> {{obj.jzl}}</lable>
213 </td> 215 </td>
214 <td> 216 <td>
215 - {{obj.czyl}} 217 +
  218 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_czyl"
  219 + type="text" value=" {{obj.czyl}}" style=" width:40px"
  220 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  221 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
216 </td> 222 </td>
217 <td> 223 <td>
218 <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl" 224 <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl"
219 -type="text" value=" {{obj.jzyl}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
220 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')"> 225 + type="text" value=" {{obj.jzyl}}" style=" width:40px"
  226 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  227 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
221 </td> 228 </td>
222 <td> 229 <td>
223 - {{obj.yh}} 230 + {{obj.yh}}
224 </td> 231 </td>
225 <td> 232 <td>
226 - <select data-id="{{obj.id}}" class="in_carpark_rylx"> 233 + <select data-id="{{obj.id}}" class="in_carpark_rylx" style=" width:80px" >
227 <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option> 234 <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option>
228 <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option> 235 <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option>
229 </select> 236 </select>
230 </td> 237 </td>
231 <td> 238 <td>
232 <input data-id="{{obj.id}}" href="javascript:;" 239 <input data-id="{{obj.id}}" href="javascript:;"
233 -class="in_carpark_ns" type="text" value=" {{obj.ns}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
234 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')"> 240 + class="in_carpark_ns" type="text" value=" {{obj.ns}}" style=" width:40px"
  241 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  242 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
235 </td> 243 </td>
236 <td> 244 <td>
237 - <select data-id="{{obj.id}}" class="in_carpark_shyy"> 245 + <select data-id="{{obj.id}}" class="in_carpark_shyy" style=" width:80px">
238 <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option> 246 <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option>
239 <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option> 247 <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option>
240 <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option> 248 <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option>
@@ -247,15 +255,20 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot;&gt; @@ -247,15 +255,20 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot;&gt;
247 </select> 255 </select>
248 </td> 256 </td>
249 <td> 257 <td>
250 - <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" type="text"  
251 -value=" {{obj.sh}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
252 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')" >  
253 - </td> 258 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl"
  259 + value={{obj.sh}} style=" width:40px" type="text"
  260 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  261 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  262 +
  263 +</td>
254 <td> 264 <td>
255 {{obj.zlc}} 265 {{obj.zlc}}
256 </td> 266 </td>
257 <td> 267 <td>
258 - {{obj.yhlx}} 268 + <select data-id="{{obj.id}}" class="in_carpark_yhlx">
  269 + <option value='0' {{if obj.yhlx==0}} selected = 'selected' {{/if}}>手录</option>
  270 + <option value='1' {{if obj.yhlx==1}} selected = 'selected' {{/if}}>拆分</option>
  271 + </select>
259 </td> 272 </td>
260 <td> 273 <td>
261 {{obj.bglyh}} 274 {{obj.bglyh}}
@@ -307,48 +320,105 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt; @@ -307,48 +320,105 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
307 //保存 320 //保存
308 $("#saveButton").on('click',function(){ 321 $("#saveButton").on('click',function(){
309 var ylArray = []; 322 var ylArray = [];
310 - /* $('input.icheck:checked').each(function(){  
311 - var map = {};  
312 - var id=$(this).data('id');  
313 - var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();  
314 - var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').html();  
315 - var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();  
316 - map['id']=id;  
317 - map['jzyl']=jzyl;  
318 - map['sh']=sh;  
319 - map['shyy']=shyy;  
320 - ylArray.push(map);  
321 - }) */  
322 -  
323 $('input.icheck').each(function(){ 323 $('input.icheck').each(function(){
324 var map = {}; 324 var map = {};
325 var id=$(this).data('id'); 325 var id=$(this).data('id');
  326 + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html();
  327 + if(jzl=="" || jzl ==null){
  328 + jzl=0;
  329 + }
  330 + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val();
  331 + if(czyl=="" || czyl==null){
  332 + czyl=0;
  333 + }
326 var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); 334 var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  335 + if(jzyl=="" || jzyl==null){
  336 + jzyl=0;
  337 + }
  338 +
327 var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); 339 var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  340 + if(sh=="" || sh==null){
  341 + sh=0;
  342 + }
  343 +
328 var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); 344 var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
329 var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); 345 var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  346 + if(ns=="" || ns==null){
  347 + ns=0;
  348 + }
  349 +
330 var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); 350 var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val();
  351 + var yhlx = $('.in_carpark_yhlx[data-id='+id+']', '#ll_oil_list').val();
  352 +
331 map['id']=id; 353 map['id']=id;
  354 + map['jzl']=jzl;
  355 + map['czyl']=czyl;
332 map['jzyl']=jzyl; 356 map['jzyl']=jzyl;
333 map['sh']=sh; 357 map['sh']=sh;
334 map['shyy']=shyy; 358 map['shyy']=shyy;
335 map['ns']=ns; 359 map['ns']=ns;
336 map['rylx']=rylx; 360 map['rylx']=rylx;
  361 + map['yhlx']=yhlx;
337 ylArray.push(map); 362 ylArray.push(map);
338 }) 363 })
339 var params = {}; 364 var params = {};
340 params['ylbList']=JSON.stringify(ylArray); 365 params['ylbList']=JSON.stringify(ylArray);
  366 + console.log(JSON.stringify(ylArray));
341 var i = layer.load(2); 367 var i = layer.load(2);
342 - $get('/ylb/saveYlbList', params, function () { 368 + $post('/ylb/saveYlbList', params, function () {
343 layer.close(i); 369 layer.close(i);
344 var params1 =getParamsList(); 370 var params1 =getParamsList();
345 jsDoQuery(params1, true); 371 jsDoQuery(params1, true);
346 - }); 372 + });
347 }) 373 })
348 //拆分 374 //拆分
349 $("#sortButton").on('click', function () { 375 $("#sortButton").on('click', function () {
350 if ($("#rq").val() != "") { 376 if ($("#rq").val() != "") {
351 - var id = $('input.icheck:checked').data('id'); 377 + var ylArray = [];
  378 + var nbbm="";
  379 + var msg="";
  380 + $('input.icheck:checked').each(function(){
  381 + var map = {};
  382 + var id=$(this).data('id');
  383 + var clzbh =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html();
  384 + if(nbbm.indexOf(clzbh)>-1){
  385 + if(msg==""){
  386 + msg += clzbh;
  387 + }else{
  388 + msg += ","+clzbh;
  389 + }
  390 + }else{
  391 + nbbm +=clzbh;
  392 + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  393 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  394 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
  395 + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  396 + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val();
  397 + map['id']=id;
  398 + map['jzyl']=jzyl;
  399 + map['sh']=sh;
  400 + map['shyy']=shyy;
  401 + map['ns']=ns;
  402 + map['rylx']=rylx;
  403 + ylArray.push(map);
  404 + }
  405 +
  406 + }) ;
  407 + if(msg!=""){
  408 + layer.msg('内部编码为:【'+msg +'】的车辆请选择一条数据进行拆分.');
  409 + }else{
  410 + var params = {};
  411 + params['ylbList']=JSON.stringify(ylArray);
  412 + var i = layer.load(2);
  413 + $post('/ylb/sort', params, function () {
  414 + layer.close(i);
  415 + var params1 =getParamsList();
  416 + jsDoQuery(params1, true);
  417 + });
  418 +
  419 + }
  420 +
  421 + /* var id = $('input.icheck:checked').data('id');
352 422
353 if (typeof(id) == 'undefined') { 423 if (typeof(id) == 'undefined') {
354 layer.msg("请选择一行进行拆分"); 424 layer.msg("请选择一行进行拆分");
@@ -370,7 +440,7 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt; @@ -370,7 +440,7 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
370 jsDoQuery(params1, true); 440 jsDoQuery(params1, true);
371 }); 441 });
372 442
373 - } 443 + } */
374 } else { 444 } else {
375 layer.msg('请选择日期.'); 445 layer.msg('请选择日期.');
376 } 446 }