feat:打印优化

This commit is contained in:
dzc committed 2026-09-22 13:29:10 +08:00
1 parent 22c4d4b9b9
commit 383ea2ad4b
32 files changed
+1879 -154

No files matched your search

@@ -37,6 +37,14 @@ abstract class PrintHistoryDao {
'SELECT * FROM print_history WHERE servicePrintId = :servicePrintId LIMIT 1')
Future<PrintHistoryEntity?> findByServicePrintId(String servicePrintId);
/// 按服务端订单号或 Android 订单号取全部本地任务,供打印等待页轮询进度。
///
/// 入队时 androidOrderCode 优先进 orderId 列、服务端单号固定在 serviceOrderId 列,
/// 因此两个列都必须匹配调用方传入的服务端单号。
@Query(
'SELECT * FROM print_history WHERE orderId = :orderId OR serviceOrderId = :orderId ORDER BY id DESC')
Future<List<PrintHistoryEntity>> findAllByOrder(String orderId);
/// 查询等待补报成功或失败结果的任务。
@Query(
'SELECT * FROM print_history WHERE resultPending = 1 ORDER BY createTime ASC')
@@ -1690,6 +1690,14 @@ class _$PrintHistoryDao extends PrintHistoryDao {
arguments: [servicePrintId]);
}
@override
Future<List<PrintHistoryEntity>> findAllByOrder(String orderId) async {
return _queryAdapter.queryList(
'SELECT * FROM print_history WHERE orderId = ?1 OR serviceOrderId = ?1 ORDER BY id DESC',
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: [orderId]);
}
@override
Future<List<PrintHistoryEntity>> getPendingResults() async {
return _queryAdapter.queryList(