Commit 57889ddf352469559c2b6263cc967c80410c4b25

Authored by 潘钊
2 parents a423338d a042614b

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

src/main/java/com/bsth/controller/oil/YlbController.java
@@ -63,7 +63,7 @@ public class YlbController extends BaseController<Ylb, Integer>{ @@ -63,7 +63,7 @@ public class YlbController extends BaseController<Ylb, Integer>{
63 } 63 }
64 64
65 65
66 - @RequestMapping(value = "/saveYlbList",method = RequestMethod.GET) 66 + @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST)
67 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){ 67 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
68 Map<String, Object> list=new HashMap<String, Object>(); 68 Map<String, Object> list=new HashMap<String, Object>();
69 try { 69 try {
@@ -79,7 +79,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -79,7 +79,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
79 * @param map 79 * @param map
80 * @return 80 * @return
81 */ 81 */
82 - @RequestMapping(value = "/sort",method = RequestMethod.GET) 82 + @RequestMapping(value = "/sort",method = RequestMethod.POST)
83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){ 83 public Map<String, Object> sort(@RequestParam Map<String, Object> map){
84 Map<String, Object> list=new HashMap<String, Object>(); 84 Map<String, Object> list=new HashMap<String, Object>();
85 try { 85 try {
@@ -201,6 +201,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{ @@ -201,6 +201,12 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
201 return yblService.oilListMonth(line, date); 201 return yblService.oilListMonth(line, date);
202 } 202 }
203 203
  204 + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
  205 + public String checkJsy(@RequestParam Map<String, Object> map){
  206 + String list=yblService.checkJsy(map);
  207 + return list;
  208 + }
  209 +
204 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) 210 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
205 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ 211 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
206 Map<String, Object> list=yblService.sumYlb(map); 212 Map<String, Object> list=yblService.sumYlb(map);
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -96,18 +96,21 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -96,18 +96,21 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
96 + " and s.ssgsdm like %?2% " 96 + " and s.ssgsdm like %?2% "
97 + " and s.fgsdm like %?3%" 97 + " and s.fgsdm like %?3%"
98 + " and s.xlbm like %?4% " 98 + " and s.xlbm like %?4% "
99 - + " and s.nbbm in ?5 ") 99 + + " and s.nbbm in ?5 order by nbbm,jcsx")
100 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 100 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
101 101
102 102
103 @Transactional 103 @Transactional
104 @Modifying 104 @Modifying
105 @Query(value="UPDATE bsth_c_ylb SET " + 105 @Query(value="UPDATE bsth_c_ylb SET " +
106 - " jzyl = ?2, " +  
107 - " sh = ?3," +  
108 - " shyy = ?4," +  
109 - " ns = ?5," +  
110 - " rylx = ?6" + 106 + " czyl= ?2,"+
  107 + " jzyl = ?3, " +
  108 + " yh = ?4,"+
  109 + " sh = ?5," +
  110 + " shyy = ?6," +
  111 + " ns = ?7," +
  112 + " rylx = ?8," +
  113 + " yhlx = ?9"+
111 " WHERE id = ?1", nativeQuery=true) 114 " WHERE id = ?1", nativeQuery=true)
112 - public void ylbUpdate(Integer id,double jzyl,double sh,String shyy,double ns,String rylx); 115 + public void ylbUpdate(Integer id,double czyl,double jzyl,double yh, double sh,String shyy,double ns,String rylx,int yhlx);
113 } 116 }
src/main/java/com/bsth/service/oil/YlbService.java
@@ -9,6 +9,7 @@ import com.bsth.service.BaseService; @@ -9,6 +9,7 @@ import com.bsth.service.BaseService;
9 public interface YlbService extends BaseService<Ylb, Integer>{ 9 public interface YlbService extends BaseService<Ylb, Integer>{
10 Map<String, Object> obtain(Map<String, Object> map) throws Exception; 10 Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception; 11 Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception;
  12 + Map<String, Object> saveYlb(Ylb t);
12 String obtainDsq() throws Exception; 13 String obtainDsq() throws Exception;
13 Map<String, Object> sort(Map<String, Object> map) throws Exception; 14 Map<String, Object> sort(Map<String, Object> map) throws Exception;
14 15
@@ -17,8 +18,10 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{ @@ -17,8 +18,10 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
17 Map<String, Object> checkYl(Map<String, Object> map) throws Exception; 18 Map<String, Object> checkYl(Map<String, Object> map) throws Exception;
18 19
19 Map<String, Object> sumYlb(Map<String, Object> map); 20 Map<String, Object> sumYlb(Map<String, Object> map);
20 - 21 + String checkJsy(Map<String, Object> map);
21 List<Ylb> oilListMonth(String line,String date); 22 List<Ylb> oilListMonth(String line,String date);
22 List<Ylb> listYlb(Map<String, Object> map); 23 List<Ylb> listYlb(Map<String, Object> map);
23 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx); 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
  25 +
  26 +
24 } 27 }
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -469,45 +469,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -469,45 +469,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
469 469
470 repository.save(t); 470 repository.save(t);
471 } 471 }
472 -  
473 - // 设置存油量  
474 - Cyl cyl = null;  
475 - boolean fage = false;  
476 - for (int z = 0; z < cylList.size(); z++) {  
477 - cyl = cylList.get(z);  
478 - if (t.getNbbm().equals(cyl.getNbbm())) {  
479 - cyl.setCyl(t.getJzyl());  
480 - cyl.setUpdatetime(t.getRq());  
481 - fage = true;  
482 - break;  
483 - }  
484 - }  
485 - if (fage) {  
486 - cylRepository.save(cyl);  
487 - } else {  
488 - if(cylMapAdd.get(t.getNbbm())!=null){  
489 - for (int l = 0; l < cylListAdd.size(); l++) {  
490 - cyl=cylListAdd.get(l);  
491 - if(cyl.getNbbm().equals(t.getNbbm())){  
492 - cyl.setNbbm(t.getNbbm());  
493 - cyl.setCyl(t.getJzyl());  
494 - cyl.setGsdm(t.getSsgsdm());  
495 - cyl.setFgsdm(t.getFgsdm());  
496 - cyl.setUpdatetime(t.getRq());  
497 - }  
498 - }  
499 - }else{  
500 - cyl = new Cyl();  
501 - cyl.setNbbm(t.getNbbm());  
502 - cyl.setCyl(t.getJzyl());  
503 - cyl.setGsdm(t.getSsgsdm());  
504 - cyl.setFgsdm(t.getFgsdm());  
505 - cyl.setUpdatetime(t.getRq());  
506 - cylListAdd.add(cyl);  
507 - }  
508 -  
509 -  
510 - }  
511 map2.put("status", ResponseCode.SUCCESS); 472 map2.put("status", ResponseCode.SUCCESS);
512 } 473 }
513 } 474 }
@@ -526,6 +487,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -526,6 +487,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
526 /** 487 /**
527 * 拆分 488 * 拆分
528 */ 489 */
  490 + /*
529 @Transactional 491 @Transactional
530 @Override 492 @Override
531 public Map<String, Object> sort(Map<String, Object> map) throws Exception{ 493 public Map<String, Object> sort(Map<String, Object> map) throws Exception{
@@ -669,7 +631,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -669,7 +631,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
669 throw e; 631 throw e;
670 } 632 }
671 return newMap; 633 return newMap;
672 - } 634 + }*/
673 635
674 /** 636 /**
675 * 核对,有加注没里程 637 * 核对,有加注没里程
@@ -727,32 +689,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -727,32 +689,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
727 t.setSsgsdm(y1.getGsdm()); 689 t.setSsgsdm(y1.getGsdm());
728 t.setXlbm(xlbm); 690 t.setXlbm(xlbm);
729 repository.save(t); 691 repository.save(t);
730 -  
731 - //设置存油量  
732 - Cyl cyl=null;  
733 - boolean status=false;  
734 - for(int z=0;z<cylList.size();z++){  
735 - cyl=cylList.get(z);  
736 - if(t.getNbbm().equals(cyl.getNbbm())){  
737 -// cyl.setCyl(cyl.getCyl()+t.getJzl());  
738 - cyl.setCyl(Arith.add(cyl.getCyl(),t.getJzl()));  
739 - cyl.setUpdatetime(t.getRq());  
740 - status=true;  
741 - break;  
742 - }  
743 - }  
744 - if(status){  
745 - cylRepository.save(cyl);  
746 - }else{  
747 - cyl=new Cyl();  
748 - cyl.setNbbm(t.getNbbm());  
749 - cyl.setCyl(t.getJzl());  
750 - cyl.setGsdm(t.getSsgsdm());  
751 - cyl.setUpdatetime(t.getRq());  
752 - cylRepository.save(cyl);  
753 - }  
754 -  
755 -  
756 } 692 }
757 } 693 }
758 newMap.put("status", ResponseCode.SUCCESS); 694 newMap.put("status", ResponseCode.SUCCESS);
@@ -965,20 +901,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -965,20 +901,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
965 for (int i = 0; i < jsonArray.size(); i++) { 901 for (int i = 0; i < jsonArray.size(); i++) {
966 // Ylb t=new Ylb(); 902 // Ylb t=new Ylb();
967 jsonObject=jsonArray.getJSONObject(i); 903 jsonObject=jsonArray.getJSONObject(i);
968 -  
969 - Double jzyl =jsonObject.getDoubleValue("jzyl");  
970 - Double sh =jsonObject.getDoubleValue("sh"); 904 + double czyl = jsonObject.getDoubleValue("czyl");
  905 + double jzl =jsonObject.getDoubleValue("jzl");
  906 + double jzyl =jsonObject.getDoubleValue("jzyl");
  907 + double sh =jsonObject.getDoubleValue("sh");
971 String shyy =jsonObject.getString("shyy"); 908 String shyy =jsonObject.getString("shyy");
972 - Double ns = jsonObject.getDoubleValue("ns"); 909 + double ns = jsonObject.getDoubleValue("ns");
973 String rylx =jsonObject.getString("rylx"); 910 String rylx =jsonObject.getString("rylx");
  911 + int yhlx =jsonObject.getIntValue("yhlx");
974 Integer id =jsonObject.getInteger("id"); 912 Integer id =jsonObject.getInteger("id");
  913 + double yh = Arith.sub(Arith.add(czyl, jzl), jzyl);
975 /*t.setJzyl(jzyl); 914 /*t.setJzyl(jzyl);
976 t.setSh(sh); 915 t.setSh(sh);
977 t.setShyy(shyy); 916 t.setShyy(shyy);
978 t.setNs(ns); 917 t.setNs(ns);
979 t.setRylx(rylx); 918 t.setRylx(rylx);
980 t.setId(jsonObject.getInteger("id"));*/ 919 t.setId(jsonObject.getInteger("id"));*/
981 - repository.ylbUpdate(id, jzyl, sh, shyy, ns, rylx); 920 + repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
982 } 921 }
983 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); 922 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
984 923
@@ -991,5 +930,139 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -991,5 +930,139 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
991 return newMap; 930 return newMap;
992 } 931 }
993 932
  933 + /**
  934 + * 拆分
  935 + */
  936 + @Transactional
  937 + @Override
  938 + public Map<String, Object> sort(Map<String, Object> map) throws Exception{
  939 + // TODO Auto-generated method stub
  940 + Map<String, Object> newMap = new HashMap<String, Object>();
  941 + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
  942 +
  943 + try {
  944 + List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  945 + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
  946 + JSONArray jsonArray=JSONArray.parseArray(json);
  947 + JSONObject jsonObject;
  948 + for (int x = 0; x < jsonArray.size(); x++) {
  949 + jsonObject=jsonArray.getJSONObject(x);
  950 + Double yl =jsonObject.getDoubleValue("jzyl");
  951 + Double sh =jsonObject.getDoubleValue("sh");
  952 + String shyy =jsonObject.getString("shyy");
  953 + Double ns = jsonObject.getDoubleValue("ns");
  954 + String rylx =jsonObject.getString("rylx");
  955 + Integer id =jsonObject.getInteger("id");
  956 + Ylb ylb = repository.findOne(id);
  957 + String nbbm_eq = ylb.getNbbm();
  958 + Date rq_eq = ylb.getRq();
  959 + // 得到一天总的加油和里程(根据车,时间)
  960 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  961 + // 保存总的加油量
  962 + Double jzl = 0.0;
  963 + // 保存总的里程
  964 + Double zlc = 0.0;
  965 + //保存总的损耗
  966 + Double zsh = 0.0;
  967 + for (int j = 0; j < sumList.size(); j++) {
  968 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  969 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  970 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  971 + }
  972 + jzl = Arith.sub(jzl, zsh);
  973 + //新的 损耗不等于 旧的损耗 总损耗从新算
  974 + if(Arith.sub(ylb.getSh(),sh )!=0){
  975 + zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
  976 + jzl =Arith.sub(jzl, zsh);
  977 + }else{
  978 + jzl =Arith.sub(jzl, zsh);
  979 + }
  980 + map.put("nbbm_eq", nbbm_eq);
  981 + map.put("rq_eq", rq_eq);
  982 +
  983 + List<Ylb> iterator2=repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),ylb.getXlbm(),
  984 + ylb.getNbbm(),"jcsx");
  985 + DecimalFormat df = new DecimalFormat("#.00");
  986 + Double zyl = 0.0;
  987 + Double nextJzyl = 0.0;
  988 + // 车的,进,出油量及耗油
  989 + Map<String, Object> cylMapAdd=new HashMap<String,Object>();
  990 + List<Cyl> cylListAdd=new ArrayList<Cyl>();
  991 + for (int i = 0; i < iterator2.size(); i++) {
  992 + Ylb t = iterator2.get(i);
  993 + if (t.getJcsx() == 1) {
  994 + if(t.getId()==id){
  995 + t.setSh(sh);
  996 + t.setShyy(shyy);
  997 + }
  998 + Double jcyl = t.getCzyl();
  999 + zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
  1000 + Double yh = 0.0;
  1001 + if (zlc > 0 && t.getZlc() > 0) {
  1002 + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1003 + }
  1004 + nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
  1005 + long l=Math.round(nextJzyl);
  1006 + double ylxs=l*100/100;
  1007 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1008 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1009 + t.setJzyl(ylxs);
  1010 + t.setYh(yh);
  1011 + nextJzyl=ylxs;
  1012 + } else {
  1013 + if(t.getId()==id){
  1014 + t.setSh(sh);
  1015 + t.setShyy(shyy);
  1016 + }
  1017 + t.setCzyl(nextJzyl);
  1018 + Double yh =0.0;
  1019 + if (t.getZlc() != 0) {
  1020 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1021 + }
  1022 + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
  1023 + long l=Math.round(nextJzyl);
  1024 + double ylxs=l*100/100;
  1025 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1026 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1027 + t.setJzyl(ylxs);
  1028 + t.setYh(yh);
  1029 + nextJzyl=ylxs;
  1030 + }
  1031 + repository.save(t);
  1032 + }
  1033 + for (int i = 0; i < cylListAdd.size(); i++) {
  1034 + cylRepository.save(cylListAdd.get(i));
  1035 + }
  1036 + newMap.put("status", ResponseCode.SUCCESS);
  1037 + }
  1038 + } catch (Exception e) {
  1039 + newMap.put("status", ResponseCode.ERROR);
  1040 + logger.error("save erro.", e);
  1041 + throw e;
  1042 + }
  1043 + return newMap;
  1044 + }
