- 门店网络打印机设置修改,只有在成功绑定后才执行可能的解绑(之前是先解绑,可能有问题)
- 所有网络打印机适配层写入性API添加EnableStoreWrite控制
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/excel"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/msg"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
@@ -521,7 +520,7 @@ func checkCreateStore(store *model.Store) (err error) {
|
||||
}
|
||||
|
||||
func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interface{}, userName string) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("UpdateStore storeID:%d, payload:%s", storeID, utils.Format4Output(payload, false))
|
||||
globals.SugarLogger.Debugf("UpdateStore storeID:%d, payload:%s", storeID, utils.Format4Output(payload, true))
|
||||
if err = checkBankBranch(utils.Interface2String(payload["payeeBankBranchName"])); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -544,27 +543,23 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
store.Name = valid["name"].(string)
|
||||
syncStatus |= model.SyncFlagStoreName
|
||||
}
|
||||
globals.SugarLogger.Debug(utils.Format4Output(valid, false))
|
||||
// 网络打印机处理
|
||||
if valid["printerVendorID"] != nil || valid["printerSN"] != nil || valid["printerKey"] != nil {
|
||||
if handler := partner.GetPrinterPlatformFromVendorID(store.PrinterVendorID); handler != nil {
|
||||
handler.UnregisterPrinter(ctx, store.PrinterSN, store.PrinterKey)
|
||||
}
|
||||
if valid["printerVendorID"] == nil {
|
||||
valid["printerVendorID"] = store.PrinterVendorID
|
||||
} else {
|
||||
store.PrinterVendorID = int(utils.Interface2Int64WithDefault(valid["printerVendorID"], 0))
|
||||
}
|
||||
if store.PrinterVendorID > 0 {
|
||||
if printerVendorID := int(utils.Interface2Int64WithDefault(valid["printerVendorID"], 0)); printerVendorID > 0 {
|
||||
handler := partner.GetPrinterPlatformFromVendorID(printerVendorID)
|
||||
if handler == nil {
|
||||
return 0, fmt.Errorf("不支持的打印机厂商ID:%d", printerVendorID)
|
||||
}
|
||||
if valid["printerSN"] == nil {
|
||||
valid["printerSN"] = store.PrinterSN
|
||||
}
|
||||
if valid["printerKey"] == nil {
|
||||
valid["printerKey"] = store.PrinterKey
|
||||
}
|
||||
var handler partner.IPrinterHandler
|
||||
if handler, err = netprinter.GetHandlerFromStore(store); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
newID1, newID2, err2 := handler.RegisterPrinter(ctx, valid["printerSN"].(string), valid["printerKey"].(string), store.Name)
|
||||
if err = err2; err != nil {
|
||||
return 0, err
|
||||
@@ -576,8 +571,14 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
if newID2 != "" {
|
||||
valid["printerKey"] = newID2
|
||||
}
|
||||
|
||||
valid["printerBindInfo"] = ""
|
||||
} else {
|
||||
valid["printerVendorID"] = 0
|
||||
valid["printerSN"] = ""
|
||||
valid["printerKey"] = ""
|
||||
}
|
||||
valid["printerBindInfo"] = ""
|
||||
if handler := partner.GetPrinterPlatformFromVendorID(store.PrinterVendorID); handler != nil {
|
||||
handler.UnregisterPrinter(ctx, store.PrinterSN, store.PrinterKey)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,7 +615,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
// }
|
||||
// valid["districtCode"] = api.AutonaviAPI.GetCoordinateDistrictCode(lng, lat)
|
||||
// }
|
||||
globals.SugarLogger.Debugf("UpdateStore track:%s, valid:%s", ctx.GetTrackInfo(), utils.Format4Output(valid, true))
|
||||
globals.SugarLogger.Debugf("UpdateStore track:%s, storeID:%d, valid:%s", ctx.GetTrackInfo(), storeID, utils.Format4Output(valid, true))
|
||||
if len(valid) > 0 {
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
@@ -708,10 +709,9 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
store.Name = jxutils.FormalizeName(store.Name)
|
||||
store.DeliveryRange = strings.Trim(store.DeliveryRange, ";")
|
||||
if store.PrinterSN != "" {
|
||||
var handler partner.IPrinterHandler
|
||||
handler, err = netprinter.GetHandlerFromStore(store)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
handler := partner.GetPrinterPlatformFromVendorID(store.PrinterVendorID)
|
||||
if handler == nil {
|
||||
return 0, fmt.Errorf("不支持的打印机厂商ID:%d", store.PrinterVendorID)
|
||||
}
|
||||
newID1, newID2, err2 := handler.RegisterPrinter(ctx, store.PrinterSN, store.PrinterKey, store.Name)
|
||||
if err = err2; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user