record location info when issue happens
This commit is contained in:
parent
0c1038b715
commit
c3cca4bd2b
BIN
APIServer.exe
BIN
APIServer.exe
Binary file not shown.
30
ews/ews.go
30
ews/ews.go
@ -53,8 +53,27 @@ func (e *EWS) RecordIssue(cfg cnf.Cfg, logger *log.Logger, host string, addr str
|
|||||||
firstAck = time.Now().Format("2006-01-02 15:04:05")
|
firstAck = time.Now().Format("2006-01-02 15:04:05")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line := ""
|
||||||
|
col := 0
|
||||||
|
row := 0
|
||||||
|
num := 0
|
||||||
|
locTime := ""
|
||||||
|
loc := dbo.QueryRow(fmt.Sprintf(`SELECT line,col,row,num,DATE_FORMAT(update_time,'%%Y-%%m-%%d %%H:%%i:%%s') FROM locinfo WHERE mac='%s';`, params["MAC"]))
|
||||||
|
err := loc.Scan(&line, &col, &row, &num, &locTime)
|
||||||
|
if locTime == "" {
|
||||||
|
locTime = "0000-00-00 00:00:00"
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
logger.Printf("[ERR] %s; %s; %#v; %s\r\n", addr, uri, params, err.Error())
|
||||||
|
rst["RESULT"] = "NG"
|
||||||
|
rst["ErrMsg"] = err.Error()
|
||||||
|
return rst
|
||||||
|
}
|
||||||
|
|
||||||
stmt, err := dbo.Prepare(
|
stmt, err := dbo.Prepare(
|
||||||
fmt.Sprintf("INSERT INTO %s (usn,mac,ipaddr,relay,partno,mo,sku,line,stage,item,status,message,first_ack,last_change) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?);",
|
fmt.Sprintf(`INSERT INTO %s
|
||||||
|
(usn,mac,ipaddr,relay,partno,mo,sku,line,stage,item,status,message,first_ack,last_change,locline,loccol,locrow,locnum,loctime)
|
||||||
|
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);`,
|
||||||
cfg.MySQL.IssuesTable),
|
cfg.MySQL.IssuesTable),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -80,6 +99,11 @@ func (e *EWS) RecordIssue(cfg cnf.Cfg, logger *log.Logger, host string, addr str
|
|||||||
params["MESSAGE"],
|
params["MESSAGE"],
|
||||||
firstAck,
|
firstAck,
|
||||||
time.Now().Format("2006-01-02 15:04:05"),
|
time.Now().Format("2006-01-02 15:04:05"),
|
||||||
|
line,
|
||||||
|
col,
|
||||||
|
row,
|
||||||
|
num,
|
||||||
|
locTime,
|
||||||
)
|
)
|
||||||
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())
|
||||||
@ -124,6 +148,9 @@ func (e *EWS) SetUutInfo(cfg cnf.Cfg, logger *log.Logger, host string, addr stri
|
|||||||
return rst
|
return rst
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fmt.Sprintf(`SELECT t1.usn,t1.mac,t1.ipaddr,t1.relay,t1.item,t1.status,t1.message,t1.partno,t1.mo,t1.sku,t1.line,t1.stage,t1.first_ack,t1.last_ack,t1.last_change,t2.model
|
||||||
|
// FROM uutinfo t1 LEFT JOIN modelfamily t2 ON t1.partno=t2.modelfamily
|
||||||
|
// WHERE t1.usn='%s';`, params["USN"]))
|
||||||
rec := dbo.QueryRow(
|
rec := dbo.QueryRow(
|
||||||
fmt.Sprintf(`SELECT usn,mac,ipaddr,relay,item,status,message,partno,mo,sku,line,stage,first_ack,last_ack,last_change
|
fmt.Sprintf(`SELECT usn,mac,ipaddr,relay,item,status,message,partno,mo,sku,line,stage,first_ack,last_ack,last_change
|
||||||
FROM uutinfo
|
FROM uutinfo
|
||||||
@ -447,6 +474,7 @@ func (e *EWS) GetUutInfo(cfg cnf.Cfg, logger *log.Logger, host string, addr stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul := new(UutInfo)
|
ul := new(UutInfo)
|
||||||
|
//model := ""
|
||||||
partNO := ""
|
partNO := ""
|
||||||
mfgMO := ""
|
mfgMO := ""
|
||||||
mfgSKU := ""
|
mfgSKU := ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user