994 1045
  1046 + @Override
  1047 + public String checkJsy(Map<String, Object> map) {
  1048 + // TODO Auto-generated method stub
  1049 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  1050 + String rq=map.get("date").toString();
  1051 + String nbbm=map.get("nbbm").toString();
  1052 + String jsy =map.get("jsy").toString();
  1053 + List<Ylb> list= repository.queryListYlb(rq, nbbm, jsy);
  1054 + String type="";
  1055 + if(list.size()>0){
  1056 + type="cunzai";
  1057 + }
  1058 + return type;
  1059 + }
  1060 +
  1061 + @Override
  1062 + public Map<String, Object> saveYlb(Ylb t) {
  1063 +
  1064 + String gsbm="";
  1065 + String fgsbm="";
  1066 + return null;
  1067 + }
995 } 1068 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1621,9 +1621,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1621,9 +1621,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1621 else if (date.length() == 7) 1621 else if (date.length() == 7)
1622 list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date); 1622 list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
1623 1623
  1624 +
1624 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 1625 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1625 DecimalFormat format = new DecimalFormat("0.00"); 1626 DecimalFormat format = new DecimalFormat("0.00");
1626 - double jhlc = 0, tempJhlc = 0, childMileage = 0; 1627 + double jhlc = 0, tempJhlc = 0, childMileage = 0,jhlcOrig=0;
1627 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f; 1628 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
1628 //班次 1629 //班次
1629 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0; 1630 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
@@ -1648,21 +1649,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1648,21 +1649,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1648 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0; 1649 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
1649 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0; 1650 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
1650 Map<String, Object> map = null; 1651 Map<String, Object> map = null;
  1652 +
  1653 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
1651 for (int i = 0; i < list.size(); i++) { 1654 for (int i = 0; i < list.size(); i++) {
1652 ScheduleRealInfo scheduleRealInfo = list.get(i); 1655 ScheduleRealInfo scheduleRealInfo = list.get(i);
  1656 +
1653 if (scheduleRealInfo != null) { 1657 if (scheduleRealInfo != null) {
1654 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 1658 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1655 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程 1659 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1660 + if(!scheduleRealInfo.isSflj()){
  1661 + jhlc += tempJhlc;
  1662 + jhlcZ += tempJhlc;
  1663 + }
1656 if (childTaskPlans.isEmpty()) { 1664 if (childTaskPlans.isEmpty()) {
1657 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 1665 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1666 + jhlcOrig = scheduleRealInfo.getJhlcOrig() == null ? 0 : scheduleRealInfo.getJhlcOrig();
  1667 +
  1668 + if(jhlcOrig-tempJhlc>0){
  1669 + xgssgl +=jhlcOrig-tempJhlc;
  1670 + cj += jhlcOrig-tempJhlc;
  1671 + }else{
  1672 + xgljgl +=tempJhlc-jhlcOrig;
  1673 + lj +=tempJhlc-jhlcOrig;
  1674 + }
1658 //临加公里 1675 //临加公里
1659 if (scheduleRealInfo.isSflj()) { 1676 if (scheduleRealInfo.isSflj()) {
1660 ljgl += tempJhlc; 1677 ljgl += tempJhlc;
1661 ljglZ += tempJhlc; 1678 ljglZ += tempJhlc;
1662 - } else {  
1663 - jhlc += tempJhlc;  
1664 - jhlcZ += tempJhlc;  
1665 - } 1679 + }
  1680 +
1666 if (scheduleRealInfo.getStatus() == -1) { 1681 if (scheduleRealInfo.getStatus() == -1) {
1667 ssgl += tempJhlc; 1682 ssgl += tempJhlc;
1668 ssglZ += tempJhlc; 1683 ssglZ += tempJhlc;
@@ -1797,8 +1812,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1797,8 +1812,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1797 ssbc_otherZ++; 1812 ssbc_otherZ++;
1798 } 1813 }
1799 } else { 1814 } else {
1800 - sjgl += childMileage;  
1801 - sjglZ += childMileage; 1815 + if (scheduleRealInfo.isSflj()) {
  1816 + ljgl += tempJhlc;
  1817 + ljglZ += tempJhlc;
  1818 + } else{
  1819 + sjgl += childMileage;
  1820 + sjglZ += childMileage;
  1821 + }
1802 } 1822 }
1803 } 1823 }
1804 } 1824 }
@@ -1855,7 +1875,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1855,7 +1875,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1855 map.put("xlName", scheduleRealInfo.getXlName()); 1875 map.put("xlName", scheduleRealInfo.getXlName());
1856 map.put("jhlc", format.format(jhlc)); 1876 map.put("jhlc", format.format(jhlc));
1857 map.put("sjgl", format.format(sjgl)); 1877 map.put("sjgl", format.format(sjgl));
1858 - map.put("ssgl", format.format(ssgl)); 1878 + map.put("ssgl", format.format(ssgl+cj));
1859 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 1879 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1860 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 1880 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1861 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 1881 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -1879,7 +1899,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1879,7 +1899,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1879 map.put("ssbc_qh", ssbc_qh); 1899 map.put("ssbc_qh", ssbc_qh);
1880 map.put("ssbc_yw", ssbc_yw); 1900 map.put("ssbc_yw", ssbc_yw);
1881 map.put("ssbc_other", ssbc_other); 1901 map.put("ssbc_other", ssbc_other);
1882 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 1902 + map.put("ljgl", format.format(ljgl+lj));
1883 map.put("jhbc", jhbc); 1903 map.put("jhbc", jhbc);
1884 map.put("jhbc_m", jhbc_m); 1904 map.put("jhbc_m", jhbc_m);
1885 map.put("jhbc_a", jhbc_a); 1905 map.put("jhbc_a", jhbc_a);
@@ -1937,13 +1957,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1937,13 +1957,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1937 djg_m = 0; 1957 djg_m = 0;
1938 djg_a = 0; 1958 djg_a = 0;
1939 djg_time = 0; 1959 djg_time = 0;
  1960 + lj=0;
  1961 + cj=0;
