aa
This commit is contained in:
@@ -206,35 +206,19 @@ func handleConn(c net.Conn) {
|
|||||||
)
|
)
|
||||||
if printMsg != nil {
|
if printMsg != nil {
|
||||||
if err = checkPrintMsg(printMsg); err == nil {
|
if err = checkPrintMsg(printMsg); err == nil {
|
||||||
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
if c != nil {
|
||||||
if tcpClient.Clients[printMsg.PrintNo].C != nil {
|
if _, err = c.Write(data); err != nil {
|
||||||
c = tcpClient.Clients[printMsg.PrintNo].C
|
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
||||||
data, err = buildMsg(printMsg)
|
delete(tcpClient.Clients, printMsg.PrintNo)
|
||||||
|
c.Close()
|
||||||
|
} else {
|
||||||
|
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
||||||
|
printMsg.Status = printMsgAlreadySend
|
||||||
|
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
printMsg.Status = printMsgErr
|
|
||||||
printMsg.Comment = err.Error()
|
|
||||||
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
|
||||||
delete(tcpClient.Clients, printMsg.PrintNo)
|
|
||||||
if c != nil {
|
|
||||||
c.Close()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if c != nil {
|
|
||||||
if _, err = c.Write(data); err != nil {
|
|
||||||
globals.SugarLogger.Debugf("handleTcpMessages err [%v]", err)
|
|
||||||
delete(tcpClient.Clients, printMsg.PrintNo)
|
|
||||||
c.Close()
|
|
||||||
} else {
|
|
||||||
globals.SugarLogger.Debugf("handleTcpMessages success, data: %v", hex.EncodeToString(data))
|
|
||||||
printMsg.Status = printMsgAlreadySend
|
|
||||||
dao.UpdateEntity(db, printMsg, "Status", "Comment")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//改变打印机状态
|
//改变打印机状态
|
||||||
|
|||||||
Reference in New Issue
Block a user