Commit 1de463e6deda47ff2567fefad639298be65651f2

Authored by 潘钊
2 parents 1267a7c6 851fdf7c

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

Showing 31 changed files with 730 additions and 188 deletions
src/main/java/com/bsth/entity/oil/Ylb.java
@@ -49,7 +49,9 @@ public class Ylb { @@ -49,7 +49,9 @@ public class Ylb {
49 private int sjbc; 49 private int sjbc;
50 private String edituser; 50 private String edituser;
51 private Date edittime; 51 private Date edittime;
  52 + private Date updatetime;
52 private Date createtime; 53 private Date createtime;
  54 +
53 private int nylx; 55 private int nylx;
54 //进场顺序(根据最先出场和最后进场来关联车辆的存油量) 56 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
55 private int jcsx; 57 private int jcsx;
@@ -321,6 +323,12 @@ public class Ylb { @@ -321,6 +323,12 @@ public class Ylb {
321 } 323 }
322 324
323 325
324 - 326 + public Date getUpdatetime() {
  327 + return updatetime;
  328 + }
  329 +
  330 + public void setUpdatetime(Date updatetime) {
  331 + this.updatetime = updatetime;
  332 + }
325 333
326 } 334 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -113,8 +113,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int @@ -113,8 +113,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int
113 /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + 113 /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" +
114 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + 114 "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " +
115 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ 115 "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/
116 - @Query(value = "SELECT s.b_jwpoints,s.station_name,r.station_route_code FROM (" +  
117 - "SELECT b.station,b.station_route_code FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + 116 + @Query(value = "SELECT s.b_jwpoints,r.station_name,r.station_route_code FROM (" +
  117 + "SELECT b.station,b.station_route_code,b.station_name FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " +
118 "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) 118 "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true)
119 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); 119 List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction);
120 120
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -248,13 +248,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -248,13 +248,13 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
248 for(int i = 0;i <stationsArray.size();i++) { 248 for(int i = 0;i <stationsArray.size();i++) {
249 // 站点名称 249 // 站点名称
250 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString(); 250 String stationName = stationsArray.getJSONObject(i).equals("") ? "" : stationsArray.getJSONObject(i).get("name").toString();
251 - Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString()); 251 + Double distance = stationsArray.getJSONObject(i).get("distance").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("distance").toString());
252 // 转成公里 252 // 转成公里
253 distance = distance/1000; 253 distance = distance/1000;
254 BigDecimal d = new BigDecimal(distance); 254 BigDecimal d = new BigDecimal(distance);
255 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); 255 distance = d.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
256 sectionDistance= distance + sectionDistance; 256 sectionDistance= distance + sectionDistance;
257 - Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0 : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString()); 257 + Double duration = stationsArray.getJSONObject(i).get("duration").equals("") ? 0.0d : Double.parseDouble(stationsArray.getJSONObject(i).get("duration").toString());
258 // 转成分钟 258 // 转成分钟
259 duration = duration/60; 259 duration = duration/60;
260 BigDecimal t = new BigDecimal(duration); 260 BigDecimal t = new BigDecimal(duration);
@@ -792,9 +792,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -792,9 +792,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
792 Station station = repository.findOne(stationId); 792 Station station = repository.findOne(stationId);
793 StationRoute arg0 = new StationRoute(); 793 StationRoute arg0 = new StationRoute();
794 // 距离 794 // 距离
795 - Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString()); 795 + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString());
796 // 时间 796 // 时间
797 - Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); 797 + Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString());
798 // 站点路由名称 798 // 站点路由名称
799 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString(); 799 String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
800 // 线路ID 800 // 线路ID
@@ -952,8 +952,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -952,8 +952,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
952 stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode; 952 stationRouteCode = stationRouteCode == null ? 100 : stationRouteCode;
953 Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString()); 953 Integer LineId = map.get("stationRouteLine").equals("") ? null : Integer.parseInt(map.get("stationRouteLine").toString());
954 String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString(); 954 String stationMark = map.get("stationMark").equals("") ? null : map.get("stationMark").toString();
955 - Double distances = map.get("distances").equals("") ? null : Double.parseDouble(map.get("distances").toString());  
956 - Double toTime = map.get("toTime").equals("") ? null : Double.parseDouble(map.get("toTime").toString()); 955 + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString());
  956 + Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString());
957 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); 957 Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
958 Station station = repository.findOne(stationId); 958 Station station = repository.findOne(stationId);
959 Line line = lineRepository.findOne(LineId); 959 Line line = lineRepository.findOne(LineId);
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -79,6 +79,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -79,6 +79,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
79 public String obtainDsq() throws Exception{ 79 public String obtainDsq() throws Exception{
80 String result = "failure"; 80 String result = "failure";
81 try { 81 try {
  82 + List<Ylb> addList = new ArrayList<Ylb>();
  83 + String type = "";
82 List<Cars> carsList=carsRepository.findCars(); 84 List<Cars> carsList=carsRepository.findCars();
83 Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); 85 Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
84 for (int i = 0; i < carsList.size(); i++) { 86 for (int i = 0; i < carsList.size(); i++) {
@@ -126,6 +128,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -126,6 +128,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
126 &&t1.getXlbm().equals(map.get("xlBm").toString())) 128 &&t1.getXlbm().equals(map.get("xlBm").toString()))
127 { 129 {
128 t=t1; 130 t=t1;
  131 + type="update";
129 } 132 }
130 } 133 }
131 134
@@ -182,13 +185,22 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -182,13 +185,22 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
182 t.setRq(sdf.parse(rq)); 185 t.setRq(sdf.parse(rq));
183 t.setCreatetime(dNow); 186 t.setCreatetime(dNow);
184 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ 187 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
185 - repository.save(t); 188 + if(type.equals("update")){
  189 + repository.save(t);
  190 + }else{
  191 + addList.add(t);
  192 + }
  193 +
186 } 194 }
187 195
188 196
189 } 197 }
190 - result = "success"; 198 +
191 } 199 }
  200 + if(addList.size()>0){
  201 + new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class);
  202 + }
  203 + result = "success";
192 }catch (Exception e) { 204 }catch (Exception e) {
193 // TODO Auto-generated catch block 205 // TODO Auto-generated catch block
194 throw e; 206 throw e;
@@ -334,11 +346,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -334,11 +346,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
334 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); 346 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
335 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); 347 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
336 t.setRq(sdf.parse(rq)); 348 t.setRq(sdf.parse(rq));
337 - t.setCreatetime(date); 349 +
338 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ 350 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
339 if(type.equals("add")){ 351 if(type.equals("add")){
  352 + t.setCreatetime(date);
340 addList.add(t); 353 addList.add(t);
341 }else{ 354 }else{
  355 + t.setUpdatetime(date);
342 updateList.add(t); 356 updateList.add(t);
343 ins += t.getId().toString()+","; 357 ins += t.getId().toString()+",";
344 } 358 }
@@ -438,6 +452,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -438,6 +452,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
438 map.put("xlbm_like", ylb.getXlbm()); 452 map.put("xlbm_like", ylb.getXlbm());
439 // Iterator<Ylb> iterator2 = repository 453 // Iterator<Ylb> iterator2 = repository
440 // .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); 454 // .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator();
  455 + double czyl=0.0;