1940 } 1962 }
1941 } else { 1963 } else {
1942 map = new HashMap<String, Object>(); 1964 map = new HashMap<String, Object>();
1943 map.put("xlName", scheduleRealInfo.getXlName()); 1965 map.put("xlName", scheduleRealInfo.getXlName());
1944 map.put("jhlc", format.format(jhlc)); 1966 map.put("jhlc", format.format(jhlc));
1945 map.put("sjgl", format.format(sjgl)); 1967 map.put("sjgl", format.format(sjgl));
1946 - map.put("ssgl", format.format(ssgl)); 1968 + map.put("ssgl", format.format(ssgl+cj));
1947 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 1969 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
1948 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 1970 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
1949 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 1971 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -1967,7 +1989,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1967,7 +1989,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1967 map.put("ssbc_qh", ssbc_qh); 1989 map.put("ssbc_qh", ssbc_qh);
1968 map.put("ssbc_yw", ssbc_yw); 1990 map.put("ssbc_yw", ssbc_yw);
1969 map.put("ssbc_other", ssbc_other); 1991 map.put("ssbc_other", ssbc_other);
1970 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 1992 + map.put("ljgl", format.format(ljgl+lj));
1971 map.put("jhbc", jhbc); 1993 map.put("jhbc", jhbc);
1972 map.put("jhbc_m", jhbc_m); 1994 map.put("jhbc_m", jhbc_m);
1973 map.put("jhbc_a", jhbc_a); 1995 map.put("jhbc_a", jhbc_a);
@@ -2025,6 +2047,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2025,6 +2047,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2025 djg_m = 0; 2047 djg_m = 0;
2026 djg_a = 0; 2048 djg_a = 0;
2027 djg_time = 0; 2049 djg_time = 0;
  2050 + lj=0;
  2051 + cj=0;
2028 } 2052 }
2029 } 2053 }
2030 } 2054 }
@@ -2032,7 +2056,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2032,7 +2056,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2032 map.put("xlName", "合计"); 2056 map.put("xlName", "合计");
2033 map.put("jhlc", format.format(jhlcZ)); 2057 map.put("jhlc", format.format(jhlcZ));
2034 map.put("sjgl", format.format(sjglZ)); 2058 map.put("sjgl", format.format(sjglZ));
2035 - map.put("ssgl", format.format(ssglZ)); 2059 + map.put("ssgl", format.format(ssglZ+xgssgl));
2036 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ)); 2060 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2037 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ)); 2061 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2038 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ)); 2062 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
@@ -2056,7 +2080,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2056,7 +2080,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2056 map.put("ssbc_qh", ssbc_qhZ); 2080 map.put("ssbc_qh", ssbc_qhZ);
2057 map.put("ssbc_yw", ssbc_ywZ); 2081 map.put("ssbc_yw", ssbc_ywZ);
2058 map.put("ssbc_other", ssbc_otherZ); 2082 map.put("ssbc_other", ssbc_otherZ);
2059 - map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ)); 2083 + map.put("ljgl", format.format(ljglZ+xgljgl));
2060 map.put("jhbc", jhbcZ); 2084 map.put("jhbc", jhbcZ);
2061 map.put("jhbc_m", jhbc_mZ); 2085 map.put("jhbc_m", jhbc_mZ);
2062 map.put("jhbc_a", jhbc_aZ); 2086 map.put("jhbc_a", jhbc_aZ);
@@ -2149,7 +2173,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2149,7 +2173,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2149 2173
2150 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); 2174 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2151 DecimalFormat format = new DecimalFormat("0.00"); 2175 DecimalFormat format = new DecimalFormat("0.00");
2152 - double jhlc = 0, tempJhlc = 0, childMileage = 0; 2176 + double jhlc = 0, tempJhlc = 0, childMileage = 0,jhlcOrig=0;
2153 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f; 2177 float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
2154 //班次 2178 //班次
2155 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0; 2179 int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
@@ -2174,21 +2198,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2174,21 +2198,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2174 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0; 2198 int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
2175 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0; 2199 int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
2176 Map<String, Object> map = null; 2200 Map<String, Object> map = null;
  2201 +
  2202 + double xgssgl=0,xgljgl=0,lj=0,cj=0;
2177 for (int i = 0; i < list.size(); i++) { 2203 for (int i = 0; i < list.size(); i++) {
2178 ScheduleRealInfo scheduleRealInfo = list.get(i); 2204 ScheduleRealInfo scheduleRealInfo = list.get(i);
  2205 +
2179 if (scheduleRealInfo != null) { 2206 if (scheduleRealInfo != null) {
2180 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 2207 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2181 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程 2208 //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  2209 + if(!scheduleRealInfo.isSflj()){
  2210 + jhlc += tempJhlc;
  2211 + jhlcZ += tempJhlc;
  2212 + }
2182 if (childTaskPlans.isEmpty()) { 2213 if (childTaskPlans.isEmpty()) {
2183 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 2214 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2215 + jhlcOrig = scheduleRealInfo.getJhlcOrig() == null ? 0 : scheduleRealInfo.getJhlcOrig();
  2216 +
  2217 + if(jhlcOrig-tempJhlc>0){
  2218 + xgssgl +=jhlcOrig-tempJhlc;
  2219 + cj += jhlcOrig-tempJhlc;
  2220 + }else{
  2221 + xgljgl +=tempJhlc-jhlcOrig;
  2222 + lj +=tempJhlc-jhlcOrig;
  2223 + }
2184 //临加公里 2224 //临加公里
2185 if (scheduleRealInfo.isSflj()) { 2225 if (scheduleRealInfo.isSflj()) {
2186 ljgl += tempJhlc; 2226 ljgl += tempJhlc;
2187 ljglZ += tempJhlc; 2227 ljglZ += tempJhlc;
2188 - } else {  
2189 - jhlc += tempJhlc;  
2190 - jhlcZ += tempJhlc;  
2191 - } 2228 + }
  2229 +
2192 if (scheduleRealInfo.getStatus() == -1) { 2230 if (scheduleRealInfo.getStatus() == -1) {
2193 ssgl += tempJhlc; 2231 ssgl += tempJhlc;
2194 ssglZ += tempJhlc; 2232 ssglZ += tempJhlc;
@@ -2323,8 +2361,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2323,8 +2361,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2323 ssbc_otherZ++; 2361 ssbc_otherZ++;
2324 } 2362 }
2325 } else { 2363 } else {
2326 - sjgl += childMileage;  
2327 - sjglZ += childMileage; 2364 + if (scheduleRealInfo.isSflj()) {
  2365 + ljgl += tempJhlc;
  2366 + ljglZ += tempJhlc;
  2367 + } else{
  2368 + sjgl += childMileage;
  2369 + sjglZ += childMileage;
  2370 + }
2328 } 2371 }
2329 } 2372 }
2330 } 2373 }
@@ -2381,7 +2424,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2381,7 +2424,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2381 map.put("xlName", scheduleRealInfo.getXlName()); 2424 map.put("xlName", scheduleRealInfo.getXlName());
2382 map.put("jhlc", format.format(jhlc)); 2425 map.put("jhlc", format.format(jhlc));
2383 map.put("sjgl", format.format(sjgl)); 2426 map.put("sjgl", format.format(sjgl));
2384 - map.put("ssgl", format.format(ssgl)); 2427 + map.put("ssgl", format.format(ssgl+cj));
2385 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 2428 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2386 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 2429 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
2387 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz)); 2430 map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
@@ -2405,7 +2448,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2405,7 +2448,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2405 map.put("ssbc_qh", ssbc_qh); 2448 map.put("ssbc_qh", ssbc_qh);
2406 map.put("ssbc_yw", ssbc_yw); 2449 map.put("ssbc_yw", ssbc_yw);
2407 map.put("ssbc_other", ssbc_other); 2450 map.put("ssbc_other", ssbc_other);
2408 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 2451 + map.put("ljgl", (ljgl+lj) == 0 ? 0 : format.format(ljgl+lj));
2409 map.put("jhbc", jhbc); 2452 map.put("jhbc", jhbc);
2410 map.put("jhbc_m", jhbc_m); 2453 map.put("jhbc_m", jhbc_m);
2411 map.put("jhbc_a", jhbc_a); 2454 map.put("jhbc_a", jhbc_a);
@@ -2463,12 +2506,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2463,12 +2506,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2463 djg_m = 0; 2506 djg_m = 0;
2464 djg_a = 0; 2507 djg_a = 0;
2465 djg_time = 0; 2508 djg_time = 0;
  2509 + lj=0;
  2510 + cj=0;
2466 } 2511 }
2467 } else { 2512 } else {
2468 map = new HashMap<String, Object>(); 2513 map = new HashMap<String, Object>();
2469 map.put("xlName", scheduleRealInfo.getXlName()); 2514 map.put("xlName", scheduleRealInfo.getXlName());
2470 map.put("jhlc", format.format(jhlc)); 2515 map.put("jhlc", format.format(jhlc));
2471 - map.put("sjgl", format.format(sjgl)); 2516 + map.put("sjgl", format.format(sjgl+cj));
2472 map.put("ssgl", format.format(ssgl)); 2517 map.put("ssgl", format.format(ssgl));
2473 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz)); 2518 map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
2474 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm)); 2519 map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
@@ -2493,7 +2538,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2493,7 +2538,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2493 map.put("ssbc_qh", ssbc_qh); 2538 map.put("ssbc_qh", ssbc_qh);
2494 map.put("ssbc_yw", ssbc_yw); 2539 map.put("ssbc_yw", ssbc_yw);
2495 map.put("ssbc_other", ssbc_other); 2540 map.put("ssbc_other", ssbc_other);
2496 - map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl)); 2541 + map.put("ljgl", format.format(ljgl+lj));
2497 map.put("jhbc", jhbc); 2542 map.put("jhbc", jhbc);
2498 map.put("jhbc_m", jhbc_m); 2543 map.put("jhbc_m", jhbc_m);
2499 map.put("jhbc_a", jhbc_a); 2544 map.put("jhbc_a", jhbc_a);
@@ -2551,6 +2596,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2551,6 +2596,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2551 djg_m = 0; 2596 djg_m = 0;
2552 djg_a = 0; 2597 djg_a = 0;
2553 djg_time = 0; 2598 djg_time = 0;
  2599 + lj=0;
  2600 + cj=0;
