
Refactors the product data model to primarily store `id`, `barcode`, and `displayName`. This simplifies the product structure, focusing on essential attributes for inventory and scanning operations. Optimizes API calls for stock picking to fetch more relevant product details. Unnecessary fields are removed, and specific product attributes like `barcode` and `quantity` are now explicitly requested for stock moves. Moves `StockPickingRecordModel` to its own dedicated file for improved code organization and maintainability. Updates all affected UI components and scanner logic to align with the revised product model.
179 lines
5.7 KiB
Dart
179 lines
5.7 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
// This code was generated by ObjectBox. To update it run the generator again
|
|
// with `dart run build_runner build`.
|
|
// See also https://docs.objectbox.io/getting-started#generate-objectbox-code
|
|
|
|
// ignore_for_file: camel_case_types, depend_on_referenced_packages
|
|
// coverage:ignore-file
|
|
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:flat_buffers/flat_buffers.dart' as fb;
|
|
import 'package:objectbox/internal.dart'
|
|
as obx_int; // generated code can access "internal" functionality
|
|
import 'package:objectbox/objectbox.dart' as obx;
|
|
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
|
|
|
import '../../backend/objectbox/entities/product/product_entity.dart';
|
|
|
|
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
|
|
|
final _entities = <obx_int.ModelEntity>[
|
|
obx_int.ModelEntity(
|
|
id: const obx_int.IdUid(1, 6757833172062715556),
|
|
name: 'ProductEntity',
|
|
lastPropertyId: const obx_int.IdUid(9, 7701820943545445010),
|
|
flags: 0,
|
|
properties: <obx_int.ModelProperty>[
|
|
obx_int.ModelProperty(
|
|
id: const obx_int.IdUid(1, 1853465479129290672),
|
|
name: 'id',
|
|
type: 6,
|
|
flags: 129,
|
|
),
|
|
obx_int.ModelProperty(
|
|
id: const obx_int.IdUid(8, 6901756236330116550),
|
|
name: 'barcode',
|
|
type: 9,
|
|
flags: 0,
|
|
),
|
|
obx_int.ModelProperty(
|
|
id: const obx_int.IdUid(9, 7701820943545445010),
|
|
name: 'displayName',
|
|
type: 9,
|
|
flags: 0,
|
|
),
|
|
],
|
|
relations: <obx_int.ModelRelation>[],
|
|
backlinks: <obx_int.ModelBacklink>[],
|
|
),
|
|
];
|
|
|
|
/// Shortcut for [obx.Store.new] that passes [getObjectBoxModel] and for Flutter
|
|
/// apps by default a [directory] using `defaultStoreDirectory()` from the
|
|
/// ObjectBox Flutter library.
|
|
///
|
|
/// Note: for desktop apps it is recommended to specify a unique [directory].
|
|
///
|
|
/// See [obx.Store.new] for an explanation of all parameters.
|
|
///
|
|
/// For Flutter apps, also calls `loadObjectBoxLibraryAndroidCompat()` from
|
|
/// the ObjectBox Flutter library to fix loading the native ObjectBox library
|
|
/// on Android 6 and older.
|
|
Future<obx.Store> openStore({
|
|
String? directory,
|
|
int? maxDBSizeInKB,
|
|
int? maxDataSizeInKB,
|
|
int? fileMode,
|
|
int? maxReaders,
|
|
bool queriesCaseSensitiveDefault = true,
|
|
String? macosApplicationGroup,
|
|
}) async {
|
|
await loadObjectBoxLibraryAndroidCompat();
|
|
return obx.Store(
|
|
getObjectBoxModel(),
|
|
directory: directory ?? (await defaultStoreDirectory()).path,
|
|
maxDBSizeInKB: maxDBSizeInKB,
|
|
maxDataSizeInKB: maxDataSizeInKB,
|
|
fileMode: fileMode,
|
|
maxReaders: maxReaders,
|
|
queriesCaseSensitiveDefault: queriesCaseSensitiveDefault,
|
|
macosApplicationGroup: macosApplicationGroup,
|
|
);
|
|
}
|
|
|
|
/// Returns the ObjectBox model definition for this project for use with
|
|
/// [obx.Store.new].
|
|
obx_int.ModelDefinition getObjectBoxModel() {
|
|
final model = obx_int.ModelInfo(
|
|
entities: _entities,
|
|
lastEntityId: const obx_int.IdUid(1, 6757833172062715556),
|
|
lastIndexId: const obx_int.IdUid(0, 0),
|
|
lastRelationId: const obx_int.IdUid(0, 0),
|
|
lastSequenceId: const obx_int.IdUid(0, 0),
|
|
retiredEntityUids: const [],
|
|
retiredIndexUids: const [],
|
|
retiredPropertyUids: const [
|
|
4521897043130066476,
|
|
2561289170534233438,
|
|
6084891210993334692,
|
|
883454706727408240,
|
|
7033704955625644592,
|
|
1825580906382154543,
|
|
],
|
|
retiredRelationUids: const [],
|
|
modelVersion: 5,
|
|
modelVersionParserMinimum: 5,
|
|
version: 1,
|
|
);
|
|
|
|
final bindings = <Type, obx_int.EntityDefinition>{
|
|
ProductEntity: obx_int.EntityDefinition<ProductEntity>(
|
|
model: _entities[0],
|
|
toOneRelations: (ProductEntity object) => [],
|
|
toManyRelations: (ProductEntity object) => {},
|
|
getId: (ProductEntity object) => object.id,
|
|
setId: (ProductEntity object, int id) {
|
|
object.id = id;
|
|
},
|
|
objectToFB: (ProductEntity object, fb.Builder fbb) {
|
|
final barcodeOffset = object.barcode == null
|
|
? null
|
|
: fbb.writeString(object.barcode!);
|
|
final displayNameOffset = object.displayName == null
|
|
? null
|
|
: fbb.writeString(object.displayName!);
|
|
fbb.startTable(10);
|
|
fbb.addInt64(0, object.id);
|
|
fbb.addOffset(7, barcodeOffset);
|
|
fbb.addOffset(8, displayNameOffset);
|
|
fbb.finish(fbb.endTable());
|
|
return object.id;
|
|
},
|
|
objectFromFB: (obx.Store store, ByteData fbData) {
|
|
final buffer = fb.BufferContext(fbData);
|
|
final rootOffset = buffer.derefObject(0);
|
|
final idParam = const fb.Int64Reader().vTableGet(
|
|
buffer,
|
|
rootOffset,
|
|
4,
|
|
0,
|
|
);
|
|
final barcodeParam = const fb.StringReader(
|
|
asciiOptimization: true,
|
|
).vTableGetNullable(buffer, rootOffset, 18);
|
|
final displayNameParam = const fb.StringReader(
|
|
asciiOptimization: true,
|
|
).vTableGetNullable(buffer, rootOffset, 20);
|
|
final object = ProductEntity(
|
|
id: idParam,
|
|
barcode: barcodeParam,
|
|
displayName: displayNameParam,
|
|
);
|
|
|
|
return object;
|
|
},
|
|
),
|
|
};
|
|
|
|
return obx_int.ModelDefinition(model, bindings);
|
|
}
|
|
|
|
/// [ProductEntity] entity fields to define ObjectBox queries.
|
|
class ProductEntity_ {
|
|
/// See [ProductEntity.id].
|
|
static final id = obx.QueryIntegerProperty<ProductEntity>(
|
|
_entities[0].properties[0],
|
|
);
|
|
|
|
/// See [ProductEntity.barcode].
|
|
static final barcode = obx.QueryStringProperty<ProductEntity>(
|
|
_entities[0].properties[1],
|
|
);
|
|
|
|
/// See [ProductEntity.displayName].
|
|
static final displayName = obx.QueryStringProperty<ProductEntity>(
|
|
_entities[0].properties[2],
|
|
);
|
|
}
|