441 for (int j = 0; j < iterator2.size(); j++) { 456 for (int j = 0; j < iterator2.size(); j++) {
442 Ylb t = iterator2.get(j); 457 Ylb t = iterator2.get(j);
443 if(t.getNbbm().equals(ylb.getNbbm())){ 458 if(t.getNbbm().equals(ylb.getNbbm())){
@@ -445,6 +460,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -445,6 +460,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
445 // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 460 // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
446 // Double yl = t.getCzyl(); 461 // Double yl = t.getCzyl();
447 // Double jcyl = t.getCzyl(); 462 // Double jcyl = t.getCzyl();
  463 + czyl = t.getCzyl();
448 zyl =jzl; 464 zyl =jzl;
449 Double yh=0.0; 465 Double yh=0.0;
450 if(zlc>0){ 466 if(zlc>0){
@@ -476,10 +492,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -476,10 +492,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
476 } 492 }
477 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); 493 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh);
478 if(zlc>0){ 494 if(zlc>0){
479 - long l=Math.round(nextJzyl);  
480 - double ylxs=l*100/100;  
481 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); 495 + long l=0l;
  496 + double ylxs=0.0;
  497 + if(j==iterator2.size()-1){
  498 + ylxs=czyl;
  499 + }else{
  500 + l=Math.round(nextJzyl);
  501 + ylxs=l*100/100;
  502 +
  503 + }
482 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); 504 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  505 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  506 +
483 t.setYh(yh); 507 t.setYh(yh);
484 t.setJzyl(ylxs); 508 t.setJzyl(ylxs);
485 nextJzyl=ylxs; 509 nextJzyl=ylxs;
@@ -704,7 +728,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -704,7 +728,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
704 } 728 }
705 // List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); 729 // List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm);
706 List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); 730 List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm);
707 - List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm);  
708 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); 731 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
709 List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); 732 List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
710 for (int i = 0; i < ylxxbList.size(); i++) { 733 for (int i = 0; i < ylxxbList.size(); i++) {
@@ -719,7 +742,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -719,7 +742,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
719 } 742 }
720 743
721 if(fage){ 744 if(fage){
722 - Cyl cyl=null;  
723 Ylb t=new Ylb(); 745 Ylb t=new Ylb();
724 t.setNbbm(y1.getNbbm()); 746 t.setNbbm(y1.getNbbm());
725 t.setRq(y1.getYyrq()); 747 t.setRq(y1.getYyrq());
@@ -749,23 +771,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -749,23 +771,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
749 } 771 }
750 } 772 }
751 if(status){ 773 if(status){
752 - for (int j = 0; j < cylList.size(); j++) {  
753 - Cyl c=cylList.get(j);  
754 - if(c.getNbbm().equals(y1.getNbbm())){  
755 - t.setCzyl(c.getCyl());  
756 - cyl=c;  
757 - status=false;  
758 - break;  
759 - }  
760 - }  
761 - }  
762 - if(status){  
763 t.setCzyl(0.0); 774 t.setCzyl(0.0);
764 } 775 }
765 // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); 776 // double jzyl=Arith.add(t.getJzl(), t.getCzyl());
766 t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); 777 t.setJzyl(Arith.add(t.getJzl(), t.getCzyl()));
767 t.setYh(0.0); 778 t.setYh(0.0);
768 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ 779 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  780 + t.setCreatetime(new Date());
769 repository.save(t); 781 repository.save(t);
770 /*if(null!=cyl){ 782 /*if(null!=cyl){
771 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); 783 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));
@@ -1141,6 +1153,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1141,6 +1153,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1141 Double zyl = 0.0; 1153 Double zyl = 0.0;
1142 Double nextJzyl = 0.0; 1154 Double nextJzyl = 0.0;
1143 // 车的,进,出油量及耗油 1155 // 车的,进,出油量及耗油
  1156 + double czyl=0.0;
1144 for (int i = 0; i < iterator2.size(); i++) { 1157 for (int i = 0; i < iterator2.size(); i++) {
1145 Ylb t = iterator2.get(i); 1158 Ylb t = iterator2.get(i);
1146 if (t.getJcsx() == 1) { 1159 if (t.getJcsx() == 1) {
@@ -1148,6 +1161,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1148,6 +1161,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1148 t.setSh(sh); 1161 t.setSh(sh);
1149 t.setShyy(shyy); 1162 t.setShyy(shyy);
1150 } 1163 }
  1164 + czyl=t.getCzyl();
1151 // Double jcyl = t.getCzyl(); 1165 // Double jcyl = t.getCzyl();
1152 zyl = jzl; 1166 zyl = jzl;
1153 Double yh = 0.0; 1167 Double yh = 0.0;
@@ -1179,8 +1193,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1179,8 +1193,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1179 } 1193 }
1180 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); 1194 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
1181 if(zlc>0){ 1195 if(zlc>0){
1182 - long l=Math.round(nextJzyl);  
1183 - double ylxs=l*100/100; 1196 + long l=0l;
  1197 + double ylxs=0.0;
  1198 + if(i==iterator2.size()){
  1199 + ylxs=czyl;
  1200 + }else{
  1201 + l=Math.round(nextJzyl);
  1202 + ylxs=l*100/100;
  1203 + }
1184 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); 1204 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
1185 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); 1205 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
1186 t.setYh(yh); 1206 t.setYh(yh);
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1812,11 +1812,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1812,11 +1812,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1812 List<ScheduleRealInfo> list = null; 1812 List<ScheduleRealInfo> list = null;
1813 list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); 1813 list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1814 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); 1814 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
1815 - String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'"; 1815 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  1816 + + " id = ("
  1817 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  1818 + + ")";
1816 String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 1819 String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
1817 - String[] minSjs = minfcsj.split(":");  
1818 - Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);  
1819 - 1820 + String[] minSjs = minfcsj.split(":");
  1821 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  1822 +
1820 for (int i = 0; i < list.size(); i++) { 1823 for (int i = 0; i < list.size(); i++) {
1821 ScheduleRealInfo s=list.get(i); 1824 ScheduleRealInfo s=list.get(i);
1822 String[] fcsj= s.getFcsj().split(":"); 1825 String[] fcsj= s.getFcsj().split(":");
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -151,8 +151,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -151,8 +151,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
151 int lbbc=0; 151 int lbbc=0;
152 for (int i = 0; i < lists.size(); i++) { 152 for (int i = 0; i < lists.size(); i++) {
153 ScheduleRealInfo scheduleRealInfo=lists.get(i); 153 ScheduleRealInfo scheduleRealInfo=lists.get(i);
154 - if (!(scheduleRealInfo.getBcType().equals("in")  
155 - || scheduleRealInfo.getBcType().equals("out"))) { 154 + if (!isInOut(scheduleRealInfo)) {
156 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 155 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
157 if(childTaskPlans.isEmpty()){ 156 if(childTaskPlans.isEmpty()){
158 if(scheduleRealInfo.getStatus() == -1){ 157 if(scheduleRealInfo.getStatus() == -1){
@@ -187,8 +186,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -187,8 +186,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
187 List<Map<String, Object>> list=new ArrayList<Map<String,Object>>(); 186 List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
188 for (int i = 0; i < lists.size(); i++) { 187 for (int i = 0; i < lists.size(); i++) {
189 ScheduleRealInfo scheduleRealInfo=lists.get(i); 188 ScheduleRealInfo scheduleRealInfo=lists.get(i);
190 - if (!(scheduleRealInfo.getBcType().equals("in")  
191 - || scheduleRealInfo.getBcType().equals("out"))) { 189 + if (!isInOut(scheduleRealInfo)) {
192 // Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 190 // Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
193 // if(childTaskPlans.isEmpty()){ 191 // if(childTaskPlans.isEmpty()){
194 if(scheduleRealInfo.isSflj()){ 192 if(scheduleRealInfo.isSflj()){
@@ -221,8 +219,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -221,8 +219,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
221 double ljgl=0; 219 double ljgl=0;
222 for (int i = 0; i < lists.size(); i++) { 220 for (int i = 0; i < lists.size(); i++) {
223 ScheduleRealInfo scheduleRealInfo=lists.get(i); 221 ScheduleRealInfo scheduleRealInfo=lists.get(i);
224 - if (!(scheduleRealInfo.getBcType().equals("in")  
225 - || scheduleRealInfo.getBcType().equals("out"))) { 222 + if (!isInOut(scheduleRealInfo)) {
226 if(!scheduleRealInfo.isDestroy()){ 223 if(!scheduleRealInfo.isDestroy()){
227 if(scheduleRealInfo.isSflj()){ 224 if(scheduleRealInfo.isSflj()){
228 ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); 225 ljgl=Arith.add(ljgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
@@ -250,8 +247,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -250,8 +247,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
250 int ljbc=0; 247 int ljbc=0;
251 for (int i = 0; i < lists.size(); i++) { 248 for (int i = 0; i < lists.size(); i++) {
252 ScheduleRealInfo scheduleRealInfo=lists.get(i); 249 ScheduleRealInfo scheduleRealInfo=lists.get(i);
253 - if (!(scheduleRealInfo.getBcType().equals("in")  
254 - || scheduleRealInfo.getBcType().equals("out"))) { 250 + if (!isInOut(scheduleRealInfo)) {
255 if(scheduleRealInfo.isSflj()){ 251 if(scheduleRealInfo.isSflj()){
256 if(item.equals("zgf") || item.equals("wgf")){ 252 if(item.equals("zgf") || item.equals("wgf")){
257 String time=""; 253 String time="";
@@ -292,8 +288,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -292,8 +288,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
292 double jhgl=0; 288 double jhgl=0;
293 for (int i = 0; i < lists.size(); i++) { 289 for (int i = 0; i < lists.size(); i++) {
294 ScheduleRealInfo scheduleRealInfo=lists.get(i); 290 ScheduleRealInfo scheduleRealInfo=lists.get(i);
295 - if (!(scheduleRealInfo.getBcType().equals("in")  
296 - || scheduleRealInfo.getBcType().equals("out"))) { 291 + if (!isInOut(scheduleRealInfo)) {
297 if(!scheduleRealInfo.isSflj()){ 292 if(!scheduleRealInfo.isSflj()){
298 jhgl=Arith.add(jhgl,scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); 293 jhgl=Arith.add(jhgl,scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig());
299 } 294 }
@@ -308,8 +303,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -308,8 +303,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
308 int jhbc=0; 303 int jhbc=0;
309 for (int i = 0; i < lists.size(); i++) { 304 for (int i = 0; i < lists.size(); i++) {
310 ScheduleRealInfo scheduleRealInfo=lists.get(i); 305 ScheduleRealInfo scheduleRealInfo=lists.get(i);
311 - if (!(scheduleRealInfo.getBcType().equals("in")  
312 - || scheduleRealInfo.getBcType().equals("out"))) { 306 + if (!isInOut(scheduleRealInfo)) {
313 if(!scheduleRealInfo.isSflj()){ 307 if(!scheduleRealInfo.isSflj()){
314 String[] fcsjStr = scheduleRealInfo.getFcsj().split(":"); 308 String[] fcsjStr = scheduleRealInfo.getFcsj().split(":");
315 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); 309 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
@@ -375,8 +369,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -375,8 +369,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
375 int sjbc=0; 369 int sjbc=0;
376 for (int i = 0; i < lists.size(); i++) { 370 for (int i = 0; i < lists.size(); i++) {
377 ScheduleRealInfo scheduleRealInfo=lists.get(i); 371 ScheduleRealInfo scheduleRealInfo=lists.get(i);
378 - if (!(scheduleRealInfo.getBcType().equals("in")  
379 - || scheduleRealInfo.getBcType().equals("out"))) { 372 + if (!isInOut(scheduleRealInfo)) {
380 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 373 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
381 if(!scheduleRealInfo.isSflj()){ 374 if(!scheduleRealInfo.isSflj()){
382 String time=""; 375 String time="";
@@ -491,7 +484,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -491,7 +484,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
491 for (int i = 0; i < lists.size(); i++) { 484 for (int i = 0; i < lists.size(); i++) {
492 ScheduleRealInfo scheduleRealInfo=lists.get(i); 485 ScheduleRealInfo scheduleRealInfo=lists.get(i);
493 if (scheduleRealInfo.getBcType().equals("in") 486 if (scheduleRealInfo.getBcType().equals("in")
494 - || scheduleRealInfo.getBcType().equals("out")) { 487 + || scheduleRealInfo.getBcType().equals("out")||scheduleRealInfo.getBcType().equals("ldks")) {
495 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 488 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
496 if(childTaskPlans.isEmpty()){ 489 if(childTaskPlans.isEmpty()){
497 if(!scheduleRealInfo.isDestroy()) 490 if(!scheduleRealInfo.isDestroy())
@@ -521,7 +514,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -521,7 +514,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
521 ScheduleRealInfo scheduleRealInfo=lists.get(i); 514 ScheduleRealInfo scheduleRealInfo=lists.get(i);
522 if(!scheduleRealInfo.isSflj()){ 515 if(!scheduleRealInfo.isSflj()){
523 if (scheduleRealInfo.getBcType().equals("in") 516 if (scheduleRealInfo.getBcType().equals("in")
524 - || scheduleRealInfo.getBcType().equals("out")) { 517 + || scheduleRealInfo.getBcType().equals("out")|| scheduleRealInfo.getBcType().equals("ldks")) {
525 double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); 518 double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();
526 if(jhlcOrig-scheduleRealInfo.getJhlc()>0){ 519 if(jhlcOrig-scheduleRealInfo.getJhlc()>0){
527 jcclc =Arith.add(jcclc, scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); 520 jcclc =Arith.add(jcclc, scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig());
@@ -542,6 +535,9 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -542,6 +535,9 @@ public class CulateMileageServiceImpl implements CulateMileageService{
542 if(s.getBcType().equals("out")){ 535 if(s.getBcType().equals("out")){
543 fage=true; 536 fage=true;
544 } 537 }
  538 + if(s.getBcType().equals("ldks")){
  539 + fage=true;
  540 + }
545 541
546 return fage; 542 return fage;
547 } 543 }
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -369,8 +369,11 @@ public class ReportServiceImpl implements ReportService{ @@ -369,8 +369,11 @@ public class ReportServiceImpl implements ReportService{
369 DecimalFormat df = new DecimalFormat("#0.00"); 369 DecimalFormat df = new DecimalFormat("#0.00");
370 // TODO Auto-generated method stub 370 // TODO Auto-generated method stub
371 //最早营运时间 区分夜宵线 371 //最早营运时间 区分夜宵线
372 - String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";  
373 - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 372 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  373 + + " id = ("
  374 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  375 + + ")";
  376 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
374 String[] minSjs = minfcsj.split(":"); 377 String[] minSjs = minfcsj.split(":");
375 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); 378 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
376 //查询时间里程 379 //查询时间里程
@@ -564,8 +567,11 @@ public class ReportServiceImpl implements ReportService{ @@ -564,8 +567,11 @@ public class ReportServiceImpl implements ReportService{
564 List<Map<String, Object>> list =new ArrayList<>(); 567 List<Map<String, Object>> list =new ArrayList<>();
565 // TODO Auto-generated method stub 568 // TODO Auto-generated method stub
566 //最早营运时间 区分夜宵线 569 //最早营运时间 区分夜宵线
567 - String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";  
568 - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class); 570 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  571 + + " id = ("
  572 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  573 + + ")";
  574 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
569 575
570 //查询全程 576 //查询全程
571 String sqlqc="select t.*,x.station_name as qdz_name from ( " 577 String sqlqc="select t.*,x.station_name as qdz_name from ( "
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -21,6 +21,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; @@ -21,6 +21,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
21 import com.bsth.service.schedule.rules.ttinfo.*; 21 import com.bsth.service.schedule.rules.ttinfo.*;
22 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; 22 import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
23 import com.bsth.service.schedule.rules.ttinfo2.Result; 23 import com.bsth.service.schedule.rules.ttinfo2.Result;
  24 +import com.bsth.service.schedule.rules.validate.ValidateParam;
  25 +import com.bsth.service.schedule.rules.validate.ValidateResults_output;
  26 +import org.apache.commons.lang3.StringUtils;
24 import org.joda.time.DateTime; 27 import org.joda.time.DateTime;
25 import org.kie.api.KieBase; 28 import org.kie.api.KieBase;
26 import org.kie.api.runtime.KieSession; 29 import org.kie.api.runtime.KieSession;
@@ -321,6 +324,59 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -321,6 +324,59 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
321 324
322 } 325 }
323 326
  327 + /**
  328 + * 验证排班结果。
  329 + * @param planResult
  330 + * @param schedulePlan
  331 + */
  332 + public void validPlanResult(PlanResult planResult, SchedulePlan schedulePlan) {
  333 + // 1-1、构造drools规则输入数据,输出数据
  334 + ValidateParam validateParam = new ValidateParam(
  335 + new DateTime(schedulePlan.getScheduleFromTime()),
  336 + new DateTime(schedulePlan.getScheduleToTime())
  337 + );
  338 + // 规则输出数据
  339 + ValidateResults_output result = new ValidateResults_output();
  340 +
  341 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
  342 + // 创建session,内部配置的是stateful
  343 + KieSession session = kieBase.newKieSession();
  344 +
  345 + // 设置gloable对象,在drl中通过别名使用
  346 + session.setGlobal("validResult", result);
  347 + session.setGlobal("log", logger); // 设置日志
  348 +
  349 + // 载入数据
  350 + session.insert(validateParam);
  351 + for (SchedulePlanInfo schedulePlanInfo: planResult.getSchedulePlanInfos()) {
  352 + session.insert(schedulePlanInfo);
  353 + }
  354 +
  355 + // 执行rule
  356 + session.fireAllRules();
  357 +
  358 + // 执行完毕销毁,有日志的也要关闭
  359 + session.dispose();
  360 +
  361 +// for (ValidateResults_output.ValidInfo validInfo: result.getInfos()) {
  362 +// logger.info(validInfo.getDesc());
  363 +// }
  364 +
  365 + // 取10条错误
  366 + int size = result.getInfos().size() > 10 ? 10: result.getInfos().size();
  367 + List<String> desclist = new ArrayList<>();
  368 + for (int i = 0; i < size; i++) {
  369 + desclist.add(result.getInfos().get(i).getDesc());
  370 + }
  371 + if (desclist.size() > 0) {
  372 + schedulePlan.setPlanResult(StringUtils.join(desclist, "</br>"));
  373 + } else {
  374 + schedulePlan.setPlanResult("ok");
  375 + }
  376 +
  377 + // TODO:设定错误信息
  378 + }
  379 +
