This commit is contained in:
邹宗楠
2025-12-26 14:07:41 +08:00
parent 1ae6cb0eef
commit 85e635ce6f
7 changed files with 65 additions and 19 deletions

View File

@@ -3,6 +3,7 @@ package defsch
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"
push "git.rosy.net.cn/jx-callback/business/jxutils/unipush"
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"git.rosy.net.cn/jx-callback/business/model"
@@ -46,14 +47,13 @@ func (s *DefScheduler) OnAfsOrderNew(order *model.AfsOrder, isPending bool) (err
}
}
//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)
// order2.Status = model.AfsOrderStatusFinished
// _, err = netprinter.PrintRefundOrCancelOrder(jxcontext.AdminCtx, model.NO, order2, afsOrder.StoreID)
// }
//}
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)
}
}
}
//if order.Status == model.AfsOrderStatusWait4Approve || order.Status == model.AfsOrderStatusFinished || order.Status == model.AfsOrderStatusNew {

View File

@@ -287,7 +287,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
if printType == model.YES { // 取消订单
title = `<CB>取消订单详情</CB><BR>`
} else { // 售后订单
title = `<CB>退款订单详情</CB><BR>`
title = `<CB>售后订单详情</CB><BR>`
}
orderFmt +=
@@ -338,7 +338,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
if printType == model.YES { // 退单
title = `<CB>取消订单详情</CB><BR>`
} else {
title = `<CB>退款订单详情</CB><BR>`
title = `<CB>售后订单详情</CB><BR>`
}
orderFmt += `--------------------------------<BR>
<B>下单时间: %s<BR></B>

View File

@@ -481,7 +481,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
if printType == model.YES { // 取消订单
title = "取消订单详情"
} else { // 售后订单
title = "退货订单详情"
title = "售后订单详情"
}
//orderFmt += `<BR><font# bolder=0 height=1 width=1>--------------------------------</font#>`
orderFmt += `
@@ -521,7 +521,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
if printType == model.YES { // 取消订单
title = `<font# bolder=1 height=2 width=2>取消订单详情</font#>`
} else { // 售后订单
title = `<font# bolder=1 height=2 width=2>退款订单详情</font#>`
title = `<font# bolder=1 height=2 width=2>售后订单详情</font#>`
}
orderFmt +=

View File

@@ -498,7 +498,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
if printType == model.YES { // 取消订单
title = `<HB><L>取消订单详情</HB><BR>`
} else { // 售后订单
title = `<HB><L>退款订单详情</HB><BR>`
title = `<HB><L>售后订单详情</HB><BR>`
}
orderFmt +=
@@ -543,7 +543,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
if printType == model.YES { // 取消订单
title = `<HB><L>取消订单详情</HB><BR>`
} else { // 售后订单
title = `<HB><L>退款订单详情</HB><BR>`
title = `<HB><L>售后订单详情</HB><BR>`
}
orderFmt +=

View File

@@ -272,7 +272,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
if printType == model.YES { // 取消订单
title = `<FS2><center>取消订单详情</center></FS2>\n`
} else { // 售后订单
title = `<FS2><center>退款订单详情</center></FS2>\n`
title = `<FS2><center>售后订单详情</center></FS2>\n`
}
orderFmt +=
@@ -324,7 +324,7 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
if printType == model.YES { // 退单
title = `<FS2><center>取消订单详情</center></FS2>\n`
} else {
title = `<FS2><center>退款订单详情</center></FS2>\n`
title = `<FS2><center>售后订单详情</center></FS2>\n`
}
orderFmt += `--------------------------------\n
<FS>门店名称: %s\n\n</FS>

View File

@@ -114,6 +114,45 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
}
//退货/取消订单 正常尺寸模板
func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder, printType int, storeDetail *dao.StoreDetail) (content string) {
orderParams := []interface{}{}
orderFmt := ``
if storeDetail.BrandIsPrint == model.NO {
orderFmt += `
<S2><C>%s</C></S2><RN><RN>
`
if order.VendorOrgCode == "34665" {
orderParams = append(orderParams, globals.StoreNameEbai2)
} else {
orderParams = append(orderParams, storeDetail.BrandName)
}
}
if printType == model.YES { // 取消订单
orderFmt = `<C>取消订单详情</C><RN>`
} else { // 售后订单
orderFmt = `<C>售后清淡详情</C><RN>`
}
orderFmt += `********************************
<S2>下单时间: %s<RN><RN></S2>
<S2>订单编号: %s<RN></S2>
<RN>
<S2>%s#%d</S2><RN><RN>
<S2><B1>共%d种%d件商品</B1></S2>
<RN>`
orderParams = append(orderParams,
utils.Time2Str(order.OrderCreatedAt),
order.VendorOrderID,
jxutils.GetVendorName(order.VendorID),
order.OrderSeq,
)
orderParams = append(orderParams, order.SkuCount, order.GoodsCount)
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
}
func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel string, storeDetail *dao.StoreDetail) (content string) {
expectedDeliveryTime := order.ExpectedDeliveredTime
if utils.IsTimeZero(expectedDeliveryTime) {
@@ -241,7 +280,16 @@ func (c *PrinterHandler) PrintStore(ctx *jxcontext.Context, store *model.Store,
}
func (c *PrinterHandler) PrintCancelOrRefundOrder(ctx *jxcontext.Context, printType int, store *model.Store, storeDetail *dao.StoreDetail, order *model.GoodsOrder) (printerStatus *partner.PrinterStatus, err error) {
return nil, err
if len(order.Skus) == 0 {
return
}
content := c.getCancelOrRefundOrderContent(order, printType, storeDetail)
if content == "" {
return nil, nil
}
return c.PrintMsg(ctx, store.PrinterSN, store.PrinterKey, order.VendorOrderID, content)
}
func (c *PrinterHandler) RegisterPrinter(ctx *jxcontext.Context, deviceID, deviceSecret, printerName string, storeID int64) (notUsed1, notUsed2 string, err error) {

View File

@@ -46,7 +46,6 @@ func OnCallbackMsg(msg *mtwmapi.CallbackMsg, msgType string) (response *mtwmapi.
globals.SugarLogger.Debugf(" UnmarshalUseNumber err := %v", err)
return nil
}
globals.SugarLogger.Debugf("-------dataMap := %s", utils.Format4Output(dataMap, false))
if len(dataMap) != 0 {
var storeMap = make(map[string]map[int][]string, 0)
var skuStatus = make(map[int][]string, 0)
@@ -58,7 +57,6 @@ func OnCallbackMsg(msg *mtwmapi.CallbackMsg, msgType string) (response *mtwmapi.
operate[v.AppFoodCode] = fmt.Sprintf("%s:%s:0↑-1↓:前%d->后%d", v.OpAppKey, v.OpName, v.DiffContents.IsSoldOut.Origin, v.DiffContents.IsSoldOut.Result)
}
}
globals.SugarLogger.Debugf("-------storeMap := %s", utils.Format4Output(storeMap, false))
for k, v := range storeMap {
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), k, model.VendorIDMTWM, "")
if storeDetail != nil {