Search in sources :

Example 1 with ProductMaterialType

use of com.qcadoo.mes.technologies.dto.ProductMaterialType in project mes by qcadoo.

the class ProductQuantitiesServiceImplBPCOverrideUtil method fillNonComponents.

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));
        Entity productInputType = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_INPUT_PRODUCT_TYPE);
        Entity attribute = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ATTRIBUTE);
        OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productInputType, attribute, productionCountingQuantity, entityType, productMaterialType);
        nonComponents.add(operationProductComponentHolder);
    }
}
Also used : OperationProductComponentHolder(com.qcadoo.mes.technologies.dto.OperationProductComponentHolder) Entity(com.qcadoo.model.api.Entity) ProductMaterialType(com.qcadoo.mes.technologies.dto.ProductMaterialType) OperationProductComponentEntityType(com.qcadoo.mes.technologies.dto.OperationProductComponentEntityType)

Example 2 with ProductMaterialType

use of com.qcadoo.mes.technologies.dto.ProductMaterialType in project mes by qcadoo.

the class ProductQuantitiesServiceImplBPCOverrideUtil method getProductComponentWithQuantities.

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));
        Entity productInputType = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_INPUT_PRODUCT_TYPE);
        Entity attribute = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ATTRIBUTE);
        OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productInputType, attribute, productionCountingQuantity, entityType, productMaterialType);
        productComponentWithQuantities.put(operationProductComponentHolder, plannedQuantity);
    }
    return productComponentWithQuantities;
}
Also used : OperationProductComponentHolder(com.qcadoo.mes.technologies.dto.OperationProductComponentHolder) Entity(com.qcadoo.model.api.Entity) ProductMaterialType(com.qcadoo.mes.technologies.dto.ProductMaterialType) OperationProductComponentWithQuantityContainer(com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer) OperationProductComponentEntityType(com.qcadoo.mes.technologies.dto.OperationProductComponentEntityType) BigDecimal(java.math.BigDecimal)

Aggregations

OperationProductComponentEntityType (com.qcadoo.mes.technologies.dto.OperationProductComponentEntityType)2 OperationProductComponentHolder (com.qcadoo.mes.technologies.dto.OperationProductComponentHolder)2 ProductMaterialType (com.qcadoo.mes.technologies.dto.ProductMaterialType)2 Entity (com.qcadoo.model.api.Entity)2 OperationProductComponentWithQuantityContainer (com.qcadoo.mes.technologies.dto.OperationProductComponentWithQuantityContainer)1 BigDecimal (java.math.BigDecimal)1