PRODUCING到PRODUCT状态转化bug修复,计划更改,辊缝追踪加入动态追踪,修复退火炉张力读写问题

This commit is contained in:
2026-01-22 17:20:18 +08:00
parent b5dfb0c9b4
commit cd192d86ba
7 changed files with 56 additions and 40 deletions

View File

@@ -86,7 +86,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
EntryMovementMessage msg =new EntryMovementMessage();
writeMessage( msg,entryMoveIds);
log.info("接收入口移动信号:从 {} 移动到 {} ", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
logDataService.logInfo("TRACK","Received entry movement signal: from {} to {}", msg.getMaterialPlaceSource(), msg.getMaterialPlaceDestination());
logDataService.logInfo("TRACK","Received entry movement signal: from " + msg.getMaterialPlaceSource() + " to " + msg.getMaterialPlaceDestination());
opcReceiverHandler.onMessageReceived(OpcMessageType.ENTRY_MOVEMENT,msg);
} catch (Exception e) {
}
@@ -98,7 +98,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
ExitCutMessage msg = new ExitCutMessage();
writeMessage(msg,exitCutIds);
log.info("接收到出口剪切信号:剪切类型 {},剪切长度{} ", msg.getCutType().toString(), msg.getCutLength());
logDataService.logInfo("TRACK","Received exit cut signal: cut type {}, cut length {}", msg.getCutType().toString(), msg.getCutLength());
logDataService.logInfo("TRACK","Received exit cut signal: cut type " + msg.getCutType().toString() + ", cut length " + msg.getCutLength());
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_CUT,msg);
} catch (Exception e) {
}
@@ -110,7 +110,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
ExitMovementMessage msg = new ExitMovementMessage();
writeMessage( msg,exitMoveIds);
log.info("接收出口移动信号:从 {} 移动到 {} ", msg.getExSrc(), msg.getExDesc());
logDataService.logInfo("TRACK","Received exit movement signal: from {} to {}", msg.getExSrc(), msg.getExDesc());
logDataService.logInfo("TRACK","Received exit movement signal: from " + msg.getExSrc() + " to " + msg.getExDesc());
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MOVEMENT,msg);
} catch (Exception e) {
}
@@ -122,7 +122,7 @@ public class MessageSubscriptionRunner implements ApplicationRunner {
ExitMeasureMessage msg = new ExitMeasureMessage();
writeMessage(msg,exitMeasureIds);
log.info("接收出口称重信号:重量 {} ", msg.getWeight());
logDataService.logInfo("TRACK","Received exit weight signal: weight {}", msg.getWeight());
logDataService.logInfo("TRACK","Received exit weight signal: weight " + msg.getWeight());
opcReceiverHandler.onMessageReceived(OpcMessageType.EXIT_MEASURE,msg);
} catch (Exception e) {
}

View File

