- 门店网络打印机设置修改,只有在成功绑定后才执行可能的解绑(之前是先解绑,可能有问题)
- 所有网络打印机适配层写入性API添加EnableStoreWrite控制
This commit is contained in:
@@ -108,7 +108,10 @@ func (c *PrinterHandler) GetVendorID() int {
|
||||
func (c *PrinterHandler) PrintMsg(ctx *jxcontext.Context, id1, id2, msgTitle, msgContent string) (printerStatus *partner.PrinterStatus, err error) {
|
||||
globals.SugarLogger.Debugf("PrintMsg id1:%s", id1)
|
||||
if id1 != "" {
|
||||
if _, err = api.FeieAPI.PrintMsg(id1, msgContent, 1); err == nil {
|
||||
if globals.EnableStoreWrite {
|
||||
_, err = api.FeieAPI.PrintMsg(id1, msgContent, 1)
|
||||
}
|
||||
if err == nil {
|
||||
printerStatus, err = c.GetPrinterStatus(ctx, id1, id2)
|
||||
}
|
||||
} else {
|
||||
@@ -138,13 +141,18 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store,
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) RegisterPrinter(ctx *jxcontext.Context, printerSN, printerKey, printerName string) (notUsed1, notUsed2 string, err error) {
|
||||
_, no, err := api.FeieAPI.PrinterAddList([]*feieapi.PrinterInfo{
|
||||
&feieapi.PrinterInfo{
|
||||
SN: printerSN,
|
||||
Key: printerKey,
|
||||
Name: printerName,
|
||||
},
|
||||
})
|
||||
var no map[string]string
|
||||
if globals.EnableStoreWrite {
|
||||
_, no, err = api.FeieAPI.PrinterAddList([]*feieapi.PrinterInfo{
|
||||
&feieapi.PrinterInfo{
|
||||
SN: printerSN,
|
||||
Key: printerKey,
|
||||
Name: printerName,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
no = make(map[string]string)
|
||||
}
|
||||
if err == nil {
|
||||
if no[printerSN] != "" {
|
||||
if no[printerSN] == feieapi.ErrMsgAlredyAdded {
|
||||
@@ -158,7 +166,9 @@ func (c *PrinterHandler) RegisterPrinter(ctx *jxcontext.Context, printerSN, prin
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) UnregisterPrinter(ctx *jxcontext.Context, printerSN, notUsed string) (err error) {
|
||||
_, _, err = api.FeieAPI.PrinterDelList([]string{printerSN})
|
||||
if globals.EnableStoreWrite {
|
||||
_, _, err = api.FeieAPI.PrinterDelList([]string{printerSN})
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -171,7 +181,9 @@ func (c *PrinterHandler) RebindPrinter(ctx *jxcontext.Context, lastBindResult *p
|
||||
}
|
||||
|
||||
func (c *PrinterHandler) EmptyPrintList(ctx *jxcontext.Context, id1, id2 string) (err error) {
|
||||
err = api.FeieAPI.DelPrinterSqs(id1)
|
||||
if globals.EnableStoreWrite {
|
||||
err = api.FeieAPI.DelPrinterSqs(id1)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user