本文整理了Java中com.qcadoo.model.api.Entity.setField()
方法的一些代码示例,展示了Entity.setField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setField()
方法的具体详情如下:
包路径:com.qcadoo.model.api.Entity
类名称:Entity
方法名:setField
暂无
代码示例来源:origin: qcadoo/mes
public void addFieldsForParameter(final DataDefinition parameterDD, final Entity parameter) {
parameter.setField(ParameterFieldsAGFO.TRACKING_RECORD_FOR_ORDER_TREATMENT,
TrackingRecordForOrderTreatment.DURING_PRODUCTION.getStringValue());
parameter.setField(ParameterFieldsAGFO.BATCH_NUMBER_REQUIRED_PRODUCTS, false);
}
代码示例来源:origin: qcadoo/mes
public void onSave(final DataDefinition timeUsageFilterDD, final Entity timeUsageFilter) {
String selected = timeUsageFilter.getStringField(TimeUsageReportFilterFields.WORKERS_SELECTION);
if ("01all".equals(selected)) {
timeUsageFilter.setField(TimeUsageReportFilterFields.WORKERS, null);
}
}
}
代码示例来源:origin: qcadoo/mes
private void generateNodeNumberForProductsFamily(final Entity product, final Entity parent) {
if (parent == null) {
product.setField(NODE_NUMBER, getNextRootNodeNumber());
} else {
product.setField(NODE_NUMBER, getNextNodeNumber(parent));
}
}
代码示例来源:origin: qcadoo/mes
private Entity prepareBasicProductionCounting(final Entity order, final Entity product) {
Entity basicProductionCounting = getBasicProductionCountingDD().create();
basicProductionCounting.setField(BasicProductionCountingFields.ORDER, order);
basicProductionCounting.setField(BasicProductionCountingFields.PRODUCT, product);
basicProductionCounting.setField(BasicProductionCountingFields.PRODUCED_QUANTITY,
numberService.setScaleWithDefaultMathContext(BigDecimal.ZERO));
basicProductionCounting.setField(BasicProductionCountingFields.USED_QUANTITY,
numberService.setScaleWithDefaultMathContext(BigDecimal.ZERO));
return basicProductionCounting;
}
代码示例来源:origin: qcadoo/mes
private Entity createAverageWithDataFromOrder(final Entity order, final DataDefinition avgLaborCostCalcForOrderDD) {
Entity avgLaborCostCalcForOrder = avgLaborCostCalcForOrderDD.create();
avgLaborCostCalcForOrder.setField(ORDER, order);
avgLaborCostCalcForOrder.setField(START_DATE, order.getField(OrderFields.START_DATE));
avgLaborCostCalcForOrder.setField(FINISH_DATE, order.getField(OrderFields.FINISH_DATE));
avgLaborCostCalcForOrder.setField(PRODUCTION_LINE, order.getBelongsToField(OrderFields.PRODUCTION_LINE));
avgLaborCostCalcForOrder.setField(BASED_ON, "01assignment");
return avgLaborCostCalcForOrder.getDataDefinition().save(avgLaborCostCalcForOrder);
}
代码示例来源:origin: qcadoo/mes
private void clearHiddenFields(final Entity event) {
FieldsForType fieldsForType = fieldsForTypeFactory.createFieldsForType(PlannedEventType.from(event));
List<String> fieldsToClear = fieldsForType.getHiddenFields();
for (String fieldName : fieldsToClear) {
if (fieldName.equals(PlannedEventFields.REQUIRES_SHUTDOWN)
|| fieldName.equals(PlannedEventFields.PLANNED_SEPARATELY)) {
event.setField(fieldName, false);
} else {
event.setField(fieldName, null);
}
}
}
代码示例来源:origin: qcadoo/mes
@Override
public Entity createPalletNumberHelper(final Integer quantity, final boolean temporary, final List<Entity> palletNumbers) {
Entity palletNumberHelper = getPalletNumberHelperDD().create();
palletNumberHelper.setField(PalletNumberHelperFields.QUANTITY, quantity);
palletNumberHelper.setField(PalletNumberHelperFields.TEMPORARY, temporary);
palletNumberHelper.setField(PalletNumberHelperFields.PALLET_NUMBERS, palletNumbers);
palletNumberHelper = palletNumberHelper.getDataDefinition().save(palletNumberHelper);
return palletNumberHelper;
}
代码示例来源:origin: qcadoo/mes
@Override
public Entity createProductionCountingOperationRun(final Entity order, final Entity technologyOperationComponent,
final BigDecimal runs) {
Entity productionCountingOperationRun = getProductionCountingOperationRunDD().create();
productionCountingOperationRun.setField(ProductionCountingOperationRunFields.ORDER, order);
productionCountingOperationRun.setField(ProductionCountingOperationRunFields.TECHNOLOGY_OPERATION_COMPONENT,
technologyOperationComponent);
productionCountingOperationRun.setField(ProductionCountingOperationRunFields.RUNS,
numberService.setScaleWithDefaultMathContext(runs));
productionCountingOperationRun = productionCountingOperationRun.getDataDefinition().save(productionCountingOperationRun);
return productionCountingOperationRun;
}
代码示例来源:origin: qcadoo/mes
private Entity copyOrderedProductToDelivered(final Entity delivery, final boolean copyQuantityAndPrice) {
// ALBR deliveredProduct has a validation so we have to delete all
// entities before save HM field in delivery
delivery.setField(DeliveryFields.DELIVERED_PRODUCTS, Lists.newArrayList());
delivery.getDataDefinition().save(delivery);
delivery.setField(
DeliveryFields.DELIVERED_PRODUCTS,
createDeliveredProducts(delivery, delivery.getHasManyField(DeliveryFields.ORDERED_PRODUCTS), copyQuantityAndPrice));
return delivery;
// delivery.getDataDefinition().save(delivery);
}
代码示例来源:origin: qcadoo/mes
private void updateCosts(final BigDecimal newQuantity, final Entity orderMaterialCosts, final BigDecimal oldQuantity) {
BigDecimal factor = newQuantity.divide(oldQuantity, numberService.getMathContext());
BigDecimal nominalCost = orderMaterialCosts.getDecimalField(TechnologyInstOperProductInCompFields.NOMINAL_COST);
BigDecimal lastPurchaseCost = orderMaterialCosts
.getDecimalField(TechnologyInstOperProductInCompFields.LAST_PURCHASE_COST);
BigDecimal averageCost = orderMaterialCosts.getDecimalField(TechnologyInstOperProductInCompFields.AVERAGE_COST);
orderMaterialCosts.setField(TechnologyInstOperProductInCompFields.COST_FOR_NUMBER, numberService.setScaleWithDefaultMathContext(newQuantity));
orderMaterialCosts.setField(TechnologyInstOperProductInCompFields.NOMINAL_COST, multiply(nominalCost, factor));
orderMaterialCosts.setField(TechnologyInstOperProductInCompFields.LAST_PURCHASE_COST, multiply(lastPurchaseCost, factor));
orderMaterialCosts.setField(TechnologyInstOperProductInCompFields.AVERAGE_COST, multiply(averageCost, factor));
}
代码示例来源:origin: qcadoo/mes
private void setDeliveryAddressDefaultValue(final Entity delivery) {
String deliveryAddress = delivery.getStringField(DELIVERY_ADDRESS);
if (deliveryAddress == null) {
delivery.setField(DELIVERY_ADDRESS, deliveriesService.getDeliveryAddressDefaultValue());
}
}
代码示例来源:origin: qcadoo/mes
private void clearStorageLocations(Entity delivery) {
EntityList deliveredProducts = delivery.getHasManyField(DeliveryFields.DELIVERED_PRODUCTS);
if (deliveredProducts != null) {
for (Entity deliveryProduct : deliveredProducts) {
deliveryProduct.setField(DeliveredProductFields.STORAGE_LOCATION, null);
deliveryProduct.getDataDefinition().save(deliveryProduct);
}
}
}
}
代码示例来源:origin: qcadoo/mes
public void updateRequestForQuotationProductCatalogNumber(final DataDefinition requestForQuotationProductDD,
final Entity requestForQuotationProduct) {
Entity requestForQuotation = requestForQuotationProduct.getBelongsToField(REQUEST_FOR_QUOTATION);
Entity supplier = requestForQuotation.getBelongsToField(SUPPLIER);
Entity product = requestForQuotationProduct.getBelongsToField(PRODUCT);
Entity productCatalogNumber = productCatalogNumbersService.getProductCatalogNumber(product, supplier);
if (productCatalogNumber != null) {
requestForQuotationProduct.setField(PRODUCT_CATALOG_NUMBER, productCatalogNumber);
}
}
代码示例来源:origin: qcadoo/mes
public void generateFactoryStructure(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference("form");
Entity maintenanceEvent = form.getEntity();
EntityTree factoryStructure = factoryStructureGenerationService.generateFactoryStructureForEntity(maintenanceEvent,
"maintenanceEvent");
maintenanceEvent.setField(MaintenanceEventFields.FACTORY_STRUCTURE, factoryStructure);
generatedTree = factoryStructure;
form.setEntity(maintenanceEvent);
}
代码示例来源:origin: qcadoo/mes
public void setDefaultValueForTechnologyBatchRequiredField(final DataDefinition dataDefinition, final Entity entity) {
if (entity.getId() != null) {
return;
}
if (entity.getField("technologyBatchRequired") != null) {
return;
}
Entity parameter = parameterService.getParameter();
entity.setField("technologyBatchRequired", parameter.getBooleanField("batchNumberRequiredProducts"));
}
}
代码示例来源:origin: qcadoo/mes
public void saveCosts(final ViewDefinitionState viewDefinitionState, final ComponentState component, final String[] args) {
FormComponent orderForm = (FormComponent) viewDefinitionState.getComponentByReference("order");
Entity order = orderForm.getEntity();
Entity orderEntity = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER).get(
order.getId());
orderEntity.setField(OrderFieldsCNFM.DIRECT_ADDITIONAL_COST,
order.getDecimalField(OrderFieldsCNFM.DIRECT_ADDITIONAL_COST));
orderEntity.setField(OrderFieldsCNFM.DIRECT_ADDITIONAL_COST_DESCRIPTION,
order.getStringField(OrderFieldsCNFM.DIRECT_ADDITIONAL_COST_DESCRIPTION));
orderEntity.getDataDefinition().save(orderEntity);
}
代码示例来源:origin: qcadoo/mes
private void addColumnForOrders(final Map<String, String> columnAttributes) {
Entity column = columnExtensionService.addColumn(DeliveriesConstants.PLUGIN_IDENTIFIER,
DeliveriesConstants.MODEL_COLUMN_FOR_ORDERS, columnAttributes);
Entity parameter = parameterService.getParameter();
column.setField("parameter", parameter);
column.getDataDefinition().save(column);
addColumnForParameterOrders(column);
}
代码示例来源:origin: qcadoo/mes
@Override
public Entity calculateTotalCost(final Entity entity) {
entity.setField(CostCalculationFields.DATE, new Date());
// FIXME MAKU beware of side effects - order of computations matter!
calculateOperationsAndProductsCosts(entity);
final BigDecimal productionCosts = calculateProductionCost(entity);
calculateMarginsAndOverheads(entity, productionCosts);
final BigDecimal effectiveQuantity = getEffectiveQuantity(entity);
calculateTotalCosts(entity, productionCosts, effectiveQuantity);
return entity.getDataDefinition().save(entity);
}
代码示例来源:origin: qcadoo/mes
public void turnOffSoundNotifications(final ViewDefinitionState viewDefinitionState, final ComponentState triggerState,
final String args[]) {
GridComponent grid = (GridComponent) viewDefinitionState.getComponentByReference("grid");
List<Entity> selectedEntities = grid.getSelectedEntities();
selectedEntities.forEach(entity -> {
entity = entity.getDataDefinition().getMasterModelEntity(entity.getId());
entity.setField(MaintenanceEventFields.SOUND_NOTIFICATIONS, false);
entity.getDataDefinition().save(entity);
});
viewDefinitionState.addMessage("cmmsMachineParts.plannedEventsList.turnedOffSoundNotifications",
ComponentState.MessageType.SUCCESS);
}
代码示例来源:origin: qcadoo/mes
private void fillBasicProductionCounting(final Entity productionCountingQuantity) {
if (productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING) == null) {
Entity order = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ORDER);
Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT);
String typeOfMaterial = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL);
String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE);
if (checkIfShouldFillBasicProductionCounting(order, product, typeOfMaterial, role)) {
productionCountingQuantity.setField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING,
fillBasicProductionCounting(order, product));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!