324 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) 380 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
325 public SchedulePlan save(SchedulePlan schedulePlan) { 381 public SchedulePlan save(SchedulePlan schedulePlan) {
326 // pre、如果排班的数据之前已经有了,删除之前的数据 382 // pre、如果排班的数据之前已经有了,删除之前的数据
@@ -341,6 +397,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -341,6 +397,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
341 // 3、确定套跑规则 397 // 3、确定套跑规则
342 rerunPlanResult(planResult, schedulePlan); 398 rerunPlanResult(planResult, schedulePlan);
343 399
  400 + // TODO:3-1、验证排班结果
  401 + validPlanResult(planResult, schedulePlan);
  402 +
344 // 4、保存数据(jdbcTemplate 批量插入) 403 // 4、保存数据(jdbcTemplate 批量插入)
345 Date start4 = new Date(); 404 Date start4 = new Date();
346 scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); 405 scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos());
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -74,6 +74,9 @@ public class MyDroolsConfiguration { @@ -74,6 +74,9 @@ public class MyDroolsConfiguration {
74 kfs.write("src/main/resources/rerun.drl", kieServices.getResources() 74 kfs.write("src/main/resources/rerun.drl", kieServices.getResources()
75 .newInputStreamResource(this.getClass().getResourceAsStream( 75 .newInputStreamResource(this.getClass().getResourceAsStream(
76 "/rules/rerun.drl"), "UTF-8")); 76 "/rules/rerun.drl"), "UTF-8"));
  77 + kfs.write("src/main/resources/validplan.drl", kieServices.getResources()
  78 + .newInputStreamResource(this.getClass().getResourceAsStream(
  79 + "/rules/validplan.drl"), "UTF-8"));
77 // TODO:还有其他drl.... 80 // TODO:还有其他drl....
78 81
79 // 4、创建KieBuilder,使用KieFileSystem构建 82 // 4、创建KieBuilder,使用KieFileSystem构建
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
1 package com.bsth.service.schedule.rules.shiftloop; 1 package com.bsth.service.schedule.rules.shiftloop;
2 2
3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
4 -import com.bsth.service.schedule.utils.Md5Util;  
5 import com.google.common.base.Splitter; 4 import com.google.common.base.Splitter;
6 import org.apache.commons.lang3.StringUtils; 5 import org.apache.commons.lang3.StringUtils;
7 import org.joda.time.DateTime; 6 import org.joda.time.DateTime;
@@ -18,11 +17,6 @@ public class ScheduleRule_input { @@ -18,11 +17,6 @@ public class ScheduleRule_input {
18 17
19 /** 规则Id */ 18 /** 规则Id */
20 private String ruleId; 19 private String ruleId;
21 - /**  
22 - * 规则md5值(不使用id判定,使用md5判定)  
23 - * 使用,启用日期,路牌范围,人员范围 结合生成md5编码  
24 - */  
25 - private String ruleMd5;  
26 20
27 /** 规则启用日期 */ 21 /** 规则启用日期 */
28 private DateTime qyrq; 22 private DateTime qyrq;
@@ -85,15 +79,6 @@ public class ScheduleRule_input { @@ -85,15 +79,6 @@ public class ScheduleRule_input {
85 } 79 }
86 } 80 }
87 81
88 - /** 生成规则md5编码 */  
89 - ruleMd5 = Md5Util.getMd5(  
90 - String.valueOf(qyrq.getMillis()) + "_" +  
91 - scheduleRule1Flat.getLpIds() + "_" +  
92 - scheduleRule1Flat.getRyConfigIds()  
93 - );  
94 -  
95 -// System.out.println("rule的md5:" + ruleMd5 + " 车辆:" + scheduleRule1Flat.getCarConfigInfo().getCl().getInsideCode());  
96 -  
97 this.self = scheduleRule1Flat; 82 this.self = scheduleRule1Flat;
98 } 83 }
99 84
@@ -179,11 +164,4 @@ public class ScheduleRule_input { @@ -179,11 +164,4 @@ public class ScheduleRule_input {
179 this.self = self; 164 this.self = self;
180 } 165 }
181 166
182 - public String getRuleMd5() {  
183 - return ruleMd5;  
184 - }  
185 -  
186 - public void setRuleMd5(String ruleMd5) {  
187 - this.ruleMd5 = ruleMd5;  
188 - }  
189 } 167 }
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.validate;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import org.kie.api.runtime.rule.AccumulateFunction;
  5 +
  6 +import java.io.*;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.HashMap;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * 计算班次重复错误。
  15 + * 同一个路牌下,相同发车时间的班次数。
  16 + * 注意:使用这个函数时,要一天计算一次,多天计算无意义。
  17 + */
  18 +public class ValidRepeatBcFunction implements AccumulateFunction {
  19 + @Override
  20 + public void writeExternal(ObjectOutput out) throws IOException {
  21 + }
  22 +
  23 + @Override
  24 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  25 +
  26 + }
  27 +
  28 + protected static class RepeatBcInfo implements Externalizable {
  29 + /** 错误描述 */
  30 + public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>();
  31 + /** 内部计数Map,key:{路牌Id}_{发车时间},value:个数 */
  32 + public Map<String, Integer> lpBcFcsjCount = new HashMap<>();
  33 +
  34 + public RepeatBcInfo() {
  35 + }
  36 +
  37 + @Override
  38 + public void writeExternal(ObjectOutput out) throws IOException {
  39 + out.writeObject(validInfoList);
  40 + }
  41 +
  42 + @Override
  43 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  44 + validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject();
  45 + }
  46 + }
  47 +
  48 + @Override
  49 + public Serializable createContext() {
  50 + return new RepeatBcInfo();
  51 + }
  52 +
  53 + @Override
  54 + public void init(Serializable serializable) throws Exception {
  55 + // TODO:
  56 + }
  57 +
  58 + @Override
  59 + public void accumulate(Serializable context, Object o) {
  60 + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context;
  61 + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o;
  62 +
  63 + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj();
  64 + SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日");
  65 + String infoformat = "日期(%s),路牌(%s),班次(%s),重复(%d)次";
  66 + if (repeatBcInfo.lpBcFcsjCount.get(key) == null) {
  67 + repeatBcInfo.lpBcFcsjCount.put(key, 1);
  68 + } else {
  69 + int count = repeatBcInfo.lpBcFcsjCount.get(key) + 1;
  70 + ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo();
  71 + validInfo.setSd(schedulePlanInfo.getScheduleDate());
  72 + validInfo.setDesc(String.format(
  73 + infoformat,
  74 + sf.format(schedulePlanInfo.getScheduleDate()),
  75 + schedulePlanInfo.getLpName(),
  76 + schedulePlanInfo.getFcsj(),
  77 + count));
  78 + repeatBcInfo.validInfoList.add(validInfo);
  79 + repeatBcInfo.lpBcFcsjCount.put(key, count);
  80 + }
  81 + }
  82 +
  83 + @Override
  84 + public boolean supportsReverse() {
  85 + return false;
  86 + }
  87 +
  88 + @Override
  89 + public void reverse(Serializable serializable, Object o) throws Exception {
  90 +
  91 + }
  92 +
  93 + @Override
  94 + public Class<?> getResultType() {
  95 + return List.class;
  96 + }
  97 +
  98 + @Override
  99 + public Object getResult(Serializable context) throws Exception {
  100 + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context;
  101 + return repeatBcInfo.validInfoList;
  102 + }
  103 +}
