This commit is contained in:
邹宗楠
2022-08-18 17:17:48 +08:00
parent d30d4146ff
commit 5bddb01dfa

View File

@@ -12,6 +12,7 @@ import (
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"regexp"
"strings"
)
var (
@@ -34,6 +35,7 @@ func (c *PrinterHandler) GetVendorID() int {
func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, printSn, orderSeq, msgTitle, msgContent string) (printerStatus *partner.PrinterStatus, err error) {
globals.SugarLogger.Debugf("PrintMsg id1:%s", printSn)
if printSn != "" && globals.EnableStoreWrite {
printSn = strings.Split(printSn, "_")[0]
if _, err := api.JxPrintAPI.DoPrint(printSn, msgContent, utils.Str2Int(orderSeq)); err == nil {
return c.GetPrinterStatus(ctx, printSn, "")
}
@@ -268,7 +270,8 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store,
return nil, err
}
return c.PrintMsg(ctx, store.PrinterSN, order.VendorOrderID, "", string(orderPrint))
orderSel := utils.Int2Str(order.VendorID) + utils.Int2Str(order.OrderSeq)
return c.PrintMsg(ctx, store.PrinterSN, orderSel, "", string(orderPrint))
}
// PrintStore 打印门店
@@ -282,7 +285,7 @@ func (c *PrinterHandler) PrintStore(ctx *jxcontext.Context, store *model.Store,
return nil, err
}
return c.PrintMsg(ctx, store.PrinterSN, "", "", string(orderPrint))
return c.PrintMsg(ctx, store.PrinterSN, "99999", "", string(orderPrint))
}
func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printType int, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {