Commit 8280bfd33e9e586a90c08da8f1c714e6196cf322

Authored by 廖磊
1 parent 6b660b21

油量计算带上一车多单,一车一单条件,行车路单传参修改,油量添加车辆,线路取消关联

src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -266,7 +266,44 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS @@ -266,7 +266,44 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS
266 List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm); 266 List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
267 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); 267 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
268 // 从排班表中计算出行驶的总里程 268 // 从排班表中计算出行驶的总里程
269 - List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); 269 + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
  270 + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
  271 +
  272 + String sxtj=map2.get("sxtj").toString();
  273 + if(sxtj.equals("0")){
  274 + listpb=listpbs;
  275 + }else{
  276 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, line,nbbm);
  277 + List<String> stringList=new ArrayList<String>();
  278 + for (int i = 0; i < objectLists.size(); i++) {
  279 + String clbm=objectLists.get(i)[0].toString();
  280 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  281 + //一车一单
  282 + if(sxtj.equals("1")){
  283 + if(cs==1){
  284 + stringList.add(clbm);
  285 + }
  286 + }
  287 + //一车多单
  288 + if(sxtj.equals("2")){
  289 + if(cs>1){
  290 + stringList.add(clbm);
  291 + }
  292 + }
  293 + }
  294 +
  295 + for (int i = 0; i < stringList.size(); i++) {
  296 + String strNbbm=stringList.get(i);
  297 + for (int j = 0; j < listpbs.size(); j++) {
  298 + Map<String, Object> map = listpbs.get(j);
  299 + String mapNbbm=map.get("clZbh").toString();
  300 + if(strNbbm.equals(mapNbbm)){
  301 + listpb.add(map);
  302 + }
  303 + }
  304 + }
  305 + }
  306 +
270 List<Ylb> addList = new ArrayList<Ylb>(); 307 List<Ylb> addList = new ArrayList<Ylb>();
271 List<Ylb> updateList = new ArrayList<Ylb>(); 308 List<Ylb> updateList = new ArrayList<Ylb>();
272 String ins=""; 309 String ins="";
@@ -443,15 +480,53 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -443,15 +480,53 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
443 List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); 480 List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm);
444 // 指定日期YLB信息 481 // 指定日期YLB信息
445 List<Ylb> ylbList =new ArrayList<Ylb>(); 482 List<Ylb> ylbList =new ArrayList<Ylb>();
  483 + List<Ylb> ylbLists =new ArrayList<Ylb>();
446 List<Ylb> iterator2=new ArrayList<Ylb>(); 484 List<Ylb> iterator2=new ArrayList<Ylb>();
447 if(xlbm.equals("")){ 485 if(xlbm.equals("")){
448 - ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); 486 + ylbLists=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
449 iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); 487 iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
450 }else{ 488 }else{
451 - ylbList=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); 489 + ylbLists=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
452 iterator2=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); 490 iterator2=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
453 } 491 }
454 492
  493 + // 从排班表中计算出行驶的总里程
  494 +
  495 + String sxtj=map.get("sxtj").toString();
  496 + if(sxtj.equals("0")){
  497 + ylbList=ylbLists;
  498 + }else{
  499 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  500 + List<String> stringList=new ArrayList<String>();
  501 + for (int i = 0; i < objectLists.size(); i++) {
  502 + String clbm=objectLists.get(i)[0].toString();
  503 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  504 + //一车一单
  505 + if(sxtj.equals("1")){
  506 + if(cs==1){
  507 + stringList.add(clbm);
  508 + }
  509 + }
  510 + //一车多单
  511 + if(sxtj.equals("2")){
  512 + if(cs>1){
  513 + stringList.add(clbm);
  514 + }
  515 + }
  516 + }
  517 +
  518 + for (int i = 0; i < stringList.size(); i++) {
  519 + String strNbbm=stringList.get(i);
  520 + for (int j = 0; j < ylbLists.size(); j++) {
  521 + Ylb y = ylbLists.get(j);
  522 + String mapNbbm=y.getNbbm();
  523 + if(strNbbm.equals(mapNbbm)){
  524 + ylbList.add(y);
  525 + }
  526 + }
  527 + }
  528 + }
  529 +
