Fix for (Issue #81). Layers should be stored now correctly
This commit is contained in:
parent
dd4ce8879b
commit
6b73e4afdf
3 changed files with 5 additions and 5 deletions
|
|
@ -142,7 +142,7 @@ public class CalculationExecutionService {
|
|||
BigDecimal leadTime = null;
|
||||
|
||||
if (destination.getD2d()) {
|
||||
var containerCalculation = containerCalculationService.doCalculation(setId, premiseToHuService.createHuFromPremise(premise), ContainerType.FEU);
|
||||
var containerCalculation = containerCalculationService.doCalculation(setId, premiseToHuService.createHuFromPremise(premise), ContainerType.FEU, premise.getHuMixable());
|
||||
sections = List.of(new SectionInfo(null, routeSectionCostCalculationService.doD2dCalculation(setId, periodId, premise, destination, containerCalculation), containerCalculation));
|
||||
leadTime = BigDecimal.valueOf(destination.getLeadTimeD2d());
|
||||
usedContainerType = ContainerType.FEU;
|
||||
|
|
@ -246,7 +246,7 @@ public class CalculationExecutionService {
|
|||
|
||||
// Get container calculation
|
||||
for (var containerType : ContainerType.values()) {
|
||||
containerCalculation.put(containerType, containerCalculationService.doCalculation(setId, hu, containerType));
|
||||
containerCalculation.put(containerType, containerCalculationService.doCalculation(setId, hu, containerType, premise.getHuMixable()));
|
||||
}
|
||||
|
||||
for (var containerType : ContainerType.values()) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class ContainerCalculationService {
|
|||
* @param containerType The type of container to be loaded
|
||||
* @return ContainerCalculationResult containing loading pattern and capacity information
|
||||
*/
|
||||
public ContainerCalculationResult doCalculation(Integer setId, PackagingDimension hu, ContainerType containerType) {
|
||||
public ContainerCalculationResult doCalculation(Integer setId, PackagingDimension hu, ContainerType containerType, boolean mixable) {
|
||||
|
||||
var weightInKg = BigDecimal.valueOf(WeightUnit.KG.convertFromG(hu.getWeight()));
|
||||
var maxContainerLoad = BigDecimal.valueOf(getMaxContainerLoad(containerType, setId));
|
||||
|
|
@ -60,7 +60,7 @@ public class ContainerCalculationService {
|
|||
var solutionHorizontal = solveLayer(SolutionType.HORIZONTAL, dimensions, containerType.getLength(), containerType.getWidth());
|
||||
var solutionVertical = solveLayer(SolutionType.VERTICAL, dimensions, containerType.getWidth(), containerType.getLength());
|
||||
var bestSolution = solutionHorizontal.getTotal() < solutionVertical.getTotal() ? solutionVertical : solutionHorizontal;
|
||||
int layers = getLayerCount(dimensions, containerType);
|
||||
int layers = mixable ? getLayerCount(dimensions, containerType) : 1;
|
||||
|
||||
if(PalletType.EURO_PALLET.fitsOn(hu) && bestSolution.getTotal() < containerType.getPalletCount(PalletType.EURO_PALLET)) {
|
||||
return new ContainerCalculationResult(Math.min(containerType.getPalletCount(PalletType.EURO_PALLET)*layers,maxUnitByWeight), layers, null, (containerType.getPalletCount(PalletType.EURO_PALLET)*layers) > maxUnitByWeight, containerType, dimensions, maxContainerLoad.intValueExact());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue