获取打印消息
This commit is contained in:
@@ -26,19 +26,27 @@ func GetPrinters(db *DaoDB, appID int, printNo string) (printers []*model.Printe
|
||||
return printers, err
|
||||
}
|
||||
|
||||
func GetPrintMsgs(db *DaoDB, printNo string) (printMsgs []*model.PrintMsg, err error) {
|
||||
func GetPrintMsgs(db *DaoDB, printNo, msgID string, status int) (printMsgs []*model.PrintMsg, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
FROM print_msg
|
||||
WHERE 1 = 1 AND deleted_at = ? AND status = ?
|
||||
WHERE 1 = 1 AND deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue, model.PrinterStatusNormal,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if status != model.PrintMsgAll {
|
||||
sql += " AND status = ?"
|
||||
sqlParams = append(sqlParams, status)
|
||||
}
|
||||
if printNo != "" {
|
||||
sql += " AND print_no = ?"
|
||||
sqlParams = append(sqlParams, printNo)
|
||||
}
|
||||
if msgID != "" {
|
||||
sql += " AND msg_id = ?"
|
||||
sqlParams = append(sqlParams, msgID)
|
||||
}
|
||||
err = GetRows(db, &printMsgs, sql, sqlParams)
|
||||
return printMsgs, err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@ const (
|
||||
PrinterStatusOnlineWithoutPaper = 2 //在线正常缺纸
|
||||
PrinterStatusOnline = 1 //在线正常
|
||||
PrinterStatusOffline = -1 //离线
|
||||
|
||||
PrintMsgAlreadySend = 2 //已经发出打印消息
|
||||
PrintMsgSuccess = 1 //打印成功
|
||||
PrintMsgWait = 0 //待打印
|
||||
PrintMsgFail = -1 //打印失败(打印机报出)
|
||||
PrintMsgErr = -2 //京西报出
|
||||
PrintMsgAll = -9
|
||||
)
|
||||
|
||||
type Printer struct {
|
||||
|
||||
Reference in New Issue
Block a user