src/main/java/com/bsth/service/schedule/rules/validate/ValidateParam.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.validate;
  2 +
  3 +import org.joda.time.DateTime;
  4 +import org.joda.time.Period;
  5 +import org.joda.time.PeriodType;
  6 +
  7 +/**
  8 + * Created by xu on 17/5/11.
  9 + */
  10 +public class ValidateParam {
  11 + /** 开始计算日期 */
  12 + private DateTime fromDate;
  13 + /** 结束计算日期 */
  14 + private DateTime toDate;
  15 +
  16 + /** 间隔天数 */
  17 + private Integer days;
  18 +
  19 + public ValidateParam(DateTime f, DateTime t) {
  20 + this.fromDate = f;
  21 + this.toDate = t;
  22 + Period period = new Period(fromDate, toDate, PeriodType.days());
  23 + days = period.getDays() + 1;
  24 + }
  25 +
  26 + public DateTime getFromDate() {
  27 + return fromDate;
  28 + }
  29 +
  30 + public void setFromDate(DateTime fromDate) {
  31 + this.fromDate = fromDate;
  32 + }
  33 +
  34 + public DateTime getToDate() {
  35 + return toDate;
  36 + }
  37 +
  38 + public void setToDate(DateTime toDate) {
  39 + this.toDate = toDate;
  40 + }
  41 +
  42 + public Integer getDays() {
  43 + return days;
  44 + }
  45 +
  46 + public void setDays(Integer days) {
  47 + this.days = days;
  48 + }
  49 +}
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.validate;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 验证输出。
  9 + */
  10 +public class ValidateResults_output {
  11 + private List<ValidInfo> infos = new ArrayList<>();
  12 +
  13 + public static class ValidInfo {
  14 + /** 日期 */
  15 + private Date sd;
  16 + /** 描述 */
  17 + private String desc;
  18 +
  19 + public Date getSd() {
  20 + return sd;
  21 + }
  22 +
  23 + public void setSd(Date sd) {
  24 + this.sd = sd;
  25 + }
  26 +
  27 + public String getDesc() {
  28 + return desc;
  29 + }
  30 +
  31 + public void setDesc(String desc) {
  32 + this.desc = desc;
  33 + }
  34 + }
  35 +
  36 + public List<ValidInfo> getInfos() {
  37 + return infos;
  38 + }
  39 +
  40 + public void setInfos(List<ValidInfo> infos) {
  41 + this.infos = infos;
  42 + }
  43 +}
src/main/resources/application-dev.properties
@@ -10,7 +10,7 @@ spring.jpa.show-sql= true @@ -10,7 +10,7 @@ spring.jpa.show-sql= true
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 spring.datasource.username= root 12 spring.datasource.username= root
13 -spring.datasource.password= root 13 +spring.datasource.password=
14 14
15 #DATASOURCE 15 #DATASOURCE
16 spring.datasource.max-active=100 16 spring.datasource.max-active=100
src/main/resources/datatools/ktrs/scheduleRuleDataInput.ktr
@@ -429,7 +429,7 @@ @@ -429,7 +429,7 @@
429 <name>cid</name> 429 <name>cid</name>
430 </field> 430 </field>
431 <field> 431 <field>
432 - <name>&#x8def;&#x724c;&#x8303;&#x56f4;</name> 432 + <name>lpnames</name>
433 </field> 433 </field>
434 <field> 434 <field>
435 <name>lpids</name> 435 <name>lpids</name>
@@ -460,6 +460,12 @@ @@ -460,6 +460,12 @@
460 <type>CONCAT_STRING</type> 460 <type>CONCAT_STRING</type>
461 <valuefield>,</valuefield> 461 <valuefield>,</valuefield>
462 </field> 462 </field>
  463 + <field>
  464 + <aggregate>rybms</aggregate>
  465 + <subject>rybm</subject>
  466 + <type>CONCAT_STRING</type>
  467 + <valuefield>,</valuefield>
  468 + </field>
463 </fields> 469 </fields>
464 <cluster_schema/> 470 <cluster_schema/>
465 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 471 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -496,9 +502,6 @@ @@ -496,9 +502,6 @@
496 <name>cid</name> 502 <name>cid</name>
497 </field> 503 </field>
498 <field> 504 <field>
499 - <name>&#x8def;&#x724c;&#x8303;&#x56f4;</name>  
500 - </field>  
501 - <field>  
502 <name>&#x8d77;&#x59cb;&#x8def;&#x724c;</name> 505 <name>&#x8d77;&#x59cb;&#x8def;&#x724c;</name>
503 </field> 506 </field>
504 <field> 507 <field>
@@ -524,6 +527,12 @@ @@ -524,6 +527,12 @@
524 <type>CONCAT_STRING</type> 527 <type>CONCAT_STRING</type>
525 <valuefield>,</valuefield> 528 <valuefield>,</valuefield>
526 </field> 529 </field>
  530 + <field>
  531 + <aggregate>lpnames</aggregate>
  532 + <subject>lpname</subject>
  533 + <type>CONCAT_STRING</type>
  534 + <valuefield>,</valuefield>
  535 + </field>
527 </fields> 536 </fields>
528 <cluster_schema/> 537 <cluster_schema/>
529 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 538 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
@@ -712,13 +721,19 @@ @@ -712,13 +721,19 @@
712 <optimizationLevel>9</optimizationLevel> 721 <optimizationLevel>9</optimizationLevel>
713 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 722 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
714 <jsScript_name>Script 1</jsScript_name> 723 <jsScript_name>Script 1</jsScript_name>
715 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var rycid&#x3b;&#xa;&#xa;if &#x28;rycid2 &#x3d;&#x3d; null&#x29; &#x7b;&#xa; rycid &#x3d; rycid1&#x3b;&#xa;&#x7d; else &#x7b;&#xa; rycid &#x3d; rycid1 &#x2b; &#x22;-&#x22; &#x2b; rycid2&#x3b;&#xa;&#x7d;</jsScript_script> 724 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var rycid&#x3b;&#xa;var rybm&#x3b;&#xa;&#xa;if &#x28;rycid2 &#x3d;&#x3d; null&#x29; &#x7b;&#xa; rycid &#x3d; rycid1&#x3b;&#xa; rybm &#x3d; dbbm1&#x3b;&#xa;&#x7d; else &#x7b;&#xa; rycid &#x3d; rycid1 &#x2b; &#x22;-&#x22; &#x2b; rycid2&#x3b;&#xa; rybm &#x3d; dbbm1 &#x2b; &#x22;-&#x22; &#x2b; dbbm2&#x3b;&#xa;&#x7d;</jsScript_script>
716 </jsScript> </jsScripts> <fields> <field> <name>rycid</name> 725 </jsScript> </jsScripts> <fields> <field> <name>rycid</name>
717 <rename>rycid</rename> 726 <rename>rycid</rename>
718 <type>String</type> 727 <type>String</type>
719 <length>-1</length> 728 <length>-1</length>
720 <precision>-1</precision> 729 <precision>-1</precision>
721 <replace>N</replace> 730 <replace>N</replace>
  731 + </field> <field> <name>rybm</name>
  732 + <rename>rybm</rename>
  733 + <type>String</type>
  734 + <length>-1</length>
  735 + <precision>-1</precision>
  736 + <replace>N</replace>
722 </field> </fields> <cluster_schema/> 737 </field> </fields> <cluster_schema/>
723 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> 738 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
724 <xloc>917</xloc> 739 <xloc>917</xloc>
@@ -927,12 +942,6 @@ @@ -927,12 +942,6 @@
927 <presorted>N</presorted> 942 <presorted>N</presorted>
928 </field> 943 </field>
929 <field> 944 <field>
930 - <name>&#x8def;&#x724c;&#x8303;&#x56f4;</name>  
931 - <ascending>Y</ascending>  
932 - <case_sensitive>N</case_sensitive>  
933 - <presorted>N</presorted>  
934 - </field>  
935 - <field>  
936 <name>&#x8d77;&#x59cb;&#x8def;&#x724c;</name> 945 <name>&#x8d77;&#x59cb;&#x8def;&#x724c;</name>
937 <ascending>Y</ascending> 946 <ascending>Y</ascending>
938 <case_sensitive>N</case_sensitive> 947 <case_sensitive>N</case_sensitive>
@@ -1009,7 +1018,7 @@ @@ -1009,7 +1018,7 @@
1009 <presorted>N</presorted> 1018 <presorted>N</presorted>
1010 </field> 1019 </field>
1011 <field> 1020 <field>
1012 - <name>&#x8def;&#x724c;&#x8303;&#x56f4;</name> 1021 + <name>lpnames</name>
1013 <ascending>Y</ascending> 1022 <ascending>Y</ascending>
1014 <case_sensitive>N</case_sensitive> 1023 <case_sensitive>N</case_sensitive>
1015 <presorted>N</presorted> 1024 <presorted>N</presorted>
@@ -1106,7 +1115,7 @@ @@ -1106,7 +1115,7 @@
1106 </value> 1115 </value>
1107 <value> 1116 <value>
1108 <name>lp_names</name> 1117 <name>lp_names</name>
1109 - <rename>&#x8def;&#x724c;&#x8303;&#x56f4;</rename> 1118 + <rename>lpnames</rename>
1110 <update>Y</update> 1119 <update>Y</update>
1111 </value> 1120 </value>
1112 <value> 1121 <value>
@@ -1126,7 +1135,7 @@ @@ -1126,7 +1135,7 @@
1126 </value> 1135 </value>
1127 <value> 1136 <value>
1128 <name>ry_dbbms</name> 1137 <name>ry_dbbms</name>
1129 - <rename>&#x4eba;&#x5458;&#x8303;&#x56f4;</rename> 1138 + <rename>rybms</rename>
1130 <update>Y</update> 1139 <update>Y</update>
1131 </value> 1140 </value>
1132 <value> 1141 <value>
src/main/resources/rules/functions.drl
@@ -4,4 +4,5 @@ import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction e @@ -4,4 +4,5 @@ import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction e
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; 6 import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
7 -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq  
8 \ No newline at end of file 7 \ No newline at end of file
  8 +import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq;
  9 +import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb;
9 \ No newline at end of file 10 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
@@ -31,6 +31,7 @@ global ScheduleRuleService scheduleRuleService; @@ -31,6 +31,7 @@ global ScheduleRuleService scheduleRuleService;
31 declare Calcu_days_result_pre 31 declare Calcu_days_result_pre
32 ruleId: String // 规则Id 32 ruleId: String // 规则Id
33 ruleMd5: String // 规则md5 33 ruleMd5: String // 规则md5
  34 + ruleEcCount: Integer // 人员范围个数
