- IPrinterHandler添加EmptyPrintList与PlayText
- 易联云打印机播放:用户申请取消订单请注意查看,收到新的售后单请查看
This commit is contained in:
@@ -348,6 +348,7 @@ func (s *DefScheduler) OnOrderStatusChanged(order *model.GoodsOrder, status *mod
|
|||||||
if status.Status == model.OrderStatusApplyCancel {
|
if status.Status == model.OrderStatusApplyCancel {
|
||||||
utils.CallFuncAsync(func() {
|
utils.CallFuncAsync(func() {
|
||||||
weixinmsg.NotifyUserApplyCancel(savedOrderInfo.order, status.Remark)
|
weixinmsg.NotifyUserApplyCancel(savedOrderInfo.order, status.Remark)
|
||||||
|
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromOrder(order), order.VendorOrderID, netprinter.PrinterNotifyUserApplyCancel)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
msghub.OnKeyOrderStatusChanged(savedOrderInfo.order)
|
msghub.OnKeyOrderStatusChanged(savedOrderInfo.order)
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package defsch
|
package defsch
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
|
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/msghub"
|
"git.rosy.net.cn/jx-callback/business/msghub"
|
||||||
@@ -11,6 +14,7 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
|
|||||||
if !isPending {
|
if !isPending {
|
||||||
msghub.OnNewWait4ApproveAfsOrder(order)
|
msghub.OnNewWait4ApproveAfsOrder(order)
|
||||||
weixinmsg.NotifyAfsOrderStatus(order)
|
weixinmsg.NotifyAfsOrderStatus(order)
|
||||||
|
netprinter.NofityOrderStatus(jxcontext.AdminCtx, jxutils.GetSaleStoreIDFromAfsOrder(order), order.VendorOrderID, netprinter.PrinterNotifyNewAfsOrder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -22,6 +22,18 @@ const (
|
|||||||
realTestOrderVendorID = model.VendorIDJD
|
realTestOrderVendorID = model.VendorIDJD
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
PrinterNotifyUserApplyCancel = 1
|
||||||
|
PrinterNotifyNewAfsOrder = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
printerMsgMap = map[int]string{
|
||||||
|
PrinterNotifyUserApplyCancel: "用户申请取消订单请注意查看",
|
||||||
|
PrinterNotifyNewAfsOrder: "收到新的售后单请查看",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (printResult *partner.PrinterStatus, err error) {
|
func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (printResult *partner.PrinterStatus, err error) {
|
||||||
storeID := vendorID
|
storeID := vendorID
|
||||||
if vendorOrderID == testVendorOrderID {
|
if vendorOrderID == testVendorOrderID {
|
||||||
@@ -182,3 +194,20 @@ func RebindAllPrinters(ctx *jxcontext.Context, isForce, isAsync bool) (hint stri
|
|||||||
}
|
}
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NofityOrderStatus(ctx *jxcontext.Context, storeID int, orderID string, notifyID int) (err error) {
|
||||||
|
if printerMsgMap[notifyID] != "" {
|
||||||
|
db := dao.GetDB()
|
||||||
|
store := &model.Store{}
|
||||||
|
store.ID = storeID
|
||||||
|
if err = dao.GetEntity(db, store); err == nil {
|
||||||
|
handler, err := GetHandlerFromStore(store)
|
||||||
|
if err == nil {
|
||||||
|
if globals.EnableStoreWrite {
|
||||||
|
_, err = handler.PlayText(ctx, store.PrinterSN, store.PrinterKey, orderID, printerMsgMap[notifyID])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ type IPrinterHandler interface {
|
|||||||
RebindPrinter(ctx *jxcontext.Context, lastBindResult *BindPrinterResult) (bindResult *BindPrinterResult, err error)
|
RebindPrinter(ctx *jxcontext.Context, lastBindResult *BindPrinterResult) (bindResult *BindPrinterResult, err error)
|
||||||
|
|
||||||
PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *PrinterStatus, err error)
|
PrintOrder(ctx *jxcontext.Context, store *model.Store, order *model.GoodsOrder) (printerStatus *PrinterStatus, err error)
|
||||||
|
|
||||||
|
EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error)
|
||||||
|
PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *PrinterStatus, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -169,3 +169,12 @@ func (c *PrinterHandler) BindPrinter(ctx *jxcontext.Context, mapData map[string]
|
|||||||
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
||||||
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDFeiE])
|
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDFeiE])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error) {
|
||||||
|
err = api.FeieAPI.DelPrinterSqs(id1)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
return c.GetPrinterStatus(ctx, id1, id2)
|
||||||
|
}
|
||||||
|
|||||||
@@ -267,3 +267,11 @@ func (c *PrinterHandler) BindPrinter(ctx *jxcontext.Context, mapData map[string]
|
|||||||
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
||||||
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDXiaoWM])
|
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDXiaoWM])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
return c.GetPrinterStatus(ctx, id1, id2)
|
||||||
|
}
|
||||||
|
|||||||
@@ -182,3 +182,13 @@ func getApiByToken(possibleToken string) *yilianyunapi.API {
|
|||||||
}
|
}
|
||||||
return api.YilianyunAPI
|
return api.YilianyunAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error) {
|
||||||
|
err = api.YilianyunAPI.CancelAll(id1, id2)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
err = api.YilianyunAPI.PlayText(id1, orderID, text, id2)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -164,3 +164,12 @@ func (c *PrinterHandler) BindPrinter(ctx *jxcontext.Context, mapData map[string]
|
|||||||
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *partner.BindPrinterResult) (bindResult *partner.BindPrinterResult, err error) {
|
||||||
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDZhongWu])
|
return nil, fmt.Errorf("%s打印机当前不支持扫码绑定", model.VendorChineseNames[model.VendorIDZhongWu])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error) {
|
||||||
|
_, err = api.ZhongwuAPI.EmptyPrintQueue(id1, id2)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *PrinterHandler) PlayText(ctx *jxcontext.Context, id1, id2, orderID, text string) (printerStatus *partner.PrinterStatus, err error) {
|
||||||
|
return c.GetPrinterStatus(ctx, id1, id2)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user