use of com.qcadoo.mes.technologies.dto.OperationProductComponentHolder in project mes by qcadoo.
the class BasicProductionCountingServiceImpl method updateProductionCountingQuantities.
private void updateProductionCountingQuantities(final Entity order, final OperationProductComponentWithQuantityContainer productComponentQuantities, final Set<OperationProductComponentHolder> nonComponents) {
for (Entry<OperationProductComponentHolder, BigDecimal> productComponentQuantity : productComponentQuantities.asMap().entrySet()) {
OperationProductComponentHolder operationProductComponentHolder = productComponentQuantity.getKey();
BigDecimal plannedQuantity = productComponentQuantity.getValue();
Entity technologyOperationComponent = operationProductComponentHolder.getTechnologyOperationComponent();
Entity product = operationProductComponentHolder.getProduct();
String role = getRole(operationProductComponentHolder);
boolean isNonComponent = nonComponents.contains(operationProductComponentHolder);
updateProductionCountingQuantity(order, technologyOperationComponent, product, role, isNonComponent, plannedQuantity);
}
updateProductionCountingQuantity(order, getOrderTechnologyOperationComponent(order), order.getBelongsToField(OrderFields.PRODUCT), ProductionCountingQuantityRole.PRODUCED.getStringValue(), false, order.getDecimalField(OrderFields.PLANNED_QUANTITY));
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentHolder in project mes by qcadoo.
the class BasicProductionCountingServiceImpl method updateProductionCountingQuantitiesAndOperationRuns.
@Override
public void updateProductionCountingQuantitiesAndOperationRuns(final Entity order) {
final Map<Long, BigDecimal> operationRuns = Maps.newHashMap();
final Set<OperationProductComponentHolder> nonComponents = Sets.newHashSet();
final OperationProductComponentWithQuantityContainer productComponentQuantities = productQuantitiesService.getProductComponentWithQuantities(Collections.singletonList(order), operationRuns, nonComponents);
updateProductionCountingOperationRuns(order, operationRuns);
updateProductionCountingQuantities(order, productComponentQuantities, nonComponents);
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentHolder in project mes by qcadoo.
the class BasicProductionCountingServiceImpl method prepareProductionCountingQuantities.
private List<Entity> prepareProductionCountingQuantities(final Entity order, final Set<OperationProductComponentHolder> nonComponents, final OperationProductComponentWithQuantityContainer productComponentQuantities) {
final List<Entity> productionCountingQuantities = new ArrayList<>();
for (Entry<OperationProductComponentHolder, BigDecimal> productComponentQuantity : productComponentQuantities.asMap().entrySet()) {
OperationProductComponentHolder operationProductComponentHolder = productComponentQuantity.getKey();
BigDecimal plannedQuantity = productComponentQuantity.getValue();
Entity product = operationProductComponentHolder.getProduct();
if (product == null) {
continue;
}
Entity technologyOperationComponent = operationProductComponentHolder.getTechnologyOperationComponent();
Entity operationProductComponent = operationProductComponentHolder.getOperationProductComponent();
Entity technologyInputProductType = operationProductComponentHolder.getTechnologyInputProductType();
Entity attribute = operationProductComponentHolder.getAttribute();
String role = getRole(operationProductComponentHolder);
boolean isNonComponent = nonComponents.contains(operationProductComponentHolder);
Entity productionCountingQuantity = prepareProductionCountingQuantity(order, technologyOperationComponent, attribute, technologyInputProductType, operationProductComponent, product, role, isNonComponent, plannedQuantity);
productionCountingQuantities.add(productionCountingQuantity);
}
if (PluginUtils.isEnabled("productFlowThruDivision")) {
fillFlow(productionCountingQuantities, order);
}
return productionCountingQuantities;
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentHolder in project mes by qcadoo.
the class BasicProductionCountingServiceImpl method createProductionCounting.
@Override
public OperationProductComponentWithQuantityContainer createProductionCounting(final Entity order) {
Map<Long, BigDecimal> operationRuns = Maps.newHashMap();
Set<OperationProductComponentHolder> nonComponents = Sets.newHashSet();
final OperationProductComponentWithQuantityContainer productComponentQuantities = productQuantitiesService.getProductComponentWithQuantities(Collections.singletonList(order), operationRuns, nonComponents);
createProductionCountingOperationRuns(order, operationRuns);
List<Entity> productionCountingQuantities = prepareProductionCountingQuantities(order, nonComponents, productComponentQuantities);
List<Entity> basicProductionCounting = Lists.newArrayList();
prepareBasicProductionCounting(order, productionCountingQuantities, basicProductionCounting);
saveBasicProductionCounting(order, productionCountingQuantities, basicProductionCounting, order.getBelongsToField(OrderFields.PRODUCT));
return productComponentQuantities;
}
use of com.qcadoo.mes.technologies.dto.OperationProductComponentHolder 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);
}
}
Aggregations