新增机台Bug修改

This commit is contained in:
liuzhaotian
2024-09-11 17:42:24 +08:00
parent 9beaa203e0
commit 83bacf8f4f
3 changed files with 140 additions and 130 deletions
@@ -236,9 +236,9 @@ public class GlobalExceptionHandler {
return tableNotExistsResult; return tableNotExistsResult;
} }
if(ex instanceof NullPointerException){ // if(ex instanceof NullPointerException){
return CommonResult.error(DATA_EXCEPTION_ERROR.getCode(), DATA_EXCEPTION_ERROR.getMsg()); // return CommonResult.error(DATA_EXCEPTION_ERROR.getCode(), DATA_EXCEPTION_ERROR.getMsg());
} // }
// 情况二:部分特殊的库的处理 // 情况二:部分特殊的库的处理
if (Objects.equals("io.github.resilience4j.ratelimiter.RequestNotPermitted", ex.getClass().getName())) { if (Objects.equals("io.github.resilience4j.ratelimiter.RequestNotPermitted", ex.getClass().getName())) {
@@ -176,14 +176,16 @@ public class MachineServiceImpl implements MachineService {
JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef"); JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef");
if(advancedConfigsRef.get("isAutoLabelEnabled") != null) {
boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean(); boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean();
if (isAutoLabelEnabled && advancedConfigsRef.has("autoLabelModel")) { if (isAutoLabelEnabled && advancedConfigsRef.has("autoLabelModel")) {
Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt(); Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt();
MachineDO newMachine ; MachineDO newMachine;
if(isMachine){ if (isMachine) {
MachineDO machine = machineMapper.selectById(autoLabelModelId); MachineDO machine = machineMapper.selectById(autoLabelModelId);
if (machine != null) { if (machine != null) {
@@ -241,6 +243,7 @@ public class MachineServiceImpl implements MachineService {
} }
} }
}
return null; return null;
} }
@@ -254,14 +257,16 @@ public class MachineServiceImpl implements MachineService {
JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef"); JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef");
if(cuttingModuleRef.get("isDrillEnabled") != null) {
boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean(); boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean();
if (isDrillEnabled && cuttingModuleRef.has("drillModel")) { if (isDrillEnabled && cuttingModuleRef.has("drillModel")) {
Integer drillModelId = cuttingModuleRef.get("drillModel").asInt(); Integer drillModelId = cuttingModuleRef.get("drillModel").asInt();
MachineDO newMachine ; MachineDO newMachine;
if(isMachine){ if (isMachine) {
MachineDO machine = machineMapper.selectById(drillModelId); MachineDO machine = machineMapper.selectById(drillModelId);
if (machine != null) { if (machine != null) {
@@ -319,6 +324,7 @@ public class MachineServiceImpl implements MachineService {
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
} }
} }
}
return null; return null;
} }
@@ -503,9 +503,10 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef"); JsonNode advancedConfigsRef = cuttingSetting.get("advancedConfigsRef");
if(advancedConfigsRef.get("isAutoLabelEnabled") != null) {
boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean(); boolean isAutoLabelEnabled = advancedConfigsRef.get("isAutoLabelEnabled").asBoolean();
if(isAutoLabelEnabled && advancedConfigsRef.get("autoLabelBrand") != null && advancedConfigsRef.get("autoLabelModel") != null){ if (isAutoLabelEnabled && advancedConfigsRef.get("autoLabelBrand") != null && advancedConfigsRef.get("autoLabelModel") != null) {
Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt(); Integer autoLabelModelId = advancedConfigsRef.get("autoLabelModel").asInt();
@@ -535,12 +536,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
// 将 Map 转换为 JSON 字符串 // 将 Map 转换为 JSON 字符串
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
}catch (Exception e){ } catch (Exception e) {
throw exception(LABELINGMACHINE_RELATED_DATA_ERROR); throw exception(LABELINGMACHINE_RELATED_DATA_ERROR);
} }
} }
}
return null; return null;
} }
@@ -552,9 +554,10 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef"); JsonNode cuttingModuleRef = drillSetting.get("cuttingModuleRef");
if(cuttingModuleRef.get("isDrillEnabled") != null) {
boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean(); boolean isDrillEnabled = cuttingModuleRef.get("isDrillEnabled").asBoolean();
if(isDrillEnabled && cuttingModuleRef.get("drillBrand") != null && cuttingModuleRef.get("drillModel") != null){ if (isDrillEnabled && cuttingModuleRef.get("drillBrand") != null && cuttingModuleRef.get("drillModel") != null) {
Integer drillModelId = cuttingModuleRef.get("drillModel").asInt(); Integer drillModelId = cuttingModuleRef.get("drillModel").asInt();
@@ -584,12 +587,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
// 将 Map 转换为 JSON 字符串 // 将 Map 转换为 JSON 字符串
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(map);
}catch (Exception e){ } catch (Exception e) {
throw exception(DRILLMACHINE_RELATED_DATA_ERROR); throw exception(DRILLMACHINE_RELATED_DATA_ERROR);
} }
} }
}
return null; return null;
} }