fix: 修改设备驱动重复的问题

This commit is contained in:
yanps
2023-11-28 14:01:52 +08:00
parent 970dbd8d7b
commit f8a42c402e
2 changed files with 22 additions and 20 deletions

View File

@@ -2267,6 +2267,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
DeviceDto device = this.findByCode(device_code);
String device_type = device.getDevice_type();
List<Dict> dictList = iSysDictService.getDictByName("device_type");
Set<JSONObject> uniqueDriverSet = new HashSet<>();
dictList.forEach(dict ->{
if(StrUtil.equals(dict.getValue(),device_type)){
List<DeviceDriverDefination> driverList = deviceDriverDefinationAppService.getDeviceDriverDefinations(DeviceType.getName(dict.getLabel()));
@@ -2275,11 +2276,12 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
JSONObject jo = new JSONObject();
jo.put("code",deviceDriverDefination.getDriverCode());
jo.put("name",deviceDriverDefination.getDriverName());
ja.add(jo);
uniqueDriverSet.add(jo);
}
);
}
});
ja = JSONArray.parseArray(JSON.toJSONString(uniqueDriverSet));
return ja;
}
}

View File

@@ -235,81 +235,81 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
if (!command.equals(last_command)) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(command));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_command + "->" + command);
logServer.deviceExecuteLog(this.device_code, "", "", "信号command" + last_command + "->" + command);
}
if (!task.equals(last_task)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_task + "->" + task);
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (!error.equals(last_error)) {
if (0 != error) {
}
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_error + "->" + error);
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (!z.equals(last_z)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(z));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_z + "->" + z);
logServer.deviceExecuteLog(this.device_code, "", "", "信号z" + last_z + "->" + z);
}
if (!x.equals(last_x)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(x));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_x + "->" + x);
logServer.deviceExecuteLog(this.device_code, "", "", "信号z" + last_x + "->" + x);
}
if (!y.equals(last_y)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_y + "->" + y);
logServer.deviceExecuteLog(this.device_code, "", "", "信号y" + last_y + "->" + y);
}
if (!move.equals(last_move)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_move + "->" + move);
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (!cargoMove.equals(last_cargoMove)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(cargoMove));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_cargoMove + "->" + cargoMove);
logServer.deviceExecuteLog(this.device_code, "", "", "信号cargoMove" + last_cargoMove + "->" + cargoMove);
}
if (!action.equals(last_action)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_action + "->" + action);
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (!distancex.equals(last_distancex)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancex));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_distancex + "->" + distancex);
logServer.deviceExecuteLog(this.device_code, "", "", "信号distancex" + last_distancex + "->" + distancex);
}
if (!distancey.equals(last_distancey)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(distancey));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_distancey + "->" + distancey);
logServer.deviceExecuteLog(this.device_code, "", "", "信号distancey" + last_distancey + "->" + distancey);
}
if (!cargoError.equals(last_cargoError)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(cargoError));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_cargoError + "->" + cargoError);
logServer.deviceExecuteLog(this.device_code, "", "", "信号cargoError" + last_cargoError + "->" + cargoError);
}
if (!forkCargo.equals(last_forkCargo)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkCargo));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_forkCargo + "->" + forkCargo);
logServer.deviceExecuteLog(this.device_code, "", "", "信号forkCargo" + last_forkCargo + "->" + forkCargo);
}
if (!forkLocation.equals(last_forkLocation)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkLocation));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_forkLocation + "->" + forkLocation);
logServer.deviceExecuteLog(this.device_code, "", "", "信号forkLocation" + last_forkLocation + "->" + forkLocation);
}
if (!forkAction.equals(last_forkAction)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(forkAction));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_forkAction + "->" + forkAction);
logServer.deviceExecuteLog(this.device_code, "", "", "信号forkAction" + last_forkAction + "->" + forkAction);
}
if (!special1.equals(last_special1)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_special1 + "->" + special1);
logServer.deviceExecuteLog(this.device_code, "", "", "信号special1" + last_special1 + "->" + special1);
}
if (!special2.equals(last_special2)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(special2));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_special2 + "->" + special2);
logServer.deviceExecuteLog(this.device_code, "", "", "信号special2" + last_special2 + "->" + special2);
}
if (!Arrays.equals(trayCode, last_trayCode)) {
logServer.deviceItemValue(this.device_code, "mode", Arrays.toString(trayCode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + Arrays.toString(last_trayCode) + "->" + Arrays.toString(trayCode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号trayCode" + Arrays.toString(last_trayCode) + "->" + Arrays.toString(trayCode));
}
if (!storage_cache.equals(last_storage_cache)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(storage_cache));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_storage_cache + "->" + storage_cache);
logServer.deviceExecuteLog(this.device_code, "", "", "信号storage_cache" + last_storage_cache + "->" + storage_cache);
}
/*if (!stacker_rpm.equals(last_stacker_rpm)) {
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(stacker_rpm));