库存盘点 交班 报错
This commit is contained in:
@@ -85,12 +85,14 @@ public class PrintMqListener {
|
||||
String printTypeEnum = jsonObject.getString("printTypeEnum");
|
||||
JSONObject data2 = jsonObject.getJSONObject("data");
|
||||
PrinterHandler.PrintTypeEnum typeEnum = PrinterHandler.PrintTypeEnum.valueOf(printTypeEnum);
|
||||
SysPrintData sysPrintData = new SysPrintData();
|
||||
sysPrintData.setShopId(shopId);
|
||||
sysPrintData.setData(data2.toJSONString());
|
||||
sysPrintData.setType(typeEnum.toString());
|
||||
printDataService.save(sysPrintData);
|
||||
rabbitPublisher.sendOtherPrintLocalMsg(shopId, printTypeEnum, sysPrintData.getId());
|
||||
if (typeEnum == PrinterHandler.PrintTypeEnum.HANDOVER) {
|
||||
SysPrintData sysPrintData = new SysPrintData();
|
||||
sysPrintData.setShopId(shopId);
|
||||
sysPrintData.setData(data2.toJSONString());
|
||||
sysPrintData.setType(typeEnum.toString());
|
||||
printDataService.save(sysPrintData);
|
||||
rabbitPublisher.sendOtherPrintLocalMsg(shopId, printTypeEnum, sysPrintData.getId());
|
||||
}
|
||||
printConfig.otherHandler(shopId, data2, typeEnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,19 +150,19 @@ public interface PrinterImpl {
|
||||
.append(signLabelInfo.br)
|
||||
.append(getFormatLabel("当班营业总额: " + handoverRecord.getTurnover(), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("实际收款的支付方式", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 现金:", handoverRecord.getCash().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 微信:", handoverRecord.getWechat().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 支付宝:", handoverRecord.getAlipay().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 二维码收款:", handoverRecord.getSelfScan().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 扫码收款:", handoverRecord.getBarScan().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 充值:", handoverRecord.getRecharge().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 现金:", bigDecimalToString(handoverRecord.getCash()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 微信:", bigDecimalToString(handoverRecord.getWechat()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 支付宝:", bigDecimalToString(handoverRecord.getAlipay()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 二维码收款:", bigDecimalToString(handoverRecord.getSelfScan()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 扫码收款:", bigDecimalToString(handoverRecord.getBarScan()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 充值:", bigDecimalToString(handoverRecord.getRecharge()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("非实际收款的支付方式", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 挂账:", handoverRecord.getOwed().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 余额:", handoverRecord.getBalance().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 挂账:", bigDecimalToString(handoverRecord.getOwed()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 余额:", bigDecimalToString(handoverRecord.getBalance()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getDividingLine()).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("退菜/退款", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退款金额:", handoverRecord.getRefundAmount().toPlainString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退菜数量:", handoverRecord.getReturnDishCount().toString(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退款金额:", bigDecimalToString(handoverRecord.getRefundAmount()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign(" 退菜数量:", bigDecimalToString(handoverRecord.getReturnDishCount()), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getDividingLine()).append(signLabelInfo.br)
|
||||
.append(getFormatLabel(leftRightAlign("订单数量/订单总额", handoverRecord.getOrderCount() + "/" + handoverRecord.getOrderTurnover(), 32), signLabelInfo.s)).append(signLabelInfo.br)
|
||||
.append(getFormatLabel("----------- 销售数据 -----------", signLabelInfo.s)).append(signLabelInfo.br)
|
||||
@@ -175,7 +175,7 @@ public interface PrinterImpl {
|
||||
String categoryName = info.getString("categoryName");
|
||||
Integer quantity = info.getInteger("quantity");
|
||||
BigDecimal amount = info.getBigDecimal("amount");
|
||||
builder.append(getFormatLabel(key3(categoryName, quantity.toString(), amount.toPlainString(), 14, 8), signLabelInfo.s)).append(signLabelInfo.br);
|
||||
builder.append(getFormatLabel(key3(categoryName, quantity.toString(), bigDecimalToString(amount), 14, 8), signLabelInfo.s)).append(signLabelInfo.br);
|
||||
});
|
||||
}
|
||||
builder.append(getDividingLine()).append(signLabelInfo.br)
|
||||
@@ -767,11 +767,11 @@ public interface PrinterImpl {
|
||||
List<StockCheckPrintDTO.StockCheckItem> items = record.getItems();
|
||||
if (CollUtil.isNotEmpty(items)) {
|
||||
for (StockCheckPrintDTO.StockCheckItem item : items) {
|
||||
String priceStr = item.getPrice().stripTrailingZeros().toPlainString() + item.getUnit();
|
||||
String priceStr = item.getPrice().stripTrailingZeros().toPlainString() + "/" + item.getUnit();
|
||||
String actualNumberStr = item.getActualNumber().toString();
|
||||
String winLossNumberStr = item.getWinLossNumber().toString();
|
||||
// 四列对齐打印
|
||||
String itemLine = key4(item.getConsName(), priceStr, actualNumberStr, winLossNumberStr, 8, 10, 8);
|
||||
String itemLine = key4(item.getConsName(), priceStr, actualNumberStr, winLossNumberStr, 10, 8, 8);
|
||||
builder.append(getFormatLabel(itemLine, signLabelInfo.s)).append(signLabelInfo.br);
|
||||
}
|
||||
}
|
||||
@@ -841,6 +841,13 @@ public interface PrinterImpl {
|
||||
return NumberUtil.round(new BigDecimal(str), 2).toPlainString();
|
||||
}
|
||||
|
||||
default String bigDecimalToString(BigDecimal bigDecimal) {
|
||||
if (bigDecimal == null) {
|
||||
return "0";
|
||||
}
|
||||
return bigDecimal.toPlainString();
|
||||
}
|
||||
|
||||
// 两个内容 左 右对齐
|
||||
default String leftRightAlign(String leftText, String rightText, int totalWidth) {
|
||||
if (leftText == null) leftText = "";
|
||||
|
||||
Reference in New Issue
Block a user