From aa9fabbb6a6baaa80394942c1c8b462c44332a27 Mon Sep 17 00:00:00 2001
From: whycq <123456>
Date: 星期一, 12 十二月 2022 15:59:55 +0800
Subject: [PATCH] # LED
---
src/main/java/com/zy/core/model/DevpSlave.java | 2 +
src/main/java/com/zy/core/thread/LedThread.java | 38 +++++++++++++++++++
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 33 ++++++++++++----
src/main/resources/application.yml | 4 ++
4 files changed, 68 insertions(+), 9 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 bada5c5..4178662 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -176,7 +176,9 @@
.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 == 200) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
barcodeThread.setBarcode("");
@@ -188,6 +190,19 @@
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
} else {
+ staProtocol.setWorkNo((short) 9999);
+ staProtocol.setStaNo((short)(inSta.getStaNo()+1));
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+
+ if(!Cools.isEmpty(ledThread)){
+ String errorMsg = jsonObject.getString("msg");
+ if(!Cools.isEmpty(errorMsg)){
+ LedCommand ledCommand = new LedCommand();
+ ledCommand.setTitle(errorMsg);
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(9, ledCommand));
+ }
+ }
log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl+"/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
}
@@ -330,14 +345,14 @@
continue;
}
String barcode = barcodeThread.getBarcode();
- if(!Cools.isEmpty(barcode)) {
- log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
- if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
- continue;
- }
- } else {
- continue;
- }
+// if(!Cools.isEmpty(barcode)) {
+// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+// if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+// continue;
+// }
+// } else {
+// continue;
+// }
// 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
diff --git a/src/main/java/com/zy/core/model/DevpSlave.java b/src/main/java/com/zy/core/model/DevpSlave.java
index ad33be5..4b78c42 100644
--- a/src/main/java/com/zy/core/model/DevpSlave.java
+++ b/src/main/java/com/zy/core/model/DevpSlave.java
@@ -34,6 +34,8 @@
private Integer barcode;
+ private Integer led;
+
}
}
diff --git a/src/main/java/com/zy/core/thread/LedThread.java b/src/main/java/com/zy/core/thread/LedThread.java
index b263a9e..c36591b 100644
--- a/src/main/java/com/zy/core/thread/LedThread.java
+++ b/src/main/java/com/zy/core/thread/LedThread.java
@@ -74,6 +74,10 @@
case 1:
write((List<LedCommand>)task.getData());
break;
+ // 鍐欐暟鎹�
+ case 9:
+ write9((List<LedCommand>)task.getData());
+ break;
// 澶嶄綅
case 2:
reset();
@@ -152,6 +156,40 @@
close();
}
+ private void write9(List<LedCommand> list) throws Bx5GException {
+ if (!connect()) {
+ return;
+ }
+ pf = new ProgramBxFile( 0, screen.getProfile());
+ pf.setFrameShow(false);
+ // 鍒嗗埆杈撳叆X锛孻锛寃idth锛宧eight
+ area = new TextCaptionBxArea( 0,0,96,48, screen.getProfile());
+ // 鍒涘缓涓�涓暟鎹〉
+ TextBxPage page = new TextBxPage();
+ for (LedCommand command : list) {
+ page.newLine(command.getTitle());
+ page.newLine("\n");
+ }
+
+ // 璁剧疆瀛椾綋
+ page.setFont(new Font("瀹嬩綋",Font.PLAIN,12));
+ // 璁剧疆鏂囨湰棰滆壊
+ page.setForeground(Color.red);
+ // 璁剧疆鏄剧ず鐗规妧涓哄揩閫熸墦鍑�
+ page.setDisplayStyle(styles[6]);
+ area.clearPages();
+ area.addPage(page);
+ pf.addArea(area);
+ if (pf.validate() != null) {
+ log.info("pf out of range");
+ } else {
+ // 鏇存柊鑺傜洰
+ screen.writeProgram(pf);
+// resetStatus = false;
+ }
+ close();
+ }
+
private void reset() throws Bx5GException {
if (!connect()) {
return;
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 614053f..06f1d66 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -185,14 +185,17 @@
inSta[0]:
staNo: 103
barcode: ${wcs-slave.barcode[0].id}
+ led: ${wcs-slave.led[1].id}
# 鍏ュ簱鍙�2
inSta[1]:
staNo: 203
barcode: ${wcs-slave.barcode[1].id}
+ led: ${wcs-slave.led[3].id}
# 鍏ュ簱鍙�3
inSta[2]:
staNo: 305
barcode: ${wcs-slave.barcode[2].id}
+ led: ${wcs-slave.led[5].id}
# 绌烘澘鍏ュ簱鍙�1
emptyInSta[0]:
staNo: 103
@@ -234,6 +237,7 @@
inSta[0]:
staNo: 402
barcode: ${wcs-slave.barcode[3].id}
+ led: ${wcs-slave.led[7].id}
# 绌烘澘鍏ュ簱鍙�1
emptyInSta[0]:
staNo: 402
--
Gitblit v1.9.1