From c0df58a6fb50ee32e7336b5901000549700ebc82 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期一, 16 三月 2026 15:02:59 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java | 66 +++++++++++++++++++--------------
1 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java
index ac6d3b4..1801e71 100644
--- a/src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnV2Thread.java
@@ -1,7 +1,7 @@
package com.zy.core.thread.impl;
import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.*;
@@ -22,6 +22,7 @@
import com.zy.core.network.DeviceConnectPool;
import com.zy.core.network.ZyCrnV2ConnectDriver;
import com.zy.core.network.entity.ZyCrnStatusEntity;
+import com.zy.core.service.WrkCommandRollbackService;
import com.zy.core.thread.CrnThread;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -120,7 +121,7 @@
}
if (basCrnpService != null) {
- BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo()));
+ BasCrnp basCrnp = basCrnpService.getOne(new QueryWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo()));
if(basCrnp == null) {
basCrnp = new BasCrnp();
basCrnp.setCrnNo(deviceConfig.getDeviceNo());
@@ -130,7 +131,7 @@
basCrnp.setMaxInTask(5);
basCrnp.setMaxOutTask(5);
basCrnp.setCreateTime(new Date());
- basCrnpService.insert(basCrnp);
+ basCrnpService.save(basCrnp);
}
}
}
@@ -174,6 +175,7 @@
crnProtocol.setYDistance(crnStatus.getYDistance());
crnProtocol.setXDuration(crnStatus.getXDuration());
crnProtocol.setYDuration(crnStatus.getYDuration());
+ crnProtocol.setTaskReceive(crnStatus.getTaskReceive());
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), deviceConfig.getDeviceNo()));
@@ -215,7 +217,7 @@
log.setStatus(1);
log.setCreateTime(new Date());
log.setSystemStatus(JSON.toJSONString(crnProtocol));
- errLogService.insert(log);
+ errLogService.save(log);
if (log.getId() != null) {
redisUtil.set(errFlagKey, log.getId(), 60 * 60 * 24);
}
@@ -282,12 +284,12 @@
}
@Override
- public CrnCommand getResetCommand(Integer crnNo) {
+ public CrnCommand getResetCommand(Integer taskNo, Integer crnNo) {
CrnCommand crnCommand = new CrnCommand();
crnCommand.setCrnNo(crnNo); // 鍫嗗灈鏈虹紪鍙�
- crnCommand.setTaskNo(0); // 宸ヤ綔鍙�
+ crnCommand.setTaskNo(taskNo); // 宸ヤ綔鍙�
crnCommand.setAckFinish(1); // 浠诲姟瀹屾垚纭浣�
- crnCommand.setTaskMode(CrnTaskModeType.NONE.id); // 浠诲姟妯″紡
+ crnCommand.setTaskMode(CrnTaskModeType.RESET.id); // 浠诲姟妯″紡
crnCommand.setSourcePosX(0); // 婧愬簱浣嶆帓
crnCommand.setSourcePosY(0); // 婧愬簱浣嶅垪
crnCommand.setSourcePosZ(0); // 婧愬簱浣嶅眰
@@ -306,27 +308,35 @@
response = zyCrnConnectDriver.sendCommand(command);
return response;
} finally {
- String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ());
- String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ());
- BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class);
- ZyCrnStatusEntity statusEntity = zyCrnConnectDriver.getStatus();
- BasCrnpOpt basCrnpOpt = new BasCrnpOpt(
- command.getTaskNo().intValue(),
- command.getCrnNo(),
- new Date(),
- String.valueOf(command.getTaskMode()),
- sourceLocNo,
- targetLocNo,
- null,
- null,
- null,
- JSON.toJSONString(command),
- JSON.toJSONString(statusEntity),
- 1,
- JSON.toJSONString(response)
- );
- if (bean != null) {
- bean.insert(basCrnpOpt);
+ if (command != null) {
+ String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ());
+ String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ());
+ BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class);
+ ZyCrnStatusEntity statusEntity = zyCrnConnectDriver.getStatus();
+ BasCrnpOpt basCrnpOpt = new BasCrnpOpt(
+ command.getTaskNo(),
+ command.getCrnNo(),
+ new Date(),
+ String.valueOf(command.getTaskMode()),
+ sourceLocNo,
+ targetLocNo,
+ null,
+ null,
+ null,
+ JSON.toJSONString(command),
+ JSON.toJSONString(statusEntity),
+ 1,
+ JSON.toJSONString(response)
+ );
+ bean.save(basCrnpOpt);
+ try {
+ WrkCommandRollbackService rollbackService = SpringUtils.getBean(WrkCommandRollbackService.class);
+ if (rollbackService != null) {
+ rollbackService.handleSingleCrnSendResult(command, response, "鍗曞伐浣嶅爢鍨涙満V2");
+ }
+ } catch (Exception e) {
+ log.error("澶勭悊鍗曞伐浣峍2鍛戒护涓嬪彂缁撴灉澶辫触, wrkNo={}", command.getTaskNo(), e);
+ }
}
}
}
--
Gitblit v1.9.1