From 375f92ebe423c6c831c399812be05a5d920f6987 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 10 九月 2020 11:02:16 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 56 +++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 39 insertions(+), 17 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 8428b98..23f7ed9 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -155,12 +155,10 @@
staProtocol.setWorkNo((short) workNo);
staProtocol.setStaNo(startupDto.getStaNo().shortValue());
staProtocol.setPakMk(false);
- staProtocol.setInreq1(false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
- staProtocol.setPakMk(false);
}
@@ -206,11 +204,11 @@
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+ staProtocol.setPakMk(false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
- staProtocol.setPakMk(false);
}
@@ -239,7 +237,7 @@
// 鏃犳嫞鏂欐暟鎹�
continue;
}
- if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 1070)
+ if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
|| Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
continue;
}
@@ -285,7 +283,6 @@
staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
staProtocol.setPakMk(false);
- staProtocol.setInreq1(false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
@@ -720,12 +717,13 @@
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
staProtocol.setWorkNo((short) workNo);
staProtocol.setStaNo(startupDto.getStaNo().shortValue());
+ staProtocol.setPakMk(false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
- staProtocol.setPakMk(false);
+
}
@@ -748,20 +746,43 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
- if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo()) { continue; }
+ if (null == staProtocol || null == staProtocol.getWorkNo() || 0 == staProtocol.getWorkNo() || !staProtocol.isLoading()) { continue; }
// 鑾峰彇宸ヤ綔妗f暟鎹�
WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
- if (wrkMast.getWrkSts() == 14L || wrkMast.getWrkSts() == 15L) {
- wrkMasts.add(wrkMast);
- // 娣诲姞鍛戒护
- List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
- LedCommand ledCommand = new LedCommand();
- ledCommand.setWorkNo(wrkMast.getWrkNo());
- ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
- ledCommand.setStaNo(wrkMast.getStaNo());
- wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMatnr(), wrkDetl.getAnfme())));
- commands.add(ledCommand);
+ if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
+ wrkMasts.add(wrkMast);
+ // 缁勮鍛戒护
+ LedCommand ledCommand = new LedCommand();
+ ledCommand.setWorkNo(wrkMast.getWrkNo());
+ // 鍑哄簱妯″紡
+ switch (wrkMast.getIoType()) {
+ case 101:
+ ledCommand.setTitle("鍏ㄦ澘鍑哄簱");
+ break;
+ case 103:
+ ledCommand.setTitle("鎷f枡鍑哄簱");
+ break;
+ case 104:
+ ledCommand.setTitle("骞舵澘鍑哄簱");
+ break;
+ case 107:
+ ledCommand.setTitle("鐩樼偣鍑哄簱");
+ break;
+ case 110:
+ ledCommand.setTitle("绌烘澘鍑哄簱");
+ ledCommand.setEmptyMk(true);
+ break;
+ default:
+ log.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
+ break;
}
+ ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
+ ledCommand.setStaNo(wrkMast.getStaNo());
+ if (wrkMast.getIoType() != 110) {
+ List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
+ wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMatnr(), wrkDetl.getAnfme())));
+ }
+ commands.add(ledCommand);
}
Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
// 鑾峰彇LED绾跨▼
@@ -773,6 +794,7 @@
// 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
if (!commands.isEmpty()) {
if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
+ log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
continue;
}
}
--
Gitblit v1.9.1