From 0867a0eb7ccf5b0fc20fd1d16a82f6cf9661ba87 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 19 三月 2026 16:22:16 +0800
Subject: [PATCH] 修复空板入库提示组托问题
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 129 ++++++++++++++++++++++++++-----------------
1 files changed, 78 insertions(+), 51 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 8e0f034..87c7e52 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -96,7 +96,7 @@
* 缁勬墭
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2
*/
- public synchronized void generateStoreWrkFile(Integer mark) {
+ public synchronized void generateStoreWrkFile(Integer mark) throws InterruptedException {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱鍙�
@@ -167,51 +167,52 @@
continue;
}
}
- if (wrkMast != null) {
- News.error("" + mark + " - 4" + " - 宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 3.寮�濮嬫墽琛屽叆搴撲换鍔� 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+// if (wrkMast != null) {
+// News.error("" + mark + " - 4" + " - 宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 3.寮�濮嬫墽琛屽叆搴撲换鍔� 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
// led 寮傚父鏄剧ず
// if (ledThread != null) {
// String errorMsg = "宸ヤ綔妗e凡瀛樺湪璇ユ潯鐮佸彿===>>" + barcode;
// MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
// }
- LiftProtocol liftProtocol = devpThread.getLiftStatus();
-
- if (liftProtocol == null) {
- continue;
- }
- if (liftProtocol.getMode() != 1) {
- continue;
- }
- if (liftProtocol.getDeviceStatus() != 0) {
- continue;
- }
- if (liftProtocol.getWorkNo() > 0) {
- continue;
- }
-
- Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo());
-
- LiftCommand command = new LiftCommand();
- command.setWorkNo(wrkMast.getWrkNo());
- command.setSourceStaNo(inSta.getStaNo());
- command.setTargetStaNo(staNo);
-
- barcodeThread.setBarcode("");
-
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, command));
- if (result) {
- News.info("WCS--->PLC涓嬪彂浠诲姟鎴愬姛:{}",command.toString());
- }
- if (!result) {
- throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
- }
-
- wrkMast.setWrkSts(3L);// 3.璁惧鎵ц涓�
- wrkMast.setCrnStrTime(new Date());
- wrkMastService.updateById(wrkMast);
- break;
- }
+// LiftProtocol liftProtocol = devpThread.getLiftStatus();
+//
+// if (liftProtocol == null) {
+// continue;
+// }
+// if (liftProtocol.getMode() != 1) {
+// continue;
+// }
+// if (liftProtocol.getDeviceStatus() != 0) {
+// continue;
+// }
+// if (liftProtocol.getWorkNo() > 0) {
+// continue;
+// }
+//
+// Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo());
+//
+// LiftCommand command = new LiftCommand();
+// command.setWorkNo(wrkMast.getWrkNo());
+// command.setSourceStaNo(inSta.getStaNo());
+// command.setTargetStaNo(staNo);
+//
+// barcodeThread.setBarcode("");
+//
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, command));
+// if (result) {
+// News.info("WCS--->PLC涓嬪彂浠诲姟鎴愬姛:{}",command.toString());
+// }
+// if (!result) {
+// throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+// }
+//
+// wrkMast.setWrkSts(3L);// 3.璁惧鎵ц涓�
+// wrkMast.setCrnStrTime(new Date());
+// wrkMastService.updateById(wrkMast);
+// Thread.sleep(300);// 寤舵椂3S
+// continue;
+// }
LiftProtocol liftProtocol = devpThread.getLiftStatus();
if(liftProtocol == null) {
@@ -274,25 +275,51 @@
wrkMastService.updateById(currentWrkMast);
Thread.sleep(3000); // 寤舵椂3S
} else {
- News.error("" + mark + " - 5" + " - 璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+// News.error("" + mark + " - 5" + " - 璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
// led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = jsonObject.getString("msg");
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
- }
-
+// if (ledThread != null) {
+// String errorMsg = jsonObject.getString("msg");
+// MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errorMsg));
+// }
//鎵樼洏閫�鍥�
// LiftCommand command = new LiftCommand();
// command.setWorkNo(9998);
// command.setSourceStaNo(inSta.getStaNo());
// command.setTargetStaNo(inSta.getBackSta());
- Integer back = 999;
+ if (wrkMast != null){
+ Integer staNo = Utils.getStaNoByLocNo(wrkMast.getLocNo());
- barcodeThread.setBarcode("");
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, back));
- if (!result) {
- throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ LiftCommand commandEmpty = new LiftCommand();
+ commandEmpty.setWorkNo(wrkMast.getWrkNo());
+ commandEmpty.setSourceStaNo(inSta.getStaNo());
+ commandEmpty.setTargetStaNo(staNo);
+
+ barcodeThread.setBarcode("");
+
+ boolean resultEmpty = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, commandEmpty));
+ if (resultEmpty) {
+ News.info("WCS--->PLC涓嬪彂浠诲姟鎴愬姛:{}",commandEmpty.toString());
+ }
+ if (!resultEmpty) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+
+ wrkMast.setWrkSts(3L);// 3.璁惧鎵ц涓�
+ wrkMast.setCrnStrTime(new Date());
+ wrkMastService.updateById(wrkMast);
+ Thread.sleep(3000); // 寤舵椂3S
+ }else {
+ Integer back = 999;
+
+ barcodeThread.setBarcode("");
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, back));
+ if (result) {
+ log.error("鎵樼洏閫�鍥炰换鍔′笅鍙戞垚鍔�");
+ }
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
}
}
--
Gitblit v1.9.1