- IPrinterHandler添加EmptyPrintList与PlayText

- 易联云打印机播放:用户申请取消订单请注意查看,收到新的售后单请查看
This commit is contained in:
gazebo
2019-07-19 17:09:56 +08:00
parent 09da354c85
commit 3c94651b2b
8 changed files with 73 additions and 0 deletions

View File

@@ -22,6 +22,18 @@ const (
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) {
storeID := vendorID
if vendorOrderID == testVendorOrderID {
@@ -182,3 +194,20 @@ func RebindAllPrinters(ctx *jxcontext.Context, isForce, isAsync bool) (hint stri
}
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
}