小票打印bug修复
This commit is contained in:
parent
059d8718dd
commit
8394585422
|
|
@ -64,13 +64,12 @@ public class FeiPrinter extends PrinterHandler {
|
|||
@Override
|
||||
protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
|
||||
TbProductSkuWithBLOBs sku = tbProductSkuMapper.selectByPrimaryKey(orderDetail.getProductSkuId());
|
||||
if (sku == null) {
|
||||
if (sku == null && orderDetail.getIsTemporary() == 0) {
|
||||
log.warn("打印菜品票失败 sku商品不存在: {}", orderDetail);
|
||||
return;
|
||||
}
|
||||
String remark = sku.getSpecSnap();
|
||||
String remark = sku == null ? "" : sku.getSpecSnap();
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String[] resp = FeieyunPrintUtil.getPrintData(machine.getAddress(), orderInfo,
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), remark);
|
||||
shopPrintLogService.save(machine, "新订单", resp[0], resp[1]);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public abstract class PrinterHandler {
|
|||
long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(finalCategoryId)
|
||||
).count();
|
||||
if (isTemporary == 0) {
|
||||
if (isTemporary == 1) {
|
||||
count = 1;
|
||||
}
|
||||
if (machine.getClassifyPrint() != null && "1".equals(machine.getClassifyPrint()) && count == 0) {
|
||||
|
|
@ -153,7 +153,7 @@ public abstract class PrinterHandler {
|
|||
}
|
||||
}
|
||||
if (isTemporary == 1) {
|
||||
it.setProductName("【临时菜】" + it.getProductName());
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(), it.getPrice()).toPlainString(), remark);
|
||||
detailList.add(detail);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.springframework.util.MultiValueMap;
|
|||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
|
@ -159,7 +160,7 @@ public class PrinterUtils {
|
|||
|
||||
|
||||
sb.append("------------------------<BR>");
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? toPlainStr(detailPO.getReceiptsAmount()) : NumberUtil.sub(new BigDecimal(detailPO.getReceiptsAmount()), new BigDecimal(detailPO.getDiscountAmount())).toPlainString());
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? toPlainStr(detailPO.getReceiptsAmount()) : NumberUtil.sub(new BigDecimal(detailPO.getReceiptsAmount()), new BigDecimal(detailPO.getDiscountAmount())).setScale(2, RoundingMode.DOWN).toPlainString());
|
||||
t = String.format("%11s", t).replace(' ', paddingCharacter);
|
||||
if (orderType.equals("return")) {
|
||||
sb.append("<F>应退" + t + "</F><BR>");
|
||||
|
|
@ -195,7 +196,7 @@ public class PrinterUtils {
|
|||
}
|
||||
|
||||
private static String toPlainStr(String str) {
|
||||
if(StrUtil.isBlank(str)){
|
||||
if (StrUtil.isBlank(str)) {
|
||||
return "0";
|
||||
}
|
||||
return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
|
||||
|
|
|
|||
Loading…
Reference in New Issue