Commit dae9d7818bb8af127a038cb86c7291628aa4fd2f

Authored by 廖磊
1 parent 6d0f7a97

油量页面输入自动计算,加油管理显示总油量,计划空驶修改

src/main/java/com/bsth/entity/oil/Ylxxb.java
@@ -45,6 +45,9 @@ public class Ylxxb { @@ -45,6 +45,9 @@ public class Ylxxb {
45 @Transient 45 @Transient
46 private String fgsname; 46 private String fgsname;
47 47
  48 + @Transient
  49 + private Double zjzl;
  50 +
48 51
49 public Integer getId() { 52 public Integer getId() {
50 return id; 53 return id;
@@ -184,5 +187,13 @@ public class Ylxxb { @@ -184,5 +187,13 @@ public class Ylxxb {
184 public void setFgsname(String fgsname) { 187 public void setFgsname(String fgsname) {
185 this.fgsname = fgsname; 188 this.fgsname = fgsname;
186 } 189 }
  190 + public Double getZjzl() {
  191 + return zjzl;
  192 + }
  193 + public void setZjzl(Double zjzl) {
  194 + this.zjzl = zjzl;
  195 + }
  196 +
  197 +
187 198
188 } 199 }
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
@@ -20,7 +20,7 @@ public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{ @@ -20,7 +20,7 @@ public interface YlxxbRepository extends BaseRepository<Ylxxb, Integer>{
20 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2 and gsdm like %?3%",nativeQuery=true) 20 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2 and gsdm like %?3%",nativeQuery=true)
21 List<Ylxxb> obtainYlxx(String rq,int nylx,String gsdm); 21 List<Ylxxb> obtainYlxx(String rq,int nylx,String gsdm);
22 22
23 - @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and ssgs=?2",nativeQuery=true) 23 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and gsdm=?2",nativeQuery=true)
24 List<Ylxxb> checkYlxx(String rq,String gs); 24 List<Ylxxb> checkYlxx(String rq,String gs);
25 25
26 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nbbm =?2 and jylx=1",nativeQuery=true) 26 @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nbbm =?2 and jylx=1",nativeQuery=true)
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
@@ -31,6 +31,7 @@ import com.bsth.repository.oil.CwjyRepository; @@ -31,6 +31,7 @@ import com.bsth.repository.oil.CwjyRepository;
31 import com.bsth.repository.oil.YlxxbRepository; 31 import com.bsth.repository.oil.YlxxbRepository;
32 import com.bsth.service.impl.BaseServiceImpl; 32 import com.bsth.service.impl.BaseServiceImpl;
33 import com.bsth.service.oil.CwjyService; 33 import com.bsth.service.oil.CwjyService;
  34 +import com.bsth.util.Arith;
34 import com.bsth.util.PageHelper; 35 import com.bsth.util.PageHelper;
35 import com.bsth.util.PageObject; 36 import com.bsth.util.PageObject;
36 37
@@ -314,7 +315,19 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw @@ -314,7 +315,19 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
314 return t; 315 return t;
315 } 316 }
316 }); 317 });
317 - 318 + List<Ylxxb> list= ylxxbRepository.checkYlxx(rq, gsdm);
  319 + for (int i = 0; i < yList.size(); i++) {
  320 + Ylxxb t=yList.get(i);
  321 + Double zjzl=0.0;
  322 + for (int j = 0; j < list.size(); j++) {
  323 + Ylxxb y=list.get(j);
  324 + if(t.getNbbm().equals(y.getNbbm())){
  325 + zjzl=Arith.add(zjzl, y.getJzl());
  326 + }
  327 +
  328 + }
  329 + t.setZjzl(zjzl);
  330 + }