455 for (int i=0;i<ylbList.size();i++) { 530 for (int i=0;i<ylbList.size();i++) {
456 Ylb ylb = ylbList.get(i); 531 Ylb ylb = ylbList.get(i);
457 // 判断是否已经计算过 532 // 判断是否已经计算过
src/main/resources/static/pages/forms/statement/waybill.html
@@ -263,14 +263,13 @@ @@ -263,14 +263,13 @@
263 }); 263 });
264 jName = params[0].split("\\")[0]; 264 jName = params[0].split("\\")[0];
265 jGh = params[0].split("\\")[1]; 265 jGh = params[0].split("\\")[1];
266 - var id = $("#"+params[1]).val(); 266 + var id = params[3];
267 $get('/realSchedule/MapById',{id:id},function(result){ 267 $get('/realSchedule/MapById',{id:id},function(result){
268 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); 268 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
269 var ludan_1 = template('ludan_1',result); 269 var ludan_1 = template('ludan_1',result);
270 // 把渲染好的模版html文本追加到表格中 270 // 把渲染好的模版html文本追加到表格中
271 $('#forms .ludan_1').html(ludan_1); 271 $('#forms .ludan_1').html(ludan_1);
272 }); 272 });
273 - console.log(params);  
274 $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ 273 $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
275 getTime(result); 274 getTime(result);
276 var ludan_2 = template('ludan_2',{list:result}); 275 var ludan_2 = template('ludan_2',{list:result});
@@ -336,7 +335,8 @@ @@ -336,7 +335,8 @@
336 <tr> 335 <tr>
337 <td width="45%">{{obj[4]}}\{{obj[1]}}</td> 336 <td width="45%">{{obj[4]}}\{{obj[1]}}</td>
338 <td width="32%">{{obj[2]}}</td> 337 <td width="32%">{{obj[2]}}</td>
339 - <td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td> 338 + <td width="20%">{{obj[3]}}</td>
  339 + <td width="3%" hidden="true">{{obj[0]}}</td>
340 </tr> 340 </tr>
341 {{/each}} 341 {{/each}}
342 {{if list.length == 0}} 342 {{if list.length == 0}}
@@ -348,9 +348,11 @@ @@ -348,9 +348,11 @@
348 <script type="text/html" id="list_info_px"> 348 <script type="text/html" id="list_info_px">
349 {{each list as obj i}} 349 {{each list as obj i}}
350 <tr> 350 <tr>
  351 +
351 <td width="45%">{{obj.jName}}\{{obj.jGh}}</td> 352 <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
352 <td width="32%">{{obj.clZbh}}</td> 353 <td width="32%">{{obj.clZbh}}</td>
353 - <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td> 354 + <td width="23%">{{obj.lpName}}</td>
  355 + <td hidden="true">{{obj.id}}</td>
354 </tr> 356 </tr>
355 {{/each}} 357 {{/each}}
356 {{if list.length == 0}} 358 {{if list.length == 0}}
src/main/resources/static/pages/oil/add.html
@@ -259,7 +259,8 @@ @@ -259,7 +259,8 @@
259 return{nbbm: params.term, 259 return{nbbm: params.term,
260 gsbm:$('#ssgsdm').val(), 260 gsbm:$('#ssgsdm').val(),
261 fgsbm:$('#fgsdm').val(), 261 fgsbm:$('#fgsdm').val(),
262 - xlbm:$('#xlbm').val()}; 262 + xlbm:""
  263 + };
263 }, 264 },
264 processResults: function (data) { 265 processResults: function (data) {
265 return { 266 return {