@Around("shouldSkipAddingProduct(operationProductComponentHolder,entityTypeWithAlreadyAddedProducts,typeOfProductionRecording)") public boolean aroundShouldSkipAddingProduct(final ProceedingJoinPoint pjp, OperationProductComponentHolder operationProductComponentHolder, Map<OperationProductComponentEntityType, Set<Entity>> entityTypeWithAlreadyAddedProducts, String typeOfProductionRecording) throws Throwable { if (cumulated(typeOfProductionRecording)) { Entity product = operationProductComponentHolder.getProduct(); Entity toc = operationProductComponentHolder.getTechnologyOperationComponent(); if (toc != null) { Entity technology = toc.getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY); if (operationProductComponentHolder.getProductMaterialType().getStringValue().equals(TechnologyService.L_02_INTERMEDIATE)) { boolean isProductToSkip = !productionTrackingListenerService.isOperationProductComponentToRegister( operationProductComponentHolder, product, toc); if (isProductToSkip) { return true; } } } } return (boolean) pjp.proceed(); }
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)); }
Entity operationComponent = operationProductComponentHolder.getTechnologyOperationComponent();
private void prepareProductionCountingQuantities(final Entity order, final Set<OperationProductComponentHolder> nonComponents, final OperationProductComponentWithQuantityContainer productComponentQuantities, final List<Entity> productionCountingQuantities) { 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); Entity productionCountingQuantity = prepareProductionCountingQuantity(order, technologyOperationComponent, product, role, isNonComponent, plannedQuantity); productionCountingQuantities.add(productionCountingQuantity); } if (PluginUtils.isEnabled("productFlowThruDivision")) { fillFlow(productionCountingQuantities, order); } if (parameterService.getParameter().getBooleanField(ParameterFieldsO.CREATE_SET_ELEMENTS_ON_ACCEPT)) { productionCountingQuantitySetService.markIntermediateInProductionCountingQuantities(productionCountingQuantities, false); } }
Entity technologyOperationComponent = operationProductComponentHolder.getTechnologyOperationComponent();
.asMap().entrySet()) { OperationProductComponentHolder operationProductComponentHolder = productComponentQuantity.getKey(); Entity technologyOperationComponent = operationProductComponentHolder.getTechnologyOperationComponent(); Entity product = operationProductComponentHolder.getProduct(); if (checkIfProductIsFinalProduct(order, technologyOperationComponent, product)) {
public OperationProductComponentWithQuantityContainer getProductComponentWithQuantitiesWithoutNonComponents( final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents) { for (OperationProductComponentHolder nonComponent : nonComponents) { Entity product = nonComponent.getProduct(); Entity technologyOperationComponent = nonComponent.getTechnologyOperationComponent(); if (technologyOperationComponent != null) { List<Entity> children = technologyOperationComponent.getHasManyField(TechnologyOperationComponentFields.CHILDREN) .find().add(SearchRestrictions.eq(TechnologyOperationComponentFieldsTS.IS_SUBCONTRACTING, true)).list() .getEntities(); boolean isSubcontracting = false; for (Entity child : children) { Entity operationProductOutComponent = child .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS).find() .add(SearchRestrictions.belongsTo(OperationProductOutComponentFields.PRODUCT, product)) .setMaxResults(1).uniqueResult(); if (operationProductOutComponent != null) { isSubcontracting = true; } } if (!isSubcontracting) { productComponentWithQuantities.remove(nonComponent); } } } return productComponentWithQuantities; }