2554 } 2601 }
2555 } 2602 }
2556 } 2603 }
@@ -2558,7 +2605,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2558,7 +2605,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2558 map.put("xlName", "合计"); 2605 map.put("xlName", "合计");
2559 map.put("jhlc", format.format(jhlcZ)); 2606 map.put("jhlc", format.format(jhlcZ));
2560 map.put("sjgl", format.format(sjglZ)); 2607 map.put("sjgl", format.format(sjglZ));
2561 - map.put("ssgl", format.format(ssglZ)); 2608 + map.put("ssgl", format.format(ssglZ+xgssgl));
2562 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ)); 2609 map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
2563 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ)); 2610 map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
2564 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ)); 2611 map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
@@ -2582,7 +2629,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2582,7 +2629,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2582 map.put("ssbc_qh", ssbc_qhZ); 2629 map.put("ssbc_qh", ssbc_qhZ);
2583 map.put("ssbc_yw", ssbc_ywZ); 2630 map.put("ssbc_yw", ssbc_ywZ);
2584 map.put("ssbc_other", ssbc_otherZ); 2631 map.put("ssbc_other", ssbc_otherZ);
2585 - map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ)); 2632 + map.put("ljgl", format.format(ljglZ+xgljgl));
2586 map.put("jhbc", jhbcZ); 2633 map.put("jhbc", jhbcZ);
2587 map.put("jhbc_m", jhbc_mZ); 2634 map.put("jhbc_m", jhbc_mZ);
2588 map.put("jhbc_a", jhbc_aZ); 2635 map.put("jhbc_a", jhbc_aZ);
@@ -3554,7 +3601,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3554,7 +3601,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3554 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 3601 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
3555 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 3602 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
3556 int jhbc = 0, cjbc = 0, ljbc = 0; 3603 int jhbc = 0, cjbc = 0, ljbc = 0;
3557 - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; 3604 + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0,ljjcclc=0;
3558 float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0; 3605 float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0;
3559 Map<String, Object> map = new HashMap<String, Object>(); 3606 Map<String, Object> map = new HashMap<String, Object>();
3560 for (ScheduleRealInfo scheduleRealInfo : list) { 3607 for (ScheduleRealInfo scheduleRealInfo : list) {
@@ -3566,7 +3613,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3566,7 +3613,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3566 double jh = 0, sj = 0; 3613 double jh = 0, sj = 0;
3567 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); 3614 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
3568 if (scheduleRealInfo.isSflj()) { 3615 if (scheduleRealInfo.isSflj()) {
3569 - ljbc++; 3616 + if(!(scheduleRealInfo.getBcType().equals("in")
  3617 + || scheduleRealInfo.getBcType().equals("out"))){
  3618 + ljbc++;
  3619 + }
3570 } else { 3620 } else {
3571 if (!(scheduleRealInfo.getBcType().equals("in") 3621 if (!(scheduleRealInfo.getBcType().equals("in")
3572 || scheduleRealInfo.getBcType().equals("out"))) { 3622 || scheduleRealInfo.getBcType().equals("out"))) {
@@ -3584,14 +3634,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3584,14 +3634,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3584 if (childTaskPlans.isEmpty()) { 3634 if (childTaskPlans.isEmpty()) {
3585 if (scheduleRealInfo.getBcType().equals("in") || 3635 if (scheduleRealInfo.getBcType().equals("in") ||
3586 scheduleRealInfo.getBcType().equals("out")) { 3636 scheduleRealInfo.getBcType().equals("out")) {
3587 - jcclc += tempJhlc;  
3588 - }  
3589 -  
3590 - //主任务 放空班次属于营运  
3591 -// else if(scheduleRealInfo.getBcType().equals("venting")){  
3592 -// ksgl += tempJhlc;  
3593 -// }  
3594 - else { 3637 + if(scheduleRealInfo.getStatus() != -1){
  3638 + if(scheduleRealInfo.isSflj()){
  3639 + ljjcclc += tempJhlc;
  3640 + }else{
  3641 + jcclc += tempJhlc;
  3642 + }
  3643 + }
  3644 + }else {
3595 if (scheduleRealInfo.getStatus() != -1) { 3645 if (scheduleRealInfo.getStatus() != -1) {
3596 if (scheduleRealInfo.isSflj()) { 3646 if (scheduleRealInfo.isSflj()) {
3597 addMileage += tempJhlc; 3647 addMileage += tempJhlc;
@@ -3640,13 +3690,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3640,13 +3690,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3640 map.put("ksgl", format.format(ksgl)); 3690 map.put("ksgl", format.format(ksgl));
3641 map.put("yyglsj", format.format(yygl)); 3691 map.put("yyglsj", format.format(yygl));
3642 map.put("jhbc", jhbc); 3692 map.put("jhbc", jhbc);
3643 - map.put("jcclc", jcclc); 3693 + map.put("jcclc", format.format(jcclc+ljjcclc));
3644 3694
3645 map.put("ljgl", format.format(addMileage)); 3695 map.put("ljgl", format.format(addMileage));
3646 map.put("ssbc", cjbc); 3696 map.put("ssbc", cjbc);
3647 map.put("ysgl", format.format(yygl)); 3697 map.put("ysgl", format.format(yygl));
3648 map.put("sjbc", jhbc - cjbc + ljbc); 3698 map.put("sjbc", jhbc - cjbc + ljbc);
3649 - map.put("zgl", format.format(yygl + ksgl + jcclc)); 3699 + map.put("zgl", format.format(yygl + ksgl + jcclc+ljjcclc));
3650 map.put("ljbc", ljbc); 3700 map.put("ljbc", ljbc);
3651 3701
3652 return map; 3702 return map;
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -177,6 +177,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -177,6 +177,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
177 session.insert(ttInfo_input); 177 session.insert(ttInfo_input);
178 } 178 }
179 179
  180 +
  181 + // 载入数据2
  182 + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(schedulePlan.getXl().getId()).iterator();
  183 + while (scheduleRule1FlatIterator.hasNext()) {
  184 + ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next();
  185 + ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp);
  186 + session.insert(scheduleRule_input);
  187 + }
  188 +
180 // 执行rule 189 // 执行rule
181 session.fireAllRules(); 190 session.fireAllRules();
182 191
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -58,9 +58,9 @@ public class MyDroolsConfiguration { @@ -58,9 +58,9 @@ public class MyDroolsConfiguration {
58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() 58 kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources()
59 .newInputStreamResource(this.getClass().getResourceAsStream( 59 .newInputStreamResource(this.getClass().getResourceAsStream(
60 "/rules/HelloWorld.drl"), "UTF-8")); 60 "/rules/HelloWorld.drl"), "UTF-8"));
61 - kfs.write("src/main/resources/shiftloop_fb.drl", kieServices.getResources() 61 + kfs.write("src/main/resources/shiftloop_fb_2.drl", kieServices.getResources()
62 .newInputStreamResource(this.getClass().getResourceAsStream( 62 .newInputStreamResource(this.getClass().getResourceAsStream(
63 - "/rules/shiftloop_fb.drl"), "UTF-8")); 63 + "/rules/shiftloop_fb_2.drl"), "UTF-8"));
64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources() 64 kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
65 .newInputStreamResource(this.getClass().getResourceAsStream( 65 .newInputStreamResource(this.getClass().getResourceAsStream(
66 "/rules/ttinfo.drl"), "UTF-8")); 66 "/rules/ttinfo.drl"), "UTF-8"));
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -12,6 +12,9 @@ import java.util.List; @@ -12,6 +12,9 @@ import java.util.List;
12 * 排班规则_输入。 12 * 排班规则_输入。
13 */ 13 */
14 public class ScheduleRule_input { 14 public class ScheduleRule_input {
  15 + /** 线路Id */
  16 + private String xlId;
  17 +
15 /** 规则Id */ 18 /** 规则Id */
16 private String ruleId; 19 private String ruleId;
17 /** 规则启用日期 */ 20 /** 规则启用日期 */
@@ -36,6 +39,7 @@ public class ScheduleRule_input { @@ -36,6 +39,7 @@ public class ScheduleRule_input {
36 public ScheduleRule_input() {} 39 public ScheduleRule_input() {}
37 40
38 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) { 41 public ScheduleRule_input(ScheduleRule1Flat scheduleRule1Flat) {
  42 + this.xlId = String.valueOf(scheduleRule1Flat.getXl().getId());
39 this.ruleId = String.valueOf(scheduleRule1Flat.getId()); 43 this.ruleId = String.valueOf(scheduleRule1Flat.getId());
40 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq()); 44 this.qyrq = new DateTime(scheduleRule1Flat.getQyrq());
41 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds()); 45 List<String> lpIds = Splitter.on(",").splitToList(scheduleRule1Flat.getLpIds());
@@ -135,4 +139,12 @@ public class ScheduleRule_input { @@ -135,4 +139,12 @@ public class ScheduleRule_input {
135 public void setWeekdays(List<Boolean> weekdays) { 139 public void setWeekdays(List<Boolean> weekdays) {
136 this.weekdays = weekdays; 140 this.weekdays = weekdays;
137 } 141 }
  142 +
  143 + public String getXlId() {
  144 + return xlId;
  145 + }
  146 +
  147 + public void setXlId(String xlId) {
  148 + this.xlId = xlId;
  149 + }
138 } 150 }
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import org.joda.time.DateTime;  
4 -  
5 -/**  
6 - * 每日路爬信息。  
7 - */  
8 -public class LpInfoResult_output {  
9 - /** 具体日期 */  
10 - private DateTime dateTime;  
11 - /** 路牌Id */  
12 - private String lpId;  
13 - /** 线路Id */  
14 - private String xlId;  
15 - /** 时刻表Id */  
16 - private String ttInfoId;  
17 -  
18 - public DateTime getDateTime() {  
19 - return dateTime;  
20 - }  
21 -  
22 - public void setDateTime(DateTime dateTime) {  
23 - this.dateTime = dateTime;  
24 - }  
25 -  
26 - public String getLpId() {  
27 - return lpId;  
28 - }  
29 -  
30 - public void setLpId(String lpId) {  
31 - this.lpId = lpId;  
32 - }  
33 -  
34 - public String getXlId() {  
35 - return xlId;  
36 - }  
37 -  
38 - public void setXlId(String xlId) {  
39 - this.xlId = xlId;  
40 - }  
41 -  
42 - public String getTtInfoId() {  
43 - return ttInfoId;  
44 - }  
45 -  
46 - public void setTtInfoId(String ttInfoId) {  
47 - this.ttInfoId = ttInfoId;  
48 - }  
49 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 每日路爬信息。
  7 + */
  8 +public class LpInfoResult_output {
  9 + /** 具体日期 */
  10 + private DateTime dateTime;
  11 + /** 路牌Id */
  12 + private String lpId;
  13 + /** 线路Id */
  14 + private String xlId;
  15 + /** 时刻表Id */
  16 + private String ttInfoId;
  17 +
  18 + public DateTime getDateTime() {
  19 + return dateTime;
  20 + }
  21 +
  22 + public void setDateTime(DateTime dateTime) {
  23 + this.dateTime = dateTime;
  24 + }
  25 +
  26 + public String getLpId() {
  27 + return lpId;
  28 + }
  29 +
  30 + public void setLpId(String lpId) {
  31 + this.lpId = lpId;
  32 + }
  33 +
  34 + public String getXlId() {
  35 + return xlId;
  36 + }
  37 +
  38 + public void setXlId(String xlId) {
  39 + this.xlId = xlId;
  40 + }
  41 +
  42 + public String getTtInfoId() {
  43 + return ttInfoId;
  44 + }
  45 +
  46 + public void setTtInfoId(String ttInfoId) {
  47 + this.ttInfoId = ttInfoId;
  48 + }
  49 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import com.bsth.entity.schedule.TTInfoDetail;  
4 -import org.kie.api.runtime.rule.AccumulateFunction;  
5 -  
6 -import java.io.*;  
7 -import java.util.ArrayList;  
8 -import java.util.HashMap;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -/**  
13 - * 路牌信息统计函数。  
14 - */  
15 -public class LpInfoResultsFunction implements AccumulateFunction {  
16 - @Override  
17 - public void writeExternal(ObjectOutput out) throws IOException {  
18 -  
19 - }  
20 -  
21 - @Override  
22 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
23 -  
24 - }  
25 -  
26 - protected static class LpInfoResultsData implements Externalizable {  
27 - public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();  
28 - public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>();  
29 - public TTInfoDetail ttInfoDetail;  
30 -  
31 - public LpInfoResultsData() {}  
32 -  
33 - @Override  
34 - public void writeExternal(ObjectOutput out) throws IOException {  
35 - out.writeObject(lpInfoResult_outputs);  
36 - out.writeObject(ttInfoDetail);  
37 - }  
38 -  
39 - @Override  
40 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
41 - lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject();  
42 - ttInfoDetail = (TTInfoDetail) in.readObject();  
43 - }  
44 - }  
45 -  
46 - @Override  
47 - public Serializable createContext() {  
48 - return new LpInfoResultsData();  
49 - }  
50 -  
51 - @Override  
52 - public void init(Serializable context) throws Exception {  
53 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
54 - lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>();  
55 - lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>();  
56 - }  
57 -  
58 - @Override  
59 - public void accumulate(Serializable context, Object value) {  
60 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
61 - TTInfoDetail ttInfoDetail = (TTInfoDetail) value;  
62 -  
63 - if (ttInfoDetail.getLp() != null) {  
64 - if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) {  
65 - LpInfoResult_output lpInfoResult_output = new LpInfoResult_output();  
66 - lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId()));  
67 - lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId()));  
68 - lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId()));  
69 -  
70 - lpInfoResultsData.lpInfoResult_outputMap.put(  
71 - ttInfoDetail.getLp().getId(),  
72 - lpInfoResult_output);  
73 - }  
74 - }  
75 -  
76 - lpInfoResultsData.lpInfoResult_outputs.clear();  
77 - lpInfoResultsData.lpInfoResult_outputs.addAll(  
78 - lpInfoResultsData.lpInfoResult_outputMap.values());  
79 - }  
80 -  
81 - @Override  
82 - public boolean supportsReverse() {  
83 - return true;  
84 - }  
85 -  
86 - @Override  
87 - public void reverse(Serializable context, Object value) throws Exception {  
88 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
89 - TTInfoDetail ttInfoDetail = (TTInfoDetail) value;  
90 -  
91 - lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId());  
92 -  
93 - lpInfoResultsData.lpInfoResult_outputs.clear();  
94 - lpInfoResultsData.lpInfoResult_outputs.addAll(  
95 - lpInfoResultsData.lpInfoResult_outputMap.values());  
96 -  
97 - }  
98 -  
99 - @Override  
100 - public Object getResult(Serializable context) throws Exception {  
101 - LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;  
102 - return lpInfoResultsData.lpInfoResult_outputs;  
103 - }  
104 -  
105 - @Override  
106 - public Class<?> getResultType() {  
107 - return List.class;  
108 - }  
109 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.entity.schedule.TTInfoDetail;
  4 +import org.kie.api.runtime.rule.AccumulateFunction;
  5 +
  6 +import java.io.*;
  7 +import java.util.ArrayList;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +/**
  13 + * 路牌信息统计函数。
  14 + */
  15 +public class LpInfoResultsFunction implements AccumulateFunction {
  16 + @Override
  17 + public void writeExternal(ObjectOutput out) throws IOException {
  18 +
  19 + }
  20 +
  21 + @Override
  22 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  23 +
  24 + }
  25 +
  26 + protected static class LpInfoResultsData implements Externalizable {
  27 + public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  28 + public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>();
  29 + public TTInfoDetail ttInfoDetail;
  30 +
  31 + public LpInfoResultsData() {}
  32 +
  33 + @Override
  34 + public void writeExternal(ObjectOutput out) throws IOException {
  35 + out.writeObject(lpInfoResult_outputs);
  36 + out.writeObject(ttInfoDetail);
  37 + }
  38 +
  39 + @Override
  40 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  41 + lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject();
  42 + ttInfoDetail = (TTInfoDetail) in.readObject();
  43 + }
  44 + }
  45 +
  46 + @Override
  47 + public Serializable createContext() {
  48 + return new LpInfoResultsData();
  49 + }
  50 +
  51 + @Override
  52 + public void init(Serializable context) throws Exception {
  53 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  54 + lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>();
  55 + lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>();
  56 + }
  57 +
  58 + @Override
  59 + public void accumulate(Serializable context, Object value) {
  60 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  61 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  62 +
  63 + if (ttInfoDetail.getLp() != null) {
  64 + if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) {
  65 + LpInfoResult_output lpInfoResult_output = new LpInfoResult_output();
  66 + lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId()));
  67 + lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId()));
  68 + lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId()));
  69 +
  70 + lpInfoResultsData.lpInfoResult_outputMap.put(
  71 + ttInfoDetail.getLp().getId(),
  72 + lpInfoResult_output);
  73 + }
  74 + }
  75 +
  76 + lpInfoResultsData.lpInfoResult_outputs.clear();
  77 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  78 + lpInfoResultsData.lpInfoResult_outputMap.values());
  79 + }
  80 +
  81 + @Override
  82 + public boolean supportsReverse() {
  83 + return true;
  84 + }
  85 +
  86 + @Override
  87 + public void reverse(Serializable context, Object value) throws Exception {
  88 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  89 + TTInfoDetail ttInfoDetail = (TTInfoDetail) value;
  90 +
  91 + lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId());
  92 +
  93 + lpInfoResultsData.lpInfoResult_outputs.clear();
  94 + lpInfoResultsData.lpInfoResult_outputs.addAll(
  95 + lpInfoResultsData.lpInfoResult_outputMap.values());
  96 +
  97 + }
  98 +
  99 + @Override
  100 + public Object getResult(Serializable context) throws Exception {
  101 + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context;
  102 + return lpInfoResultsData.lpInfoResult_outputs;
  103 + }
  104 +
  105 + @Override
  106 + public Class<?> getResultType() {
  107 + return List.class;
  108 + }
  109 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java
