小票打印bug修复

This commit is contained in:
谭凯凯
2024-11-28 17:33:21 +08:00
committed by Tankaikai
parent a6de9593a7
commit b75bb50f63
5 changed files with 20 additions and 19 deletions

View File

@@ -285,7 +285,7 @@ public class PrintMechineConsumer {
// 重置打印数据 // 重置打印数据
redisTemplate.delete(printKey); redisTemplate.delete(printKey);
if (!tbOrderDetails.isEmpty()) { if (!tbOrderDetails.isEmpty()) {
tbOrderDetails.forEach(it -> { tbOrderDetails.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it->{
log.info("开始打印一菜一品票据,:{}", it.getProductName()); log.info("开始打印一菜一品票据,:{}", it.getProductName());
String categoryId = tbProductMapper.selectByPrimaryKey(it.getProductId()).getCategoryId(); String categoryId = tbProductMapper.selectByPrimaryKey(it.getProductId()).getCategoryId();
@@ -494,7 +494,7 @@ public class PrintMechineConsumer {
private void printReturnTicket(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo, String printerNum, List<CategoryInfo> categoryInfos, String orderId) { private void printReturnTicket(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo, String printerNum, List<CategoryInfo> categoryInfos, String orderId) {
List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId)); List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
if (ObjectUtil.isNotEmpty(details) && details.size() > 0) { if (ObjectUtil.isNotEmpty(details) && details.size() > 0) {
details.parallelStream().forEach(it -> { details.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId(); String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
Long count = categoryInfos.stream().filter(c -> Long count = categoryInfos.stream().filter(c ->
c.getId().toString().equals(categoryId) c.getId().toString().equals(categoryId)
@@ -657,8 +657,7 @@ public class PrintMechineConsumer {
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final"); List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) { if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
cashierCarts.parallelStream().forEach(it -> { cashierCarts.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
String categoryId; String categoryId;
if (ObjectUtil.isEmpty(it.getCategoryId())) { if (ObjectUtil.isEmpty(it.getCategoryId())) {
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId(); categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();

View File

@@ -83,7 +83,7 @@ public abstract class PrinterHandler {
* 仅打印制作单「厨房」 * 仅打印制作单「厨房」
*/ */
private void onlyKitchen(TbPrintMachine machine, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, List<CategoryInfo> categoryInfos, boolean isReturn) { private void onlyKitchen(TbPrintMachine machine, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, List<CategoryInfo> categoryInfos, boolean isReturn) {
tbOrderDetailList.forEach(item -> { tbOrderDetailList.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(item -> {
log.info("开始打印退单菜品,商品名:{}", item.getProductName()); log.info("开始打印退单菜品,商品名:{}", item.getProductName());
Integer isTemporary = ObjectUtil.defaultIfNull(item.getIsTemporary(), 0); Integer isTemporary = ObjectUtil.defaultIfNull(item.getIsTemporary(), 0);
String categoryId = "0"; String categoryId = "0";

View File

@@ -175,7 +175,7 @@ public class CloudPrinterService {
if ("return".equals(orderInfo.getOrderType())) { if ("return".equals(orderInfo.getOrderType())) {
List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId)); List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
if (ObjectUtil.isNotEmpty(details) && details.size() > 0) { if (ObjectUtil.isNotEmpty(details) && details.size() > 0) {
details.parallelStream().forEach(it -> { details.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId(); String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
@@ -509,7 +509,7 @@ public class CloudPrinterService {
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final"); List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) { if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
cashierCarts.parallelStream().forEach(it -> { cashierCarts.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
String categoryId; String categoryId;
if (ObjectUtil.isEmpty(it.getCategoryId())) { if (ObjectUtil.isEmpty(it.getCategoryId())) {

View File

@@ -274,7 +274,7 @@ public class FeieyunPrintUtil {
if(StrUtil.isBlank(str)){ if(StrUtil.isBlank(str)){
return "0"; return "0";
} }
return new BigDecimal(str).toPlainString(); return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
} }
public static String[] getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType, String printerNum) { public static String[] getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType, String printerNum) {
@@ -498,6 +498,8 @@ public class FeieyunPrintUtil {
String a = "12.0000"; String a = "12.0000";
String s = new BigDecimal(a).toPlainString(); String s = new BigDecimal(a).toPlainString();
System.out.println(s); System.out.println(s);
String s1 = toPlainStr(a);
System.out.println(s1);
//testPrint3(); //testPrint3();
} }

View File

@@ -198,7 +198,7 @@ public class PrinterUtils {
if(StrUtil.isBlank(str)){ if(StrUtil.isBlank(str)){
return "0"; return "0";
} }
return new BigDecimal(str).toPlainString(); return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
} }
public static String getCallNumPrintData(CallNumPrintPO po) { public static String getCallNumPrintData(CallNumPrintPO po) {