private void fillNonComponents(final Set<OperationProductComponentHolder> nonComponents, final Entity order) { List<Entity> productionCountingQuantities = dataDefinitionService .get(BasicProductionCountingConstants.PLUGIN_IDENTIFIER, BasicProductionCountingConstants.MODEL_PRODUCTION_COUNTING_QUANTITY).find() .add(SearchRestrictions.belongsTo(ProductionCountingQuantityFields.ORDER, order)) .add(SearchRestrictions.eq(ProductionCountingQuantityFields.IS_NON_COMPONENT, true)).list().getEntities(); for (Entity productionCountingQuantity : productionCountingQuantities) { Entity technologyOperationComponent = productionCountingQuantity .getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT); Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT); String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE); OperationProductComponentEntityType entityType = getEntityType(role); ProductMaterialType productMaterialType = ProductMaterialType.parseString( productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL)); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productionCountingQuantity, entityType, productMaterialType); nonComponents.add(operationProductComponentHolder); } }
private OperationProductComponentWithQuantityContainer getProductComponentWithQuantities(final Entity order) { OperationProductComponentWithQuantityContainer productComponentWithQuantities = new OperationProductComponentWithQuantityContainer(); List<Entity> productionCountingQuantities = dataDefinitionService .get(BasicProductionCountingConstants.PLUGIN_IDENTIFIER, BasicProductionCountingConstants.MODEL_PRODUCTION_COUNTING_QUANTITY).find() .add(SearchRestrictions.belongsTo(ProductionCountingQuantityFields.ORDER, order)).list().getEntities(); for (Entity productionCountingQuantity : productionCountingQuantities) { Entity technologyOperationComponent = productionCountingQuantity .getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT); Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT); String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE); BigDecimal plannedQuantity = productionCountingQuantity .getDecimalField(ProductionCountingQuantityFields.PLANNED_QUANTITY); OperationProductComponentEntityType entityType = getEntityType(role); ProductMaterialType productMaterialType = ProductMaterialType.parseString(productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL)); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productionCountingQuantity, entityType, productMaterialType); productComponentWithQuantities.put(operationProductComponentHolder, plannedQuantity); } return productComponentWithQuantities; }