feat:取消系统自带软键盘设计,改为系统自用键盘组件-初步
feat:将打印分为图片打印和命令式打印-初步
This commit is contained in:
1 parent
94ee7415b1
commit
e68f41375b
38 files changed
+1471
-408
No files matched your search
@@ -48,7 +48,7 @@ const typeConverters = <Type>[
|
||||
];
|
||||
|
||||
/// 收银终端共享 SQLite 数据库入口,统一暴露各业务 DAO 和带迁移的建库方法。
|
||||
@Database(version: 13, entities: entities)
|
||||
@Database(version: 14, entities: entities)
|
||||
@TypeConverters(typeConverters)
|
||||
abstract class AppDatabase extends FloorDatabase {
|
||||
/// 取餐广播队列 DAO。
|
||||
|
||||
@@ -112,7 +112,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
Callback? callback,
|
||||
]) async {
|
||||
final databaseOptions = sqflite.OpenDatabaseOptions(
|
||||
version: 13,
|
||||
version: 14,
|
||||
onConfigure: (database) async {
|
||||
await database.execute('PRAGMA foreign_keys = ON');
|
||||
await callback?.onConfigure?.call(database);
|
||||
@@ -148,7 +148,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `classify` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `sysType` TEXT NOT NULL, `name` TEXT NOT NULL, `categoryType` TEXT NOT NULL, `sort` INTEGER NOT NULL, `createTime` TEXT NOT NULL, `updateTime` TEXT NOT NULL, `delFlag` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `print_history` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `orderId` TEXT NOT NULL, `serviceOrderId` TEXT NOT NULL, `servicePrintId` TEXT NOT NULL, `invoiceUrl` TEXT NOT NULL, `printType` TEXT NOT NULL, `printNo` INTEGER NOT NULL, `retryVersion` INTEGER NOT NULL, `attemptCount` INTEGER NOT NULL, `lastError` TEXT, `resultPending` INTEGER NOT NULL, `status` TEXT NOT NULL, `printTime` TEXT, `syncTime` TEXT, `createTime` TEXT NOT NULL)');
|
||||
'CREATE TABLE IF NOT EXISTS `print_history` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `orderId` TEXT NOT NULL, `serviceOrderId` TEXT NOT NULL, `servicePrintId` TEXT NOT NULL, `invoiceUrl` TEXT NOT NULL, `printCmd` TEXT, `printType` TEXT NOT NULL, `printNo` INTEGER NOT NULL, `retryVersion` INTEGER NOT NULL, `attemptCount` INTEGER NOT NULL, `lastError` TEXT, `resultPending` INTEGER NOT NULL, `status` TEXT NOT NULL, `printTime` TEXT, `syncTime` TEXT, `createTime` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `user_record` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `userId` TEXT NOT NULL, `nickname` TEXT NOT NULL, `mobile` TEXT, `avatar` TEXT, `walletCardNumber` TEXT, `walletId` TEXT, `walletTypeId` TEXT, `walletBalance` INTEGER, `canteenId` TEXT, `discountsList` TEXT, `discountsUpdateTime` TEXT, `createTime` TEXT, `updateTime` TEXT)');
|
||||
await database.execute(
|
||||
@@ -1582,6 +1582,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
'serviceOrderId': item.serviceOrderId,
|
||||
'servicePrintId': item.servicePrintId,
|
||||
'invoiceUrl': item.invoiceUrl,
|
||||
'printCmd': item.printCmd,
|
||||
'printType': item.printType,
|
||||
'printNo': item.printNo,
|
||||
'retryVersion': item.retryVersion,
|
||||
@@ -1603,6 +1604,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
'serviceOrderId': item.serviceOrderId,
|
||||
'servicePrintId': item.servicePrintId,
|
||||
'invoiceUrl': item.invoiceUrl,
|
||||
'printCmd': item.printCmd,
|
||||
'printType': item.printType,
|
||||
'printNo': item.printNo,
|
||||
'retryVersion': item.retryVersion,
|
||||
@@ -1624,6 +1626,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
'serviceOrderId': item.serviceOrderId,
|
||||
'servicePrintId': item.servicePrintId,
|
||||
'invoiceUrl': item.invoiceUrl,
|
||||
'printCmd': item.printCmd,
|
||||
'printType': item.printType,
|
||||
'printNo': item.printNo,
|
||||
'retryVersion': item.retryVersion,
|
||||
@@ -1658,7 +1661,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
Future<List<PrintHistoryEntity>> getAll(String status) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT * FROM print_history WHERE (?1 = \'-1\' OR status = ?1)',
|
||||
mapper: (Map<String, Object?> row) => PrintHistoryEntity(id: row['id'] as int?, orderId: row['orderId'] as String, serviceOrderId: row['serviceOrderId'] as String, servicePrintId: row['servicePrintId'] as String, invoiceUrl: row['invoiceUrl'] as String, printType: row['printType'] as String, printNo: row['printNo'] as int, retryVersion: row['retryVersion'] as int, attemptCount: row['attemptCount'] as int, lastError: row['lastError'] as String?, resultPending: _boolConverter.decode(row['resultPending'] as int), status: _printStatusConverter.decode(row['status'] as String), printTime: row['printTime'] as String?, syncTime: _dateTimeEmptyConverter.decode(row['syncTime'] as String), createTime: _dateTimeConverter.decode(row['createTime'] as String)),
|
||||
mapper: (Map<String, Object?> row) => PrintHistoryEntity(id: row['id'] as int?, orderId: row['orderId'] as String, serviceOrderId: row['serviceOrderId'] as String, servicePrintId: row['servicePrintId'] as String, invoiceUrl: row['invoiceUrl'] as String, printCmd: row['printCmd'] as String?, printType: row['printType'] as String, printNo: row['printNo'] as int, retryVersion: row['retryVersion'] as int, attemptCount: row['attemptCount'] as int, lastError: row['lastError'] as String?, resultPending: _boolConverter.decode(row['resultPending'] as int), status: _printStatusConverter.decode(row['status'] as String), printTime: row['printTime'] as String?, syncTime: _dateTimeEmptyConverter.decode(row['syncTime'] as String), createTime: _dateTimeConverter.decode(row['createTime'] as String)),
|
||||
arguments: [status]);
|
||||
}
|
||||
|
||||
@@ -1673,6 +1676,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
serviceOrderId: row['serviceOrderId'] as String,
|
||||
servicePrintId: row['servicePrintId'] as String,
|
||||
invoiceUrl: row['invoiceUrl'] as String,
|
||||
printCmd: row['printCmd'] as String?,
|
||||
printType: row['printType'] as String,
|
||||
printNo: row['printNo'] as int,
|
||||
retryVersion: row['retryVersion'] as int,
|
||||
@@ -1696,6 +1700,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
serviceOrderId: row['serviceOrderId'] as String,
|
||||
servicePrintId: row['servicePrintId'] as String,
|
||||
invoiceUrl: row['invoiceUrl'] as String,
|
||||
printCmd: row['printCmd'] as String?,
|
||||
printType: row['printType'] as String,
|
||||
printNo: row['printNo'] as int,
|
||||
retryVersion: row['retryVersion'] as int,
|
||||
@@ -1733,6 +1738,7 @@ class _$PrintHistoryDao extends PrintHistoryDao {
|
||||
serviceOrderId: row['serviceOrderId'] as String,
|
||||
servicePrintId: row['servicePrintId'] as String,
|
||||
invoiceUrl: row['invoiceUrl'] as String,
|
||||
printCmd: row['printCmd'] as String?,
|
||||
printType: row['printType'] as String,
|
||||
printNo: row['printNo'] as int,
|
||||
retryVersion: row['retryVersion'] as int,
|
||||
|
||||
@@ -410,6 +410,14 @@ abstract class DatabaseMigration {
|
||||
);
|
||||
});
|
||||
|
||||
/// 版本14为打印任务补充后端指令流列,指令打印模式可离线重试且不改变出纸内容。
|
||||
///
|
||||
/// 列可空且不回填:旧任务与旧后端无指令,指令模式下回退 invoiceUrl 图片打印。
|
||||
static Migration migration13To14 = Migration(13, 14, (database) async {
|
||||
await database
|
||||
.execute('ALTER TABLE print_history ADD COLUMN printCmd TEXT');
|
||||
});
|
||||
|
||||
/// 按起始版本升序返回全部迁移,Floor 打开旧数据库时据此连续升级到当前版本。
|
||||
static List<Migration> getDatabaseMigrations() {
|
||||
return [
|
||||
@@ -425,6 +433,7 @@ abstract class DatabaseMigration {
|
||||
migration10To11,
|
||||
migration11To12,
|
||||
migration12To13,
|
||||
migration13To14,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,10 @@ class PrintHistoryEntity {
|
||||
/// 发票图片地址
|
||||
String invoiceUrl;
|
||||
|
||||
/// 后端拼装的凭证打印指令流(Base64 的 ESC/POS 字节)。
|
||||
/// 旧后端或历史任务无指令时为空,指令打印模式下回退 [invoiceUrl] 图片打印。
|
||||
String? printCmd;
|
||||
|
||||
/// 服务端凭证类型、打印序号与重试版本。
|
||||
String printType;
|
||||
int printNo;
|
||||
@@ -59,6 +63,7 @@ class PrintHistoryEntity {
|
||||
required this.serviceOrderId,
|
||||
required this.servicePrintId,
|
||||
required this.invoiceUrl,
|
||||
this.printCmd,
|
||||
this.printType = '1',
|
||||
this.printNo = 1,
|
||||
this.retryVersion = 0,
|
||||
|
||||
@@ -13,6 +13,7 @@ PrintHistoryEntity _$PrintHistoryEntityFromJson(Map<String, dynamic> json) =>
|
||||
serviceOrderId: json['serviceOrderId'] as String,
|
||||
servicePrintId: json['servicePrintId'] as String,
|
||||
invoiceUrl: json['invoiceUrl'] as String,
|
||||
printCmd: json['printCmd'] as String?,
|
||||
printType: json['printType'] as String? ?? '1',
|
||||
printNo: (json['printNo'] as num?)?.toInt() ?? 1,
|
||||
retryVersion: (json['retryVersion'] as num?)?.toInt() ?? 0,
|
||||
@@ -34,6 +35,7 @@ Map<String, dynamic> _$PrintHistoryEntityToJson(PrintHistoryEntity instance) =>
|
||||
'serviceOrderId': instance.serviceOrderId,
|
||||
'servicePrintId': instance.servicePrintId,
|
||||
'invoiceUrl': instance.invoiceUrl,
|
||||
'printCmd': instance.printCmd,
|
||||
'printType': instance.printType,
|
||||
'printNo': instance.printNo,
|
||||
'retryVersion': instance.retryVersion,
|
||||
|
||||
Reference in new issue
Block a user