临时菜小票打印
This commit is contained in:
@@ -85,14 +85,23 @@ public abstract class PrinterHandler {
|
||||
private void onlyKitchen(TbPrintMachine machine, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, List<CategoryInfo> categoryInfos, boolean isReturn) {
|
||||
tbOrderDetailList.forEach(item -> {
|
||||
log.info("开始打印退单菜品,商品名:{}", item.getProductName());
|
||||
Integer isTemporary = ObjectUtil.defaultIfNull(item.getIsTemporary(), 0);
|
||||
String categoryId = "0";
|
||||
if (isTemporary == 1) {
|
||||
item.setProductId(0);
|
||||
}
|
||||
// 台位费不打印
|
||||
if (item.getProductId().equals(-999)) {
|
||||
log.info("台位费商品,不打印");
|
||||
return;
|
||||
}
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(item.getProductId()).getCategoryId();
|
||||
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(item.getProductId());
|
||||
if(isTemporary == 0) {
|
||||
categoryId = product.getCategoryId();
|
||||
}
|
||||
TbProductSkuWithBLOBs sku = tbProductSkuMapper.selectByPrimaryKey(item.getProductSkuId());
|
||||
if (sku == null) {
|
||||
if (isTemporary == 0 && sku == null) {
|
||||
log.error("商品不存在, id: {}", item.getProductSkuId());
|
||||
return;
|
||||
}
|
||||
@@ -100,10 +109,13 @@ public abstract class PrinterHandler {
|
||||
log.error("分类打印是空, classifyPrint: {}", machine.getClassifyPrint());
|
||||
return;
|
||||
}
|
||||
String finalCategoryId = categoryId;
|
||||
long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
c.getId().toString().equals(finalCategoryId)
|
||||
).count();
|
||||
|
||||
if(isTemporary == 0) {
|
||||
count = 1;
|
||||
}
|
||||
if (machine.getClassifyPrint() != null && "1".equals(machine.getClassifyPrint()) && count == 0) {
|
||||
log.warn("分类未添加菜品: {} : {}", item.getProductName(), sku.getSpecSnap());
|
||||
return;
|
||||
@@ -129,12 +141,14 @@ public abstract class PrinterHandler {
|
||||
}
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetailList.forEach(it -> {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
Integer isTemporary = ObjectUtil.defaultIfNull(it.getIsTemporary(), 0);
|
||||
String remark = "";
|
||||
if(isTemporary == 0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
}
|
||||
if(isTemporary == 1) {
|
||||
it.setProductName("【临时菜】"+it.getProductName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user