diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go
index 33543e698..3eb3906fc 100644
--- a/business/partner/delivery/mtps/waybill.go
+++ b/business/partner/delivery/mtps/waybill.go
@@ -127,47 +127,51 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
err := mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus)
defer delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID, order.Status) // 骑手位置更新
if order.OrderVendorID == model.VendorIDDD {
- result := &mtpsapi.RiderInfo{
- OrderId: order.VendorOrderID,
- ThirdCarrierOrderId: order.VendorOrderID,
- CourierName: order.CourierName,
- CourierPhone: order.CourierMobile,
- LogisticsProviderCode: "10032",
- LogisticsStatus: order.Status,
- OpCode: "",
- }
- switch msg.Status {
- case mtpsapi.OrderStatusWaitingForSchedule: // 待接单,召唤骑手
- result.LogisticsStatus = model.WaybillStatusNew
- result.LogisticsContext = model.RiderWaitRider
- case mtpsapi.OrderStatusAccepted: // 已接单
- result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
- result.LogisticsContext = model.RiderWaitGetGoods
- case mtpsapi.OrderStatusDeliverred: // 完成
- result.LogisticsStatus = model.WaybillStatusDelivered
- result.LogisticsContext = model.RiderGetOrderDelivered
- case mtpsapi.OrderStatusCanceled: // 取消
- result.LogisticsStatus = model.WaybillStatusCanceled
- result.LogisticsContext = model.RiderGetOrderCanceled
- case mtpsapi.OrderStatusPickedUp: // 骑手到店
- result.LogisticsStatus = model.WaybillStatusCourierArrived
- result.LogisticsContext = model.RiderToStore
- default:
- result.LogisticsStatus = 0
- result.LogisticsContext = model.RiderGetOrderDeliverOther
- }
- globals.SugarLogger.Debugf("===========================mtps:%s", utils.Format4Output(result, false))
- delivery.PullTiktokRiderInfo(result)
- if result.LogisticsStatus == model.WaybillStatusCourierArrived {
- result.LogisticsStatus = model.WaybillStatusDelivering
- result.LogisticsContext = model.RiderGetOrderDelivering
- delivery.PullTiktokRiderInfo(result)
- }
+ pushMTPSToTiktok(msg.Status, order)
}
return err
}
+func pushMTPSToTiktok(msgStatus int, order *model.Waybill) {
+ result := &mtpsapi.RiderInfo{
+ OrderId: order.VendorOrderID,
+ ThirdCarrierOrderId: order.VendorOrderID,
+ CourierName: order.CourierName,
+ CourierPhone: order.CourierMobile,
+ LogisticsProviderCode: "10032",
+ LogisticsStatus: order.Status,
+ OpCode: "",
+ }
+ switch msgStatus {
+ case mtpsapi.OrderStatusWaitingForSchedule: // 待接单,召唤骑手
+ result.LogisticsStatus = model.WaybillStatusNew
+ result.LogisticsContext = model.RiderWaitRider
+ case mtpsapi.OrderStatusAccepted: // 已接单
+ result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
+ result.LogisticsContext = model.RiderWaitGetGoods
+ case mtpsapi.OrderStatusDeliverred: // 完成
+ result.LogisticsStatus = model.WaybillStatusDelivered
+ result.LogisticsContext = model.RiderGetOrderDelivered
+ case mtpsapi.OrderStatusCanceled: // 取消
+ result.LogisticsStatus = model.WaybillStatusCanceled
+ result.LogisticsContext = model.RiderGetOrderCanceled
+ case mtpsapi.OrderStatusPickedUp: // 骑手到店
+ result.LogisticsStatus = model.WaybillStatusCourierArrived
+ result.LogisticsContext = model.RiderToStore
+ default:
+ result.LogisticsStatus = 0
+ result.LogisticsContext = model.RiderGetOrderDeliverOther
+ }
+ globals.SugarLogger.Debugf("===========================mtps:%s", utils.Format4Output(result, false))
+ delivery.PullTiktokRiderInfo(result)
+ if result.LogisticsStatus == model.WaybillStatusCourierArrived {
+ result.LogisticsStatus = model.WaybillStatusDelivering
+ result.LogisticsContext = model.RiderGetOrderDelivering
+ delivery.PullTiktokRiderInfo(result)
+ }
+}
+
func (c *DeliveryHandler) pushToGy(msg *mtpsapi.CallbackOrderMsg) {
cl := http.Client{}
params := make(map[string]interface{})
diff --git a/business/partner/printer/feie/feie.go b/business/partner/printer/feie/feie.go
index 1b0cca266..7452468c8 100644
--- a/business/partner/printer/feie/feie.go
+++ b/business/partner/printer/feie/feie.go
@@ -53,8 +53,7 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
}
orderFmt += `
-
-
+%s#%d
--------------------------------
下单时间: %s
预计送达: %s
@@ -68,7 +67,6 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
orderFmt += `
-%s#%d
` + getCode +
`客户: %s
@@ -85,11 +83,11 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
--------------------------------
`
//
orderParams = append(orderParams,
+ jxutils.GetVendorName(order.VendorID),
+ order.OrderSeq,
utils.Time2Str(order.OrderCreatedAt),
utils.Time2Str(expectedDeliveryTime),
order.VendorOrderID,
- jxutils.GetVendorName(order.VendorID),
- order.OrderSeq,
order.VendorOrderID,
order.ConsigneeName,
order.ConsigneeMobile,
@@ -149,15 +147,13 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
}
}
orderFmt += `
-
-
+%s#%d
--------------------------------
下单时间: %s
预计送达: %s
订单编号: %s
-%s#%d
` + getCode +
`客户: %s
@@ -174,11 +170,11 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
--------------------------------
`
//
orderParams = append(orderParams,
+ jxutils.GetVendorName(order.VendorID),
+ order.OrderSeq,
utils.Time2Str(order.OrderCreatedAt),
utils.Time2Str(expectedDeliveryTime),
order.VendorOrderID,
- jxutils.GetVendorName(order.VendorID),
- order.OrderSeq,
order.VendorOrderID,
order.ConsigneeName,
order.ConsigneeMobile,
@@ -214,6 +210,109 @@ func (c *PrinterHandler) getOrderContentBig(order *model.GoodsOrder, storeTel st
return fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...)
}
+// 打印取消或者退款订单
+func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder, printType int, storeDetail *dao.StoreDetail) (content string) {
+ expectedDeliveryTime := order.ExpectedDeliveredTime
+ if utils.IsTimeZero(expectedDeliveryTime) {
+ expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
+ }
+ var orderParams []interface{}
+ orderFmt := ``
+ if storeDetail != nil {
+ if storeDetail.BrandIsPrint == model.NO {
+ orderFmt += `
+
+ `
+ if order.VendorOrgCode == "34665" {
+ orderParams = append(orderParams, globals.StoreNameEbai2)
+ } else {
+ orderParams = append(orderParams, storeDetail.BrandName)
+ }
+ }
+ }
+
+ // 加载用户取消订单售后单
+
+ title := ``
+ if printType == model.YES { // 取消订单
+ title = `
`
+ } else { // 售后订单
+ title = `
`
+ }
+
+ orderFmt +=
+ `--------------------------------\n
+下单时间: %s\n
+订单编号: %s\n
+`
+
+ orderFmt += `
+\n
+%s #%d
+` + title + `
+--------------------------------\n`
+ orderParams = append(orderParams,
+ utils.Time2Str(order.OrderCreatedAt),
+ order.VendorOrderID,
+ jxutils.GetVendorName(order.VendorID),
+ order.OrderSeq,
+ )
+ orderFmt += `
+--------------------------------\n
+`
+ orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice))
+ return strings.Replace(fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...), "\\n", "\r\n", -1)
+}
+
+// 打印取消或者退款订单,大字体
+func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrder, printType int, storeDetail *dao.StoreDetail) (content string) {
+ expectedDeliveryTime := order.ExpectedDeliveredTime
+ if utils.IsTimeZero(expectedDeliveryTime) {
+ expectedDeliveryTime = order.OrderCreatedAt.Add(1 * time.Hour)
+ }
+ var orderParams []interface{}
+ orderFmt := ``
+ if storeDetail != nil {
+ if storeDetail.BrandIsPrint == model.NO {
+ orderFmt += `
+
+ `
+ if order.VendorOrgCode == "34665" {
+ orderParams = append(orderParams, globals.StoreNameEbai2)
+ } else {
+ orderParams = append(orderParams, storeDetail.BrandName)
+ }
+ }
+ }
+ title := ``
+ if printType == model.YES { // 退单
+ title = `
`
+ } else {
+ title = `
`
+ }
+ orderFmt += `--------------------------------
+下单时间: %s
+订单编号: %s
+\n
+%s #%d
+\n
+` + title + `
+--------------------------------\n`
+ orderParams = append(orderParams,
+ utils.Time2Str(order.OrderCreatedAt),
+ order.VendorOrderID,
+ jxutils.GetVendorName(order.VendorID),
+ order.OrderSeq,
+ //order.VendorOrderID,
+ )
+
+ orderFmt += `
+--------------------------------
+`
+ orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice))
+ return strings.Replace(fmt.Sprintf(strings.Replace(orderFmt, "\n", "", -1), orderParams...), "\\n", "\r\n", -1)
+}
+
func (c *PrinterHandler) GetVendorID() int {
return model.VendorIDFeiE
}
@@ -264,7 +363,21 @@ 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 := ""
+ if store.PrinterFontSize == partner.PrinterFontSizeBig || store.PrinterFontSize == partner.PrinterFontSizeBig2 {
+ content = c.getCancelOrRefundOrderContent(order, printType, storeDetail)
+ } else {
+ content = c.getCancelOrRefundOrderContentBig(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, printerSN, printerKey, printerName string, storeID int64) (notUsed1, notUsed2 string, err error) {
diff --git a/business/partner/printer/yilianyun/yilianyun.go b/business/partner/printer/yilianyun/yilianyun.go
index e09c0af71..05faec2b0 100644
--- a/business/partner/printer/yilianyun/yilianyun.go
+++ b/business/partner/printer/yilianyun/yilianyun.go
@@ -49,8 +49,8 @@ func (c *PrinterHandler) getOrderContent(order *model.GoodsOrder, storeTel strin
}
}
}
- orderFmt += `