diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 324f6fe87..fd9892aca 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -264,7 +264,7 @@ func printFail() (err error) { c net.Conn ) if printMsg != nil { - if err = checkPrintMsg(printMsg); err == nil { + if err = checkPrintMsg(db, printMsg); err == nil { tcpClient.s.RLock() if tcpClient.Clients[printMsg.PrintNo] != nil { if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline { @@ -355,7 +355,7 @@ func HandleTcpMessages() { c net.Conn ) if printMsg != nil { - if err = checkPrintMsg(printMsg); err == nil { + if err = checkPrintMsg(db, printMsg); err == nil { tcpClient.s.RLock() if tcpClient.Clients[printMsg.PrintNo] != nil { if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline { @@ -556,7 +556,7 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) { return result } -func checkPrintMsg(printMsg *model.PrintMsg) (err error) { +func checkPrintMsg(db *dao.DaoDB, printMsg *model.PrintMsg) (err error) { if printMsg.Content == "" { return fmt.Errorf("此打印信息内容为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo) } @@ -566,6 +566,13 @@ func checkPrintMsg(printMsg *model.PrintMsg) (err error) { if printMsg.OrderNo == 0 { return fmt.Errorf("此打印信息订单序号为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo) } + if printer, err := dao.GetPrinter(db, printMsg.PrintNo); err == nil { + if printer != nil { + if printer.FlowFlag == 1 { + return fmt.Errorf("此打印机当月流量已用完,请及时充值!printNo:[%v]", printMsg.PrintNo) + } + } + } return err }