34 35
35 calcu_index_lp : Integer // 计算之后路牌的起始索引 36 calcu_index_lp : Integer // 计算之后路牌的起始索引
36 calcu_index_ry : Integer // 计算之后人员的起始索引 37 calcu_index_ry : Integer // 计算之后人员的起始索引
@@ -61,8 +62,8 @@ rule &quot;calcu_days_1_&quot; @@ -61,8 +62,8 @@ rule &quot;calcu_days_1_&quot;
61 $toDate : toDate, 62 $toDate : toDate,
62 $xlId: xlId 63 $xlId: xlId
63 ) 64 )
64 - ScheduleRule_input(  
65 - $ruleId : ruleId, $qyrq : qyrq, $ruleMd5: ruleMd5, 65 + $sri: ScheduleRule_input(
  66 + $ruleId : ruleId, $qyrq : qyrq,
66 $lpindex : startGbdIndex, $ryindex: startEIndex) 67 $lpindex : startGbdIndex, $ryindex: startEIndex)
67 eval($qyrq.isBefore($fromDate)) 68 eval($qyrq.isBefore($fromDate))
68 then 69 then
@@ -71,7 +72,6 @@ rule &quot;calcu_days_1_&quot; @@ -71,7 +72,6 @@ rule &quot;calcu_days_1_&quot;
71 // 构造Calcu_days_result_pre,用于路牌 72 // 构造Calcu_days_result_pre,用于路牌
72 Calcu_days_result_pre cdrp = new Calcu_days_result_pre(); 73 Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
73 cdrp.setRuleId($ruleId); 74 cdrp.setRuleId($ruleId);
74 - cdrp.setRuleMd5($ruleMd5);  
75 cdrp.setCalcu_index_lp($lpindex); 75 cdrp.setCalcu_index_lp($lpindex);
76 cdrp.setCalcu_index_ry($ryindex); 76 cdrp.setCalcu_index_ry($ryindex);
77 cdrp.setCalcu_start_date_1($qyrq); 77 cdrp.setCalcu_start_date_1($qyrq);
@@ -81,6 +81,19 @@ rule &quot;calcu_days_1_&quot; @@ -81,6 +81,19 @@ rule &quot;calcu_days_1_&quot;
81 cdrp.setCalcu_start_date_2($fromDate); 81 cdrp.setCalcu_start_date_2($fromDate);
82 cdrp.setCalcu_end_date_2($toDate); 82 cdrp.setCalcu_end_date_2($toDate);
83 83
  84 + /**
  85 + * 规则md5值(不使用id判定,使用md5判定)
  86 + * 使用,启用日期,路牌范围,结合生成md5编码
  87 + */
  88 + String ruleMd5 = Md5Util.getMd5(
  89 + String.valueOf($qyrq.getMillis()) +
  90 + "_" +
  91 + $sri.getSelf().getLpIds()
  92 + );
  93 + cdrp.setRuleMd5(ruleMd5);
  94 + // 人员范围个数
  95 + cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
  96 +
84 insert(cdrp); 97 insert(cdrp);
85 98
86 // log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate); 99 // log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
@@ -97,8 +110,8 @@ rule &quot;calcu_days_2_&quot; @@ -97,8 +110,8 @@ rule &quot;calcu_days_2_&quot;
97 $toDate : toDate, 110 $toDate : toDate,
98 $xlId: xlId 111 $xlId: xlId
99 ) 112 )
100 - ScheduleRule_input(  
101 - $ruleId : ruleId, $qyrq : qyrq, $ruleMd5: ruleMd5, 113 + $sri: ScheduleRule_input(
  114 + $ruleId : ruleId, $qyrq : qyrq,
102 $lpindex : startGbdIndex, $ryindex: startEIndex) 115 $lpindex : startGbdIndex, $ryindex: startEIndex)
103 eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate))) 116 eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
104 then 117 then
@@ -107,7 +120,6 @@ rule &quot;calcu_days_2_&quot; @@ -107,7 +120,6 @@ rule &quot;calcu_days_2_&quot;
107 // 构造Calcu_days_result_pre,用于路牌 120 // 构造Calcu_days_result_pre,用于路牌
108 Calcu_days_result_pre cdrp = new Calcu_days_result_pre(); 121 Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
109 cdrp.setRuleId($ruleId); 122 cdrp.setRuleId($ruleId);
110 - cdrp.setRuleMd5($ruleMd5);  
111 cdrp.setCalcu_index_lp($lpindex); 123 cdrp.setCalcu_index_lp($lpindex);
112 cdrp.setCalcu_index_ry($ryindex); 124 cdrp.setCalcu_index_ry($ryindex);
113 cdrp.setCalcu_start_date_1($qyrq); 125 cdrp.setCalcu_start_date_1($qyrq);
@@ -117,6 +129,19 @@ rule &quot;calcu_days_2_&quot; @@ -117,6 +129,19 @@ rule &quot;calcu_days_2_&quot;
117 cdrp.setCalcu_start_date_2($qyrq); 129 cdrp.setCalcu_start_date_2($qyrq);
118 cdrp.setCalcu_end_date_2($toDate); 130 cdrp.setCalcu_end_date_2($toDate);
119 131
  132 + /**
  133 + * 规则md5值(不使用id判定,使用md5判定)
  134 + * 使用,启用日期,路牌范围,结合生成md5编码
  135 + */
  136 + String ruleMd5 = Md5Util.getMd5(
  137 + String.valueOf($qyrq.getMillis()) +
  138 + "_" +
  139 + $sri.getSelf().getLpIds()
  140 + );
  141 + cdrp.setRuleMd5(ruleMd5);
  142 + // 人员范围个数
  143 + cdrp.setRuleEcCount($sri.getEmployeeConfigIds().size());
  144 +
120 insert(cdrp); 145 insert(cdrp);
121 146
122 // log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate); 147 // log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
@@ -160,8 +185,9 @@ rule &quot;Calcu_SchedulePlanRuleResult_wrap&quot; @@ -160,8 +185,9 @@ rule &quot;Calcu_SchedulePlanRuleResult_wrap&quot;
160 185
161 // 规则Md5编码 186 // 规则Md5编码
162 String md5 = Md5Util.getMd5( 187 String md5 = Md5Util.getMd5(
163 - String.valueOf($sprr.getQyrq().getTime()) + "_" +  
164 - $sprr.getGids() + "_" + $sprr.getEcids() 188 + String.valueOf($sprr.getQyrq().getTime()) +
  189 + "_" +
  190 + $sprr.getGids()
165 ); 191 );
166 192
167 // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh()); 193 // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh());
@@ -181,7 +207,8 @@ rule &quot;calcu_days_1_with_result&quot; @@ -181,7 +207,8 @@ rule &quot;calcu_days_1_with_result&quot;
181 $cdrp: Calcu_days_result_pre( 207 $cdrp: Calcu_days_result_pre(
182 calcu_start_date_1.isBefore(calcu_start_date_2), 208 calcu_start_date_1.isBefore(calcu_start_date_2),
183 $ruleId: ruleId, 209 $ruleId: ruleId,
184 - $ruleMd5: ruleMd5 210 + $ruleMd5: ruleMd5,
  211 + $ruleEcCount: ruleEcCount
185 ) 212 )
186 $srrr_wrap: SchedulePlanRuleResult_wrap( 213 $srrr_wrap: SchedulePlanRuleResult_wrap(
187 // ruleId == $ruleId, 214 // ruleId == $ruleId,
@@ -196,8 +223,14 @@ rule &quot;calcu_days_1_with_result&quot; @@ -196,8 +223,14 @@ rule &quot;calcu_days_1_with_result&quot;
196 // 修正排班数据 223 // 修正排班数据
197 // log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate); 224 // log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate);
198 225
  226 + // 路牌范围起始index使用历史数据
199 $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex())); 227 $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex()));
200 - $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex())); 228 + // 人员范围起始index,需要判定,如果长度都是一样的,使用历史的,否则不更新,使用最新的
  229 + String history_ecids = $self.getEcids();
  230 + if ($ruleEcCount == history_ecids.split(",").length) {
  231 + $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex()));
  232 + }
  233 +
201 $cdrp.setCalcu_start_date_1($scheduleDate); 234 $cdrp.setCalcu_start_date_1($scheduleDate);
202 update($cdrp); 235 update($cdrp);
203 236
src/main/resources/rules/validplan.drl
1 -// TODO:  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +package com.bsth.service.schedule.rules.validate;
  3 +
  4 +import com.bsth.entity.schedule.SchedulePlanInfo;
  5 +
  6 +import org.joda.time.*;
  7 +import java.util.*;
  8 +
  9 +import org.slf4j.Logger;
  10 +
  11 +// 全局日志类(一般使用调用此规则的service类)
  12 +global Logger log;
  13 +
  14 +// 输出
  15 +global ValidateResults_output validResult;
  16 +
  17 +//------------------------- 第一阶段、构造循环体 ----------------------------//
  18 +
  19 +declare Loop_param
  20 + start_date: DateTime // 开始日期(这个要不停的更新迭代)
  21 + end_date: DateTime // 结束日期
  22 + sdays: Integer // 总共循环的天数
  23 +end
  24 +
  25 +rule "Calcu_Loop_param"
  26 + salience 1000
  27 + when
  28 + ValidateParam(
  29 + $fd: fromDate,
  30 + $ed: toDate,
  31 + $days: days
  32 + )
  33 + then
  34 + Loop_param p = new Loop_param();
  35 + p.setStart_date($fd);
  36 + p.setEnd_date($ed);
  37 + p.setSdays($days);
  38 +
  39 + insert(p);
  40 +end
  41 +
  42 +//------------------------- 第二阶段、验证计算 ----------------------------//
  43 +
  44 +
  45 +rule "Valid_repeat_bc" // 验证是否存在重复班次
  46 + salience 600
  47 + when
  48 + $lp: Loop_param($sd: start_date, $ed: end_date)
  49 + eval($sd.isBefore($ed) || $sd.isEqual($ed))
  50 + $spiList: ArrayList() from collect (SchedulePlanInfo(scheduleDate.getTime() == $sd.millis))
  51 + $infos: ArrayList() from accumulate ($spi: SchedulePlanInfo() from $spiList, vrb($spi))
  52 + then
  53 + // TODO:
  54 +// log.info("日期={},班次重复错误数={}", $sd, $infos.size());
  55 +
  56 + validResult.getInfos().addAll($infos);
  57 +
  58 + // 迭代
  59 + $lp.setStart_date($sd.plusDays(1));
  60 + update($lp);
  61 +
  62 +end
  63 +
  64 +
  65 +
  66 +
  67 +
  68 +
  69 +
  70 +
