Commit 49163cf34428bcb9e0a53acde4690a3c2d49f451
1 parent
8f5618c6
嘉定油电操作量
Showing
8 changed files
with
3242 additions
and
193 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
| @@ -97,6 +97,18 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -97,6 +97,18 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 97 | return list; | 97 | return list; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | + @RequestMapping(value = "/obtainJd",method = RequestMethod.GET) | ||
| 101 | + public Map<String, Object> obtainJd(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 102 | + Map<String, Object> list=new HashMap<String, Object>(); | ||
| 103 | + try { | ||
| 104 | + list = service.obtain(map); | ||
| 105 | + } catch (Exception e) { | ||
| 106 | + // TODO Auto-generated catch block | ||
| 107 | + throw e; | ||
| 108 | + } | ||
| 109 | + return list; | ||
| 110 | + } | ||
| 111 | + | ||
| 100 | /** | 112 | /** |
| 101 | * 保存电量 | 113 | * 保存电量 |
| 102 | * @param map | 114 | * @param map |
src/main/java/com/bsth/controller/oil/YlbController.java
| @@ -72,6 +72,19 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -72,6 +72,19 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 72 | return list; | 72 | return list; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | + @RequestMapping(value = "/obtainJd",method = RequestMethod.GET) | ||
| 76 | + public Map<String, Object> obtainJd(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 77 | + Map<String, Object> list =new HashMap<String, Object>(); | ||
| 78 | + try { | ||
| 79 | + | ||
| 80 | + list = ylbService.obtain(map); | ||
| 81 | + } catch (Exception e) { | ||
| 82 | + // TODO Auto-generated catch block | ||
| 83 | + throw e; | ||
| 84 | + } | ||
| 85 | + System.out.println(); | ||
| 86 | + return list; | ||
| 87 | + } | ||
| 75 | 88 | ||
| 76 | @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST) | 89 | @RequestMapping(value = "/saveYlbList",method = RequestMethod.POST) |
| 77 | public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){ | 90 | public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){ |
| @@ -322,5 +335,17 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -322,5 +335,17 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 322 | return list; | 335 | return list; |
| 323 | } | 336 | } |
| 324 | 337 | ||
| 338 | + @RequestMapping(value = "/updateHistoryJd",method = RequestMethod.POST) | ||
| 339 | + public Map<String, Object> updateHistoryJd(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 340 | + Map<String, Object> list =new HashMap<String, Object>(); | ||
| 341 | + try { | ||
| 342 | + list = ylbService.updateHistory(map); | ||
| 343 | + } catch (Exception e) { | ||
| 344 | + // TODO Auto-generated catch block | ||
| 345 | + throw e; | ||
| 346 | + } | ||
| 347 | + return list; | ||
| 348 | + } | ||
| 349 | + | ||
| 325 | 350 | ||
| 326 | } | 351 | } |
src/main/java/com/bsth/service/oil/DlbService.java
| @@ -8,7 +8,8 @@ import com.bsth.service.BaseService; | @@ -8,7 +8,8 @@ import com.bsth.service.BaseService; | ||
| 8 | 8 | ||
| 9 | public interface DlbService extends BaseService<Dlb, Integer>{ | 9 | public interface DlbService extends BaseService<Dlb, Integer>{ |
| 10 | Map<String, Object> obtain(Map<String, Object> map) throws Exception; | 10 | Map<String, Object> obtain(Map<String, Object> map) throws Exception; |
| 11 | - | 11 | + Map<String, Object> obtainJd(Map<String, Object> map) throws Exception; |
| 12 | + | ||
| 12 | Map<String, Object> sort(Map<String, Object> map); | 13 | Map<String, Object> sort(Map<String, Object> map); |
| 13 | 14 | ||
| 14 | Map<String, Object> checkDl(Map<String, Object> map); | 15 | Map<String, Object> checkDl(Map<String, Object> map); |
src/main/java/com/bsth/service/oil/YlbService.java
| @@ -8,6 +8,8 @@ import com.bsth.service.BaseService; | @@ -8,6 +8,8 @@ import com.bsth.service.BaseService; | ||
| 8 | 8 | ||
| 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> obtainJd(Map<String, Object> map) throws Exception; | ||
| 12 | + | ||
| 11 | Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception; | 13 | Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception; |
| 12 | Map<String, Object> saveYlb(Ylb t); | 14 | Map<String, Object> saveYlb(Ylb t); |
| 13 | String obtainDsq() throws Exception; | 15 | String obtainDsq() throws Exception; |
| @@ -28,7 +30,7 @@ public interface YlbService extends BaseService<Ylb, Integer>{ | @@ -28,7 +30,7 @@ public interface YlbService extends BaseService<Ylb, Integer>{ | ||
| 28 | Map<String, Object> deleteIds(Map<String, Object> map) throws Exception; | 30 | Map<String, Object> deleteIds(Map<String, Object> map) throws Exception; |
| 29 | 31 | ||
| 30 | Map<String, Object> updateHistory(Map<String, Object> map) throws Exception; | 32 | Map<String, Object> updateHistory(Map<String, Object> map) throws Exception; |
| 31 | - | 33 | + Map<String, Object> updateHistoryJd(Map<String, Object> map) throws Exception; |
| 32 | Map<String, Object> update(Map<String, Object> map); | 34 | Map<String, Object> update(Map<String, Object> map); |
| 33 | 35 | ||
| 34 | 36 |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| @@ -261,7 +261,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -261,7 +261,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 261 | // 当天DLB信息 | 261 | // 当天DLB信息 |
| 262 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | 262 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); |
| 263 | // 当天YLXXB信息 | 263 | // 当天YLXXB信息 |
| 264 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | 264 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 1,gsbm); |
| 265 | // 从排班表中计算出行驶的总里程 | 265 | // 从排班表中计算出行驶的总里程 |
| 266 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | 266 | List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); |
| 267 | List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | 267 | List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); |
| @@ -528,6 +528,304 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -528,6 +528,304 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 528 | return newMap; | 528 | return newMap; |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | + | ||
| 532 | + | ||
| 533 | + /** | ||
| 534 | + * 获取进存油信息 | ||
| 535 | + * @Transactional 回滚事物 | ||
| 536 | + */ | ||
| 537 | + @Transactional | ||
| 538 | + @Override | ||
| 539 | + public Map<String, Object> obtainJd(Map<String, Object> map2) throws Exception{ | ||
| 540 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 541 | + try { | ||
| 542 | + Date date=new Date(); | ||
| 543 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 544 | + Map<String, Object> carsMap = new HashMap<String, Object>(); | ||
| 545 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 546 | + Cars c = carsList.get(i); | ||
| 547 | + carsMap.put(c.getInsideCode(), c.getNyType()); | ||
| 548 | + } | ||
| 549 | + String rq = map2.get("rq").toString(); | ||
| 550 | + String line = ""; | ||
| 551 | + if (map2.get("xlbm_like") != null) { | ||
| 552 | + line = map2.get("xlbm_like").toString().trim(); | ||
| 553 | + } | ||
| 554 | + String gsbm=""; | ||
| 555 | + if(map2.get("ssgsdm_like")!=null){ | ||
| 556 | + gsbm=map2.get("ssgsdm_like").toString(); | ||
| 557 | + } | ||
| 558 | + String fgsbm=""; | ||
| 559 | + if(map2.get("fgsdm_like")!=null){ | ||
| 560 | + fgsbm=map2.get("fgsdm_like").toString(); | ||
| 561 | + } | ||
| 562 | + String nbbm=""; | ||
| 563 | + if(map2.get("nbbm_eq")!=null){ | ||
| 564 | + nbbm=map2.get("nbbm_eq").toString(); | ||
| 565 | + } | ||
| 566 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 567 | + // 保留两位小数 | ||
| 568 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 569 | + // TODO Auto-generated method stub | ||
| 570 | + // 当天DLB信息 | ||
| 571 | + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | ||
| 572 | + // 当天YLXXB信息 | ||
| 573 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 1,gsbm); | ||
| 574 | + // 从排班表中计算出行驶的总里程 | ||
| 575 | + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | ||
| 576 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | ||
| 577 | + Map<String, Double> lcMap=new HashMap<String,Double>(); | ||
| 578 | + for (int i = 0; i < listpbs.size(); i++) { | ||
| 579 | + String cl=listpbs.get(i).get("clZbh").toString(); | ||
| 580 | + Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0 | ||
| 581 | + : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString()); | ||
| 582 | + if(lcMap.get(cl)==null){ | ||
| 583 | + lcMap.put(cl, lc); | ||
| 584 | + }else{ | ||
| 585 | + double lc_=lcMap.get(cl); | ||
| 586 | + lcMap.remove(cl); | ||
| 587 | + lcMap.put(cl, Arith.add(lc, lc_)); | ||
| 588 | + } | ||
| 589 | + } | ||
| 590 | + | ||
| 591 | + List<Jdl> jdlList=jdlRepository.JdlList(rq); | ||
| 592 | + String sxtj=map2.get("sxtj").toString(); | ||
| 593 | + if(sxtj.equals("0")){ | ||
| 594 | + listpb=listpbs; | ||
| 595 | + }else{ | ||
| 596 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | ||
| 597 | + List<String> stringList=new ArrayList<String>(); | ||
| 598 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 599 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 600 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 601 | + //一车一单 | ||
| 602 | + if(sxtj.equals("1")){ | ||
| 603 | + if(cs==1){ | ||
| 604 | + stringList.add(clbm); | ||
| 605 | + } | ||
| 606 | + } | ||
| 607 | + //一车多单 | ||
| 608 | + if(sxtj.equals("2")){ | ||
| 609 | + if(cs>1){ | ||
| 610 | + stringList.add(clbm); | ||
| 611 | + } | ||
| 612 | + } | ||
| 613 | + } | ||
| 614 | + | ||
| 615 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 616 | + String strNbbm=stringList.get(i); | ||
| 617 | + for (int j = 0; j < listpbs.size(); j++) { | ||
| 618 | + Map<String, Object> map = listpbs.get(j); | ||
| 619 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 620 | + if(strNbbm.equals(mapNbbm)){ | ||
| 621 | + listpb.add(map); | ||
| 622 | + } | ||
| 623 | + } | ||
| 624 | + } | ||
| 625 | + } | ||
| 626 | + Map<String, Object> newMap_=new HashMap<String,Object>(); | ||
| 627 | + List<Dlb> addList = new ArrayList<Dlb>(); | ||
| 628 | + List<Dlb> updateList = new ArrayList<Dlb>(); | ||
| 629 | + Map<String, Object> cMap=new HashMap<String, Object>(); | ||
| 630 | + List<Map<String, Object>> listpb_=listpb; | ||
| 631 | + Collections.sort(listpb,new NbbmJcsxMap()); | ||
| 632 | + for (int x = 0; x < listpb_.size(); x++) { | ||
| 633 | + String type = "add"; | ||
| 634 | + boolean sfdc = false; | ||
| 635 | + Map<String, Object> map_ = listpb_.get(x); | ||
| 636 | + if (carsMap.get(map_.get("clZbh").toString()) != null) { | ||
| 637 | + if(map_.get("clZbh").toString().equals("0")){ | ||
| 638 | + sfdc = false; | ||
| 639 | + } | ||
| 640 | + } else { | ||
| 641 | + sfdc = false; | ||
| 642 | + } | ||
| 643 | + if (sfdc) { | ||
| 644 | + if(newMap_.get(map_.get("clZbh").toString())==null){ | ||
| 645 | + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | ||
| 646 | + //车辆总里程 | ||
| 647 | + double zlc =lcMap.get(map_.get("clZbh").toString()); | ||
| 648 | + //车辆总加电量 | ||
| 649 | + double zjzl = 0.0; | ||
| 650 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 651 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 652 | + if (map_.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 653 | + && map_.get("company").toString().equals(ylxxb.getGsdm())) { | ||
| 654 | + zjzl = Arith.add(zjzl, ylxxb.getJzl()); | ||
| 655 | + } | ||
| 656 | + } | ||
| 657 | + for (int i = 0; i < jdlList.size(); i++) { | ||
| 658 | + Jdl jdl=jdlList.get(i); | ||
| 659 | + if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | ||
| 660 | + &&map_.get("company").toString().equals(jdl.getGsBm()) | ||
| 661 | + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | ||
| 662 | + zjzl = Arith.add(zjzl,jdl.getJdl()); | ||
| 663 | + } | ||
| 664 | + } | ||
| 665 | +// double clsh=0.0; | ||
| 666 | +// if(shMap.get(map_.get("clZbh").toString())==null){ | ||
| 667 | +// clsh=0.0; | ||
| 668 | +// }else{ | ||
| 669 | +// clsh=shMap.get(map_.get("clZbh").toString()); | ||
| 670 | +// } | ||
| 671 | +// zjzl =Arith.sub(zjzl, clsh); | ||
| 672 | + Double nextJzyl = 0.0; | ||
| 673 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 674 | + Map<String, Object> map = listpb.get(i); | ||
| 675 | + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | ||
| 676 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 677 | + Dlb t = new Dlb(); | ||
| 678 | + for (int k = 0; k < dlList.size(); k++) { | ||
| 679 | + Dlb t1 = dlList.get(k); | ||
| 680 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 681 | + && t1.getJsy().equals(map.get("jGh").toString()) | ||
| 682 | + && t1.getXlbm().equals(map.get("xlBm").toString())) { | ||
| 683 | + if(t1.getLp()==null){ | ||
| 684 | + //同人同车同线路不同路牌的过滤 (考虑到历史数据) | ||
| 685 | + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | ||
| 686 | + t = t1; | ||
| 687 | + type = "update"; | ||
| 688 | + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | ||
| 689 | + map.get("clZbh").toString()); | ||
| 690 | + } | ||
| 691 | + }else{ | ||
| 692 | + if(t1.getLp().equals(map.get("lpName").toString())){ | ||
| 693 | + t = t1; | ||
| 694 | + type = "update"; | ||
| 695 | + } | ||
| 696 | + | ||
| 697 | + } | ||
| 698 | + } | ||
| 699 | + } | ||
| 700 | + Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | ||
| 701 | + if(map.get("seqNumber").toString().equals("1")){ | ||
| 702 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 703 | + Double dh=0.0; | ||
| 704 | + if(zlc>0){ | ||
| 705 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | ||
| 706 | + } | ||
| 707 | + nextJzyl =Arith.sub(zjzl,dh); | ||
| 708 | + if(zlc>0){ | ||
| 709 | +// long l=Math.round(nextJzyl); | ||
| 710 | + double ylxs=nextJzyl; | ||
| 711 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | ||
| 712 | + if(dh<0){ | ||
| 713 | + t.setHd(0.0); | ||
| 714 | + t.setCdl(0.0); | ||
| 715 | + nextJzyl=Arith.add(ylxs, dh); | ||
| 716 | + }else{ | ||
| 717 | + t.setHd(dh); | ||
| 718 | + t.setCdl(dh); | ||
| 719 | + nextJzyl=ylxs; | ||
| 720 | + } | ||
| 721 | + }else{ | ||
| 722 | + t.setHd(0.0); | ||
| 723 | + t.setCdl(0.0); | ||
| 724 | + } | ||
| 725 | + }else{ | ||
| 726 | + Double dh=0.0; | ||
| 727 | + if(zlc>0){ | ||
| 728 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | ||
| 729 | + } | ||
| 730 | + nextJzyl =Arith.sub( nextJzyl,dh); | ||
| 731 | + if(zlc>0){ | ||
| 732 | +// long l=0l; | ||
| 733 | + double ylxs=0.0; | ||
| 734 | + if(i==listpb.size()-1){ | ||
| 735 | +// ylxs=czyl; | ||
| 736 | + }else{ | ||
| 737 | + if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | ||
| 738 | +// l=Math.round(nextJzyl); | ||
| 739 | + ylxs=nextJzyl; | ||
| 740 | + } | ||
| 741 | + | ||
| 742 | + } | ||
| 743 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | ||
| 744 | + if(dh<0){ | ||
| 745 | + t.setHd(0.0); | ||
| 746 | + t.setCdl(0.0); | ||
| 747 | + nextJzyl=Arith.add(ylxs, dh); | ||
| 748 | + }else{ | ||
| 749 | + t.setHd(dh); | ||
| 750 | + t.setCdl(dh); | ||
| 751 | + nextJzyl=ylxs; | ||
| 752 | + } | ||
| 753 | + }else{ | ||
| 754 | + t.setHd(0.0); | ||
| 755 | + t.setCdl(0.0); | ||
| 756 | + } | ||
| 757 | + } | ||
| 758 | + t.setCzcd(100.0); | ||
| 759 | + t.setJzcd(100.0); | ||
| 760 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 761 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | ||
| 762 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | ||
| 763 | + : Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 764 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 765 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 766 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | ||
| 767 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | ||
| 768 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 769 | + t.setRq(sdf.parse(rq)); | ||
| 770 | + t.setLp(map.get("lpName").toString()); | ||
| 771 | + t.setJname(map.get("jName").toString()); | ||
| 772 | + if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) { | ||
| 773 | + if (t.getHd() < 0) { | ||
| 774 | + t.setHd(0.0); | ||
| 775 | + } | ||
| 776 | + if (t.getCdl() < 0) { | ||
| 777 | + t.setCdl(0.0); | ||
| 778 | + } | ||
| 779 | + if (type.equals("add")) { | ||
| 780 | + t.setCreatetime(date); | ||
| 781 | + addList.add(t); | ||
| 782 | + } else { | ||
| 783 | + t.setUpdatetime(date); | ||
| 784 | + updateList.add(t); | ||
| 785 | + } | ||
| 786 | + } | ||
| 787 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 788 | + } | ||
| 789 | + } | ||
| 790 | + } | ||
| 791 | + } | ||
| 792 | + } | ||
| 793 | + if(addList.size()>0){ | ||
| 794 | + try { | ||
| 795 | + new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class); | ||
| 796 | + } catch (Exception e) { | ||
| 797 | + // TODO: handle exception | ||
| 798 | + if(e.getMessage().indexOf("PK_DLB_UK")>0){ | ||
| 799 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 800 | + logger.info("获取:存在相同数据,数据已经过滤"); | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + if(updateList.size()>0){ | ||
| 807 | + for (int i = 0; i < updateList.size(); i++) { | ||
| 808 | + repository.save(updateList.get(i)); | ||
| 809 | + } | ||
| 810 | + } | ||
| 811 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 812 | + Nylog nylog=new Nylog(); | ||
| 813 | + nylog.setCreatedate(new Date()); | ||
| 814 | + nylog.setCzmc("获取"); | ||
| 815 | + nylog.setNylx("电"); | ||
| 816 | + nylog.setUserid(user.getUserName()); | ||
| 817 | + nylog.setUsername(user.getName()); | ||
| 818 | + nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm); | ||
| 819 | + nylogRepository.save(nylog); | ||
| 820 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 821 | + } catch (Exception e) { | ||
| 822 | + // TODO Auto-generated catch block | ||
| 823 | + newMap.put("status", ResponseCode.ERROR); | ||
| 824 | + throw e; | ||
| 825 | + } | ||
| 826 | + | ||
| 827 | + return newMap; | ||
| 828 | + } | ||
| 531 | /** | 829 | /** |
| 532 | * 拆分 | 830 | * 拆分 |
| 533 | */ | 831 | */ |
| @@ -1081,7 +1379,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -1081,7 +1379,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 1081 | } | 1379 | } |
| 1082 | } | 1380 | } |
| 1083 | List<Jdl> jdlList=jdlRepository.JdlList(date); | 1381 | List<Jdl> jdlList=jdlRepository.JdlList(date); |
| 1084 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | 1382 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 1,gsdm); |
| 1085 | Map<String, Object> newMap_=new HashMap<String,Object>(); | 1383 | Map<String, Object> newMap_=new HashMap<String,Object>(); |
| 1086 | Map<String, Object> cMap=new HashMap<String, Object>(); | 1384 | Map<String, Object> cMap=new HashMap<String, Object>(); |
| 1087 | List<Map<String, Object>> listpb_=listpbDc; | 1385 | List<Map<String, Object>> listpb_=listpbDc; |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -235,21 +235,23 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -235,21 +235,23 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 235 | return result; | 235 | return result; |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | + | ||
| 239 | + | ||
| 238 | /** | 240 | /** |
| 239 | * 获取进存油信息 | 241 | * 获取进存油信息 |
| 240 | * @Transactional 回滚事物 | 242 | * @Transactional 回滚事物 |
| 241 | */ | 243 | */ |
| 242 | @Transactional | 244 | @Transactional |
| 243 | @Override | 245 | @Override |
| 244 | - public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | 246 | + public Map<String, Object> obtainJd(Map<String, Object> map2) throws Exception{ |
| 245 | Map<String, Object> newMap = new HashMap<String, Object>(); | 247 | Map<String, Object> newMap = new HashMap<String, Object>(); |
| 246 | try { | 248 | try { |
| 247 | Date date=new Date(); | 249 | Date date=new Date(); |
| 248 | List<Cars> carsList = carsRepository.findCars(); | 250 | List<Cars> carsList = carsRepository.findCars(); |
| 249 | - Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | 251 | + Map<String, Object> carsMap = new HashMap<String, Object>(); |
| 250 | for (int i = 0; i < carsList.size(); i++) { | 252 | for (int i = 0; i < carsList.size(); i++) { |
| 251 | Cars c = carsList.get(i); | 253 | Cars c = carsList.get(i); |
| 252 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | 254 | + carsMap.put(c.getInsideCode(), c.getNyType()); |
| 253 | } | 255 | } |
| 254 | String rq = map2.get("rq").toString(); | 256 | String rq = map2.get("rq").toString(); |
| 255 | String line = ""; | 257 | String line = ""; |
| @@ -331,7 +333,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -331,7 +333,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 331 | boolean sfdc = true; | 333 | boolean sfdc = true; |
| 332 | Map<String, Object> map = listpb.get(x); | 334 | Map<String, Object> map = listpb.get(x); |
| 333 | if (carsMap.get(map.get("clZbh").toString()) != null) { | 335 | if (carsMap.get(map.get("clZbh").toString()) != null) { |
| 334 | - sfdc = carsMap.get(map.get("clZbh").toString()); | 336 | + if(map.get("clZbh").toString().equals("1")){ |
| 337 | + sfdc=true; | ||
| 338 | + } | ||
| 339 | +// sfdc = carsMap.get(map.get("clZbh").toString()); | ||
| 335 | } else { | 340 | } else { |
| 336 | sfdc = true; | 341 | sfdc = true; |
| 337 | } | 342 | } |
| @@ -550,52 +555,61 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -550,52 +555,61 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 550 | 555 | ||
| 551 | 556 | ||
| 552 | /** | 557 | /** |
| 553 | - * 进场等于出场 | 558 | + * 获取进存油信息 |
| 559 | + * @Transactional 回滚事物 | ||
| 554 | */ | 560 | */ |
| 555 | @Transactional | 561 | @Transactional |
| 556 | @Override | 562 | @Override |
| 557 | - public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{ | ||
| 558 | - // TODO Auto-generated method stub | ||
| 559 | - String xlbm=""; | ||
| 560 | - if(map.get("xlbm_like")!=null){ | ||
| 561 | - xlbm= map.get("xlbm_like").toString().trim(); | ||
| 562 | - } | ||
| 563 | - String gsbm=""; | ||
| 564 | - if(map.get("ssgsdm_like")!=null){ | ||
| 565 | - gsbm=map.get("ssgsdm_like").toString(); | ||
| 566 | - } | ||
| 567 | - String fgsbm=""; | ||
| 568 | - if(map.get("fgsdm_like")!=null){ | ||
| 569 | - fgsbm=map.get("fgsdm_like").toString(); | ||
| 570 | - } | ||
| 571 | - String rq = map.get("rq").toString(); | ||
| 572 | - String nbbm=""; | ||
| 573 | - if(map.get("nbbm_eq")!=null){ | ||
| 574 | - nbbm=map.get("nbbm_eq").toString(); | ||
| 575 | - } | ||
| 576 | - | ||
| 577 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 578 | - Map<String, Object> map2=new HashMap<String,Object>(); | 563 | + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ |
| 564 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 579 | try { | 565 | try { |
| 566 | + Date date=new Date(); | ||
| 567 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 568 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 569 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 570 | + Cars c = carsList.get(i); | ||
| 571 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 572 | + } | ||
| 573 | + String rq = map2.get("rq").toString(); | ||
| 574 | + String line = ""; | ||
| 575 | + if (map2.get("xlbm_like") != null) { | ||
| 576 | + line = map2.get("xlbm_like").toString().trim(); | ||
| 577 | + } | ||
| 578 | + String gsbm=""; | ||
| 579 | + if(map2.get("ssgsdm_like")!=null){ | ||
| 580 | + gsbm=map2.get("ssgsdm_like").toString(); | ||
| 581 | + } | ||
| 582 | + String fgsbm=""; | ||
| 583 | + if(map2.get("fgsdm_like")!=null){ | ||
| 584 | + fgsbm=map2.get("fgsdm_like").toString(); | ||
| 585 | + } | ||
| 586 | + String nbbm=""; | ||
| 587 | + if(map2.get("nbbm_eq")!=null){ | ||
| 588 | + nbbm=map2.get("nbbm_eq").toString(); | ||
| 589 | + } | ||
| 580 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 590 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 591 | + // 保留两位小数 | ||
| 592 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 593 | + // TODO Auto-generated method stub | ||
| 594 | + // 当天YLB信息 | ||
| 595 | + List<Ylb> ylList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | ||
| 596 | + | ||
| 597 | + // 当天YLXXB信息 | ||
| 598 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | ||
| 599 | + | ||
| 600 | + // 前一天所有车辆最后进场班次信息 | ||
| 601 | + List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 602 | + List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 581 | 603 | ||
| 582 | - map.put("rq_eq", sdf.parse(rq)); | ||
| 583 | -// List<Cyl> clyList = cylRepository.obtainCyl(); | ||
| 584 | - // 获取车辆存油信息 | ||
| 585 | - List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 586 | - // 指定日期YLB信息 | ||
| 587 | - List<Ylb> ylbList =new ArrayList<Ylb>(); | ||
| 588 | - List<Ylb> ylbLists =new ArrayList<Ylb>(); | ||
| 589 | - List<Ylb> iterator2=new ArrayList<Ylb>(); | ||
| 590 | - ylbLists=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); | ||
| 591 | - iterator2=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); | ||
| 592 | // 从排班表中计算出行驶的总里程 | 604 | // 从排班表中计算出行驶的总里程 |
| 605 | + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | ||
| 606 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | ||
| 593 | 607 | ||
| 594 | - String sxtj=map.get("sxtj").toString(); | 608 | + String sxtj=map2.get("sxtj").toString(); |
| 595 | if(sxtj.equals("0")){ | 609 | if(sxtj.equals("0")){ |
| 596 | - ylbList=ylbLists; | 610 | + listpb=listpbs; |
| 597 | }else{ | 611 | }else{ |
| 598 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | 612 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); |
| 599 | List<String> stringList=new ArrayList<String>(); | 613 | List<String> stringList=new ArrayList<String>(); |
| 600 | for (int i = 0; i < objectLists.size(); i++) { | 614 | for (int i = 0; i < objectLists.size(); i++) { |
| 601 | String clbm=objectLists.get(i)[0].toString(); | 615 | String clbm=objectLists.get(i)[0].toString(); |
| @@ -616,194 +630,499 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -616,194 +630,499 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 616 | 630 | ||
| 617 | for (int i = 0; i < stringList.size(); i++) { | 631 | for (int i = 0; i < stringList.size(); i++) { |
| 618 | String strNbbm=stringList.get(i); | 632 | String strNbbm=stringList.get(i); |
| 619 | - for (int j = 0; j < ylbLists.size(); j++) { | ||
| 620 | - Ylb y = ylbLists.get(j); | ||
| 621 | - String mapNbbm=y.getNbbm(); | 633 | + for (int j = 0; j < listpbs.size(); j++) { |
| 634 | + Map<String, Object> map = listpbs.get(j); | ||
| 635 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 622 | if(strNbbm.equals(mapNbbm)){ | 636 | if(strNbbm.equals(mapNbbm)){ |
| 623 | - ylbList.add(y); | 637 | + listpb.add(map); |
| 624 | } | 638 | } |
| 625 | } | 639 | } |
| 626 | } | 640 | } |
| 627 | } | 641 | } |
| 628 | - | ||
| 629 | - for (int i=0;i<ylbList.size();i++) { | ||
| 630 | - Ylb ylb = ylbList.get(i); | ||
| 631 | - // 判断是否已经计算过 | ||
| 632 | - if (newMap.get("nbbm" + ylb.getNbbm()) == null) { | ||
| 633 | - String nbbm_eq = ylb.getNbbm(); | ||
| 634 | - Date rq_eq = ylb.getRq(); | ||
| 635 | - // 得到一天总的加油和里程(根据车,时间) | ||
| 636 | - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",gsbm,fgsbm); | ||
| 637 | - // 保存总的加油量 | ||
| 638 | - Double jzl = 0.0; | ||
| 639 | - // 保存总的里程 | ||
| 640 | - Double zlc = 0.0; | ||
| 641 | - //保存总的损耗 | ||
| 642 | - Double zsh = 0.0; | ||
| 643 | - for (int j = 0; j < sumList.size(); j++) { | ||
| 644 | - jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 645 | - zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 646 | - zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 647 | - } | ||
| 648 | -// jzl = Arith.sub(jzl, zsh); | ||
| 649 | - // 保留两位小数 | ||
| 650 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 651 | - Double zyl = 0.0; | ||
| 652 | - Double nextJzyl = 0.0; | ||
| 653 | - // 保存已经计算过的车辆,相同车辆编号的车不在计算 | ||
| 654 | - newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm()); | ||
| 655 | 642 | ||
| 656 | - // 查询指定车辆,设置进、存、耗油量 | ||
| 657 | - map.remove("nbbm_eq"); | ||
| 658 | - map.put("nbbm_eq", ylb.getNbbm()); | ||
| 659 | - map.put("xlbm_like", ylb.getXlbm()); | ||
| 660 | -// Iterator<Ylb> iterator2 = repository | ||
| 661 | -// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 662 | - double czyl=0.0; | ||
| 663 | - for (int j = 0; j < iterator2.size(); j++) { | ||
| 664 | - Ylb t = iterator2.get(j); | ||
| 665 | - if(t.getNbbm().equals(ylb.getNbbm())){ | ||
| 666 | - if (t.getJcsx() == 1) { | ||
| 667 | - // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 668 | -// Double yl = t.getCzyl(); | ||
| 669 | -// Double jcyl = t.getCzyl(); | ||
| 670 | - czyl = t.getCzyl(); | ||
| 671 | - zyl =jzl; | ||
| 672 | - Double yh=0.0; | ||
| 673 | - if(zlc>0 ){ | ||
| 674 | - yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 643 | + List<Ylb> addList = new ArrayList<Ylb>(); |
| 644 | + List<Ylb> updateList = new ArrayList<Ylb>(); | ||
| 645 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 646 | + | ||
| 647 | + Map<String, Object> cMap=new HashMap<String, Object>(); | ||
| 648 | + for (int x = 0; x < listpb.size(); x++) { | ||
| 649 | + String type = "add"; | ||
| 650 | + boolean sfdc = true; | ||
| 651 | + Map<String, Object> map = listpb.get(x); | ||
| 652 | + if (carsMap.get(map.get("clZbh").toString()) != null) { | ||
| 653 | + sfdc = carsMap.get(map.get("clZbh").toString()); | ||
| 654 | + } else { | ||
| 655 | + sfdc = true; | ||
| 656 | + } | ||
| 657 | + if (!sfdc) { | ||
| 658 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 659 | + Ylb t = new Ylb(); | ||
| 660 | + for (int k = 0; k < ylList.size(); k++) { | ||
| 661 | + Ylb t1 = ylList.get(k); | ||
| 662 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 663 | + && t1.getJsy().equals(map.get("jGh").toString()) | ||
| 664 | + && t1.getXlbm().equals(map.get("xlBm").toString() | ||
| 665 | + )) { | ||
| 666 | + if(t1.getLp()==null){ | ||
| 667 | + //同人同车同线路不同路牌的过滤 (考虑到历史数据) | ||
| 668 | + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | ||
| 669 | + t = t1; | ||
| 670 | + type = "update"; | ||
| 671 | + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | ||
| 672 | + map.get("clZbh").toString()); | ||
| 675 | } | 673 | } |
| 676 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 677 | -// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); | ||
| 678 | - //把进场油量的小数和整数分别取出 | ||
| 679 | -// int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | ||
| 680 | - if(zlc>0 && t.getZlc()>0){ | ||
| 681 | - long l=Math.round(nextJzyl); | ||
| 682 | - double ylxs=l*100/100; | ||
| 683 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 684 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 685 | - t.setYh(yh); | ||
| 686 | - t.setJzyl(ylxs); | ||
| 687 | - nextJzyl=ylxs; | ||
| 688 | - }else{ | ||
| 689 | - t.setYh(yh); | ||
| 690 | - t.setJzyl(nextJzyl); | 674 | + }else{ |
| 675 | + if(t1.getLp().equals(map.get("lpName").toString())){ | ||
| 676 | + t = t1; | ||
| 677 | + type = "update"; | ||
| 691 | } | 678 | } |
| 692 | - } else { | ||
| 693 | - t.setCzyl(nextJzyl); | ||
| 694 | - Double yh=0.0; | ||
| 695 | - if(zlc>0){ | ||
| 696 | - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 679 | + |
| 680 | + } | ||
| 681 | + } | ||
| 682 | + } | ||
| 683 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 684 | + if (map.get("seqNumber").toString().equals("1")) { | ||
| 685 | + boolean fage = true; | ||
| 686 | + if(line.equals("")){ | ||
| 687 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 688 | + Ylb ylb = ylListBe.get(i); | ||
| 689 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 690 | + if(ylb.getJzyl()>0){ | ||
| 691 | + t.setCzyl(ylb.getJzyl()); | ||
| 692 | + fage = false; | ||
| 693 | + break; | ||
| 694 | + } | ||
| 695 | + | ||
| 697 | } | 696 | } |
| 698 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 699 | -// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); | ||
| 700 | - if(zlc>0 && t.getZlc()>0){ | ||
| 701 | - long l=0l; | ||
| 702 | - double ylxs=0.0; | ||
| 703 | - if(j==iterator2.size()-1){ | ||
| 704 | - ylxs=czyl; | ||
| 705 | - }else{ | ||
| 706 | - if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 707 | - l=Math.round(nextJzyl); | ||
| 708 | - ylxs=l*100/100; | ||
| 709 | - }else{ | ||
| 710 | - ylxs=czyl; | 697 | + } |
| 698 | + if (fage) { | ||
| 699 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 700 | + Cyl cyl = clyList.get(y); | ||
| 701 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 702 | + if(cyl!=null){ | ||
| 703 | + if(cyl.getCyl()>=0){ | ||
| 704 | + t.setCzyl(cyl.getCyl()); | ||
| 705 | + fage = false; | ||
| 706 | + break; | ||
| 707 | + }else { | ||
| 708 | + if(cyl.getCxrl()!=null){ | ||
| 709 | + if(cyl.getCxrl()>0){ | ||
| 710 | + t.setCzyl(cyl.getCxrl()); | ||
| 711 | + fage = false; | ||
| 712 | + break; | ||
| 713 | + } | ||
| 714 | + } | ||
| 715 | + } | ||
| 711 | } | 716 | } |
| 712 | - | ||
| 713 | } | 717 | } |
| 714 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 715 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 716 | - | ||
| 717 | - t.setYh(yh); | ||
| 718 | - t.setJzyl(ylxs); | ||
| 719 | - nextJzyl=ylxs; | ||
| 720 | - }else{ | ||
| 721 | - t.setYh(yh); | ||
| 722 | - t.setJzyl(nextJzyl); | ||
| 723 | } | 718 | } |
| 724 | } | 719 | } |
| 725 | - if(t.getJzyl()<0){ | ||
| 726 | - t.setJzyl(0.0); | ||
| 727 | - } | ||
| 728 | - if(t.getCzyl()<0){ | 720 | + if (fage) { |
| 729 | t.setCzyl(0.0); | 721 | t.setCzyl(0.0); |
| 730 | } | 722 | } |
| 731 | - if(t.getYh()<0){ | ||
| 732 | - t.setYh(0.0); | 723 | + }else{ |
| 724 | + if (line.equals(map.get("xlBm").toString())) { | ||
| 725 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 726 | + Ylb ylb = ylListBe.get(i); | ||
| 727 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 728 | + if(ylb.getJzyl()>0){ | ||
| 729 | + t.setCzyl(ylb.getJzyl()); | ||
| 730 | + fage = false; | ||
| 731 | + break; | ||
| 732 | + } | ||
| 733 | + | ||
| 734 | + } | ||
| 735 | + } | ||
| 736 | + if (fage) { | ||
| 737 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 738 | + Cyl cyl = clyList.get(y); | ||
| 739 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 740 | + if(cyl!=null){ | ||
| 741 | + if(cyl.getCyl()>=0){ | ||
| 742 | + t.setCzyl(cyl.getCyl()); | ||
| 743 | + fage = false; | ||
| 744 | + break; | ||
| 745 | + }else { | ||
| 746 | + if(cyl.getCxrl()!=null){ | ||
| 747 | + if(cyl.getCxrl()>0){ | ||
| 748 | + t.setCzyl(cyl.getCxrl()); | ||
| 749 | + fage = false; | ||
| 750 | + break; | ||
| 751 | + } | ||
| 752 | + } | ||
| 753 | + } | ||
| 754 | + } | ||
| 755 | + } | ||
| 756 | + } | ||
| 757 | + } | ||
| 758 | + if (fage) { | ||
| 759 | + t.setCzyl(0.0); | ||
| 760 | + } | ||
| 733 | } | 761 | } |
| 734 | - if(t.getSh()<0){ | ||
| 735 | - t.setSh(0.0); | 762 | + } |
| 763 | + | ||
| 764 | + } | ||
| 765 | + | ||
| 766 | + Double jzl = 0.0; | ||
| 767 | + //一人一车加注量只匹配一次 | ||
| 768 | + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())==null){ | ||
| 769 | + | ||
| 770 | + boolean fage2=false; | ||
| 771 | + for (int i = 0; i < ylxxList.size(); i++) { | ||
| 772 | + Ylxxb ylxxb = ylxxList.get(i); | ||
| 773 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 774 | + && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 775 | + && ylxxb.getJylx()==1) { | ||
| 776 | + if(ylxxb.getJzl()>0){ | ||
| 777 | + fage2=true; | ||
| 778 | + } | ||
| 779 | + | ||
| 736 | } | 780 | } |
| 737 | - repository.save(t); | ||
| 738 | } | 781 | } |
| 739 | - map2.put("status", ResponseCode.SUCCESS); | 782 | + //车辆的加注量如果有任工干预,略接口过来 数据 |
| 783 | + if(fage2){ | ||
| 784 | + // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 785 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 786 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 787 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 788 | + && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 789 | + && ylxxb.getJylx()==1) { | ||
| 790 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 791 | + } | ||
| 792 | + } | ||
| 793 | + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 794 | + }else{ | ||
| 795 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 796 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 797 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 798 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 799 | + && map.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 800 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 801 | + } | ||
| 802 | + } | ||
| 803 | + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + } | ||
| 807 | + t.setJzl(jzl); | ||
| 808 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 809 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | ||
| 810 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | ||
| 811 | + : Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 812 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 813 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 814 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | ||
| 815 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | ||
| 816 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 817 | + t.setRq(sdf.parse(rq)); | ||
| 818 | + t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | ||
| 819 | + t.setJname(map.get("jName").toString()); | ||
| 820 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 821 | + if(type.equals("add")){ | ||
| 822 | + t.setCreatetime(date); | ||
| 823 | + addList.add(t); | ||
| 824 | + }else{ | ||
| 825 | + t.setUpdatetime(date); | ||
| 826 | + updateList.add(t); | ||
| 827 | + } | ||
| 828 | + } | ||
| 829 | +// repository.save(t); | ||
| 830 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 831 | + | ||
| 832 | + } | ||
| 833 | + } | ||
| 834 | + if(addList.size()>0){ | ||
| 835 | + try { | ||
| 836 | + new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class); | ||
| 837 | + } catch (Exception e) { | ||
| 838 | + // TODO: handle exception | ||
| 839 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 840 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 841 | + logger.info("获取:存在相同数据,数据已经过滤"); | ||
| 740 | } | 842 | } |
| 741 | } | 843 | } |
| 844 | + | ||
| 845 | + } | ||
| 846 | + if(updateList.size()>0){ | ||
| 847 | + for (int i = 0; i < updateList.size(); i++) { | ||
| 848 | + repository.save(updateList.get(i)); | ||
| 849 | + } | ||
| 742 | } | 850 | } |
| 743 | - | ||
| 744 | SysUser user = SecurityUtils.getCurrentUser(); | 851 | SysUser user = SecurityUtils.getCurrentUser(); |
| 745 | Nylog nylog=new Nylog(); | 852 | Nylog nylog=new Nylog(); |
| 746 | nylog.setCreatedate(new Date()); | 853 | nylog.setCreatedate(new Date()); |
| 747 | - nylog.setCzmc("进场等于出场"); | 854 | + nylog.setCzmc("获取加存油"); |
| 748 | nylog.setNylx("油"); | 855 | nylog.setNylx("油"); |
| 749 | nylog.setUserid(user.getUserName()); | 856 | nylog.setUserid(user.getUserName()); |
| 750 | nylog.setUsername(user.getName()); | 857 | nylog.setUsername(user.getName()); |
| 751 | - nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"+sxtj); | ||
| 752 | - | 858 | + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+line+"-"+nbbm+"-"+sxtj); |
| 753 | nylogRepository.save(nylog); | 859 | nylogRepository.save(nylog); |
| 860 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 754 | } catch (Exception e) { | 861 | } catch (Exception e) { |
| 755 | - map2.put("status", ResponseCode.ERROR); | ||
| 756 | - logger.error("save erro.", e); | ||
| 757 | - throw e; | 862 | + // TODO Auto-generated catch block |
| 863 | + newMap.put("status", ResponseCode.ERROR); | ||
| 864 | + throw e; | ||
| 758 | } | 865 | } |
| 759 | - return map2; | 866 | + |
| 867 | + return newMap; | ||
| 760 | } | 868 | } |
| 761 | 869 | ||
| 762 | - | 870 | + |
| 763 | /** | 871 | /** |
| 764 | - * 核对,有加注没里程 | ||
| 765 | - * @param map | ||
| 766 | - * @return | 872 | + * 进场等于出场 |
| 767 | */ | 873 | */ |
| 768 | - @Transactional | 874 | + @Transactional |
| 769 | @Override | 875 | @Override |
| 770 | - public Map<String, Object> checkYl(Map<String, Object> map) throws Exception{ | ||
| 771 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 772 | -// String xlbm=""; | ||
| 773 | -// if(map.get("xlbm_like")!=null){ | ||
| 774 | -// xlbm=map.get("xlbm_like").toString(); | ||
| 775 | -// } | 876 | + public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{ |
| 776 | // TODO Auto-generated method stub | 877 | // TODO Auto-generated method stub |
| 777 | - | ||
| 778 | - List<Cars> carsList = carsRepository.findCars(); | ||
| 779 | - Map<String, String> carsMap = new HashMap<String, String>(); | ||
| 780 | - for (int i = 0; i < carsList.size(); i++) { | ||
| 781 | - Cars c = carsList.get(i); | ||
| 782 | - carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | 878 | + String xlbm=""; |
| 879 | + if(map.get("xlbm_like")!=null){ | ||
| 880 | + xlbm= map.get("xlbm_like").toString().trim(); | ||
| 881 | + } | ||
| 882 | + String gsbm=""; | ||
| 883 | + if(map.get("ssgsdm_like")!=null){ | ||
| 884 | + gsbm=map.get("ssgsdm_like").toString(); | ||
| 885 | + } | ||
| 886 | + String fgsbm=""; | ||
| 887 | + if(map.get("fgsdm_like")!=null){ | ||
| 888 | + fgsbm=map.get("fgsdm_like").toString(); | ||
| 889 | + } | ||
| 890 | + String rq = map.get("rq").toString(); | ||
| 891 | + String nbbm=""; | ||
| 892 | + if(map.get("nbbm_eq")!=null){ | ||
| 893 | + nbbm=map.get("nbbm_eq").toString(); | ||
| 783 | } | 894 | } |
| 784 | 895 | ||
| 785 | - try{ | ||
| 786 | - //获取车辆存油信息 | ||
| 787 | - | ||
| 788 | - String rq=map.get("rq").toString(); | ||
| 789 | - String xlbm=""; | ||
| 790 | - if(map.get("xlbm_like")!=null){ | ||
| 791 | - xlbm= map.get("xlbm_like").toString().trim(); | ||
| 792 | - } | ||
| 793 | - String gsbm=""; | ||
| 794 | - if(map.get("ssgsdm_like")!=null){ | ||
| 795 | - gsbm=map.get("ssgsdm_like").toString(); | ||
| 796 | - } | ||
| 797 | - String fgsbm=""; | ||
| 798 | - if(map.get("fgsdm_like")!=null){ | ||
| 799 | - fgsbm=map.get("fgsdm_like").toString(); | ||
| 800 | - } | ||
| 801 | - String nbbm=""; | ||
| 802 | - if(map.get("nbbm_eq")!=null){ | ||
| 803 | - nbbm=map.get("nbbm_eq").toString(); | 896 | + Map<String, Object> newMap=new HashMap<String,Object>(); |
| 897 | + Map<String, Object> map2=new HashMap<String,Object>(); | ||
| 898 | + try { | ||
| 899 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 900 | + | ||
| 901 | + map.put("rq_eq", sdf.parse(rq)); | ||
| 902 | +// List<Cyl> clyList = cylRepository.obtainCyl(); | ||
| 903 | + // 获取车辆存油信息 | ||
| 904 | + List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 905 | + // 指定日期YLB信息 | ||
| 906 | + List<Ylb> ylbList =new ArrayList<Ylb>(); | ||
| 907 | + List<Ylb> ylbLists =new ArrayList<Ylb>(); | ||
| 908 | + List<Ylb> iterator2=new ArrayList<Ylb>(); | ||
| 909 | + ylbLists=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); | ||
| 910 | + iterator2=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); | ||
| 911 | + // 从排班表中计算出行驶的总里程 | ||
| 912 | + | ||
| 913 | + String sxtj=map.get("sxtj").toString(); | ||
| 914 | + if(sxtj.equals("0")){ | ||
| 915 | + ylbList=ylbLists; | ||
| 916 | + }else{ | ||
| 917 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 918 | + List<String> stringList=new ArrayList<String>(); | ||
| 919 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 920 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 921 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 922 | + //一车一单 | ||
| 923 | + if(sxtj.equals("1")){ | ||
| 924 | + if(cs==1){ | ||
| 925 | + stringList.add(clbm); | ||
| 926 | + } | ||
| 927 | + } | ||
| 928 | + //一车多单 | ||
| 929 | + if(sxtj.equals("2")){ | ||
| 930 | + if(cs>1){ | ||
| 931 | + stringList.add(clbm); | ||
| 932 | + } | ||
| 933 | + } | ||
| 934 | + } | ||
| 935 | + | ||
| 936 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 937 | + String strNbbm=stringList.get(i); | ||
| 938 | + for (int j = 0; j < ylbLists.size(); j++) { | ||
| 939 | + Ylb y = ylbLists.get(j); | ||
| 940 | + String mapNbbm=y.getNbbm(); | ||
| 941 | + if(strNbbm.equals(mapNbbm)){ | ||
| 942 | + ylbList.add(y); | ||
| 943 | + } | ||
| 944 | + } | ||
| 945 | + } | ||
| 804 | } | 946 | } |
| 805 | -// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | ||
| 806 | - List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | 947 | + |
| 948 | + for (int i=0;i<ylbList.size();i++) { | ||
| 949 | + Ylb ylb = ylbList.get(i); | ||
| 950 | + // 判断是否已经计算过 | ||
| 951 | + if (newMap.get("nbbm" + ylb.getNbbm()) == null) { | ||
| 952 | + String nbbm_eq = ylb.getNbbm(); | ||
| 953 | + Date rq_eq = ylb.getRq(); | ||
| 954 | + // 得到一天总的加油和里程(根据车,时间) | ||
| 955 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",gsbm,fgsbm); | ||
| 956 | + // 保存总的加油量 | ||
| 957 | + Double jzl = 0.0; | ||
| 958 | + // 保存总的里程 | ||
| 959 | + Double zlc = 0.0; | ||
| 960 | + //保存总的损耗 | ||
| 961 | + Double zsh = 0.0; | ||
| 962 | + for (int j = 0; j < sumList.size(); j++) { | ||
| 963 | + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 964 | + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 965 | + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 966 | + } | ||
| 967 | +// jzl = Arith.sub(jzl, zsh); | ||
| 968 | + // 保留两位小数 | ||
| 969 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 970 | + Double zyl = 0.0; | ||
| 971 | + Double nextJzyl = 0.0; | ||
| 972 | + // 保存已经计算过的车辆,相同车辆编号的车不在计算 | ||
| 973 | + newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm()); | ||
| 974 | + | ||
| 975 | + // 查询指定车辆,设置进、存、耗油量 | ||
| 976 | + map.remove("nbbm_eq"); | ||
| 977 | + map.put("nbbm_eq", ylb.getNbbm()); | ||
| 978 | + map.put("xlbm_like", ylb.getXlbm()); | ||
| 979 | +// Iterator<Ylb> iterator2 = repository | ||
| 980 | +// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 981 | + double czyl=0.0; | ||
| 982 | + for (int j = 0; j < iterator2.size(); j++) { | ||
| 983 | + Ylb t = iterator2.get(j); | ||
| 984 | + if(t.getNbbm().equals(ylb.getNbbm())){ | ||
| 985 | + if (t.getJcsx() == 1) { | ||
| 986 | + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 987 | +// Double yl = t.getCzyl(); | ||
| 988 | +// Double jcyl = t.getCzyl(); | ||
| 989 | + czyl = t.getCzyl(); | ||
| 990 | + zyl =jzl; | ||
| 991 | + Double yh=0.0; | ||
| 992 | + if(zlc>0 ){ | ||
| 993 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 994 | + } | ||
| 995 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 996 | +// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); | ||
| 997 | + //把进场油量的小数和整数分别取出 | ||
| 998 | +// int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | ||
| 999 | + if(zlc>0 && t.getZlc()>0){ | ||
| 1000 | + long l=Math.round(nextJzyl); | ||
| 1001 | + double ylxs=l*100/100; | ||
| 1002 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1003 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1004 | + t.setYh(yh); | ||
| 1005 | + t.setJzyl(ylxs); | ||
| 1006 | + nextJzyl=ylxs; | ||
| 1007 | + }else{ | ||
| 1008 | + t.setYh(yh); | ||
| 1009 | + t.setJzyl(nextJzyl); | ||
| 1010 | + } | ||
| 1011 | + } else { | ||
| 1012 | + t.setCzyl(nextJzyl); | ||
| 1013 | + Double yh=0.0; | ||
| 1014 | + if(zlc>0){ | ||
| 1015 | + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 1016 | + } | ||
| 1017 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 1018 | +// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); | ||
| 1019 | + if(zlc>0 && t.getZlc()>0){ | ||
| 1020 | + long l=0l; | ||
| 1021 | + double ylxs=0.0; | ||
| 1022 | + if(j==iterator2.size()-1){ | ||
| 1023 | + ylxs=czyl; | ||
| 1024 | + }else{ | ||
| 1025 | + if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 1026 | + l=Math.round(nextJzyl); | ||
| 1027 | + ylxs=l*100/100; | ||
| 1028 | + }else{ | ||
| 1029 | + ylxs=czyl; | ||
| 1030 | + } | ||
| 1031 | + | ||
| 1032 | + } | ||
| 1033 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1034 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1035 | + | ||
| 1036 | + t.setYh(yh); | ||
| 1037 | + t.setJzyl(ylxs); | ||
| 1038 | + nextJzyl=ylxs; | ||
| 1039 | + }else{ | ||
| 1040 | + t.setYh(yh); | ||
| 1041 | + t.setJzyl(nextJzyl); | ||
| 1042 | + } | ||
| 1043 | + } | ||
| 1044 | + if(t.getJzyl()<0){ | ||
| 1045 | + t.setJzyl(0.0); | ||
| 1046 | + } | ||
| 1047 | + if(t.getCzyl()<0){ | ||
| 1048 | + t.setCzyl(0.0); | ||
| 1049 | + } | ||
| 1050 | + if(t.getYh()<0){ | ||
| 1051 | + t.setYh(0.0); | ||
| 1052 | + } | ||
| 1053 | + if(t.getSh()<0){ | ||
| 1054 | + t.setSh(0.0); | ||
| 1055 | + } | ||
| 1056 | + repository.save(t); | ||
| 1057 | + } | ||
| 1058 | + map2.put("status", ResponseCode.SUCCESS); | ||
| 1059 | + } | ||
| 1060 | + } | ||
| 1061 | + } | ||
| 1062 | + | ||
| 1063 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1064 | + Nylog nylog=new Nylog(); | ||
| 1065 | + nylog.setCreatedate(new Date()); | ||
| 1066 | + nylog.setCzmc("进场等于出场"); | ||
| 1067 | + nylog.setNylx("油"); | ||
| 1068 | + nylog.setUserid(user.getUserName()); | ||
| 1069 | + nylog.setUsername(user.getName()); | ||
| 1070 | + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"+sxtj); | ||
| 1071 | + | ||
| 1072 | + nylogRepository.save(nylog); | ||
| 1073 | + } catch (Exception e) { | ||
| 1074 | + map2.put("status", ResponseCode.ERROR); | ||
| 1075 | + logger.error("save erro.", e); | ||
| 1076 | + throw e; | ||
| 1077 | + } | ||
| 1078 | + return map2; | ||
| 1079 | + } | ||
| 1080 | + | ||
| 1081 | + | ||
| 1082 | + /** | ||
| 1083 | + * 核对,有加注没里程 | ||
| 1084 | + * @param map | ||
| 1085 | + * @return | ||
| 1086 | + */ | ||
| 1087 | + @Transactional | ||
| 1088 | + @Override | ||
| 1089 | + public Map<String, Object> checkYl(Map<String, Object> map) throws Exception{ | ||
| 1090 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 1091 | +// String xlbm=""; | ||
| 1092 | +// if(map.get("xlbm_like")!=null){ | ||
| 1093 | +// xlbm=map.get("xlbm_like").toString(); | ||
| 1094 | +// } | ||
| 1095 | + // TODO Auto-generated method stub | ||
| 1096 | + | ||
| 1097 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 1098 | + Map<String, String> carsMap = new HashMap<String, String>(); | ||
| 1099 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 1100 | + Cars c = carsList.get(i); | ||
| 1101 | + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | ||
| 1102 | + } | ||
| 1103 | + | ||
| 1104 | + try{ | ||
| 1105 | + //获取车辆存油信息 | ||
| 1106 | + | ||
| 1107 | + String rq=map.get("rq").toString(); | ||
| 1108 | + String xlbm=""; | ||
| 1109 | + if(map.get("xlbm_like")!=null){ | ||
| 1110 | + xlbm= map.get("xlbm_like").toString().trim(); | ||
| 1111 | + } | ||
| 1112 | + String gsbm=""; | ||
| 1113 | + if(map.get("ssgsdm_like")!=null){ | ||
| 1114 | + gsbm=map.get("ssgsdm_like").toString(); | ||
| 1115 | + } | ||
| 1116 | + String fgsbm=""; | ||
| 1117 | + if(map.get("fgsdm_like")!=null){ | ||
| 1118 | + fgsbm=map.get("fgsdm_like").toString(); | ||
| 1119 | + } | ||
| 1120 | + String nbbm=""; | ||
| 1121 | + if(map.get("nbbm_eq")!=null){ | ||
| 1122 | + nbbm=map.get("nbbm_eq").toString(); | ||
| 1123 | + } | ||
| 1124 | +// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | ||
| 1125 | + List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 807 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 1126 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 808 | // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | 1127 | // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 809 | // List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | 1128 | // List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); |
| @@ -1656,6 +1975,373 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1656,6 +1975,373 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1656 | return lists; | 1975 | return lists; |
| 1657 | } | 1976 | } |
| 1658 | 1977 | ||
| 1978 | + | ||
| 1979 | + @Override | ||
| 1980 | + public Map<String, Object> updateHistoryJd(Map<String, Object> map) throws Exception { | ||
| 1981 | + // TODO Auto-generated method stub | ||
| 1982 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 1983 | + | ||
| 1984 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 1985 | + Map<String, Object> carsMap = new HashMap<String, Object>(); | ||
| 1986 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 1987 | + Cars c = carsList.get(i); | ||
| 1988 | + carsMap.put(c.getInsideCode(), c.getNyType()); | ||
| 1989 | + } | ||
| 1990 | + try{ | ||
| 1991 | + String date = map.get("date").toString(); | ||
| 1992 | + String line = map.get("line").toString(); | ||
| 1993 | + List<Line> listLine=lineRepository.findLineByCode(line); | ||
| 1994 | + String gsdm =""; | ||
| 1995 | + String fgsdm =""; | ||
| 1996 | + if(listLine.size()>0){ | ||
| 1997 | + Line l=listLine.get(0); | ||
| 1998 | + gsdm=l.getCompany(); | ||
| 1999 | + fgsdm=l.getBrancheCompany(); | ||
| 2000 | + } | ||
| 2001 | + | ||
| 2002 | + String nbbmstr=""; | ||
| 2003 | + List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 | ||
| 2004 | + List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 | ||
| 2005 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", date,gsdm, fgsdm, "", ""); | ||
| 2006 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 2007 | + if(listpb.get(i).get("xlBm").toString().equals(line)){ | ||
| 2008 | + nbbmstr +=listpb.get(i).get("clZbh").toString(); | ||
| 2009 | + } | ||
| 2010 | + } | ||
| 2011 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 2012 | + String sfdc="3"; | ||
| 2013 | + Map<String, Object> m = listpb.get(i); | ||
| 2014 | + if (carsMap.get(m.get("clZbh").toString()) != null) { | ||
| 2015 | + sfdc =m.get("clZbh").toString(); | ||
| 2016 | + } | ||
| 2017 | + if(nbbmstr.indexOf(m.get("clZbh").toString())>-1){ | ||
| 2018 | + if(!sfdc.equals("3")){ | ||
| 2019 | + if(sfdc.equals("0")){ | ||
| 2020 | + listpbYc.add(m); | ||
| 2021 | + }else if(sfdc.equals("1")){ | ||
| 2022 | + listpbDc.add(m); | ||
| 2023 | + }else{ | ||
| 2024 | + listpbDc.add(m); | ||
| 2025 | + listpbYc.add(m); | ||
| 2026 | + } | ||
| 2027 | + } | ||
| 2028 | + } | ||
| 2029 | + } | ||
| 2030 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 2031 | + //初始存油量 | ||
| 2032 | + List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); | ||
| 2033 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | ||
| 2034 | + //重新统计油车数据开始 | ||
| 2035 | + List<Ylb> ylListBe =repository.listByRqJcsx(date, gsdm, fgsdm, "", ""); | ||
| 2036 | + List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | ||
| 2037 | + List<Ylb> ylbList_upd=new ArrayList<Ylb>(); | ||
| 2038 | + List<Ylb> ylbList_del=new ArrayList<Ylb>(); | ||
| 2039 | + | ||
| 2040 | + for (int j = 0; j < ylbList.size(); j++) { | ||
| 2041 | + Ylb t=ylbList.get(j); | ||
| 2042 | + boolean fage=true; | ||
| 2043 | + if(t.getLp().isEmpty()){ | ||
| 2044 | + fage=false; | ||
| 2045 | + }else{ | ||
| 2046 | + for (int i = 0; i < listpbYc.size(); i++) { | ||
| 2047 | + Map<String, Object> m = listpbYc.get(i); | ||
| 2048 | + if(t.getNbbm().equals(m.get("clZbh").toString()) | ||
| 2049 | + &&t.getJsy().equals(m.get("jGh").toString()) | ||
| 2050 | + &&t.getXlbm().equals(m.get("xlBm").toString()) | ||
| 2051 | + &&t.getLp().equals(m.get("lpName").toString())){ | ||
| 2052 | + //该条记录不用删除 | ||
| 2053 | + fage =false; | ||
| 2054 | + ylbList_upd.add(t); | ||
| 2055 | + } | ||
| 2056 | + } | ||
| 2057 | + } | ||
| 2058 | + if(fage){ | ||
| 2059 | + if(t.getXlbm().equals(line)){ | ||
| 2060 | + ylbList_del.add(t); | ||
| 2061 | + } | ||
| 2062 | + } | ||
| 2063 | + | ||
| 2064 | + } | ||
| 2065 | + String nbbmStr=""; | ||
| 2066 | + List<Ylb> list=new ArrayList<Ylb>(); | ||
| 2067 | + /* | ||
| 2068 | + * 第一步 修改车辆里程 和加注量 | ||
| 2069 | + */ | ||
| 2070 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 2071 | + for (int x = 0; x < listpbYc.size(); x++) { | ||
| 2072 | + String type = "add"; | ||
| 2073 | + Map<String, Object> maps = listpbYc.get(x); | ||
| 2074 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 2075 | + Ylb t = new Ylb(); | ||
| 2076 | + for (int k = 0; k < ylbList_upd.size(); k++) { | ||
| 2077 | + Ylb t1 = ylbList_upd.get(k); | ||
| 2078 | + if (t1.getNbbm().equals(maps.get("clZbh").toString()) | ||
| 2079 | + && t1.getJsy().equals(maps.get("jGh").toString()) | ||
| 2080 | + && t1.getXlbm().equals(maps.get("xlBm").toString()) | ||
| 2081 | + && t1.getLp().equals(maps.get("lpName").toString())) { | ||
| 2082 | + t = t1; | ||
| 2083 | + type = "update"; | ||
| 2084 | + } | ||
| 2085 | + } | ||
| 2086 | + if(type.equals("add")){ | ||
| 2087 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 2088 | + if (maps.get("seqNumber").toString().equals("1")) { | ||
| 2089 | + boolean fage = true; | ||
| 2090 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 2091 | + Ylb ylb = ylListBe.get(i); | ||
| 2092 | + if (maps.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 2093 | + if(ylb.getJzyl()>0){ | ||
| 2094 | + t.setCzyl(ylb.getJzyl()); | ||
| 2095 | + fage = false; | ||
| 2096 | + break; | ||
| 2097 | + } | ||
| 2098 | + } | ||
| 2099 | + } | ||
| 2100 | + if (fage) { | ||
| 2101 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 2102 | + Cyl cyl = clyList.get(y); | ||
| 2103 | + if (maps.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 2104 | + if(cyl!=null){ | ||
| 2105 | + if(cyl.getCyl()>=0){ | ||
| 2106 | + t.setCzyl(cyl.getCyl()); | ||
| 2107 | + fage = false; | ||
| 2108 | + break; | ||
| 2109 | + }else { | ||
| 2110 | + if(cyl.getCxrl()!=null){ | ||
| 2111 | + if(cyl.getCxrl()>0){ | ||
| 2112 | + t.setCzyl(cyl.getCxrl()); | ||
| 2113 | + fage = false; | ||
| 2114 | + break; | ||
| 2115 | + } | ||
| 2116 | + } | ||
| 2117 | + } | ||
| 2118 | + } | ||
| 2119 | + } | ||
| 2120 | + } | ||
| 2121 | + } | ||
| 2122 | + if (fage) { | ||
| 2123 | + t.setCzyl(0.0); | ||
| 2124 | + } | ||
| 2125 | + } | ||
| 2126 | + } | ||
| 2127 | + | ||
| 2128 | + Double jzl = 0.0; | ||
| 2129 | + //一人一车加注量只匹配一次 | ||
| 2130 | + if(ylMap.get(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString())!=null){ | ||
| 2131 | + }else{ | ||
| 2132 | + boolean fage2=false; | ||
| 2133 | + for (int i = 0; i < ylxxList.size(); i++) { | ||
| 2134 | + Ylxxb ylxxb = ylxxList.get(i); | ||
| 2135 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 2136 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 2137 | + && ylxxb.getJylx()==1) { | ||
| 2138 | + if(ylxxb.getJzl()>0){ | ||
| 2139 | + fage2=true; | ||
| 2140 | + } | ||
| 2141 | + } | ||
| 2142 | + } | ||
| 2143 | + //车辆的加注量如果有任工干预,略接口过来 数据 | ||
| 2144 | + if(fage2){ | ||
| 2145 | + // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 2146 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 2147 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 2148 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 2149 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 2150 | + && ylxxb.getJylx()==1) { | ||
| 2151 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 2152 | + } | ||
| 2153 | + } | ||
| 2154 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 2155 | + }else{ | ||
| 2156 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 2157 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 2158 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 2159 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 2160 | + && maps.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 2161 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 2162 | + } | ||
| 2163 | + } | ||
| 2164 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 2165 | + } | ||
| 2166 | + } | ||
| 2167 | + t.setJzl(jzl); | ||
| 2168 | + t.setNbbm(maps.get("clZbh").toString()); | ||
| 2169 | + t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); | ||
| 2170 | + t.setJname(maps.get("jName").toString()); | ||
| 2171 | + t.setZlc(maps.get("totalKilometers") == null ? 0.0 | ||
| 2172 | + : Double.parseDouble(maps.get("totalKilometers").toString())); | ||
| 2173 | + t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 2174 | + t.setJcsx(Integer.parseInt(maps.get("seqNumber").toString())); | ||
| 2175 | + t.setSsgsdm(maps.get("company") == null ? "" : maps.get("company").toString()); | ||
| 2176 | + t.setFgsdm(maps.get("bCompany") == null ? "" : maps.get("bCompany").toString()); | ||
| 2177 | + t.setJhsj(maps.get("fcsj")==null?"":maps.get("fcsj").toString()); | ||
| 2178 | + t.setRq(sdf.parse(date)); | ||
| 2179 | + t.setLp(maps.get("lpName")==null?"":maps.get("lpName").toString()); | ||
| 2180 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 2181 | + if(type.equals("add")){ | ||
| 2182 | + if(nbbmStr.indexOf(t.getNbbm())<0){ | ||
| 2183 | + nbbmStr +=t.getNbbm()+","; | ||
| 2184 | + } | ||
| 2185 | + t.setCreatetime(new Date()); | ||
| 2186 | + }else{ | ||
| 2187 | + t.setUpdatetime(new Date()); | ||
| 2188 | + } | ||
| 2189 | + } | ||
| 2190 | + try { | ||
| 2191 | + repository.save(t); | ||
| 2192 | + } catch (Exception e) { | ||
| 2193 | + // TODO: handle exception | ||
| 2194 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 2195 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 2196 | + logger.info("油量存在相同数据,数据已经过滤"); | ||
| 2197 | + } | ||
| 2198 | + } | ||
| 2199 | + | ||
| 2200 | + } | ||
| 2201 | + for (int i = 0; i < ylbList_del.size(); i++) { | ||
| 2202 | + Ylb y=ylbList_del.get(i); | ||
| 2203 | + if(nbbmStr.indexOf(y.getNbbm())<0){ | ||
| 2204 | + nbbmStr +=y.getNbbm()+","; | ||
| 2205 | + } | ||
| 2206 | + repository.delete(y.getId()); | ||
| 2207 | + } | ||
| 2208 | + | ||
| 2209 | + //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算) | ||
| 2210 | + double czyl=0.0; | ||
| 2211 | + List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm,jcsx"); | ||
| 2212 | + String[] nbbms=nbbmStr.split(","); | ||
| 2213 | + for (int i = 0; i < nbbms.length; i++) { | ||
| 2214 | + String clzbm=nbbms[i]; | ||
| 2215 | + // 得到一天总的加油和里程(根据车,时间) | ||
| 2216 | + List<Object[]> sumList = repository.sumLcYl(clzbm, sdf.parse(date),"",gsdm,fgsdm); | ||
| 2217 | + // 保存总的加油量 | ||
| 2218 | + Double jzl = 0.0; | ||
| 2219 | + // 保存总的里程 | ||
| 2220 | + Double zlc = 0.0; | ||
| 2221 | + for (int j = 0; j < sumList.size(); j++) { | ||
| 2222 | + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 2223 | + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 2224 | + } | ||
| 2225 | + // 保留两位小数 | ||
| 2226 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 2227 | + Double zyl = 0.0; | ||
| 2228 | + Double nextJzyl = 0.0; | ||
| 2229 | + for (int j = 0; j < iterator2.size(); j++) { | ||
| 2230 | + Ylb t = iterator2.get(j); | ||
| 2231 | + if(t.getNbbm().equals(clzbm)){ | ||
| 2232 | + if (t.getJcsx() == 1) { | ||
| 2233 | + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 2234 | + czyl = t.getCzyl(); | ||
| 2235 | + zyl =jzl; | ||
| 2236 | + Double yh=0.0; | ||
| 2237 | + if(zlc>0 ){ | ||
| 2238 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2239 | + } | ||
| 2240 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 2241 | + //把进场油量的小数和整数分别取出 | ||
| 2242 | + if(zlc>0 && t.getZlc()>0){ | ||
| 2243 | + long l=Math.round(nextJzyl); | ||
| 2244 | + double ylxs=l*100/100; | ||
| 2245 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2246 | + t.setYh(yh); | ||
| 2247 | + t.setJzyl(ylxs); | ||
| 2248 | + nextJzyl=ylxs; | ||
| 2249 | + }else{ | ||
| 2250 | + t.setYh(yh); | ||
| 2251 | + t.setJzyl(nextJzyl); | ||
| 2252 | + } | ||
| 2253 | + } else { | ||
| 2254 | + t.setCzyl(nextJzyl); | ||
| 2255 | + Double yh=0.0; | ||
| 2256 | + if(zlc>0){ | ||
| 2257 | + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2258 | + } | ||
| 2259 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 2260 | + if(zlc>0 && t.getZlc()>0){ | ||
| 2261 | + long l=0l; | ||
| 2262 | + double ylxs=0.0; | ||
| 2263 | + if(j==iterator2.size()-1){ | ||
| 2264 | + ylxs=czyl; | ||
| 2265 | + }else{ | ||
| 2266 | + if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 2267 | + l=Math.round(nextJzyl); | ||
| 2268 | + ylxs=l*100/100; | ||
| 2269 | + }else{ | ||
| 2270 | + ylxs=czyl; | ||
| 2271 | + } | ||
| 2272 | + | ||
| 2273 | + } | ||
| 2274 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2275 | + t.setYh(yh); | ||
| 2276 | + t.setJzyl(ylxs); | ||
| 2277 | + nextJzyl=ylxs; | ||
| 2278 | + }else{ | ||
| 2279 | + t.setYh(yh); | ||
| 2280 | + t.setJzyl(nextJzyl); | ||
| 2281 | + } | ||
| 2282 | + } | ||
| 2283 | + if(t.getJzyl()<0){ | ||
| 2284 | + t.setJzyl(0.0); | ||
| 2285 | + } | ||
| 2286 | + if(t.getCzyl()<0){ | ||
| 2287 | + t.setCzyl(0.0); | ||
| 2288 | + } | ||
| 2289 | + if(t.getYh()<0){ | ||
| 2290 | + t.setYh(0.0); | ||
| 2291 | + } | ||
| 2292 | + if(t.getSh()<0){ | ||
| 2293 | + t.setSh(0.0); | ||
| 2294 | + } | ||
| 2295 | + repository.save(t); | ||
| 2296 | + } | ||
| 2297 | + } | ||
| 2298 | + } | ||
| 2299 | + | ||
| 2300 | + //重新统计油车数据结束 | ||
| 2301 | + | ||
| 2302 | + | ||
| 2303 | + //重新获取电耗数据开始 | ||
| 2304 | + Map<String, List<Dlb>> mapList=dlbService.updeteHistory(listpbDc, date, gsdm, fgsdm, line); | ||
| 2305 | + List<Dlb> delDlb=mapList.get("delList"); | ||
| 2306 | + for (int i = 0; i < delDlb.size(); i++) { | ||
| 2307 | + Dlb d=delDlb.get(i); | ||
| 2308 | + dlbRepository.delete(d.getId()); | ||
| 2309 | + } | ||
| 2310 | + List<Dlb> updDlb=mapList.get("updList"); | ||
| 2311 | + for (int i = 0; i < updDlb.size(); i++) { | ||
| 2312 | + Dlb d=updDlb.get(i); | ||
| 2313 | + try { | ||
| 2314 | + dlbRepository.save(d); | ||
| 2315 | + } catch (Exception e) { | ||
| 2316 | + // TODO: handle exception | ||
| 2317 | + if(e.getMessage().indexOf("PK_DLB_UK")>0){ | ||
| 2318 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 2319 | + logger.info("电量存在相同数据,数据已经过滤"); | ||
| 2320 | + } | ||
| 2321 | + } | ||
| 2322 | + } | ||
| 2323 | + //重新获取电耗数据结束 | ||
| 2324 | + | ||
| 2325 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 2326 | + Nylog nylog=new Nylog(); | ||
| 2327 | + nylog.setCreatedate(new Date()); | ||
| 2328 | + nylog.setCzmc("重新统计"); | ||
| 2329 | + nylog.setNylx("油"); | ||
| 2330 | + nylog.setUserid(user.getUserName()); | ||
| 2331 | + nylog.setUsername(user.getName()); | ||
| 2332 | + nylog.setCxtj(line+"-"+ date+"-"+gsdm+"-"+fgsdm); | ||
| 2333 | + nylogRepository.save(nylog); | ||
| 2334 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 2335 | + }catch(Exception e){ | ||
| 2336 | + // TODO Auto-generated catch block | ||
| 2337 | + newMap.put("status", ResponseCode.ERROR); | ||
| 2338 | + throw e; | ||
| 2339 | + } | ||
| 2340 | + | ||
| 2341 | + | ||
| 2342 | + return newMap; | ||
| 2343 | + } | ||
| 2344 | + | ||
| 1659 | @Override | 2345 | @Override |
| 1660 | public Map<String, Object> updateHistory(Map<String, Object> map) throws Exception { | 2346 | public Map<String, Object> updateHistory(Map<String, Object> map) throws Exception { |
| 1661 | // TODO Auto-generated method stub | 2347 | // TODO Auto-generated method stub |
src/main/resources/static/pages/electricity/list/list_jd.html
0 → 100644
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>进出场存电量</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 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> | ||
| 10 | + <li><span class="active">进出场存电量</span></li> | ||
| 11 | +</ul> | ||
| 12 | + | ||
| 13 | +<div class="row" id="dl_oil_list"> | ||
| 14 | + <div class="col-md-12"> | ||
| 15 | + <!-- Begin: life time stats --> | ||
| 16 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | ||
| 17 | + <div class="portlet-title"> | ||
| 18 | + <div class="caption"> | ||
| 19 | + <i class="fa fa-fire-extinguisher"></i> <span | ||
| 20 | + class="caption-subject font-dark sbold uppercase">进出场存电量表</span> | ||
| 21 | + </div> | ||
| 22 | + <div class="actions"> | ||
| 23 | + <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i> | ||
| 24 | + 保存 | ||
| 25 | + </button> | ||
| 26 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a> | ||
| 27 | + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> | ||
| 28 | + | ||
| 29 | + <button type="button" class="btn btn-circle blue" id="obtain"><i class="fa fa-hourglass-half"></i> | ||
| 30 | + 获取加/存电信息 | ||
| 31 | + </button> | ||
| 32 | + <button type="button" class="btn btn-circle blue" id="checkDl"><i class="fa fa-gg-circle"></i> | ||
| 33 | + 核对加注量(有加电无里程) | ||
| 34 | + </button> | ||
| 35 | + <button class="btn btn-circle blue" | ||
| 36 | + id="export"> <i class="fa fa-file-excel-o"></i> | ||
| 37 | + 导出Excel | ||
| 38 | + </button> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + <div class="portlet-body"> | ||
| 42 | + <div class="table-container" style="margin-top: 10px"> | ||
| 43 | + <table | ||
| 44 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 45 | + id="datatable_dlb"> | ||
| 46 | + <thead > | ||
| 47 | + <tr role="row" class="filter"> | ||
| 48 | + <td colspan="2"> | ||
| 49 | + <div style="float: right; " > 公司</div> | ||
| 50 | + </td> | ||
| 51 | + <td colspan="3"> | ||
| 52 | + <div style="float: left;width: 150px"> | ||
| 53 | + <select class="form-control" name="ssgsdm_like" | ||
| 54 | + id="ylbListGsdmId"></select> | ||
| 55 | + </div> | ||
| 56 | + </td> | ||
| 57 | + <td colspan="2"> | ||
| 58 | + <div style="float: right; " > 分公司</div> | ||
| 59 | + </td> | ||
| 60 | + <td colspan="3"> | ||
| 61 | + <div style="float: left;"> | ||
| 62 | + <select class="form-control" name="fgsdm_like" | ||
| 63 | + id="ylbListFgsdmId" style="width: 150px"></select> | ||
| 64 | + </div> | ||
| 65 | + </td> | ||
| 66 | + <td > | ||
| 67 | + <div style="float: right; ">日期</div> | ||
| 68 | + </td> | ||
| 69 | + <td colspan="2"> | ||
| 70 | + <div style="float: left;"> | ||
| 71 | + <input type="text" style="width: 120px" name="rq" id="rq" /> | ||
| 72 | + </div> | ||
| 73 | + </td> | ||
| 74 | + <td rowspan="2" colspan="2"> | ||
| 75 | + <div style="float: left;"> | ||
| 76 | + <button | ||
| 77 | + class="btn btn-sm green btn-outline filter-submit margin-bottom" | ||
| 78 | + style="margin-right: 0px"> | ||
| 79 | + <i class="fa fa-search"></i> 搜索 | ||
| 80 | + </button> <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> --> | ||
| 81 | + <!-- <i class="fa fa-times"></i> 重置 --> | ||
| 82 | + <!-- </button> --> | ||
| 83 | + | ||
| 84 | + </div> | ||
| 85 | + </td> | ||
| 86 | + </tr> | ||
| 87 | + <tr class="filter2"> | ||
| 88 | + <td colspan="2"> | ||
| 89 | + <div style="float: right; "> 线路</div> | ||
| 90 | + </td> | ||
| 91 | + <td colspan="3"> | ||
| 92 | + <div style="float: left;"> | ||
| 93 | + <select class="form-control" name="xlbm_like" id="xlbm" | ||
| 94 | + style="width: 150px;"></select> | ||
| 95 | + </div> | ||
| 96 | + </td> | ||
| 97 | + <td colspan="2"> | ||
| 98 | + <div style="float: right;"> 内部编码</div> | ||
| 99 | + </td> | ||
| 100 | + <td colspan="3"> | ||
| 101 | + <div style="float: left;"> | ||
| 102 | + <select class="form-control" name="nbbm_eq" id="nbbm" | ||
| 103 | + style="width: 120px;"></select> | ||
| 104 | + </div> | ||
| 105 | + <div style="float: left;"> | ||
| 106 | + <button class="btn btn-sm #000 btn-outline filter-cancel" | ||
| 107 | + style="margin-right: 0px"> | ||
| 108 | + <i class="fa fa-times"></i> | ||
| 109 | + </button> | ||
| 110 | + </div> | ||
| 111 | + </td> | ||
| 112 | + <td > | ||
| 113 | + <div style="float: right;"> | ||
| 114 | + 类型 | ||
| 115 | + </div> | ||
| 116 | + </td> | ||
| 117 | + <td colspan="2"> | ||
| 118 | + <div style="float: left;"> | ||
| 119 | + <select class="form-control" name="sxtj"> | ||
| 120 | + <option value="0">全部</option> | ||
| 121 | + <option value="1">一车一单</option> | ||
| 122 | + <option value="2">一车多单</option> | ||
| 123 | + <option value="3">有充电没里程</option> | ||
| 124 | + <option value="4">有里程没充电</option> | ||
| 125 | + </select> | ||
| 126 | + </div> | ||
| 127 | + | ||
| 128 | + </td> | ||
| 129 | + </tr> | ||
| 130 | + <tr> | ||
| 131 | + <td colspan="17"> | ||
| 132 | + <div style="float: left;"> | ||
| 133 | + 总计 | ||
| 134 | + | ||
| 135 | + 充电量: <label id="sumJzl"></label> | ||
| 136 | + | ||
| 137 | + 耗电量: <label id="sumYh"></label> | ||
| 138 | + | ||
| 139 | + 损耗电量: <label id="sumSh"></label> | ||
| 140 | + </div> | ||
| 141 | + </td> | ||
| 142 | + </tr> | ||
| 143 | + <tr role="row" class="heading"> | ||
| 144 | + <th width="2%">#</th> | ||
| 145 | + <th width="8%">日期</th> | ||
| 146 | + <th width="5%">公司</th> | ||
| 147 | + <th width="8%">线路</th> | ||
| 148 | + <th width="5%">自编号</th> | ||
| 149 | + <th width="6%">驾驶员</th> | ||
| 150 | + <th width="4%">充电量</th> | ||
| 151 | + <th width="6%">出场存电</th> | ||
| 152 | + <th width="6%">进场存电</th> | ||
| 153 | + <th width="5%">耗电</th> | ||
| 154 | + <th width="5%">耗损原因</th> | ||
| 155 | + <th width="4%">耗损电量</th> | ||
| 156 | + <th width="4%">当日总里程</th> | ||
| 157 | + <th width="4%">数据类型</th> | ||
| 158 | + <th width="4%">百公里电耗</th> | ||
| 159 | +<!-- <th width="5%">操作</th> --> | ||
| 160 | + </tr> | ||
| 161 | + </thead> | ||
| 162 | + <tbody></tbody> | ||
| 163 | + </table> | ||
| 164 | + <div style="text-align: right;"> | ||
| 165 | + <ul id="pagination" class="pagination"></ul> | ||
| 166 | + </div> | ||
| 167 | + </div> | ||
| 168 | + </div> | ||
| 169 | + </div> | ||
| 170 | + </div> | ||
| 171 | +</div> | ||
| 172 | + | ||
| 173 | +<script id="dlb_list_temp" type="text/html"> | ||
| 174 | + {{each list as obj i}} | ||
| 175 | + <tr> | ||
| 176 | + <td style="vertical-align: middle;"> | ||
| 177 | + <input type="checkbox" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> | ||
| 178 | + </td> | ||
| 179 | + <td> | ||
| 180 | + {{obj.rq}} | ||
| 181 | + </td> | ||
| 182 | + <td> | ||
| 183 | + {{obj.gsname}} | ||
| 184 | + </td> | ||
| 185 | + <td> | ||
| 186 | + {{obj.xlname}} | ||
| 187 | + </td> | ||
| 188 | + <td> | ||
| 189 | + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable> | ||
| 190 | + | ||
| 191 | + </td> | ||
| 192 | + <td> | ||
| 193 | + {{if obj.jsy=='' || obj.jsy==null }} | ||
| 194 | + <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input> | ||
| 195 | + <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button> | ||
| 196 | + {{else}} | ||
| 197 | + {{obj.jsy}}/{{obj.name}} | ||
| 198 | + {{/if}} | ||
| 199 | + </td> | ||
| 200 | + <td> | ||
| 201 | + | ||
| 202 | + <lable data-id="{{obj.id}}" class="in_carpark_cdl"> {{obj.cdl}}</lable> | ||
| 203 | + </td> | ||
| 204 | + <td> | ||
| 205 | + | ||
| 206 | + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_czcd" | ||
| 207 | + type="text" value=" {{obj.czcd}}" style=" width:40px;float:left" | ||
| 208 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 209 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | ||
| 210 | + <lable style="float:left">%<lable> | ||
| 211 | + </td> | ||
| 212 | + <td> | ||
| 213 | + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzcd" | ||
| 214 | + type="text" value=" {{obj.jzcd}}" style=" width:40px;float:left" | ||
| 215 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 216 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | ||
| 217 | + <lable style="float:left">%<lable> | ||
| 218 | + </td> | ||
| 219 | + <td> | ||
| 220 | +<input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_hd" readOnly="true" | ||
| 221 | + type="text" value=" {{obj.hd}}" style=" width:45px;float:left" | ||
| 222 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 223 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | ||
| 224 | + </td> | ||
| 225 | + <td> | ||
| 226 | + <select data-id="{{obj.id}}" class="in_carpark_shyy" style=" width:80px"> | ||
| 227 | + <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option> | ||
| 228 | + <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用电</option> | ||
| 229 | + <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用电</option> | ||
| 230 | + <option value='3' {{if obj.shyy==3}} selected = 'selected' {{/if}}>报废车用电</option> | ||
| 231 | + <option value='4' {{if obj.shyy==4}} selected = 'selected' {{/if}}>其它用电</option> | ||
| 232 | + <option value='5' {{if obj.shyy==5}} selected = 'selected' {{/if}}>人保部</option> | ||
| 233 | + <option value='6' {{if obj.shyy==6}} selected = 'selected' {{/if}}>车队</option> | ||
| 234 | + <option value='7' {{if obj.shyy==7}} selected = 'selected' {{/if}}>车间(高保)</option> | ||
| 235 | + <option value='8' {{if obj.shyy==8}} selected = 'selected' {{/if}}>车间(小修)</option> | ||
| 236 | + </select> | ||
| 237 | + </td> | ||
| 238 | + <td> | ||
| 239 | + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl" | ||
| 240 | + value={{obj.sh}} style=" width:40px" type="text" | ||
| 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('$#$','.')" /> | ||
| 243 | + | ||
| 244 | +</td> | ||
| 245 | + <td> | ||
| 246 | + {{obj.zlc}} | ||
| 247 | + </td> | ||
| 248 | + <td> | ||
| 249 | + <select data-id="{{obj.id}}" class="in_carpark_yhlx"> | ||
| 250 | + <option value='0' {{if obj.yhlx==0}} selected = 'selected' {{/if}}>手录</option> | ||
| 251 | + <option value='1' {{if obj.yhlx==1}} selected = 'selected' {{/if}}>拆分</option> | ||
| 252 | + </select> | ||
| 253 | + </td> | ||
| 254 | + <td> | ||
| 255 | + {{obj.bglyh}} | ||
| 256 | + </td> | ||
| 257 | + </tr> | ||
| 258 | + {{/each}} | ||
| 259 | + {{if list.length == 0}} | ||
| 260 | + <tr> | ||
| 261 | + <td colspan=15><h6 class="muted">没有找到相关数据</h6></td> | ||
| 262 | + </tr> | ||
| 263 | + {{/if}} | ||
| 264 | +</script> | ||
| 265 | + | ||
| 266 | +<script> | ||
| 267 | + $(function () { | ||
| 268 | + var fage=false; | ||
| 269 | + //var id = 15; | ||
| 270 | + //$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list') | ||
| 271 | + | ||
| 272 | + $("#checkDl").on('click', function () { | ||
| 273 | + if ($("#rq").val() != "") { | ||
| 274 | + var params=getParamsList(); | ||
| 275 | + $get('/ylb/checkDate',params,function(status){ | ||
| 276 | + if(status=='2'){ | ||
| 277 | + layer.msg('只能操作三天内数据.'); | ||
| 278 | + }else{ | ||
| 279 | + var i = layer.load(2); | ||
| 280 | + $get('/dlb/checkDl', params, function () { | ||
| 281 | + layer.close(i); | ||
| 282 | + jsDoQuery(params, true); | ||
| 283 | + }); | ||
| 284 | + } | ||
| 285 | + }) | ||
| 286 | + } else { | ||
| 287 | + layer.msg('请选择日期.'); | ||
| 288 | + } | ||
| 289 | + }) | ||
| 290 | + | ||
| 291 | + //进场等于出场 | ||
| 292 | + $("#outAndIn").on('click', function () { | ||
| 293 | + console.log("进场油量等于出场油量"); | ||
| 294 | + if ($("#rq").val() != "") { | ||
| 295 | + var params=getParamsList(); | ||
| 296 | + $get('/ylb/checkDate',params,function(status){ | ||
| 297 | + if(status=='2'){ | ||
| 298 | + layer.msg('只能操作三天内数据.'); | ||
| 299 | + }else{ | ||
| 300 | + var i = layer.load(2); | ||
| 301 | + $get('/ylb/outAndIn', params, function () { | ||
| 302 | + layer.close(i); | ||
| 303 | + jsDoQuery(params, true); | ||
| 304 | + }); | ||
| 305 | + } | ||
| 306 | + }) | ||
| 307 | + } else { | ||
| 308 | + layer.msg('请选择日期.'); | ||
| 309 | + } | ||
| 310 | + }); | ||
| 311 | + | ||
| 312 | + | ||
| 313 | + //保存 | ||
| 314 | + $("#saveButton").on('click',function(){ | ||
| 315 | + var params_=getParamsList(); | ||
| 316 | + $get('/ylb/checkDate',params_,function(status){ | ||
| 317 | + if(status=='2'){ | ||
| 318 | + layer.msg('只能操作三天内数据.'); | ||
| 319 | + }else{ | ||
| 320 | + var ylArray = []; | ||
| 321 | + $('input.icheck').each(function(){ | ||
| 322 | + var map = {}; | ||
| 323 | + var id=$(this).data('id'); | ||
| 324 | + var nbbm =$('.in_carpark_nbbm[data-id='+id+']', '#dl_oil_list').html(); | ||
| 325 | + var cdl =$('.in_carpark_cdl[data-id='+id+']', '#dl_oil_list').html(); | ||
| 326 | + if(cdl=="" || cdl ==null){ | ||
| 327 | + cdl=0; | ||
| 328 | + } | ||
| 329 | + var czcd=$('.in_carpark_czcd[data-id='+id+']', '#dl_oil_list').val(); | ||
| 330 | + if(czcd=="" || czcd==null){ | ||
| 331 | + czcd=0; | ||
| 332 | + } | ||
| 333 | + var jzcd=$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list').val(); | ||
| 334 | + if(jzcd=="" || jzcd==null){ | ||
| 335 | + jzcd=0; | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#dl_oil_list').val(); | ||
| 339 | + if(sh=="" || sh==null){ | ||
| 340 | + sh=0; | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#dl_oil_list').val(); | ||
| 344 | + var hd = $('.in_carpark_hd[data-id='+id+']', '#dl_oil_list').val(); | ||
| 345 | + if(hd=="" || hd==null){ | ||
| 346 | + hd=0; | ||
| 347 | + } | ||
| 348 | + var yhlx = $('.in_carpark_yhlx[data-id='+id+']', '#dl_oil_list').val(); | ||
| 349 | + | ||
| 350 | + map['id']=id; | ||
| 351 | + map['cdl']=cdl; | ||
| 352 | + map['czcd']=czcd; | ||
| 353 | + map['jzcd']=jzcd; | ||
| 354 | + map['sh']=sh; | ||
| 355 | + map['shyy']=shyy; | ||
| 356 | + map['yhlx']=yhlx; | ||
| 357 | + map['nbbm']=nbbm; | ||
| 358 | + map['hd']=hd; | ||
| 359 | + map['rq']=$("#rq").val(); | ||
| 360 | + ylArray.push(map); | ||
| 361 | + }) | ||
| 362 | + var params = {}; | ||
| 363 | + params['dlbList']=JSON.stringify(ylArray); | ||
| 364 | + var i = layer.load(2); | ||
| 365 | + $post('/dlb/saveDlbList', params, function () { | ||
| 366 | + layer.close(i); | ||
| 367 | + var params1 =getParamsList(); | ||
| 368 | + jsDoQuery(params1, true); | ||
| 369 | + }); | ||
| 370 | + } | ||
| 371 | + }) | ||
| 372 | + }) | ||
| 373 | + //拆分 | ||
| 374 | + $("#sortButton").on('click', function () { | ||
| 375 | + if ($("#rq").val() != "") { | ||
| 376 | + var ylArray = []; | ||
| 377 | + var nbbm=""; | ||
| 378 | + var msg=""; | ||
| 379 | + $('input.icheck:checked').each(function(){ | ||
| 380 | + var map = {}; | ||
| 381 | + var id=$(this).data('id'); | ||
| 382 | + var clzbh =$('.in_carpark_nbbm[data-id='+id+']', '#dl_oil_list').html(); | ||
| 383 | + if(nbbm.indexOf(clzbh)>-1){ | ||
| 384 | + if(msg==""){ | ||
| 385 | + msg += clzbh; | ||
| 386 | + }else{ | ||
| 387 | + msg += ","+clzbh; | ||
| 388 | + } | ||
| 389 | + }else{ | ||
| 390 | + nbbm +=clzbh; | ||
| 391 | + var jzyl=$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list').val(); | ||
| 392 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#dl_oil_list').val(); | ||
| 393 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#dl_oil_list').val(); | ||
| 394 | + var ns = $('.in_carpark_ns[data-id='+id+']', '#dl_oil_list').val(); | ||
| 395 | + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#dl_oil_list').val(); | ||
| 396 | + map['id']=id; | ||
| 397 | + map['jzyl']=jzyl; | ||
| 398 | + map['sh']=sh; | ||
| 399 | + map['shyy']=shyy; | ||
| 400 | + map['ns']=ns; | ||
| 401 | + map['rylx']=rylx; | ||
| 402 | + ylArray.push(map); | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + }) ; | ||
| 406 | + if(msg!=""){ | ||
| 407 | + layer.msg('内部编码为:【'+msg +'】的车辆请选择一条数据进行拆分.'); | ||
| 408 | + }else{ | ||
| 409 | + var params = {}; | ||
| 410 | + params['ylbList']=JSON.stringify(ylArray); | ||
| 411 | + var i = layer.load(2); | ||
| 412 | + $post('/ylb/sort', params, function () { | ||
| 413 | + layer.close(i); | ||
| 414 | + var params1 =getParamsList(); | ||
| 415 | + jsDoQuery(params1, true); | ||
| 416 | + }); | ||
| 417 | + | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + } else { | ||
| 421 | + layer.msg('请选择日期.'); | ||
| 422 | + } | ||
| 423 | + }) | ||
| 424 | + //获取加存信息 | ||
| 425 | + $("#obtainJd").on('click', function () { | ||
| 426 | + if ($("#rq").val() != "") { | ||
| 427 | + var params=getParamsList(); | ||
| 428 | + $get('/ylb/checkDate',params,function(status){ | ||
| 429 | + if(status=='2'){ | ||
| 430 | + layer.msg('只能操作三天内数据.'); | ||
| 431 | + }else{ | ||
| 432 | + var i = layer.load(2); | ||
| 433 | + $get('/dlb/obtain', params, function () { | ||
| 434 | + layer.close(i); | ||
| 435 | + jsDoQuery(params, true); | ||
| 436 | + }); | ||
| 437 | + } | ||
| 438 | + }) | ||
| 439 | + } else { | ||
| 440 | + layer.msg('请选择日期.'); | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + }) | ||
| 444 | + $("#rq").datetimepicker({ | ||
| 445 | + format: 'YYYY-MM-DD', | ||
| 446 | + locale: 'zh-cn' | ||
| 447 | + }); | ||
| 448 | + | ||
| 449 | + var page = 0, initPagination; | ||
| 450 | + var icheckOptions = { | ||
| 451 | + radioClass: 'icheckbox_flat-blue', | ||
| 452 | + increaseArea: '20%' | ||
| 453 | + } | ||
| 454 | + | ||
| 455 | + //重置 | ||
| 456 | + $('tr.filter2 .filter-cancel').on('click', function () { | ||
| 457 | + $('tr.filter2 , #nbbm').val('').change(); | ||
| 458 | + }); | ||
| 459 | + | ||
| 460 | + //提交 | ||
| 461 | + $('tr.filter .filter-submit').on('click', function () { | ||
| 462 | + var ylbGsdm=$("#ylbListGsdmId").val(); | ||
| 463 | + var ylbFgsdm=$("#ylbListFgsdmId").val(); | ||
| 464 | + if ($("#rq").val() == "" || $("#rq").val() ==null){ | ||
| 465 | + layer.msg('请选择日期.'); | ||
| 466 | + }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){ | ||
| 467 | + layer.msg('请选择公司和分公司.'); | ||
| 468 | + }else { | ||
| 469 | + var params = getParamsList(); | ||
| 470 | + | ||
| 471 | + | ||
| 472 | + page = 0; | ||
| 473 | + jsDoQuery(params, true); | ||
| 474 | + } | ||
| 475 | + }); | ||
| 476 | + | ||
| 477 | + function getParamsList(){ | ||
| 478 | + var cells = $('tr.filter')[0].cells | ||
| 479 | + , cells1 = $('tr.filter2')[0].cells,params = {} | ||
| 480 | + , name; | ||
| 481 | + $.each(cells, function (i, cell) { | ||
| 482 | + var items = $('input,select', cell); | ||
| 483 | + for (var j = 0, item; item = items[j++];) { | ||
| 484 | + name = $(item).attr('name'); | ||
| 485 | + if (name) { | ||
| 486 | + params[name] = $(item).val(); | ||
| 487 | + } | ||
| 488 | + } | ||
| 489 | + }); | ||
| 490 | + $.each(cells1, function (i, cell) { | ||
| 491 | + var items = $('input,select', cell); | ||
| 492 | + for (var j = 0, item; item = items[j++];) { | ||
| 493 | + name = $(item).attr('name'); | ||
| 494 | + if (name) { | ||
| 495 | + params[name] = $(item).val(); | ||
| 496 | + } | ||
| 497 | + } | ||
| 498 | + }); | ||
| 499 | + | ||
| 500 | + return params; | ||
| 501 | + } | ||
| 502 | + | ||
| 503 | +// var gsqxdm=""; | ||
| 504 | + | ||
| 505 | + var xlList; | ||
| 506 | + var obj=[]; | ||
| 507 | + $.get('/report/lineList',function(result){ | ||
| 508 | + xlList=result; | ||
| 509 | + $.get('/user/companyData', function(result){ | ||
| 510 | + obj = result; | ||
| 511 | + var options=""; | ||
| 512 | + // = '<option value="">请选择</option>'; | ||
| 513 | + for(var i = 0; i < obj.length; i++){ | ||
| 514 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 515 | + // setFgsqx(obj[i].companyCode); | ||
| 516 | + } | ||
| 517 | + $('#ylbListGsdmId').html(options); | ||
| 518 | + updateCompany(); | ||
| 519 | + }); | ||
| 520 | + }) | ||
| 521 | + $("#ylbListGsdmId").on("change",updateCompany); | ||
| 522 | + function updateCompany(){ | ||
| 523 | + var company = $('#ylbListGsdmId').val(); | ||
| 524 | + var options =""; | ||
| 525 | +// = '<option value="">请选择</option>'; | ||
| 526 | + for(var i = 0; i < obj.length; i++){ | ||
| 527 | + if(obj[i].companyCode == company){ | ||
| 528 | + var children = obj[i].children; | ||
| 529 | + for(var j = 0; j < children.length; j++){ | ||
| 530 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + } | ||
| 534 | + $('#ylbListFgsdmId').html(options); | ||
| 535 | + initXl(); | ||
| 536 | + initCl(); | ||
| 537 | + } | ||
| 538 | + /* | ||
| 539 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 540 | + */ | ||
| 541 | + function jsDoQuery(p, pagination) { | ||
| 542 | + var params = {}; | ||
| 543 | + if (p) | ||
| 544 | + params = p; | ||
| 545 | + //更新时间排序 | ||
| 546 | + params['order'] = 'nbbm'; | ||
| 547 | + params['page'] = page; | ||
| 548 | + params['rq'] = $("#rq").val(); | ||
| 549 | + | ||
| 550 | + | ||
| 551 | + var l = layer.load(2); | ||
| 552 | + $get('/dlb/dlbList', params, function (data) { | ||
| 553 | + | ||
| 554 | + $.each(data, function (i, obj) { | ||
| 555 | + obj.rq = moment(obj.rq).format("YYYY-MM-DD"); | ||
| 556 | + }); | ||
| 557 | + var bodyHtm = template('dlb_list_temp', {list:data}); | ||
| 558 | + $('#datatable_dlb tbody').html(bodyHtm); | ||
| 559 | + $('.btn-jsyUpdate').on('click', jsyUpdate); | ||
| 560 | + layer.close(l); | ||
| 561 | + $get('/dlb/sumYlb',params,function(returns){ | ||
| 562 | + $("#sumJzl").html(returns.jzl); | ||
| 563 | + $("#sumYh").html(returns.yh); | ||
| 564 | + $("#sumSh").html(returns.sh); | ||
| 565 | + }); | ||
| 566 | + | ||
| 567 | + /* $('input').on('input propertychange',function(){ | ||
| 568 | + var id=$(this).data('id'); | ||
| 569 | + var cdl =$('.in_carpark_cdl[data-id='+id+']', '#dl_oil_list').html(); | ||
| 570 | + if(cdl=="" || cdl ==null){ | ||
| 571 | + cdl=0; | ||
| 572 | + } | ||
| 573 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#dl_oil_list').val(); | ||
| 574 | + if(sh=="" || sh==null){ | ||
| 575 | + sh=0; | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + var sub=numSubtr(cdl*1000,sh*1000); | ||
| 579 | + var subValue=0; | ||
| 580 | + if(sub/1000>=0){ | ||
| 581 | + subValue=sub/1000; | ||
| 582 | + } | ||
| 583 | + $('.in_carpark_hd[data-id='+id+']', '#dl_oil_list').val(subValue); | ||
| 584 | + | ||
| 585 | + }); */ | ||
| 586 | + }); | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + function jsyUpdate(){ | ||
| 590 | + var params=getParamsList(); | ||
| 591 | + $get('/ylb/checkDate',params,function(status){ | ||
| 592 | + if(status=='2'){ | ||
| 593 | + layer.msg('只能操作三天内数据.'); | ||
| 594 | + }else{ | ||
| 595 | + var id = $(this).data('id'); | ||
| 596 | + var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val(); | ||
| 597 | + $get('/dlb/updateJsy',{id:id,jsy:jsy}, function(result){ | ||
| 598 | + layer.msg('修改成功.'); | ||
| 599 | + page = 0; | ||
| 600 | + jsDoQuery(params, true); | ||
| 601 | + }); | ||
| 602 | + } | ||
| 603 | + }) | ||
| 604 | + } | ||
| 605 | + //页面计算防止精度丢失 | ||
| 606 | + var accAdd = function (a, b) { | ||
| 607 | + var c, d, e; | ||
| 608 | + try { | ||
| 609 | + c = a.toString().split(".")[1].length; | ||
| 610 | + } catch (f) { | ||
| 611 | + c = 0; | ||
| 612 | + } | ||
| 613 | + try { | ||
| 614 | + d = b.toString().split(".")[1].length; | ||
| 615 | + } catch (f) { | ||
| 616 | + d = 0; | ||
| 617 | + } | ||
| 618 | + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; | ||
| 619 | + }; | ||
| 620 | + | ||
| 621 | + var numSubtr = function (a, b) { | ||
| 622 | + var c, d, e; | ||
| 623 | + try { | ||
| 624 | + c = a.toString().split(".")[1].length; | ||
| 625 | + } catch (f) { | ||
| 626 | + c = 0; | ||
| 627 | + } | ||
| 628 | + try { | ||
| 629 | + d = b.toString().split(".")[1].length; | ||
| 630 | + } catch (f) { | ||
| 631 | + d = 0; | ||
| 632 | + } | ||
| 633 | + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; | ||
| 634 | + }; | ||
| 635 | + | ||
| 636 | + function mul(a, b) { | ||
| 637 | + var c = 0, | ||
| 638 | + d = a.toString(), | ||
| 639 | + e = b.toString(); | ||
| 640 | + try { | ||
| 641 | + c += d.split(".")[1].length; | ||
| 642 | + } catch (f) { | ||
| 643 | + } | ||
| 644 | + try { | ||
| 645 | + c += e.split(".")[1].length; | ||
| 646 | + } catch (f) { | ||
| 647 | + } | ||
| 648 | + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); | ||
| 649 | + } | ||
| 650 | + | ||
| 651 | + //改变状态 | ||
| 652 | + function startOptJzylLink(es) { | ||
| 653 | + es.editable({ | ||
| 654 | + type: 'text', | ||
| 655 | + placement: 'right', | ||
| 656 | + width: 100, | ||
| 657 | + display: false, | ||
| 658 | + validate: function (value) { | ||
| 659 | + if (!value) | ||
| 660 | + return '值不能为空!'; | ||
| 661 | + if (isNaN(value)) | ||
| 662 | + return '只能为数字!'; | ||
| 663 | + if (value < 0) | ||
| 664 | + return '值不能小于0!'; | ||
| 665 | + }, | ||
| 666 | + inputclass: 'form-control input-medium input-edtable-sm' | ||
| 667 | + }) | ||
| 668 | + .on('save', function (e, params) { | ||
| 669 | + $(this).text(params.newValue); | ||
| 670 | + }); | ||
| 671 | + } | ||
| 672 | + | ||
| 673 | + //改变状态 | ||
| 674 | + function startOptShylLink(es) { | ||
| 675 | + es.editable({ | ||
| 676 | + type: 'text', | ||
| 677 | + placement: 'right', | ||
| 678 | + width: 100, | ||
| 679 | + display: false, | ||
| 680 | + validate: function (value) { | ||
| 681 | + if (!value) | ||
| 682 | + return '值不能为空!'; | ||
| 683 | + if (isNaN(value)) | ||
| 684 | + return '只能为数字!'; | ||
| 685 | + if (value < 0) | ||
| 686 | + return '值不能小于0!'; | ||
| 687 | + }, | ||
| 688 | + inputclass: 'form-control input-medium input-edtable-sm' | ||
| 689 | + }) | ||
| 690 | + .on('save', function (e, params) { | ||
| 691 | + $(this).text(params.newValue); | ||
| 692 | + }); | ||
| 693 | + } | ||
| 694 | + function iCheckChange() { | ||
| 695 | + var tr = $(this).parents('tr'); | ||
| 696 | + if (this.checked) | ||
| 697 | + tr.addClass('row-active'); | ||
| 698 | + else | ||
| 699 | + tr.removeClass('row-active'); | ||
| 700 | + | ||
| 701 | + /* if($('#datatable_resource input.icheck:checked').length == 1) | ||
| 702 | + $('#removeButton').removeAttr('disabled'); | ||
| 703 | + else | ||
| 704 | + $('#removeButton').attr('disabled', 'disabled'); */ | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + function showPagination(data) { | ||
| 708 | + //分页 | ||
| 709 | + $('#pagination').jqPaginator({ | ||
| 710 | + totalPages: data.totalPages, | ||
| 711 | + visiblePages: 6, | ||
| 712 | + currentPage: page + 1, | ||
| 713 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 714 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 715 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 716 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 717 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 718 | + onPageChange: function (num, type) { | ||
| 719 | + if (initPagination) { | ||
| 720 | + initPagination = false; | ||
| 721 | + return; | ||
| 722 | + } | ||
| 723 | + | ||
| 724 | + var params=getParamsList(); | ||
| 725 | + page = num - 1; | ||
| 726 | + jsDoQuery(params, true); | ||
| 727 | + } | ||
| 728 | + }); | ||
| 729 | + } | ||
| 730 | + | ||
| 731 | + | ||
| 732 | + //删除 | ||
| 733 | + $('#removeButton').on('click', function () { | ||
| 734 | + var params_=getParamsList(); | ||
| 735 | + $get('/ylb/checkDate',params_,function(status){ | ||
| 736 | + if(status=='2'){ | ||
| 737 | + layer.msg('只能操作三天内数据.'); | ||
| 738 | + }else{ | ||
| 739 | + var idArray = []; | ||
| 740 | + var x=0; | ||
| 741 | + $('input.icheck:checked').each(function(){ | ||
| 742 | + x++; | ||
| 743 | + var map ={}; | ||
| 744 | + var id=$(this).data('id'); | ||
| 745 | + map['id']=id; | ||
| 746 | + idArray.push(map); | ||
| 747 | + | ||
| 748 | + }) | ||
| 749 | + var params = {}; | ||
| 750 | + params['ids']=JSON.stringify(idArray); | ||
| 751 | + if (x==0) { | ||
| 752 | + layer.msg("请选择要删除的数据"); | ||
| 753 | + }else{ | ||
| 754 | + if(confirm('确定要删除选中的数据?')) | ||
| 755 | + { | ||
| 756 | + var i = layer.load(2); | ||
| 757 | + $post('/dlb/deleteIds', params, function (result) { | ||
| 758 | + layer.close(i); | ||
| 759 | + var params=getParamsList(); | ||
| 760 | + jsDoQuery(params, true); | ||
| 761 | + }); | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + } | ||
| 765 | + }) | ||
| 766 | + }); | ||
| 767 | + | ||
| 768 | + | ||
| 769 | + $("#ylbListFgsdmId").on("change",initXl); | ||
| 770 | + function initXl(){ | ||
| 771 | + var data=[]; | ||
| 772 | + data.push({id: " ", text: "全部线路"}); | ||
| 773 | + if(fage){ | ||
| 774 | + $("#xlbm").select2("destroy").html(''); | ||
| 775 | + } | ||
| 776 | + var fgs=$('#ylbListFgsdmId').val(); | ||
| 777 | + var gs=$('#ylbListGsdmId').val(); | ||
| 778 | + for(var i=0;i<xlList.length;i++){ | ||
| 779 | + if(gs!=""){ | ||
| 780 | + if(fgs!=""){ | ||
| 781 | + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){ | ||
| 782 | + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]}); | ||
| 783 | + } | ||
| 784 | + }else{ | ||
| 785 | + if(xlList[i]["gsbm"]==gs){ | ||
| 786 | + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]}); | ||
| 787 | + } | ||
| 788 | + } | ||
| 789 | + } | ||
| 790 | + } | ||
| 791 | + initPinYinSelect2('#xlbm',data,''); | ||
| 792 | + fage=true; | ||
| 793 | + } | ||
| 794 | + $("#xlbm").on("change",initCl); | ||
| 795 | + function initCl(){ | ||
| 796 | + $('#nbbm').select2({ | ||
| 797 | + placeholder: '搜索车辆...', | ||
| 798 | + ajax: { | ||
| 799 | + url: '/report/carList', | ||
| 800 | + dataType: 'json', | ||
| 801 | + delay: 150, | ||
| 802 | + data: function (params) { | ||
| 803 | + return {nbbm: params.term, | ||
| 804 | + gsbm:$('#ylbListGsdmId').val(), | ||
| 805 | + fgsbm:$('#ylbListFgsdmId').val(), | ||
| 806 | + xlbm:$('#xlbm').val()}; | ||
| 807 | + }, | ||
| 808 | + processResults: function (data) { | ||
| 809 | + return { | ||
| 810 | + results: data | ||
| 811 | + }; | ||
| 812 | + }, | ||
| 813 | + cache: true | ||
| 814 | + }, | ||
| 815 | + templateResult: function (repo) { | ||
| 816 | + if (repo.loading) return repo.text; | ||
| 817 | + var h = '<span>' + repo.text + '</span>'; | ||
| 818 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | ||
| 819 | + return h; | ||
| 820 | + }, | ||
| 821 | + escapeMarkup: function (markup) { | ||
| 822 | + return markup; | ||
| 823 | + }, | ||
| 824 | + minimumInputLength: 1, | ||
| 825 | + templateSelection: function (repo) { | ||
| 826 | + return repo.text; | ||
| 827 | + }, | ||
| 828 | + language: { | ||
| 829 | + noResults: function () { | ||
| 830 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | ||
| 831 | + }, | ||
| 832 | + inputTooShort: function (e) { | ||
| 833 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | ||
| 834 | + }, | ||
| 835 | + searching: function () { | ||
| 836 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | ||
| 837 | + } | ||
| 838 | + } | ||
| 839 | + }); | ||
| 840 | + } | ||
| 841 | +// } | ||
| 842 | + | ||
| 843 | + | ||
| 844 | +//导出 | ||
| 845 | + | ||
| 846 | + $("#export").on("click", function () { | ||
| 847 | + if ($("#rq").val() != "") { | ||
| 848 | + var params=getParamsList(); | ||
| 849 | + $post('/dlb/listExport', params, function (result) { | ||
| 850 | + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存电量" ); | ||
| 851 | + }); | ||
| 852 | + } else { | ||
| 853 | + layer.msg('请选择日期.'); | ||
| 854 | + } | ||
| 855 | + }); | ||
| 856 | + | ||
| 857 | + }); | ||
| 858 | +</script> | ||
| 0 | \ No newline at end of file | 859 | \ No newline at end of file |
src/main/resources/static/pages/oil/list_jd.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + #ylbtable table>tr> td { | ||
| 3 | + white-space: nowrap; | ||
| 4 | + overflow: hidden; | ||
| 5 | + text-overflow: ellipsis; | ||
| 6 | + } | ||
| 7 | + | ||
| 8 | +</style> | ||
| 9 | + <div class="page-head"> | ||
| 10 | + <div class="page-title"> | ||
| 11 | + <h1>进出场存油量</h1> | ||
| 12 | + </div> | ||
| 13 | + </div> | ||
| 14 | + | ||
| 15 | + <ul class="page-breadcrumb breadcrumb"> | ||
| 16 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 17 | + <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li> | ||
| 18 | + <li><span class="active">进出场存油量</span></li> | ||
| 19 | + </ul> | ||
| 20 | + <div id="ll_oil_list" | ||
| 21 | + class=" row col-md-12 portlet light porttlet-fit portlet-datatable bordered" style="height: calc(100% - 100px);background-color: #fff"> | ||
| 22 | + <!-- Begin: life time stats --> | ||
| 23 | + <div class="portlet-title" > | ||
| 24 | + <div class="caption"> | ||
| 25 | + <i class="fa fa-fire-extinguisher"></i> <span | ||
| 26 | + class="caption-subject font-dark sbold uppercase">进出场存油量表</span> | ||
| 27 | + </div> | ||
| 28 | + <div class="actions"> | ||
| 29 | + <a class="btn btn-circle blue" href="add.html" data-pjax><i | ||
| 30 | + class="fa fa-plus"></i> 添加</a> | ||
| 31 | + <button type="button" class="btn btn-circle blue removeButton" id="removeButton"> | ||
| 32 | + <i class="fa fa-trash-o"></i> 删除 | ||
| 33 | + </button> | ||
| 34 | + <button type="button" class="btn btn-circle blue sortButton" id="sortButton"> | ||
| 35 | + <i class="fa fa-minus-square"></i> 拆分 | ||
| 36 | + </button> | ||
| 37 | + <button type="button" class="btn btn-circle blue saveButton" id="saveButton"> | ||
| 38 | + <i class="fa fa-check-circle"></i> 保存 | ||
| 39 | + </button> | ||
| 40 | + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> --> | ||
| 41 | + <div class="btn-group"> | ||
| 42 | + <a class="btn red btn-outline btn-circle" href="javascript:;" | ||
| 43 | + data-toggle="dropdown"> <i class="fa fa-share"></i> <span | ||
| 44 | + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i> | ||
| 45 | + </a> | ||
| 46 | + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools"> | ||
| 47 | + <li><a href="javascript:;" data-action="0" class="tool-action" | ||
| 48 | + id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息 | ||
| 49 | + </a></li> | ||
| 50 | + <li><a href="javascript:;" data-action="1" class="tool-action" | ||
| 51 | + id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场) | ||
| 52 | + </a></li> | ||
| 53 | + <li><a href="javascript:;" id="checkYl" data-action="3" | ||
| 54 | + class="tool-action"> <i class="fa fa-gg-circle"></i> | ||
| 55 | + 核对加注量(有加油无里程) | ||
| 56 | + </a></li> | ||
| 57 | + <li class="divider"></li> | ||
| 58 | + <li><a href="javascript:;" data-action="3" class="tool-action" | ||
| 59 | + id="export"> <i class="fa fa-file-excel-o"></i> 导出Excel | ||
| 60 | + </a></li> | ||
| 61 | + | ||
| 62 | +<!-- <li class="divider"></li> --> | ||
| 63 | +<!-- <li><a href="javascript:;" data-action="3" class="tool-action" --> | ||
| 64 | +<!-- id="cxtj"> <i class="fa fa-file-excel-o"></i> 重新统计 --> | ||
| 65 | +<!-- </a></li> --> | ||
| 66 | + </ul> | ||
| 67 | + </div> | ||
| 68 | + </div> | ||
| 69 | + <div> | ||
| 70 | + <table | ||
| 71 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 72 | + id="datatable_ylb" style="table-layout: fixed;margin-bottom: 0px"> | ||
| 73 | + <thead> | ||
| 74 | + <tr role="row" class="filter"> | ||
| 75 | + <td colspan="2"> | ||
| 76 | + <div style="float: right;"> 公司 </div> | ||
| 77 | + </td> | ||
| 78 | + <td colspan="3"> | ||
| 79 | + <div style="float: left; width: 150px"> | ||
| 80 | + <select class="form-control" name="ssgsdm_like" | ||
| 81 | + id="ylbListGsdmId"></select> | ||
| 82 | + </div> | ||
| 83 | + </td> | ||
| 84 | + <td colspan="2"> | ||
| 85 | + <div style="float: right;"> 分公司 </div> | ||
| 86 | + </td> | ||
| 87 | + <td colspan="4"> | ||
| 88 | + <div style="float: left;"> | ||
| 89 | + <select class="form-control" name="fgsdm_like" | ||
| 90 | + id="ylbListFgsdmId" style="width: 150px"></select> | ||
| 91 | + </div> | ||
| 92 | + </td> | ||
| 93 | + <td> | ||
| 94 | + <div style="float: right;">日期</div> | ||
| 95 | + </td> | ||
| 96 | + <td colspan="3"> | ||
| 97 | + <div style="float: left;"> | ||
| 98 | + <input type="text" style="width: 120px" name="rq" id="rq" /> | ||
| 99 | + </div> | ||
| 100 | + </td> | ||
| 101 | + <td rowspan="2" colspan="2"> | ||
| 102 | + <div style="float: left;"> | ||
| 103 | + | ||
| 104 | + <button | ||
| 105 | + class="btn btn-sm green btn-outline filter-submit margin-bottom" | ||
| 106 | + style="margin-right: 0px"> | ||
| 107 | + <i class="fa fa-search"></i> 搜索 | ||
| 108 | + </button> | ||
| 109 | + <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> --> | ||
| 110 | + <!-- <i class="fa fa-times"></i> 重置 --> | ||
| 111 | + <!-- </button> --> | ||
| 112 | + | ||
| 113 | + </div> | ||
| 114 | + </td> | ||
| 115 | + </tr> | ||
| 116 | + <tr class="filter2"> | ||
| 117 | + <td colspan="2"> | ||
| 118 | + <div style="float: right;"> 线路</div> | ||
| 119 | + </td> | ||
| 120 | + <td colspan="3"> | ||
| 121 | + <div style="float: left;"> | ||
| 122 | + <select class="form-control" name="xlbm_like" id="xlbm" | ||
| 123 | + style="width: 150px;"></select> | ||
| 124 | + </div> | ||
| 125 | + </td> | ||
| 126 | + <td colspan="2"> | ||
| 127 | + <div style="float: right;"> 内部编码</div> | ||
| 128 | + </td> | ||
| 129 | + <td colspan="4"> | ||
| 130 | + <div style="float: left;"> | ||
| 131 | + <select class="form-control" name="nbbm_eq" id="nbbm" | ||
| 132 | + style="width: 120px;"></select> | ||
| 133 | + </div> | ||
| 134 | + <div style="float: left;"> | ||
| 135 | + <button class="btn btn-sm #000 btn-outline filter-cancel" | ||
| 136 | + style="margin-right: 0px"> | ||
| 137 | + <i class="fa fa-times"></i> | ||
| 138 | + </button> | ||
| 139 | + </div> | ||
| 140 | + </td> | ||
| 141 | + <td> | ||
| 142 | + <div style="float: right;">类型</div> | ||
| 143 | + </td> | ||
| 144 | + <td colspan="3"> | ||
| 145 | + <div style="float: left;"> | ||
| 146 | + <select class="form-control" name="sxtj"> | ||
| 147 | + <option value="0">全部</option> | ||
| 148 | + <option value="1">一车一单</option> | ||
| 149 | + <option value="2">一车多单</option> | ||
| 150 | + <option value="3">有加油没里程</option> | ||
| 151 | + <option value="4">有里程没加油</option> | ||
| 152 | + </select> | ||
| 153 | + </div> | ||
| 154 | + | ||
| 155 | + </td> | ||
| 156 | + </tr> | ||
| 157 | + <tr> | ||
| 158 | + <td colspan="17"> | ||
| 159 | + <div style="float: left;"> | ||
| 160 | + 总计 加注量: <label id="sumJzl"></label> | ||
| 161 | + 耗油量: <label id="sumYh"></label> | ||
| 162 | + 损耗量: <label id="sumSh"></label> | ||
| 163 | + </div> | ||
| 164 | + </td> | ||
| 165 | + </tr> | ||
| 166 | + | ||
| 167 | + </thead> | ||
| 168 | + | ||
| 169 | + </table> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + | ||
| 173 | + <div id="ylbtable" class="portlet-body table-container " style="height: calc(100% + 100px);overflow: hidden;position: absolute;background: #fff;"> | ||
| 174 | + | ||
| 175 | + <table | ||
| 176 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 177 | + style="table-layout: fixed;margin-bottom: 0px;"> | ||
| 178 | + <thead> | ||
| 179 | + <tr role="row" class="heading"> | ||
| 180 | + <td width="40px"> | ||
| 181 | + <input type="checkbox" id="selectAll" class="group-checkable" > | ||
| 182 | + </td> | ||
| 183 | + <td width="40px">序号</td> | ||
| 184 | + <td width="8%">日期</td> | ||
| 185 | + <td width="5%">公司</td> | ||
| 186 | + <td width="8%">线路</td> | ||
| 187 | + <td width="5%">自编号</td> | ||
| 188 | + <td width="7%">驾驶员</td> | ||
| 189 | + <td width="4%">加油量</td> | ||
| 190 | + <td width="5%">出场存油</td> | ||
| 191 | + <td width="5%">进场存油</td> | ||
| 192 | + <td width="5%">油耗</td> | ||
| 193 | + <td width="8%">燃油类型</td> | ||
| 194 | + <td width="4%">尿素</td> | ||
| 195 | + <td width="8%">耗损原因</td> | ||
| 196 | + <td width="5%">耗损油量</td> | ||
| 197 | + <td width="5%">当日总里程</td> | ||
| 198 | + <td width="5%">数据类型</td> | ||
| 199 | + <td >百公里油耗</td> | ||
| 200 | + </tr> | ||
| 201 | + </thead> | ||
| 202 | + </table> | ||
| 203 | + <div id="datatable_ylb_body_div" style="display: block;position:absolute;overflow: auto;height: calc(100% - 80px);"> | ||
| 204 | + <table | ||
| 205 | + class="table table-striped table-bordered table-hover table-checkable" | ||
| 206 | + id="datatable_ylb_body" | ||
| 207 | + style="table-layout: fixed; overflow: auto; "> | ||
| 208 | + <tbody></tbody> | ||
| 209 | + </table> | ||
| 210 | + <div style="text-align: right;margin-right: 50px"> | ||
| 211 | + <a class="btn btn-circle " href="add.html" data-pjax><i | ||
| 212 | + class="fa fa-plus"></i> 添加</a> | ||
| 213 | + <button type="button" class="btn btn-circle removeButton" > | ||
| 214 | + <i class="fa fa-trash-o"></i> 删除 | ||
| 215 | + </button> | ||
| 216 | + <button type="button" class="btn btn-circle sortButton"> | ||
| 217 | + <i class="fa fa-minus-square"></i> 拆分 | ||
| 218 | + </button> | ||
| 219 | + <button type="button" class="btn btn-circle saveButton" > | ||
| 220 | + <i class="fa fa-check-circle"></i> 保存 | ||
| 221 | + </button> | ||
| 222 | + </div> | ||
| 223 | + </div> | ||
| 224 | + | ||
| 225 | + | ||
| 226 | + <div style="text-align: right;"> | ||
| 227 | + <ul id="pagination" class="pagination"></ul> | ||
| 228 | + </div> | ||
| 229 | + </div> | ||
| 230 | + </div> | ||
| 231 | +<script id="ylb_list_temp" type="text/html"> | ||
| 232 | + {{each list as obj i}} | ||
| 233 | + <tr> | ||
| 234 | + <td style="vertical-align: middle;" width="40px"> | ||
| 235 | + <input type="checkbox" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> | ||
| 236 | + </td> | ||
| 237 | + <td width="40px">{{i+1}}</td> | ||
| 238 | + <td width="8%"> | ||
| 239 | + {{obj.rq}} | ||
| 240 | + </td> | ||
| 241 | + <td width="5%"> | ||
| 242 | + {{obj.fgsname}} | ||
| 243 | + </td> | ||
| 244 | + <td width="8%"> | ||
| 245 | + {{obj.xlname}} | ||
| 246 | + </td> | ||
| 247 | + <td width="5%"> | ||
| 248 | + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable> | ||
| 249 | + | ||
| 250 | + </td> | ||
| 251 | + <td width="7%"> | ||
| 252 | + {{if obj.jsy=='' || obj.jsy==null }} | ||
| 253 | + <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input> | ||
| 254 | + <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button> | ||
| 255 | + {{else}} | ||
| 256 | + {{obj.jsy}}/{{obj.name}} | ||
| 257 | + {{/if}} | ||
| 258 | + | ||
| 259 | + </td> | ||
| 260 | + <td width="4%"> | ||
| 261 | + <lable data-id="{{obj.id}}" class="in_carpark_jzl"> {{obj.jzl}}</lable> | ||
| 262 | + </td> | ||
| 263 | + <td width="5%"> | ||
| 264 | + | ||
| 265 | + <input data-id="{{obj.id}}" id="{{(i+1)}}_1" href="javascript:;" class="in_carpark_czyl yl_sxzy" | ||
| 266 | + type="text" value=" {{obj.czyl}}" style=" width:100%" | ||
| 267 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 268 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"> | ||
| 269 | + </td> | ||
| 270 | + <td width="5%"> | ||
| 271 | + <input data-id="{{obj.id}}" id="{{(i+1)}}_2" href="javascript:;" class="in_carpark_jzyl yl_sxzy" | ||
| 272 | + type="text" value=" {{obj.jzyl}}" style=" width:100%" | ||
| 273 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 274 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"> | ||
| 275 | + </td> | ||
| 276 | + <td width="5%"> | ||
| 277 | + | ||
| 278 | + <input data-id="{{obj.id}}" id="{{(i+1)}}_3" href="javascript:;" class="in_carpark_yh yl_sxzy" | ||
| 279 | + type="text" value="{{obj.yh}}" style=" width:100%" readOnly="true" /> | ||
| 280 | + </td> | ||
| 281 | + <td width="8%"> | ||
| 282 | + <select data-id="{{obj.id}}" class="in_carpark_rylx" style=" width:100%" > | ||
| 283 | + <option value='0' {{if obj.rylx==0}} selected = 'selected' {{/if}}>0号柴油</option> | ||
| 284 | + <option value='1' {{if obj.rylx==1}} selected = 'selected' {{/if}}>负10号柴油</option> | ||
| 285 | + </select> | ||
| 286 | + </td> | ||
| 287 | + <td width="4%"> | ||
| 288 | + <input data-id="{{obj.id}}" href="javascript:;" | ||
| 289 | + class="in_carpark_ns yl_sxzy" id="{{(i+1)}}_4" type="text" value=" {{obj.ns}}" style=" width:100%" | ||
| 290 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 291 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"> | ||
| 292 | + </td> | ||
| 293 | + <td width="8%"> | ||
| 294 | + <select data-id="{{obj.id}}" class="in_carpark_shyy" style=" width:100%" > | ||
| 295 | + <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option> | ||
| 296 | + <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option> | ||
| 297 | + <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option> | ||
| 298 | + <option value='3' {{if obj.shyy==3}} selected = 'selected' {{/if}}>报废车用油</option> | ||
| 299 | + <option value='4' {{if obj.shyy==4}} selected = 'selected' {{/if}}>其它用油</option> | ||
| 300 | + <option value='5' {{if obj.shyy==5}} selected = 'selected' {{/if}}>人保部</option> | ||
| 301 | + <option value='6' {{if obj.shyy==6}} selected = 'selected' {{/if}}>车队</option> | ||
| 302 | + <option value='7' {{if obj.shyy==7}} selected = 'selected' {{/if}}>车间(高保)</option> | ||
| 303 | + <option value='8' {{if obj.shyy==8}} selected = 'selected' {{/if}}>车间(小修)</option> | ||
| 304 | + </select> | ||
| 305 | + </td> | ||
| 306 | + <td width="5%"> | ||
| 307 | + <input data-id="{{obj.id}}" id="{{(i+1)}}_5" href="javascript:;" class="in_carpark_shyl yl_sxzy" | ||
| 308 | + value={{obj.sh}} style=" width:100%" type="text" | ||
| 309 | +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" | ||
| 310 | + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" /> | ||
| 311 | + | ||
| 312 | +</td> | ||
| 313 | + <td width="5%"> | ||
| 314 | + {{obj.zlc}} | ||
| 315 | + </td> | ||
| 316 | + <td width="5%"> | ||
| 317 | + <select data-id="{{obj.id}}" class="in_carpark_yhlx"> | ||
| 318 | + <option value='0' {{if obj.yhlx==0}} selected = 'selected' {{/if}}>手录</option> | ||
| 319 | + <option value='1' {{if obj.yhlx==1}} selected = 'selected' {{/if}}>拆分</option> | ||
| 320 | + </select> | ||
| 321 | + </td> | ||
| 322 | + <td > | ||
| 323 | + {{obj.bglyh}} | ||
| 324 | + </td> | ||
| 325 | + </tr> | ||
| 326 | + {{/each}} | ||
| 327 | + {{if list.length == 0}} | ||
| 328 | + <tr> | ||
| 329 | + <td colspan=17><h6 class="muted">没有找到相关数据</h6></td> | ||
| 330 | + </tr> | ||
| 331 | + {{/if}} | ||
| 332 | +</script> | ||
| 333 | + | ||
| 334 | +<script> | ||
| 335 | + $(function () { | ||
| 336 | + var fage=false; | ||
| 337 | + //var id = 15; | ||
| 338 | + //$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list') | ||
| 339 | + | ||
| 340 | + | ||
| 341 | + $("#checkYl").on('click', function () { | ||
| 342 | + //console.log("核对加注量"); | ||
| 343 | + if ($("#rq").val() != "") { | ||
| 344 | + var params=getParamsList(); | ||
| 345 | + $get('/ylb/checkDate',params,function(status){ | ||
| 346 | + if(status=='2'){ | ||
| 347 | + layer.msg('只能操作三天内数据.'); | ||
| 348 | + }else{ | ||
| 349 | + var i = layer.load(2); | ||
| 350 | + $get('/ylb/checkYl', params, function () { | ||
| 351 | + layer.close(i); | ||
| 352 | + jsDoQuery(params, true); | ||
| 353 | + }); | ||
| 354 | + } | ||
| 355 | + }) | ||
| 356 | + | ||
| 357 | + } else { | ||
| 358 | + layer.msg('请选择日期.'); | ||
| 359 | + } | ||
| 360 | + }) | ||
| 361 | + | ||
| 362 | + //进场等于出场 | ||
| 363 | + $("#outAndIn").on('click', function () { | ||
| 364 | + // console.log("进场油量等于出场油量"); | ||
| 365 | + if ($("#rq").val() != "") { | ||
| 366 | + var params=getParamsList(); | ||
| 367 | + $get('/ylb/checkDate',params,function(status){ | ||
| 368 | + if(status=='2'){ | ||
| 369 | + layer.msg('只能操作三天内数据.'); | ||
| 370 | + }else{ | ||
| 371 | + var i = layer.load(2); | ||
| 372 | + $get('/ylb/outAndIn', params, function () { | ||
| 373 | + layer.close(i); | ||
| 374 | + jsDoQuery(params, true); | ||
| 375 | + }); | ||
| 376 | + } | ||
| 377 | + }) | ||
| 378 | + } else { | ||
| 379 | + layer.msg('请选择日期.'); | ||
| 380 | + } | ||
| 381 | + }); | ||
| 382 | + | ||
| 383 | + //保存 | ||
| 384 | + $(".saveButton").on('click',function(){ | ||
| 385 | + | ||
| 386 | + var params_=getParamsList(); | ||
| 387 | + $get('/ylb/checkDate',params_,function(status){ | ||
| 388 | + if(status=='2'){ | ||
| 389 | + layer.msg('只能操作三天内数据.'); | ||
| 390 | + }else{ | ||
| 391 | + var ylArray = []; | ||
| 392 | + $('input.icheck').each(function(){ | ||
| 393 | + var map = {}; | ||
| 394 | + var id=$(this).data('id'); | ||
| 395 | + var nbbm =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html(); | ||
| 396 | + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html(); | ||
| 397 | + if(jzl=="" || jzl ==null){ | ||
| 398 | + jzl=0; | ||
| 399 | + } | ||
| 400 | + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 401 | + if(czyl=="" || czyl==null){ | ||
| 402 | + czyl=0; | ||
| 403 | + } | ||
| 404 | + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 405 | + if(jzyl=="" || jzyl==null){ | ||
| 406 | + jzyl=0; | ||
| 407 | + } | ||
| 408 | + | ||
| 409 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 410 | + if(sh=="" || sh==null){ | ||
| 411 | + sh=0; | ||
| 412 | + } | ||
| 413 | + | ||
| 414 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); | ||
| 415 | + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); | ||
| 416 | + if(ns=="" || ns==null){ | ||
| 417 | + ns=0; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 421 | + var yhlx = $('.in_carpark_yhlx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 422 | + | ||
| 423 | + map['id']=id; | ||
| 424 | + map['jzl']=jzl; | ||
| 425 | + map['czyl']=czyl; | ||
| 426 | + map['jzyl']=jzyl; | ||
| 427 | + map['sh']=sh; | ||
| 428 | + map['shyy']=shyy; | ||
| 429 | + map['ns']=ns; | ||
| 430 | + map['rylx']=rylx; | ||
| 431 | + map['yhlx']=yhlx; | ||
| 432 | + map['nbbm']=nbbm; | ||
| 433 | + map['rq']=$("#rq").val(); | ||
| 434 | + ylArray.push(map); | ||
| 435 | + }) | ||
| 436 | + var params = {}; | ||
| 437 | + params['ylbList']=JSON.stringify(ylArray); | ||
| 438 | + var i = layer.load(2); | ||
| 439 | + $post('/ylb/saveYlbList', params, function () { | ||
| 440 | + layer.close(i); | ||
| 441 | + var params1 =getParamsList(); | ||
| 442 | + jsDoQuery(params1, true); | ||
| 443 | + }); | ||
| 444 | + } | ||
| 445 | + }) | ||
| 446 | + }) | ||
| 447 | + //拆分 | ||
| 448 | + $(".sortButton").on('click', function () { | ||
| 449 | + if ($("#rq").val() != "") { | ||
| 450 | + var params_=getParamsList(); | ||
| 451 | + $get('/ylb/checkDate',params_,function(status){ | ||
| 452 | + if(status=='2'){ | ||
| 453 | + layer.msg('只能操作三天内数据.'); | ||
| 454 | + }else{ | ||
| 455 | + //拆分前先保存全部 | ||
| 456 | + var ylArray = []; | ||
| 457 | + $('input.icheck').each(function(){ | ||
| 458 | + var map = {}; | ||
| 459 | + var id=$(this).data('id'); | ||
| 460 | + var nbbm =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html(); | ||
| 461 | + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html(); | ||
| 462 | + if(jzl=="" || jzl ==null){ | ||
| 463 | + jzl=0; | ||
| 464 | + } | ||
| 465 | + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 466 | + if(czyl=="" || czyl==null){ | ||
| 467 | + czyl=0; | ||
| 468 | + } | ||
| 469 | + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 470 | + if(jzyl=="" || jzyl==null){ | ||
| 471 | + jzyl=0; | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 475 | + if(sh=="" || sh==null){ | ||
| 476 | + sh=0; | ||
| 477 | + } | ||
| 478 | + | ||
| 479 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); | ||
| 480 | + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); | ||
| 481 | + if(ns=="" || ns==null){ | ||
| 482 | + ns=0; | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 486 | + var yhlx = $('.in_carpark_yhlx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 487 | + | ||
| 488 | + map['id']=id; | ||
| 489 | + map['jzl']=jzl; | ||
| 490 | + map['czyl']=czyl; | ||
| 491 | + map['jzyl']=jzyl; | ||
| 492 | + map['sh']=sh; | ||
| 493 | + map['shyy']=shyy; | ||
| 494 | + map['ns']=ns; | ||
| 495 | + map['rylx']=rylx; | ||
| 496 | + map['yhlx']=yhlx; | ||
| 497 | + map['nbbm']=nbbm; | ||
| 498 | + map['rq']=$("#rq").val(); | ||
| 499 | + ylArray.push(map); | ||
| 500 | + }) | ||
| 501 | + var params = {}; | ||
| 502 | + params['ylbList']=JSON.stringify(ylArray); | ||
| 503 | + | ||
| 504 | + | ||
| 505 | + //拆分操作 | ||
| 506 | + var ylArray2 = []; | ||
| 507 | + var nbbm=""; | ||
| 508 | + var msg=""; | ||
| 509 | + $('input.icheck:checked').each(function(){ | ||
| 510 | + var map = {}; | ||
| 511 | + var id=$(this).data('id'); | ||
| 512 | + var clzbh =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html(); | ||
| 513 | + if(nbbm.indexOf(clzbh)>-1){ | ||
| 514 | + if(msg==""){ | ||
| 515 | + msg += clzbh; | ||
| 516 | + }else{ | ||
| 517 | + msg += ","+clzbh; | ||
| 518 | + } | ||
| 519 | + }else{ | ||
| 520 | + nbbm +=clzbh; | ||
| 521 | + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 522 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 523 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); | ||
| 524 | + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); | ||
| 525 | + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 526 | + map['id']=id; | ||
| 527 | + map['jzyl']=jzyl; | ||
| 528 | + map['sh']=sh; | ||
| 529 | + map['shyy']=shyy; | ||
| 530 | + map['ns']=ns; | ||
| 531 | + map['rylx']=rylx; | ||
| 532 | + ylArray2.push(map); | ||
| 533 | + } | ||
| 534 | + | ||
| 535 | + }) ; | ||
| 536 | + if(msg!=""){ | ||
| 537 | + layer.msg('内部编码为:【'+msg +'】的车辆请选择一条数据进行拆分.'); | ||
| 538 | + }else{ | ||
| 539 | + var params2 = {}; | ||
| 540 | + params2['ylbList']=JSON.stringify(ylArray2); | ||
| 541 | + var i = layer.load(2); | ||
| 542 | + //保存操作 | ||
| 543 | + $post('/ylb/saveYlbList', params, function () { | ||
| 544 | + //拆分操作 | ||
| 545 | + $post('/ylb/sort', params2, function () { | ||
| 546 | + layer.close(i); | ||
| 547 | + var params1 =getParamsList(); | ||
| 548 | + jsDoQuery(params1, true); | ||
| 549 | + }); | ||
| 550 | + }); | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + }) | ||
| 554 | + } else { | ||
| 555 | + layer.msg('请选择日期.'); | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | + | ||
| 559 | + }) | ||
| 560 | + | ||
| 561 | + /* //拆分 | ||
| 562 | + $("#sortButton").on('click', function () { | ||
| 563 | + if ($("#rq").val() != "") { | ||
| 564 | + var ylArray = []; | ||
| 565 | + var nbbm=""; | ||
| 566 | + var msg=""; | ||
| 567 | + $('input.icheck:checked').each(function(){ | ||
| 568 | + var map = {}; | ||
| 569 | + var id=$(this).data('id'); | ||
| 570 | + var clzbh =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html(); | ||
| 571 | + if(nbbm.indexOf(clzbh)>-1){ | ||
| 572 | + if(msg==""){ | ||
| 573 | + msg += clzbh; | ||
| 574 | + }else{ | ||
| 575 | + msg += ","+clzbh; | ||
| 576 | + } | ||
| 577 | + }else{ | ||
| 578 | + nbbm +=clzbh; | ||
| 579 | + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 580 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 581 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); | ||
| 582 | + var ns = $('.in_carpark_ns[data-id='+id+']', '#ll_oil_list').val(); | ||
| 583 | + var rylx= $('.in_carpark_rylx[data-id='+id+']', '#ll_oil_list').val(); | ||
| 584 | + map['id']=id; | ||
| 585 | + map['jzyl']=jzyl; | ||
| 586 | + map['sh']=sh; | ||
| 587 | + map['shyy']=shyy; | ||
| 588 | + map['ns']=ns; | ||
| 589 | + map['rylx']=rylx; | ||
| 590 | + ylArray.push(map); | ||
| 591 | + } | ||
| 592 | + | ||
| 593 | + }) ; | ||
| 594 | + if(msg!=""){ | ||
| 595 | + layer.msg('内部编码为:【'+msg +'】的车辆请选择一条数据进行拆分.'); | ||
| 596 | + }else{ | ||
| 597 | + var params = {}; | ||
| 598 | + params['ylbList']=JSON.stringify(ylArray); | ||
| 599 | + var i = layer.load(2); | ||
| 600 | + $post('/ylb/sort', params, function () { | ||
| 601 | + layer.close(i); | ||
| 602 | + var params1 =getParamsList(); | ||
| 603 | + jsDoQuery(params1, true); | ||
| 604 | + }); | ||
| 605 | + | ||
| 606 | + } | ||
| 607 | + | ||
| 608 | + } else { | ||
| 609 | + layer.msg('请选择日期.'); | ||
| 610 | + } | ||
| 611 | + }) */ | ||
| 612 | + //获取加存信息 | ||
| 613 | + $("#obtain").on('click', function () { | ||
| 614 | + //console.log("获取加存"); | ||
| 615 | + if ($("#rq").val() != "") { | ||
| 616 | + var params=getParamsList(); | ||
| 617 | + $get('/ylb/checkDate',params,function(status){ | ||
| 618 | + if(status=='2'){ | ||
| 619 | + layer.msg('只能操作三天内数据.'); | ||
| 620 | + }else{ | ||
| 621 | + var i = layer.load(2); | ||
| 622 | + $get('/ylb/obtain', params, function () { | ||
| 623 | + layer.close(i); | ||
| 624 | + jsDoQuery(params, true); | ||
| 625 | + }); | ||
| 626 | + } | ||
| 627 | + }) | ||
| 628 | + } else { | ||
| 629 | + layer.msg('请选择日期.'); | ||
| 630 | + } | ||
| 631 | + | ||
| 632 | + }) | ||
| 633 | + $("#rq").datetimepicker({ | ||
| 634 | + format: 'YYYY-MM-DD', | ||
| 635 | + locale: 'zh-cn' | ||
| 636 | + }); | ||
| 637 | + | ||
| 638 | + var page = 0, initPagination; | ||
| 639 | + var icheckOptions = { | ||
| 640 | + radioClass: 'icheckbox_flat-blue', | ||
| 641 | + increaseArea: '20%' | ||
| 642 | + } | ||
| 643 | + | ||
| 644 | + //重置 | ||
| 645 | + $('tr.filter2 .filter-cancel').on('click', function () { | ||
| 646 | + $('tr.filter2 , #nbbm').val('').change(); | ||
| 647 | + }); | ||
| 648 | + | ||
| 649 | + //提交 | ||
| 650 | + $('tr.filter .filter-submit').on('click', function () { | ||
| 651 | + var ylbGsdm=$("#ylbListGsdmId").val(); | ||
| 652 | + var ylbFgsdm=$("#ylbListFgsdmId").val(); | ||
| 653 | + if ($("#rq").val() == "" || $("#rq").val() ==null){ | ||
| 654 | + layer.msg('请选择日期.'); | ||
| 655 | + }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){ | ||
| 656 | + layer.msg('请选择公司和分公司.'); | ||
| 657 | + }else { | ||
| 658 | + var params = getParamsList(); | ||
| 659 | + page = 0; | ||
| 660 | + jsDoQuery(params, true); | ||
| 661 | + } | ||
| 662 | + }); | ||
| 663 | + | ||
| 664 | + | ||
| 665 | + var xlList; | ||
| 666 | + var obj=[]; | ||
| 667 | + $.get('/report/lineList',function(result){ | ||
| 668 | + xlList=result; | ||
| 669 | + $.get('/user/companyData', function(result){ | ||
| 670 | + obj = result; | ||
| 671 | + var options=""; | ||
| 672 | + for(var i = 0; i < obj.length; i++){ | ||
| 673 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 674 | + } | ||
| 675 | + $('#ylbListGsdmId').html(options); | ||
| 676 | + updateCompany(); | ||
| 677 | + }); | ||
| 678 | + }) | ||
| 679 | + $("#ylbListGsdmId").on("change",updateCompany); | ||
| 680 | + function updateCompany(){ | ||
| 681 | + var company = $('#ylbListGsdmId').val(); | ||
| 682 | + var options =""; | ||
| 683 | + for(var i = 0; i < obj.length; i++){ | ||
| 684 | + if(obj[i].companyCode == company){ | ||
| 685 | + var children = obj[i].children; | ||
| 686 | + for(var j = 0; j < children.length; j++){ | ||
| 687 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 688 | + } | ||
| 689 | + } | ||
| 690 | + } | ||
| 691 | + $('#ylbListFgsdmId').html(options); | ||
| 692 | + initXl(); | ||
| 693 | + initCl(); | ||
| 694 | + } | ||
| 695 | + /* | ||
| 696 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 697 | + */ | ||
| 698 | + var moveArray=new Array(); //存放文本框数组 | ||
| 699 | + function jsDoQuery(p, pagination) { | ||
| 700 | + var params = {}; | ||
| 701 | + if (p) | ||
| 702 | + params = p; | ||
| 703 | + //更新时间排序 | ||
| 704 | + params['order'] = 'nbbm'; | ||
| 705 | + params['page'] = page; | ||
| 706 | + params['rq'] = $("#rq").val(); | ||
| 707 | + | ||
| 708 | + var l = layer.load(2); | ||
| 709 | + $get('/ylb/ylbList', params, function (data) { | ||
| 710 | + for(var i=1;i<data.length;i++){ | ||
| 711 | + moveArray[i]=new Array(); | ||
| 712 | + for(var j=1;j<6;j++){ | ||
| 713 | + moveArray[i][j]=i+"_"+j; | ||
| 714 | + } | ||
| 715 | + } | ||
| 716 | + $.each(data, function (i, obj) { | ||
| 717 | + obj.rq = moment(obj.rq).format("YYYY-MM-DD"); | ||
| 718 | + }); | ||
| 719 | + var bodyHtm = template('ylb_list_temp', {list:data}); | ||
| 720 | + | ||
| 721 | + $('#datatable_ylb_body tbody').html(bodyHtm); | ||
| 722 | + $('.btn-jsyUpdate').on('click', jsyUpdate); | ||
| 723 | + $('.yl_sxzy').on('mouseup', yhSxzy); | ||
| 724 | + layer.close(l); | ||
| 725 | + $get('/ylb/sumYlb',params,function(returns){ | ||
| 726 | + $("#sumJzl").html(returns.jzl); | ||
| 727 | + $("#sumYh").html(returns.yh); | ||
| 728 | + $("#sumSh").html(returns.sh); | ||
| 729 | + }); | ||
| 730 | + $('input').on('input propertychange',function(){ | ||
| 731 | + var id=$(this).data('id'); | ||
| 732 | + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html(); | ||
| 733 | + if(jzl=="" || jzl ==null){ | ||
| 734 | + jzl=0; | ||
| 735 | + } | ||
| 736 | + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 737 | + if(czyl=="" || czyl==null){ | ||
| 738 | + czyl=0; | ||
| 739 | + } | ||
| 740 | + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 741 | + if(jzyl=="" || jzyl==null){ | ||
| 742 | + jzyl=0; | ||
| 743 | + } | ||
| 744 | + | ||
| 745 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val(); | ||
| 746 | + if(sh=="" || sh==null){ | ||
| 747 | + sh=0; | ||
| 748 | + } | ||
| 749 | + var addNum=accAdd(jzl,czyl); | ||
| 750 | + var subNum=jzyl; | ||
| 751 | + var sub=numSubtr(addNum*1000,subNum*1000); | ||
| 752 | + var subValue=0; | ||
| 753 | + if(sub/1000>=0){ | ||
| 754 | + subValue=sub/1000; | ||
| 755 | + } | ||
| 756 | + $('.in_carpark_yh[data-id='+id+']', '#ll_oil_list').val(subValue); | ||
| 757 | + | ||
| 758 | + }); | ||
| 759 | + $('#datatable_ylb_body_div').animate({scrollTop: '0px'}, 800); | ||
| 760 | + }); | ||
| 761 | + } | ||
| 762 | + | ||
| 763 | + | ||
| 764 | + function jsyUpdate(){ | ||
| 765 | + var params=getParamsList(); | ||
| 766 | + $get('/ylb/checkDate',params,function(status){ | ||
| 767 | + if(status=='2'){ | ||
| 768 | + layer.msg('只能操作三天内数据.'); | ||
| 769 | + }else{ | ||
| 770 | + var id = $(this).data('id'); | ||
| 771 | + var jsy=$('.in_carpark_jsy[data-id='+id+']', '#ll_oil_list').val(); | ||
| 772 | + $get('/ylb/updateJsy',{id:id,jsy:jsy}, function(result){ | ||
| 773 | + layer.msg('修改成功.'); | ||
| 774 | + page = 0; | ||
| 775 | + jsDoQuery(params, true); | ||
| 776 | + }); | ||
| 777 | + } | ||
| 778 | + }) | ||
| 779 | + | ||
| 780 | + } | ||
| 781 | + //页面计算防止精度丢失 | ||
| 782 | + var accAdd = function (a, b) { | ||
| 783 | + var c, d, e; | ||
| 784 | + try { | ||
| 785 | + c = a.toString().split(".")[1].length; | ||
| 786 | + } catch (f) { | ||
| 787 | + c = 0; | ||
| 788 | + } | ||
| 789 | + try { | ||
| 790 | + d = b.toString().split(".")[1].length; | ||
| 791 | + } catch (f) { | ||
| 792 | + d = 0; | ||
| 793 | + } | ||
| 794 | + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e; | ||
| 795 | + }; | ||
| 796 | + | ||
| 797 | + var numSubtr = function (a, b) { | ||
| 798 | + var c, d, e; | ||
| 799 | + try { | ||
| 800 | + c = a.toString().split(".")[1].length; | ||
| 801 | + } catch (f) { | ||
| 802 | + c = 0; | ||
| 803 | + } | ||
| 804 | + try { | ||
| 805 | + d = b.toString().split(".")[1].length; | ||
| 806 | + } catch (f) { | ||
| 807 | + d = 0; | ||
| 808 | + } | ||
| 809 | + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; | ||
| 810 | + }; | ||
| 811 | + | ||
| 812 | + function mul(a, b) { | ||
| 813 | + var c = 0, | ||
| 814 | + d = a.toString(), | ||
| 815 | + e = b.toString(); | ||
| 816 | + try { | ||
| 817 | + c += d.split(".")[1].length; | ||
| 818 | + } catch (f) { | ||
| 819 | + } | ||
| 820 | + try { | ||
| 821 | + c += e.split(".")[1].length; | ||
| 822 | + } catch (f) { | ||
| 823 | + } | ||
| 824 | + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); | ||
| 825 | + } | ||
| 826 | + //改变状态 | ||
| 827 | + function startOptJzylLink(es) { | ||
| 828 | + es.editable({ | ||
| 829 | + type: 'text', | ||
| 830 | + placement: 'right', | ||
| 831 | + width: 100, | ||
| 832 | + display: false, | ||
| 833 | + validate: function (value) { | ||
| 834 | + if (!value) | ||
| 835 | + return '值不能为空!'; | ||
| 836 | + if (isNaN(value)) | ||
| 837 | + return '只能为数字!'; | ||
| 838 | + if (value < 0) | ||
| 839 | + return '值不能小于0!'; | ||
| 840 | + }, | ||
| 841 | + inputclass: 'form-control input-medium input-edtable-sm' | ||
| 842 | + }) | ||
| 843 | + .on('save', function (e, params) { | ||
| 844 | + $(this).text(params.newValue); | ||
| 845 | + }); | ||
| 846 | + } | ||
| 847 | + | ||
| 848 | + //改变状态 | ||
| 849 | + function startOptShylLink(es) { | ||
| 850 | + es.editable({ | ||
| 851 | + type: 'text', | ||
| 852 | + placement: 'right', | ||
| 853 | + width: 100, | ||
| 854 | + display: false, | ||
| 855 | + validate: function (value) { | ||
| 856 | + if (!value) | ||
| 857 | + return '值不能为空!'; | ||
| 858 | + if (isNaN(value)) | ||
| 859 | + return '只能为数字!'; | ||
| 860 | + if (value < 0) | ||
| 861 | + return '值不能小于0!'; | ||
| 862 | + }, | ||
| 863 | + inputclass: 'form-control input-medium input-edtable-sm' | ||
| 864 | + }) | ||
| 865 | + .on('save', function (e, params) { | ||
| 866 | + $(this).text(params.newValue); | ||
| 867 | + }); | ||
| 868 | + } | ||
| 869 | + function iCheckChange() { | ||
| 870 | + var tr = $(this).parents('tr'); | ||
| 871 | + if (this.checked) | ||
| 872 | + tr.addClass('row-active'); | ||
| 873 | + else | ||
| 874 | + tr.removeClass('row-active'); | ||
| 875 | + } | ||
| 876 | + | ||
| 877 | + function showPagination(data) { | ||
| 878 | + //分页 | ||
| 879 | + $('#pagination').jqPaginator({ | ||
| 880 | + totalPages: data.totalPages, | ||
| 881 | + visiblePages: 6, | ||
| 882 | + currentPage: page + 1, | ||
| 883 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 884 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 885 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 886 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 887 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 888 | + onPageChange: function (num, type) { | ||
| 889 | + if (initPagination) { | ||
| 890 | + initPagination = false; | ||
| 891 | + return; | ||
| 892 | + } | ||
| 893 | + | ||
| 894 | + var params=getParamsList(); | ||
| 895 | + page = num - 1; | ||
| 896 | + jsDoQuery(params, true); | ||
| 897 | + } | ||
| 898 | + }); | ||
| 899 | + } | ||
| 900 | + | ||
| 901 | + //删除 | ||
| 902 | + $('.removeButton').on('click', function () { | ||
| 903 | + var params_=getParamsList(); | ||
| 904 | + $get('/ylb/checkDate',params_,function(status){ | ||
| 905 | + if(status=='2'){ | ||
| 906 | + layer.msg('只能操作三天内数据.'); | ||
| 907 | + }else{ | ||
| 908 | + var idArray = []; | ||
| 909 | + var x=0; | ||
| 910 | + $('input.icheck:checked').each(function(){ | ||
| 911 | + x++; | ||
| 912 | + var map ={}; | ||
| 913 | + var id=$(this).data('id'); | ||
| 914 | + map['id']=id; | ||
| 915 | + idArray.push(map); | ||
| 916 | + | ||
| 917 | + }) | ||
| 918 | + var params = {}; | ||
| 919 | + params['ids']=JSON.stringify(idArray); | ||
| 920 | + if (x==0) { | ||
| 921 | + layer.msg("请选择要删除的数据"); | ||
| 922 | + }else{ | ||
| 923 | + if(confirm('确定要删除选中的数据?')) | ||
| 924 | + { | ||
| 925 | + var i = layer.load(2); | ||
| 926 | + $post('/ylb/deleteIds', params, function (result) { | ||
| 927 | + layer.close(i); | ||
| 928 | + var params=getParamsList(); | ||
| 929 | + jsDoQuery(params, true); | ||
| 930 | + }); | ||
| 931 | + } | ||
| 932 | + } | ||
| 933 | + } | ||
| 934 | + }) | ||
| 935 | + }); | ||
| 936 | + | ||
| 937 | + $("#ylbListFgsdmId").on("change",initXl); | ||
| 938 | + function initXl(){ | ||
| 939 | + var data=[]; | ||
| 940 | + data.push({id: " ", text: "全部线路"}); | ||
| 941 | + if(fage){ | ||
| 942 | + $("#xlbm").select2("destroy").html(''); | ||
| 943 | + } | ||
| 944 | + var fgs=$('#ylbListFgsdmId').val(); | ||
| 945 | + var gs=$('#ylbListGsdmId').val(); | ||
| 946 | + for(var i=0;i<xlList.length;i++){ | ||
| 947 | + if(gs!=""){ | ||
| 948 | + if(fgs!=""){ | ||
| 949 | + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){ | ||
| 950 | + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]}); | ||
| 951 | + } | ||
| 952 | + }else{ | ||
| 953 | + if(xlList[i]["gsbm"]==gs){ | ||
| 954 | + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]}); | ||
| 955 | + } | ||
| 956 | + } | ||
| 957 | + } | ||
| 958 | + } | ||
| 959 | + initPinYinSelect2('#xlbm',data,''); | ||
| 960 | + fage=true; | ||
| 961 | + } | ||
| 962 | + | ||
| 963 | + $("#xlbm").on("change",initCl); | ||
| 964 | + function initCl(){ | ||
| 965 | + $('#nbbm').select2({ | ||
| 966 | + placeholder: '搜索车辆...', | ||
| 967 | + ajax: { | ||
| 968 | + url: '/report/carList', | ||
| 969 | + dataType: 'json', | ||
| 970 | + delay: 150, | ||
| 971 | + data: function (params) { | ||
| 972 | + return {nbbm: params.term, | ||
| 973 | + gsbm:$('#ylbListGsdmId').val(), | ||
| 974 | + fgsbm:$('#ylbListFgsdmId').val(), | ||
| 975 | + xlbm:$('#xlbm').val()}; | ||
| 976 | + }, | ||
| 977 | + processResults: function (data) { | ||
| 978 | + return { | ||
| 979 | + results: data | ||
| 980 | + }; | ||
| 981 | + }, | ||
| 982 | + cache: true | ||
| 983 | + }, | ||
| 984 | + templateResult: function (repo) { | ||
| 985 | + if (repo.loading) return repo.text; | ||
| 986 | + var h = '<span>' + repo.text + '</span>'; | ||
| 987 | + h += (repo.lineName ? ' <span class="select2-desc">' + repo.lineName + '</span>' : ''); | ||
| 988 | + return h; | ||
| 989 | + }, | ||
| 990 | + escapeMarkup: function (markup) { | ||
| 991 | + return markup; | ||
| 992 | + }, | ||
| 993 | + minimumInputLength: 1, | ||
| 994 | + templateSelection: function (repo) { | ||
| 995 | + return repo.text; | ||
| 996 | + }, | ||
| 997 | + language: { | ||
| 998 | + noResults: function () { | ||
| 999 | + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>'; | ||
| 1000 | + }, | ||
| 1001 | + inputTooShort: function (e) { | ||
| 1002 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>'; | ||
| 1003 | + }, | ||
| 1004 | + searching: function () { | ||
| 1005 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; | ||
| 1006 | + } | ||
| 1007 | + } | ||
| 1008 | + }); | ||
| 1009 | + | ||
| 1010 | + } | ||
| 1011 | +// } | ||
| 1012 | + | ||
| 1013 | + $("#cxtj").on("click", function () { | ||
| 1014 | + if ($("#rq").val() != "") { | ||
| 1015 | +// var params=getParamsList(); | ||
| 1016 | + $post('/ylb/updateHistory', {date:'2017-11-07',line:'10708',gsdm:'26',fgsdm:'1'}, function (result) { | ||
| 1017 | + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" ); | ||
| 1018 | + }); | ||
| 1019 | + } else { | ||
| 1020 | + layer.msg('请选择日期.'); | ||
| 1021 | + } | ||
| 1022 | + }); | ||
| 1023 | + | ||
| 1024 | +//导出 | ||
| 1025 | + | ||
| 1026 | + $("#export").on("click", function () { | ||
| 1027 | + if ($("#rq").val() != "") { | ||
| 1028 | + var params=getParamsList(); | ||
| 1029 | + $post('/ylb/listExport', params, function (result) { | ||
| 1030 | + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" ); | ||
| 1031 | + }); | ||
| 1032 | + } else { | ||
| 1033 | + layer.msg('请选择日期.'); | ||
| 1034 | + } | ||
| 1035 | + }); | ||
| 1036 | + | ||
| 1037 | + function checkDate(){ | ||
| 1038 | + var params=getParamsList(); | ||
| 1039 | + | ||
| 1040 | + } | ||
| 1041 | + | ||
| 1042 | + function getParamsList(){ | ||
| 1043 | + var cells = $('tr.filter')[0].cells | ||
| 1044 | + , cells1 = $('tr.filter2')[0].cells,params = {} | ||
| 1045 | + , name; | ||
| 1046 | + $.each(cells, function (i, cell) { | ||
| 1047 | + var items = $('input,select', cell); | ||
| 1048 | + for (var j = 0, item; item = items[j++];) { | ||
| 1049 | + name = $(item).attr('name'); | ||
| 1050 | + if (name) { | ||
| 1051 | + params[name] = $(item).val(); | ||
| 1052 | + } | ||
| 1053 | + } | ||
| 1054 | + }); | ||
| 1055 | + $.each(cells1, function (i, cell) { | ||
| 1056 | + var items = $('input,select', cell); | ||
| 1057 | + for (var j = 0, item; item = items[j++];) { | ||
| 1058 | + name = $(item).attr('name'); | ||
| 1059 | + if (name) { | ||
| 1060 | + params[name] = $(item).val(); | ||
| 1061 | + } | ||
| 1062 | + } | ||
| 1063 | + }); | ||
| 1064 | + | ||
| 1065 | + return params; | ||
| 1066 | + } | ||
| 1067 | + | ||
| 1068 | + //表格滚动条 | ||
| 1069 | + var modal='#ylbtable'; | ||
| 1070 | + $('#datatable_ylb_body_div', modal).perfectScrollbar({suppressScrollX: true}); | ||
| 1071 | + | ||
| 1072 | + //全选 全不选 | ||
| 1073 | + $("#selectAll").on("click", function () { | ||
| 1074 | + if ($(this).is(":checked")) { | ||
| 1075 | + $("[name=id]:checkbox").prop("checked", true); | ||
| 1076 | +// $("input[name='id']").attr('checked', true) | ||
| 1077 | + } else { | ||
| 1078 | + $("[name=id]:checkbox").prop("checked", false); | ||
| 1079 | +// $("input[name='id']").attr('checked', false); | ||
| 1080 | + } | ||
| 1081 | + }); | ||
| 1082 | + | ||
| 1083 | + | ||
| 1084 | + //键盘上下左右移动 | ||
| 1085 | + var mouseInfo={}; //存放鼠标的当前位置 | ||
| 1086 | + function yhSxzy(){ | ||
| 1087 | + tdid=$(this).attr('id'); | ||
| 1088 | + var rc=tdid.split("_"); | ||
| 1089 | + mouseInfo["row"]=rc[0]; | ||
| 1090 | + mouseInfo["col"]=rc[1]; | ||
| 1091 | + } | ||
| 1092 | + | ||
| 1093 | + document.body.onkeydown=function(e){ //监听鼠标操作 | ||
| 1094 | + e=window.event||e; | ||
| 1095 | + switch(e.keyCode){ | ||
| 1096 | + case 37: //左键 | ||
| 1097 | + moveLeft(); | ||
| 1098 | + break; | ||
| 1099 | + case 38: //向上键 | ||
| 1100 | + moveUp(); | ||
| 1101 | + break; | ||
| 1102 | + case 39: //右键 | ||
| 1103 | + moveRight(); | ||
| 1104 | + break; | ||
| 1105 | + case 40: //向下键 | ||
| 1106 | + moveDown(); | ||
| 1107 | + break; | ||
| 1108 | + default: | ||
| 1109 | + break; | ||
| 1110 | + } | ||
| 1111 | + } | ||
| 1112 | + | ||
| 1113 | + function moveLeft(){ | ||
| 1114 | + var row=mouseInfo["row"]; | ||
| 1115 | + var col=mouseInfo["col"]; | ||
| 1116 | + | ||
| 1117 | + var key=moveArray[row][col-1]; | ||
| 1118 | + if(document.getElementById(key)!=undefined) | ||
| 1119 | + { | ||
| 1120 | + var textFiled=document.getElementById(key); | ||
| 1121 | + textFiled.focus(false, 1000); | ||
| 1122 | + textFiled.select(); | ||
| 1123 | + mouseInfo["col"]=parseInt(col)-1; | ||
| 1124 | + } | ||
| 1125 | + | ||
| 1126 | + } | ||
| 1127 | + function moveRight(){ | ||
| 1128 | + var row=mouseInfo["row"]; | ||
| 1129 | + var col=mouseInfo["col"]; | ||
| 1130 | + | ||
| 1131 | + var key=moveArray[row][parseInt(col)+1]; | ||
| 1132 | + if(document.getElementById(key)!=undefined) | ||
| 1133 | + { | ||
| 1134 | + var textFiled=document.getElementById(key); | ||
| 1135 | + textFiled.focus(false, 1000); | ||
| 1136 | + textFiled.select(); | ||
| 1137 | + mouseInfo["col"]=parseInt(col)+1; | ||
| 1138 | + } | ||
| 1139 | + } | ||
| 1140 | + function moveUp(){ | ||
| 1141 | + var row=mouseInfo["row"]; | ||
| 1142 | + var col=mouseInfo["col"]; | ||
| 1143 | + | ||
| 1144 | + var key=moveArray[parseInt(row)-1][col]; | ||
| 1145 | + if(document.getElementById(key)!=undefined) | ||
| 1146 | + { | ||
| 1147 | + var textFiled=document.getElementById(key); | ||
| 1148 | + textFiled.focus(false, 1000); | ||
| 1149 | + textFiled.select(); | ||
| 1150 | + mouseInfo["row"]=parseInt(row)-1; | ||
| 1151 | + } | ||
| 1152 | + } | ||
| 1153 | + function moveDown(){ | ||
| 1154 | + var row=mouseInfo["row"]; | ||
| 1155 | + var col=mouseInfo["col"]; | ||
| 1156 | + var key=moveArray[parseInt(row)+1][col]; | ||
| 1157 | + if(document.getElementById(key)!=undefined) | ||
| 1158 | + { | ||
| 1159 | + var textFiled=document.getElementById(key); | ||
| 1160 | + textFiled.focus(false, 1000); | ||
| 1161 | + textFiled.select(); | ||
| 1162 | + mouseInfo["row"]=parseInt(row)+1; | ||
| 1163 | + } | ||
| 1164 | + } | ||
| 1165 | + | ||
| 1166 | + }); | ||
| 1167 | +</script> |