feat(exit-cut): 添加甩尾信号发送功能并扩展字典数据长度

- 在 ExitCutHandler 中注入 OpcReceiverHandler 用于消息发送
- 添加 EntryMovementMessage 导入并实现甩尾信号发送逻辑
- 将字典数据表中字典键值长度限制从100字符扩展到10000字符
- 优化 SysDictData 中 toString 方法的代码格式
- 在 EXIT_CUT 消息处理完成后发送 ENTRY_MOVEMENT 消息实现甩尾功能
This commit is contained in:
2025-12-24 14:18:41 +08:00
parent 41a17b7161
commit 096b8f212c
2 changed files with 33 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.json.JSONUtil;
import com.fizz.business.anno.OpcMessageHandlerType; import com.fizz.business.anno.OpcMessageHandlerType;
import com.fizz.business.constants.enums.L1OperateMatEnum; import com.fizz.business.constants.enums.L1OperateMatEnum;
import com.fizz.business.constants.enums.OpcMessageType; import com.fizz.business.constants.enums.OpcMessageType;
import com.fizz.business.domain.msg.EntryMovementMessage;
import com.fizz.business.domain.msg.ExitCutMessage; 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;
@@ -16,6 +17,8 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import static com.fizz.business.constants.enums.DeviceEnum.TR; import static com.fizz.business.constants.enums.DeviceEnum.TR;
@Component @Component
@@ -27,7 +30,8 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
// 注入 PdoExCoilService // 注入 PdoExCoilService
private final PdoExCoilService pdoExCoilService; private final PdoExCoilService pdoExCoilService;
private final TrackService trackService; private final TrackService trackService;
@Resource
private OpcReceiverHandler opcReceiverHandler;
@Override @Override
public void handle(ExitCutMessage message) { public void handle(ExitCutMessage message) {
// 1. 获取卷取机 (TR) 上的物料信息 // 1. 获取卷取机 (TR) 上的物料信息
@@ -50,12 +54,22 @@ public class ExitCutHandler implements OpcMessageHandler<ExitCutMessage> {
pdoExCoilService.saveExCoil(exitCoilInfo); pdoExCoilService.saveExCoil(exitCoilInfo);
if (exitCoilInfo.isLastFlag()) { if (exitCoilInfo.isLastFlag()) {
trackService.l1OperateMat(L1OperateMatForm.builder() trackService.l1OperateMat(L1OperateMatForm.builder()
.trIdx(TR.getIdx()) .trIdx(TR.getIdx())
.entryMatId(trMatmap.getMatId()) .entryMatId(trMatmap.getMatId())
.planId(trMatmap.getPlanId()) .planId(trMatmap.getPlanId())
.operation(L1OperateMatEnum.PRODUCT) .operation(L1OperateMatEnum.PRODUCT)
.build()); .build());
// wangyu 配合二级发一个甩尾信号 01全甩一下
EntryMovementMessage msg = new EntryMovementMessage();
msg.setCounter(message.getCounter());
msg.setMaterialPlaceSource(0);
msg.setMaterialPlaceDestination(200);
opcReceiverHandler.onMessageReceived(OpcMessageType.ENTRY_MOVEMENT,msg);
msg.setMaterialPlaceSource(1);
opcReceiverHandler.onMessageReceived(OpcMessageType.ENTRY_MOVEMENT,msg);
} }
log.info("成功处理 EXIT_CUT 消息,已保存成品卷: " + exitCoilInfo.getExitMatId()); log.info("成功处理 EXIT_CUT 消息,已保存成品卷: " + exitCoilInfo.getExitMatId());

View File

@@ -85,7 +85,7 @@ public class SysDictData extends BaseEntity
} }
@NotBlank(message = "字典键值不能为空") @NotBlank(message = "字典键值不能为空")
@Size(min = 0, max = 100, message = "字典键值长度不能超过100个字符") @Size(min = 0, max = 10000, message = "字典键值长度不能超过10000个字符")
public String getDictValue() public String getDictValue()
{ {
return dictValue; return dictValue;
@@ -157,20 +157,20 @@ public class SysDictData extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("dictCode", getDictCode()) .append("dictCode", getDictCode())
.append("dictSort", getDictSort()) .append("dictSort", getDictSort())
.append("dictLabel", getDictLabel()) .append("dictLabel", getDictLabel())
.append("dictValue", getDictValue()) .append("dictValue", getDictValue())
.append("dictType", getDictType()) .append("dictType", getDictType())
.append("cssClass", getCssClass()) .append("cssClass", getCssClass())
.append("listClass", getListClass()) .append("listClass", getListClass())
.append("isDefault", getIsDefault()) .append("isDefault", getIsDefault())
.append("status", getStatus()) .append("status", getStatus())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }