Commit 3bb767d033cc45aff26e83279a1093f92550238b

Authored by 徐烜
2 parents 4fa0d03a 57889ddf

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

src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -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 67 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
68 68 Map<String, Object> list=new HashMap<String, Object>();
69 69 try {
... ... @@ -79,7 +79,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
79 79 * @param map
80 80 * @return
81 81 */
82   - @RequestMapping(value = "/sort",method = RequestMethod.GET)
  82 + @RequestMapping(value = "/sort",method = RequestMethod.POST)
83 83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){
84 84 Map<String, Object> list=new HashMap<String, Object>();
85 85 try {
... ... @@ -201,6 +201,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
201 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 210 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
205 211 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
206 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 54  
55 55 @Override
56 56 public void run(String... arg0) throws Exception {
57   - logger.info("gpsDataLoader,20,5");
  57 + logger.info("gpsDataLoader,20,3");
58 58 //定时从网关获取GPS数据
59   - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS);
  59 + //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS);
60 60 //定时扫描掉离线
61 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 148 }
149 149 //出站既出场
150 150 outStationAndOutPark(sch);
151   - logger.info("班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
  151 + logger.info("车辆:" + sch.getClZbh() + " 班次:" + sch.getDfsj() + "发车, 时间:" + sch.getFcsjActual());
152 152 }
153 153 else if(sch.getBcType().equals("out")){
154 154 ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
... ... @@ -163,10 +163,16 @@ public class InOutStationSignalHandle extends SignalHandle{
163 163  
164 164 private void outStationAndOutPark(ScheduleRealInfo sch){
165 165 LineConfig config = lineConfigData.get(sch.getXlBm());
  166 + //限定出站既出场的停车场
  167 + String park = config.getTwinsPark();
  168 + boolean limitPark = StringUtils.isNotEmpty(park);
  169 +
166 170 if (config != null && config.getOutConfig() == 2) {
167 171 //出站既出场
168 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 176 schPrev.setFcsjActualAll(sch.getFcsjActualTime());
171 177 schPrev.setZdsjActualAll(sch.getFcsjActualTime());
172 178  
... ... @@ -217,14 +223,6 @@ public class InOutStationSignalHandle extends SignalHandle{
217 223 sendUtils.sendZdsj(sch, next, doneSum);
218 224 //持久化
219 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 228 if (next != null) {
... ... @@ -234,6 +232,13 @@ public class InOutStationSignalHandle extends SignalHandle{
234 232 inStationAndInPark(sch, next);
235 233 //将gps转换为下一个班次走向的站内信号
236 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 244 else {
... ... @@ -297,8 +302,14 @@ public class InOutStationSignalHandle extends SignalHandle{
297 302 */
298 303 private void inStationAndInPark(ScheduleRealInfo sch, ScheduleRealInfo next){
299 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 313 next.setFcsjActualAll(sch.getZdsjActualTime());
303 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 13 @Component
14 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 19 //断开70分钟,之前的信号不再有参考价值
20 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 148 try {
149 149 //循环gps恢复数据
150 150 CircleQueue<GpsEntity> prevs;
151   -
  151 + boolean task;
152 152 for (GpsEntity gps : list) {
153 153  
  154 + //是否有任务
  155 +
154 156 prevs = GeoCacheData.getGps(gps.getNbbm());
155 157 //掉线处理
156 158 offlineSignalHandle.handle(gps, prevs);
157 159 //状态处理
158   - if (!correctSignalHandle.handle(gps, prevs))
159   - continue;
  160 + task = correctSignalHandle.handle(gps, prevs);
160 161 //场,站内外判断
161 162 stationInsideHandle.handle(gps, prevs);
  163 + //异常判定(越界/超速)
  164 + //abnormalStateHandle.handle(gps, prevs);
  165 +
  166 + if(!task)
  167 + return; //无任务的,到这里就结束
  168 +
162 169 //反向处理
163 170 reverseSignalHandle.handle(gps, prevs);
164 171 //进出站动作处理
165 172 inOutStationSignalHandle.handle(gps, prevs);
166   -
167 173 GeoCacheData.putGps(gps);
168 174 }
169 175 } catch (Exception e) {
... ...
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
... ... @@ -95,7 +95,9 @@ public class GpsDataLoaderThread extends Thread {
95 95  
96 96 old = gpsRealData.get(gps.getDeviceId());
97 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 101 continue;
100 102  
101 103 nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId());
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -197,12 +197,22 @@ public class SchAttrCalculator {
197 197 String lineCode = list.get(0).getXlBm();
198 198 LineConfig conf = lineConfigData.get(lineCode);
199 199 int outConfig = -1;
200   - if(conf != null)
  200 + //限定出站既出场的停车场
  201 + String park = null;
  202 + if(conf != null){
201 203 outConfig = conf.getOutConfig();
  204 + park = conf.getTwinsPark();
  205 + }
  206 + boolean limitPark = StringUtils.isNotEmpty(park);
202 207  
203 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 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 96 + " and s.ssgsdm like %?2% "
97 97 + " and s.fgsdm like %?3%"
98 98 + " and s.xlbm like %?4% "
99   - + " and s.nbbm in ?5 ")
  99 + + " and s.nbbm in ?5 order by nbbm,jcsx")
100 100 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
101 101  
102 102  
103 103 @Transactional
104 104 @Modifying
105 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 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 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
  12 + Map<String, Object> saveYlb(Ylb t);
12 13 String obtainDsq() throws Exception;
13 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 18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
18 19  
19 20 Map<String, Object> sumYlb(Map<String, Object> map);
20   -
  21 + String checkJsy(Map<String, Object> map);
21 22 List<Ylb> oilListMonth(String line,String date);
22 23 List<Ylb> listYlb(Map<String, Object> map);
23 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
... ... @@ -469,45 +469,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
469 469  
470 470 repository.save(t);
471 471 }
472   -
473   - // 设置存油量
474   - Cyl cyl = null;
475   - boolean fage = false;
476   - for (int z = 0; z < cylList.size(); z++) {
477   - cyl = cylList.get(z);
478   - if (t.getNbbm().equals(cyl.getNbbm())) {
479   - cyl.setCyl(t.getJzyl());
480   - cyl.setUpdatetime(t.getRq());
481   - fage = true;
482   - break;
483   - }
484   - }
485   - if (fage) {
486   - cylRepository.save(cyl);
487   - } else {
488   - if(cylMapAdd.get(t.getNbbm())!=null){
489   - for (int l = 0; l < cylListAdd.size(); l++) {
490   - cyl=cylListAdd.get(l);
491   - if(cyl.getNbbm().equals(t.getNbbm())){
492   - cyl.setNbbm(t.getNbbm());
493   - cyl.setCyl(t.getJzyl());
494   - cyl.setGsdm(t.getSsgsdm());
495   - cyl.setFgsdm(t.getFgsdm());
496   - cyl.setUpdatetime(t.getRq());
497   - }
498   - }
499   - }else{
500   - cyl = new Cyl();
501   - cyl.setNbbm(t.getNbbm());
502   - cyl.setCyl(t.getJzyl());
503   - cyl.setGsdm(t.getSsgsdm());
504   - cyl.setFgsdm(t.getFgsdm());
505   - cyl.setUpdatetime(t.getRq());
506   - cylListAdd.add(cyl);
507   - }
508   -
509   -
510   - }
511 472 map2.put("status", ResponseCode.SUCCESS);
512 473 }
513 474 }
... ... @@ -526,6 +487,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
526 487 /**
527 488 * 拆分
528 489 */
  490 + /*
529 491 @Transactional
530 492 @Override
531 493 public Map<String, Object> sort(Map<String, Object> map) throws Exception{
... ... @@ -669,7 +631,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
669 631 throw e;
670 632 }
671 633 return newMap;
672   - }
  634 + }*/
673 635  
674 636 /**
675 637 * 核对,有加注没里程
... ... @@ -727,32 +689,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
727 689 t.setSsgsdm(y1.getGsdm());
728 690 t.setXlbm(xlbm);
729 691 repository.save(t);
730   -
731   - //设置存油量
732   - Cyl cyl=null;
733   - boolean status=false;
734   - for(int z=0;z<cylList.size();z++){
735   - cyl=cylList.get(z);
736   - if(t.getNbbm().equals(cyl.getNbbm())){
737   -// cyl.setCyl(cyl.getCyl()+t.getJzl());
738   - cyl.setCyl(Arith.add(cyl.getCyl(),t.getJzl()));
739   - cyl.setUpdatetime(t.getRq());
740   - status=true;
741   - break;
742   - }
743   - }
744   - if(status){
745   - cylRepository.save(cyl);
746   - }else{
747   - cyl=new Cyl();
748   - cyl.setNbbm(t.getNbbm());
749   - cyl.setCyl(t.getJzl());
750   - cyl.setGsdm(t.getSsgsdm());
751   - cyl.setUpdatetime(t.getRq());
752   - cylRepository.save(cyl);
753   - }
754   -
755   -
756 692 }
757 693 }
758 694 newMap.put("status", ResponseCode.SUCCESS);
... ... @@ -965,20 +901,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
965 901 for (int i = 0; i < jsonArray.size(); i++) {
966 902 // Ylb t=new Ylb();
967 903 jsonObject=jsonArray.getJSONObject(i);
968   -
969   - Double jzyl =jsonObject.getDoubleValue("jzyl");
970   - 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");
971 908 String shyy =jsonObject.getString("shyy");
972   - Double ns = jsonObject.getDoubleValue("ns");
  909 + double ns = jsonObject.getDoubleValue("ns");
973 910 String rylx =jsonObject.getString("rylx");
  911 + int yhlx =jsonObject.getIntValue("yhlx");
974 912 Integer id =jsonObject.getInteger("id");
  913 + double yh = Arith.sub(Arith.add(czyl, jzl), jzyl);
975 914 /*t.setJzyl(jzyl);
976 915 t.setSh(sh);
977 916 t.setShyy(shyy);
978 917 t.setNs(ns);
979 918 t.setRylx(rylx);
980 919 t.setId(jsonObject.getInteger("id"));*/
981   - repository.ylbUpdate(id, jzyl, sh, shyy, ns, rylx);
  920 + repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
982 921 }
983 922 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
984 923  
... ... @@ -991,5 +930,139 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
991 930 return newMap;
992 931 }
993 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 + }
994 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) {
  1063 +
  1064 + String gsbm="";
  1065 + String fgsbm="";
  1066 + return null;
  1067 + }
995 1068 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -203,7 +203,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
203 203 try {
204 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 207 for (String id : idList) {
208 208 schedule = dayOfSchedule.get(Long.parseLong(id));
209 209 if (schedule.isDestroy()) {
... ... @@ -219,14 +219,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
219 219 dayOfSchedule.save(schedule);
220 220 rsList.add(schedule);
221 221  
222   - //如果正在执行当前班次,跳下一个班次
  222 + /*//如果正在执行当前班次,跳下一个班次
223 223 execSch = dayOfSchedule.executeCurr(schedule.getClZbh());
224 224 if(execSch != null && execSch.getId().equals(schedule.getId())){
225 225 next = dayOfSchedule.next(schedule);
226 226 dayOfSchedule.addExecPlan(next);
227   - }
  227 + }*/
228 228 }
229 229  
  230 + //重新计算当前执行班次
  231 + dayOfSchedule.reCalcExecPlan(schedule.getClZbh());
  232 +
230 233 map.put("status", ResponseCode.SUCCESS);
231 234 } catch (Exception e) {
232 235 logger.error("", e);
... ... @@ -368,8 +371,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
368 371 //更新起点应到时间
369 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 379 rs.put("t", t);
374 380 } catch (Exception e) {
375 381 logger.error("", e);
... ... @@ -1615,9 +1621,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1615 1621 else if (date.length() == 7)
1616 1622 list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1617 1623  
  1624 +
1618 1625 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1619 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 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 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 1649 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
1643 1650 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
1644 1651 Map<String, Object> map = null;
  1652 +
  1653 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
1645 1654 for (int i = 0; i < list.size(); i++) {
1646 1655 ScheduleRealInfo scheduleRealInfo = list.get(i);
  1656 +
1647 1657 if (scheduleRealInfo != null) {
1648 1658 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1649 1659 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1660 + if(!scheduleRealInfo.isSflj()){
  1661 + jhlc += tempJhlc;
  1662 + jhlcZ += tempJhlc;
  1663 + }
1650 1664 if (childTaskPlans.isEmpty()) {
1651 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 1676 if (scheduleRealInfo.isSflj()) {
1654 1677 ljgl += tempJhlc;
1655 1678 ljglZ += tempJhlc;
1656   - } else {
1657   - jhlc += tempJhlc;
1658   - jhlcZ += tempJhlc;
1659   - }
  1679 + }
  1680 +
1660 1681 if (scheduleRealInfo.getStatus() == -1) {
1661 1682 ssgl += tempJhlc;
1662 1683 ssglZ += tempJhlc;
... ... @@ -1791,8 +1812,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1791 1812 ssbc_otherZ++;
1792 1813 }
1793 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 1875 map.put("xlName", scheduleRealInfo.getXlName());
1850 1876 map.put("jhlc", format.format(jhlc));
1851 1877 map.put("sjgl", format.format(sjgl));
1852   - map.put("ssgl", format.format(ssgl));
  1878 + map.put("ssgl", format.format(ssgl+cj));
1853 1879 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1854 1880 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1855 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 1899 map.put("ssbc_qh", ssbc_qh);
1874 1900 map.put("ssbc_yw", ssbc_yw);
1875 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 1903 map.put("jhbc", jhbc);
1878 1904 map.put("jhbc_m", jhbc_m);
1879 1905 map.put("jhbc_a", jhbc_a);
... ... @@ -1931,13 +1957,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1931 1957 djg_m = 0;
1932 1958 djg_a = 0;
1933 1959 djg_time = 0;
  1960 + lj=0;
  1961 + cj=0;
1934 1962 }
1935 1963 } else {
1936 1964 map = new HashMap<String, Object>();
1937 1965 map.put("xlName", scheduleRealInfo.getXlName());
1938 1966 map.put("jhlc", format.format(jhlc));
1939 1967 map.put("sjgl", format.format(sjgl));
1940   - map.put("ssgl", format.format(ssgl));
  1968 + map.put("ssgl", format.format(ssgl+cj));
1941 1969 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1942 1970 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1943 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 1989 map.put("ssbc_qh", ssbc_qh);
1962 1990 map.put("ssbc_yw", ssbc_yw);
1963 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 1993 map.put("jhbc", jhbc);
1966 1994 map.put("jhbc_m", jhbc_m);
1967 1995 map.put("jhbc_a", jhbc_a);
... ... @@ -2019,6 +2047,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2019 2047 djg_m = 0;
2020 2048 djg_a = 0;
2021 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 2056 map.put("xlName", "合计");
2027 2057 map.put("jhlc", format.format(jhlcZ));
2028 2058 map.put("sjgl", format.format(sjglZ));
2029   - map.put("ssgl", format.format(ssglZ));
  2059 + map.put("ssgl", format.format(ssglZ+xgssgl));
2030 2060 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2031 2061 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2032 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 2080 map.put("ssbc_qh", ssbc_qhZ);
2051 2081 map.put("ssbc_yw", ssbc_ywZ);
2052 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 2084 map.put("jhbc", jhbcZ);
2055 2085 map.put("jhbc_m", jhbc_mZ);
2056 2086 map.put("jhbc_a", jhbc_aZ);
... ... @@ -2143,7 +2173,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2143 2173  
2144 2174 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2145 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 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 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 2198 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
2169 2199 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
2170 2200 Map<String, Object> map = null;
  2201 +
  2202 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
2171 2203 for (int i = 0; i < list.size(); i++) {
2172 2204 ScheduleRealInfo scheduleRealInfo = list.get(i);
  2205 +
2173 2206 if (scheduleRealInfo != null) {
2174 2207 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2175 2208 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  2209 + if(!scheduleRealInfo.isSflj()){
  2210 + jhlc += tempJhlc;
  2211 + jhlcZ += tempJhlc;
  2212 + }
2176 2213 if (childTaskPlans.isEmpty()) {
2177 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 2225 if (scheduleRealInfo.isSflj()) {
2180 2226 ljgl += tempJhlc;
2181 2227 ljglZ += tempJhlc;
2182   - } else {
2183   - jhlc += tempJhlc;
2184   - jhlcZ += tempJhlc;
2185   - }
  2228 + }
  2229 +
2186 2230 if (scheduleRealInfo.getStatus() == -1) {
2187 2231 ssgl += tempJhlc;
2188 2232 ssglZ += tempJhlc;
... ... @@ -2317,8 +2361,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2317 2361 ssbc_otherZ++;
2318 2362 }
2319 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 2424 map.put("xlName", scheduleRealInfo.getXlName());
2376 2425 map.put("jhlc", format.format(jhlc));
2377 2426 map.put("sjgl", format.format(sjgl));
2378   - map.put("ssgl", format.format(ssgl));
  2427 + map.put("ssgl", format.format(ssgl+cj));
2379 2428 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2380 2429 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
2381 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 2448 map.put("ssbc_qh", ssbc_qh);
2400 2449 map.put("ssbc_yw", ssbc_yw);
2401 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 2452 map.put("jhbc", jhbc);
2404 2453 map.put("jhbc_m", jhbc_m);
2405 2454 map.put("jhbc_a", jhbc_a);
... ... @@ -2457,12 +2506,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2457 2506 djg_m = 0;
2458 2507 djg_a = 0;
2459 2508 djg_time = 0;
  2509 + lj=0;
  2510 + cj=0;
2460 2511 }
2461 2512 } else {
2462 2513 map = new HashMap<String, Object>();
2463 2514 map.put("xlName", scheduleRealInfo.getXlName());
2464 2515 map.put("jhlc", format.format(jhlc));
2465   - map.put("sjgl", format.format(sjgl));
  2516 + map.put("sjgl", format.format(sjgl+cj));
2466 2517 map.put("ssgl", format.format(ssgl));
2467 2518 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2468 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 2538 map.put("ssbc_qh", ssbc_qh);
2488 2539 map.put("ssbc_yw", ssbc_yw);
2489 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 2542 map.put("jhbc", jhbc);
2492 2543 map.put("jhbc_m", jhbc_m);
2493 2544 map.put("jhbc_a", jhbc_a);
... ... @@ -2545,6 +2596,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2545 2596 djg_m = 0;
2546 2597 djg_a = 0;
2547 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 2605 map.put("xlName", "合计");
2553 2606 map.put("jhlc", format.format(jhlcZ));
2554 2607 map.put("sjgl", format.format(sjglZ));
2555   - map.put("ssgl", format.format(ssglZ));
  2608 + map.put("ssgl", format.format(ssglZ+xgssgl));
2556 2609 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2557 2610 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2558 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 2629 map.put("ssbc_qh", ssbc_qhZ);
2577 2630 map.put("ssbc_yw", ssbc_ywZ);
2578 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 2633 map.put("jhbc", jhbcZ);
2581 2634 map.put("jhbc_m", jhbc_mZ);
2582 2635 map.put("jhbc_a", jhbc_aZ);
... ... @@ -3548,7 +3601,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3548 3601 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
3549 3602 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
3550 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 3605 float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
3553 3606 Map<String, Object> map = new HashMap<String, Object>();
3554 3607 for (ScheduleRealInfo scheduleRealInfo : list) {
... ... @@ -3560,7 +3613,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3560 3613 double jh = 0, sj = 0;
3561 3614 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
3562 3615 if (scheduleRealInfo.isSflj()) {
3563   - ljbc++;
  3616 + if(!(scheduleRealInfo.getBcType().equals("in")
  3617 + || scheduleRealInfo.getBcType().equals("out"))){
  3618 + ljbc++;
  3619 + }
3564 3620 } else {
3565 3621 if (!(scheduleRealInfo.getBcType().equals("in")
3566 3622 || scheduleRealInfo.getBcType().equals("out"))) {
... ... @@ -3578,14 +3634,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3578 3634 if (childTaskPlans.isEmpty()) {
3579 3635 if (scheduleRealInfo.getBcType().equals("in") ||
3580 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 3645 if (scheduleRealInfo.getStatus() != -1) {
3590 3646 if (scheduleRealInfo.isSflj()) {
3591 3647 addMileage += tempJhlc;
... ... @@ -3634,13 +3690,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3634 3690 map.put("ksgl", format.format(ksgl));
3635 3691 map.put("yyglsj", format.format(yygl));
3636 3692 map.put("jhbc", jhbc);
3637   - map.put("jcclc", jcclc);
  3693 + map.put("jcclc", format.format(jcclc+ljjcclc));
3638 3694  
3639 3695 map.put("ljgl", format.format(addMileage));
3640 3696 map.put("ssbc", cjbc);
3641 3697 map.put("ysgl", format.format(yygl));
3642 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 3700 map.put("ljbc", ljbc);
3645 3701  
3646 3702 return map;
... ...
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
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   -
  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 1 package com.bsth.websocket.handler;
2 2  
3 3 import com.alibaba.fastjson.JSONObject;
  4 +import com.bsth.common.Constants;
4 5 import com.bsth.data.BasicData;
5 6 import com.google.common.base.Splitter;
6 7 import com.google.common.collect.ArrayListMultimap;
... ... @@ -107,6 +108,10 @@ public class RealControlSocketHandler implements WebSocketHandler {
107 108 user.sendMessage(message);
108 109 }
109 110 } catch (Exception e) {
  111 + try{
  112 + logger.error("error user...."+user.getAttributes().get(Constants.SESSION_USERNAME));
  113 + }
  114 + catch(Exception e2){}
110 115 logger.error("sendMessageToLine error ...."+msg);
111 116 logger.error("sendMessageToLine error ....", e);
112 117 }
... ...
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={} 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   -
  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/static/pages/oil/add.html
... ... @@ -7,7 +7,7 @@
7 7 <ul class="page-breadcrumb breadcrumb">
8 8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9 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 11 <li><span class="active">进场站油量信息编辑</span></li>
12 12 </ul>
13 13  
... ... @@ -46,7 +46,7 @@
46 46 <div class="form-group">
47 47 <label class="col-md-3 control-label">开始营运日期</label>
48 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 50 <span class="help-block"> 如:12:12</span>
51 51 </div>
52 52 </div>
... ... @@ -326,33 +326,26 @@
326 326 submitHandler : function(f) {
327 327 var params = form.serializeJSON();
328 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 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 203 {{obj.xlname}}
204 204 </td>
205 205 <td>
206   - {{obj.nbbm}}
  206 + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
  207 +
207 208 </td>
208 209 <td>
209 210 {{obj.jsy}}
210 211 </td>
211 212 <td>
212   - {{obj.jzl}}
  213 +
  214 + <lable data-id="{{obj.id}}" class="in_carpark_jzl"> {{obj.jzl}}</lable>
213 215 </td>
214 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 222 </td>
217 223 <td>
218 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 228 </td>
222 229 <td>
223   - {{obj.yh}}
  230 + {{obj.yh}}
224 231 </td>
225 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 234 <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option>
228 235 <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option>
229 236 </select>
230 237 </td>
231 238 <td>
232 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 243 </td>
236 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 246 <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option>
239 247 <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option>
240 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 255 </select>
248 256 </td>
249 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 264 <td>
255 265 {{obj.zlc}}
256 266 </td>
257 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 272 </td>
260 273 <td>
261 274 {{obj.bglyh}}
... ... @@ -307,48 +320,105 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
307 320 //保存
308 321 $("#saveButton").on('click',function(){
309 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 323 $('input.icheck').each(function(){
324 324 var map = {};
325 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 334 var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  335 + if(jzyl=="" || jzyl==null){
  336 + jzyl=0;
  337 + }
  338 +
327 339 var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  340 + if(sh=="" || sh==null){
  341 + sh=0;
  342 + }
  343 +
328 344 var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
329 345 var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  346 + if(ns=="" || ns==null){
  347 + ns=0;
  348 + }
  349 +
330 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 353 map['id']=id;
  354 + map['jzl']=jzl;
  355 + map['czyl']=czyl;
332 356 map['jzyl']=jzyl;
333 357 map['sh']=sh;
334 358 map['shyy']=shyy;
335 359 map['ns']=ns;
336 360 map['rylx']=rylx;
  361 + map['yhlx']=yhlx;
337 362 ylArray.push(map);
338 363 })
339 364 var params = {};
340 365 params['ylbList']=JSON.stringify(ylArray);
  366 + console.log(JSON.stringify(ylArray));
341 367 var i = layer.load(2);
342   - $get('/ylb/saveYlbList', params, function () {
  368 + $post('/ylb/saveYlbList', params, function () {
343 369 layer.close(i);
344 370 var params1 =getParamsList();
345 371 jsDoQuery(params1, true);
346   - });
  372 + });
347 373 })
348 374 //拆分
349 375 $("#sortButton").on('click', function () {
350 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 423 if (typeof(id) == 'undefined') {
354 424 layer.msg("请选择一行进行拆分");
... ... @@ -370,7 +440,7 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
370 440 jsDoQuery(params1, true);
371 441 });
372 442  
373   - }
  443 + } */
374 444 } else {
375 445 layer.msg('请选择日期.');
376 446 }
... ...