打印状态标识 允许重新操作
This commit is contained in:
@@ -49,9 +49,6 @@ public abstract class PrinterHandler {
|
||||
@Setter
|
||||
protected PrinterHandler nextPrinter;
|
||||
protected String printerBrand;
|
||||
// 创建 ThreadLocal 变量
|
||||
private static final ThreadLocal<String> ERR_MSG = ThreadLocal.withInitial(() -> "");
|
||||
|
||||
|
||||
@Resource
|
||||
protected OrderDetailService orderDetailService;
|
||||
@@ -148,16 +145,17 @@ public abstract class PrinterHandler {
|
||||
* @param printType 打印类型,JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
|
||||
* @return 打印机列表
|
||||
*/
|
||||
private List<PrintMachine> getPrintMachine(Long shopId, String subType, String printMethod, String printType) {
|
||||
private List<PrintMachine> getPrintMachine(Long shopId, String subType, String printMethod, String printType, Long machineId) {
|
||||
QueryWrapper wrapper = new QueryWrapper()
|
||||
.eq(PrintMachine::getStatus, 1)
|
||||
.eq(PrintMachine::getId, machineId)
|
||||
.eq(PrintMachine::getShopId, shopId)
|
||||
.eq(PrintMachine::getSubType, subType)
|
||||
.eq(PrintMachine::getConnectionType, "网络");
|
||||
|
||||
if (StrUtil.isNotEmpty(printMethod)) {
|
||||
List<String> arrayList = switch (printMethod) {
|
||||
case "all" ->Arrays.asList("one", "normal", "all");
|
||||
case "all" -> Arrays.asList("one", "normal", "all");
|
||||
case "one" -> Arrays.asList("one", "all");
|
||||
case "normal" -> Arrays.asList("normal", "all");
|
||||
default -> new ArrayList<>();
|
||||
@@ -188,10 +186,11 @@ public abstract class PrinterHandler {
|
||||
|
||||
/**
|
||||
* 处理打印
|
||||
* @param data 传递的数据
|
||||
*
|
||||
* @param data 传递的数据
|
||||
* @param printTypeEnum order returnOrder preOrder one call handover
|
||||
*/
|
||||
public void handler(String data, PrintTypeEnum printTypeEnum) {
|
||||
public void handler(String data, PrintTypeEnum printTypeEnum, Long machineId) {
|
||||
Long shopId;
|
||||
String printMethod = "";
|
||||
String printType = "";
|
||||
@@ -262,7 +261,7 @@ public abstract class PrinterHandler {
|
||||
}
|
||||
|
||||
Object finalObj = obj;
|
||||
getPrintMachine(shopId, "cash", printMethod, printType).forEach(machine -> {
|
||||
getPrintMachine(shopId, "cash", printMethod, printType, machineId).forEach(machine -> {
|
||||
handleRequest(machine, finalObj, printTypeEnum);
|
||||
// printPlaceTicket(isReturn, machine, orderInfo, shopInfo);
|
||||
});
|
||||
@@ -314,7 +313,7 @@ public abstract class PrinterHandler {
|
||||
item.setNum(item.getNum().subtract(printDetailInfo.getPrintNum()));
|
||||
item.setReturnNum(item.getReturnNum().subtract(printDetailInfo.getPrintReturnNum()));
|
||||
orderDetails.add(item);
|
||||
}else {
|
||||
} else {
|
||||
orderDetails.add(item);
|
||||
}
|
||||
|
||||
@@ -334,7 +333,7 @@ public abstract class PrinterHandler {
|
||||
log.info("准备开始打印交班");
|
||||
if (data instanceof HandoverRecordDTO record) {
|
||||
handoverPrint(machine, record);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
break;
|
||||
@@ -343,7 +342,7 @@ public abstract class PrinterHandler {
|
||||
if (data instanceof OrderInfo orderInfo) {
|
||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||
onlyFrontDesk(machine, false, orderInfo, orderDetailList);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
break;
|
||||
@@ -352,7 +351,7 @@ public abstract class PrinterHandler {
|
||||
if (data instanceof OrderInfo orderInfo) {
|
||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||
onlyFrontDesk(machine, true, orderInfo, orderDetailList);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
break;
|
||||
@@ -361,7 +360,7 @@ public abstract class PrinterHandler {
|
||||
if (data instanceof OrderInfo orderInfo) {
|
||||
List<OrderDetail> orderDetailList = orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||
onlyKitchen(machine, orderInfo, orderDetailList);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
break;
|
||||
@@ -369,7 +368,7 @@ public abstract class PrinterHandler {
|
||||
log.info("准备开始打印叫号单");
|
||||
if (data instanceof CallQueue queue) {
|
||||
onlyCallNumPrint(machine, queue);
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
break;
|
||||
@@ -393,7 +392,7 @@ public abstract class PrinterHandler {
|
||||
default:
|
||||
throw new RuntimeException("打印方法有误");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
throw new RuntimeException("传递数据类型有误");
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,8 +1060,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
distributionUserService.costUpgradeLevelBefore(orderInfo.getUserId(), orderInfo.getShopId());
|
||||
// 分销奖励
|
||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
boolean isFree = PayTypeConstants.SourceType.FREE.equals(payment.getSourceType());
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
OrderInfo orderInfo = null;
|
||||
@@ -1113,22 +1112,17 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||
//购买会员
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
memberConfigService.joinMember(payment.getShopId(), shopUser.getUserId(), payment.getRelatedId());
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.DISTRIBUTION.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.DISTRIBUTION.equals(payment.getSourceType())) {
|
||||
distributionUserService.open(payment.getSourceId(), payment.getAmount(), payment.getShopId(), payment.getId());
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.POINT.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.POINT.equals(payment.getSourceType())) {
|
||||
goodPayService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.WARE.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.WARE.equals(payment.getSourceType())) {
|
||||
gbOrderService.payCallBack(payment.getSourceId(), payment.getId());
|
||||
}
|
||||
else if (PayTypeConstants.SourceType.PP.equals(payment.getSourceType())) {
|
||||
} else if (PayTypeConstants.SourceType.PP.equals(payment.getSourceType())) {
|
||||
ppPackageOrderService.paySuccess(payment.getSourceId(), payment.getId());
|
||||
}
|
||||
}
|
||||
@@ -1529,13 +1523,13 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
|
||||
switch (orderInfoPrintDTO.getType()) {
|
||||
case 0:
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ONE_AND_ORDER);
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ONE_AND_ORDER, orderInfoPrintDTO.getMachineId());
|
||||
break;
|
||||
case 1:
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.PRE_ORDER);
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.PRE_ORDER, orderInfoPrintDTO.getMachineId());
|
||||
break;
|
||||
case 2:
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ORDER);
|
||||
printerHandler.handler(orderInfo.getId().toString(), PrinterHandler.PrintTypeEnum.ORDER, orderInfoPrintDTO.getMachineId());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user