From 60e04974768c2c98b839a085cce2579caf0f3864 Mon Sep 17 00:00:00 2001
From: tqs <56479841@qq.com>
Date: 星期四, 16 三月 2023 11:15:23 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 128 ++++++++++++++++++++++++++++++++----------
1 files changed, 97 insertions(+), 31 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 cc41e1d..136df8d 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -113,9 +113,9 @@
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) {
- continue;
+ barcode = barcodeThread1.getBarcode();
}
- barcode = barcodeThread1.getBarcode();
+
if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
BarcodeThread barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode2());
if (barcodeThread2 != null) {
@@ -123,18 +123,21 @@
}
}
-// if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
-// barcode = "";
-// continue;
-// }
}
- if (!Cools.isEmpty(barcode) && !"NoRead".equals(barcode)) {
+
+ if (!Cools.isEmpty(barcode)) {
log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-// if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-// continue;
-// }
+ if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+ continue;
+ }
} else {
+ // led 寮傚父鏄剧ず
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ if (ledThread != null) {
+ String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
+ }
continue;
}
@@ -193,11 +196,15 @@
// }
// 鍒ゆ柇閲嶅宸ヤ綔妗�
- WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
- if (wrkMast != null) {
- log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
- continue;
+ WrkMast wrkMast = new WrkMast();
+ if (barcode.length() == 8) {
+ wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
+ if (wrkMast != null) {
+ log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+ continue;
+ }
}
+
// // 鑾峰彇鍏ュ簱閫氱煡妗�
// List<WaitPakin> waitPakins = waitPakinMapper.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("io_status", "N"));
// if (waitPakins.isEmpty()) {
@@ -222,6 +229,8 @@
.build()
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
+// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+// Integer code = jsonObject.getInteger("code");
if (jsonObject.getInteger("code").equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
@@ -236,6 +245,40 @@
} else {
log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
}
+// if (jsonObject.getInteger("code").equals(200)) {
+// StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+//
+// barcodeThread.setBarcode("");
+// staProtocol.setWorkNo(dto.getWorkNo().shortValue());
+// staProtocol.setStaNo(dto.getStaNo().shortValue());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+//
+// ledThread.errorReset();
+//
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// if (!result) {
+// throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+// }
+// } 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));
+// }
+// }
// // 妫�绱㈠簱浣�
@@ -397,15 +440,34 @@
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;
+
+
+ //101绔欐湁3涓壂鐮佸櫒锛屽綋0鎵爜鍣ㄦ病鏈夋暟鎹椂锛岃幏鍙�9銆�10涓や釜鎵爜鍣ㄦ暟鎹�
+ if((pickSta.getStaNo().equals(101) || pickSta.getStaNo().equals(104)) && ( "NoRead".equals(barcode) || Cools.isEmpty(barcode) )){
+ BarcodeThread barcodeThread1 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode1());
+ if (barcodeThread1 != null) {
+ barcode = barcodeThread1.getBarcode();
}
+
+ if("NoRead".equals(barcode) || Cools.isEmpty(barcode)) {
+ BarcodeThread barcodeThread2 = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode2());
+ if (barcodeThread2 != null) {
+ barcode = barcodeThread2.getBarcode();
+
+ }
+ }
+ }
+
+ if (!Cools.isEmpty(barcode)) {
+ log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+// if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+// continue;
+// }
} else {
continue;
}
@@ -419,33 +481,29 @@
staProtocol = staProtocol.clone();
}
-// // 鍏ュ嚭搴撴ā寮忓垽鏂�
-// if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
// WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
if (wrkMast == null) {
wrkMast = wrkMastMapper.selectPickStep(barcode);
}
if (wrkMast == null) {
// 鏃犳嫞鏂欐暟鎹�
+
+ if (ledThread != null) {
+ String errorMsg = "鏆傛棤鎷f枡淇℃伅锛侊紒锛�";
+ MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+ }
continue;
}
if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
|| Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo())) {
continue;
}
+ ledThread.errorReset();
- // 鎷c�佺洏銆佸苟 浣滀笟绔欒浆鎹�
-// int stnNo = 0;
-// if (wrkMast.getStaNo() == 109) {
-// stnNo = 127;
-// } else if (wrkMast.getStaNo() == 113) {
-// stnNo = 128;
-// } else {
-// log.error("{}鍙蜂换鍔℃暟鎹紓甯革紒", wrkMast.getWrkNo());
-// }
// 鑾峰彇鐩爣绔�
Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
.eq("type_no", wrkMast.getIoType() - 50)
@@ -828,6 +886,11 @@
// 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
// WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo());
+ // 鑾峰彇宸ヤ綔鐘舵�佷负14鐨勫伐浣滄。
+ WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep14(slave.getId(), crnStn.getStaNo());
+ if ( wrkMast1 !=null && (wrkMast1.getIoType().equals(103) || wrkMast1.getIoType().equals(107)) ) {
+ continue;
+ }
for (WrkMast wrkMast : wrkMasts) {
if (wrkMast == null) {
continue;
@@ -1795,8 +1858,11 @@
}
LocMast sourceLoc = locMastService.queryDemoSourceLoc(crn.getId());
- LocMast loc = locMastService.queryDemoLoc(crn.getId());
- if (null == sourceLoc || null == loc) {
+ if (null == sourceLoc ) {
+ continue;
+ }
+ LocMast loc = locMastService.queryDemoLoc0(crn.getId(),sourceLoc.getLocType1());
+ if ( null == loc) {
continue;
}
--
Gitblit v1.9.1