加入上线时的下一设定值写入,生产状态转化后的其他数据写入
This commit is contained in:
@@ -120,6 +120,56 @@ public class PdiSetup extends OpcMessage{
|
||||
@Schema(description = "BR9-TR 张力")
|
||||
private BigDecimal tensionBR9TR;
|
||||
|
||||
// 新增的张力设定值字段
|
||||
@Schema(description = "开卷机1当前张力")
|
||||
private BigDecimal tensionPor1Current;
|
||||
@Schema(description = "开卷机1下一设定张力")
|
||||
private BigDecimal tensionPor1Next;
|
||||
@Schema(description = "开卷机2当前张力")
|
||||
private BigDecimal tensionPor2Current;
|
||||
@Schema(description = "开卷机2下一设定张力")
|
||||
private BigDecimal tensionPor2Next;
|
||||
@Schema(description = "入口活套当前张力")
|
||||
private BigDecimal tensionEnLpCurrent;
|
||||
@Schema(description = "入口活套下一设定张力")
|
||||
private BigDecimal tensionEnLpNext;
|
||||
@Schema(description = "清洗段当前张力")
|
||||
private BigDecimal tensionCleaningCurrent;
|
||||
@Schema(description = "清洗段下一设定张力")
|
||||
private BigDecimal tensionCleaningNext;
|
||||
@Schema(description = "炉区当前张力")
|
||||
private BigDecimal tensionFuranceCurrent;
|
||||
@Schema(description = "炉区下一设定张力")
|
||||
private BigDecimal tensionFuranceNext;
|
||||
@Schema(description = "镀后冷却当前张力")
|
||||
private BigDecimal tensionGalvanizingCoolCurrent;
|
||||
@Schema(description = "镀后冷却下一设定张力")
|
||||
private BigDecimal tensionGalvanizingCoolNext;
|
||||
@Schema(description = "光整机入口当前张力")
|
||||
private BigDecimal tensionTmEntryCurrent;
|
||||
@Schema(description = "光整机入口下一设定张力")
|
||||
private BigDecimal tensionTmEntryNext;
|
||||
@Schema(description = "光整机出口当前张力")
|
||||
private BigDecimal tensionTmExitCurrent;
|
||||
@Schema(description = "光整机出口下一设定张力")
|
||||
private BigDecimal tensionTmExitNext;
|
||||
@Schema(description = "拉矫机当前张力")
|
||||
private BigDecimal tensionTlCurrent;
|
||||
@Schema(description = "拉矫机下一设定张力")
|
||||
private BigDecimal tensionTlNext;
|
||||
@Schema(description = "涂敷段当前张力")
|
||||
private BigDecimal tensionCoatingCurrent;
|
||||
@Schema(description = "涂敷段下一设定张力")
|
||||
private BigDecimal tensionCoatingNext;
|
||||
@Schema(description = "出口活套当前张力")
|
||||
private BigDecimal tensionExLpCurrent;
|
||||
@Schema(description = "出口活套下一设定张力")
|
||||
private BigDecimal tensionExLpNext;
|
||||
@Schema(description = "卷取机当前张力")
|
||||
private BigDecimal tensionTrCurrent;
|
||||
@Schema(description = "卷取机下一设定张力")
|
||||
private BigDecimal tensionTrNext;
|
||||
|
||||
@Schema(description = "涂油投入")
|
||||
private Integer oilingFlag;
|
||||
@Schema(description = "上表面涂油量")
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.fizz.business.form.L1OperateMatForm;
|
||||
import com.fizz.business.form.WebOperateMatForm;
|
||||
import com.fizz.business.service.CrmPdiPlanService;
|
||||
import com.fizz.business.comm.OPC.OpcMessageSend;
|
||||
import com.fizz.business.service.strip.SegmentTrackerService;
|
||||
import com.fizz.business.service.ProMatmapService;
|
||||
import com.fizz.business.service.TrackService;
|
||||
import com.fizz.business.service.client.RedisCacheManager;
|
||||
@@ -64,10 +65,23 @@ public class TrackServiceImpl implements TrackService {
|
||||
proMatmapService.flushMatmap();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SegmentTrackerService segmentTrackerService;
|
||||
|
||||
@Override
|
||||
public void l1OperateMat(L1OperateMatForm form) {
|
||||
|
||||
log.info("l1 operate mat: {}", JSON.toJSONString(form));
|
||||
|
||||
// NEW/READY -> ONLINE:下发张力下一设定值
|
||||
if (form.getOperation() == com.fizz.business.constants.enums.L1OperateMatEnum.ONLINE) {
|
||||
try {
|
||||
segmentTrackerService.sendDriveTensionNextOnOnline(form.getEntryMatId(), form.getPorIdx());
|
||||
} catch (Exception e) {
|
||||
log.error("张力Next下发异常, coilId={} err={}", form.getEntryMatId(), e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
form.getOperation().operate(form);
|
||||
proMatmapService.flushMatmap();
|
||||
}
|
||||
|
||||
@@ -407,6 +407,34 @@ public class OpcMessageIdsManager {
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.exitLength4", "exitLength4");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.exitLength5", "exitLength5");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.exitLength6", "exitLength6");
|
||||
// 张力设定值(LepServer TagName,按 DB 地址与工艺语义对齐)
|
||||
// DB35502 段:Current/Next
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.1kjjtensionsetting", "tensionPor1Current");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.1kjjtensionsettingnext", "tensionPor1Next");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.2kjjtensionsetting", "tensionPor2Current");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.2kjjtensionsettingnext", "tensionPor2Next");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.rkhttensionsetting", "tensionEnLpCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.rkhttensionsettingnext", "tensionEnLpNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.qxdtensionsetting", "tensionCleaningCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.qxdtensionsettingnext", "tensionCleaningNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.thltensionsetting", "tensionFuranceCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.thltensionsettingnext", "tensionFuranceNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.dhlqdtensionsetting", "tensionGalvanizingCoolCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.dhlqdtensionsettingnext", "tensionGalvanizingCoolNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.gzjrktensionsetting", "tensionTmEntryCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.gzjrktensionsettingnext", "tensionTmEntryNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.gzjcktensionsetting", "tensionTmExitCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.gzjcktensionsettingnext", "tensionTmExitNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.ljjtensionsetting", "tensionTlCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.ljjtensionsettingnext", "tensionTlNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.dhdtensionsetting", "tensionCoatingCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.dhdtensionsettingnext", "tensionCoatingNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.ckhttensionsetting", "tensionExLpCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.ckhttensionsettingnext", "tensionExLpNext");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.sjjtensionsetting", "tensionTrCurrent");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.sjjtensionsettingnext", "tensionTrNext");
|
||||
|
||||
// DB35501 段:原有张力字段(保持兼容)
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.tensionPorBR1", "tensionPorBR1");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.tensionBR1BR2", "tensionBR1BR2");
|
||||
pdiSetupIds.put("ns=2;s=ProcessCGL.PLCLine.L2Setup.tensionBR2BR3", "tensionBR2BR3");
|
||||
|
||||
@@ -11,7 +11,12 @@ import com.fizz.business.dto.MatmapDTO;
|
||||
import com.fizz.business.dto.SegValue;
|
||||
import com.fizz.business.dto.SegmentDTO;
|
||||
import com.fizz.business.form.L1OperateMatForm;
|
||||
import com.fizz.business.form.OpcBatchWriteDataForm;
|
||||
import com.fizz.business.form.OpcWriteDataForm;
|
||||
import com.fizz.business.service.CrmPdiPlanService;
|
||||
import com.fizz.business.service.IPdiSetupService;
|
||||
import com.fizz.business.service.LogDataService;
|
||||
import com.fizz.business.service.OpcDataService;
|
||||
import com.fizz.business.service.ProMatmapService;
|
||||
import com.fizz.business.service.TrackService;
|
||||
import com.fizz.business.service.impl.SegmentService;
|
||||
@@ -42,6 +47,10 @@ public class SegmentTrackerService {
|
||||
private final LogDataService logDataService; // 注入新创建的段服务
|
||||
private final ProMatmapService proMatmapService; // 注入新创建的段服务
|
||||
|
||||
private final CrmPdiPlanService crmPdiPlanService;
|
||||
private final IPdiSetupService pdiSetupService;
|
||||
private final OpcDataService opcDataService;
|
||||
|
||||
private static final long intervalTime = 10000; // 每 10 秒写一次
|
||||
private int traceCount = 0;
|
||||
private boolean firstMeasure = true;
|
||||
@@ -426,6 +435,14 @@ public class SegmentTrackerService {
|
||||
|
||||
if (d == DeviceEnum.WELDER) {
|
||||
logDataService.logInfo("MATMAP-TRACK", "Coil reached welder, update plan status. coil=" + coilId + ", headPos=" + headPos);
|
||||
|
||||
// ONLINE -> PRODUCING:下发入口卷参数
|
||||
try {
|
||||
sendEntryPdiOnProducing(coilId);
|
||||
} catch (Exception ex) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "入口参数下发异常(PRODUCING触发), coilId=" + coilId + ", err=" + String.valueOf(ex));
|
||||
}
|
||||
|
||||
trackService.l1OperateMat(L1OperateMatForm.builder()
|
||||
.entryMatId(coilId)
|
||||
.planId(matmap.getPlanId())
|
||||
@@ -445,5 +462,98 @@ public class SegmentTrackerService {
|
||||
|
||||
|
||||
|
||||
private com.fizz.business.domain.PdiSetups loadPdiSetup(String coilId, String planId) {
|
||||
if (planId == null) {
|
||||
return null;
|
||||
}
|
||||
com.fizz.business.domain.PdiSetups query = new com.fizz.business.domain.PdiSetups();
|
||||
query.setCoilid(coilId);
|
||||
query.setPlanid(planId);
|
||||
java.util.List<com.fizz.business.domain.PdiSetups> setups = pdiSetupService.selectPdiSetupList(query);
|
||||
return (setups != null && !setups.isEmpty()) ? setups.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* NEW/READY -> ONLINE:下发全线张力“下一设定值”(Next)
|
||||
*/
|
||||
public void sendDriveTensionNextOnOnline(String coilId, Integer porIdx) {
|
||||
try {
|
||||
com.fizz.business.vo.CrmPdiPlanVO plan = crmPdiPlanService.getByCoilIdAndOperId(coilId);
|
||||
if (plan == null) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "张力Next下发跳过:未找到计划信息, coilId=" + coilId);
|
||||
return;
|
||||
}
|
||||
|
||||
com.fizz.business.domain.PdiSetups setup = loadPdiSetup(coilId, plan.getPlanid());
|
||||
if (setup == null) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "张力Next下发跳过:未找到pdi_setup, coilId=" + coilId);
|
||||
return;
|
||||
}
|
||||
|
||||
java.util.List<OpcWriteDataForm> dataList = new java.util.ArrayList<>();
|
||||
|
||||
if (porIdx != null && porIdx == 0) {
|
||||
dataList.add(buildOpcWrite("tensionPor1Next", setup.getPorTension()));
|
||||
} else if (porIdx != null && porIdx == 1) {
|
||||
dataList.add(buildOpcWrite("tensionPor2Next", setup.getPorTension()));
|
||||
}
|
||||
|
||||
dataList.add(buildOpcWrite("tensionEnLpNext", setup.getCelTension()));
|
||||
dataList.add(buildOpcWrite("tensionCleaningNext", setup.getCleanTension()));
|
||||
dataList.add(buildOpcWrite("tensionGalvanizingCoolNext", setup.getPassivationTension()));
|
||||
dataList.add(buildOpcWrite("tensionExLpNext", setup.getCxlTension()));
|
||||
dataList.add(buildOpcWrite("tensionTlNext", setup.getLevelerEntryTension()));
|
||||
dataList.add(buildOpcWrite("tensionTmExitNext", setup.getStraightenerExitTension()));
|
||||
dataList.add(buildOpcWrite("tensionFuranceNext", setup.getFurTension()));
|
||||
dataList.add(buildOpcWrite("tensionTrNext", setup.getTrTension()));
|
||||
|
||||
OpcBatchWriteDataForm opcForm = new OpcBatchWriteDataForm();
|
||||
opcForm.setDataList(dataList);
|
||||
boolean ok = opcDataService.batchWriteData(opcForm);
|
||||
logDataService.logInfo("MATMAP-TRACK", "张力Next下发完成(ONLINE触发), coilId=" + coilId + ", ok=" + ok);
|
||||
} catch (Exception ex) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "张力Next下发异常(ONLINE触发), coilId=" + coilId + ", err=" + String.valueOf(ex));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ONLINE -> PRODUCING:下发入口卷参数(481-490)
|
||||
*/
|
||||
public void sendEntryPdiOnProducing(String coilId) {
|
||||
try {
|
||||
com.fizz.business.vo.CrmPdiPlanVO plan = crmPdiPlanService.getByCoilIdAndOperId(coilId);
|
||||
if (plan == null) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "入口参数下发跳过:未找到计划信息, coilId=" + coilId);
|
||||
return;
|
||||
}
|
||||
|
||||
java.util.List<OpcWriteDataForm> dataList = new java.util.ArrayList<>();
|
||||
dataList.add(buildOpcWrite("coilId", coilId));
|
||||
dataList.add(buildOpcWrite("entryCoilWeight", plan.getEntryWeight()));
|
||||
dataList.add(buildOpcWrite("entryCoilLength", plan.getEntryLength()));
|
||||
dataList.add(buildOpcWrite("entryCoilWidth", plan.getEntryWidth()));
|
||||
dataList.add(buildOpcWrite("entryCoilThick", plan.getEntryThick()));
|
||||
dataList.add(buildOpcWrite("entryCoilInnerDia", plan.getEntryInnerDiameter()));
|
||||
dataList.add(buildOpcWrite("entryCoilOuterDia", plan.getEntryOuterDiameter()));
|
||||
dataList.add(buildOpcWrite("alloyCode", plan.getSteelGrade()));
|
||||
dataList.add(buildOpcWrite("splitNum", plan.getSplitNum()));
|
||||
|
||||
OpcBatchWriteDataForm opcForm = new OpcBatchWriteDataForm();
|
||||
opcForm.setDataList(dataList);
|
||||
boolean ok = opcDataService.batchWriteData(opcForm);
|
||||
logDataService.logInfo("MATMAP-TRACK", "入口参数下发完成(PRODUCING触发), coilId=" + coilId + ", ok=" + ok);
|
||||
} catch (Exception ex) {
|
||||
logDataService.logWarn("MATMAP-TRACK", "入口参数下发异常(PRODUCING触发), coilId=" + coilId + ", err=" + String.valueOf(ex));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private OpcWriteDataForm buildOpcWrite(String fieldName, Object value) {
|
||||
OpcWriteDataForm form = new OpcWriteDataForm();
|
||||
form.setFieldName(fieldName);
|
||||
form.setValue(value);
|
||||
return form;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user