diff --git a/business/jxstore/event/event_tcp.go b/business/jxstore/event/event_tcp.go index 6b363ac8a..c06818208 100644 --- a/business/jxstore/event/event_tcp.go +++ b/business/jxstore/event/event_tcp.go @@ -197,35 +197,10 @@ func HandleTcpMessages(t *TcpClient, printNo string) { } } else { globals.SugarLogger.Debugf("HandleTcpMessages timeout") - //Poll.Stop() return } - //} } Poll.AddJob(fn) - - //go func() { - // for { - // if t.TimeoutMap[printNo] == true { - // timeNow := time.Now() - // timeStart := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location()) - // timeEnd := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 23, 59, 59, 0, timeNow.Location()) - // prints, _ := dao.GetPrintMsgs(db, printNo, []int{printMsgWait}, timeStart.AddDate(0, 0, -1), timeEnd, offset, pageSize) - // for _, printMsg := range prints { - // printMsg.Status = PrintMsgAlreadyLoad - // //先避免重复读再插到channel? - // if _, err := dao.UpdateEntity(db, printMsg, "Status"); err == nil { - // if err = t.addMsgChan(printMsg); err != nil { - // globals.SugarLogger.Debugf("HandleTcpMessages addMsgChan Err: %v", err) - // } - // } - // } - // } else { - // globals.SugarLogger.Debugf("HandleTcpMessages timeout") - // return - // } - // } - //}() } func (t *TcpClient) readTimeoutMap(key string) bool { @@ -240,6 +215,7 @@ func doPrint(t *TcpClient, key string) (err error) { ) if !t.isExistMsg(key) { + globals.SugarLogger.Debugf("==============:= %v", err) return err } @@ -248,6 +224,10 @@ func doPrint(t *TcpClient, key string) (err error) { if t.TimeoutMap[key] == true { select { case printMsg, ok := <-t.MsgMap[key]: + if key == "120220915001467" { + globals.SugarLogger.Debugf("=msgMap=%s", utils.Format4Output(printMsg, false)) + globals.SugarLogger.Debugf("=msgMapok=%s", utils.Format4Output(ok, false)) + } if !ok { globals.SugarLogger.Debugf("doPrint err !ok ...") return diff --git a/business/jxstore/event/event_tcp_utils.go b/business/jxstore/event/event_tcp_utils.go index 40da5fd10..8d3e049b6 100644 --- a/business/jxstore/event/event_tcp_utils.go +++ b/business/jxstore/event/event_tcp_utils.go @@ -642,6 +642,11 @@ func Heartbeat(c net.Conn, t *TcpClient, data string, printNo string) { //4、读打印channel并打印,并切等待回调channel中的消息 //5、修改数据库中打印机状态(没在连接池中说明是重新连接的) //6、监听心跳时间,超过1分多钟就clear掉 + if printNo == "120220915001467" { + globals.SugarLogger.Debugf("==%s", utils.Format4Output(t, false)) + globals.SugarLogger.Debugf("=msgMap=%s", utils.Format4Output(t.MsgMap, false)) + globals.SugarLogger.Debugf("=bool=%s", utils.Format4Output(t.getClients(printNo) == nil, false)) + } if t.getClients(printNo) == nil { addConn(c, t, printNo, status) buildAllMap(t, printNo)