优化日志

This commit is contained in:
2025-10-17 10:44:20 +08:00
parent fa437b30aa
commit 3b967aa449
4 changed files with 10 additions and 7 deletions

View File

@@ -179,6 +179,7 @@ func (g *GeneralDeviceService) Collect(regionalControllerID uint, devicesToColle
g.logger.Warnf("跳过设备 %d因生成Modbus RTU读取指令失败: %v", dev.ID, err)
continue
}
g.logger.Debugf("生成485指令: %v", modbusCommandBytes)
// 构建 Raw485Command包含总线号
raw485Cmd := &proto.Raw485Command{
@@ -229,7 +230,7 @@ func (g *GeneralDeviceService) Collect(regionalControllerID uint, devicesToColle
g.logger.Errorf("序列化采集指令失败 (CorrelationID: %s): %v", correlationID, err)
return err
}
g.logger.Infof("构造空中载荷成功: networkID: %v, payload: %v", networkID, instruction)
if _, err := g.comm.Send(networkID, payload); err != nil {
g.logger.DPanicf("待采集请求 (CorrelationID: %s) 已创建,但发送到设备失败: %v。数据可能不一致", correlationID, err)
return err