解释语句 if (shipData != null && ship_navi_info != null) { int id = shipData.ID; int position_status = ship_navi_info.PositionStatus; var sailAreaType = GetSailAreaType(position_status); if (m_lastPlanDockShipItem.ContainsKey(id) == false) { IBLogManager.Instance.Log("CheckPlanShipList___变更__" + id + "__新数据!!"); flag = true; break; } else { var lastSailAreaType = m_lastPlanDockShipItem[id]; if (lastSailAreaType != sailAreaType) { IBLogManager.Instance.Log("CheckPlanShipList___变更__" + (string.IsNullOrWhiteSpace(shipData.CNName) == true ? shipData.ENName : shipData.CNName) + "__状态变更O___" + lastSailAreaType + "___N___" + sailAreaType); flag = true; break; } } }
时间: 2024-02-10 16:35:01 浏览: 132
这是一段 C# 代码,它首先判断两个变量 `shipData` 和 `ship_navi_info` 是否都不为 null,如果是,就获取 `shipData` 的 ID 和 `ship_navi_info` 的 PositionStatus,然后调用 `GetSailAreaType` 方法获取 `sailAreaType`。接下来,它判断一个名为 `m_lastPlanDockShipItem` 的字典中是否包含当前船只的 ID,如果不包含,则输出一条日志并将变量 `flag` 置为 true,并跳出当前循环。如果包含,则获取 `m_lastPlanDockShipItem` 中该船只对应的上一次状态 `lastSailAreaType`,如果 `lastSailAreaType` 不等于当前状态 `sailAreaType`,则输出一条日志并将变量 `flag` 置为 true,并跳出当前循环。最终,如果循环执行完毕,变量 `flag` 的值仍为 false。
阅读全文
相关推荐


