1 -package com.bsth.service.schedule.rules.ttinfo;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 -/**  
7 - * Created by xu on 17/3/21.  
8 - */  
9 -public class LpInfoResults_output {  
10 -  
11 - private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();  
12 -  
13 - public List<LpInfoResult_output> getLpInfoResult_outputs() {  
14 - return lpInfoResult_outputs;  
15 - }  
16 -  
17 - public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) {  
18 - this.lpInfoResult_outputs = lpInfoResult_outputs;  
19 - }  
20 -  
21 - public void add(LpInfoResult_output lpInfoResult_output) {  
22 -  
23 - }  
24 -} 1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * Created by xu on 17/3/21.
  8 + */
  9 +public class LpInfoResults_output {
  10 +
  11 + private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>();
  12 +
  13 + public List<LpInfoResult_output> getLpInfoResult_outputs() {
  14 + return lpInfoResult_outputs;
  15 + }
  16 +
  17 + public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) {
  18 + this.lpInfoResult_outputs = lpInfoResult_outputs;
  19 + }
  20 +
  21 + public void add(LpInfoResult_output lpInfoResult_output) {
  22 +
  23 + }
  24 +}
src/main/java/com/bsth/service/schedule/rules/ttinfo/MinRuleQyrqFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.ttinfo;
  2 +
  3 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  4 +import org.joda.time.DateTime;
  5 +import org.kie.api.runtime.rule.AccumulateFunction;
  6 +
  7 +import java.io.*;
  8 +
  9 +/**
  10 + * 最小的规则启用日期。
  11 + */
  12 +public class MinRuleQyrqFunction implements AccumulateFunction {
  13 + @Override
  14 + public void writeExternal(ObjectOutput out) throws IOException {
  15 + }
  16 +
  17 + @Override
  18 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  19 +
  20 + }
  21 +
  22 + protected static class MinRuleQyrqData implements Externalizable {
  23 + public DateTime min;
  24 +
  25 + public MinRuleQyrqData() {}
  26 +
  27 + @Override
  28 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  29 + min = (DateTime) in.readObject();
  30 + }
  31 +
  32 + @Override
  33 + public void writeExternal(ObjectOutput out) throws IOException {
  34 + out.writeObject(min);
  35 + }
  36 + }
  37 +
  38 + @Override
  39 + public Serializable createContext() {
  40 + return new MinRuleQyrqData();
  41 + }
  42 +
  43 + @Override
  44 + public void init(Serializable context) throws Exception {
  45 + // TODO:
  46 + }
  47 +
  48 + @Override
  49 + public void accumulate(Serializable context, Object value) {
  50 + MinRuleQyrqData minRuleQyrqData = (MinRuleQyrqData) context;
  51 + ScheduleRule_input scheduleRule_input = (ScheduleRule_input) value;
  52 +
  53 + if (minRuleQyrqData.min == null) {
  54 + minRuleQyrqData.min = scheduleRule_input.getQyrq();
  55 + } else if (scheduleRule_input.getQyrq().isBefore(minRuleQyrqData.min)) {
  56 + minRuleQyrqData.min = scheduleRule_input.getQyrq();
  57 + }
  58 + }
  59 +
  60 + @Override
  61 + public boolean supportsReverse() {
  62 + return false;
  63 + }
  64 +
  65 + @Override
  66 + public void reverse(Serializable serializable, Object o) throws Exception {
  67 +
  68 + }
  69 +
  70 + @Override
  71 + public Class<?> getResultType() {
  72 + return DateTime.class;
  73 + }
  74 +
  75 + @Override
  76 + public Object getResult(Serializable context) throws Exception {
  77 + MinRuleQyrqData minRuleQyrqData = (MinRuleQyrqData) context;
  78 + return minRuleQyrqData.min;
  79 + }
  80 +}
  81 +
  82 +
  83 +
  84 +
  85 +
  86 +
  87 +
  88 +
  89 +
  90 +
  91 +
  92 +
  93 +
  94 +
  95 +
src/main/resources/rules/functions.drl
@@ -3,4 +3,5 @@ package com.bsth.service.schedule; @@ -3,4 +3,5 @@ package com.bsth.service.schedule;
3 import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; 3 import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;
4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; 4 import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; 5 import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
6 -import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;  
7 \ No newline at end of file 6 \ No newline at end of file
  7 +import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
  8 +import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq
