From 6cdbb7c1b75a897d5917d36fcde5de8fd94863e3 Mon Sep 17 00:00:00 2001
From: lsh <lsh123456>
Date: 星期日, 08 一月 2023 21:12:50 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 180 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 128 insertions(+), 52 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 7712da6..1abe6ed 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -105,14 +105,6 @@
continue;
}
String barcode = barcodeThread.getBarcode();
- if (!Cools.isEmpty(barcode)) {
- log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
- if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
- continue;
- }
- } else {
- continue;
- }
// 鑾峰彇鍏ュ簱绔欎俊鎭�
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -121,6 +113,63 @@
continue;
} else {
staProtocol = staProtocol.clone();
+ }
+
+ if (!Cools.isEmpty(barcode)) {
+ log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+ if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+ if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
+ staProtocol.setWorkNo((short)9998);
+ staProtocol.setStaNo((short)100);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
+ staProtocol.setWorkNo((short)9998);
+ if (inSta.getStaNo()==201){
+ staProtocol.setStaNo((short)200);
+ }else if (inSta.getStaNo()==207){
+ staProtocol.setStaNo((short)206);
+ }else if (inSta.getStaNo()==213){
+ staProtocol.setStaNo((short)212);
+ }
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }
+ continue;
+ }
+ } else if (staProtocol.getWorkNo()==9999 && staProtocol.isLoading() && !staProtocol.isEmptyMk()){
+ if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
+ staProtocol.setWorkNo((short)9998);
+ staProtocol.setStaNo((short)100);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
+ staProtocol.setWorkNo((short)9998);
+ if (inSta.getStaNo()==201){
+ staProtocol.setStaNo((short)200);
+ }else if (inSta.getStaNo()==207){
+ staProtocol.setStaNo((short)206);
+ }else if (inSta.getStaNo()==213){
+ staProtocol.setStaNo((short)212);
+ }
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }
+ continue;
+ }else {
+ continue;
}
// 鍏ュ嚭搴撴ā寮忓垽鏂�
@@ -150,11 +199,31 @@
// 鍒ゆ柇閲嶅宸ヤ綔妗�
WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
+ WrkMast wrkMast1 = wrkMastMapper.selectPakInStepBarcode(barcode);
+ if (wrkMast1 !=null){
+ if (wrkMast1.getIoType()==103 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()==104){
+ continue;
+ }
+ }
if (wrkMast != null) {
log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
- if (inSta.getStaNo()==100 || inSta.getStaNo()==108 || inSta.getStaNo()==116){
+ if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
staProtocol.setWorkNo((short)9999);
staProtocol.setStaNo((short)100);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
+ staProtocol.setWorkNo((short)9999);
+ if (inSta.getStaNo()==201){
+ staProtocol.setStaNo((short)200);
+ }else if (inSta.getStaNo()==207){
+ staProtocol.setStaNo((short)206);
+ }else if (inSta.getStaNo()==213){
+ staProtocol.setStaNo((short)212);
+ }
devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
if (!result) {
@@ -199,6 +268,31 @@
}
} else {
log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+ if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
+ staProtocol.setWorkNo((short)9999);
+ staProtocol.setStaNo((short)100);
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+ }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
+ staProtocol.setWorkNo((short)9999);
+ if (inSta.getStaNo()==201){
+ staProtocol.setStaNo((short)200);
+ }else if (inSta.getStaNo()==207){
+ staProtocol.setStaNo((short)206);
+ }else if (inSta.getStaNo()==213){
+ staProtocol.setStaNo((short)212);
+ }
+ devpThread.setPakMk(staProtocol.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
+
+
+ }
}
@@ -338,20 +432,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());
@@ -366,8 +460,8 @@
// 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());
+ WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
+// WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo().intValue());
if (wrkMast == null) {
// 鏃犳嫞鏂欐暟鎹�
continue;
@@ -721,7 +815,7 @@
CrnCommand crnCommand = new CrnCommand();
crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
- crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+// crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
crnCommand.setSourcePosX(crnStn.getRow().shortValue()); // 婧愬簱浣嶆帓
crnCommand.setSourcePosY(crnStn.getBay().shortValue()); // 婧愬簱浣嶅垪
@@ -869,7 +963,7 @@
CrnCommand crnCommand = new CrnCommand();
crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
- crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+// crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 婧愬簱浣嶆帓
crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 婧愬簱浣嶅垪
@@ -1435,20 +1529,11 @@
}
// 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
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);
- }
+ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
+ log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+ continue;
} 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);
- }
+ ledThread.setLedMk(false);
}
}
@@ -1525,20 +1610,11 @@
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
// 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 {
-
- }
+ 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 {
- 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 {
- }
}
}
}
--
Gitblit v1.9.1