| | |
| | | oldPlcRecord, err := model.NewDevicePlcSearch().SetDeviceId(msg.ID).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | err = model.NewDevicePlcSearch().Create(&record) |
| | | } else if record.Port != oldPlcRecord.Port || |
| | | record.Method != oldPlcRecord.Method || |
| | | } else if record.Port != oldPlcRecord.Port || record.Method != oldPlcRecord.Method || |
| | | record.Address != oldPlcRecord.Address || |
| | | record.Detail != oldPlcRecord.Detail { |
| | | record.Detail != oldPlcRecord.Detail || |
| | | record.BaudRate != oldPlcRecord.BaudRate || |
| | | record.SerialName != oldPlcRecord.SerialName || |
| | | record.DataBit != oldPlcRecord.DataBit || |
| | | record.StopBit != oldPlcRecord.StopBit || |
| | | record.Parity != oldPlcRecord.Parity { |
| | | |
| | | oldPlcRecord.Port = record.Port |
| | | oldPlcRecord.Method = record.Method |
| | | oldPlcRecord.Address = record.Address |
| | | oldPlcRecord.Port = record.Port |
| | | oldPlcRecord.Detail = record.Detail |
| | | oldPlcRecord.BaudRate = record.BaudRate |
| | | oldPlcRecord.SerialName = record.SerialName |
| | | oldPlcRecord.DataBit = record.DataBit |
| | | oldPlcRecord.StopBit = record.StopBit |
| | | oldPlcRecord.Parity = record.Parity |
| | | |
| | | err = model.NewDevicePlcSearch().Save(oldPlcRecord) |
| | | } |
| | | if err != nil { |