Show last_ack time in report tables

This commit is contained in:
r0n1n7an 2025-05-06 09:02:10 +08:00
parent 5ab24de4e8
commit 3191c4a95f

View File

@ -766,7 +766,7 @@ func (e *EWS) GetIssueReport(cfg cnf.Cfg, logger *log.Logger, host string, addr
ri := new(ReportInfo) ri := new(ReportInfo)
defect := "" defect := ""
rows, err := dbo.Query(fmt.Sprintf( rows, err := dbo.Query(fmt.Sprintf(
`SELECT usn,partno,sku,mo,line,location,ipaddr,relay,item,status,message,last_change,diffmins `SELECT usn,partno,sku,mo,line,location,ipaddr,relay,item,status,message,last_change,last_ack,diffmins
FROM %s;`, cfg.MySQL.IssuesView)) FROM %s;`, cfg.MySQL.IssuesView))
if err != nil { if err != nil {
logger.Printf("[ERR] %s; %s; %#v; %s\r\n", addr, uri, params, err.Error()) logger.Printf("[ERR] %s; %s; %#v; %s\r\n", addr, uri, params, err.Error())
@ -791,13 +791,14 @@ func (e *EWS) GetIssueReport(cfg cnf.Cfg, logger *log.Logger, host string, addr
&ri.Status, &ri.Status,
&ri.Message, &ri.Message,
&ri.LastChg, &ri.LastChg,
&ri.LastAck,
&ri.DiffMins, &ri.DiffMins,
) )
if err != nil { if err != nil {
break break
} }
temp := fmt.Sprintf(`<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>%s`, temp := fmt.Sprintf(`<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>%s`,
num, ri.USN, ri.PartNO, ri.MfgSKU, ri.MfgMO, ri.Line, ri.Location, ri.IPAddr, ri.Relay, ri.Item, ri.Status, ri.Message, ri.LastChg, ri.DiffMins, "\r\n") num, ri.USN, ri.PartNO, ri.MfgSKU, ri.MfgMO, ri.Line, ri.Location, ri.IPAddr, ri.Relay, ri.Item, ri.Status, ri.Message, ri.LastChg, ri.LastAck, ri.DiffMins, "\r\n")
defect = defect + temp defect = defect + temp
num += 1 num += 1
} }
@ -836,7 +837,7 @@ func (e *EWS) GetOfflineReport(cfg cnf.Cfg, logger *log.Logger, host string, add
ri := new(ReportInfo) ri := new(ReportInfo)
offline := "" offline := ""
rows, err := dbo.Query(fmt.Sprintf( rows, err := dbo.Query(fmt.Sprintf(
`SELECT usn,partno,sku,mo,line,location,ipaddr,relay,item,status,message,last_change,diffmins `SELECT usn,partno,sku,mo,line,location,ipaddr,relay,item,status,message,last_change,last_ack,diffmins
FROM %s;`, cfg.MySQL.OfflineView)) FROM %s;`, cfg.MySQL.OfflineView))
if err != nil { if err != nil {
logger.Printf("[ERR] %s; %s; %#v; %s\r\n", addr, uri, params, err.Error()) logger.Printf("[ERR] %s; %s; %#v; %s\r\n", addr, uri, params, err.Error())
@ -861,13 +862,14 @@ func (e *EWS) GetOfflineReport(cfg cnf.Cfg, logger *log.Logger, host string, add
&ri.Status, &ri.Status,
&ri.Message, &ri.Message,
&ri.LastChg, &ri.LastChg,
&ri.LastAck,
&ri.DiffMins, &ri.DiffMins,
) )
if err != nil { if err != nil {
break break
} }
temp := fmt.Sprintf(`<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>%s`, temp := fmt.Sprintf(`<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>%s`,
num, ri.USN, ri.PartNO, ri.MfgSKU, ri.MfgMO, ri.Line, ri.Location, ri.IPAddr, ri.Relay, ri.Item, ri.Status, ri.Message, ri.LastChg, ri.DiffMins, "\r\n") num, ri.USN, ri.PartNO, ri.MfgSKU, ri.MfgMO, ri.Line, ri.Location, ri.IPAddr, ri.Relay, ri.Item, ri.Status, ri.Message, ri.LastChg, ri.LastAck, ri.DiffMins, "\r\n")
offline = offline + temp offline = offline + temp
num += 1 num += 1
} }
@ -950,7 +952,7 @@ func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
<table> <table>
<tr> <tr>
<th>Model</th> <th>Model</th>
<th>Part NO.</th> <th>Project Code</th>
<th>SKU</th> <th>SKU</th>
<th>MO</th> <th>MO</th>
<th>First Ack</th> <th>First Ack</th>
@ -1030,7 +1032,7 @@ func (e *EWS) TemplateReportInfo(src string) string {
<tr> <tr>
<th>NO.</th> <th>NO.</th>
<th>USN</th> <th>USN</th>
<th>PartNO.</th> <th>Project Code</th>
<th>SKU</th> <th>SKU</th>
<th>MO</th> <th>MO</th>
<th>Line</th> <th>Line</th>
@ -1041,6 +1043,7 @@ func (e *EWS) TemplateReportInfo(src string) string {
<th>Status</th> <th>Status</th>
<th>Message</th> <th>Message</th>
<th>Last Change</th> <th>Last Change</th>
<th>Last Ack</th>
<th>Differ Mins</th> <th>Differ Mins</th>
</tr> </tr>
%s %s