This commit is contained in:
suyl
2021-07-29 18:25:00 +08:00
parent b18672e92d
commit 37440aa104
2 changed files with 12 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ func (t *TcpClient) handleConn(c net.Conn) {
//t.Lock()
//t.Clients[printNo] = printInfo
//t.Unlock()
t.addConn(c, printNo, printStatus2JxStatus(data[len(data)-8:len(data)-6]))
t.addConn(c, printNo, status)
t.buildCallBackMap(printNo)
changePrinterStatus(printNo, status)
if status == printerStatusOnline {
@@ -298,10 +298,14 @@ func (t *TcpClient) doPrint2(printMsgChan chan *model.PrintMsg) (err error) {
dao.UpdateEntity(db, printMsg, "Status", "Comment")
if t.CallBackMap[printMsg.PrintNo] != nil {
t.RLock()
dataStr := <-t.CallBackMap[printMsg.PrintNo]
select {
case dataStr := <-t.CallBackMap[printMsg.PrintNo]:
a, b := getCallbackMsgInfo(dataStr)
t.changePrintMsg(dataStr, a, b)
case <-timeoutChan:
}
t.RUnlock()
a, b := getCallbackMsgInfo(dataStr)
t.changePrintMsg(dataStr, a, b)
}
//dataStr := <-printMsgCallbackChan
}