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

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
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.IS_IN, 1)
.eq(CurrTask.STATUS, 1));
AlarmInfo alarmInfo=new AlarmInfo();
alarmInfo.setEquipmentId(currTask.getKilnId());
alarmInfo.setEquipmentName(currTask.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
alarmInfo.setAlarmInfo(plcNameSpace.getEqName()+""+plcNameSpace.getNote());
alarmInfo.setTaskCode(currTask.getTaskCode());
alarmInfo.setCreateTime(LocalDateTime.now());
alarmInfoServiceBiz.save(alarmInfo);
if (currTaskList.size()!=0){
for (CurrTask currTask:currTaskList
) {
AlarmInfo alarmInfo=new AlarmInfo();
alarmInfo.setEquipmentId(currTask.getKilnId());
alarmInfo.setEquipmentName(currTask.getKilnName());
alarmInfo.setType(0);
alarmInfo.setAlarmCode(CodeGeneratorHelper.getAlarmCode());
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) {
e.printStackTrace();