|
@@ -25,10 +25,10 @@ import com.sckj.l2.entity.TL2Material;
|
|
|
import com.sckj.l2.service.impl.L2DataServiceImpl;
|
|
|
import com.sckj.l2.service.impl.TL2DataServiceImpl;
|
|
|
import com.sckj.l2.service.impl.TL2MaterialServiceImpl;
|
|
|
-import com.sckj.opc.dto.L2Data;
|
|
|
-import com.sckj.opc.dto.L2Material;
|
|
|
+import com.sckj.l2.dto.L2Data;
|
|
|
+import com.sckj.l2.dto.L2Material;
|
|
|
import com.sckj.opc.entity.OPCData;
|
|
|
-import com.sckj.opc.opcua.OPCDAServiceImpl;
|
|
|
+import com.sckj.opc.dauaservice.OPCDAServiceImpl;
|
|
|
import com.sckj.opc.service.OPCDataServiceImpl;
|
|
|
import com.sckj.opc.utils.CustomUtil;
|
|
|
import com.sckj.warn.entity.TAudio;
|
|
@@ -37,6 +37,7 @@ import com.sckj.warn.service.impl.TAudioServiceImpl;
|
|
|
import com.sckj.warn.validate.TExceptionLogCreateValidate;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
@@ -113,6 +114,9 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
OPCDAServiceImpl opcdaService;
|
|
|
|
|
|
|
|
|
+ //炉前申请出铁
|
|
|
+ private static final String STEP_LQCT = "lqct";
|
|
|
+
|
|
|
//预判和确认出铁
|
|
|
private static final String STEP_YPQRCT = "lnct";
|
|
|
|
|
@@ -208,7 +212,7 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
//实时出铁总重量/总流量
|
|
|
private BigDecimal mTotalWeight = BigDecimal.ZERO;
|
|
|
//总干量
|
|
|
- private BigDecimal mTotalDry = BigDecimal.ZERO;
|
|
|
+// private BigDecimal mTotalDry = BigDecimal.ZERO;
|
|
|
//耗时(单位:s)
|
|
|
private AtomicInteger mSecondsElapsed = new AtomicInteger(0);
|
|
|
|
|
@@ -322,13 +326,13 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
|
|
|
//实时数据
|
|
|
taskExecutor.submit(() -> {
|
|
|
-
|
|
|
+ setRealtimeDataAndStatus(opcData, null);
|
|
|
});
|
|
|
- setRealtimeDataAndStatus(opcData, null);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//出铁次数编号
|
|
|
- private String mIronNo;
|
|
|
+ private Long mIronNo;
|
|
|
|
|
|
/***
|
|
|
* L2数据项
|
|
@@ -348,45 +352,36 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
ironTimeNoDTO.setDesc(String.format("%s第%s次出铁", dateString, ironTimeNoDTO.getIronNo()));
|
|
|
PushData.send2IronTimeNo(ironTimeNoDTO);
|
|
|
|
|
|
- TL2Data tl2Data = new TL2Data();
|
|
|
- //出铁操作
|
|
|
- BeanUtils.copyProperties(l2Data, tl2Data);
|
|
|
- //将L2实时数据保存到数据库
|
|
|
- taskExecutor.submit(() -> {
|
|
|
- tl2DataService.saveOrUpdate(tl2Data);
|
|
|
- });
|
|
|
-
|
|
|
- //将L2实时数据保存到Redis
|
|
|
- taskExecutor.submit(() -> {
|
|
|
- RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, MAX_REDIS_COUNT);
|
|
|
- });
|
|
|
|
|
|
//推送实时数据
|
|
|
taskExecutor.submit(() -> {
|
|
|
setRealtimeDataAndStatus(null, l2Data);
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showTheoryWeight(List<TL2Data> latest2DataList) {
|
|
|
taskExecutor.submit(() -> {
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
|
if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
|
|
|
//处理子项
|
|
|
for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
if (STEP_TLC.equals(child.getIdentifier())) {
|
|
|
- List<L2Data> latest2Data = (List<L2Data>) RedisUtils.getFixedElement(IRON_ELEMENT, 2);
|
|
|
- if (latest2Data.size() >= 2) {
|
|
|
+ if (latest2DataList.size() >= 2) {
|
|
|
HashMap[] hashMaps = new HashMap[6];
|
|
|
child.setExtraInfo(hashMaps);
|
|
|
//理论出铁量 = 矿批 × 综合品位 × 1.06
|
|
|
//铁量差 = 理论出铁量 - 实际出铁量
|
|
|
- L2Data tl2Data1Last = latest2Data.get(0);
|
|
|
- BigDecimal llLast = new BigDecimal(tl2Data1Last.getTotalDry()).multiply(new BigDecimal(1.0)).multiply(new BigDecimal(1.06));
|
|
|
- BigDecimal ironWeightLast = new BigDecimal(tl2Data1Last.getIronWeight());
|
|
|
- BigDecimal tlcLast = llLast.subtract(ironWeightLast);
|
|
|
+ TL2Data tl2Data1Last = latest2DataList.get(0);
|
|
|
+ BigDecimal llLast = new BigDecimal(tl2Data1Last.getTheoryWeight()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal ironWeightLast = new BigDecimal(tl2Data1Last.getIronWeight()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal tlcLast = llLast.subtract(ironWeightLast).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
- L2Data tl2Data1LastLast = latest2Data.get(1);
|
|
|
- BigDecimal llLastLast = new BigDecimal(tl2Data1LastLast.getTotalDry()).multiply(new BigDecimal(1.0)).multiply(new BigDecimal(1.06));
|
|
|
- BigDecimal ironWeightLastLast = new BigDecimal(tl2Data1Last.getIronWeight());
|
|
|
- BigDecimal tlcLastLast = llLastLast.subtract(ironWeightLastLast);
|
|
|
+ TL2Data tl2Data1LastLast = latest2DataList.get(1);
|
|
|
+ BigDecimal llLastLast = new BigDecimal(tl2Data1LastLast.getTheoryWeight()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal ironWeightLastLast = new BigDecimal(tl2Data1LastLast.getIronWeight()).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal tlcLastLast = llLastLast.subtract(ironWeightLastLast).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
//铁量差在合理范围内
|
|
|
// 上一次铁量差:-30 上上次铁量差:20 t
|
|
@@ -402,16 +397,22 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
for (IronStepVO grandChild : child.getChilds()) {
|
|
|
if (sctlc.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(tlcLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
} else if (ssctlc.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(tlcLastLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
} else if (scll.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(llLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
} else if (sscll.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(llLastLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
} else if (scsj.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(ironWeightLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
} else if (sscsj.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(ironWeightLastLast);
|
|
|
+ grandChild.setStepName(StringUtils.substringBefore(grandChild.getStepName(), ":") + ":" + grandChild.getData());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -422,7 +423,6 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
setStepResult(mSteps);
|
|
|
PushData.send2Operation(mSteps, ironLoading1.get());
|
|
|
});
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -437,12 +437,12 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
tl2MaterialService.save(tl2Material);
|
|
|
});
|
|
|
|
|
|
- if (ironLoading1.get()) {
|
|
|
- BigDecimal bigDecimalNew = new BigDecimal(material.getDryWeight());
|
|
|
- mTotalDry = mTotalDry.add(bigDecimalNew);
|
|
|
- } else {
|
|
|
- mTotalDry = BigDecimal.ZERO;
|
|
|
- }
|
|
|
+// if (ironLoading1.get()) {
|
|
|
+// BigDecimal bigDecimalNew = new BigDecimal(material.getDryWeight());
|
|
|
+// mTotalDry = mTotalDry.add(bigDecimalNew);
|
|
|
+// } else {
|
|
|
+// mTotalDry = BigDecimal.ZERO;
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -559,7 +559,7 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
private void taphole1End() {
|
|
|
//由 1-> 0 表明1号铁口结束出铁
|
|
|
mTotalWeight = BigDecimal.ZERO;
|
|
|
- mTotalDry = BigDecimal.ZERO;
|
|
|
+// mTotalDry = BigDecimal.ZERO;
|
|
|
scheduledTaskManager.cancelTask(TaskNameConstants.TASKNAME_OPEN_WARN);
|
|
|
scheduledTaskManager.cancelTask(TaskNameConstants.TASKNAME_CLOSE_WARN);
|
|
|
scheduledTaskManager.cancelTask(TaskNameConstants.TASKNAME_TAPPING_WARN);
|
|
@@ -918,6 +918,12 @@ public class DeviceEventListener extends EventListener implements ApplicationLis
|
|
|
PushData.send2Operation(mSteps, ironLoading1.get());
|
|
|
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
|
+ if (STEP_LQCT.equals(stepDTO.getIdentifier()) && stepDTO.getPassResult() == 1) {
|
|
|
+ //
|
|
|
+ List<TL2Data> tl2DataList = tl2DataService.getLatest2Data();
|
|
|
+ showTheoryWeight(tl2DataList);
|
|
|
+ }
|
|
|
+
|
|
|
for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
if (Objects.equals(child.getIdentifier(), CAR_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|