commit
8be5f34137
3 changed files with 27 additions and 7 deletions
|
|
@ -10,7 +10,7 @@
|
|||
<PhCaretLeft :size="18" /> Previous
|
||||
</button>
|
||||
|
||||
<!-- First helppages -->
|
||||
<!-- First pages -->
|
||||
<button
|
||||
v-if="showFirstPage"
|
||||
class="pagination-btn page-number"
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<!-- First ellipsis -->
|
||||
<span v-if="showFirstEllipsis" class="ellipsis">...</span>
|
||||
|
||||
<!-- Page numbers around current helppages -->
|
||||
<!-- Page numbers around current pages -->
|
||||
<button
|
||||
v-for="pageNum in visiblePages"
|
||||
:key="pageNum"
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<!-- Last ellipsis -->
|
||||
<span v-if="showLastEllipsis" class="ellipsis">...</span>
|
||||
|
||||
<!-- Last helppages -->
|
||||
<!-- Last pages -->
|
||||
<button
|
||||
v-if="showLastPage"
|
||||
class="pagination-btn page-number"
|
||||
|
|
@ -90,7 +90,7 @@ export default {
|
|||
default: 5
|
||||
}
|
||||
},
|
||||
emits: ['helppages-change'],
|
||||
emits: ['page-change'],
|
||||
computed: {
|
||||
visiblePages() {
|
||||
const delta = Math.floor(this.maxVisiblePages / 2);
|
||||
|
|
@ -130,7 +130,7 @@ export default {
|
|||
methods: {
|
||||
goToPage(pageNumber) {
|
||||
if (pageNumber >= 1 && pageNumber <= this.pageCount && pageNumber !== this.page) {
|
||||
this.$emit('helppages-change', pageNumber);
|
||||
this.$emit('page-change', pageNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,6 +177,12 @@ public class PremisesService {
|
|||
premissIds.forEach(id -> {
|
||||
|
||||
var old = premiseRepository.getPremiseById(id).orElseThrow();
|
||||
|
||||
|
||||
var existingPremises = premiseRepository.findByMaterialIdAndSupplierId(old.getMaterialId(), old.getSupplierNodeId(), old.getUserSupplierNodeId(), userId);
|
||||
var existingDrafts = existingPremises.stream().filter(p -> p.getState().equals(PremiseState.DRAFT)).toList();
|
||||
this.delete(existingDrafts.stream().map(Premise::getId).toList());
|
||||
|
||||
var newId = premiseRepository.insert(old.getMaterialId(), old.getSupplierNodeId(), old.getUserSupplierNodeId(), BigDecimal.valueOf(old.getLocation().getLatitude()), BigDecimal.valueOf(old.getLocation().getLongitude()), old.getCountryId(), userId);
|
||||
|
||||
premiseRepository.updateMaterial(Collections.singletonList(newId), old.getHsCode(), old.getTariffRate(), old.getTariffUnlocked());
|
||||
|
|
|
|||
|
|
@ -142,12 +142,14 @@ public class CalculationExecutionService {
|
|||
CalculationJobDestination destinationCalculationJob = new CalculationJobDestination();
|
||||
boolean hasMainRun = true;
|
||||
BigDecimal leadTime = null;
|
||||
boolean isWeightExceeded = false;
|
||||
|
||||
if (destination.getD2d()) {
|
||||
selectedContainerCalculation = containerCalculationService.doCalculation(setId, premiseToHuService.createHuFromPremise(premise), ContainerType.FEU, premise.getHuMixable(), premise.getHuStackable());
|
||||
sections = List.of(new SectionInfo(null, routeSectionCostCalculationService.doD2dCalculation(setId, periodId, premise, destination, selectedContainerCalculation), selectedContainerCalculation));
|
||||
leadTime = BigDecimal.valueOf(destination.getLeadTimeD2d());
|
||||
usedContainerType = ContainerType.FEU;
|
||||
isWeightExceeded = sections.getFirst().result().isWeightPrice();
|
||||
} else {
|
||||
var bestContainerTypeResult = getSectionsFromBestContainerType(setId, periodId, destination, premise);
|
||||
sections = bestContainerTypeResult.sections;
|
||||
|
|
@ -162,6 +164,17 @@ public class CalculationExecutionService {
|
|||
s.result().setPreRun(false);
|
||||
s.result().setPostRun(false);
|
||||
});
|
||||
|
||||
var containerSections = sections.stream().filter(s -> s.section().getRateType() != RateType.MATRIX).toList();
|
||||
|
||||
if(containerSections.size() > 1) {
|
||||
isWeightExceeded = containerSections.stream().anyMatch(s -> s.result().isWeightPrice());
|
||||
} else {
|
||||
isWeightExceeded = sections.getFirst().result().isWeightPrice();
|
||||
}
|
||||
|
||||
} else {
|
||||
isWeightExceeded = sections.stream().map(SectionInfo::result).filter(CalculationJobRouteSection::getMainRun).anyMatch(CalculationJobRouteSection::isWeightPrice);
|
||||
}
|
||||
|
||||
selectedContainerCalculation = bestContainerTypeResult.selectedContainerCalculation;
|
||||
|
|
@ -207,7 +220,7 @@ public class CalculationExecutionService {
|
|||
destinationCalculationJob.setAnnualCustomCost(customCost.getAnnualCost());
|
||||
|
||||
destinationCalculationJob.setAnnualTransportationCost(sections.stream().map(SectionInfo::result).map(CalculationJobRouteSection::getAnnualCost).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
destinationCalculationJob.setTransportWeightExceeded(sections.stream().map(SectionInfo::result).filter(CalculationJobRouteSection::getMainRun).anyMatch(CalculationJobRouteSection::isWeightPrice));
|
||||
destinationCalculationJob.setTransportWeightExceeded(isWeightExceeded);
|
||||
destinationCalculationJob.setLayerCount(sections.getFirst().containerResult().getLayer());
|
||||
destinationCalculationJob.setLayerStructure(null); //TODO generate layer structure
|
||||
destinationCalculationJob.setHuCount(sections.getFirst().containerResult().getHuUnitCount());
|
||||
|
|
@ -216,10 +229,11 @@ public class CalculationExecutionService {
|
|||
|
||||
|
||||
double huAnnualAmount = BigDecimal.valueOf(destination.getAnnualAmount()).divide(BigDecimal.valueOf(premise.getHuUnitCount()),4, RoundingMode.UP ).doubleValue();
|
||||
destinationCalculationJob.setShippingFrequency(Double.valueOf(shippingFrequencyCalculationService.doCalculation(setId, huAnnualAmount, selectedContainerCalculation.getHuPerContainer(),!premise.getHuMixable())).intValue());
|
||||
destinationCalculationJob.setShippingFrequency((int) Math.round(shippingFrequencyCalculationService.doCalculation(setId, huAnnualAmount, selectedContainerCalculation.getHuPerContainer(), !premise.getHuMixable())));
|
||||
|
||||
var commonCost = destinationCalculationJob.getAnnualHandlingCost()
|
||||
.add(destinationCalculationJob.getAnnualDisposalCost())
|
||||
.add(destinationCalculationJob.getAnnualRepackingCost())
|
||||
.add(destinationCalculationJob.getAnnualCapitalCost())
|
||||
.add(destinationCalculationJob.getAnnualStorageCost())
|
||||
.add(materialCost.multiply(BigDecimal.valueOf(destination.getAnnualAmount())))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue