From ec80bf42b4aab897becca23417c661d089c2a099 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 28 九月 2022 13:50:54 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 63 ++++++++++++++++++++++++++++---
src/main/resources/application.yml | 2 +
2 files changed, 58 insertions(+), 7 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 258fe03..4f320b2 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -165,19 +165,39 @@
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
// plc 澶勭悊
barcodeThread.setBarcode("");
staProtocol.setWorkNo(dto.getWorkNo().shortValue());
staProtocol.setStaNo(dto.getStaNo().shortValue());
devpThread.setPakMk(staProtocol.getSiteId(), false);
+
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
- } else {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ } else if (code == 500){
+ if (ledThread != null) {
+ String errorMsg = jsonObject.getString("msg");
+ if (!Cools.isEmpty(errorMsg)) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
+ }
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ } else if (code == 700) {
+ 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));
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -1931,14 +1951,36 @@
staProtocol = staProtocol.clone();
}
// 绔欑偣鏉′欢鍒ゆ柇
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
- && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo() >= 9990 && staProtocol.getWorkNo() <= 9999) || staProtocol.getWorkNo() == 9997) && staProtocol.isPakMk()) {
+ if (staProtocol.isAutoing()
+ && staProtocol.isLoading()
+ && staProtocol.isInEnable()
+ && staProtocol.isEmptyMk()
+ && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo() >= 9990 || staProtocol.getWorkNo() <= 9999))
+ && staProtocol.isPakMk()) {
+
+ // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+ String barcode = null;
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, emptyInSta.getBarcode());
+ if (barcodeThread != null) {
+ String barcode0 = barcodeThread.getBarcode();
+ if(!Cools.isEmpty(barcode0)) {
+// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", emptyInSta.getBarcode(), barcode0);
+ if(!"NG".endsWith(barcode0) && !"NoRead".equals(barcode0) && !"empty".equals(barcode0)) {
+ barcode = barcode0;
+ }
+ }
+ }
+
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed());
try {
LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
SearchLocParam param = new SearchLocParam();
param.setIoType(10);
+ if (!Cools.isEmpty(barcode)) {
+ param.setBarcode(barcode);
+ }
param.setSourceStaNo(emptyInSta.getStaNo());
param.setLocType1(locTypeDto.getLocType1());
String response = new HttpHandler.Builder()
@@ -1948,7 +1990,8 @@
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
- if (jsonObject.getInteger("code").equals(200)) {
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
@@ -1960,7 +2003,13 @@
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
} else {
- log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ if (ledThread != null) {
+ String errorMsg = jsonObject.getString("msg");
+ if (!Cools.isEmpty(errorMsg)) {
+ MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, errorMsg));
+ }
+ }
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
}
} catch (Exception e) {
e.printStackTrace();
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index dd5aba4..63008e2 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -175,9 +175,11 @@
# 绌烘澘鍏ュ簱鍙�1
emptyInSta[0]:
staNo: 103
+ barcode: ${wcs-slave.barcode[0].id}
# 绌烘澘鍏ュ簱鍙�1
emptyInSta[1]:
staNo: 203
+ barcode: ${wcs-slave.barcode[1].id}
# 鍑哄簱鍙�1
outSta[0]:
staNo: 100
--
Gitblit v1.9.1