318 return yList; 331 return yList;
319 } 332 }
320 333
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -529,11 +529,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -529,11 +529,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{
529 if(!scheduleRealInfo.isSflj()){ 529 if(!scheduleRealInfo.isSflj()){
530 if (scheduleRealInfo.getBcType().equals("in") 530 if (scheduleRealInfo.getBcType().equals("in")
531 || scheduleRealInfo.getBcType().equals("out")|| scheduleRealInfo.getBcType().equals("ldks")) { 531 || scheduleRealInfo.getBcType().equals("out")|| scheduleRealInfo.getBcType().equals("ldks")) {
532 - double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();  
533 - if(jhlcOrig-scheduleRealInfo.getJhlc()>0){ 532 + if(!scheduleRealInfo.isSflj()){
534 jcclc =Arith.add(jcclc, scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig()); 533 jcclc =Arith.add(jcclc, scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig());
535 - }else{  
536 - jcclc =Arith.add(jcclc, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());  
537 } 534 }
538 } 535 }
539 } 536 }
src/main/resources/static/pages/oil/jyglList.html
@@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
69 <th width="3%">油价</th> 69 <th width="3%">油价</th>
70 <th width="4%">路单工号</th> 70 <th width="4%">路单工号</th>
71 <th width="4%">备注</th> 71 <th width="4%">备注</th>
72 - <th width="10%">操作</th> 72 + <th width="10%">总加注量</th>
73 </tr> 73 </tr>
74 <tr role="row" class="filter"> 74 <tr role="row" class="filter">
75 <td></td> 75 <td></td>
@@ -160,7 +160,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -160,7 +160,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
160 type="text" value="{{obj.bz}}" style=" width:45px" /> 160 type="text" value="{{obj.bz}}" style=" width:45px" />
161 </td> 161 </td>
162 <td> 162 <td>
163 - <!--<a class="btn btn-sm blue btn-outline" onclick="editCyjy('{{obj.nbbm}}')" data-pjax><i class="fa fa-edit"></i> 编辑</a>--> 163 + {{obj.zjzl}}
164 </td> 164 </td>
165 </tr> 165 </tr>
166 {{/each}} 166 {{/each}}
@@ -200,7 +200,6 @@ $(function(){ @@ -200,7 +200,6 @@ $(function(){
200 params['fgsbm']=$("#jyglListFgsdmId").val(); 200 params['fgsbm']=$("#jyglListFgsdmId").val();
201 params['rq']=$("#rq").val(); 201 params['rq']=$("#rq").val();
202 var i = layer.load(2); 202 var i = layer.load(2);
203 - console.log(params);  
204 $post('/cwjy/savejzl', params, function(){ 203 $post('/cwjy/savejzl', params, function(){
205 layer.close(i); 204 layer.close(i);
206 var cells = $('tr.filter')[0].cells 205 var cells = $('tr.filter')[0].cells
@@ -316,7 +315,7 @@ $(function(){ @@ -316,7 +315,7 @@ $(function(){
316 params['page'] = page; 315 params['page'] = page;
317 params['rq']=$("#rq").val(); 316 params['rq']=$("#rq").val();
318 317
319 - var i = 2; 318 + var i = layer.load(2);;
320 /* var jyglGsdm=$("#jyglListGsdmId").val(); 319 /* var jyglGsdm=$("#jyglListGsdmId").val();
321 var jyglFgsdm=$("#jyglListFgsdmId").val(); 320 var jyglFgsdm=$("#jyglListFgsdmId").val();
322 if(jyglGsdm=="" || jyglGsdm==null){ 321 if(jyglGsdm=="" || jyglGsdm==null){
@@ -340,7 +339,6 @@ $(function(){ @@ -340,7 +339,6 @@ $(function(){
340 $.each(data, function(i, obj) { 339 $.each(data, function(i, obj) {
341 obj.yyrq = $("#rq").val(); 340 obj.yyrq = $("#rq").val();
342 }); 341 });
343 - console.log(data)  
344 var bodyHtm = template('jygl_list_temp', {list: data}); 342 var bodyHtm = template('jygl_list_temp', {list: data});
345 $('#datatable_cwjy tbody').html(bodyHtm); 343 $('#datatable_cwjy tbody').html(bodyHtm);
346 iCheckChange(); 344 iCheckChange();
src/main/resources/static/pages/oil/list_ph.html
@@ -229,7 +229,9 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -229,7 +229,9 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
229 onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"> 229 onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
230 </td> 230 </td>
231 <td> 231 <td>
232 - {{obj.yh}} 232 +
  233 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_yh"
  234 + type="text" value="{{obj.yh}}" style=" width:50px" disabled="true" readOnly="true" />
233 </td> 235 </td>
234 <td> 236 <td>
235 <select data-id="{{obj.id}}" class="in_carpark_rylx" style=" width:80px" > 237 <select data-id="{{obj.id}}" class="in_carpark_rylx" style=" width:80px" >
@@ -319,7 +321,6 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -319,7 +321,6 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
319 } 321 }
320 }); 322 });
321 323
322 -  
323 //保存 324 //保存
324 $("#saveButton").on('click',function(){ 325 $("#saveButton").on('click',function(){
325 var ylArray = []; 326 var ylArray = [];
@@ -627,9 +628,83 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -627,9 +628,83 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
627 }); 628 });
628 // startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); 629 // startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
629 // startOptShylLink($('#ll_oil_list .in_carpark_shyl')); 630 // startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
  631 + $('input').on('input propertychange',function(){
  632 + var id=$(this).data('id');
  633 + var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html();
  634 + if(jzl=="" || jzl ==null){
  635 + jzl=0;
  636 + }
  637 + var czyl=$('.in_carpark_czyl[data-id='+id+']', '#ll_oil_list').val();
  638 + if(czyl=="" || czyl==null){
  639 + czyl=0;
  640 + }
  641 + var jzyl=$('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').val();
  642 + if(jzyl=="" || jzyl==null){
  643 + jzyl=0;
  644 + }
  645 +
  646 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').val();
  647 + if(sh=="" || sh==null){
  648 + sh=0;
  649 + }
  650 + var addNum=accAdd(jzl,czyl);
  651 + var subNum=accAdd(jzyl,sh);
  652 + var sub=numSubtr(addNum*1000,subNum*1000);
  653 + var subValue=0;
  654 + if(sub/1000>=0){
  655 + subValue=sub/1000;
  656 + }
  657 + $('.in_carpark_yh[data-id='+id+']', '#ll_oil_list').val(subValue);
  658 +
  659 + });
630 }); 660 });
631 } 661 }
  662 +
  663 + //页面计算防止精度丢失
  664 + var accAdd = function (a, b) {
  665 + var c, d, e;
  666 + try {
  667 + c = a.toString().split(".")[1].length;
  668 + } catch (f) {
  669 + c = 0;
  670 + }
  671 + try {
  672 + d = b.toString().split(".")[1].length;
  673 + } catch (f) {
  674 + d = 0;
  675 + }
  676 + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
  677 + };
632 678
  679 + var numSubtr = function (a, b) {
  680 + var c, d, e;
  681 + try {
  682 + c = a.toString().split(".")[1].length;
  683 + } catch (f) {
  684 + c = 0;
  685 + }
  686 + try {
  687 + d = b.toString().split(".")[1].length;
  688 + } catch (f) {
  689 + d = 0;
  690 + }
  691 + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e;
  692 + };
  693 +
  694 + function mul(a, b) {
  695 + var c = 0,
  696 + d = a.toString(),
  697 + e = b.toString();
  698 + try {
  699 + c += d.split(".")[1].length;
  700 + } catch (f) {
  701 + }
  702 + try {
  703 + c += e.split(".")[1].length;
  704 + } catch (f) {
  705 + }
  706 + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
  707 + }
633 //改变状态 708 //改变状态
634 function startOptJzylLink(es) { 709 function startOptJzylLink(es) {
635 es.editable({ 710 es.editable({