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 266 List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
267 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 307 List<Ylb> addList = new ArrayList<Ylb>();
271 308 List<Ylb> updateList = new ArrayList<Ylb>();
272 309 String ins="";
... ... @@ -443,15 +480,53 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
443 480 List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm);
444 481 // 指定日期YLB信息
445 482 List<Ylb> ylbList =new ArrayList<Ylb>();
  483 + List<Ylb> ylbLists =new ArrayList<Ylb>();
446 484 List<Ylb> iterator2=new ArrayList<Ylb>();
447 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 487 iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
450 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 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 530 for (int i=0;i<ylbList.size();i++) {
456 531 Ylb ylb = ylbList.get(i);
457 532 // 判断是否已经计算过
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -263,14 +263,13 @@
263 263 });
264 264 jName = params[0].split("\\")[0];
265 265 jGh = params[0].split("\\")[1];
266   - var id = $("#"+params[1]).val();
  266 + var id = params[3];
267 267 $get('/realSchedule/MapById',{id:id},function(result){
268 268 result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
269 269 var ludan_1 = template('ludan_1',result);
270 270 // 把渲染好的模版html文本追加到表格中
271 271 $('#forms .ludan_1').html(ludan_1);
272 272 });
273   - console.log(params);
274 273 $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
275 274 getTime(result);
276 275 var ludan_2 = template('ludan_2',{list:result});
... ... @@ -336,7 +335,8 @@
336 335 <tr>
337 336 <td width="45%">{{obj[4]}}\{{obj[1]}}</td>
338 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 340 </tr>
341 341 {{/each}}
342 342 {{if list.length == 0}}
... ... @@ -348,9 +348,11 @@
348 348 <script type="text/html" id="list_info_px">
349 349 {{each list as obj i}}
350 350 <tr>
  351 +
351 352 <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
352 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 356 </tr>
355 357 {{/each}}
356 358 {{if list.length == 0}}
... ...
src/main/resources/static/pages/oil/add.html
... ... @@ -259,7 +259,8 @@
259 259 return{nbbm: params.term,
260 260 gsbm:$('#ssgsdm').val(),
261 261 fgsbm:$('#fgsdm').val(),
262   - xlbm:$('#xlbm').val()};
  262 + xlbm:""
  263 + };
263 264 },
264 265 processResults: function (data) {
265 266 return {
... ...