From 358a7d1e4b8b20d90e6fe75161be2fc0a10498e7 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 08 一月 2025 16:24:09 +0800 Subject: [PATCH] 煤气调度 --- shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleGasTask.java | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 105 insertions(+), 0 deletions(-) diff --git a/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleGasTask.java b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleGasTask.java new file mode 100644 index 0000000..02082c4 --- /dev/null +++ b/shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleGasTask.java @@ -0,0 +1,105 @@ +package com.iailab.module.shasteel.job.task; + +import com.iailab.module.model.api.mcs.McsApi; +import com.iailab.module.model.api.mcs.dto.ScheduleSuggestRespDTO; +import com.iailab.module.model.api.mcs.dto.StScheduleSchemeDTO; +import com.iailab.module.model.api.mdk.MdkApi; +import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; +import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; +import com.iailab.module.model.enums.CommonConstant; +import com.iailab.module.model.enums.ScheduleTriggerMethodEnum; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +/** + * 煤气调度 + * 高炉煤气调整量 adjustBFG + * 焦炉煤气调整量 adjustCOG + * 转炉煤气调整量 adjustLDG + * 高炉煤气调度建议 adviceBFG + * 焦炉煤气调度建议 adviceCOG + * 转炉煤气调度建议 adviceLDG + * 机组的煤气(折高)流量 gasConsumption + * 机组的负荷率 loadRates + * 机组的气耗 gasVolume + * + * @author PanZhibao + * @Description + * @createTime 2025年01月08日 + */ +@Component("runScheduleGasTask") +public class RunScheduleGasTask implements ITask { + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private McsApi mcsApi; + + @Autowired + private MdkApi mdkApi; + + @Override + public void run(String params) { + logger.info("RunScheduleGasTask,参数为:{}", params); + try { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.MILLISECOND, 0); + calendar.set(Calendar.SECOND, 0); + Date scheduleTime = calendar.getTime(); + if (StringUtils.isEmpty(params)) { + logger.info("参数为空"); + return; + } + + // 根据条件查找方案 + List<StScheduleSchemeDTO> schemeList = mcsApi.listScheduleScheme(ScheduleTriggerMethodEnum.JOB.getCode(), params); + if (CollectionUtils.isEmpty(schemeList)) { + logger.info("方案为空"); + return; + } + StScheduleSchemeDTO scheme = schemeList.get(0); + MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); + dto.setScheduleTime(scheduleTime); + dto.setScheduleCode(scheme.getCode()); + MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto); + if (!CommonConstant.MDK_STATUS_100.equals(mdkScheduleRespDTO.getStatusCode())) { + logger.info("调度结果异常,STATUS=" + mdkScheduleRespDTO.getStatusCode()); + return; + } + Object adviceBFG = mdkScheduleRespDTO.getResult().get("adviceBFG"); + saveScheduleSuggest("高炉煤气调度建议", adviceBFG, scheme.getScheduleObj(), scheduleTime); + Object adviceCOG = mdkScheduleRespDTO.getResult().get("adviceCOG"); + saveScheduleSuggest("焦炉煤气调度建议", adviceCOG, scheme.getScheduleObj(), scheduleTime); + Object adviceLDG = mdkScheduleRespDTO.getResult().get("adviceLDG"); + saveScheduleSuggest("转炉煤气调度建议", adviceLDG, scheme.getScheduleObj(), scheduleTime); + // 结果写入测点 + mdkApi.scheduleModelOut(mdkScheduleRespDTO); + logger.info(params + "调度方案执行完成"); + } catch (Exception ex) { + logger.error("RunScheduleGasTask运行异常"); + ex.printStackTrace(); + } + logger.info("RunScheduleGasTask运行完成"); + } + + private void saveScheduleSuggest(String title, Object content, String scheduleObj, Date scheduleTime) { + if (content == null || StringUtils.isBlank(content.toString()) || "0".equals(content.toString())) { + logger.info(title + "content为空"); + return; + } + ScheduleSuggestRespDTO suggest = new ScheduleSuggestRespDTO(); + suggest.setTitle(title); + suggest.setContent(content.toString()); + suggest.setScheduleObj(scheduleObj); + suggest.setScheduleTime(scheduleTime); + suggest.setSort(0); + mcsApi.createScheduleSuggest(suggest); + } +} \ No newline at end of file -- Gitblit v1.9.3