From 132db34b1ae71bf985d306ab38b8db37fac2e1eb Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期六, 25 二月 2023 10:44:41 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 219 +++++++++++++++++++++++++++---------------------------
1 files changed, 111 insertions(+), 108 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 14ca97b..6777879 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -21,6 +21,7 @@
import com.zy.common.service.CommonService;
import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
+import com.zy.common.utils.News;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
@@ -101,15 +102,39 @@
for (DevpSlave.Sta inSta : devp.getInSta()) {
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
+
if (barcodeThread == null) {
continue;
}
String barcode = barcodeThread.getBarcode();
- if (!Cools.isEmpty(barcode)) {
- log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
- if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
- continue;
+
+
+
+ //101绔欐湁3涓壂鐮佸櫒锛屽綋0鎵爜鍣ㄦ病鏈夋暟鎹椂锛岃幏鍙�9銆�10涓や釜鎵爜鍣ㄦ暟鎹�
+ if((inSta.getStaNo().equals(101) || inSta.getStaNo().equals(104)) && ( "NoRead".equals(barcode) || Cools.isEmpty(barcode) )){
+ BarcodeThread barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode1());
+ if (barcodeThread1 != null) {
+ barcode = barcodeThread1.getBarcode();
}
+
+ if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
+ BarcodeThread barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2());
+ if (barcodeThread2 != null) {
+ barcode = barcodeThread2.getBarcode();
+
+ }
+ }
+// if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
+// barcode = "";
+// continue;
+// }
+ }
+
+ if (!Cools.isEmpty(barcode) && !"NoRead".equals(barcode)) {
+ log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+// if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+// continue;
+// }
} else {
continue;
}
@@ -190,6 +215,7 @@
param.setIoType(1);
param.setSourceStaNo(inSta.getStaNo());
param.setLocType1(locTypeDto.getLocType1());
+// param.setFull(staProtocol.isFull());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/loc/v1")
@@ -302,22 +328,22 @@
}
// // 鍏ュ嚭搴撴ā寮忓垽鏂�
- if (inSta.getStaNo() == 101 && devpThread.ioModeOf1F1 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 104 && devpThread.ioModeOf1F1 != IoModeType.PAKOUT_MODE) {
continue;
}
- if (inSta.getStaNo() == 104 && devpThread.ioModeOf1F2 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 101 && devpThread.ioModeOf1F2 != IoModeType.PAKOUT_MODE) {
continue;
}
- if (inSta.getStaNo() == 111 && devpThread.ioModeOf1F3 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 114 && devpThread.ioModeOf1F3 != IoModeType.PAKOUT_MODE) {
continue;
}
- if (inSta.getStaNo() == 114 && devpThread.ioModeOf1F4 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 111 && devpThread.ioModeOf1F4 != IoModeType.PAKOUT_MODE) {
continue;
}
- if (inSta.getStaNo() == 201 && devpThread.ioModeOf2F1 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 204 && devpThread.ioModeOf2F1 != IoModeType.PAKOUT_MODE) {
continue;
}
- if (inSta.getStaNo() == 204 && devpThread.ioModeOf2F2 != IoModeType.PAKOUT_MODE) {
+ if (inSta.getStaNo() == 201 && devpThread.ioModeOf2F2 != IoModeType.PAKOUT_MODE) {
continue;
}
if (inSta.getStaNo() == 301 && devpThread.ioModeOf3F1 != IoModeType.PAKOUT_MODE) {
@@ -370,20 +396,20 @@
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鎷f枡鍏ュ簱鍙�
for (DevpSlave.Sta pickSta : devp.getPickSta()) {
-// // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
-// if (barcodeThread == null) {
-// continue;
-// }
-// String barcode = barcodeThread.getBarcode();
-// if(!Cools.isEmpty(barcode)) {
-// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
-// if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-// continue;
-// }
-// } else {
-// continue;
-// }
+ // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+ if (barcodeThread == null) {
+ continue;
+ }
+ String barcode = barcodeThread.getBarcode();
+ 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());
@@ -400,6 +426,9 @@
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
// WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+ if (wrkMast == null) {
+ wrkMast = wrkMastMapper.selectPickStep(barcode);
+ }
if (wrkMast == null) {
// 鏃犳嫞鏂欐暟鎹�
continue;
@@ -1302,7 +1331,7 @@
public synchronized void storeEmptyPlt() {
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻绌烘澘鍏ュ簱鍙�
- for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) {
+ for (DevpSlave.Sta emptyInSta : devp.getEmptyInSta()) {
// 鑾峰彇绌烘澘鍏ュ簱绔欎俊鎭�
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(emptyInSta.getStaNo());
@@ -1314,7 +1343,8 @@
// 绔欑偣鏉′欢鍒ゆ柇
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
- && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 9990 && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) {
+ && staProtocol.isEmptyMk() && (staProtocol.getWorkNo() > 9990
+ && staProtocol.getWorkNo() <= 9999) && staProtocol.isPakMk()) {
try {
LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
@@ -1431,10 +1461,7 @@
}
// 鑾峰彇宸ヤ綔妗f暟鎹�
WrkMast wrkMast = wrkMastMapper.selectById(staProtocol.getWorkNo());
-// if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
- if (null == wrkMast) {
- continue;
- }
+ if (null == wrkMast || wrkMast.getWrkSts() < 14 || wrkMast.getIoType() < 100) { continue; }
wrkMasts.add(wrkMast);
// 缁勮鍛戒护
LedCommand ledCommand = new LedCommand();
@@ -1442,12 +1469,6 @@
ledCommand.setIoType(wrkMast.getIoType());
// 鍑哄簱妯″紡
switch (wrkMast.getIoType()) {
- case 1:
- ledCommand.setTitle("鍏ㄦ澘鍏ュ簱");
- break;
- case 10:
- ledCommand.setTitle("绌烘澘鍏ュ簱");
- break;
case 101:
ledCommand.setTitle("鍏ㄦ澘鍑哄簱");
break;
@@ -1465,16 +1486,24 @@
ledCommand.setEmptyMk(true);
break;
default:
- log.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
+ News.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
break;
}
ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
- ledCommand.setLocNo(wrkMast.getLocNo());
ledCommand.setStaNo(wrkMast.getStaNo());
-// ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
- if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
+ if (wrkMast.getIoType() != 110) {
List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
- wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme())));
+ wrkDetls.forEach(wrkDetl -> {
+ if (wrkMast.getIoType() == 101) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme()));
+ }
+ if (wrkMast.getIoType() == 103 && (null == wrkDetl.getInspect() || 0 == wrkDetl.getInspect())) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme()));
+ }
+ if (wrkMast.getIoType() == 107) {
+ ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme()));
+ }
+ });
}
commands.add(ledCommand);
}
@@ -1487,22 +1516,10 @@
}
// 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
if (!commands.isEmpty()) {
- if (led.getId() == 7) {
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
- log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- continue;
- } else {
- ledThread.setLedMk(false);
- }
- } else {
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
- log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- continue;
- } else {
- ledThread.setLedMk(false);
- }
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) {
+ News.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ continue;
}
-
}
try {
@@ -1530,33 +1547,6 @@
* 鍏朵粬 ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅
*/
public synchronized void ledReset() {
-// for (LedSlave led : slaveProperties.getLed()) {
-// // 鑾峰彇杈撻�佺嚎plc绾跨▼
-// DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
-// // 鍛戒护闆嗗悎
-// boolean reset = true;
-// for (Integer staNo : led.getStaArr()) {
-// // 鑾峰彇鍙夎溅绔欑偣
-// StaProtocol staProtocol = devpThread.getStation().get(staNo);
-// if (staProtocol == null) {
-// continue;
-// } else {
-// staProtocol = staProtocol.clone();
-// }
-// if (staProtocol.getWorkNo() != 0) {
-// reset = false;
-// break;
-// }
-// }
-// // 鑾峰彇led绾跨▼
-// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId());
-// // led鏄剧ず榛樿鍐呭
-// if (reset) {
-// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
-// log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
-// }
-// }
-// }
for (LedSlave led : slaveProperties.getLed()) {
// 鑾峰彇杈撻�佺嚎plc绾跨▼
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
@@ -1565,32 +1555,18 @@
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
StaProtocol staProtocol = devpThread.getStation().get(staNo);
- if (staProtocol == null) {
- continue;
- }
- if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) {
+ if (staProtocol == null) { continue; }
+ if (staProtocol.getWorkNo() != 0) {
reset = false;
break;
}
}
// 鑾峰彇led绾跨▼
- LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId());
// led鏄剧ず榛樿鍐呭
- if (reset && !ledThread.isLedMk()) {
- if (led.getId() == 7) {
- ledThread.setLedMk(true);
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
- log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- } else {
-
- }
- } else {
- ledThread.setLedMk(true);
- if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
- log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
- } else {
-
- }
+ if (reset) {
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) {
+ News.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
}
}
}
@@ -1951,10 +1927,37 @@
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
for (DevpSlave.Sta inSta : devp.getInSta()) {
- if (inSta.getStaNo() == 2) {
- continue;
+// if (inSta.getStaNo() == 2) {
+// continue;
+// }
+ Integer staNo = 0;
+ switch (inSta.getStaNo()){
+ case 101:
+ staNo = 102;
+ break;
+ case 104:
+ staNo = 106;
+ break;
+ case 111:
+ staNo = 112;
+ break;
+ case 114:
+ staNo = 116;
+ break;
+ case 201:
+ staNo = 202;
+ break;
+ case 204:
+ staNo = 205;
+ break;
+ case 301:
+ staNo = 302;
+ break;
+ case 304:
+ staNo = 305;
+ break;
}
- WrkMast pakout = wrkMastMapper.selectWorkingPakout(inSta.getStaNo());
+ WrkMast pakout = wrkMastMapper.selectWorkingPakout(staNo);
switch (inSta.getStaNo()) {
case 101: // 1F1
if (pakout != null) {
@@ -2046,7 +2049,7 @@
devpThread.ioModeOf2F1 = IoModeType.PAKIN_MODE;
}
break;
- case 203: // 2F2
+ case 204: // 2F2
if (pakout != null) {
if (devpThread.ioModeOf2F2 != IoModeType.PAKOUT_MODE) {
// 鍑哄簱鍒囨崲涓�
@@ -2082,7 +2085,7 @@
devpThread.ioModeOf3F1 = IoModeType.PAKIN_MODE;
}
break;
- case 303: // 3F2
+ case 304: // 3F2
if (pakout != null) {
if (devpThread.ioModeOf3F2 != IoModeType.PAKOUT_MODE) {
// 鍑哄簱鍒囨崲涓�
--
Gitblit v1.9.1