This commit is contained in:
suyl
2021-07-09 16:19:05 +08:00
parent e8ac03ce9c
commit 0a8211dd5b
2 changed files with 9 additions and 8 deletions

View File

@@ -252,7 +252,6 @@ func changePrintMsg(data string) (err error) {
printNo, comment string
orderNo int64
status int
printMsg = &model.PrintMsg{}
)
//1、先找出打印机编号和订单序列号这两个确定唯一一条消息
orderNo = h8l82int(data[len(data)-6:len(data)-4], data[len(data)-4:len(data)-2])
@@ -270,15 +269,17 @@ func changePrintMsg(data string) (err error) {
if tcpClient.Clients[printNo] == nil {
return err
}
if printMsg, err = dao.GetPrintMsg(db, printNo, orderNo); err != nil {
if printMsgs, err := dao.GetPrintMsgNoPage(db, printNo, orderNo); err != nil {
globals.SugarLogger.Debugf("changePrintMsg err :[%v]", err)
return
} else if printMsg == nil {
} else if len(printMsgs) == 0 {
globals.SugarLogger.Debugf("changePrintMsg err ,not found printMsg printNo:[%v], orderNo :[%v]", printNo, orderNo)
} else if printMsg.Status != status {
printMsg.Comment = comment
printMsg.Status = status
dao.UpdateEntity(db, printMsg, "Comment", "Status")
} else if len(printMsgs) > 0 {
for _, v := range printMsgs {
v.Comment = comment
v.Status = status
dao.UpdateEntity(db, v, "Comment", "Status")
}
}
return err
}

View File

@@ -6,7 +6,7 @@ import (
"time"
)
func GetPrintMsg(db *DaoDB, printNo string, orderNo int64) (prints *model.PrintMsg, err error) {
func GetPrintMsgNoPage(db *DaoDB, printNo string, orderNo int64) (prints []*model.PrintMsg, err error) {
sql := `
SELECT *
FROM print_msg