@@ -14,24 +14,24 @@ import java.util.*;
@Getter
public enum DeviceEnum {
// === Entry section / 入口段 ===
POR1(0, "Uncoiler #1", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr1", "stripSpeed","bR4or5toBR6Tension")),
POR2(1, "Uncoiler #2", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr2", "stripSpeed","bR4or5toBR6Tension")),
POR1(0, "Uncoiler #1", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr1", "stripSpeed","tensionBr45Br6")),
POR2(1, "Uncoiler #2", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr2", "stripSpeed","tensionBr45Br6")),
WELDER(2, "Welder", 4.98, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("weldStatus")),
ENL1(3, "Entry Looper #1", 19.04, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel")),
ENL2(4, "Entry Looper #2", 167.09, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel")),
ENL3(5, "Entry Looper #3", 198.19, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel","bR4or5toBR6Tension")),
ENL1(3, "Entry Looper #1", 19.041, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel")),
ENL2(4, "Entry Looper #2", 167.091, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel")),
ENL3(5, "Entry Looper #3", 198.191, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel","tensionBr45Br6")),
// === Process section / 工艺段 ===
CLEAN(6, "Cleaning Section", 264.803, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("cleaningVoltage", "cleaningCurrent", "alkaliConcentration", "alkaliTemperature")),
FUR1(7, "Annealing Furnace - Preheating", 302.837, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("phfExitStripTemp", "potTemperature", "gasConsumption")),
FUR2(8, "Annealing Furnace - Heating", 381.057, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("rtfExitStripTemp", "zincPotPower")),
FUR3(9, "Annealing Furnace - Cooling", 416.837, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("jcsExitStripTemp", "coolingTowerStripTemp")),
FUR4(10, "Annealing Furnace - Equalizing", 432.16, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("scsExitStripTemp")),
POT(11, "Zinc Pot", 442.994, SectionType.PROCESS, SourceType.COAT, Arrays.asList("scsExitStripTemp")),
TOWER(12, "Cooling Tower", 563.594, SectionType.PROCESS, SourceType.COAT, Arrays.asList("scsExitStripTemp")),
TM(13, "Temper Mill", 586.529, SectionType.PROCESS, SourceType.COAT, Arrays.asList("tensionBr5Tm", "stripSpeedTmExit")),
TL(14, "Tension Leveler", 612.909, SectionType.PROCESS, SourceType.COAT, Arrays.asList("tlElongation", "tensionTlBr7")),
COAT(15, "Post-treatment Section", 712.699, SectionType.PROCESS, SourceType.COAT, Arrays.asList(
FUR3(9, "Annealing Furnace - Cooling", 398.947, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("jcsExitStripTemp", "coolingTowerStripTemp")),
FUR4(10, "Annealing Furnace - Equalizing", 414.27, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("scsExitStripTemp")),
POT(11, "Zinc Pot", 425.104, SectionType.PROCESS, SourceType.COAT, Arrays.asList("scsExitStripTemp")),
TOWER(12, "Cooling Tower", 545.659, SectionType.PROCESS, SourceType.COAT, Arrays.asList("scsExitStripTemp")),
TM(13, "Temper Mill", 568.639, SectionType.PROCESS, SourceType.COAT, Arrays.asList("tensionBr5Tm", "stripSpeedTmExit")),
TL(14, "Tension Leveler", 595.019, SectionType.PROCESS, SourceType.COAT, Arrays.asList("tlElongation", "tensionTlBr7")),
COAT(15, "Post-treatment Section", 694.809, SectionType.PROCESS, SourceType.COAT, Arrays.asList(
"avrCoatingWeightTop","stdCoatingWeightTop","maxCoatingWeightTop","minCoatingWeightTop",
"avrCoatingWeightBottom","stdCoatingWeightBottom","maxCoatingWeightBottom","minCoatingWeightBottom",
"airKnifePressure","airKnifeFlow","airKnifeGap","stripSpeedTmExit","tensionBr8Tm",
@@ -42,10 +42,10 @@ public enum DeviceEnum {
)),
// === Exit section / 出口段 ===
CXL1(16, "Exit Looper #1", 720.709, SectionType.EXIT, SourceType.EXIT, Arrays.asList("cxlLength", "cxlCapacity", "tensionCxl")),
CXL2(17, "Exit Looper #2", 888.789, SectionType.EXIT, SourceType.EXIT, Arrays.asList("cxlLength", "cxlCapacity", "tensionCxl")),
CXL1(16, "Exit Looper #1", 702.819, SectionType.EXIT, SourceType.EXIT, Arrays.asList("cxlLength", "cxlCapacity", "tensionCxl")),
CXL2(17, "Exit Looper #2", 870.899, SectionType.EXIT, SourceType.EXIT, Arrays.asList("cxlLength", "cxlCapacity", "tensionCxl")),
// INS(18, "Inspection Station", 940.561, SectionType.EXIT, SourceType.EXIT, Arrays.asList("inspectionStatus")),
TR(18, "Recoiler", 952.819, SectionType.EXIT, SourceType.EXIT, Arrays.asList("coilLength", "speedExitSection", "tensionBr9Tr")),
TR(18, "Recoiler", 934.929, SectionType.EXIT, SourceType.EXIT, Arrays.asList("coilLength", "speedExitSection", "tensionBr9Tr")),
EXC(19, "Coil Car", 9999999.0, SectionType.EXIT, SourceType.EXIT, Collections.emptyList()),
WEIGHT(20, "Weighing Saddle", 9999999.0, SectionType.EXIT, SourceType.EXIT, Collections.emptyList());

View File

@@ -32,6 +32,9 @@ public class AppMeasureEntryMessage extends OpcMessage {
@Schema(description = "钢带张力 BR2 BR3 (daN)")
private BigDecimal tensionBr2Br3;
@Schema(description = "钢带张力 BR4/5 BR6 (daN)")
private BigDecimal tensionBr45Br6;
@Schema(description = "钢带速度 (m/min)")
private BigDecimal stripSpeed;
@@ -74,6 +77,4 @@ public class AppMeasureEntryMessage extends OpcMessage {
@Schema(description = "热风压力 (Pa)")
private BigDecimal hotAirPressure;
@Schema(description = "钢带张力 BR4/5 BR6 (daN)")
private BigDecimal bR4or5toBR6Tension;
}

View File

@@ -56,7 +56,7 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
pdoExCoilService.saveExCoil(exitCoilInfo);
if (exitCoilInfo.isLastFlag()) {
logDataService.logInfo("TRACK", "当前trMatmap的值为 -> matId={}, planId={}", trMatmap.getMatId(), trMatmap.getPlanId());
logDataService.logInfo("TRACK", "当前trMatmap的值为 -> matId=" + trMatmap.getMatId() + ", planId=" + trMatmap.getPlanId());
trackService.l1OperateMat(L1OperateMatForm.builder()
.trIdx(TR.getIdx())
.entryMatId(exitCoilInfo.getEntryMatId())
@@ -65,7 +65,7 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
.build());
logDataService.logInfo("EXIT_CUT", "成功处理 EXIT_CUT 消息,已保存成品卷 -> exitMatId={}, planId={}, entryMatId={}", exitCoilInfo.getExitMatId(), exitCoilInfo.getPlanId(), trMatmap.getMatId());
logDataService.logInfo("EXIT_CUT", "成功处理 EXIT_CUT 消息,已保存成品卷 -> exitMatId=" + exitCoilInfo.getExitMatId() + ", planId=" + exitCoilInfo.getPlanId() + ", entryMatId=" + trMatmap.getMatId());
}
}

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fizz.business.domain.CrmPdiPlan;
import com.fizz.business.form.ChangePlanStatusForm;
import com.fizz.business.constants.enums.PlanStatusEnum;
import com.fizz.business.form.PlanQueryForm;
import com.fizz.business.mapper.CrmPdiPlanMapper;
import com.fizz.business.service.CrmPdiPlanService;
@@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Slf4j
@@ -167,7 +169,7 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
if (StrUtil.isBlank(build.getMatId())) {
logDataService.logInfo("PLAN", "changeStatus matId为空, planId={}, operation={}", build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "changeStatus matId为空, planId=" + build.getId() + ", operation=" + build.getOperation());
return false;
}
@@ -182,18 +184,32 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
CrmPdiPlan pdiPlan = baseMapper.selectOne(wrapper);
if (pdiPlan == null) {
logDataService.logInfo("PLAN", "未找到计划记录, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "未找到计划记录, matId=" + build.getMatId() + ", planId=" + build.getId() + ", operation=" + build.getOperation());
return false;
}
pdiPlan.setStatus(build.getOperation());
String oldStatus = pdiPlan.getStatus();
String newStatus = build.getOperation();
// 状态机保护:禁止已完成(PRODUCT)的计划回退到生产中(PRODUCING)
if (PlanStatusEnum.PRODUCT.name().equals(oldStatus) && PlanStatusEnum.PRODUCING.name().equals(newStatus)) {
logDataService.logWarn("PLAN", "拦截计划状态回退: matId=" + build.getMatId() + ", planId=" + build.getId() + ", " + oldStatus + " -> " + newStatus);
return true;
}
// 幂等:同状态重复更新直接放行(避免重复写库导致的误判)
if (Objects.equals(oldStatus, newStatus)) {
return true;
}
pdiPlan.setStatus(newStatus);
int rows = baseMapper.updateById(pdiPlan);
if (rows <= 0) {
logDataService.logInfo("PLAN", "计划状态更新失败, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "计划状态更新失败, matId=" + build.getMatId() + ", planId=" + build.getId() + ", operation=" + newStatus);
return false;
}
logDataService.logInfo("PLAN", "计划状态更新成功, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "计划状态更新成功, matId=" + build.getMatId() + ", planId=" + build.getId() + ", {} -> {}", oldStatus, newStatus);
return true;
}

View File

@@ -115,7 +115,7 @@ public class OpcMessageIdsManager {
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.rinseTemperature","rinseTemperature");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.dryingTemperature","dryingTemperature");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.BR4or5toBR6Tension","bR4or5toBR6Tension");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.BR4or5toBR6Tension","tensionBr45Br6");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirFlow","hotAirFlow");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirPressure","hotAirPressure");
}

View File

@@ -79,7 +79,7 @@ public class SegmentTrackerService {
try {
trackCoilHeadPosition(coilId, entryLengthAtWelder, entry, exit);
} catch (Exception e) {
logDataService.logInfo("TRACK", "trackCoilHeadPosition异常, coilId={}, err={}", coilId, String.valueOf(e));
logDataService.logInfo("TRACK", "trackCoilHeadPosition异常, coilId=" + coilId + ", err=" + String.valueOf(e));
}
Long lastTime = lastLogTimeMap.get(coilId);
@@ -105,7 +105,7 @@ public class SegmentTrackerService {
Long lastTime1 = lastNewCoilLogTimeMap.get(coilId);
if (lastTime1 == null || now1 - lastTime1 > intervalTime) {
lastNewCoilLogTimeMap.put(coilId, now1);
logDataService.logInfo("WELDER", "检测到新钢卷或初始化, CoilId={}", coilId);
logDataService.logInfo("WELDER", "检测到新钢卷或初始化, CoilId=" + coilId);
}
} else {
weldDev = entryLengthAtWelder.subtract(weldLength);
@@ -128,7 +128,7 @@ public class SegmentTrackerService {
// 5. 完成日志
logDataService.logInfo("TRACK", "处理完成, CoilId={}, 当前长度={}, 已生成段数={}", coilId, entryLengthAtWelder, coilSegNum);
logDataService.logInfo("TRACK", "处理完成, CoilId=" + coilId + ", 当前长度=" + entryLengthAtWelder + ", 已生成段数=" + coilSegNum);
}
@@ -144,7 +144,7 @@ public class SegmentTrackerService {
BigDecimal weldDev) {
if (listSegment.isEmpty()) {
// === 【处理开始日志】===
logDataService.logWarn("TRACK", "treatSeg: listSegment为空直接返回, coilSegNum={}", coilSegNum);
logDataService.logWarn("TRACK", "treatSeg: listSegment为空直接返回, coilSegNum=" + coilSegNum);
return;
}
@@ -155,7 +155,7 @@ public class SegmentTrackerService {
// payOffReelNumber=1/2 代表当前跟踪的是哪一路开卷机入口。
// 这里做保护,避免 entry 为空或值异常导致误写 matmap。
// === 【处理开始日志】===
logDataService.logInfo("TRACK", "开始处理段数据, count={}, weldDev={}, celLength={}, cxlLength={}", listSegment.size(), weldDev, celLength, cxlLength);
logDataService.logInfo("TRACK", "开始处理段数据, count=" + listSegment.size() + ", weldDev=" + weldDev + ", celLength=" + celLength + ", cxlLength=" + cxlLength);
Iterator<SegmentDTO> iterator = listSegment.descendingIterator();
while (iterator.hasNext()) {
@@ -362,15 +362,15 @@ public class SegmentTrackerService {
public void trackCoilHeadPosition(String coilId, BigDecimal headPos,
AppMeasureEntryMessage entry, AppMeasureExitMessage exit) {
logDataService.logInfo("MATMAP-TRACK", "trackCoilHeadPosition 当前线程={}", Thread.currentThread().getName());
logDataService.logInfo("MATMAP-TRACK", "trackCoilHeadPosition 当前线程=" + Thread.currentThread().getName());
if (LogRateLimiter.shouldLog("TRACK:" + coilId, 5000)) {
logDataService.logInfo("MATMAP-TRACK", "焊缝位置匹配逻辑, coilId={}, weldLen={}", coilId, headPos);
logDataService.logInfo("MATMAP-TRACK", "焊缝位置匹配逻辑, coilId=" + coilId + ", weldLen=" + headPos);
}
Integer payOffReelNumber = entry != null ? entry.getPayOffReelNumber() : null;
if (payOffReelNumber == null || payOffReelNumber < 1) {
logDataService.logWarn("MATMAP-TRACK", "trackCoilHeadPosition: invalid payOffReelNumber={}, coilId={}", payOffReelNumber, coilId);
logDataService.logWarn("MATMAP-TRACK", "trackCoilHeadPosition: invalid payOffReelNumber=" + payOffReelNumber + ", coilId=" + coilId);
return;
}
@@ -388,7 +388,7 @@ public class SegmentTrackerService {
for (DeviceEnum d : DeviceEnum.values()) {
double dynPos = stripPositionService.calculate(d, celLength, cxlLength);
if (LogRateLimiter.shouldLog("TRACK:DYNPOS:" + coilId, 5000)) {
logDataService.logInfo("MATMAP-TRACK", "焊缝位置匹配, coilId={}, headPos={}, device={}, dynPos={}", coilId, headPos, d.name(), dynPos);
logDataService.logInfo("MATMAP-TRACK", "焊缝位置匹配, coilId=" + coilId + ", headPos=" + headPos + ", device=" + d.name() + ", dynPos=" + dynPos);
}
boolean positionReached = headPos.compareTo(BigDecimal.valueOf(dynPos)) >= 0;
@@ -399,8 +399,7 @@ public class SegmentTrackerService {
if (d == DeviceEnum.WELDER && entry != null && entry.getStripSpeed() != null) {
if (entry.getStripSpeed().doubleValue() > LOWSPEEDLIMIT) {
welderIsMoving = true;
logDataService.logInfo("MATMAP-TRACK", "WELDER速度触发状态变更, coilId={}, speed={}, limit={}",
coilId, entry.getStripSpeed().doubleValue(), LOWSPEEDLIMIT);
logDataService.logInfo("MATMAP-TRACK", "WELDER速度触发状态变更, coilId=" + coilId + ", speed=" + entry.getStripSpeed().doubleValue() + ", limit=" + LOWSPEEDLIMIT);
}
}