fear: rev 2
This commit is contained in:
@@ -35,18 +35,25 @@ Future<void> onPrint(
|
||||
// Checker printer
|
||||
if (checkerPrinter != null) {
|
||||
try {
|
||||
final productByPrinter = productQuantity
|
||||
.where((item) => item.product.printerType == 'checker')
|
||||
.toList();
|
||||
|
||||
final printValue = await PrintDataoutputs.instance.printChecker(
|
||||
productQuantity,
|
||||
productByPrinter,
|
||||
order.tableNumber ?? "",
|
||||
order.orderNumber ?? "",
|
||||
authData.user?.name ?? "",
|
||||
order.metadata?['customer_name'] ?? "",
|
||||
checkerPrinter.paper.toIntegerFromText,
|
||||
order.orderType ?? "",
|
||||
);
|
||||
|
||||
await PrinterService()
|
||||
// ignore: use_build_context_synchronously
|
||||
.printWithPrinter(checkerPrinter, printValue, context);
|
||||
if (productByPrinter.isNotEmpty) {
|
||||
await PrinterService()
|
||||
// ignore: use_build_context_synchronously
|
||||
.printWithPrinter(checkerPrinter, printValue, context);
|
||||
}
|
||||
} catch (e) {
|
||||
log("Error printing checker: $e");
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -58,17 +65,23 @@ Future<void> onPrint(
|
||||
// Kitchen printer
|
||||
if (kitchenPrinter != null) {
|
||||
try {
|
||||
final productByPrinter = productQuantity
|
||||
.where((item) => item.product.printerType == 'kitchen')
|
||||
.toList();
|
||||
final printValue = await PrintDataoutputs.instance.printKitchen(
|
||||
productQuantity,
|
||||
productByPrinter,
|
||||
order.tableNumber!,
|
||||
order.orderNumber ?? "",
|
||||
authData.user?.name ?? "",
|
||||
order.metadata?['customer_name'] ?? "",
|
||||
kitchenPrinter.paper.toIntegerFromText,
|
||||
order.orderType ?? "",
|
||||
);
|
||||
|
||||
await PrinterService()
|
||||
.printWithPrinter(kitchenPrinter, printValue, context);
|
||||
if (productByPrinter.isNotEmpty) {
|
||||
await PrinterService()
|
||||
.printWithPrinter(kitchenPrinter, printValue, context);
|
||||
}
|
||||
} catch (e) {
|
||||
log("Error printing kitchen order: $e");
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -80,17 +93,24 @@ Future<void> onPrint(
|
||||
// Bar printer
|
||||
if (barPrinter != null) {
|
||||
try {
|
||||
final productByPrinter = productQuantity
|
||||
.where((item) => item.product.printerType == 'bar')
|
||||
.toList();
|
||||
|
||||
final printValue = await PrintDataoutputs.instance.printBar(
|
||||
productQuantity,
|
||||
productByPrinter,
|
||||
order.tableNumber ?? "",
|
||||
order.orderNumber ?? "",
|
||||
authData.user?.name ?? "",
|
||||
order.metadata?['customer_name'] ?? "",
|
||||
barPrinter.paper.toIntegerFromText,
|
||||
order.orderType ?? "",
|
||||
);
|
||||
|
||||
await PrinterService()
|
||||
.printWithPrinter(barPrinter, printValue, context);
|
||||
if (productByPrinter.isNotEmpty) {
|
||||
await PrinterService()
|
||||
.printWithPrinter(barPrinter, printValue, context);
|
||||
}
|
||||
} catch (e) {
|
||||
log("Error printing bar order: $e");
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
||||
Reference in New Issue
Block a user