From 624b93640b504a33837fddb3fb9ef1ebb510f20c Mon Sep 17 00:00:00 2001
From: TQS <56479841@qq.com>
Date: 星期二, 15 四月 2025 20:02:40 +0800
Subject: [PATCH] 12
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 112 +++++++++++++++++++++++++++++++++----------------------
src/main/resources/application.yml | 2
2 files changed, 68 insertions(+), 46 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 564d2ba..920801a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -95,6 +95,8 @@
@Autowired
private WaitPakinMapper waitPakinMapper;
+ private Map<String, Integer> flagData = new HashMap<>();
+
/**
* 缁勬墭
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 2
@@ -225,6 +227,7 @@
JSONObject jsonObject = JSON.parseObject(response);
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
Integer code = jsonObject.getInteger("code");
+ Object redata = jsonObject.get("data");
if (code.equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
// plc 澶勭悊
@@ -247,19 +250,7 @@
// }
// }
// News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
- }else if (code == 800) {
- staProtocol.setWorkNo((short) 9995);
- staProtocol.setStaNo(inSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-
- // led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = barcode + "娌℃湁瀵瑰簲绌哄簱浣�";
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
- }
- }
- else if (code == 700) {
+ } else if (code == 700) {
staProtocol.setWorkNo((short) 9995);
staProtocol.setStaNo(inSta.getBackSta().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -270,40 +261,71 @@
String errorMsg = barcode + "鎵樼洏璇嗗埆寮傚父锛岃鍏堣繘琛岀粍鎵橈紒";
MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
}
- } else if (code == 500 || code == 1000) {
- if (inSta.getStaNo().equals(103)) {
- staProtocol.setWorkNo((short) 9996);
- staProtocol.setStaNo((short) 203);
- }
- if (inSta.getStaNo().equals(203)) {
- staProtocol.setWorkNo((short) 9996);
- staProtocol.setStaNo((short) 103);
- }
- if (inSta.getStaNo().equals(113)) {
- staProtocol.setWorkNo((short) 9995);
- staProtocol.setStaNo((short) 114);
- } else if (inSta.getStaNo().equals(213)) {
- staProtocol.setWorkNo((short) 9995);
- staProtocol.setStaNo((short) 214);
- }
+ } else if (redata.toString().contains("鐗╂枡绫诲瀷鍜屽疄闄呯绫讳笉涓�鑷�")) {
+ staProtocol.setWorkNo((short) 9995);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- String data = jsonObject.getString("data");
- String msg = jsonObject.getString("msg");
- if (code == 500) {
- // led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "妫�绱㈠簱浣嶅け璐�,璇锋鏌ュ簱瀛樺墿浣欍��===>>" + data + "--" + msg;
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
- }
- } else if (code == 1000) {
- // led 寮傚父鏄剧ず
- if (ledThread != null) {
- String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "闇�瑕佹崲鍏ュ簱绔欍��";
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ String errorMsg = barcode + "鐗╂枡绫诲瀷鍜屽疄闄呯绫讳笉涓�鑷达紒";
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
+ } else if ((code == 500 || code == 1000)) {
+ if (redata != null && redata.toString().startsWith("800")) {
+ Integer num = flagData.get(param.getBarcode());
+ if (num != null) {
+ flagData.put(param.getBarcode(), num + 1);
+ } else {
+ flagData.put(param.getBarcode(), 1);
}
}
+ if (flagData.get(param.getBarcode()) != null && flagData.get(param.getBarcode()) >= 2) {
+ staProtocol.setWorkNo((short) 9995);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ // led 寮傚父鏄剧ず
+ if (ledThread != null && redata != null) {
+ String errorMsg = barcode + redata.toString();
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
+ } else {
+ if (inSta.getStaNo().equals(103)) {
+ staProtocol.setWorkNo((short) 9996);
+ staProtocol.setStaNo((short) 203);
+ }
+ if (inSta.getStaNo().equals(203)) {
+ staProtocol.setWorkNo((short) 9996);
+ staProtocol.setStaNo((short) 103);
+ }
+ if (inSta.getStaNo().equals(113)) {
+ staProtocol.setWorkNo((short) 9995);
+ staProtocol.setStaNo((short) 114);
+ } else if (inSta.getStaNo().equals(213)) {
+ staProtocol.setWorkNo((short) 9995);
+ staProtocol.setStaNo((short) 214);
+ }
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ String data = jsonObject.getString("data");
+ String msg = jsonObject.getString("msg");
+ if (code == 500) {
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "妫�绱㈠簱浣嶅け璐�,璇锋鏌ュ簱瀛樺墿浣欍��===>>" + data + "--" + msg;
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
+ } else if (code == 1000) {
+ // led 寮傚父鏄剧ず
+ if (ledThread != null) {
+ String errorMsg = "鍏ュ簱绔欙細" + staProtocol.getStaNo() + "---" + barcode + "闇�瑕佹崲鍏ュ簱绔欍��";
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
+ }
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -2821,7 +2843,7 @@
/**
* 璁╁皬杞︿粠 杩滅偣 ====>> 寰呮満
- * 绛夊緟鍫嗗灈鏈烘惉杩�
+ * 绛夊緟鍫嗗灈鏈烘惉杩�
*/
public synchronized void letCarBeWaiting(WrkMast wrkMast, Integer steNo, String locNo) {
// 鑾峰彇绌挎杞︿俊鎭�
@@ -2905,7 +2927,7 @@
/**
* 璁╁皬杞︿粠 杩滅偣 ====>> 绉诲姩鍒拌繎鐐�
- * 绛夊緟鍫嗗灈鏈烘惉杩�
+ * 绛夊緟鍫嗗灈鏈烘惉杩�
*/
public synchronized void letCarBeReady(WrkMast wrkMast, Integer steNo, String locNo) {
// 鑾峰彇绌挎杞︿俊鎭�
@@ -2949,7 +2971,7 @@
/**
* 璁╁皬杞︿粠 杩滅偣 ====>> 绉诲姩鍒拌繎鐐�
- * 绛夊緟鍫嗗灈鏈烘惉杩�
+ * 绛夊緟鍫嗗灈鏈烘惉杩�
*/
public synchronized void letCarBeReady(WrkCharge wrkCharge, Integer steNo) {
// 鑾峰彇绌挎杞︿俊鎭�
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index f066bcd..1acdcc3 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,5 +1,5 @@
server:
- port: 9090
+ port: 9091
servlet:
context-path: /@pom.build.finalName@
--
Gitblit v1.9.1