This commit is contained in:
邹宗楠
2022-08-04 11:46:56 +08:00
parent b3ced58e91
commit e0e5cbdae5
3 changed files with 8 additions and 4 deletions

View File

@@ -371,7 +371,11 @@ func buildMsg(printMsg *model.PrintMsg) (data []byte, err error) {
orderNoHexH, orderNoHexL, printData string
)
//写入数据
orderNoHexH, orderNoHexL = int2h8l8(int64(orderNo))
no, err := strconv.ParseInt(orderNo, 10, 64)
if err != nil {
globals.SugarLogger.Debug("order_msg Order_no 转换异常")
}
orderNoHexH, orderNoHexL = int2h8l8(no)
// 将数据与模板组装
printDataGBK, _ := jxutils.Utf8ToGbk([]byte(replaceContentOther(content)))
@@ -541,7 +545,7 @@ func checkPrintMsg(db *dao.DaoDB, printMsg *model.PrintMsg) (err error) {
if printMsg.PrintNo == "" {
return fmt.Errorf("此打印信息打印机编号为空printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
}
if printMsg.OrderNo == 0 {
if printMsg.OrderNo == "" {
return fmt.Errorf("此打印信息订单序号为空printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
}
if printer, err := dao.GetPrinter(db, printMsg.PrintNo); err == nil {

View File

@@ -17,7 +17,7 @@ func TestPrintMsg(t *testing.T) {
ModelIDCULD: model.ModelIDCULD{},
PrintNo: "20220707000002",
Content: "<sound>61</sound><sound>62</sound>",
OrderNo: 1,
OrderNo: "1",
Status: 0,
Comment: "",
MsgID: "1",

View File

@@ -5,7 +5,7 @@ type PrintMsg struct {
PrintNo string `json:"print_no" db:"print_no"` //打印机编号
Content string `orm:"type(text)" json:"content" db:"content"` //订单内容
OrderNo int64 `json:"order_no" db:"order_no"` //订单序号
OrderNo string `json:"order_no" db:"order_no"` //订单序号
Status int `json:"status" db:"status"` //打印状态
Comment string `json:"comment" db:"comment"` //失败原因
MsgID string `orm:"column(msg_id)" json:"msgID" db:"msg_id"`