src/main/resources/static/pages/base/section/editsection.html
1 <!-- 编辑路段 --> 1 <!-- 编辑路段 -->
2 -<div class="modal fade" id="edit_section_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 上一路段: 49 上一路段:
50 </label> 50 </label>
51 <div class="col-md-6"> 51 <div class="col-md-6">
52 - <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect"></select> 52 + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select>
53 <span class="help-block">说明:选择的路段将作为本路段序号的参考,成为选择路段的下一个路段。 </span> 53 <span class="help-block">说明:选择的路段将作为本路段序号的参考,成为选择路段的下一个路段。 </span>
54 </div> 54 </div>
55 </div> 55 </div>
@@ -162,7 +162,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -162,7 +162,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
162 var sectionRouteId = Section.sectionRouteId; 162 var sectionRouteId = Section.sectionRouteId;
163 // 获取路段号元素,并添加下拉属性值 163 // 获取路段号元素,并添加下拉属性值
164 ajaxd.getStation(lineId,dir,function(treeData) { 164 ajaxd.getStation(lineId,dir,function(treeData) {
165 - var options = '<option value="">请选择...</option>'; 165 + /* var options = '<option value="">请选择...</option>';
166 var dArray = treeData[0].children[1].children; 166 var dArray = treeData[0].children[1].children;
167 var eq_stationRouteCode = Section.sectionRouteCode; 167 var eq_stationRouteCode = Section.sectionRouteCode;
168 for(var i = 0 ; i<dArray.length; i++){ 168 for(var i = 0 ; i<dArray.length; i++){
@@ -181,6 +181,33 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -181,6 +181,33 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
181 }else { 181 }else {
182 $('#sectionrouteCodeSelect').val(''); 182 $('#sectionrouteCodeSelect').val('');
183 } 183 }
  184 + }); */
  185 + var array = treeData[0].children[1].children,paramsD =new Array();
  186 + var eq_scetionRouteCode = Section.sectionRouteCode;
  187 + paramsD.push({'id':'请选择...','text':'请选择...'});
  188 + // 遍历.
  189 + $.each(array, function(i, g){
  190 + // 判断.
  191 + if(g.sectionName!='' || g.sectionName != null) {
  192 + var ptions_v = g.sectionrouteCode;
  193 + if(eq_scetionRouteCode != ptions_v){
  194 + // 添加拼音检索下拉框格式数据数组.
  195 + paramsD.push({'id':ptions_v,
  196 + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + dirdmToName(g.sectionrouteDirections)});
  197 + }
  198 + }
  199 + });
  200 + // 初始化上一个路段拼音检索下拉框.
  201 + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {
  202 + $('#sectionDirSelect').val('');// 设值方向.
  203 + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) {
  204 + if(str.length>0){
  205 + var upStationRouteCode = str[0].sectionrouteCode;
  206 + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode);
  207 + }else {
  208 + $('#sectionrouteCodeSelect').select2('val','请选择...');
  209 + }
  210 + });
184 }); 211 });
185 }); 212 });
186 function dirdmToName(value) { 213 function dirdmToName(value) {
@@ -257,6 +284,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -257,6 +284,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
257 // 设置日期 284 // 设置日期
258 params.createDate = moment(Section.carParkCreateDate).format(fs); 285 params.createDate = moment(Section.carParkCreateDate).format(fs);
259 error.hide(); 286 error.hide();
  287 + if(params.sectionrouteCode=='请选择...')
  288 + params.sectionrouteCode='';
260 ajaxd.sectionUpdate(params,function(resuntDate) { 289 ajaxd.sectionUpdate(params,function(resuntDate) {
261 if(resuntDate.status=='SUCCESS') { 290 if(resuntDate.status=='SUCCESS') {
262 // 弹出添加成功提示消息 291 // 弹出添加成功提示消息
src/main/resources/static/pages/base/station/edit.html
1 <!-- 编辑站点弹出层mobal --> 1 <!-- 编辑站点弹出层mobal -->
2 -<div class="modal fade" id="editPoitsions_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="editPoitsions_station_mobal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <!-- 弹出层标题title容器 --> 5 <!-- 弹出层标题title容器 -->
@@ -209,6 +209,7 @@ @@ -209,6 +209,7 @@
209 </div> 209 </div>
210 <script type="text/javascript"> 210 <script type="text/javascript">
211 $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fun,stat){ 211 $('#editPoitsions_station_mobal').on('editStationMobal_show', function(e, map,fun,stat){
  212 + layer.closeAll();
212 // 获取站点对象信息 213 // 获取站点对象信息
213 var editStation = stat.getAddStation(); 214 var editStation = stat.getAddStation();
214 // 初始化表单值 215 // 初始化表单值
@@ -297,7 +298,9 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -297,7 +298,9 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
297 // 站点序号值改变事件 298 // 站点序号值改变事件
298 $('#stationrouteSelect').on('change',function() { 299 $('#stationrouteSelect').on('change',function() {
299 var stationRValue = $('#stationrouteSelect').val(); 300 var stationRValue = $('#stationrouteSelect').val();
300 - if(stationRValue) { 301 + if(stationRValue=='请选择...') {
  302 + $('#stationMarkSelect').val('B');
  303 + }else {
301 var tempStr = stationRValue.split('_'); 304 var tempStr = stationRValue.split('_');
302 if(tempStr[1] == 'E') { 305 if(tempStr[1] == 'E') {
303 $('#stationMarkSelect').val('E'); 306 $('#stationMarkSelect').val('E');
@@ -318,8 +321,15 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -318,8 +321,15 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
318 if(g.name!='' || g.name != null) { 321 if(g.name!='' || g.name != null) {
319 if(g.stationRouteCode != editStation.stationRouteCode) { 322 if(g.stationRouteCode != editStation.stationRouteCode) {
320 // 添加拼音检索下拉框格式数据数组. 323 // 添加拼音检索下拉框格式数据数组.
321 - paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,  
322 - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); 324 + /* paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
  325 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); */
  326 + if(editStation.stationRouteStationMark=='E' && i == (len_-2)){
  327 + paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions,
  328 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  329 + }else {
  330 + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
  331 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  332 + }
323 } 333 }
324 } 334 }
325 }); 335 });
@@ -333,10 +343,17 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -333,10 +343,17 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
333 } 343 }
334 function setZdlyValue() { 344 function setZdlyValue() {
335 fun.findUpStationRouteCode(editStation.stationRouteLine,editStation.stationRoutedirections,editStation.stationRouteCode,function(str) { 345 fun.findUpStationRouteCode(editStation.stationRouteLine,editStation.stationRoutedirections,editStation.stationRouteCode,function(str) {
336 - if(str.length>0){ 346 + /* if(str.length>0){
337 var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStation.stationRoutedirections; 347 var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStation.stationRoutedirections;
338 $('#stationrouteSelect').select2('val',upStationRouteCode); 348 $('#stationrouteSelect').select2('val',upStationRouteCode);
  349 + } */
  350 + if(str.length>0){
  351 + var upStationRouteCode = str[0].stationRouteCode + '_' + editStation.stationRouteStationMark + '_' + editStation.stationRoutedirections;
  352 + $('#stationrouteSelect').select2('val',upStationRouteCode);
  353 + }else {
  354 + $('#stationrouteSelect').select2('val','请选择...');
339 } 355 }
  356 + $('#stationMarkSelect').val(editStation.stationRouteStationMark);
340 }); 357 });
341 } 358 }
342 // 当站点类型为中途站或者终点站时,上一站点为必填项! 359 // 当站点类型为中途站或者终点站时,上一站点为必填项!
src/main/resources/static/pages/base/stationroute/add.html
1 <!-- 新增站点 --> 1 <!-- 新增站点 -->
2 -<div class="modal fade" id="add_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -180,7 +180,7 @@ @@ -180,7 +180,7 @@
180 180
181 <!-- 描述/说明 --> 181 <!-- 描述/说明 -->
182 <div class="form-group"> 182 <div class="form-group">
183 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label> 183 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;: </label>
184 <div class="col-md-6"> 184 <div class="col-md-6">
185 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> 185 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
186 </div> 186 </div>
@@ -243,7 +243,9 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao @@ -243,7 +243,9 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
243 // 站点序号值改变事件 243 // 站点序号值改变事件
244 $('#stationrouteSelect').on('change',function() { 244 $('#stationrouteSelect').on('change',function() {
245 var stationRValue = $('#stationrouteSelect').val(); 245 var stationRValue = $('#stationrouteSelect').val();
246 - if(stationRValue) { 246 + if(stationRValue=='请选择...') {
  247 + $('#stationMarkSelect').val('B');
  248 + }else {
247 var tempStr = stationRValue.split('_'); 249 var tempStr = stationRValue.split('_');
248 if(tempStr[1] == 'E') { 250 if(tempStr[1] == 'E') {
249 $('#stationMarkSelect').val('E'); 251 $('#stationMarkSelect').val('E');
src/main/resources/static/pages/base/stationroute/css/bmap_base.css
@@ -93,4 +93,39 @@ html,body{ @@ -93,4 +93,39 @@ html,body{
93 93
94 box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; 94 box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important;
95 95
  96 +}
  97 +
  98 +.defeat-scroll {
  99 +width: 98%;
  100 +height:380px;
  101 +/* overflow:auto; */
  102 +overflow:hidden;
  103 +}
  104 +.defeat-scroll::-webkit-scrollbar {
  105 +width:6px;
  106 +height:6px;
  107 +}
  108 +.defeat-scroll::-webkit-scrollbar-button {
  109 +/* background-color:#FF7677; */
  110 +background:rgba(255, 255, 255, 0);
  111 +}
  112 +.defeat-scroll::-webkit-scrollbar-track {
  113 +/* background:#FF66D5; */
  114 +background:rgba(255, 255, 255, 0);
  115 +}
  116 +.defeat-scroll::-webkit-scrollbar-track-piece {
  117 +/* background:#ff0000; */
  118 +background:rgba(255, 255, 255, 0);
  119 +}
  120 +.defeat-scroll::-webkit-scrollbar-thumb{
  121 +background:rgba(197, 196, 196, 0.81);
  122 +border-radius:10px !important;
  123 +}
  124 +.defeat-scroll::-webkit-scrollbar-corner {
  125 +/* background:#82AFFF; */
  126 +background:rgba(255, 255, 255, 0);
  127 +}
  128 +.defeat-scroll::-webkit-scrollbar-resizer {
  129 +/* background:#FF0BEE; */
  130 +background:rgba(255, 255, 255, 0);
96 } 131 }
97 \ No newline at end of file 132 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/edit.html
1 <!-- 编辑站点 --> 1 <!-- 编辑站点 -->
2 -<div class="modal fade" id="edit_station_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="edit_station_mobal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
50 <span class="required"> * </span> 站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 50 <span class="required"> * </span> 站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
51 </label> 51 </label>
52 <div class="col-md-6"> 52 <div class="col-md-6">
53 - <input type="text" class="form-control" name="stationCod" id="stationCodInput" placeholder="站点编码"> 53 + <input type="text" class="form-control" name="stationCod" id="stationCodInput" placeholder="站点编码" readonly="readonly">
54 </div> 54 </div>
55 </div> 55 </div>
56 </div> 56 </div>
@@ -177,7 +177,7 @@ @@ -177,7 +177,7 @@
177 </div> 177 </div>
178 <!-- 描述/说明 --> 178 <!-- 描述/说明 -->
179 <div class="form-group"> 179 <div class="form-group">
180 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;: </label> 180 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;: </label>
181 <div class="col-md-6"> 181 <div class="col-md-6">
182 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> 182 <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
183 </div> 183 </div>
@@ -194,6 +194,7 @@ @@ -194,6 +194,7 @@
194 <script type="text/javascript"> 194 <script type="text/javascript">
195 195
196 $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,station_,Line_,fun){ 196 $('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,station_,Line_,fun){
  197 + layer.closeAll();
197 var editStationParmasObj = station_.getEitdStation(); 198 var editStationParmasObj = station_.getEitdStation();
198 var addLine = Line_.getLineObj(); 199 var addLine = Line_.getLineObj();
199 fun.setFormValue(editStationParmasObj); 200 fun.setFormValue(editStationParmasObj);
@@ -290,7 +291,9 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -290,7 +291,9 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
290 // 站点序号值改变事件 291 // 站点序号值改变事件
291 $('#stationrouteSelect').on('change',function() { 292 $('#stationrouteSelect').on('change',function() {
292 var stationRValue = $('#stationrouteSelect').val(); 293 var stationRValue = $('#stationrouteSelect').val();
293 - if(stationRValue) { 294 + if(stationRValue=='请选择...') {
  295 + $('#stationMarkSelect').val('B');
  296 + }else {
294 var tempStr = stationRValue.split('_'); 297 var tempStr = stationRValue.split('_');
295 if(tempStr[1] == 'E') { 298 if(tempStr[1] == 'E') {
296 $('#stationMarkSelect').val('E'); 299 $('#stationMarkSelect').val('E');
@@ -311,8 +314,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -311,8 +314,13 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
311 if(g.name!='' || g.name != null) { 314 if(g.name!='' || g.name != null) {
312 if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) { 315 if(g.stationRouteCode != editStationParmasObj.stationRouteStationRouteCode) {
313 // 添加拼音检索下拉框格式数据数组. 316 // 添加拼音检索下拉框格式数据数组.
314 - paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,  
315 - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)}); 317 + if(editStationParmasObj.stationRouteStationMark=='E' && i == (len_-2)){
  318 + paramsD.push({'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions,
  319 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  320 + }else {
  321 + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
  322 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  323 + }
316 } 324 }
317 } 325 }
318 }); 326 });
@@ -327,12 +335,14 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati @@ -327,12 +335,14 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
327 function setZdlyValue() { 335 function setZdlyValue() {
328 ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) { 336 ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) {
329 if(str.length>0){ 337 if(str.length>0){
330 - var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections; 338 + /* var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections; */
  339 + var upStationRouteCode = str[0].stationRouteCode + '_' + editStationParmasObj.stationRouteStationMark + '_' + editStationParmasObj.stationRouteDirections;
331 $('#stationrouteSelect').select2('val',upStationRouteCode); 340 $('#stationrouteSelect').select2('val',upStationRouteCode);
332 }else { 341 }else {
333 $('#stationrouteSelect').select2('val','请选择...'); 342 $('#stationrouteSelect').select2('val','请选择...');
334 - $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark); 343 + /* $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark); */
335 } 344 }
  345 + $('#stationMarkSelect').val(editStationParmasObj.stationRouteStationMark);
336 }); 346 });
337 } 347 }
338 // 当站点类型为中途站或者终点站时,上一站点为必填项! 348 // 当站点类型为中途站或者终点站时,上一站点为必填项!
src/main/resources/static/pages/base/stationroute/editsection.html
1 <!-- 编辑路段 --> 1 <!-- 编辑路段 -->
2 -<div class="modal fade" id="edit_section_mobal" tabindex="-1" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 上一路段: 49 上一路段:
50 </label> 50 </label>
51 <div class="col-md-6"> 51 <div class="col-md-6">
52 - <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect"></select> 52 + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect" style="width:100%"></select>
53 <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> 53 <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span>
54 </div> 54 </div>
55 </div> 55 </div>
@@ -157,10 +157,9 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -157,10 +157,9 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
157 var lineId = Section.sectionrouteLine; 157 var lineId = Section.sectionrouteLine;
158 // 获取路段号元素,并添加下拉属性值 158 // 获取路段号元素,并添加下拉属性值
159 ajaxd.getStation(lineId,dir,function(treeData) { 159 ajaxd.getStation(lineId,dir,function(treeData) {
160 - var options = '<option value="">请选择...</option>';  
161 - var dArray = treeData[0].children[1].children; 160 + var array = treeData[0].children[1].children,paramsD =new Array();
162 var eq_scetionRouteCode = Section.sectionrouteCode; 161 var eq_scetionRouteCode = Section.sectionrouteCode;
163 - for(var i = 0 ; i<dArray.length; i++){ 162 + /* for(var i = 0 ; i<dArray.length; i++){
164 var ptions_v = dArray[i].sectionrouteCode; 163 var ptions_v = dArray[i].sectionrouteCode;
165 if(eq_scetionRouteCode == ptions_v){ 164 if(eq_scetionRouteCode == ptions_v){
166 continue; 165 continue;
@@ -168,17 +167,32 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -168,17 +167,32 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
168 options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')' 167 options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName + ' (' + ptions_v +')'
169 + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ; 168 + ' --' + fun.dirdmToName(dArray[i].sectionrouteDirections) + '</option>' ;
170 } 169 }
171 - $('#sectionrouteCodeSelect').html(options);  
172 - ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) {  
173 - debugger;  
174 - console.log(eq_scetionRouteCode);  
175 - if(str.length>0){  
176 - var upStationRouteCode = str[0].sectionrouteCode;  
177 - $('#sectionrouteCodeSelect').val(upStationRouteCode);  
178 - }else {  
179 - $('#sectionrouteCodeSelect').val(''); 170 + $('#sectionrouteCodeSelect').html(options); */
  171 + paramsD.push({'id':'请选择...','text':'请选择...'});
  172 + // 遍历.
  173 + $.each(array, function(i, g){
  174 + // 判断.
  175 + if(g.sectionName!='' || g.sectionName != null) {
  176 + var ptions_v = g.sectionrouteCode;
  177 + if(eq_scetionRouteCode != ptions_v){
  178 + // 添加拼音检索下拉框格式数据数组.
  179 + paramsD.push({'id':ptions_v,
  180 + 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)});
  181 + }
180 } 182 }
181 }); 183 });
  184 + // 初始化上一个路段拼音检索下拉框.
  185 + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {
  186 + $('#sectionDirSelect').val('');// 设值方向.
  187 + ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) {
  188 + if(str.length>0){
  189 + var upStationRouteCode = str[0].sectionrouteCode;
  190 + $('#sectionrouteCodeSelect').select2('val',upStationRouteCode);
  191 + }else {
  192 + $('#sectionrouteCodeSelect').select2('val','请选择...');
  193 + }
  194 + });
  195 + });
182 }); 196 });
183 // 显示mobal 197 // 显示mobal
184 $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false}); 198 $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});
@@ -238,6 +252,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect @@ -238,6 +252,8 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
238 submitHandler : function(f) { 252 submitHandler : function(f) {
239 var params = form.serializeJSON(); 253 var params = form.serializeJSON();
240 error.hide(); 254 error.hide();
  255 + if(params.sectionrouteCode=='请选择...')
  256 + params.sectionrouteCode='';
241 ajaxd.sectionUpdate(params,function(resuntDate) { 257 ajaxd.sectionUpdate(params,function(resuntDate) {
242 if(resuntDate.status=='SUCCESS') { 258 if(resuntDate.status=='SUCCESS') {
243 // 弹出添加成功提示消息 259 // 弹出添加成功提示消息
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
@@ -238,4 +238,9 @@ $(function(){ @@ -238,4 +238,9 @@ $(function(){
238 } 238 }
239 }); 239 });
240 }); 240 });
  241 + $('#scrllmouseEvent').on('mousemove',function() {
  242 + $('.defeat-scroll').css('overflow','auto');
  243 + }).on('mouseleave',function() {
  244 + $('.defeat-scroll').css('overflow','hidden');
  245 + });
241 }); 246 });
242 \ No newline at end of file 247 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -354,7 +354,7 @@ var PublicFunctions = function () { @@ -354,7 +354,7 @@ var PublicFunctions = function () {
354 // 获取站点编码元素设值 354 // 获取站点编码元素设值
355 $('#stationCodInput').val(editStationParmas.stationStationCod); 355 $('#stationCodInput').val(editStationParmas.stationStationCod);
356 // 获取站点类型元素设值 356 // 获取站点类型元素设值
357 - $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark); 357 + // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
358 // 获取站点方向元素设值 358 // 获取站点方向元素设值
359 $('#stationdirSelect').val(editStationParmas.stationRouteDirections); 359 $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
360 // 获取站点道路编码元素设值 360 // 获取站点道路编码元素设值
src/main/resources/static/pages/base/stationroute/list.html
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <div id="bmap_basic" class="bmaps"></div> 4 <div id="bmap_basic" class="bmaps"></div>
5 <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;"> 5 <div class="portlet box protlet-box" style="top:20px;border-radius: 6px !important;box-shadow: 10px 10px 5px #888888;">
6 <!-- 左边标题栏 --> 6 <!-- 左边标题栏 -->
7 - <div class="portlet-title" style="background-color:#3B3F51"> 7 + <div class="portlet-title" style="background-color:#12527f;">
8 <div class="caption"> 8 <div class="caption">
9 <!-- 途径站点 --> 9 <!-- 途径站点 -->
10 </div> 10 </div>
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 </div> 13 </div>
14 </div> 14 </div>
15 <!-- 左边栏 --> 15 <!-- 左边栏 -->
16 - <div class="portlet-body" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 200px;"> 16 + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 380px;">
17 <div class="row"> 17 <div class="row">
18 <!-- 上下行栏 --> 18 <!-- 上下行栏 -->
19 <div class="col-md-3 col-sm-3 col-xs-3"> 19 <div class="col-md-3 col-sm-3 col-xs-3">
@@ -83,8 +83,8 @@ @@ -83,8 +83,8 @@
83 </div> 83 </div>
84 </div> 84 </div>
85 <!-- 树 --> 85 <!-- 树 -->
86 - <div class="portlet-body">  
87 - <div id="station_Up_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div> 86 + <div class="portlet-body" >
  87 + <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div>
88 </div> 88 </div>
89 </div> 89 </div>
90 <!-- 无上行站点添加方式 --> 90 <!-- 无上行站点添加方式 -->
@@ -176,7 +176,7 @@ @@ -176,7 +176,7 @@
176 </div> 176 </div>
177 <!-- 树 --> 177 <!-- 树 -->
178 <div class="portlet-body"> 178 <div class="portlet-body">
179 - <div id="station_Down_tree" style="height: auto;max-height: 500px;overflow-y: auto;"></div> 179 + <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div>
180 </div> 180 </div>
181 </div> 181 </div>
182 <!-- 无上行站点添加方式 --> 182 <!-- 无上行站点添加方式 -->
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/list.html
@@ -9,7 +9,8 @@ @@ -9,7 +9,8 @@
9 <th style="width: 100%;">关联时刻表</th> 9 <th style="width: 100%;">关联时刻表</th>
10 <th style="width: 150px;">排班开始日期</th> 10 <th style="width: 150px;">排班开始日期</th>
11 <th style="width: 150px;">排班结束日期</th> 11 <th style="width: 150px;">排班结束日期</th>
12 - <th style="width: 250px;">排班人/操作时间</th> 12 + <th style="width: 150px;">排班人/操作时间</th>
  13 + <th style="width: 100px;">状态</th>
13 <th style="width: 180px;">操作</th> 14 <th style="width: 180px;">操作</th>
14 </tr> 15 </tr>
15 <tr role="row" class="filter"> 16 <tr role="row" class="filter">
@@ -60,6 +61,7 @@ @@ -60,6 +61,7 @@
60 </div> 61 </div>
61 </td> 62 </td>
62 <td></td> 63 <td></td>
  64 + <td></td>
63 <td> 65 <td>
64 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 66 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
65 ng-click="ctrl.doPage()"> 67 ng-click="ctrl.doPage()">
@@ -94,9 +96,28 @@ @@ -94,9 +96,28 @@
94 <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span> 96 <span ng-bind="info.scheduleToTime | date: 'yyyy-MM-dd '"></span>
95 </td> 97 </td>
96 <td> 98 <td>
97 - <span ng-bind="info.updateBy.userName"></span>  
98 - /  
99 - <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span> 99 + <div>
  100 + <a href="#">
  101 + <i class="fa fa-user"></i>
  102 + <span ng-bind="info.updateBy.userName"></span>
  103 + </a>
  104 + </div>
  105 + <div>
  106 + <a href="#">
  107 + <span ng-bind="info.updateDate | date: 'yyyy-MM-dd HH:mm:ss'"></span>
  108 + </a>
  109 + </div>
  110 +
  111 + </td>
  112 + <td>
  113 + <a href="#" class="btn btn-success btn-sm" ng-if="info.planResult == 'ok'">
  114 + <span>成功</span>
  115 + </a>
  116 + <a sweetalert
  117 + sweet-options="{title: '排班错误信息',text: '线路:' + info.xl.name + '</br>开始时间:' + ctrl.toDateStr(info.scheduleFromTime) + '</br>结束时间:' + ctrl.toDateStr(info.scheduleToTime) + '</br>' + info.planResult, html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}"
  118 + sweet-on-confirm=""
  119 + class="btn btn-danger btn-sm"
  120 + ng-if="info.planResult != 'ok'">点击查错</a>
100 </td> 121 </td>
101 <td> 122 <td>
102 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 123 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
@@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
66 <td> 66 <td>
67 <div> 67 <div>
68 <a href="#"> 68 <a href="#">
  69 + <i class="fa fa-user"></i>
69 <span ng-bind="info.updateBy.userName"></span> 70 <span ng-bind="info.updateBy.userName"></span>
70 </a> 71 </a>
71 </div> 72 </div>
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit3.html
@@ -40,51 +40,78 @@ @@ -40,51 +40,78 @@
40 <!--<i class="fa fa-adjust" aria-hidden="true"></i>--> 40 <!--<i class="fa fa-adjust" aria-hidden="true"></i>-->
41 <span style="padding-right: 10px;background: #adff00;color: #501a1a;text-align: center;">分班班次</span> 41 <span style="padding-right: 10px;background: #adff00;color: #501a1a;text-align: center;">分班班次</span>
42 42
43 - <div class="btn-group">  
44 - <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">  
45 - <i class="fa fa-share"></i>  
46 - <span>数据工具</span>  
47 - <i class="fa fa-angle-down"></i>  
48 - </a>  
49 - <ul class="dropdown-menu pull-right">  
50 - <li>  
51 - <a href="javascript:" class="tool-action" ng-click="ctrl.multiselect()">  
52 - <i class="fa fa-file-excel-o"></i>  
53 - 批量选择  
54 - </a>  
55 - </li>  
56 - <li>  
57 - <a href="javascript:" class="tool-action" ng-click="ctrl.editInfos()">  
58 - <i class="fa fa-file-excel-o"></i>  
59 - 批量修改  
60 - </a>  
61 - </li>  
62 - <li>  
63 - <a href="javascript:" class="tool-action" ng-click="ctrl.deleteInfos()">  
64 - <i class="fa fa-file-excel-o"></i>  
65 - 批量删除  
66 - </a>  
67 - </li>  
68 - <li class="divider"></li>  
69 - <li>  
70 - <a href="javascript:" class="tool-action" ng-click="ctrl.clearsel()">  
71 - <i class="fa fa-refresh"></i>  
72 - 清除选择  
73 - </a>  
74 - </li>  
75 - <li>  
76 - <a href="javascript:" class="tool-action" ng-click="ctrl.refresh()">  
77 - <i class="fa fa-refresh"></i>  
78 - 刷行数据  
79 - </a>  
80 - </li>  
81 - </ul>  
82 - </div> 43 + <!--<div class="btn-group">-->
  44 + <!--<a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">-->
  45 + <!--<i class="fa fa-share"></i>-->
  46 + <!--<span>数据工具</span>-->
  47 + <!--<i class="fa fa-angle-down"></i>-->
  48 + <!--</a>-->
  49 + <!--<ul class="dropdown-menu pull-right">-->
  50 + <!--<li>-->
  51 + <!--<a href="javascript:" class="tool-action" ng-click="ctrl.multiselect()">-->
  52 + <!--<i class="fa fa-file-excel-o"></i>-->
  53 + <!--批量选择-->
  54 + <!--</a>-->
  55 + <!--</li>-->
  56 + <!--<li>-->
  57 + <!--<a href="javascript:" class="tool-action" ng-click="ctrl.editInfos()">-->
  58 + <!--<i class="fa fa-file-excel-o"></i>-->
  59 + <!--批量修改-->
  60 + <!--</a>-->
  61 + <!--</li>-->
  62 + <!--<li>-->
  63 + <!--<a href="javascript:" class="tool-action" ng-click="ctrl.deleteInfos()">-->
  64 + <!--<i class="fa fa-file-excel-o"></i>-->
  65 + <!--批量删除-->
  66 + <!--</a>-->
  67 + <!--</li>-->
  68 + <!--<li class="divider"></li>-->
  69 + <!--<li>-->
  70 + <!--<a href="javascript:" class="tool-action" ng-click="ctrl.clearsel()">-->
  71 + <!--<i class="fa fa-refresh"></i>-->
  72 + <!--清除选择-->
  73 + <!--</a>-->
  74 + <!--</li>-->
  75 + <!--<li>-->
  76 + <!--<a href="javascript:" class="tool-action" ng-click="ctrl.refresh()">-->
  77 + <!--<i class="fa fa-refresh"></i>-->
  78 + <!--刷行数据-->
  79 + <!--</a>-->
  80 + <!--</li>-->
  81 + <!--</ul>-->
  82 + <!--</div>-->
83 83
84 </div> 84 </div>
85 </div> 85 </div>
86 86
87 <div class="portlet-body"> 87 <div class="portlet-body">
  88 + <div style="padding-bottom: 5px;">
  89 + <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.multiselect()">
  90 + <i class="fa fa-file-excel-o"></i>
  91 + 批量选择
  92 + </a>
  93 + <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.editInfos()">
  94 + <i class="fa fa-pencil-square-o"></i>
  95 + 批量修改
  96 + </a>
  97 +
  98 + <a sweetalert
  99 + sweet-options="{title: '是否删除选定的班次?',text: '线路:' + ctrl.xlname + '</br>时刻表:' + ctrl.ttname + '</br>谨慎删除!', html: true,type: 'warning',showCancelButton: true,confirmButtonColor: '#DD6B55',confirmButtonText: '是',cancelButtonText: '取消'}"
  100 + sweet-on-confirm="ctrl.deleteInfos()"
  101 + style="padding-right: 5px;" >
  102 + <i class="fa fa-trash"></i>
  103 + 批量删除
  104 + </a>
  105 + <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.clearsel()">
  106 + <i class="fa fa-eraser"></i>
  107 + 取消选择
  108 + </a>
  109 + <a href="javascript:" style="padding-right: 5px;" ng-click="ctrl.refresh()">
  110 + <i class="fa fa-refresh"></i>
  111 + 刷行数据
  112 + </a>
  113 + </div>
  114 +
88 <!--<div ng-view></div>--> 115 <!--<div ng-view></div>-->
89 <div style="height: {{ctrl.ttHeight}}px;"> 116 <div style="height: {{ctrl.ttHeight}}px;">
90 <sa-Timetable name="tt" ng-model="ctrl.editInfo" ng-model-options="{ getterSetter: true }" celldbclick="ctrl.singleEditBcDetail"> 117 <sa-Timetable name="tt" ng-model="ctrl.editInfo" ng-model-options="{ getterSetter: true }" celldbclick="ctrl.singleEditBcDetail">
src/test/resources/testdata/problem.properties
1 ##1=时刻表明细导入,线路标准里所有的高峰低谷时间需要带入时刻表班次时间里,标准可以点击切换到线路标准界面 1 ##1=时刻表明细导入,线路标准里所有的高峰低谷时间需要带入时刻表班次时间里,标准可以点击切换到线路标准界面
2 -2=时刻表明细编辑功能,数据工具移到时刻表里,类似工具栏的样子 2 +##2=时刻表明细编辑功能,数据工具移到时刻表里,类似工具栏的样子
3 3=时刻表导入,可以选一个已经存在的时刻表导入,而不是excel文件 3 3=时刻表导入,可以选一个已经存在的时刻表导入,而不是excel文件
4 ##4=所有的删除,作废,都要有提示框操作 4 ##4=所有的删除,作废,都要有提示框操作
5 5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误 5 5=排班计划错误提示,如果选的排班日期之前没有排班,提示错误,排班结果有重复与时刻表不符合,显示错误
@@ -31,4 +31,4 @@ @@ -31,4 +31,4 @@
31 ##30=时刻表公里数 三位数 31 ##30=时刻表公里数 三位数
32 32
33 31=规则修改,路牌范围,人员范围可以拖动 33 31=规则修改,路牌范围,人员范围可以拖动
34 -32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入 34 +#32=人员配置不存在的情况下,导入规则ktr,找不到的人员不添加,人员范围不存在的,规则不导入