use of com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer in project mes by qcadoo.
the class ProductQuantitiesWithComponentsServiceImpl method getProductComponentWithQuantitiesForTechnology.
@Override
public OperationProductComponentWithQuantityContainer getProductComponentWithQuantitiesForTechnology(final Entity technology, final BigDecimal givenQuantity, final Map<Long, BigDecimal> operationRuns, final Set<OperationProductComponentHolder> nonComponents) {
OperationProductComponentWithQuantityContainer operationProductComponentWithQuantityContainer = new OperationProductComponentWithQuantityContainer();
EntityTree operationComponents = productStructureTreeService.getOperationComponentsFromTechnology(technology);
technology.setField(TechnologyFields.OPERATION_COMPONENTS, EntityTreeUtilsService.getDetachedEntityTree(operationComponents));
Entity root = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS).getRoot();
Map<Long, Entity> entitiesById = new LinkedHashMap<>();
for (Entity entity : operationComponents) {
entitiesById.put(entity.getId(), entity);
}
if (root != null) {
productQuantitiesService.preloadProductQuantitiesAndOperationRuns(operationComponents, operationProductComponentWithQuantityContainer, operationRuns);
productQuantitiesService.traverseProductQuantitiesAndOperationRuns(technology, entitiesById, givenQuantity, root, null, operationProductComponentWithQuantityContainer, nonComponents, operationRuns);
}
return operationProductComponentWithQuantityContainer;
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer in project mes by qcadoo.
the class WorkPlansColumnFiller method getValues.
@Override
public Map<Entity, Map<String, String>> getValues(final List<Entity> orders) {
Map<Entity, Map<String, String>> values = new HashMap<>();
for (Entity order : orders) {
OperationProductComponentWithQuantityContainer productQuantities = productQuantitiesService.getProductComponentQuantities(order);
Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
fillProductNames(technology, values);
fillPlannedQuantities(technology, productQuantities, values);
}
return values;
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer in project mes by qcadoo.
the class MrpAlgorithmStrategyTSTest method init.
@Before
public void init() {
algorithmStrategyTS = new MrpAlgorithmStrategyTS();
MockitoAnnotations.initMocks(this);
ReflectionTestUtils.setField(algorithmStrategyTS, "productQuantitiesService", productQuantitiesService);
EntityList opComp1InComp = mockEntityListIterator(asList(productInComponent1, productInComponent3));
EntityList opComp1OutComp = mockEntityListIterator(asList(productOutComponent2));
EntityList opComp2InComp = mockEntityListIterator(asList(productInComponent2));
EntityList opComp2OutComp = mockEntityListIterator(asList(productOutComponent4));
when(operComp1.getHasManyField("operationProductInComponents")).thenReturn(opComp1InComp);
when(operComp1.getHasManyField("operationProductOutComponents")).thenReturn(opComp1OutComp);
when(operComp2.getHasManyField("operationProductInComponents")).thenReturn(opComp2InComp);
when(operComp2.getHasManyField("operationProductOutComponents")).thenReturn(opComp2OutComp);
when(productInComponent1.getField("quantity")).thenReturn(new BigDecimal(5));
when(productInComponent3.getField("quantity")).thenReturn(BigDecimal.ONE);
when(productOutComponent2.getField("quantity")).thenReturn(BigDecimal.ONE);
when(productInComponent2.getField("quantity")).thenReturn(new BigDecimal(2));
when(productOutComponent4.getField("quantity")).thenReturn(BigDecimal.ONE);
productComponentQuantities = new OperationProductComponentWithQuantityContainer();
nonComponents = Sets.newHashSet();
productComponentQuantities.put(productInComponent1, new BigDecimal(5));
productComponentQuantities.put(productInComponent3, BigDecimal.ONE);
productComponentQuantities.put(productOutComponent2, BigDecimal.ONE);
productComponentQuantities.put(productOutComponent4, BigDecimal.ONE);
productComponentQuantities.put(productInComponent2, new BigDecimal(2));
nonComponents.add(new OperationProductComponentHolder(productInComponent2));
when(product1.getId()).thenReturn(1L);
when(product2.getId()).thenReturn(2L);
when(product3.getId()).thenReturn(3L);
when(product4.getId()).thenReturn(4L);
when(productInComponent1.getBelongsToField("product")).thenReturn(product1);
when(productInComponent2.getBelongsToField("product")).thenReturn(product2);
when(productInComponent3.getBelongsToField("product")).thenReturn(product3);
when(productOutComponent2.getBelongsToField("product")).thenReturn(product2);
when(productOutComponent4.getBelongsToField("product")).thenReturn(product4);
when(productInComponent1.getBelongsToField("operationComponent")).thenReturn(operComp1);
when(productInComponent3.getBelongsToField("operationComponent")).thenReturn(operComp1);
when(productOutComponent2.getBelongsToField("operationComponent")).thenReturn(operComp1);
when(productInComponent2.getBelongsToField("operationComponent")).thenReturn(operComp2);
when(productOutComponent4.getBelongsToField("operationComponent")).thenReturn(operComp2);
when(ddIn.getName()).thenReturn("productInComponent");
when(ddOut.getName()).thenReturn("productOutComponent");
when(productInComponent1.getDataDefinition()).thenReturn(ddIn);
when(productInComponent2.getDataDefinition()).thenReturn(ddIn);
when(productInComponent3.getDataDefinition()).thenReturn(ddIn);
when(productOutComponent2.getDataDefinition()).thenReturn(ddOut);
when(productOutComponent4.getDataDefinition()).thenReturn(ddOut);
when(ddIn.getName()).thenReturn("operationProductInComponent");
when(ddOut.getName()).thenReturn("operationProductOutComponent");
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer in project mes by qcadoo.
the class OrderRealizationTimeServiceImpl method getQuantityCyclesNeededToProducedNextOperationAfterProducedQuantity.
private BigDecimal getQuantityCyclesNeededToProducedNextOperationAfterProducedQuantity(final Entity operationComponent, final BigDecimal nextOperationAfterProducedQuantity) {
MathContext mc = numberService.getMathContext();
Entity technology = operationComponent.getBelongsToField(TECHNOLOGY);
Map<Long, BigDecimal> operationRunsFromProductionQuantities = Maps.newHashMap();
OperationProductComponentWithQuantityContainer productQuantities = productQuantitiesService.getProductComponentQuantities(technology, BigDecimal.ONE, operationRunsFromProductionQuantities);
BigDecimal operationsRunsForOneMainProduct = operationRunsFromProductionQuantities.get(operationComponent.getId());
BigDecimal quantityOutputProductProduced = productQuantities.get(getOutputProduct(operationComponent));
BigDecimal cycles = operationsRunsForOneMainProduct.multiply(nextOperationAfterProducedQuantity, mc).divide(quantityOutputProductProduced, mc);
return numberService.setScaleWithDefaultMathContext(cycles);
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer in project mes by qcadoo.
the class OrderRealizationTimeServiceImpl method estimateMaxOperationTimeConsumptionForWorkstation.
@Override
@Transactional
public int estimateMaxOperationTimeConsumptionForWorkstation(final Entity order, final EntityTreeNode operationComponent, final BigDecimal plannedQuantity, final boolean includeTpz, final boolean includeAdditionalTime, final Entity productionLine) {
Entity technology = operationComponent.getBelongsToField(TECHNOLOGY);
Map<Long, BigDecimal> operationRunsFromProductionQuantities = Maps.newHashMap();
OperationProductComponentWithQuantityContainer productComponentQuantities = productQuantitiesService.getProductComponentQuantities(technology, plannedQuantity, operationRunsFromProductionQuantities);
return evaluateOperationTime(order, operationComponent, includeTpz, includeAdditionalTime, operationRunsFromProductionQuantities, productionLine, true, productComponentQuantities);
}
Aggregations