From 947a2a7ce414fc2bc64eefa9d9fd6fe14f7c3a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 10 Aug 2022 09:34:24 +0800 Subject: [PATCH] 1 --- business/model/print_temp_utils.go | 38 ++++++++++++++++++------------ business/model/print_temp_voice.go | 8 +++++-- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/business/model/print_temp_utils.go b/business/model/print_temp_utils.go index b4730353c..0629aa069 100644 --- a/business/model/print_temp_utils.go +++ b/business/model/print_temp_utils.go @@ -152,7 +152,10 @@ func MakePrintMsgOnTempVoice(param map[string]string, setting *PrintSettingObj, // 打运单 if param[WayBillStatusPrint] != "" { + switch param[WayBillStatusPrint] { + case "15": + } } // 门店状态 @@ -275,29 +278,34 @@ func PrinterOrderVoice(param map[string]string, setting *PrintSettingObj, userId } // PrintWayBillOrderStatus 打印运单类通知消息 -func PrintWayBillOrderStatus(param map[string]string, setting *PrintSettingObj) { +func PrintWayBillOrderStatus(param map[string]string, setting *PrintSettingObj) string { var ( printVoiceMsg string //语音信息 printVoiceValue = make([]interface{}, 0, 0) - textMsg string // 文本信息 - err error + textMsg string // 文本信息 + textMsgValue = make([]interface{}, 0, 0) // 文本信息 ) switch param[WayBillStatusPrint] { - case: - if setting.PickingSetting.WaitPickingPrint == SettingOpen { // 打印订单 - textMsg, err = MakePrintMsgOnTemp(param, userId) - if err != nil { - return "", err - } + case utils.Int2Str(WaybillStatusAccepted), utils.Int2Str(WaybillStatusCourierAssigned): // 分配骑手 + if setting.RiderVoiceSetting.RiderTakeOrder == SettingOpen { // 打印订单 + textMsg += `
接单骑手信息:

` + textMsg += `
骑手姓名: %s

` + textMsg += `
骑手电话: %s

` + textMsg += `
接单时间: %s

` + textMsg += `
订单来源: %s

` + textMsg += `
单号: #%s

` + textMsgValue = append(textMsgValue, param[RiderNamePrint], param[RiderNamePrint], utils.Time2DateStr(time.Now()), param[VendorNamePrint], param[VendorOrderNoPrint]) } - if setting.PickingSetting.WaitPickingVoice == SettingOpen && setting.SystemVoice == SettingClose { // 订单通知 - printVoiceMsg += `%s%s` // 你有订单未拣货 - printVoiceValue = append(printVoiceValue, WaitPickUpOrderVoice) - printVoiceMsg, printVoiceValue = SyntheticSpeech(printVoiceMsg, printVoiceValue, param) - } - } + if setting.RiderVoiceSetting.RiderTakeOrderVoice == SettingOpen && setting.SystemVoice == SettingClose { // 骑手接单语音通知 + printVoiceMsg += `%s%s` // 骑手已经接单了 + printVoiceValue = append(printVoiceValue, RiderGetOrderVoice) + } + + msg := strings.Replace(fmt.Sprintf(strings.Replace(textMsg, "\n", "", -1), textMsgValue...), "\\n", "\r\n", -1) + voice := strings.Replace(fmt.Sprintf(strings.Replace(printVoiceMsg, "\n", "", -1), printVoiceValue...), "\\n", "\r\n", -1) + return voice + msg } // PrintStoreStatus 打印门店状态 diff --git a/business/model/print_temp_voice.go b/business/model/print_temp_voice.go index ffffe0c8f..b1875d0fd 100644 --- a/business/model/print_temp_voice.go +++ b/business/model/print_temp_voice.go @@ -12,7 +12,7 @@ func init() { "5": FiveVoice, "6": SixVoice, "7": SevenVoice, - "8": EightyVoice, + "8": EightVoice, "9": NineVoice, "10": TenVoice, "20": TwentyVoice, @@ -149,5 +149,9 @@ const ( AppIDPrint = "appId" // 应用id OrderStatusPrint = "orderStatus" // 订单状态 WayBillStatusPrint = "wayBillStatus" // 运单状态 - StoreStatusPrint = "storeStatusPrint" // 门店状态 + StoreStatusPrint = "storeStatus" // 门店状态 + + RiderVendorIdPrint = "riderVendorId" // 骑手所属平台id + RiderNamePrint = "riderName" // 骑手名称 + RiderPhonePrint = "riderPhone" // 骑手电话 )