private void fillGenerationProgressFlag(Entity subOrders, final boolean option) { subOrders.setField("orderGenerationInProgress", option); subOrders.getDataDefinition().fastSave(subOrders); }
private void fillForComponentsOne(final Entity technology) { List<Entity> opics = operationComponentDataProvider.getOperationProductsForTechnology(technology.getId()); Entity componentsLocation = technology.getBelongsToField(OperationProductOutComponentFieldsPFTD.COMPONENTS_LOCATION); Entity componentsOutputLocation = technology.getBelongsToField(TechnologyFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); for (Entity op : opics) { cleanOperationProduct(op); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, componentsLocation); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, componentsOutputLocation); op.getDataDefinition().fastSave(op); } }
private void fillGenerationProgressFlag(final ViewDefinitionState view, final ComponentState state, final boolean option) { FormComponent materialRequirementForm = (FormComponent) view.getComponentByReference(L_FORM); Entity materialRequirementEntity = materialRequirementForm.getEntity().getDataDefinition() .get(materialRequirementForm.getEntity().getId()); materialRequirementEntity.setField("orderGenerationInProgress", option); materialRequirementEntity.getDataDefinition().fastSave(materialRequirementEntity); }
public void changeTechnologyStateToChecked(Entity technology) { technology.setField(TechnologyFields.STATE, TechnologyStateStringValues.CHECKED); technology = technology.getDataDefinition().fastSave(technology); DataDefinition technologyStateChangeDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY_STATE_CHANGE); Entity technologyStateChange = technologyStateChangeDD.create(); technologyStateChange.setField(TechnologyStateChangeFields.SOURCE_STATE, TechnologyStateStringValues.DRAFT); technologyStateChange.setField(TechnologyStateChangeFields.TARGET_STATE, TechnologyStateStringValues.CHECKED); technologyStateChange.setField(TechnologyStateChangeFields.TECHNOLOGY, technology); technologyStateChange.setField(TechnologyStateChangeFields.STATUS, StateChangeStatus.SUCCESSFUL.getStringValue()); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getDateTimeFieldName(), new Date()); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getShiftFieldName(), shiftsService.getShiftFromDateWithTime(new Date())); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getWorkerFieldName(), securityService.getCurrentUserName()); technologyStateChangeDD.fastSave(technologyStateChange); }
private void fillForProductsIntermediateInOne(final Entity technology) { List<Entity> opics = operationComponentDataProvider.getOperationsIntermediateInProductsForTechnology(technology.getId()); String productionFlow = technology.getStringField(TechnologyFieldsPFTD.PRODUCTION_FLOW); Entity productsFlowLocation = technology.getBelongsToField(TechnologyFieldsPFTD.PRODUCTS_FLOW_LOCATION); for (Entity op : opics) { cleanOperationProduct(op); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW, productionFlow); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, productsFlowLocation); op.getDataDefinition().fastSave(op); } }
private void cleanOperationProduct(Entity op) { op.setField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW, ProductionFlowComponent.WITHIN_THE_PROCESS.getStringValue()); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, null); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, null); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, null); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTS_INPUT_LOCATION, null); op.setField("automaticMove", false); op.getDataDefinition().fastSave(op); }
public void changeTechnologyStateToAccepted(Entity technology) { technology.setField(TechnologyFields.STATE, TechnologyStateStringValues.ACCEPTED); technology = technology.getDataDefinition().fastSave(technology); DataDefinition technologyStateChangeDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY_STATE_CHANGE); Entity technologyStateChange = technologyStateChangeDD.create(); technologyStateChange.setField(TechnologyStateChangeFields.SOURCE_STATE, TechnologyStateStringValues.CHECKED); technologyStateChange.setField(TechnologyStateChangeFields.TARGET_STATE, TechnologyStateStringValues.ACCEPTED); technologyStateChange.setField(TechnologyStateChangeFields.TECHNOLOGY, technology); technologyStateChange.setField(TechnologyStateChangeFields.STATUS, StateChangeStatus.SUCCESSFUL.getStringValue()); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getDateTimeFieldName(), new Date()); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getShiftFieldName(), shiftsService.getShiftFromDateWithTime(new Date())); technologyStateChange.setField(technologyStateChangeAspect.getChangeEntityDescriber().getWorkerFieldName(), securityService.getCurrentUserName()); technologyStateChangeDD.fastSave(technologyStateChange); }
private void fillForFinalOne(final Entity technology) { List<Long> ids = operationComponentDataProvider.getFinalProductsForTechnology(technology.getId()); if (ids.isEmpty()) { return; } List<Entity> opocs = dataDefinitionService .get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT).find() .add(SearchRestrictions.in("id", ids)).list().getEntities(); Entity productsInputLocation = technology .getBelongsToField(OperationProductOutComponentFieldsPFTD.PRODUCTS_INPUT_LOCATION); Boolean automaticMove = technology.getBooleanField("automaticMoveForFinal"); for (Entity op : opocs) { cleanOperationProduct(op); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_INPUT_LOCATION, productsInputLocation); op.setField("automaticMove", automaticMove); op.getDataDefinition().fastSave(op); } }
private void fillForProductsIntermediateInMany(final Entity technology) { List<Entity> opics = operationComponentDataProvider.getOperationsIntermediateInProductsForTechnology( technology.getId()); for (Entity op : opics) { cleanOperationProduct(op); Entity division = op.getBelongsToField(OperationProductInComponentFields.OPERATION_COMPONENT) .getBelongsToField("division"); if (division != null) { String productionFlow = division.getStringField(DivisionFieldsPFTD.PRODUCTION_FLOW); Entity productsFlowLocation = division.getBelongsToField(DivisionFieldsPFTD.PRODUCTS_FLOW_LOCATION); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW, productionFlow); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, productsFlowLocation); } else { op.setField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW, null); op.setField(OperationProductInComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, null); } op.getDataDefinition().fastSave(op); } }
private void fillForProductsIntermediateOutOne(final Entity technology) { List<Long> ids = operationComponentDataProvider.getIntermediateOutProductsForTechnology(technology.getId()); if (ids.isEmpty()) { return; } List<Entity> opocs = dataDefinitionService .get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT).find() .add(SearchRestrictions.in("id", ids)).list().getEntities(); String productionFlow = technology.getStringField(TechnologyFieldsPFTD.PRODUCTION_FLOW); Entity productsFlowLocation = technology.getBelongsToField(OperationProductOutComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION); Boolean automaticMove = technology.getBooleanField("automaticMoveForIntermediate"); for (Entity op : opocs) { cleanOperationProduct(op); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTION_FLOW, productionFlow); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, productsFlowLocation); op.setField("automaticMove", automaticMove); op.getDataDefinition().fastSave(op); } }
private void fillForComponentsMany(final Entity technology) { List<Entity> opics = operationComponentDataProvider.getOperationProductsForTechnology(technology.getId()); for (Entity op : opics) { cleanOperationProduct(op); Entity division = op.getBelongsToField(OperationProductInComponentFields.OPERATION_COMPONENT) .getBelongsToField("division"); if (division != null) { Entity componentsLocation = division.getBelongsToField(DivisionFieldsPFTD.COMPONENTS_LOCATION); Entity componentsOutputLocation = division.getBelongsToField(DivisionFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, componentsLocation); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, componentsOutputLocation); } else { op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_LOCATION, null); op.setField(OperationProductInComponentFieldsPFTD.COMPONENTS_OUTPUT_LOCATION, null); } op.getDataDefinition().fastSave(op); } }
private void fillForFinalMany(final Entity technology) { List<Long> ids = operationComponentDataProvider.getFinalProductsForTechnology(technology.getId()); if (ids.isEmpty()) { return; } List<Entity> opocs = dataDefinitionService .get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT).find() .add(SearchRestrictions.in("id", ids)).list().getEntities(); for (Entity op : opocs) { cleanOperationProduct(op); Entity division = op.getBelongsToField(OperationProductOutComponentFields.OPERATION_COMPONENT) .getBelongsToField("division"); if (division != null) { Boolean automaticMove = division.getBooleanField("automaticMoveForFinal"); Entity productsInputLocation = division.getBelongsToField(DivisionFieldsPFTD.PRODUCTS_INPUT_LOCATION); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_INPUT_LOCATION, productsInputLocation); op.setField("automaticMove", automaticMove); } else { op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_INPUT_LOCATION, null); op.setField("automaticMove", false); } op.getDataDefinition().fastSave(op); } }
private void fillForProductsIntermediateOutMany(final Entity technology) { List<Long> ids = operationComponentDataProvider.getIntermediateOutProductsForTechnology(technology.getId()); if (ids.isEmpty()) { return; } List<Entity> opocs = dataDefinitionService .get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT).find() .add(SearchRestrictions.in("id", ids)).list().getEntities(); for (Entity op : opocs) { cleanOperationProduct(op); Entity division = op.getBelongsToField(OperationProductOutComponentFields.OPERATION_COMPONENT) .getBelongsToField("division"); if (division != null) { String productionFlow = division.getStringField(DivisionFieldsPFTD.PRODUCTION_FLOW); Entity productsFlowLocation = division .getBelongsToField(OperationProductOutComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION); Boolean automaticMove = division.getBooleanField("automaticMoveForIntermediate"); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTION_FLOW, productionFlow); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, productsFlowLocation); op.setField("automaticMove", automaticMove); } else { op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTION_FLOW, null); op.setField(OperationProductOutComponentFieldsPFTD.PRODUCTS_FLOW_LOCATION, null); op.setField("automaticMove", false); } op.getDataDefinition().fastSave(op); } }