Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ migration:
|
||||
- platform: root
|
||||
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
||||
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
||||
- platform: web
|
||||
- platform: android
|
||||
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
||||
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
|
||||
|
||||
|
||||
@@ -4,13 +4,15 @@ import 'dart:typed_data';
|
||||
import 'package:web/web.dart' as web;
|
||||
import '../../models/stock_in.dart';
|
||||
import '../../models/stock_out.dart';
|
||||
import '../errors/error_reporter.dart';
|
||||
|
||||
void _openPrintWindow(String html) {
|
||||
final win = web.window.open('', '_blank');
|
||||
if (win != null) {
|
||||
win.document.write(html.toJS);
|
||||
win.document.close();
|
||||
if (win == null) {
|
||||
throw Exception('浏览器已拦截弹窗,请在地址栏允许弹窗后重试');
|
||||
}
|
||||
win.document.write(html.toJS);
|
||||
win.document.close();
|
||||
}
|
||||
|
||||
Future<void> printProductLabelImpl({
|
||||
@@ -187,7 +189,12 @@ body { width: 4in; height: 2in; overflow: hidden; background: #fff; }
|
||||
</body>
|
||||
</html>''';
|
||||
|
||||
_openPrintWindow(html);
|
||||
try {
|
||||
_openPrintWindow(html);
|
||||
} catch (e, st) {
|
||||
reportError(e, st);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// ── 入库单 ──────────────────────────────────────────────────────────────────
|
||||
@@ -293,7 +300,12 @@ Future<void> printStockInOrderImpl(StockInOrder order) async {
|
||||
</body>
|
||||
</html>''';
|
||||
|
||||
_openPrintWindow(html);
|
||||
try {
|
||||
_openPrintWindow(html);
|
||||
} catch (e, st) {
|
||||
reportError(e, st);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
// ── 出库单 ──────────────────────────────────────────────────────────────────
|
||||
@@ -396,5 +408,10 @@ Future<void> printStockOutOrderImpl(StockOutOrder order) async {
|
||||
</body>
|
||||
</html>''';
|
||||
|
||||
_openPrintWindow(html);
|
||||
try {
|
||||
_openPrintWindow(html);
|
||||
} catch (e, st) {
|
||||
reportError(e, st);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user