From 67809d68cadd1ae3e6f697a92030201dbdf947ce Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期五, 09 五月 2025 16:24:57 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/SiteController.java | 4 +-
src/main/java/com/zy/asrs/domain/enums/WorkNoType.java | 6 +-
src/main/java/com/zy/core/thread/LedThread.java | 19 ++++++---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 6 +-
src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java | 7 ++-
src/main/java/com/zy/asrs/controller/CrnController.java | 6 +-
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 4 +
src/main/java/com/zy/core/thread/ScaleThread.java | 14 ++++++-
src/main/java/com/zy/core/thread/SiemensDevpThread.java | 20 +++++++---
src/main/webapp/views/deviceOperate/rgvOperate.html | 2
10 files changed, 57 insertions(+), 31 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/CrnController.java b/src/main/java/com/zy/asrs/controller/CrnController.java
index 90085da..e045613 100644
--- a/src/main/java/com/zy/asrs/controller/CrnController.java
+++ b/src/main/java/com/zy/asrs/controller/CrnController.java
@@ -628,7 +628,7 @@
crnCommand.setCommand((short) 0); // 浠诲姟瀹屾垚纭浣�
// 寤舵椂鍙戦��
Thread.sleep(1000L);
- if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand), false)) {
+ if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand))) {
return R.ok();
} else {
throw new CoolException("鍛戒护涓嬪彂澶辫触");
@@ -782,7 +782,7 @@
}
// 绌洪棽鍒ゆ柇
// if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) {
- if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(4, command), false)) {
+ if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(4, command))) {
return true;
} else {
throw new CoolException("鍛戒护涓嬪彂澶辫触");
@@ -816,7 +816,7 @@
}
// 绌洪棽鍒ゆ柇
// if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) {
- if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, command), false)) {
+ if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) {
return true;
} else {
throw new CoolException("鍛戒护涓嬪彂澶辫触");
diff --git a/src/main/java/com/zy/asrs/controller/SiteController.java b/src/main/java/com/zy/asrs/controller/SiteController.java
index 759eec6..cdb066b 100644
--- a/src/main/java/com/zy/asrs/controller/SiteController.java
+++ b/src/main/java/com/zy/asrs/controller/SiteController.java
@@ -270,7 +270,7 @@
staProtocol.setWorkNo(0);
staProtocol.setStaNo(0);
basDevpService.updateById(basDevp);
- boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
if (result) {
return R.ok();
} else {
@@ -310,7 +310,7 @@
}
staProtocol.setWorkNo( 9999);
staProtocol.setStaNo(inSta.getStaNo());
- boolean result = CommandUtils.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
if (result) {
return R.ok();
} else {
diff --git a/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java b/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java
index 4aa3911..0ae3ae5 100644
--- a/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java
+++ b/src/main/java/com/zy/asrs/domain/enums/WorkNoType.java
@@ -7,10 +7,10 @@
*/
public enum WorkNoType {
- PAKIN(0),
- PICK(1),
+ PAKIN(1),
+ PICK(3),
PAKOUT(2),
- OTHER(3),
+ OTHER(4),
;
public Integer type;
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 1bf0bbe..55a8c13 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1017,7 +1017,7 @@
crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅鍒�
crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅灞�
crnCommand.setCommand((short) 1);
- if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand), false)) {
+ if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand))) {
log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
} else {
// 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
@@ -1085,14 +1085,14 @@
}
// 鐘舵�侊細绛夊緟纭 骞朵笖 浠诲姟瀹屾垚浣� = 1
- if (!Cools.isEmpty(crnProtocol.getTaskFinish()) && crnProtocol.getTaskFinish() == 0 && crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) {
+ if (crnProtocol.statusType == CrnStatusType.WAITING && crnProtocol.getTaskNo() != 0) {
//鑾峰彇鍏ュ簱寰呯‘璁ゅ伐浣滄。
TaskWrk taskWrk = taskWrkMapper.selectCrnNoInWorking(crnProtocol.getLaneNo(), crnProtocol.getTaskNo().intValue());
if (Cools.isEmpty(taskWrk) && crnProtocol.getTaskNo() != 999) {
log.error("鍫嗗灈鏈哄浜庣瓑寰呯‘璁や笖浠诲姟瀹屾垚鐘舵�侊紝浣嗘湭鎵惧埌宸ヤ綔妗c�傚爢鍨涙満鍙�={}锛屽贩閬撳彿={}锛屽伐浣滃彿={}", crn.getId(), crnProtocol.getLaneNo(), crnProtocol.getTaskNo());
continue;
}
- Thread.sleep(300);
+// Thread.sleep(300);
//纭瀹屾垚淇″彿
CrnOperatorParam crnOperatorParam = new CrnOperatorParam();
crnOperatorParam.setCrnNo(crn.getId());
diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 194a76b..255482d 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -75,9 +75,11 @@
taskWrk = new TaskWrk();
int workNo1 = 0;//鑾峰彇鍏ュ簱宸ヤ綔鍙�
if (param.getIoType() .equals(1)){
+ workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);
+ } else if (param.getIoType() .equals(2)){
workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type);
} else {
- workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);
+ workNo1 = commonService.getWorkNo(WorkNoType.PICK.type);
}
taskWrk.setTaskNo(param.getTaskNo());//浠诲姟鍙�
taskWrk.setWrkNo(workNo1);
diff --git a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
index 6ba5ef3..8f1aeac 100644
--- a/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/TaskWrkServiceImpl.java
@@ -19,6 +19,7 @@
import com.zy.common.service.CommonService;
import com.zy.common.utils.HttpHandler;
import com.zy.core.DevpThread;
+import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.CrnTaskModeType;
import com.zy.core.enums.SlaveType;
@@ -135,7 +136,7 @@
crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅灞�
crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint())); // 鐩爣搴撲綅鎺�
crnCommand.setCommand((short)1);
- if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand),false)) {
+ if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) {
log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
}else{
@@ -206,7 +207,7 @@
crnCommand.setDestinationPosY(crnStn.getLev().shortValue()); // 鐩爣搴撲綅鍒�
crnCommand.setDestinationPosZ(crnStn.getRow().shortValue()); // 鐩爣搴撲綅灞�
crnCommand.setCommand((short)1);
- if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) {
+ if (!MessageQueue.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(5, crnCommand))) {
log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
}
@@ -216,7 +217,7 @@
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()).clone();
staProtocol.setWorkNo(taskWrk.getWrkNo());
staProtocol.setStaNo(Integer.parseInt(taskWrk.getTargetPoint()));
- if (!CommandUtils.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) {
+ if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(3, staProtocol))) {
log.error("杈撻�佺嚎鍛戒护鐢熸垚澶辫触锛屽爢鍨涙満鍙�={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
throw new CoolException("杈撻�佺嚎鍛戒护鐢熸垚澶辫触");
}
diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index c4cf476..eb46bc6 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -202,14 +202,19 @@
screen.turnOn();
} catch (Exception ignore) {
}
- DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
- if (connRes) {
- log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
- deviceErrorService.deleteDeviceError("led", slave.getId());
- } else {
- log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
- deviceErrorService.addDeviceError("led", slave.getId(), "led杩炴帴澶辫触");
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ if (connRes) {
+ log.info("led杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ deviceErrorService.deleteDeviceError("led", slave.getId());
+ } else {
+ log.error("led杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ deviceErrorService.addDeviceError("led", slave.getId(), "led杩炴帴澶辫触");
+ }
+ } catch (Exception e){
+ log.error("e:"+e.getMessage());
}
+
return connRes;
}
diff --git a/src/main/java/com/zy/core/thread/ScaleThread.java b/src/main/java/com/zy/core/thread/ScaleThread.java
index e4fdf1e..e630268 100644
--- a/src/main/java/com/zy/core/thread/ScaleThread.java
+++ b/src/main/java/com/zy/core/thread/ScaleThread.java
@@ -122,13 +122,23 @@
dataOutputStream = new DataOutputStream(socket.getOutputStream());
dataInputStream = new DataInputStream(socket.getInputStream());
// log.info("鏉$爜鎵弿浠繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
-// DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
-// deviceErrorService.deleteDeviceError("scale", slave.getId());
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.deleteDeviceError("devp", slave.getId());
+ } catch (Exception e){
+ log.error("e:"+e.getMessage());
+ }
} catch (Exception e) {
socket = null;
log.error("纾呯Г杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
// DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
// deviceErrorService.addDeviceError("scale", slave.getId(), "纾呯Г杩炴帴澶辫触");
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.deleteDeviceError("devp", slave.getId());
+ } catch (Exception e1){
+ log.error("e:"+e1.getMessage());
+ }
return false;
}
return true;
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index f59ff6d..7a88f83 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -235,19 +235,27 @@
StaProtocol staProtocol = station.get(siteId);
basDevps.add(staProtocol.toSqlModel());
}
-
- BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
- if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
- throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+ try{
+ BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+ if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
+ throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+ }
+ } catch (Exception e){
+ log.error("e:"+e.getMessage());
}
+
} catch (Exception e) {
e.printStackTrace();
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戞洿鏂版暟鎹簱鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
log.error("鏇存柊鏁版嵁搴撴暟鎹け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
}
- DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
- deviceErrorService.deleteDeviceError("devp", slave.getId());
+ try{
+ DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
+ deviceErrorService.deleteDeviceError("devp", slave.getId());
+ } catch (Exception e){
+ log.error("e:"+e.getMessage());
+ }
} else {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戣鍙栬緭閫佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
// log.error("璇诲彇杈撻�佺嚎plc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot());
diff --git a/src/main/webapp/views/deviceOperate/rgvOperate.html b/src/main/webapp/views/deviceOperate/rgvOperate.html
index 8dd7e98..fa2ba58 100644
--- a/src/main/webapp/views/deviceOperate/rgvOperate.html
+++ b/src/main/webapp/views/deviceOperate/rgvOperate.html
@@ -16,7 +16,7 @@
<div style="width: 100%;">
<el-table ref="singleTable" :data="tableData" highlight-current-row @row-click="handleRowClick"
max-height="450" style="width: 100%">
- <el-table-column property="devNo" label="绔欏彿">
+ <el-table-column property="devNo" label="灏忚溅鍙�">
</el-table-column>
<el-table-column property="workNo" label="宸ヤ綔鍙�">
</el-table-column>
--
Gitblit v1.9.1