8 \ No newline at end of file 9 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
1 -package com.bsth.service.schedule.shiftloop;  
2 -  
3 -import org.joda.time.*;  
4 -import java.util.*;  
5 -  
6 -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;  
7 -  
8 -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;  
9 -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;  
10 -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;  
11 -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;  
12 -  
13 -import org.slf4j.Logger;  
14 -  
15 -global Logger log;  
16 -global ScheduleResults_output scheduleResult;  
17 -  
18 -/*  
19 - 存在(翻班格式)  
20 -*/  
21 -  
22 -//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//  
23 -  
24 -declare Calcu_days_result_pre  
25 - ruleId: String // 规则Id  
26 -  
27 - calcu_index_lp : Integer // 计算之后路牌的起始索引  
28 - calcu_index_ry : Integer // 计算之后人员的起始索引  
29 -  
30 - // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)  
31 - calcu_start_date_1: DateTime // 第一部分开始计算日期  
32 - calcu_end_date_1: DateTime // 第一部分结束计算日期  
33 -  
34 - // 2、第二部分循环需要用到的数据  
35 - sdays : Integer // 总共需要排班的天数  
36 - calcu_start_date_2 : DateTime // 开始计算日期  
37 - calcu_end_date_2 : DateTime // 结束计算日期  
38 -  
39 -end  
40 -  
41 -/*  
42 - 计算启用日期,开始计算日期,结束计算日期,相差天数  
43 - 1、规则启用日期小于开始计算日期  
44 - 2、规则启用日期大于等于开始日期,小于等于结束日期  
45 -*/  
46 -// 1、启用日期 < 开始日期  
47 -rule "calcu_days_1_"  
48 - salience 1000  
49 - when  
50 - ScheduleCalcuParam_input(  
51 - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),  
52 - $fromDate : fromDate,  
53 - $toDate : toDate  
54 - )  
55 - ScheduleRule_input(  
56 - $ruleId : ruleId, $qyrq : qyrq,  
57 - $lpindex : startGbdIndex, $ryindex: startEIndex)  
58 - eval($qyrq.isBefore($fromDate))  
59 - then  
60 - // 构造Calcu_days_result_pre,用于路牌  
61 - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();  
62 - cdrp.setRuleId($ruleId);  
63 - cdrp.setCalcu_index_lp($lpindex);  
64 - cdrp.setCalcu_index_ry($ryindex);  
65 - cdrp.setCalcu_start_date_1($qyrq);  
66 - cdrp.setCalcu_end_date_1($fromDate);  
67 - Period p2 = new Period($fromDate, $toDate, PeriodType.days());  
68 - cdrp.setSdays(p2.getDays() + 1);  
69 - cdrp.setCalcu_start_date_2($fromDate);  
70 - cdrp.setCalcu_end_date_2($toDate);  
71 -  
72 - insert(cdrp);  
73 -  
74 - log.info("总共需要排班的天数 sdays={} ruleId={}", (p2.getDays() + 1), $ruleId);  
75 -  
76 -end  
77 -  
78 -// 启用日期 属于 [开始日期,结束日期]  
79 -rule "calcu_days_2_"  
80 - salience 1000  
81 - when  
82 - ScheduleCalcuParam_input(  
83 - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),  
84 - $fromDate : fromDate,  
85 - $toDate : toDate  
86 - )  
87 - ScheduleRule_input(  
88 - $ruleId : ruleId, $qyrq : qyrq,  
89 - $lpindex : startGbdIndex, $ryindex: startEIndex)  
90 - eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))  
91 - then  
92 - // 构造Calcu_days_result_pre,用于路牌  
93 - Calcu_days_result_pre cdrp = new Calcu_days_result_pre();  
94 - cdrp.setRuleId($ruleId);  
95 - cdrp.setCalcu_index_lp($lpindex);  
96 - cdrp.setCalcu_index_ry($ryindex);  
97 - cdrp.setCalcu_start_date_1($qyrq);  
98 - cdrp.setCalcu_end_date_1($qyrq);  
99 - Period p2 = new Period($qyrq, $toDate, PeriodType.days());  
100 - cdrp.setSdays(p2.getDays() + 1);  
101 - cdrp.setCalcu_start_date_2($qyrq);  
102 - cdrp.setCalcu_end_date_2($toDate);  
103 -  
104 - insert(cdrp);  
105 -  
106 - log.info("总共需要排班的天数 sdays={} ruleId={}", (p2.getDays() + 1), $ruleId);  
107 -  
108 -end  
109 -  
110 -//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//  
111 -rule "Calcu_loop1_1_" // 时刻表的关联的路牌不存在,调整翻版规则  
112 - salience 900  
113 - when  
114 - $cdrp: Calcu_days_result_pre(  
115 - calcu_start_date_1.isBefore(calcu_end_date_1),  
116 - $csd1: calcu_start_date_1,  
117 - $ced1: calcu_end_date_1,  
118 - $ruleId: ruleId,  
119 - $lpindex: calcu_index_lp,  
120 - $ryindex: calcu_index_ry  
121 - )  
122 - $sri: ScheduleRule_input(  
123 - ruleId == $ruleId,  
124 - $gids: guideboardIds,  
125 - $lprangesize : guideboardIds.size(),  
126 - $ryrangesize: employeeConfigIds.size()  
127 - )  
128 - $liro: LpInfoResult_output(  
129 - dateTime.isEqual($csd1),  
130 - $gids.get($lpindex) == lpId,  
131 - $lpId: lpId  
132 - )  
133 - then  
134 - $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);  
135 - $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);  
136 - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));  
137 -  
138 - log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",  
139 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());  
140 -  
141 - update($cdrp);  
142 -end  
143 -  
144 -rule "Calcu_loop1_2_" // 时刻表的关联路牌存在,就翻  
145 - salience 800  
146 - when  
147 - $cdrp: Calcu_days_result_pre(  
148 - calcu_start_date_1.isBefore(calcu_end_date_1),  
149 - $csd1: calcu_start_date_1,  
150 - $ced1: calcu_end_date_1,  
151 - $ruleId: ruleId  
152 - )  
153 - $sri: ScheduleRule_input(  
154 - ruleId == $ruleId,  
155 - $rangesize : guideboardIds.size()  
156 - )  
157 - then  
158 - $cdrp.setCalcu_start_date_1($csd1.plusDays(1));  
159 -  
160 - log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",  
161 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());  
162 -  
163 - update($cdrp);  
164 -end  
165 -  
166 -  
167 -//----------------------- 路牌范围循环计算 ------------------------//  
168 -  
169 -//declare Calcu_guideboard_index_result  
170 -// ruleId : String // 规则Id  
171 -// calcu_index : Integer // 计算之后的起始索引  
172 -//end  
173 -//  
174 -//// 启用日期等于开始日期  
175 -//rule "calcu_guideboard_index_qyrq_eq_startrq"  
176 -// when  
177 -// $calcu_days_result : Calcu_days_result(  
178 -// qyrq_days == 0,  
179 -// $ruleId: ruleId  
180 -// )  
181 -// $scheduleRule_input : ScheduleRule_input(  
182 -// ruleId == $ruleId,  
183 -// $oindex : startGbdIndex  
184 -// )  
185 -// then  
186 -// Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();  
187 -// cgir.setRuleId($ruleId);  
188 -// cgir.setCalcu_index($oindex);  
189 -//  
190 -// log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
191 -//  
192 -// insert(cgir);  
193 -//end  
194 -//  
195 -//// 开始日期大于启用日期  
196 -//rule "calcu_guideboard_index_startrq_gt_qyrq"  
197 -// when  
198 -// $calcu_days_result : Calcu_days_result(  
199 -// qyrq_days > 0,  
200 -// $ruleId: ruleId, $qyrq_days: qyrq_days,  
201 -// $calcu_start_date: calcu_start_date  
202 -// )  
203 -// $scheduleRule_input : ScheduleRule_input(  
204 -// ruleId == $ruleId,  
205 -// $qyrq: qyrq,  
206 -// $rangesize : guideboardIds.size(),  
207 -// $oindex : startGbdIndex,  
208 -// $weekdays: weekdays  
209 -// )  
210 -// then  
211 -// // 开始时间  
212 -// DateTime initDate = $qyrq;  
213 -// int index = $oindex;  
214 -// int resultIndex = index;  
215 -//  
216 -// while (!initDate.isAfter($calcu_start_date)) {  
217 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
218 -// resultIndex = index;  
219 -// index = (index + 1) % $rangesize;  
220 -// }  
221 -// initDate = initDate.plusDays(1);  
222 -// }  
223 -//  
224 -// Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();  
225 -// cgir.setRuleId($ruleId);  
226 -// cgir.setCalcu_index(resultIndex);  
227 -//  
228 -// log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
229 -//  
230 -// insert(cgir);  
231 -//end  
232 -//  
233 -////----------------------- 人员范围循环计算 ------------------------//  
234 -//  
235 -//declare Calcu_employee_index_result  
236 -// ruleId : String // 规则Id  
237 -// calcu_index : Integer // 计算之后的起始索引  
238 -//end  
239 -//  
240 -//// 启用日期等于开始日期  
241 -//rule "calcu_employee_index_qyrq_eq_startrq"  
242 -// when  
243 -// $calcu_days_result : Calcu_days_result(  
244 -// qyrq_days == 0,  
245 -// $ruleId: ruleId)  
246 -// $scheduleRule_input : ScheduleRule_input(  
247 -// ruleId == $ruleId,  
248 -// $oindex : startEIndex)  
249 -// then  
250 -// Calcu_employee_index_result cgir = new Calcu_employee_index_result();  
251 -// cgir.setRuleId($ruleId);  
252 -// cgir.setCalcu_index($oindex);  
253 -//  
254 -// log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
255 -//  
256 -// insert(cgir);  
257 -//end  
258 -//  
259 -//// 开始日期大于启用日期  
260 -//rule "calcu_employee_index_startrq_gt_qyrq"  
261 -// when  
262 -// $calcu_days_result : Calcu_days_result(  
263 -// qyrq_days > 0,  
264 -// $ruleId: ruleId, $qyrq_days: qyrq_days,  
265 -// $calcu_start_date: calcu_start_date  
266 -// )  
267 -// $scheduleRule_input : ScheduleRule_input(  
268 -// ruleId == $ruleId,  
269 -// $qyrq: qyrq,  
270 -// $rangesize : employeeConfigIds.size(),  
271 -// $oindex : startEIndex,  
272 -// $weekdays: weekdays  
273 -// )  
274 -// then  
275 -// // 开始时间  
276 -// DateTime initDate = $qyrq;  
277 -// int index = $oindex;  
278 -// int resultIndex = index;  
279 -//  
280 -// while (!initDate.isAfter($calcu_start_date)) {  
281 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
282 -// resultIndex = index;  
283 -// index = (index + 1) % $rangesize;  
284 -// }  
285 -// initDate = initDate.plusDays(1);  
286 -// }  
287 -//  
288 -// Calcu_employee_index_result cgir = new Calcu_employee_index_result();  
289 -// cgir.setRuleId($ruleId);  
290 -// cgir.setCalcu_index(resultIndex);  
291 -//  
292 -// log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());  
293 -//  
294 -// insert(cgir);  
295 -//  
296 -//end  
297 -//  
298 -////------------------------- 第三阶段、循环计算 ------------------------//  
299 -//  
300 -////----------------------- 路牌范围循环计算 ------------------------//  
301 -//declare loop_guideboard_result  
302 -// ruleId : String // 规则id  
303 -// go_list : List // 路牌循环的列表  
304 -//end  
305 -//  
306 -//// 循环路牌计算  
307 -//rule "Calcu_loop_guideboard_result"  
308 -// when  
309 -// Calcu_days_result(  
310 -// $ruleId: ruleId,  
311 -// $startDate : calcu_start_date,  
312 -// $calcu_end_date: calcu_end_date  
313 -// )  
314 -// $ruleData : ScheduleRule_input(  
315 -// ruleId == $ruleId,  
316 -// $rangesize : guideboardIds.size(),  
317 -// $weekdays: weekdays  
318 -// )  
319 -// $indexData : Calcu_guideboard_index_result(  
320 -// ruleId == $ruleId  
321 -// )  
322 -// then  
323 -// DateTime initDate = $startDate; // 开始时间  
324 -// DateTime endDate = $calcu_end_date; // 结束实际  
325 -// List<ScheduleResult_output> scheduleResult_outputs =  
326 -// new ArrayList<ScheduleResult_output>();  
327 -//  
328 -// int i = $indexData.getCalcu_index();  
329 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {  
330 -// i = (i + 1) % $rangesize;  
331 -// }  
332 -//  
333 -// while (!initDate.isAfter(endDate)) {  
334 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
335 -// ScheduleResult_output ro = new ScheduleResult_output();  
336 -// ro.setRuleId($ruleId);  
337 -// ro.setSd(initDate);  
338 -// ro.setGuideboardId($ruleData.getGuideboardIds().get(i));  
339 -// ro.setCarConfigId($ruleData.getCarConfigId());  
340 -// scheduleResult_outputs.add(ro);  
341 -//  
342 -// i = (i + 1) % $rangesize;  
343 -// }  
344 -//  
345 -// initDate = initDate.plusDays(1);  
346 -// }  
347 -//  
348 -// loop_guideboard_result clgr = new loop_guideboard_result();  
349 -// clgr.setRuleId($ruleId);  
350 -// clgr.setGo_list(scheduleResult_outputs);  
351 -//  
352 -// log.info(String.valueOf(scheduleResult_outputs.size()));  
353 -//  
354 -// insert(clgr);  
355 -//  
356 -//end  
357 -//  
358 -////----------------------- 人员范围循环计算 ------------------------//  
359 -//declare loop_employee_result  
360 -// ruleId : String // 规则id  
361 -// eo_list : List // 人员循环的列表  
362 -//end  
363 -//  
364 -//// 循环人员计算  
365 -//rule "Calcu_loop_employee_result"  
366 -// when  
367 -// Calcu_days_result(  
368 -// $ruleId: ruleId,  
369 -// $startDate : calcu_start_date,  
370 -// $calcu_end_date: calcu_end_date  
371 -// )  
372 -// $ruleData : ScheduleRule_input(  
373 -// ruleId == $ruleId,  
374 -// $rangesize : employeeConfigIds.size(),  
375 -// $weekdays: weekdays  
376 -// )  
377 -// $indexData : Calcu_employee_index_result(  
378 -// ruleId == $ruleId  
379 -// )  
380 -// then  
381 -// DateTime initDate = $startDate; // 开始时间  
382 -// DateTime endDate = $calcu_end_date; // 结束实际  
383 -// List<ScheduleResult_output> scheduleResult_outputs =  
384 -// new ArrayList<ScheduleResult_output>();  
385 -//  
386 -// int i = $indexData.getCalcu_index();  
387 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {  
388 -// i = (i + 1) % $rangesize;  
389 -// }  
390 -//  
391 -// while (!initDate.isAfter(endDate)) {  
392 -// if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {  
393 -// ScheduleResult_output ro = new ScheduleResult_output();  
394 -// ro.setRuleId($ruleId);  
395 -// ro.setSd(initDate);  
396 -// ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));  
397 -// ro.setCarConfigId($ruleData.getCarConfigId());  
398 -// scheduleResult_outputs.add(ro);  
399 -//  
400 -// i = (i + 1) % $rangesize;  
401 -// }  
402 -//  
403 -// initDate = initDate.plusDays(1);  
404 -// }  
405 -//  
406 -// loop_employee_result clgr = new loop_employee_result();  
407 -// clgr.setRuleId($ruleId);  
408 -// clgr.setEo_list(scheduleResult_outputs);  
409 -//  
410 -// log.info(String.valueOf(scheduleResult_outputs.size()));  
411 -//  
412 -// insert(clgr);  
413 -//end  
414 -//  
415 -////------------------------- 第四阶段、范围组循环计算 ----------------------------//  
416 -//  
417 -//global ScheduleResults_output scheduleResult;  
418 -//  
419 -//rule "output"  
420 -// when  
421 -// loop_guideboard_result(  
422 -// go_list.size() > 0,  
423 -// $ruleId : ruleId, $go_list : go_list  
424 -// )  
425 -// loop_employee_result(  
426 -// ruleId == $ruleId,  
427 -// eo_list.size() == $go_list.size(),  
428 -// $eo_list : eo_list  
429 -// )  
430 -// then  
431 -// for (int i = 0; i < $go_list.size(); i++) {  
432 -// ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i);  
433 -// ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i);  
434 -// go.setEmployeeConfigId(eo.getEmployeeConfigId());  
435 -// scheduleResult.getResults().add(go);  
436 -// }  
437 -//  
438 -//end  
439 -//  
440 -//  
441 -//  
442 -//  
443 -//  
444 -//  
445 -//  
446 -//  
447 -//  
448 -//  
449 -//  
450 -//  
451 -//  
452 -//  
453 -  
454 - 1 +package com.bsth.service.schedule.shiftloop;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  7 +
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  10 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  11 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  12 +
  13 +import org.slf4j.Logger;
  14 +
  15 +global Logger log;
  16 +global ScheduleResults_output scheduleResult;
  17 +
  18 +/*
  19 + 存在(翻班格式)
  20 +*/
  21 +
  22 +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
  23 +
  24 +declare Calcu_days_result_pre
  25 + ruleId: String // 规则Id
  26 +
  27 + calcu_index_lp : Integer // 计算之后路牌的起始索引
  28 + calcu_index_ry : Integer // 计算之后人员的起始索引
  29 +
  30 + // 1、第一部分循环需要用到的数据(当开始日期大于启用日期的时候才有)
  31 + calcu_start_date_1: DateTime // 第一部分开始计算日期
  32 + calcu_end_date_1: DateTime // 第一部分结束计算日期
  33 +
  34 + // 2、第二部分循环需要用到的数据
  35 + sdays : Integer // 总共需要排班的天数
  36 + calcu_start_date_2 : DateTime // 开始计算日期
  37 + calcu_end_date_2 : DateTime // 结束计算日期
  38 +
  39 +end
  40 +
  41 +/*
  42 + 计算启用日期,开始计算日期,结束计算日期,相差天数
  43 + 1、规则启用日期小于开始计算日期
  44 + 2、规则启用日期大于等于开始日期,小于等于结束日期
  45 +*/
  46 +// 1、启用日期 < 开始日期
  47 +rule "calcu_days_1_"
  48 + salience 1000
  49 + when
  50 + ScheduleCalcuParam_input(
  51 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  52 + $fromDate : fromDate,
  53 + $toDate : toDate
  54 + )
  55 + ScheduleRule_input(
  56 + $ruleId : ruleId, $qyrq : qyrq,
  57 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  58 + eval($qyrq.isBefore($fromDate))
  59 + then
  60 + // 构造Calcu_days_result_pre,用于路牌
  61 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  62 + cdrp.setRuleId($ruleId);
  63 + cdrp.setCalcu_index_lp($lpindex);
  64 + cdrp.setCalcu_index_ry($ryindex);
  65 + cdrp.setCalcu_start_date_1($qyrq);
  66 + cdrp.setCalcu_end_date_1($fromDate);
  67 + Period p2 = new Period($fromDate, $toDate, PeriodType.days());
  68 + cdrp.setSdays(p2.getDays() + 1);
  69 + cdrp.setCalcu_start_date_2($fromDate);
  70 + cdrp.setCalcu_end_date_2($toDate);
  71 +
  72 + insert(cdrp);
  73 +
  74 + log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
  75 +
  76 +end
  77 +
  78 +// 启用日期 属于 [开始日期,结束日期]
  79 +rule "calcu_days_2_"
  80 + salience 1000
  81 + when
  82 + ScheduleCalcuParam_input(
  83 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  84 + $fromDate : fromDate,
  85 + $toDate : toDate
  86 + )
  87 + ScheduleRule_input(
  88 + $ruleId : ruleId, $qyrq : qyrq,
  89 + $lpindex : startGbdIndex, $ryindex: startEIndex)
  90 + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
  91 + then
  92 + // 构造Calcu_days_result_pre,用于路牌
  93 + Calcu_days_result_pre cdrp = new Calcu_days_result_pre();
  94 + cdrp.setRuleId($ruleId);
  95 + cdrp.setCalcu_index_lp($lpindex);
  96 + cdrp.setCalcu_index_ry($ryindex);
  97 + cdrp.setCalcu_start_date_1($qyrq);
  98 + cdrp.setCalcu_end_date_1($qyrq);
  99 + Period p2 = new Period($qyrq, $toDate, PeriodType.days());
  100 + cdrp.setSdays(p2.getDays() + 1);
  101 + cdrp.setCalcu_start_date_2($qyrq);
  102 + cdrp.setCalcu_end_date_2($toDate);
  103 +
  104 + insert(cdrp);
  105 +
  106 + log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
  107 +
  108 +end
  109 +
  110 +//------------------------- 第二阶段、计算规则准备数据2(第一组循环) ----------------------------//
  111 +rule "Calcu_loop1_1_" // 路牌在时刻表中存在,就翻
  112 + salience 900
  113 + when
  114 + $cdrp: Calcu_days_result_pre(
  115 + calcu_start_date_1.isBefore(calcu_end_date_1),
  116 + $csd1: calcu_start_date_1,
  117 + $ced1: calcu_end_date_1,
  118 + $ruleId: ruleId,
  119 + $lpindex: calcu_index_lp,
  120 + $ryindex: calcu_index_ry
  121 + )
  122 + $sri: ScheduleRule_input(
  123 + ruleId == $ruleId,
  124 + $gids: guideboardIds,
  125 + $lprangesize : guideboardIds.size(),
  126 + $ryrangesize: employeeConfigIds.size()
  127 + )
  128 + $liro: LpInfoResult_output(
  129 + dateTime.isEqual($csd1),
  130 + $gids.get($lpindex) == lpId,
  131 + $lpId: lpId
  132 + )
  133 + then
  134 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  135 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  136 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  137 +
  138 + log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",
  139 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
  140 +
  141 + update($cdrp);
  142 +end
  143 +
  144 +rule "Calcu_loop1_2_" // 路牌在时刻表中不存在,就不翻
  145 + salience 900
  146 + when
  147 + $cdrp: Calcu_days_result_pre(
  148 + calcu_start_date_1.isBefore(calcu_end_date_1),
  149 + $csd1: calcu_start_date_1,
  150 + $ced1: calcu_end_date_1,
  151 + $ruleId: ruleId
  152 + )
  153 + $sri: ScheduleRule_input(
  154 + ruleId == $ruleId,
  155 + $rangesize : guideboardIds.size()
  156 + )
  157 + then
  158 + $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
  159 +
  160 + log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",
  161 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
  162 +
  163 + update($cdrp);
  164 +end
  165 +
  166 +//------------------------- 第三阶段、计算规则准备数据2(第二组循环) ----------------------------//
  167 +rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻
  168 + salience 800
  169 + when
  170 + $cdrp: Calcu_days_result_pre(
  171 + calcu_start_date_1.isEqual(calcu_end_date_1),
  172 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  173 + $csd2: calcu_start_date_2,
  174 + $ced2: calcu_end_date_2,
  175 + $ruleId: ruleId,
  176 + $lpindex: calcu_index_lp,
  177 + $ryindex: calcu_index_ry
  178 + )
  179 + $sri: ScheduleRule_input(
  180 + ruleId == $ruleId,
  181 + $cid: carConfigId,
  182 + $gids: guideboardIds,
  183 + $eids: employeeConfigIds,
  184 + $lprangesize : guideboardIds.size(),
  185 + $ryrangesize: employeeConfigIds.size()
  186 + )
  187 + $liro: LpInfoResult_output(
  188 + dateTime.isEqual($csd2),
  189 + $gids.get($lpindex) == lpId,
  190 + $lpId: lpId
  191 + )
  192 + then
  193 + ScheduleResult_output ro = new ScheduleResult_output();
  194 + ro.setRuleId($ruleId);
  195 + ro.setSd($csd2);
  196 + ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  197 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  198 + ro.setCarConfigId($cid);
  199 +
  200 + scheduleResult.getResults().add(ro);
  201 +
  202 + $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
  203 + $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
  204 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  205 +
  206 + log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  207 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  208 +
  209 + update($cdrp);
  210 +end
  211 +
  212 +rule "Calcu_loop2_2_" // 路牌在时刻表中不存在,就不翻
  213 + salience 800
  214 + when
  215 + $cdrp: Calcu_days_result_pre(
  216 + calcu_start_date_1.isEqual(calcu_end_date_1),
  217 + calcu_start_date_2.isBefore(calcu_end_date_2) || calcu_start_date_2.isEqual(calcu_end_date_2),
  218 + $csd2: calcu_start_date_2,
  219 + $ced2: calcu_end_date_2,
  220 + $ruleId: ruleId,
  221 + $lpindex: calcu_index_lp,
  222 + $ryindex: calcu_index_ry
  223 + )
  224 + $sri: ScheduleRule_input(
  225 + ruleId == $ruleId,
  226 + $cid: carConfigId,
  227 + $gids: guideboardIds,
  228 + $eids: employeeConfigIds
  229 +
  230 + )
  231 + then
  232 + ScheduleResult_output ro = new ScheduleResult_output();
  233 + ro.setRuleId($ruleId);
  234 + ro.setSd($csd2);
  235 + ro.setGuideboardId(String.valueOf($gids.get($lpindex)));
  236 + ro.setEmployeeConfigId(String.valueOf($eids.get($ryindex)));
  237 + ro.setCarConfigId($cid);
  238 +
  239 + scheduleResult.getResults().add(ro);
  240 +
  241 + $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
  242 +
  243 + log.info("Calcu_loop2_2_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  244 + $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
  245 +
  246 + update($cdrp);
  247 +end
  248 +
  249 +
  250 +
  251 +
  252 +
  253 +
src/main/resources/rules/ttinfo.drl
@@ -10,6 +10,8 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; @@ -10,6 +10,8 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
10 import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; 10 import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
11 import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output; 11 import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output;
12 12
  13 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  14 +
13 import com.bsth.service.schedule.TTInfoDetailService; 15 import com.bsth.service.schedule.TTInfoDetailService;
14 16
15 import com.bsth.entity.schedule.TTInfo; 17 import com.bsth.entity.schedule.TTInfo;
@@ -38,7 +40,18 @@ function Map ttidParams(List ttinfolist) { @@ -38,7 +40,18 @@ function Map ttidParams(List ttinfolist) {
38 TODO:规则说明,以后待说明 40 TODO:规则说明,以后待说明
39 */ 41 */
40 42
41 -// TODO: 43 +//----------------- pre 预处理 param对象 -----------------------//
  44 +
  45 +rule "pre_calcu_TTInfoCalcuParam_input"
  46 + no-loop
  47 + salience 1000
  48 + when
  49 + $ttp: TTInfoCalcuParam_input($xlId : xlId)
  50 + $minqyrq: DateTime() from accumulate ($sri: ScheduleRule_input(xlId == $xlId), minruleqyrq($sri))
  51 + then
  52 + $ttp.setFromDate($minqyrq);
  53 + update($ttp);
  54 +end
42 55
43 //----------------- 第一阶段、计算规则准备数据(天数)----------------// 56 //----------------- 第一阶段、计算规则准备数据(天数)----------------//
44 57
src/main/resources/static/pages/oil/add.html
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <ul class="page-breadcrumb breadcrumb"> 7 <ul class="page-breadcrumb breadcrumb">
8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> 8 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9 <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li> 9 <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
10 - <li><a href="list.html" data-pjax>进场场油量</a> <i class="fa fa-circle"></i></li> 10 + <li><a href="list_ph.html" data-pjax>进场场油量</a> <i class="fa fa-circle"></i></li>
11 <li><span class="active">进场站油量信息编辑</span></li> 11 <li><span class="active">进场站油量信息编辑</span></li>
12 </ul> 12 </ul>
13 13
@@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
46 <div class="form-group"> 46 <div class="form-group">
47 <label class="col-md-3 control-label">开始营运日期</label> 47 <label class="col-md-3 control-label">开始营运日期</label>
48 <div class="col-md-4"> 48 <div class="col-md-4">
49 - <input type="text" class="form-control" name="jhsj" > 49 + <input type="time" class="form-control" name="jhsj" >
50 <span class="help-block"> 如:12:12</span> 50 <span class="help-block"> 如:12:12</span>
51 </div> 51 </div>
52 </div> 52 </div>
@@ -326,33 +326,26 @@ @@ -326,33 +326,26 @@
326 submitHandler : function(f) { 326 submitHandler : function(f) {
327 var params = form.serializeJSON(); 327 var params = form.serializeJSON();
328 error.hide(); 328 error.hide();
329 - 329 + var nbbm=$("#nbbm").val();
  330 + var date=$("#date").val();
  331 + var jsy=$("#jsy").val();
  332 + var map={};
  333 + map["nbbm"]=nbbm;
  334 + map["date"]=date;
  335 + map["jsy"]=jsy;
330 //检查一下用户是否存在 336 //检查一下用户是否存在
331 - $post('/ylb/saveYlb', params, function(){  
332 - layer.msg('添加信息成功.');  
333 - loadPage('list.html');  
334 - });  
335 -// $get('/user/all', {userName_eq: params.userName}, function(list){  
336 -// if(!list || list.length == 0){  
337 - /* console.log(params);  
338 - $.ajax({  
339 - url: '/ylb/saveYlb',  
340 - type: 'POST',  
341 - traditional: true,  
342 - data: params,  
343 - success: function(res){  
344 - layer.msg('添加信息成功.');  
345 - loadPage('list.html');  
346 - }  
347 - }); */  
348 - /* $post('/user', params, function(res){  
349 - layer.msg('添加用户成功.'); 337 + $get('/ylb/checkYl', map, function(fage){
  338 + console.log(fage);
  339 + if(fage!=""){
  340 + layer.msg('该驾驶员当天已存在.');
  341 + }else{
  342 + $post('/ylb/saveYlb', params, function(){
  343 + layer.msg('添加信息成功.');
350 loadPage('list.html'); 344 loadPage('list.html');
351 - }); */  
352 -// }  
353 -// else  
354 -// layer.alert('用户【' + params.userName + '】已存在', {icon: 2, title: '提交被拒绝'});  
355 -// }); 345 + });
  346 + }
  347 +
  348 + });
356 } 349 }
357 }); 350 });
358 }); 351 });
src/main/resources/static/pages/oil/list_ph.html
@@ -203,38 +203,46 @@ @@ -203,38 +203,46 @@
203 {{obj.xlname}} 203 {{obj.xlname}}
204 </td> 204 </td>
205 <td> 205 <td>
206 - {{obj.nbbm}} 206 + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
  207 +
