| | |
| | | "fmt" |
| | | "log" |
| | | "net/http" |
| | | _ "net/http/pprof" |
| | | "time" |
| | | ) |
| | | |
| | |
| | | var syncTables = []string{ |
| | | "procedures", |
| | | "process_model", |
| | | "production_progress", |
| | | "work_order", |
| | | "task_status_sync", |
| | | "device", |
| | | "device_plc", |
| | | "system_status", |
| | | "process_model_plc_address", |
| | | "reports_to_cloud", |
| | | "report_work", |
| | | } |
| | | |
| | | agent := serf.InitAgent("apsClient", syncTables, sqlitex.GetDB()) |
| | |
| | | } |
| | | |
| | | //从文件里读取当前生产设备id获取设备列表第一个 |
| | | err := service.InitCurrentDeviceID() |
| | | err := service.InitCurrentDeviceID(serf.Vasystem.ServerID) |
| | | if err != nil { |
| | | logx.Errorf("InitCurrentDeviceID error: %v, exit", err) |
| | | return |
| | | } |
| | | |
| | | go func() { |
| | | service.ReportsSystemDeviceToCloud(serf.Vasystem.ServerID) |
| | | }() |
| | | |
| | | // 判断当前集群状态 |
| | | logx.Infof("current agent.ClusterStatus:%v", agent.ClusterStatus) |
| | | log.Println("current agent.ClusterStatus:", agent.ClusterStatus) |