From 067e0bd4ae50cfc8810844ff39e9302493309da1 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 08 十二月 2022 10:09:48 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 384 ++++++++++++++++++++++++++++++++++--------------------
1 files changed, 238 insertions(+), 146 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 d00577d..98ed695 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -39,7 +39,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -118,6 +117,54 @@
&& !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999))
&& staProtocol.isPakMk()) {
+ // 灏哄妫�娴嬪紓甯�
+ boolean back = false;
+ String errMsg = "";
+ if (staProtocol.isFrontErr()) {
+ errMsg = "鍓嶈秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isBackErr()) {
+ errMsg = "鍚庤秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isHighErr()) {
+ errMsg = "楂樿秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isLeftErr()) {
+ errMsg = "宸﹁秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isRightErr()) {
+ errMsg = "鍙宠秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isWeightErr()) {
+ errMsg = "瓒呴噸";
+ back = true;
+ }
+ if (!back && staProtocol.isBarcodeErr()) {
+ errMsg = "鎵爜澶辫触";
+ back = true;
+ }
+
+ // 閫�鍥�
+ if (back) {
+ log.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg);
+ 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 寮傚父鏄剧ず
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ if (ledThread != null) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
+ }
+ continue;
+ }
+
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
if (barcodeThread == null) {
@@ -156,16 +203,16 @@
}
// 杩囨护鐩樼偣/鎷f枡/骞舵澘浠诲姟
- if (null != wrkMastMapper.selectPickStepByBarcode(barcode)) {
- continue;
- }
+// if (null != wrkMastMapper.selectPickStepByBarcode(barcode)) {
+// continue;
+// }
// 鍒ゆ柇閲嶅宸ヤ綔妗�
- WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
- if (wrkMast != null) {
- log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
- continue;
- }
+// WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
+// if (wrkMast != null) {
+// log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
+// continue;
+// }
try {
LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
@@ -228,6 +275,7 @@
* wms鍏ュ簱
* 鍏ュ簱绔欙紝鏍规嵁鏉$爜鎵弿鐢熸垚鍏ュ簱宸ヤ綔妗o紝宸ヤ綔鐘舵�� 1 ==>> 2
*/
+ @Deprecated
public void generateStoreWrkFile0() {
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
@@ -247,6 +295,55 @@
&& staProtocol.isInEnable()
&& !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999))
&& staProtocol.isPakMk()) {
+
+ // 灏哄妫�娴嬪紓甯�
+ boolean back = false;
+ String errMsg = "";
+ if (staProtocol.isFrontErr()) {
+ errMsg = "鍓嶈秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isBackErr()) {
+ errMsg = "鍚庤秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isHighErr()) {
+ errMsg = "楂樿秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isLeftErr()) {
+ errMsg = "宸﹁秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isRightErr()) {
+ errMsg = "鍙宠秴闄�";
+ back = true;
+ }
+ if (!back && staProtocol.isWeightErr()) {
+ errMsg = "瓒呴噸";
+ back = true;
+ }
+ if (!back && staProtocol.isBarcodeErr()) {
+ errMsg = "鎵爜澶辫触";
+ back = true;
+ }
+
+ // 閫�鍥�
+ if (back) {
+ log.warn("鎵爜鍏ュ簱澶辫触锛寋}鍏ュ簱绔欏洜{}寮傚父锛屾墭鐩樺凡琚��鍥�", inSta.getStaNo(), errMsg);
+ 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 寮傚父鏄剧ず
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ if (ledThread != null) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
+ }
+ continue;
+ }
+
// 鍒ゆ柇閲嶅宸ヤ綔妗�
WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
if (wrkMast == null) { continue; }
@@ -274,63 +371,9 @@
}
/**
- * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱 銆愮1闃舵銆�
+ * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
*/
- public synchronized void stnToCrnStnPick0(){
- for (DevpSlave devp : slaveProperties.getDevp()) {
- // 閬嶅巻鎷f枡鍏ュ簱鍙�
- for (DevpSlave.Sta pickSta : devp.getPickOutSta()) {
-
- // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
- DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
- if (staProtocol == null) {
- continue;
- } else {
- staProtocol = staProtocol.clone();
- }
- if (staProtocol.isAutoing()
- && staProtocol.isLoading()
- && staProtocol.isInEnable()
- && staProtocol.getWorkNo() > 0
- && staProtocol.isPakMk()) {
- WrkMast wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo());
- if (wrkMast == null) {
- // 鏃犳嫞鏂欐暟鎹�
- continue;
- }
- short staNo;
- switch (wrkMast.getSourceStaNo()) {
- case 104:
- case 108:
- staNo = 103;
- break;
- case 204:
- case 208:
- staNo = 203;
- break;
- default:
- log.error("{}浠诲姟鍐嶅叆搴撳け璐ワ紝绯荤粺鏁版嵁寮傚父锛�", wrkMast.getWrkNo());
- continue;
- }
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
-// staProtocol.setWorkNo((short) 9994);
- staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
- staProtocol.setStaNo(staNo);
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
- }
- }
- }
- }
-
- /**
- * 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱銆愮2闃舵銆�
- */
- public synchronized void stnToCrnStnPick1(){
+ public synchronized void stnToCrnStnPick(){
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鎷f枡鍏ュ簱鍙�
for (DevpSlave.Sta pickSta : devp.getPickInSta()) {
@@ -347,65 +390,63 @@
&& staProtocol.isLoading()
&& staProtocol.isInEnable()
// 0 - 9990 鎴栬�� 9996
- && ((staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) || staProtocol.getWorkNo() == 9996)
+ && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990)
&& staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
&& staProtocol.isPakMk()){
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
- BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
- if (barcodeThread == null) {
- continue;
- }
+// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+// if (barcodeThread == null) {
+// continue;
+// }
WrkMast wrkMast = null;
if (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9990) {
wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo());
if (null == wrkMast) {
log.error("{}浠诲姟鍙烽敊璇紝鏆傛棤鎷f枡浠诲姟锛�", staProtocol.getWorkNo());
- }
- }
- if (staProtocol.getWorkNo() == 9996) {
- String barcode = barcodeThread.getBarcode();
- if(!Cools.isEmpty(barcode)) {
- log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
- if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
- staProtocol.setWorkNo((short) 9995);
- 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());
- if (ledThread != null) {
- String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
- MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
- }
- continue;
- }
- } else {
- staProtocol.setWorkNo((short) 9995);
- 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());
- if (ledThread != null) {
- String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
- MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
- }
continue;
}
- wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
- if (null == wrkMast) {
- log.error("{}鏉$爜閿欒锛屾殏鏃犳嫞鏂欎换鍔★紒", barcode);
- }
- }
-
- if (wrkMast == null) {
- // 鏃犳嫞鏂欐暟鎹�
+ } else {
continue;
}
+// if (staProtocol.getWorkNo() == 9996) {
+// String barcode = barcodeThread.getBarcode();
+// if(!Cools.isEmpty(barcode)) {
+// log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+// if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+// staProtocol.setWorkNo((short) 9995);
+// 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());
+// if (ledThread != null) {
+// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+// }
+// continue;
+// }
+// } else {
+// staProtocol.setWorkNo((short) 9995);
+// 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());
+// if (ledThread != null) {
+// String errorMsg = "鎵爜澶辫触锛岃閲嶈瘯";
+// MessageQueue.offer(SlaveType.Led, pickSta.getLed(), new Task(3, errorMsg));
+// }
+// continue;
+// }
+// wrkMast = wrkMastMapper.selectPickStepByBarcode(barcode);
+// if (null == wrkMast) {
+// log.error("{}鏉$爜閿欒锛屾殏鏃犳嫞鏂欎换鍔★紒", barcode);
+// }
+// }
if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
|| Cools.isEmpty(wrkMast.getStaNo()) || Cools.isEmpty(wrkMast.getSourceStaNo()) ) {
continue;
@@ -418,7 +459,7 @@
param.setWrkNo(wrkMast.getWrkNo());
param.setIoType(wrkMast.getIoType());
param.setSourceStaNo(pickSta.getStaNo());
- param.setLocType1(locTypeDto.getLocType1());
+// param.setLocType1(locTypeDto.getLocType1());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/loc/v1")
@@ -469,27 +510,6 @@
if (wrkMastMapper.setSteEmpty(wrkMast.getWrkNo()) == 0) {
throw new CoolException(wrkMast.getWrkNo() + "鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
}
- // 淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�
- LocMast locMast = locMastService.selectById(sourceLocNo);
- locMast.setLocSts("O");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException(wrkMast.getWrkNo() + "淇敼婧愬簱浣嶇姸鎬� O.绌哄簱浣�");
- }
- // 淇敼鐩爣搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
- locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocSts("Q");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException(wrkMast.getWrkNo() + "淇敼鐩爣搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�");
- }
- // 搴撳瓨鏄庣粏杞Щ
- if (!locDetlService.updateLocNo(wrkMast.getLocNo(), sourceLocNo)) {
- throw new CoolException(wrkMast.getWrkNo() + "浠诲姟搴撳瓨鏄庣粏杞Щ澶辫触锛侊紒锛�");
- }
-
- // 鏉$爜璁惧澶勭悊
- barcodeThread.setBarcode("");
// 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
@@ -525,7 +545,6 @@
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-// continue;
}
}
@@ -537,7 +556,6 @@
/**
* 鍫嗗灈鏈虹珯鍑哄簱鍒板嚭搴撶珯
*/
- @Async
public void crnStnToOutStn() {
for (CrnSlave crnSlave : slaveProperties.getCrn()) {
// 閬嶅巻鍫嗗灈鏈哄嚭搴撶珯
@@ -777,8 +795,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� {} => 7.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkSts$(), wrkMast.getWrkNo());
+ } else {
+ return true;
}
- return true;
}
}
} else {
@@ -793,11 +812,13 @@
// 娌℃湁鍏朵粬浠诲姟
if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
this.letCarBeReady(wrkMast, steNo, wrkMast.getLocNo());
+ return true;
}
}
// 灏忚溅鎼蛋
if (wrkMast.getWrkSts() == 3L) {
this.carMoveOut(wrkMast, steNo, crnProtocol);
+ return true;
}
// 娌℃湁灏忚溅
} else {
@@ -834,8 +855,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� {} => 7.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkSts$(), wrkMast.getWrkNo());
+ } else {
+ return true;
}
- return true;
}
}
@@ -852,6 +874,8 @@
// 娌℃湁鍏朵粬浠诲姟
if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo());
+ } else {
+ return true;
}
}
// 鍫嗗灈鏈哄皢璐ф斁鑷冲皬杞︿笂 3.灏忚溅寰呮惉锛堝皬杞︿笉鐢ㄦ惉杩愶紝宸茬粡鍦ㄥ綋鍓嶇粍搴撲綅锛� / 6.灏忚溅寰呭叆 ===>> 7.鍚婅溅鍏ュ簱涓�
@@ -888,8 +912,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉/6.灏忚溅寰呭叆 => 7.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ } else {
+ return true;
}
- return true;
}
}
}
@@ -903,12 +928,14 @@
if (null == wrkMastMapper.selectPakin(slave.getId(), steNo)) {
// 璁╁皬杞︾瓑寰呮惉杩愬緟缁�
this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getLocNo());
+ return true;
}
}
}
// 鍫嗗灈鏈烘惉杩愬皬杞�
if (wrkMast.getWrkSts() == 3L) {
this.carMoveIn(wrkMast, wrkMast.getSteNo(), crnProtocol);
+ return true;
}
}
}
@@ -921,7 +948,7 @@
/**
* 鍑哄簱 ===>> 搴撲綅鍒板爢鍨涙満绔�
*/
- public boolean locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
+ public synchronized boolean locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){
for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
// 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
WrkMast wrkMast = wrkMastMapper.selectPakOutStep111215(slave.getId(), crnStn.getStaNo());
@@ -939,6 +966,16 @@
log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
continue;
}
+
+ // 鍒ゆ柇鏄惁鏈夊悓搴撲綅缁勭殑鍑哄簱浠诲姟锛屽鏋滄湁锛屽垯鏆傚仠
+ List<String> outsideLoc = Utils.getGroupOutsideLoc(wrkMast.getSourceLocNo());
+ if (!Cools.isEmpty(outsideLoc)) {
+ if (!Cools.isEmpty(wrkMastMapper.selectWorkingOfPakOutBySource(outsideLoc))) {
+// log.warn("{}宸ヤ綔妗e嚭搴撳け璐ワ紝鍘熷洜锛氬灞傚簱浣峽}姝e湪鎵ц鍑哄簱浠诲姟锛�", wrkMast.getWrkNo(), JSON.toJSONString(outsideLoc));
+ continue;
+ }
+ }
+
// 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId());
StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo());
@@ -1035,8 +1072,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 16.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ } else {
+ return true;
}
- break;
}
} else {
@@ -1070,8 +1108,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 16.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ } else {
+ return true;
}
- return true;
}
// 涓嶆槸鏈�澶栧眰搴撲綅锛岄渶瑕佷娇鐢ㄧ┛姊溅鎼繍鍚庯紝鍐嶅爢鍨涙満鍑哄簱
} else {
@@ -1111,6 +1150,8 @@
wrkMast.setCrnNo(outCrnNo);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 14.灏忚溅鎼嚭搴� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ } else {
+ return true;
}
}
}
@@ -1143,8 +1184,9 @@
wrkMast.setModiTime(now);
if (wrkMastMapper.updateById(wrkMast) == 0) {
log.error("淇敼宸ヤ綔妗g姸鎬� 15.绛夊緟鍚婅溅 => 16.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ } else {
+ return true;
}
- return true;
}
}
@@ -1158,12 +1200,14 @@
if (null == wrkMastMapper.selectPakout(slave.getId(), steNo)) {
// 璁╁皬杞︾瓑寰呮惉杩愬緟缁�
this.letCarBeReady(wrkMast, steThread.getSlave().getId(), wrkMast.getSourceLocNo());
+ return true;
}
}
}
// 鍫嗗灈鏈烘惉杩愬皬杞�
if (wrkMast.getWrkSts() == 12L) {
this.carMoveIn(wrkMast, wrkMast.getSteNo(), crnProtocol);
+ return true;
}
}
}
@@ -1620,7 +1664,6 @@
/**
* 鎵ц瀵瑰伐浣滄。鐨勫畬鎴愭搷浣�
*/
- @Async
@Transactional
public void storeFinished() {
for (CrnSlave crn : slaveProperties.getCrn()) {
@@ -2286,7 +2329,6 @@
/**
* 绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�
*/
- @Async
public void storeEmptyPlt(){
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻绌烘澘鍏ュ簱鍙�
@@ -2331,7 +2373,7 @@
param.setBarcode(barcode);
}
param.setSourceStaNo(emptyInSta.getStaNo());
- param.setLocType1(locTypeDto.getLocType1());
+// param.setLocType1(locTypeDto.getLocType1());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/loc/v1")
@@ -2375,7 +2417,6 @@
/**
* 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
*/
- @Async
public void ledExecute() {
for (LedSlave led : slaveProperties.getLed()) {
// 鑾峰彇杈撻�佺嚎plc绾跨▼
@@ -2476,7 +2517,6 @@
/**
* 鍏朵粬 ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅
*/
- @Async
public void ledReset() {
for (LedSlave led : slaveProperties.getLed()) {
// 鑾峰彇杈撻�佺嚎plc绾跨▼
@@ -2593,6 +2633,40 @@
continue;
}
+ // 灏忚溅澶勪簬閫氶亾
+ List<String> channel = slaveProperties.getChannel();
+ for (String channelLocNo : channel) {
+ if (steProtocol.getRow().intValue() == Utils.getRow(channelLocNo)
+ && steProtocol.getBay().intValue() == Utils.getBay(channelLocNo)
+ && steProtocol.getLev().intValue() == Utils.getLev(channelLocNo)) {
+ Integer otherSte = existOtherSte(channelLocNo, wrkCharge.getSteNo());
+ if (null != otherSte) {
+ log.warn("{}鍙峰皬杞﹀厖鐢甸樆鏂紝鍘熷洜锛氶�氶亾瀛樺湪{}鍙风┛姊溅锛�", wrkCharge.getSteNo(), otherSte);
+ } else {
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ SteCommand steCommand = new SteCommand();
+ steCommand.setSteNo(wrkCharge.getSteNo()); // 绌挎杞︾紪鍙�
+ steCommand.setTaskNo(wrkCharge.getWrkNo()); // 宸ヤ綔鍙�
+ steCommand.setTaskMode(SteTaskModeType.GO_ORIGIN); // 鍘诲彸绔�
+
+ steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue(), false).shortValue());
+ steCommand.setBay(steProtocol.getBay());
+ steCommand.setLev(steProtocol.getLev());
+ if (!MessageQueue.offer(SlaveType.Ste, wrkCharge.getSteNo(), new Task(2, steCommand))) {
+ log.error("绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", wrkCharge.getSteNo(), JSON.toJSON(steCommand));
+ } else {
+ // 淇敼宸ヤ綔妗g姸鎬� 21.鍑嗗鍏呯數 ===> 25.灏忚溅璧拌
+ wrkCharge.setWrkSts(25L);
+ Date now = new Date();
+ wrkCharge.setModiTime(now);
+ if (!wrkChargeService.updateById(wrkCharge)) {
+ log.error("淇敼鍏呯數浠诲姟鐘舵�� 21.鍑嗗鍏呯數 ===> 25.灏忚溅璧拌 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkCharge.getWrkNo());
+ }
+ }
+ }
+ }
+ }
+
// 澶勪簬鍏呯數搴撲綅缁�
if (steProtocol.getRow().intValue() == Utils.getRow(chargeLocNo)
&& steProtocol.getBay().intValue() == Utils.getBay(chargeLocNo)
@@ -2651,6 +2725,11 @@
// 22.灏忚溅寰呮惉
if (wrkCharge.getWrkSts() == 22) {
+
+ // 鍏ュ嚭搴撲换鍔′紭鍏�
+ if (null != wrkMastMapper.selectWorkingByCrn(wrkCharge.getCrnNo())) {
+ return;
+ }
// 鎼皬杞﹁嚦灏忚溅璧板悜閫氶亾
List<String> channel = slaveProperties.getChannel();
@@ -2727,6 +2806,11 @@
} else if (wrkCharge.getWrkSts() == 26) {
// 鍥哄畾鍫嗗灈鏈�
int crnNo = 1;
+ // 鍏ュ嚭搴撲换鍔′紭鍏�
+ if (null != wrkMastMapper.selectWorkingByCrn(crnNo)) {
+ return;
+ }
+
// 鍏呯數浣�
LocMast chargeLoc = locMastService.selectById(wrkCharge.getLocNo());
@@ -2882,6 +2966,10 @@
} else {
// 鍥哄畾鍫嗗灈鏈�
int crnNo = 1;
+ if (null != wrkMastMapper.selectWorkingByCrn(crnNo)) {
+ return;
+ }
+
LocMast channelLoc = locMastService.selectById(channelLocNo);
CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crnNo);
@@ -2946,6 +3034,10 @@
}
}
} else if (wrkCharge.getWrkSts() == 45L) {
+ if (null != wrkMastMapper.selectWorkingByCrn(wrkCharge.getCrnNo())) {
+ return;
+ }
+
LocMast idleLoc = locMastService.selectById(basSte.getIdleLoc());
Integer otherSte = existOtherSte(idleLoc.getLocNo(), wrkCharge.getSteNo());
--
Gitblit v1.9.1