207 </td> 208 </td>
208 <td> 209 <td>
209 {{obj.jsy}} 210 {{obj.jsy}}
210 </td> 211 </td>
211 <td> 212 <td>
212 - {{obj.jzl}} 213 +
  214 + <lable data-id="{{obj.id}}" class="in_carpark_jzl"> {{obj.jzl}}</lable>
213 </td> 215 </td>
214 <td> 216 <td>
215 - {{obj.czyl}} 217 +
  218 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_czyl"
  219 + type="text" value=" {{obj.czyl}}" style=" width:40px"
  220 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  221 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
216 </td> 222 </td>
217 <td> 223 <td>
218 <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl" 224 <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzyl"
219 -type="text" value=" {{obj.jzyl}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
220 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')"> 225 + type="text" value=" {{obj.jzyl}}" style=" width:40px"
  226 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  227 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
221 </td> 228 </td>
222 <td> 229 <td>
223 - {{obj.yh}} 230 + {{obj.yh}}
224 </td> 231 </td>
225 <td> 232 <td>
226 - <select data-id="{{obj.id}}" class="in_carpark_rylx"> 233 + <select data-id="{{obj.id}}" class="in_carpark_rylx" style=" width:80px" >
227 <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option> 234 <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option>
228 <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option> 235 <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option>
229 </select> 236 </select>
230 </td> 237 </td>
231 <td> 238 <td>
232 <input data-id="{{obj.id}}" href="javascript:;" 239 <input data-id="{{obj.id}}" href="javascript:;"
233 -class="in_carpark_ns" type="text" value=" {{obj.ns}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
234 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')"> 240 + class="in_carpark_ns" type="text" value=" {{obj.ns}}" style=" width:40px"
  241 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  242 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
