From 3160d2eb5f67ecb48b9c951b0ca974eade2040a5 Mon Sep 17 00:00:00 2001
From: pjb <123456>
Date: 星期四, 27 六月 2024 20:48:27 +0800
Subject: [PATCH] led显示屏修改
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++---------
1 files changed, 69 insertions(+), 18 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 6b6667f..3bc9660 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -206,14 +206,16 @@
continue;
}
}
- if (wrkMast != null && devp.getId() == 2) {
+ if (wrkMast != null) {
News.warn(""+mark+" - 4"+" - 宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
- staProtocol.setWorkNo((short)9999);
- staProtocol.setStaNo(inSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ if (devp.getId() == 2) {
+ staProtocol.setWorkNo((short)9999);
+ staProtocol.setStaNo(inSta.getBackSta().shortValue());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
}
// led 寮傚父鏄剧ず
@@ -264,7 +266,11 @@
ledCommand.setStaNo(dto.getStaNo());
ledCommand.setBarcode(barcode);
commands.add(ledCommand);
- MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands));
+ if (devp.getId() == 1) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(1, commands));
+ } else {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, commands));
+ }
// ledThread.errorReset();
}
} else {
@@ -447,10 +453,12 @@
StaDesc staDesc = staDescService.selectOne(wrapper);
if (Cools.isEmpty(staDesc)) {
News.error(""+mark+" - 2"+" - 鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
- staProtocol.setWorkNo((short) 9999);
- staProtocol.setStaNo(pickSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (devp.getId() == 2) {
+ staProtocol.setWorkNo((short) 9999);
+ staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ }
//LED
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
// led 寮傚父鏄剧ず
@@ -499,6 +507,20 @@
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
continue;
+ }
+ List<LedCommand> commands = new ArrayList<>();
+ LedCommand ledCommand = new LedCommand();
+ ledCommand.setWorkNo(wrkMast.getWrkNo());
+ ledCommand.setIoType(wrkMast.getIoType());
+ ledCommand.setTitle(wrkMast.getIoType() == 53 ? "鎷f枡鍐嶅叆搴�" : "鐩樼偣鍐嶅叆搴�");
+ ledCommand.setLocNo(wrkMast.getLocNo());
+ ledCommand.setStaNo(wrkMast.getStaNo());
+ ledCommand.setBarcode(barcode);
+ commands.add(ledCommand);
+ if (devp.getId() == 1) {
+ MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(1, commands));
+ } else {
+ MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, commands));
}
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
@@ -1546,12 +1568,17 @@
// 缁勮鍛戒护
LedCommand ledCommand = new LedCommand();
ledCommand.setWorkNo(dto.getWorkNo());
- ledCommand.setIoType(1);
- ledCommand.setTitle("鍏ㄦ澘鍏ュ簱");
+ ledCommand.setIoType(10);
+ ledCommand.setTitle("绌烘澘鍏ュ簱");
ledCommand.setLocNo(dto.getLocNo());
ledCommand.setStaNo(dto.getStaNo());
+ ledCommand.setBarcode("");
commands.add(ledCommand);
- MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
+ if (devp.getId() == 1) {
+ MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(1, commands));
+ } else {
+ MessageQueue.offer(SlaveType.Led, emptyInSta.getLed(), new Task(3, commands));
+ }
// ledThread.errorReset();
}
} else {
@@ -1600,6 +1627,9 @@
// 宸ヤ綔妗i泦鍚�
List<WrkMast> wrkMasts = new ArrayList<>();
for (Integer staNo : led.getStaArr()) {
+ if (staNo == 104 || staNo == 204) {
+ continue;
+ }
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) {
@@ -1745,11 +1775,20 @@
// led鏄剧ず榛樿鍐呭
if (reset && !ledThread.isLedMk()) {
ledThread.setLedMk(true);
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
- News.error(""+mark+" - 1"+" - {}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- } else {
+ if (led.getId() <=2 ) {
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
+ News.error(""+mark+" - 1"+" - {}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ } else {
+ }
+ } else {
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
+ News.error(""+mark+" - 1"+" - {}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ } else {
+
+ }
}
+
}
}
News.infoNoLog(""+mark+" - 0"+" - 鎵ц瀹屾垚锛氬叾浠� ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅");
@@ -2325,4 +2364,16 @@
}
}
+ public void resetOneLed() {
+ // 鏍规嵁杈撻�佺嚎plc閬嶅巻
+ for (DevpSlave devp : slaveProperties.getDevp()) { //閬嶅巻杈撻�佺嚎
+ if (devp.getId() == 1) {
+ // 閬嶅巻鍏ュ簱鍙�
+ for (DevpSlave.Sta inSta : devp.getInSta()) { // 閬嶅巻鍏ュ簱鍙�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
+ }
+ }
+ }
+ }
}
--
Gitblit v1.9.1