From 800d4421f6939c20d409dcc821caa4026fae181e Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 09 九月 2023 09:15:33 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 91 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 8f706d1..9259abd 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -69,6 +69,8 @@
@Autowired
private BasShuttleErrLogService basShuttleErrLogService;
@Autowired
+ private BasLiftErrLogService basLiftErrLogService;
+ @Autowired
private BasShuttleErrService basShuttleErrService;
@Autowired
private BasCrnErrorMapper basCrnErrorMapper;
@@ -1453,6 +1455,7 @@
public void recErr() {
try {
this.recShuttleErr();
+ this.recLiftErr();
} catch (Exception e) {
News.error("recErr fail", e);
}
@@ -1507,7 +1510,8 @@
null, // 娣诲姞浜哄憳
now, // 淇敼鏃堕棿
null, // 淇敼浜哄憳
- "浠诲姟涓紓甯�" // 澶囨敞
+ "浠诲姟涓紓甯�", // 澶囨敞
+ JSON.toJSONString(shuttleProtocol) // 绯荤粺鐘舵�佹暟鎹�
);
if (!basShuttleErrLogService.insert(basShuttleErrLog)) {
News.error("鍥涘悜绌挎杞lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", shuttleSlave.getId(), errName);
@@ -1576,6 +1580,91 @@
}
}
+ /**
+ * 鎻愬崌鏈哄紓甯镐俊鎭褰�
+ */
+ private void recLiftErr() {
+ Date now = new Date();
+ for (LiftSlave liftSlave : slaveProperties.getLift()) {
+ // 鑾峰彇鎻愬崌鏈轰俊鎭�
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
+ if (liftThread == null) {
+ continue;
+ }
+ LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ continue;
+ }
+
+ if (liftProtocol.getTaskNo() != 0) {
+ //鏈変换鍔�
+ BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(liftSlave.getId(), liftProtocol.getTaskNo().intValue());
+ // 鏈夊紓甯�
+ if (latest == null) {
+ if (liftProtocol.getDeviceError() != null && liftProtocol.getDeviceError()) {
+ WrkMast wrkMast = wrkMastMapper.selectById(liftProtocol.getTaskNo());
+ if (wrkMast == null) {
+ continue;
+ }
+
+ String errName = "";
+ if (liftProtocol.getFrontOverrun()) {
+ errName = "鍓嶈秴闄�";
+ } else if (liftProtocol.getBackOverrun()) {
+ errName = "鍚庤秴闄�";
+ } else if (liftProtocol.getLeftOverrun()) {
+ errName = "宸﹁秴闄�";
+ } else if (liftProtocol.getRightOverrun()) {
+ errName = "鍙宠秴闄�";
+ } else if (liftProtocol.getOverHeight()) {
+ errName = "瓒呴珮";
+ } else if (liftProtocol.getOverWeight()) {
+ errName = "瓒呴噸";
+ }
+
+ BasLiftErrLog basLiftErrLog = new BasLiftErrLog(
+ null, // 缂栧彿
+ wrkMast.getWrkNo(), // 宸ヤ綔鍙�
+ now, // 鍙戠敓鏃堕棿
+ null, // 缁撴潫鏃堕棿
+ wrkMast.getWrkSts(), // 宸ヤ綔鐘舵��
+ wrkMast.getIoType(), // 鍏ュ嚭搴撶被鍨�
+ liftSlave.getId(), // 鎻愬崌鏈�
+ null, // plc
+ wrkMast.getLocNo(), // 鐩爣搴撲綅
+ wrkMast.getStaNo(), // 鐩爣绔�
+ wrkMast.getSourceStaNo(), // 婧愮珯
+ wrkMast.getSourceLocNo(), // 婧愬簱浣�
+ wrkMast.getBarcode(), // 鏉$爜
+ null, // 寮傚父鐮�
+ errName, // 寮傚父
+ 1, // 寮傚父鎯呭喌
+ now, // 娣诲姞鏃堕棿
+ null, // 娣诲姞浜哄憳
+ now, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ "浠诲姟涓紓甯�", // 澶囨敞
+ JSON.toJSONString(liftProtocol) // 绯荤粺鐘舵�佹暟鎹�
+ );
+ if (!basLiftErrLogService.insert(basLiftErrLog)) {
+ News.error("鎻愬崌鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", liftSlave.getId(), errName);
+ }
+ }
+ } else {
+ // 寮傚父淇
+ if (liftProtocol.getDeviceError() == null || !liftProtocol.getDeviceError()) {
+ latest.setEndTime(now);
+ latest.setUpdateTime(now);
+ latest.setStatus(2);
+ if (!basLiftErrLogService.updateById(latest)) {
+ News.error("鎻愬崌鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", liftSlave.getId(), latest.getId());
+ }
+ }
+ }
+ }
+ }
+ }
+
// -------------------------------------------------------------------------------
/**
--
Gitblit v1.9.1