aa
This commit is contained in:
@@ -264,7 +264,7 @@ func printFail() (err error) {
|
|||||||
c net.Conn
|
c net.Conn
|
||||||
)
|
)
|
||||||
if printMsg != nil {
|
if printMsg != nil {
|
||||||
if err = checkPrintMsg(printMsg); err == nil {
|
if err = checkPrintMsg(db, printMsg); err == nil {
|
||||||
tcpClient.s.RLock()
|
tcpClient.s.RLock()
|
||||||
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
||||||
if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline {
|
if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline {
|
||||||
@@ -355,7 +355,7 @@ func HandleTcpMessages() {
|
|||||||
c net.Conn
|
c net.Conn
|
||||||
)
|
)
|
||||||
if printMsg != nil {
|
if printMsg != nil {
|
||||||
if err = checkPrintMsg(printMsg); err == nil {
|
if err = checkPrintMsg(db, printMsg); err == nil {
|
||||||
tcpClient.s.RLock()
|
tcpClient.s.RLock()
|
||||||
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
||||||
if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline {
|
if tcpClient.Clients[printMsg.PrintNo].Status == printerStatusOnline {
|
||||||
@@ -556,7 +556,7 @@ func replaceContent(content string, printMsg *model.PrintMsg) (result string) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkPrintMsg(printMsg *model.PrintMsg) (err error) {
|
func checkPrintMsg(db *dao.DaoDB, printMsg *model.PrintMsg) (err error) {
|
||||||
if printMsg.Content == "" {
|
if printMsg.Content == "" {
|
||||||
return fmt.Errorf("此打印信息内容为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
|
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 {
|
if printMsg.OrderNo == 0 {
|
||||||
return fmt.Errorf("此打印信息订单序号为空!printMsg printNo:[%v], orderNo :[%v]", printMsg.PrintNo, printMsg.OrderNo)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user