Compare commits

..

No commits in common. "cb37ca5077368d6651f04f105077667ff3fa95ae" and "4230e0889aab9175c0139ab48cd10760084bb127" have entirely different histories.

View File

@ -38,8 +38,6 @@ type ReportInfo struct {
MfgMO string MfgMO string
Line string Line string
Location string Location string
IPAddr string
Relay string
Item string Item string
Status string Status string
Message string Message string
@ -696,7 +694,7 @@ func (e *EWS) GetUutInfo(cfg cnf.Cfg, logger *log.Logger, host string, addr stri
} }
if loc == "" { if loc == "" {
loc = `<span style="color: red;">N/A</span>` loc = `<span style="color: red;">Unknown</span>`
} else { } else {
loc = fmt.Sprintf(`<span>%s</span>`, loc) loc = fmt.Sprintf(`<span>%s</span>`, loc)
} }
@ -766,8 +764,9 @@ 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,first_ack,last_ack,last_change,diffmins `SELECT usn,partno,sku,mo,line,location,item,status,message,first_ack,last_ack,last_change,diffmins
FROM %s;`, cfg.MySQL.IssuesView)) FROM %s
ORDER BY diffmins ASC;`, 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())
rst["RESULT"] = "NG" rst["RESULT"] = "NG"
@ -785,11 +784,11 @@ func (e *EWS) GetIssueReport(cfg cnf.Cfg, logger *log.Logger, host string, addr
&ri.MfgMO, &ri.MfgMO,
&ri.Line, &ri.Line,
&ri.Location, &ri.Location,
&ri.IPAddr,
&ri.Relay,
&ri.Item, &ri.Item,
&ri.Status, &ri.Status,
&ri.Message, &ri.Message,
&ri.FirstAck,
&ri.LastAck,
&ri.LastChg, &ri.LastChg,
&ri.DiffMins, &ri.DiffMins,
) )
@ -797,13 +796,13 @@ func (e *EWS) GetIssueReport(cfg cnf.Cfg, logger *log.Logger, host string, addr
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></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.Item, ri.Status, ri.Message, ri.FirstAck, ri.LastAck, ri.LastChg, ri.DiffMins, "\r\n")
defect = defect + temp defect = defect + temp
num += 1 num += 1
} }
rst["RESULT"] = "OK" rst["RESULT"] = "OK"
rst["ErrMsg"] = e.TemplateReportInfo(defect) rst["ErrMsg"] = e.TemplateDefectInfo(defect)
return rst return rst
} }
@ -836,8 +835,9 @@ 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,item,status,message,first_ack,last_ack,last_change,diffmins
FROM %s;`, cfg.MySQL.OfflineView)) FROM %s
ORDER BY diffmins DESC;`, 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())
rst["RESULT"] = "NG" rst["RESULT"] = "NG"
@ -855,11 +855,11 @@ func (e *EWS) GetOfflineReport(cfg cnf.Cfg, logger *log.Logger, host string, add
&ri.MfgMO, &ri.MfgMO,
&ri.Line, &ri.Line,
&ri.Location, &ri.Location,
&ri.IPAddr,
&ri.Relay,
&ri.Item, &ri.Item,
&ri.Status, &ri.Status,
&ri.Message, &ri.Message,
&ri.FirstAck,
&ri.LastAck,
&ri.LastChg, &ri.LastChg,
&ri.DiffMins, &ri.DiffMins,
) )
@ -867,13 +867,13 @@ func (e *EWS) GetOfflineReport(cfg cnf.Cfg, logger *log.Logger, host string, add
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></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.Item, ri.Status, ri.Message, ri.FirstAck, ri.LastAck, ri.LastChg, ri.DiffMins, "\r\n")
offline = offline + temp offline = offline + temp
num += 1 num += 1
} }
rst["RESULT"] = "OK" rst["RESULT"] = "OK"
rst["ErrMsg"] = e.TemplateReportInfo(offline) rst["ErrMsg"] = e.TemplateDefectInfo(offline)
return rst return rst
} }
@ -972,7 +972,7 @@ func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
<th>MAC</th> <th>MAC</th>
<th>IP Address</th> <th>IP Address</th>
<th>Server</th> <th>Server</th>
<th>Item</th> <th>Test Item</th>
<th>Status</th> <th>Status</th>
<th>Message</th> <th>Message</th>
<th>Last Change</th> <th>Last Change</th>
@ -985,7 +985,7 @@ func (e *EWS) TemplateUutInfo(loc, locTime, misc, last, bkup string) string {
return resp return resp
} }
func (e *EWS) TemplateReportInfo(src string) string { func (e *EWS) TemplateDefectInfo(src string) string {
now := time.Now().Format("2006-01-02 15:04:05") now := time.Now().Format("2006-01-02 15:04:05")
if src == "" { if src == "" {
src = fmt.Sprintf(`<span style="color: red;">[%s] NO Records !</span><br/>`, now) src = fmt.Sprintf(`<span style="color: red;">[%s] NO Records !</span><br/>`, now)
@ -1035,13 +1035,13 @@ func (e *EWS) TemplateReportInfo(src string) string {
<th>MO</th> <th>MO</th>
<th>Line</th> <th>Line</th>
<th>Location</th> <th>Location</th>
<th>IP Address</th>
<th>Server</th>
<th>Item</th> <th>Item</th>
<th>Status</th> <th>Status</th>
<th>Message</th> <th>Message</th>
<th>First Ack</th>
<th>Last Ack</th>
<th>Last Change</th> <th>Last Change</th>
<th>Differ Mins</th> <th>Differ Time (Min)</th>
</tr> </tr>
%s %s
</table> </table>