235 </td> 243 </td>
236 <td> 244 <td>
237 - <select data-id="{{obj.id}}" class="in_carpark_shyy"> 245 + <select data-id="{{obj.id}}" class="in_carpark_shyy" style=" width:80px">
238 <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option> 246 <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option>
239 <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option> 247 <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option>
240 <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option> 248 <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option>
@@ -247,15 +255,20 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot;&gt; @@ -247,15 +255,20 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot;&gt;
247 </select> 255 </select>
248 </td> 256 </td>
249 <td> 257 <td>
250 - <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" type="text"  
251 -value=" {{obj.sh}}" style=" width:40px" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'')"  
252 -onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'')" >  
253 - </td> 258 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl"
  259 + value={{obj.sh}} style=" width:40px" type="text"
  260 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  261 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  262 +
  263 +</td>
254 <td> 264 <td>
255 {{obj.zlc}} 265 {{obj.zlc}}
256 </td> 266 </td>
257 <td> 267 <td>
258 - {{obj.yhlx}} 268 + <select data-id="{{obj.id}}" class="in_carpark_yhlx">
  269 + <option value='0' {{if obj.yhlx==0}} selected = 'selected' {{/if}}>手录</option>
  270 + <option value='1' {{if obj.yhlx==1}} selected = 'selected' {{/if}}>拆分</option>
  271 + </select>
259 </td> 272 </td>
260 <td> 273 <td>
261 {{obj.bglyh}} 274 {{obj.bglyh}}
@@ -307,48 +320,105 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt; @@ -307,48 +320,105 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
307 //保存 320 //保存
308 $("#saveButton").on('click',function(){ 321 $("#saveButton").on('click',function(){
309 var ylArray = []; 322 var ylArray = [];
310 - /* $('input.icheck:checked').each(function(){  
311 - var map = {};  
312 - var id=$(this).data('id');  
313 - var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html();  
314 - var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').html();  
315 - var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();  
316 - map['id']=id;  
317 - map['jzyl']=jzyl;  
318 - map['sh']=sh;  
319 - map['shyy']=shyy;  
320 - ylArray.push(map);  
321 - }) */  
322 -  
323 $('input.icheck').each(function(){ 323 $('input.icheck').each(function(){
324 var map = {}; 324 var map = {};
325 var id=$(this).data('id'); 325 var id=$(this).data('id');
  326 + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html();
  327 + if(jzl=="" || jzl ==null){
  328 + jzl=0;
  329 + }
  330 + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val();
  331 + if(czyl=="" || czyl==null){
  332 + czyl=0;
  333 + }
326 var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); 334 var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  335 + if(jzyl=="" || jzyl==null){
  336 + jzyl=0;
  337 + }
  338 +
327 var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); 339 var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  340 + if(sh=="" || sh==null){
  341 + sh=0;
  342 + }
  343 +
328 var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); 344 var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
329 var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); 345 var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  346 + if(ns=="" || ns==null){
  347 + ns=0;
  348 + }
  349 +
330 var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); 350 var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val();
  351 + var yhlx = $('.in_carpark_yhlx[data-id='+id+']', '#ll_oil_list').val();
  352 +
331 map['id']=id; 353 map['id']=id;
  354 + map['jzl']=jzl;
  355 + map['czyl']=czyl;
332 map['jzyl']=jzyl; 356 map['jzyl']=jzyl;
333 map['sh']=sh; 357 map['sh']=sh;
334 map['shyy']=shyy; 358 map['shyy']=shyy;
335 map['ns']=ns; 359 map['ns']=ns;
336 map['rylx']=rylx; 360 map['rylx']=rylx;
  361 + map['yhlx']=yhlx;
337 ylArray.push(map); 362 ylArray.push(map);
338 }) 363 })
339 var params = {}; 364 var params = {};
340 params['ylbList']=JSON.stringify(ylArray); 365 params['ylbList']=JSON.stringify(ylArray);
  366 + console.log(JSON.stringify(ylArray));
341 var i = layer.load(2); 367 var i = layer.load(2);
342 - $get('/ylb/saveYlbList', params, function () { 368 + $post('/ylb/saveYlbList', params, function () {
343 layer.close(i); 369 layer.close(i);
344 var params1 =getParamsList(); 370 var params1 =getParamsList();
345 jsDoQuery(params1, true); 371 jsDoQuery(params1, true);
346 - }); 372 + });
347 }) 373 })
348 //拆分 374 //拆分
349 $("#sortButton").on('click', function () { 375 $("#sortButton").on('click', function () {
350 if ($("#rq").val() != "") { 376 if ($("#rq").val() != "") {
351 - var id = $('input.icheck:checked').data('id'); 377 + var ylArray = [];
  378 + var nbbm="";
  379 + var msg="";
  380 + $('input.icheck:checked').each(function(){
  381 + var map = {};
  382 + var id=$(this).data('id');
  383 + var clzbh =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html();
  384 + if(nbbm.indexOf(clzbh)>-1){
  385 + if(msg==""){
  386 + msg += clzbh;
  387 + }else{
  388 + msg += ","+clzbh;
  389 + }
  390 + }else{
  391 + nbbm +=clzbh;
  392 + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  393 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  394 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val();
  395 + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val();
  396 + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val();
  397 + map['id']=id;
  398 + map['jzyl']=jzyl;
  399 + map['sh']=sh;
  400 + map['shyy']=shyy;
  401 + map['ns']=ns;
  402 + map['rylx']=rylx;
  403 + ylArray.push(map);
  404 + }
  405 +
  406 + }) ;
  407 + if(msg!=""){
  408 + layer.msg('内部编码为:【'+msg +'】的车辆请选择一条数据进行拆分.');
  409 + }else{
  410 + var params = {};
  411 + params['ylbList']=JSON.stringify(ylArray);
  412 + var i = layer.load(2);
  413 + $post('/ylb/sort', params, function () {
  414 + layer.close(i);
  415 + var params1 =getParamsList();
  416 + jsDoQuery(params1, true);
  417 + });
  418 +
  419 + }
  420 +
  421 + /* var id = $('input.icheck:checked').data('id');
352 422
353 if (typeof(id) == 'undefined') { 423 if (typeof(id) == 'undefined') {
354 layer.msg("请选择一行进行拆分"); 424 layer.msg("请选择一行进行拆分");
@@ -370,7 +440,7 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt; @@ -370,7 +440,7 @@ onafterpaste=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;)&quot; &gt;
370 jsDoQuery(params1, true); 440 jsDoQuery(params1, true);
371 }); 441 });
372 442
373 - } 443 + } */
374 } else { 444 } else {
375 layer.msg('请选择日期.'); 445 layer.msg('请选择日期.');
376 } 446 }