小票打印bug修复
This commit is contained in:
@@ -89,6 +89,7 @@ public abstract class PrinterHandler {
|
||||
String categoryId = "0";
|
||||
if (isTemporary == 1) {
|
||||
item.setProductId(0);
|
||||
item.setProductSkuId(0);
|
||||
}
|
||||
// 台位费不打印
|
||||
if (item.getProductId().equals(-999)) {
|
||||
@@ -104,6 +105,8 @@ public abstract class PrinterHandler {
|
||||
if (isTemporary == 0 && sku == null) {
|
||||
log.error("商品不存在, id: {}", item.getProductSkuId());
|
||||
return;
|
||||
} else {
|
||||
sku = new TbProductSkuWithBLOBs();
|
||||
}
|
||||
if (StrUtil.isEmpty(machine.getClassifyPrint())) {
|
||||
log.error("分类打印是空, classifyPrint: {}", machine.getClassifyPrint());
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@@ -249,7 +250,7 @@ public class FeieyunPrintUtil {
|
||||
data.append(StrUtil.format("折扣:-{}<BR>", toPlainStr(detailPO.getDiscountAmount())));
|
||||
}
|
||||
data.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());
|
||||
if (orderType.equals("return")) {
|
||||
data.append(StrUtil.format("<B>应退:{}</B><BR>", t));
|
||||
} else {
|
||||
@@ -271,7 +272,7 @@ public class FeieyunPrintUtil {
|
||||
}
|
||||
|
||||
private static String toPlainStr(String str) {
|
||||
if(StrUtil.isBlank(str)){
|
||||
if (StrUtil.isBlank(str)) {
|
||||
return "0";
|
||||
}
|
||||
return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
|
||||
@@ -496,7 +497,7 @@ public class FeieyunPrintUtil {
|
||||
//testPrint();
|
||||
//testPrint2();
|
||||
String a = "12.0000";
|
||||
String s = new BigDecimal(a).toPlainString();
|
||||
String s = new BigDecimal(a).setScale(2, RoundingMode.DOWN).toPlainString();
|
||||
System.out.println(s);
|
||||
String s1 = toPlainStr(a);
|
||||
System.out.println(s1);
|
||||
|
||||
Reference in New Issue
Block a user