3.8 KiB
代码评审
1. TwoNDCSocketConnectionAutoRun.java
中的问题
-
冗余代码: 在
AirShowerDoorDeviceDriver
和StandardAutodoorDeviceDriver
的writing
方法调用中,存在重复的代码。例如,airShowerDoorDeviceDriver.writing("to_open", "1");
和airShowerDoorDeviceDriver.writing("to_close", "0");
应该合并为一个方法调用,以减少代码冗余。 -
不必要的空指针检查: 在
if (device.getDeviceDriver() instanceof AirShowerDoorDeviceDriver)
中,如果device
为null
,则会抛出NullPointerException
。应该添加空指针检查。 -
代码逻辑: 在处理
AirShowerDoorDeviceDriver
和StandardAutodoorDeviceDriver
的逻辑中,存在一些不必要的条件判断。例如,if ("AD4".equals(device.getDevice_code()) && airShowerDoorDeviceDriver.getClose2() == 1)
可以简化。
2. DeviceServiceImpl.java
中的问题
- 代码冗余: 在
setDeviceStatus
方法中,存在重复的代码。例如,if (device.getDeviceDriver() instanceof RollUpRollerManipulatorDeviceDriver)
和if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver)
应该合并为一个方法调用。
3. AgvNdcTwoDeviceDriver.java
中的问题
-
代码冗余: 在
setDeviceStatus
方法中,存在重复的代码。例如,if (device.getDeviceDriver() instanceof OvenGantryManipulatorDeviceDriver)
和if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver)
应该合并为一个方法调用。 -
逻辑错误: 在
if (StrUtil.equals(device_code, next_device_code) || StrUtil.equals(device_code, next_device_code2))
中,如果device_code
、next_device_code
和next_device_code2
都为null
,则会抛出NullPointerException
。应该添加空指针检查。
4. AirShowerDoorDeviceDriver.java
和 ItemProtocol.java
中的问题
- 代码冗余: 在
ItemProtocol
类中,存在重复的代码。例如,item_open
和item_close
可以合并为一个ItemDto
。
5. ManipulatorAgvStationDeviceDriver.java
中的问题
- 代码冗余: 在
setDeviceStatus
方法中,存在重复的代码。例如,if (StrUtil.equals(requestSucess, "0"))
和if (StrUtil.equals(requestSucess, "1"))
可以合并为一个方法调用。
6. OvenGantryManipulatorDeviceDriver.java
中的问题
- 代码冗余: 在
setDeviceStatus
方法中,存在重复的代码。例如,if (StrUtil.equals(requireActionSucess, "0"))
和if (StrUtil.equals(requireActionSucess, "1"))
可以合并为一个方法调用。
7. AcsToWmsService.java
和 AcsToWmsServiceImpl.java
中的问题
- 代码冗余: 在
AcsToWmsService
和AcsToWmsServiceImpl
中,存在重复的代码。例如,if (result2.getStatus() == 200)
和if (result2.getStatus() != 200)
可以合并为一个方法调用。
8. RawFoilPdaServiceImpl.java
中的问题
- 代码冗余: 在
createVirtualContainer
方法中,存在重复的代码。例如,ObjectUtil.isNotEmpty(orderCode) ? orderCode : createVirtualContainer(rollCode, "yyMMddHHmmss", sbPoint.getExt_code())
可以简化。
9. SlitterPdaServiceImpl.java
中的问题
- 代码冗余: 在
apply
方法中,存在重复的代码。例如,"01".equals(cutPoint.getFull_point_status()) ? "0" : "1"
可以简化。
10. OtherPdaServiceImpl.java
中的问题
- 代码冗余: 在
apply
方法中,存在重复的代码。例如,"01".equals(cutPoint.getFull_point_status()) ? "0" : "1"
可以简化。
11. OtherOperationService.java
和 OtherOperationServiceImpl.java
中的问题
- 代码冗余: 在
getSJGHCPointStatus
方法中,存在重复的代码。例如,if (point.getPoint_status().equals("1"))
和 `if (point.getPoint_status().equals("2"))