在系统中没有加工任务时也记录炉子报警

This commit is contained in:
lgh 2022-07-09 00:06:40 +08:00
parent 6f0e487bc4
commit 40c4e20949

View File

@ -541,19 +541,35 @@ public class ScheduledTask extends BaseService {
//报警状态为true //报警状态为true
if (resultBoolean){ if (resultBoolean){
//任务状态为执行中且正在炉子中加工的任务 //任务状态为执行中且正在炉子中加工的任务
CurrTask currTask = currTaskServiceBiz.getOne(new QueryWrapper<CurrTask>() List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>()
.eq(CurrTask.KILN_ID, kilnInfo.getId()) .eq(CurrTask.KILN_ID, kilnInfo.getId())
.eq(CurrTask.IS_IN, 1) .eq(CurrTask.IS_IN, 1)
.eq(CurrTask.STATUS, 1)); .eq(CurrTask.STATUS, 1));
AlarmInfo alarmInfo=new AlarmInfo(); if (currTaskList.size()!=0){
alarmInfo.setEquipmentId(currTask.getKilnId()); for (CurrTask currTask:currTaskList
alarmInfo.setEquipmentName(currTask.getKilnName()); ) {
alarmInfo.setType(0); AlarmInfo alarmInfo=new AlarmInfo();
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode()); alarmInfo.setEquipmentId(currTask.getKilnId());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote()); alarmInfo.setEquipmentName(currTask.getKilnName());
alarmInfo.setTaskCode(currTask.getTaskCode()); alarmInfo.setType(0);
alarmInfo.setCreateTime(LocalDateTime.now()); alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfoServiceBiz.save(alarmInfo); alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote());
alarmInfo.setTaskCode(currTask.getTaskCode());
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
}
}
else {
AlarmInfo alarmInfo=new AlarmInfo();
alarmInfo.setEquipmentId(kilnInfo.getId());
alarmInfo.setEquipmentName(kilnInfo.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote());
alarmInfo.setTaskCode("0");
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
}
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();