|
@@ -12,6 +12,8 @@ import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
|
|
|
import org.jeecg.modules.actualControl.billetActual.billetActual.service.IBilletBasicInfoService;
|
|
|
+import org.jeecg.modules.actualControl.billetActual.billetActual.utils.MqttClientUtil;
|
|
|
+import org.jeecg.modules.actualControl.billetActual.billetActual.utils.TopicType;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.entity.HeatsActuals;
|
|
|
import org.jeecg.modules.actualControl.heatsActuals.service.IHeatsActualsService;
|
|
|
import org.jeecg.modules.billet.billetHotsend.entity.*;
|
|
@@ -54,6 +56,7 @@ import org.jeecg.modules.billet.storageBill.entity.StorageBill;
|
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
|
|
|
import org.jeecg.modules.billet.storageCarLog.entity.StorageCarLog;
|
|
|
import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
|
|
|
+import org.jeecg.modules.connConfig.mapper.ConfigMqttMapper;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -124,6 +127,8 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
private IBilletLiftingBillService billetLiftingBillService;
|
|
|
@Autowired
|
|
|
private IHeatsActualsService heatsActualsService;
|
|
|
+ @Autowired
|
|
|
+ private ConfigMqttMapper configMqttMapper;
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
@@ -725,6 +730,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
finalData.setHeatNo(heatNo);
|
|
|
|
|
|
if (one != null) {
|
|
|
+ finalData.setId(one.getId());
|
|
|
finalData.setNetWeight(one.getMoltenSteelWeight() != null ? one.getMoltenSteelWeight().toString() : null);
|
|
|
finalData.setLadleNo(one.getLadleCode());
|
|
|
finalData.setGrade(one.getGrade());
|
|
@@ -732,6 +738,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
finalData.setSpec(one.getSpec());
|
|
|
finalData.setCcmNo(one.getCasterCode());
|
|
|
} else {
|
|
|
+ finalData.setId("");
|
|
|
finalData.setNetWeight(data.getNetWeight());
|
|
|
finalData.setLadleNo(data.getLadleNo());
|
|
|
finalData.setGrade(data.getGrade());
|
|
@@ -743,6 +750,51 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
|
|
|
return finalData;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void furnaceChange(FurnaceChangeData data) {
|
|
|
+ String ccmNo = data.getCcmNo(); // 铸机号
|
|
|
+ String heatNo = data.getHeatNo(); // 炉号
|
|
|
+ String startPourTime = data.getStartPourTime(); // 开浇时间
|
|
|
+ if (oConvertUtils.isEmpty(ccmNo) || oConvertUtils.isEmpty(heatNo) || oConvertUtils.isEmpty(startPourTime)) {
|
|
|
+ throw new JeecgBootException("换炉失败:铸机号或炉号或开浇时间不能为空!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建最终要传递的对象
|
|
|
+ FurnaceChangeData finalData = new FurnaceChangeData();
|
|
|
+ finalData.setCcmNo(ccmNo);
|
|
|
+ finalData.setHeatNo(heatNo);
|
|
|
+ finalData.setStartPourTime(startPourTime);
|
|
|
+ finalData.setNetWeight(data.getNetWeight());
|
|
|
+ finalData.setLadleNo(data.getLadleNo());
|
|
|
+ finalData.setGrade(data.getGrade());
|
|
|
+ finalData.setSpec(data.getSpec());
|
|
|
+ finalData.setSendTime(formatDate(new Date()));
|
|
|
+
|
|
|
+ // 发送mqtt消息
|
|
|
+ sendFurnaceChangeToMqtt(finalData);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void sendFurnaceChangeToMqtt(FurnaceChangeData data) {
|
|
|
+ try {
|
|
|
+ Map<String, Object> mapSendInfo = new HashMap<>();
|
|
|
+ mapSendInfo.put("netWeight", data.getNetWeight());
|
|
|
+ mapSendInfo.put("ladleNo", data.getLadleNo());
|
|
|
+ mapSendInfo.put("heatNo", data.getHeatNo());
|
|
|
+ mapSendInfo.put("grade", data.getGrade());
|
|
|
+ mapSendInfo.put("startPourTime", data.getStartPourTime());
|
|
|
+ mapSendInfo.put("spec", data.getSpec());
|
|
|
+ mapSendInfo.put("ccmNo", data.getCcmNo());
|
|
|
+ mapSendInfo.put("sendTime", data.getSendTime());
|
|
|
+
|
|
|
+ // 执行MQTT推送,设置合理的超时时间
|
|
|
+ MqttClientUtil mqttClientUtilBe = new MqttClientUtil();
|
|
|
+ mqttClientUtilBe.pushCData(configMqttMapper, mapSendInfo, TopicType.SYN_PUSHBILLETHOTSEND_NEXTSEND.getTopicValue());
|
|
|
+ log.info("B端传递换炉参数,发送MQTT成功: {}", mapSendInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("B端传递换炉参数,发送MQTT异常!", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 通过CcmNo查询结束根
|
|
|
* @param ccmNo
|