This commit is contained in:
邹宗楠
2024-05-24 09:49:14 +08:00
parent 6afc1582fa
commit ad5f763b56
16 changed files with 1547 additions and 81 deletions

View File

@@ -41,6 +41,69 @@ func TestAPI_Print(t *testing.T) {
fmt.Println(err)
}
func TestAPI_AddPrinterOrder(t *testing.T) {
orderParams := []interface{}{}
data := `
<font# bolder=0 height=2 width=1>--------------------------------</font#>
<LEFT>下单时间: %s</LEFT>
<LEFT>期望送达: %s</LEFT>
<LEFT>客户姓名: %s</LEFT>
<LEFT>客户电话: %s</LEFT>
<LEFT>店铺名称: %s</LEFT>
<LEFT><font# bolder=1 height=2 width=1>订单编号: %s</font#></LEFT><BR>
<C><font# bolder=0 height=2 width=2>%s#%d</font#>
<QR>%s</QR></C>
` + `` + `<font# bolder=0 height=1 width=1>--------------------------------</font#>
<LEFT><font# bolder=0 height=2 width=1>客户地址: %s</font#></LEFT>
<font# bolder=0 height=1 width=1>--------------------------------</font#>
<LEFT><font# bolder=0 height=2 width=1>客户备注:%s</font#></LEFT>
<font# bolder=0 height=1 width=1>--------------------------------</font#>
商品名` + StrRepeat(" ", 15) + `数量` + StrRepeat(" ", 3) + `金额` + StrRepeat("-", 32) + `
`
orderParams = append(orderParams,
"2024-05-21 13:10:00",
"2024-05-21 14:10:00",
"花花(先生)",
"18582476194,7712",
"成都若溪科技有限公司",
"2301082344187999120",
"美团外卖",
19,
"2301082344187999120",
"仁恒置地广场 (12层)@#四川省成都市锦江区春熙路街道仁恒置地广场",
"【如遇缺货】:缺货时电话与我沟通 收货人隐私号 18582476194,7712手机号 173****9503",
)
data += FormatPrintOrderItemBigV2("娃哈哈纯净水24瓶装", 8, 1)
data += `<BR><LEFT><font# bolder=0 height=2 width=1>共%d种%d件商品 实付:%s</font#></LEFT>
<font# bolder=0 height=2 width=1>--------------#%d完-------------</font#>`
orderParams = append(orderParams, 1, 8, "321.00", 19)
context := fmt.Sprintf(data, orderParams...)
//context := `<font# bolder=0 height=2 width=1>--------------------------------</font#>
//<LEFT>下单时间: 2024-05-21 13:10:00</LEFT>
//<LEFT>期望送达: 2024-05-21 14:10:00</LEFT>
//<LEFT>客户姓名: 花花(先生)</LEFT>
//<LEFT>客户电话: 18582476194,7712</LEFT>
//<LEFT>店铺名称: 成都若溪科技有限公司</LEFT>
//<LEFT><font# bolder=1 height=2 width=1>订单编号: 2301082344187999120</font#></LEFT><BR>
//<C><font# bolder=0 height=2 width=2>美团外卖#19</font#>
//<QR>2301082344187999120</QR></C>
// 美团外卖#19<font# bolder=0 height=1 width=1>--------------------------------</font#>
//<LEFT><font# bolder=0 height=2 width=1>客户地址: 仁恒置地广场 (12层)@#四川省成都市锦江区春熙路街道仁恒置地广场</font#></LEFT>
//<font# bolder=0 height=1 width=1>--------------------------------</font#>
//<LEFT><font# bolder=0 height=2 width=1>客户备注:【如遇缺货】:缺货时电话与我沟通 收货人隐私号 18582476194,7712手机号 173****9503</font#></LEFT>
//<font# bolder=0 height=1 width=1>--------------------------------</font#>
//商品名 数量 金额
//--------------------------------
//<font# bolder=1 height=2 width=1>1.哇哈哈纯净水24瓶装 x8 ¥321.0</font#><BR><BR><LEFT><font# bolder=0 height=2 width=1>共1种8件商品</font#></LEFT>
//<font# bolder=0 height=2 width=1>--------------#19完-------------</font#>`
result, err := api.Print("670020035344", context, "10")
fmt.Println(result)
fmt.Println(err)
}
func TestCal(t *testing.T) {
fmt.Println(utils.Time2Str(time.Now()))
}