aa
This commit is contained in:
@@ -27,7 +27,7 @@ func ListenTcp() {
|
|||||||
go HandleTcpMessages()
|
go HandleTcpMessages()
|
||||||
go t.HandleCheckTcpHeart()
|
go t.HandleCheckTcpHeart()
|
||||||
go t.doPrint2(printMsgChan)
|
go t.doPrint2(printMsgChan)
|
||||||
//go t.doPrint(printMsgChanFail)
|
go t.doPrint(printMsgChanFail)
|
||||||
for {
|
for {
|
||||||
c, err := l.Accept()
|
c, err := l.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -95,7 +95,7 @@ func (t *TcpClient) handleConn(c net.Conn) {
|
|||||||
t.addConn(c, printNo, printStatus2JxStatus(data[len(data)-8:len(data)-6]))
|
t.addConn(c, printNo, printStatus2JxStatus(data[len(data)-8:len(data)-6]))
|
||||||
changePrinterStatus(printNo, status)
|
changePrinterStatus(printNo, status)
|
||||||
if status == printerStatusOnline {
|
if status == printerStatusOnline {
|
||||||
//printFail()
|
printFail()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//改变打印机状态
|
//改变打印机状态
|
||||||
@@ -151,7 +151,7 @@ func printFail() (err error) {
|
|||||||
var (
|
var (
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
)
|
)
|
||||||
prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait, printMsgFail, printMsgErr, printMsgAlreadyLoad, printMsgAlreadySend}, time.Now().Add(-time.Hour*3), time.Now(), 0, 999)
|
prints, _ := dao.GetPrintMsgs(db, []int{printMsgFail, printMsgErr, printMsgAlreadyLoad, printMsgAlreadySend}, time.Now().Add(-time.Hour*3), time.Now(), 0, 999)
|
||||||
for _, printMsg := range prints {
|
for _, printMsg := range prints {
|
||||||
printMsgChanFail <- printMsg
|
printMsgChanFail <- printMsg
|
||||||
}
|
}
|
||||||
@@ -190,10 +190,14 @@ func (t *TcpClient) doPrint(printMsgChanFail chan *model.PrintMsg) (err error) {
|
|||||||
//c.Close()
|
//c.Close()
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
||||||
|
dataStr := <-printMsgCallbackChan
|
||||||
|
t.changePrintMsg(dataStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user