Update: lib/models/product.dart
This commit is contained in:
parent
905f0906b8
commit
697ed887f1
|
@ -1 +0,0 @@
|
||||||
disable = true
|
|
|
@ -1 +0,0 @@
|
||||||
44bac29c391fd8b7a7b8fb82e18a7de312d5dcc14e24e36bc139f392fcf21af3
|
|
|
@ -1,23 +0,0 @@
|
||||||
app-id: ir.dataist.datapack.Assets
|
|
||||||
runtime: org.freedesktop.Platform
|
|
||||||
runtime-version: "23.08"
|
|
||||||
sdk: org.freedesktop.Sdk
|
|
||||||
branch: stable
|
|
||||||
command: assets_dataist_ir
|
|
||||||
separate-locales: false
|
|
||||||
finish-args:
|
|
||||||
- --share=ipc
|
|
||||||
- --share=network
|
|
||||||
- --socket=x11
|
|
||||||
- --socket=pulseaudio
|
|
||||||
- --socket=wayland
|
|
||||||
- --device=dri
|
|
||||||
- --filesystem=home
|
|
||||||
- --filesystem=xdg-run/app/ir.dataist.datapack.Assets:ro
|
|
||||||
modules:
|
|
||||||
- name: assets_dataist_ir
|
|
||||||
builddir: true
|
|
||||||
buildsystem: simple
|
|
||||||
sources:
|
|
||||||
- type: dir
|
|
||||||
path: ../build/linux/x64/release/bundle
|
|
|
@ -1,44 +1,211 @@
|
||||||
class Product {
|
class Product {
|
||||||
int? id;
|
// 1. مشخصات شناسایی و ظاهری کالا (Identification & Appearance)
|
||||||
String name;
|
int? id; // شناسه منحصر به فرد کالا (Primary Key در دیتابیس)
|
||||||
String code;
|
String name; // نام کالا (اجباری)
|
||||||
int quantity;
|
String code; // کد کالا، مانند بارکد یا کد داخلی (اجباری)
|
||||||
double price;
|
String? description; // توضیحات تکمیلی کالا (اختیاری)
|
||||||
String? description;
|
String? imageUrl; // آدرس URL یا مسیر فایل عکس کالا (اختیاری)
|
||||||
|
String? serialNumber; // شماره سریال منحصر به فرد هر واحد کالا (اختیاری)
|
||||||
|
String? model; // شماره مدل خاص محصول (اختیاری)
|
||||||
|
List<String>? tags; // هشتگها یا کلمات کلیدی برای جستجو و دستهبندی (اختیاری)
|
||||||
|
|
||||||
|
// 2. اطلاعات مالی و تجاری (Financial & Commercial)
|
||||||
|
double price; // قیمت فروش واحد کالا (اجباری)
|
||||||
|
double? costPrice; // قیمت خرید / بهای تمام شده کالا (اختیاری)
|
||||||
|
double? taxRate; // نرخ مالیات/عوارض مربوط به کالا (مثلاً 0.09 برای 9 درصد) (اختیاری)
|
||||||
|
double? discount; // میزان تخفیف روی کالا (مثلاً به صورت درصدی یا مبلغ ثابت) (اختیاری)
|
||||||
|
double? profitMargin; // درصد سود مورد انتظار یا واقعی برای کالا (اختیاری)
|
||||||
|
|
||||||
|
// 3. موجودی و لجستیک (انبارداری)
|
||||||
|
int quantity; // تعداد موجودی کالا (اجباری)
|
||||||
|
String? unitOfMeasure; // واحد اندازهگیری کالا (مثلاً "کیلوگرم", "عدد", "لیتر") (اختیاری)
|
||||||
|
String? location; // مکان فیزیکی کالا در انبار یا فروشگاه (اختیاری)
|
||||||
|
int? minimumStock; // حداقل موجودی که برای سفارش مجدد لازم است (اختیاری)
|
||||||
|
String? supplier; // نام تامینکننده یا فروشنده کالا (اختیاری)
|
||||||
|
|
||||||
|
// 4. تاریخگذاری، گارانتی و وضعیت (Dating, Warranty & Status)
|
||||||
|
DateTime? entryDate; // تاریخ ورود یا ثبت کالا در سیستم (اختیاری)
|
||||||
|
DateTime? manufactureDate; // تاریخ تولید کالا (اختیاری)
|
||||||
|
DateTime? expirationDate; // تاریخ انقضای کالا (اختیاری)
|
||||||
|
String? status; // وضعیت فعلی کالا (مثلاً "موجود", "ناموجود", "آسیبدیده") (اختیاری)
|
||||||
|
|
||||||
|
// 5. دستهبندی و طبقهبندی (Categorization & Classification)
|
||||||
|
String? category; // دسته بندی اصلی کالا (مثلاً "الکترونیک", "مواد غذایی") (اختیاری)
|
||||||
|
String? brand; // برند یا شرکت سازنده کالا (اختیاری)
|
||||||
|
|
||||||
|
// 6. اطلاعات مرتبط با کاربران/کارمندان و زمان (User/Employee & Timestamp Information)
|
||||||
|
String? createdBy; // شناسه کاربری ایجاد کننده (اختیاری، اگر سیستم لاگین داشته باشد)
|
||||||
|
DateTime? createdAt; // زمان دقیق ایجاد رکورد (معمولا توسط سیستم پر میشود)
|
||||||
|
String? lastModifiedBy; // شناسه کاربری آخرین ویرایشگر (اختیاری، اگر سیستم لاگین داشته باشد)
|
||||||
|
DateTime? lastModifiedAt; // زمان دقیق آخرین ویرایش رکورد (توسط سیستم پر میشود)
|
||||||
|
|
||||||
Product({
|
Product({
|
||||||
|
// 1. مشخصات شناسایی و ظاهری کالا
|
||||||
this.id,
|
this.id,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.code,
|
required this.code,
|
||||||
required this.quantity,
|
|
||||||
required this.price,
|
|
||||||
this.description,
|
this.description,
|
||||||
|
this.imageUrl,
|
||||||
|
this.serialNumber,
|
||||||
|
this.model,
|
||||||
|
this.tags,
|
||||||
|
|
||||||
|
// 2. اطلاعات مالی و تجاری
|
||||||
|
required this.price,
|
||||||
|
this.costPrice,
|
||||||
|
this.taxRate,
|
||||||
|
this.discount,
|
||||||
|
this.profitMargin,
|
||||||
|
|
||||||
|
// 3. موجودی و لجستیک
|
||||||
|
required this.quantity,
|
||||||
|
this.unitOfMeasure,
|
||||||
|
this.location,
|
||||||
|
this.minimumStock,
|
||||||
|
this.supplier,
|
||||||
|
|
||||||
|
// 4. تاریخگذاری، گارانتی و وضعیت
|
||||||
|
this.entryDate,
|
||||||
|
this.manufactureDate,
|
||||||
|
this.expirationDate,
|
||||||
|
this.status,
|
||||||
|
|
||||||
|
// 5. دستهبندی و طبقهبندی
|
||||||
|
this.category,
|
||||||
|
this.brand,
|
||||||
|
|
||||||
|
// 6. اطلاعات مرتبط با کاربران/کارمندان و زمان
|
||||||
|
this.createdBy,
|
||||||
|
this.createdAt,
|
||||||
|
this.lastModifiedBy,
|
||||||
|
this.lastModifiedAt,
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
// 1. مشخصات شناسایی و ظاهری کالا
|
||||||
'id': id,
|
'id': id,
|
||||||
'name': name,
|
'name': name,
|
||||||
'code': code,
|
'code': code,
|
||||||
'quantity': quantity,
|
|
||||||
'price': price,
|
|
||||||
'description': description,
|
'description': description,
|
||||||
|
'imageUrl': imageUrl,
|
||||||
|
'serialNumber': serialNumber,
|
||||||
|
'model': model,
|
||||||
|
'tags': tags?.join(','), // ذخیره لیست تگها به صورت رشته جدا شده با کاما
|
||||||
|
|
||||||
|
// 2. اطلاعات مالی و تجاری
|
||||||
|
'price': price,
|
||||||
|
'costPrice': costPrice,
|
||||||
|
'taxRate': taxRate,
|
||||||
|
'discount': discount,
|
||||||
|
'profitMargin': profitMargin,
|
||||||
|
|
||||||
|
// 3. موجودی و لجستیک
|
||||||
|
'quantity': quantity,
|
||||||
|
'unitOfMeasure': unitOfMeasure,
|
||||||
|
'location': location,
|
||||||
|
'minimumStock': minimumStock,
|
||||||
|
'supplier': supplier,
|
||||||
|
|
||||||
|
// 4. تاریخگذاری، گارانتی و وضعیت
|
||||||
|
'entryDate': entryDate?.toIso8601String(),
|
||||||
|
'manufactureDate': manufactureDate?.toIso8601String(),
|
||||||
|
'expirationDate': expirationDate?.toIso8601String(),
|
||||||
|
'status': status,
|
||||||
|
|
||||||
|
// 5. دستهبندی و طبقهبندی
|
||||||
|
'category': category,
|
||||||
|
'brand': brand,
|
||||||
|
|
||||||
|
// 6. اطلاعات مرتبط با کاربران/کارمندان و زمان
|
||||||
|
'createdBy': createdBy,
|
||||||
|
'createdAt': createdAt?.toIso8601String(),
|
||||||
|
'lastModifiedBy': lastModifiedBy,
|
||||||
|
'lastModifiedAt': lastModifiedAt?.toIso8601String(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
factory Product.fromMap(Map<String, dynamic> map) {
|
factory Product.fromMap(Map<String, dynamic> map) {
|
||||||
return Product(
|
return Product(
|
||||||
|
// 1. مشخصات شناسایی و ظاهری کالا
|
||||||
id: map['id'],
|
id: map['id'],
|
||||||
name: map['name'],
|
name: map['name'],
|
||||||
code: map['code'],
|
code: map['code'],
|
||||||
quantity: map['quantity'],
|
|
||||||
price: map['price'],
|
|
||||||
description: map['description'],
|
description: map['description'],
|
||||||
|
imageUrl: map['imageUrl'],
|
||||||
|
serialNumber: map['serialNumber'],
|
||||||
|
model: map['model'],
|
||||||
|
tags: map['tags'] != null ? (map['tags'] as String).split(',') : null, // تبدیل رشته به لیست تگها
|
||||||
|
|
||||||
|
// 2. اطلاعات مالی و تجاری
|
||||||
|
price: map['price'],
|
||||||
|
costPrice: map['costPrice'],
|
||||||
|
taxRate: map['taxRate'],
|
||||||
|
discount: map['discount'],
|
||||||
|
profitMargin: map['profitMargin'],
|
||||||
|
|
||||||
|
// 3. موجودی و لجستیک
|
||||||
|
quantity: map['quantity'],
|
||||||
|
unitOfMeasure: map['unitOfMeasure'],
|
||||||
|
location: map['location'],
|
||||||
|
minimumStock: map['minimumStock'],
|
||||||
|
supplier: map['supplier'],
|
||||||
|
|
||||||
|
// 4. تاریخگذاری، گارانتی و وضعیت
|
||||||
|
entryDate: map['entryDate'] != null ? DateTime.parse(map['entryDate']) : null,
|
||||||
|
manufactureDate: map['manufactureDate'] != null ? DateTime.parse(map['manufactureDate']) : null,
|
||||||
|
expirationDate: map['expirationDate'] != null ? DateTime.parse(map['expirationDate']) : null,
|
||||||
|
status: map['status'],
|
||||||
|
|
||||||
|
// 5. دستهبندی و طبقهبندی
|
||||||
|
category: map['category'],
|
||||||
|
brand: map['brand'],
|
||||||
|
|
||||||
|
// 6. اطلاعات مرتبط با کاربران/کارمندان و زمان
|
||||||
|
createdBy: map['createdBy'],
|
||||||
|
createdAt: map['createdAt'] != null ? DateTime.parse(map['createdAt']) : null,
|
||||||
|
lastModifiedBy: map['lastModifiedBy'],
|
||||||
|
lastModifiedAt: map['lastModifiedAt'] != null ? DateTime.parse(map['lastModifiedAt']) : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'Product(id: $id, name: $name, code: $code, quantity: $quantity, price: $price, description: $description)';
|
return 'Product('
|
||||||
|
// 1. مشخصات شناسایی و ظاهری کالا
|
||||||
|
'id: $id, '
|
||||||
|
'name: $name, '
|
||||||
|
'code: $code, '
|
||||||
|
'description: $description, '
|
||||||
|
'imageUrl: $imageUrl, '
|
||||||
|
'serialNumber: $serialNumber, '
|
||||||
|
'model: $model, '
|
||||||
|
'tags: $tags, '
|
||||||
|
// 2. اطلاعات مالی و تجاری
|
||||||
|
'price: $price, '
|
||||||
|
'costPrice: $costPrice, '
|
||||||
|
'taxRate: $taxRate, '
|
||||||
|
'discount: $discount, '
|
||||||
|
'profitMargin: $profitMargin, '
|
||||||
|
// 3. موجودی و لجستیک
|
||||||
|
'quantity: $quantity, '
|
||||||
|
'unitOfMeasure: $unitOfMeasure, '
|
||||||
|
'location: $location, '
|
||||||
|
'minimumStock: $minimumStock, '
|
||||||
|
'supplier: $supplier, '
|
||||||
|
// 4. تاریخگذاری، گارانتی و وضعیت
|
||||||
|
'entryDate: $entryDate, '
|
||||||
|
'manufactureDate: $manufactureDate, '
|
||||||
|
'expirationDate: $expirationDate, '
|
||||||
|
'status: $status, '
|
||||||
|
// 5. دستهبندی و طبقهبندی
|
||||||
|
'category: $category, '
|
||||||
|
'brand: $brand, '
|
||||||
|
// 6. اطلاعات مرتبط با کاربران/کارمندان و زمان
|
||||||
|
'createdBy: $createdBy, '
|
||||||
|
'createdAt: $createdAt, '
|
||||||
|
'lastModifiedBy: $lastModifiedBy, '
|
||||||
|
'lastModifiedAt: $lastModifiedAt'
|
||||||
|
')';
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue