日志优化+PRODUCING到PRODUCT状态转化优化

This commit is contained in:
2026-01-21 19:28:29 +08:00
parent 675dd43262
commit b5dfb0c9b4
7 changed files with 28 additions and 39 deletions

View File

@@ -14,12 +14,12 @@ import java.util.*;
@Getter @Getter
public enum DeviceEnum { public enum DeviceEnum {
// === Entry section / 入口段 === // === Entry section / 入口段 ===
POR1(0, "Uncoiler #1", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr1", "stripSpeed")), 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")), POR2(1, "Uncoiler #2", 0.0, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("tensionPorBr2", "stripSpeed","bR4or5toBR6Tension")),
WELDER(2, "Welder", 4.98, SectionType.ENTRY, SourceType.ENTRY, Arrays.asList("weldStatus")), 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")), 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")), 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")), ENL3(5, "Entry Looper #3", 198.19, SectionType.PROCESS, SourceType.ENTRY, Arrays.asList("celLength", "celCapacity", "tensionCel","bR4or5toBR6Tension")),
// === Process section / 工艺段 === // === Process section / 工艺段 ===
CLEAN(6, "Cleaning Section", 264.803, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("cleaningVoltage", "cleaningCurrent", "alkaliConcentration", "alkaliTemperature")), CLEAN(6, "Cleaning Section", 264.803, SectionType.PROCESS, SourceType.FURNACE, Arrays.asList("cleaningVoltage", "cleaningCurrent", "alkaliConcentration", "alkaliTemperature")),

View File

@@ -80,11 +80,11 @@ public enum L1OperateMatEnum implements IEnum<String>, IOperateMat<L1OperateMatF
PAY_OVER("甩尾") { PAY_OVER("甩尾") {
@Override @Override
public void operate(L1OperateMatForm form) { public void operate(L1OperateMatForm form) {
ArrayList<String> status = Lists.newArrayList(PlanStatusEnum.PRODUCING.name(), PlanStatusEnum.PRODUCT.name()); // ArrayList<String> status = Lists.newArrayList(PlanStatusEnum.PRODUCING.name(), PlanStatusEnum.PRODUCT.name());
CrmPdiPlanService planClient = BeanFactory.getBean(CrmPdiPlanService.class); CrmPdiPlanService planClient = BeanFactory.getBean(CrmPdiPlanService.class);
CrmPdiPlanVO plan = planClient.getByCoilIdAndOperId(form.getEntryMatId()); CrmPdiPlanVO plan = planClient.getByCoilIdAndOperId(form.getEntryMatId());
Assert.notNull(plan, "计划[{}]不存在", plan.getId()); Assert.notNull(plan, "计划[{}]不存在", plan.getId());
Assert.isTrue(status.contains(plan.getStatus()), "当前状态[{}]不支持甩尾", plan.getStatus()); // Assert.isTrue(status.contains(plan.getStatus()), "当前状态[{}]不支持甩尾", plan.getStatus());
MatmapUtil.clearMatmap(form.getPorIdx()); MatmapUtil.clearMatmap(form.getPorIdx());
WebSocketUtil.sendSignalMsg(form); WebSocketUtil.sendSignalMsg(form);
WebSocketUtil.sendMatmapMsg(); WebSocketUtil.sendMatmapMsg();

View File

@@ -9,6 +9,7 @@ import com.fizz.business.domain.msg.ExitCutMessage;
import com.fizz.business.dto.ExitCoilInfoDTO; import com.fizz.business.dto.ExitCoilInfoDTO;
import com.fizz.business.dto.MatmapDTO; import com.fizz.business.dto.MatmapDTO;
import com.fizz.business.form.L1OperateMatForm; import com.fizz.business.form.L1OperateMatForm;
import com.fizz.business.service.LogDataService;
import com.fizz.business.service.OpcMessageHandler; import com.fizz.business.service.OpcMessageHandler;
import com.fizz.business.service.PdoExCoilService; import com.fizz.business.service.PdoExCoilService;
import com.fizz.business.service.TrackService; import com.fizz.business.service.TrackService;
@@ -32,6 +33,7 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
private final TrackService trackService; private final TrackService trackService;
@Resource @Resource
private OpcReceiverHandler opcReceiverHandler; private OpcReceiverHandler opcReceiverHandler;
private final LogDataService logDataService;
@Override @Override
public void handle(ExitCutMessage message) { public void handle(ExitCutMessage message) {
// 1. 获取卷取机 (TR) 上的物料信息 // 1. 获取卷取机 (TR) 上的物料信息
@@ -54,16 +56,17 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
pdoExCoilService.saveExCoil(exitCoilInfo); pdoExCoilService.saveExCoil(exitCoilInfo);
if (exitCoilInfo.isLastFlag()) { if (exitCoilInfo.isLastFlag()) {
logDataService.logInfo("TRACK", "当前trMatmap的值为 -> matId={}, planId={}", trMatmap.getMatId(), trMatmap.getPlanId());
trackService.l1OperateMat(L1OperateMatForm.builder() trackService.l1OperateMat(L1OperateMatForm.builder()
.trIdx(TR.getIdx()) .trIdx(TR.getIdx())
.entryMatId(trMatmap.getMatId()) .entryMatId(exitCoilInfo.getEntryMatId())
.planId(trMatmap.getPlanId()) .planId(exitCoilInfo.getPlanId())
.operation(L1OperateMatEnum.PRODUCT) .operation(L1OperateMatEnum.PRODUCT)
.build()); .build());
logDataService.logInfo("EXIT_CUT", "成功处理 EXIT_CUT 消息,已保存成品卷 -> exitMatId={}, planId={}, entryMatId={}", exitCoilInfo.getExitMatId(), exitCoilInfo.getPlanId(), trMatmap.getMatId());
} }
log.info("成功处理 EXIT_CUT 消息,已保存成品卷: " + exitCoilInfo.getExitMatId());
} }
} }

View File

@@ -166,9 +166,8 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
QueryWrapper<CrmPdiPlan> wrapper = new QueryWrapper<>(); QueryWrapper<CrmPdiPlan> wrapper = new QueryWrapper<>();
if (StrUtil.isBlank(build.getMatId())) { if (StrUtil.isBlank(build.getMatId())) {
if (logDataService != null) {
logDataService.logInfo("PLAN", "changeStatus matId为空, planId={}, operation={}", build.getId(), build.getOperation()); logDataService.logInfo("PLAN", "changeStatus matId为空, planId={}, operation={}", build.getId(), build.getOperation());
}
return false; return false;
} }
@@ -183,9 +182,7 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
CrmPdiPlan pdiPlan = baseMapper.selectOne(wrapper); CrmPdiPlan pdiPlan = baseMapper.selectOne(wrapper);
if (pdiPlan == null) { if (pdiPlan == null) {
if (logDataService != null) { logDataService.logInfo("PLAN", "未找到计划记录, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "未找到计划记录, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
}
return false; return false;
} }
@@ -193,13 +190,10 @@ public class CrmPdiPlanServiceImpl extends ServiceImpl<CrmPdiPlanMapper, CrmPdiP
int rows = baseMapper.updateById(pdiPlan); int rows = baseMapper.updateById(pdiPlan);
if (rows <= 0) { if (rows <= 0) {
if (logDataService != null) { logDataService.logInfo("PLAN", "计划状态更新失败, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
logDataService.logInfo("PLAN", "计划状态更新失败, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
}
return false; return false;
} }
logDataService.logInfo("PLAN", "计划状态更新成功, matId={}, planId={}, operation={}", build.getMatId(), build.getId(), build.getOperation());
log.info("计划状态更新成功, matId={}, planId={}, 新状态={}", build.getMatId(), build.getId(), build.getOperation());
return true; return true;
} }

View File

@@ -114,9 +114,10 @@ public class OpcMessageIdsManager {
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.rinseConductivity","rinseConductivity"); entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.rinseConductivity","rinseConductivity");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.rinseTemperature","rinseTemperature"); 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.dryingTemperature","dryingTemperature");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.BR4or5toBR6Tension","bR4or5toBR6Tension");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirFlow","hotAirFlow"); entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirFlow","hotAirFlow");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirPressure","hotAirPressure"); entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.hotAirPressure","hotAirPressure");
entryLineMeasureIds.put("ns=2;s=ProcessCGL.PLCLine.EntryLineMeasure.BR4or5toBR6Tension","bR4or5toBR6Tension");
} }
public static void loadProcLineMeasureIds(){ public static void loadProcLineMeasureIds(){

View File

@@ -412,25 +412,15 @@ public class SegmentTrackerService {
// 设备到达时只更新该入口对应的设备槽位,避免把另一入口(另一开卷机/活套)覆盖。 // 设备到达时只更新该入口对应的设备槽位,避免把另一入口(另一开卷机/活套)覆盖。
int targetIdx = d.getIdx(); int targetIdx = d.getIdx();
if (payOffReelNumber == 1) { if (payOffReelNumber == 1) {
// 仅在开卷机位置做 1/2 路隔离。
// 入口/出口活套已合并为单套ENL1/2/3、CXL1/2 为同一活套内不同测点,不再按入口分路。
if (d == DeviceEnum.POR2) { if (d == DeviceEnum.POR2) {
continue; continue;
} }
if (d == DeviceEnum.ENL2 || d == DeviceEnum.ENL3) {
continue;
}
if (d == DeviceEnum.CXL2) {
continue;
}
} else if (payOffReelNumber == 2) { } else if (payOffReelNumber == 2) {
if (d == DeviceEnum.POR1) { if (d == DeviceEnum.POR1) {
continue; continue;
} }
if (d == DeviceEnum.ENL1 || d == DeviceEnum.ENL3) {
continue;
}
if (d == DeviceEnum.CXL1) {
continue;
}
} }
MatmapUtil.setMatId(targetIdx, coilId, matmap.getPlanId()); MatmapUtil.setMatId(targetIdx, coilId, matmap.getPlanId());
@@ -440,7 +430,7 @@ public class SegmentTrackerService {
trackService.l1OperateMat(L1OperateMatForm.builder() trackService.l1OperateMat(L1OperateMatForm.builder()
.entryMatId(coilId) .entryMatId(coilId)
.planId(matmap.getPlanId()) .planId(matmap.getPlanId())
.porIdx(entry.getPayOffReelNumber()) .porIdx(entry.getPayOffReelNumber() - 1)
.operation(L1OperateMatEnum.PRODUCING) .operation(L1OperateMatEnum.PRODUCING)
.build()); .build());
} else { } else {

View File

@@ -6,7 +6,6 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.fizz.business.constants.CommonConstants; import com.fizz.business.constants.CommonConstants;
import com.fizz.business.constants.enums.WsTypeEnum; import com.fizz.business.constants.enums.WsTypeEnum;
import com.fizz.business.domain.msg.AppMeasureEntryMessage;
import com.fizz.business.domain.msg.AppMeasureMessage; import com.fizz.business.domain.msg.AppMeasureMessage;
import com.fizz.business.dto.CoilPositionDTO; import com.fizz.business.dto.CoilPositionDTO;
import com.fizz.business.dto.DeviceChartDataDTO; import com.fizz.business.dto.DeviceChartDataDTO;
@@ -46,11 +45,13 @@ public class WebSocketUtil {
Map<String, WebSocketSession> clients = trackWsHandler.getClients().getOrDefault(type.name(), Maps.newConcurrentMap()); Map<String, WebSocketSession> clients = trackWsHandler.getClients().getOrDefault(type.name(), Maps.newConcurrentMap());
TextMessage message = new TextMessage(text); TextMessage message = new TextMessage(text);
clients.values().forEach(s -> { clients.values().forEach(s -> {
try { synchronized (s) {
s.sendMessage(message); try {
s.sendMessage(message);
// log.info("[websocket]向客户端[{}]推送消息:{}", type + "-" + s.getId(), text); // log.info("[websocket]向客户端[{}]推送消息:{}", type + "-" + s.getId(), text);
} catch (IOException e) { } catch (IOException e) {
log.error("[websocket]向客户端[{}]推送消息异常:{}", type + "-" + s.getId(), text); log.error("[websocket]向客户端[{}]推送消息异常:{}", type + "-" + s.getId(), text);
}
} }
}); });
} }