打印机日志

This commit is contained in:
邹宗楠
2026-02-09 16:05:41 +08:00
parent 67dc8be686
commit 1b700c9dda
3 changed files with 13 additions and 19 deletions

View File

@@ -1,7 +1,10 @@
package defsch
import (
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/netprinter"
push "git.rosy.net.cn/jx-callback/business/jxutils/unipush"
@@ -46,26 +49,17 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
push.NotifyAfsOrder(order)
}
}
}
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(order.StoreID, order.VendorID)
if err == nil {
if storeDetail.IsPrintRefundOrder == model.YES { // 打印退款订单
order2, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID)
_, err = netprinter.PrintRefundOrCancelOrder(jxcontext.AdminCtx, model.NO, order2, order2.JxStoreID)
}
storeDetail, err := partner.CurOrderManager.LoadStoreDetail(order.StoreID, order.VendorID)
if err == nil {
if storeDetail.IsPrintRefundOrder == model.YES { // 打印退款订单
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "打印售后订单/取消订单", utils.Format4Output(storeDetail.ID, false))
order2, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID)
_, err = netprinter.PrintRefundOrCancelOrder(jxcontext.AdminCtx, model.NO, order2, order2.JxStoreID)
}
}
//if order.Status == model.AfsOrderStatusWait4Approve || order.Status == model.AfsOrderStatusFinished || order.Status == model.AfsOrderStatusNew {
// // 京西云打印机打印数据-如果门店使用京西打印机才使用如下代码块
// store, err := dao.GetStoreDetail(dao.GetDB(), order.JxStoreID, order.VendorID, order.VendorOrgCode)
// if err == nil && store.PrinterVendorID == model.VendorIDJxprint && store.IsPrintCancelOrder == model.YES {
// orderObj, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, order.VendorID)
// if orderObj != nil {
// netprinter.PrintOrderByOrder(jxcontext.AdminCtx, orderObj, model.PrintAfsOrder, order)
// }
// }
//}
return err
}

View File

@@ -147,6 +147,9 @@ func PrintRefundOrCancelOrder(ctx *jxcontext.Context, printType int, order *mode
storeDetail, _ := dao.GetStoreDetail(db, storeID, order.VendorID, order.VendorOrgCode)
printResult, err = handler.PrintCancelOrRefundOrder(ctx, printType, store, storeDetail, order)
globals.SugarLogger.Debugf("------printResult :=printType: %d ,storeID := %d", printType, storeDetail.ID)
globals.SugarLogger.Debugf("------printResult := %s", utils.Format4Output(printResult, false))
globals.SugarLogger.Debugf("------err := %v", err)
if err == nil {
dao.SetOrderPrintFlag(db, ctx.GetUserName(), order.VendorOrderID, order.VendorID, true)
}

View File

@@ -131,9 +131,6 @@ func (p PrinterHandler) PrintStore(ctx *jxcontext.Context, store *model.Store, s
}
func (p PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printType int, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
if len(order.Skus) == 0 {
return
}
content := ""
voiceType := ""
if printType == model.YES { // 取消订单