aa
This commit is contained in:
@@ -30,6 +30,7 @@ const (
|
||||
printMsgWait = 0 //待打印
|
||||
printMsgFail = -1 //打印失败(打印机报出)
|
||||
printMsgErr = -2 //京西报出
|
||||
printMsgAlreadyLoad = 3 //已放入队列
|
||||
|
||||
heartErrNormal = "00" //正常
|
||||
heartErrWithoutPaper = "04" //心跳错,缺纸
|
||||
@@ -142,7 +143,7 @@ func ListenTcp() {
|
||||
globals.SugarLogger.Debugf("begin listenTcp port 8000......")
|
||||
go HandleTcpMessages()
|
||||
go HandleCheckTcpHeart()
|
||||
//go doPrint(printMsgChanFail)
|
||||
go doPrint(printMsgChanFail)
|
||||
go doPrint2(printMsgChan)
|
||||
for {
|
||||
c, err := l.Accept()
|
||||
@@ -265,6 +266,8 @@ func printFail() (err error) {
|
||||
prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait, printMsgFail, printMsgErr}, time.Now().Add(-time.Hour*3), time.Now(), 0, 999)
|
||||
for _, printMsg := range prints {
|
||||
printMsgChanFail <- printMsg
|
||||
printMsg.Status = printMsgAlreadyLoad
|
||||
dao.UpdateEntity(db, printMsg, "Status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -366,6 +369,8 @@ func HandleTcpMessages() {
|
||||
prints, _ := dao.GetPrintMsgs(db, []int{printMsgWait}, time.Now().Add(-time.Hour*3), time.Now(), offset, pageSize)
|
||||
for _, printMsg := range prints {
|
||||
printMsgChan <- printMsg
|
||||
printMsg.Status = printMsgAlreadyLoad
|
||||
dao.UpdateEntity(db, printMsg, "Status")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user