用车计算逻辑调整
This commit is contained in:
parent
aa37b20015
commit
658264daad
@ -310,7 +310,7 @@ public class VehicleDemandController extends JeecgController<VehicleDemand, IVeh
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑
|
||||
* 解绑,拆分
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ -320,6 +320,10 @@ public class VehicleDemandController extends JeecgController<VehicleDemand, IVeh
|
||||
List<String> vdNoNews = vehicleDemands.stream()
|
||||
.map(VehicleDemand::getVdNo)
|
||||
.collect(Collectors.toList());
|
||||
boolean hasEven = vehicleDemands.stream().anyMatch(item -> !TmsConstants.currentStatus_1.equals(item.getCurrentStatus()));
|
||||
if (hasEven) {
|
||||
return Result.error("数据中含有不是已合并需求的数据!");
|
||||
}
|
||||
LambdaQueryWrapper<VehicleDemandHis> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(VehicleDemandHis::getVdNoNew, vdNoNews);
|
||||
List<VehicleDemandHis> list = vehicleDemandHisService.list(lambdaQueryWrapper);
|
||||
|
@ -47,6 +47,7 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
private final TmsIogisticsPriceMapper iogisticsPriceMapper;
|
||||
private final DeliveryDemandMapper deliveryDemandMapper;
|
||||
|
||||
/*//用车计算方法,根据价格选择车(tms_iogistics_price表)
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<?> carCount(VehicleDemand vehicleDemand) {
|
||||
@ -71,9 +72,9 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
// Integer: 该种车型与车长选择的数量
|
||||
Solution solution = findCheapestSolution(iogisticsPriceList, vehicleDemand.getTotalPallets());
|
||||
// 打印,方便查看,开发时可以打开
|
||||
/*for (Map.Entry<String, Integer> entry : solution.getVehicleCounts().entrySet()) {
|
||||
*//*for (Map.Entry<String, Integer> entry : solution.getVehicleCounts().entrySet()) {
|
||||
System.out.println(entry.getKey() + " 车: " + entry.getValue() + " 辆");
|
||||
}*/
|
||||
}*//*
|
||||
// 4.转化集合
|
||||
List<VehicleDemandCount> vehicleDemandCounts = convertToVehicleDemandCountList(solution.getVehicleCounts(), vehicleDemand);
|
||||
// 5.新增
|
||||
@ -83,7 +84,7 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
log.info("用车需求计算,用车需求编号:{},方案:{},费用:{}",vehicleDemand.getVdNo(),
|
||||
solution.getVehicleCounts(),solution.getTotalCost());
|
||||
return Result.OK("用车计算成功!");
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 查找费用最低的方案
|
||||
@ -177,7 +178,7 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
/*private void insertVehicleDemandCount(VehicleDemand vehicleDemand, VehiclePallet vehiclePallet, List<VehicleDemandCount> vehicleDemandCounts) {
|
||||
private void insertVehicleDemandCount(VehicleDemand vehicleDemand, VehiclePallet vehiclePallet, List<VehicleDemandCount> vehicleDemandCounts) {
|
||||
VehicleDemandCount vehicleDemandCount = new VehicleDemandCount();
|
||||
vehicleDemandCount.setVdNo(vehicleDemand.getVdNo())
|
||||
.setShipType(vehicleDemand.getShipType())
|
||||
@ -185,12 +186,16 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
.setDeliveryAddress(vehicleDemand.getDeliveryAddress())
|
||||
.setPickUpHub(vehicleDemand.getPickUpHub())
|
||||
.setCarType(vehiclePallet.getCarType())
|
||||
.setCarLong(vehiclePallet.getCarLong());
|
||||
.setSystemCarType(vehiclePallet.getCarType())
|
||||
.setCarLong(vehiclePallet.getCarLong())
|
||||
.setSystemCarLong(vehiclePallet.getCarLong());
|
||||
vehicleDemandCounts.add(vehicleDemandCount);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
/* 原来的用车计算方法
|
||||
// 用车计算方法,根据托盘数选择大车,只考虑托盘数,不考虑价格(tms_vehicle_pallet表)
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<?> carCount(VehicleDemand vehicleDemand) {
|
||||
// 1.判断是否进行过用车计算
|
||||
LambdaQueryWrapper<VehicleDemandCount> countLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@ -226,8 +231,11 @@ public class VehicleDemandServiceImpl extends ServiceImpl<VehicleDemandMapper, V
|
||||
ids.add(smallestVehicle.getId());
|
||||
insertVehicleDemandCount(vehicleDemand, smallestVehicle, vehicleDemandCounts);
|
||||
}
|
||||
// 新增
|
||||
vehicleDemandCountService.saveBatch(vehicleDemandCounts);
|
||||
// 更新发货需求当前状态
|
||||
deliveryDemandMapper.updateByVdNo(vehicleDemand.getVdNo(), TmsConstants.currentStatus_2);
|
||||
System.out.println(ids);
|
||||
return Result.OK("用车计算成功!");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.jeecg.modules.tms.outbound.vehicledemandhis.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
@ -84,7 +85,7 @@ public class VehicleDemandHis implements Serializable {
|
||||
/**总发货数量*/
|
||||
@Excel(name = "总发货数量", width = 15)
|
||||
@ApiModelProperty(value = "总发货数量")
|
||||
private Integer totalShips;
|
||||
private BigDecimal totalShips;
|
||||
/**送货区域*/
|
||||
// @Excel(name = "送货区域", width = 15)
|
||||
@ApiModelProperty(value = "送货区域")
|
||||
|
Loading…
x
Reference in New Issue
Block a user