添加退单打印
This commit is contained in:
@@ -180,7 +180,8 @@ public class PrintMechineConsumer {
|
||||
String printType="退款单";
|
||||
|
||||
String data= PrinterUtils.getCashPrintData(detailPO,printType,"return");
|
||||
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +231,8 @@ public class PrintMechineConsumer {
|
||||
String printType="结算单";
|
||||
|
||||
String data= PrinterUtils.getCashPrintData(detailPO,printType,orderInfo.getOrderType());
|
||||
PrinterUtils.printTickets(3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -239,38 +241,61 @@ public class PrintMechineConsumer {
|
||||
case "one": //一菜一品
|
||||
|
||||
if("return".equals(orderInfo.getOrderType())){
|
||||
log.error("退款但不打印出品小票");
|
||||
return;
|
||||
}
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
|
||||
String categoryId;
|
||||
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
List<TbOrderDetail> details= tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if(ObjectUtil.isNotEmpty(details)&&details.size()>0){
|
||||
details.parallelStream().forEach(it->{
|
||||
|
||||
|
||||
Long count= categoryInfos.stream().filter(c->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
String categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
Long count= categoryInfos.stream().filter(c->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
log.info("获取当前类别是否未打印类别:{}",count);
|
||||
|
||||
if(count>0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
if(count>0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
String data = PrinterUtils.getPrintData("return",orderInfo.getPayType().equals("wx_lite")?orderInfo.getTableName():orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
String data = PrinterUtils.getPrintData(orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||
PrinterUtils.printTickets(3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return;
|
||||
}else {
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
|
||||
String categoryId;
|
||||
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
|
||||
Long count= categoryInfos.stream().filter(c->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
log.info("获取当前类别是否未打印类别:{}",count);
|
||||
|
||||
if(count>0){
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
String data = PrinterUtils.getPrintData("",orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson,3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "category": //分类出单
|
||||
@@ -366,7 +391,8 @@ public class PrintMechineConsumer {
|
||||
String printType="退款单";
|
||||
|
||||
String data= PrinterUtils.getCashPrintData(detailPO,printType,"return");
|
||||
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// PrinterUtils.printTickets(voiceJson,1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user