aa
This commit is contained in:
@@ -206,35 +206,19 @@ func handleConn(c net.Conn) {
|
||||
)
|
||||
if printMsg != nil {
|
||||
if err = checkPrintMsg(printMsg); err == nil {
|
||||
if tcpClient.Clients[printMsg.PrintNo] != nil {
|
||||
if tcpClient.Clients[printMsg.PrintNo].C != nil {
|
||||
c = tcpClient.Clients[printMsg.PrintNo].C
|
||||
data, err = buildMsg(printMsg)
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
//改变打印机状态
|
||||
|
||||
Reference in New Issue
Block a user