From 4cec3f902ac1fac2d599a37dc401594e4e932cf8 Mon Sep 17 00:00:00 2001
From: L <L@132>
Date: 星期五, 18 七月 2025 18:25:14 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 1617 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 1,352 insertions(+), 265 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 e06f2a1..39702ae 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -3,9 +3,9 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
+import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.*;
@@ -21,7 +21,6 @@
import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.RedisUtil;
-import com.zy.common.utils.RgvUtils;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
@@ -74,8 +73,6 @@
@Autowired
private LocMastService locMastService;
@Autowired
- private StaDescService staDescService;
- @Autowired
private BasCrnpService basCrnpService;
@Autowired
private BasRgvService basRgvService;
@@ -94,16 +91,17 @@
@Autowired
private BasRgvPathService basRgvPathService;
@Autowired
- private RedisUtil redisUtil;
- @Autowired
private WrkMastStaMapper wrkMastStaMapper;
@Autowired
- private BasRgvMapMapper basRgvMapMapper;
- @Autowired
private RgvOneSignMapper rgvOneSignMapper;
+ @Autowired
+ private BasRgvMapService basRgvMapService;
@Value("${wms.url}")
private String wmsUrl;
+
+ @Value("${wms.rgvOpen}")
+ private boolean rgvOpen;
/**
* 缁勬墭
@@ -427,9 +425,10 @@
// // 鍏ュ嚭搴撴ā寮忓垽鏂�
// if (devpThread.ioMode != IoModeType.PAKIN_MODE) { continue; }
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()) {
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk() && staProtocol.getWorkNo()!=0) {
// WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
- WrkMast wrkMast = wrkMastMapper.selectPakInStep5(staProtocol.getSiteId(),"7");
+// WrkMast wrkMast = wrkMastMapper.selectPakInStep5(staProtocol.getSiteId(),"7");
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo());
if (wrkMast == null) {
// 鏃犳嫞鏂欐暟鎹�
continue;
@@ -482,7 +481,7 @@
staProtocol.setStaNo(dto.getStaNo());
devpThread.setPakMk(staProtocol.getSiteId(), false);
// ledThread.errorReset();
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(5, staProtocol));
if (!result) {
log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
}
@@ -530,14 +529,14 @@
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()==0 && !staProtocol.isOutEnable() && staProtocol.isInEnable()) {
- WrkMast wrkMast = wrkMastMapper.selectPakInStep4(staProtocol.getSiteId(),"3");
-
- if (wrkMast == null) {
- continue;
- }
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()!=0) {//&& staProtocol.isInEnable()
if (staProtocol.isEmptyMk()){
log.error("绔欑偣鍙�"+staProtocol.getSiteId()+"绌烘澘淇″彿寮傚父锛�");
+ continue;
+ }
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo());
+
+ if (wrkMast == null || !wrkMast.getSheetNo().equals("3")) {
continue;
}
if ((wrkMast.getIoType() != 103 && wrkMast.getIoType() != 104 && wrkMast.getIoType() != 107)
@@ -573,12 +572,12 @@
.doPost();
} catch(Exception e){
log.error("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
- log.error("stnToCrnStnPick2===>>鐩樼偣鏌ュ簱浣嶅叆搴撴帴鍙eけ璐�", e);
- e.printStackTrace();
+// log.error("stnToCrnStnPick2===>>鐩樼偣鏌ュ簱浣嶅叆搴撴帴鍙eけ璐�", e);
+// e.printStackTrace();
continue;
}
- log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
- log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
+// log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+// log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
if(response.equals("")) {
continue;
}
@@ -586,35 +585,35 @@
// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, pickSta.getLed());
Integer code = jsonObject.getInteger("code");
if (code == 200) {
- StartupDto dto = jsonObject.getObject("data", StartupDto.class);
- if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getStaNo())) {
- log.error("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶅け璐�===>>" + jsonObject.toJSONString());
- } else {
+// StartupDto dto = jsonObject.getObject("data", StartupDto.class);
+// if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getStaNo())) {
+// log.error("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶅け璐�===>>" + jsonObject.toJSONString());
+// } else {
log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣鍐嶅叆搴撴煡璇㈠簱浣嶆垚鍔�===>>" + jsonObject.toJSONString());
- try {
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo());
- staProtocol.setStaNo(dto.getStaNo());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
-// ledThread.errorReset();
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
- log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣/鎷f枡鍐嶅叆搴撲换鍔′笅鍙戞垚鍔�===>>" + staProtocol);
- } catch (Exception e) {
- log.error("鐩樼偣鍐嶅叆搴撳け璐�===>>" + e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- }
- }
+// try {
+// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+// staProtocol.setWorkNo(wrkMast.getWrkNo());
+// staProtocol.setStaNo(dto.getStaNo());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+//// ledThread.errorReset();
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// if (!result) {
+// log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+// }
+// log.info("浠诲姟鍙�"+wrkMast.getWrkNo()+"鐩樼偣/鎷f枡鍐嶅叆搴撲换鍔′笅鍙戞垚鍔�===>>" + staProtocol);
+// } catch (Exception e) {
+// log.error("鐩樼偣鍐嶅叆搴撳け璐�===>>" + e);
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+// }
+// }
} else {
log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin2/loc/v1", JSON.toJSONString(param), response);
}
} catch (Exception e) {
log.error("stnToCrnStnPick2===>>fail", e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
// // 鑾峰彇鐩爣绔�
@@ -863,9 +862,25 @@
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()==0 && !staProtocol.isOutEnable() && staProtocol.isInEnable()) {
- WrkMast wrkMast = wrkMastMapper.selectPakInStep4(staProtocol.getSiteId(),"3");
- if (wrkMast == null) {
+// if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()==0) {
+// WrkMast wrkMast = wrkMastMapper.selectPakInStep4(staProtocol.getSiteId(),"3");
+// if (wrkMast == null) {
+// WrkMast wrkMast1 = wrkMastMapper.selectPakInStep5(staProtocol.getSiteId(),"3");
+// if (Cools.isEmpty(wrkMast1) && staProtocol.isEmptyMk()){
+// WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(staProtocol.getSiteId() + 19999L);
+// if (Cools.isEmpty(wrkMastSta)){
+// WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),staProtocol.getSiteId());
+// wrkMastSta1.setType(2);
+// wrkMastSta1.setWrkType(1);
+// wrkMastStaMapper.insert(wrkMastSta1);
+// }
+// }
+// }
+// } else
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isEmptyMk() && staProtocol.isPakMk() && staProtocol.getWorkNo()>0) {
+// WrkMast wrkMast = wrkMastMapper.selectPakInStep4(staProtocol.getSiteId(),"3");
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo());
+ if (wrkMast == null || (wrkMast.getSheetNo().equals("3") && wrkMast.getIoType()==101)) {
WrkMast wrkMast1 = wrkMastMapper.selectPakInStep5(staProtocol.getSiteId(),"3");
if (Cools.isEmpty(wrkMast1) && staProtocol.isEmptyMk()){
WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(staProtocol.getSiteId() + 19999L);
@@ -1196,11 +1211,16 @@
} else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
// 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
- wrkMast.setUpdMk("Y");
- wrkMast.setIoPri(14D);
- wrkMastMapper.updateById(wrkMast);
- // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
- moveLocForDeepLoc(slave, shallowLoc);
+// wrkMast.setUpdMk("Y");
+// wrkMast.setIoPri(14D);
+// wrkMastMapper.updateById(wrkMast);
+// // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+// moveLocForDeepLoc(slave, shallowLoc);
+ if (moveLocForDeepLoc(slave, shallowLoc)){
+ wrkMast.setUpdMk("Y");
+ wrkMast.setIoPri(14D);
+ wrkMastMapper.updateById(wrkMast);
+ }
// 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
// moveLocForDeepLocPakin(slave, shallowLoc, wrkMast);
}
@@ -1290,7 +1310,11 @@
log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+// if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
+// && staDetl.getCanining() != null && staDetl.getCanining().equals("Y") && staDetl.getWrkNo().equals(wrkMast.getWrkNo())) {
+// flag = true;
+// }
+ if (staProtocol.isAutoing() && staProtocol.getWorkNo() > 0
&& staDetl.getCanining() != null && staDetl.getCanining().equals("Y") && staDetl.getWrkNo().equals(wrkMast.getWrkNo())) {
flag = true;
}
@@ -1340,11 +1364,17 @@
} else if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) {
// 姝ゆ爣璁伴伩鍏嶅娆℃墽琛岀Щ搴撲换鍔�
if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) {
- wrkMast.setUpdMk("Y");
- wrkMast.setIoPri(14D);
- wrkMastMapper.updateById(wrkMast);
- // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
- moveLocForDeepLoc(slave, shallowLoc);
+// wrkMast.setUpdMk("Y");
+// wrkMast.setIoPri(14D);
+// wrkMastMapper.updateById(wrkMast);
+// // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+// moveLocForDeepLoc(slave, shallowLoc);
+
+ if (moveLocForDeepLoc(slave, shallowLoc)){
+ wrkMast.setUpdMk("Y");
+ wrkMast.setIoPri(14D);
+ wrkMastMapper.updateById(wrkMast);
+ }
// 鐢熸垚宸ヤ綔妗c�佹敼鍙樻祬搴撲綅鐨勬簮搴�/鐩爣搴� 搴撲綅鐘舵�併�佷笅鍙戝爢鍨涙満鍛戒护锛堢珛椹墽琛�)
// moveLocForDeepLocPakin(slave, shallowLoc, wrkMast);
}
@@ -1472,10 +1502,16 @@
// if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
// || Cools.isEmpty(waitWrkMast)) {
if (Cools.isEmpty(waitWrkMast)) {
- wrkMast.setUpdMk("Y");
- wrkMastMapper.updateById(wrkMast);
- // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
- moveLocForDeepLoc(slave, shallowLoc);
+// wrkMast.setUpdMk("Y");
+// wrkMastMapper.updateById(wrkMast);
+// // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+// moveLocForDeepLoc(slave, shallowLoc);
+
+ if (moveLocForDeepLoc(slave, shallowLoc)){
+ wrkMast.setUpdMk("Y");
+// wrkMast.setIoPri(14D);
+ wrkMastMapper.updateById(wrkMast);
+ }
}
log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
continue;
@@ -1529,7 +1565,15 @@
*/
public synchronized void locToCrnStn1(CrnSlave slave, CrnProtocol crnProtocol) {
List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep12(slave.getId());
+ Double pri = 0.0;
for (WrkMast wrkMast : wrkMasts) {
+ if (wrkMast.getIoType() != 110){
+ if (wrkMast.getIoPri()>=pri){
+ pri = wrkMast.getIoPri();
+ } else {
+ continue;
+ }
+ }
if (wrkMast == null) {
continue;
}
@@ -1552,7 +1596,7 @@
}
//閫�搴撴ā寮忚烦杩�118銆�119鍑哄簱浠诲姟
if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){
- RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign();
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
continue;
}
@@ -1608,7 +1652,11 @@
log.error("{}搴撲綅寮傚父锛屾湭妫�绱㈠埌鐩稿簲宸ヤ綔妗o紒", shallowLocNo);
} else {
if (waitWrkMast.getWrkSts() == 11) {
- waitWrkMast.setIoPri(15D);
+ if (waitWrkMast.getIoPri() + 100000D < 99999999) {
+ waitWrkMast.setIoPri(waitWrkMast.getIoPri()+100000D);
+ } else {
+ waitWrkMast.setIoPri(99999999D);
+ }
waitWrkMast.setModiTime(new Date());
if (wrkMastMapper.updateById(waitWrkMast) == 0) {
log.error("璋冩暣宸ヤ綔妗d紭鍏堢骇澶辫触锛佸伐浣滃彿={}", waitWrkMast.getWrkNo());
@@ -1626,10 +1674,16 @@
// if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())
// || Cools.isEmpty(waitWrkMast)) {
if (Cools.isEmpty(waitWrkMast)) {
- wrkMast.setUpdMk("Y");
- wrkMastMapper.updateById(wrkMast);
- // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
- moveLocForDeepLoc(slave, shallowLoc);
+// wrkMast.setUpdMk("Y");
+// wrkMastMapper.updateById(wrkMast);
+// // 鐢熸垚宸ヤ綔妗�,灏嗘祬搴撲綅绉昏浆鍒版柊鐨勫簱浣嶄腑
+// moveLocForDeepLoc(slave, shallowLoc);
+
+ if (moveLocForDeepLoc(slave, shallowLoc)){
+ wrkMast.setUpdMk("Y");
+// wrkMast.setIoPri(14D);
+ wrkMastMapper.updateById(wrkMast);
+ }
}
log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{}", wrkMast.getWrkNo(), shallowLocNo);
continue;
@@ -1638,6 +1692,9 @@
if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
continue;
}
+ } else if (!shallowLoc.getLocSts().equals("O") ){
+ log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{},娴呭簱浣嶇姸鎬�:{}", wrkMast.getWrkNo(), shallowLocNo,shallowLoc.getLocSts());
+ continue;
}
}
@@ -2282,7 +2339,7 @@
*/
public synchronized void storeEmptyPlt3() {
try{
- RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign();
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
return;
}
@@ -2303,7 +2360,10 @@
&& rgvProtocol.getModeType() == RgvModeType.AUTO
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
// && (rgvProtocol.getLoaded2()==2 || rgvProtocol.getLoaded2()==3 ) ////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
&& rgvProtocol.getLoaded2()==3 ////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
@@ -2318,6 +2378,7 @@
param.setIoType(10);
param.setSourceStaNo(122);
param.setLocType1((short)1);
+ param.setRgvNo(rgvProtocol.getRgvNo());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/empty/loc/v1")
@@ -2363,7 +2424,8 @@
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId());
// 鍛戒护闆嗗悎
List<LedCommand> commands = new ArrayList<>();
- // 宸ヤ綔妗i泦鍚�
+ String orderNo = null;
+ // 宸ヤ綔妗i泦鍚�
List<WrkMast> wrkMasts = new ArrayList<>();
for (Integer staNo : led.getStaArr()) {
// 鑾峰彇鍙夎溅绔欑偣
@@ -2423,7 +2485,15 @@
// ledCommand.setSourceStaNo(wrkMast.getSourceStaNo());
if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
- wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl)));
+ if (Cools.isEmpty(wrkDetls)){
+ continue;
+ }
+// Integer count1 = wrkDetlService.count1();
+ Integer count111 = wrkDetlService.count111();
+// Integer count11 = wrkDetlService.count11();
+ Integer count2 = wrkDetlService.count2(wrkDetls.get(0).getOrderNo());
+ Integer count3 = wrkDetlService.count3();
+ wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl,count111,count2,count3)));
}
commands.add(ledCommand);
}
@@ -2491,7 +2561,7 @@
if (staProtocol == null) {
continue;
}
- if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) {
+ if (staProtocol.getWorkNo() != 0 || staProtocol.isLoading()) {
reset = false;
break;
}
@@ -2500,21 +2570,21 @@
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 {
-
- }
- } else {
+// 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 {
}
- }
+// }
}
}
}
@@ -2599,7 +2669,7 @@
* 鍥犲弻娣卞簱浣嶉樆濉烇紝瀵规祬搴撲綅杩涜绉昏浆锛堢珛鍗虫墽琛岀増)
* tip锛氬悓姝�
*/
- private synchronized void moveLocForDeepLoc(CrnSlave crn, LocMast shallowLoc) {
+ private synchronized boolean moveLocForDeepLoc(CrnSlave crn, LocMast shallowLoc) {
try {
List<Integer> rows = locMastService.queryDistinctRow(crn.getId());
LocMast loc = null;
@@ -2643,74 +2713,90 @@
if (null == loc) {
log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
- throw new CoolException("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
- }
-
- // 鑾峰彇宸ヤ綔鍙�
- int workNo = commonService.getWorkNo(0);
- // 淇濆瓨宸ヤ綔妗�
- WrkMast wrkMast = new WrkMast();
- wrkMast.setWrkNo(workNo);
- wrkMast.setIoTime(new Date());
- wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
- wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
- wrkMast.setIoPri(13D);
- wrkMast.setCrnNo(crn.getId());
- wrkMast.setSourceLocNo(shallowLoc.getLocNo()); // 婧愬簱浣�
- wrkMast.setLocNo(loc.getLocNo()); // 鐩爣搴撲綅
- wrkMast.setFullPlt(shallowLoc.getFullPlt()); // 婊℃澘
- wrkMast.setPicking("N"); // 鎷f枡
- wrkMast.setExitMk("N"); // 閫�鍑�
- wrkMast.setEmptyMk(shallowLoc.getLocSts().equals("D") ? "Y" : "N"); // 绌烘澘
- wrkMast.setBarcode(shallowLoc.getBarcode()); // 鎵樼洏鐮�
- wrkMast.setLinkMis("N");
- wrkMast.setAppeTime(new Date());
- wrkMast.setModiTime(new Date());
- int res = wrkMastMapper.insert(wrkMast);
- if (res == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
- }
- // 宸ヤ綔妗f槑缁嗕繚瀛�
- if (shallowLoc.getLocSts().equals("F")) {
- List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", shallowLoc.getLocNo()));
- for (LocDetl locDetl : locDetls) {
- WrkDetl wrkDetl = new WrkDetl();
- wrkDetl.setWrkNo(workNo);
- wrkDetl.setIoTime(new Date());
- wrkDetl.setAnfme(locDetl.getAnfme());
- VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗
- wrkDetl.setAppeTime(new Date());
- wrkDetl.setModiTime(new Date());
- if (!wrkDetlService.insert(wrkDetl)) {
- throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ return false;
+// throw new CoolException("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 寰呯Щ杞祬搴撲綅锛�" + shallowLoc.getLocNo());
+ } else {
+ // 鑾峰彇宸ヤ綔鍙�
+ int workNo = commonService.getWorkNo(0);
+ // 淇濆瓨宸ヤ綔妗�
+ WrkMast wrkMast = new WrkMast();
+ wrkMast.setWrkNo(workNo);
+ wrkMast.setIoTime(new Date());
+ wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+ wrkMast.setIoType(11); // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
+ wrkMast.setIoPri(13D);
+ wrkMast.setCrnNo(crn.getId());
+ wrkMast.setSourceLocNo(shallowLoc.getLocNo()); // 婧愬簱浣�
+ wrkMast.setLocNo(loc.getLocNo()); // 鐩爣搴撲綅
+ wrkMast.setFullPlt(shallowLoc.getFullPlt()); // 婊℃澘
+ wrkMast.setPicking("N"); // 鎷f枡
+ wrkMast.setExitMk("N"); // 閫�鍑�
+ wrkMast.setEmptyMk(shallowLoc.getLocSts().equals("D") ? "Y" : "N"); // 绌烘澘
+ wrkMast.setBarcode(shallowLoc.getBarcode()); // 鎵樼洏鐮�
+ wrkMast.setLinkMis("N");
+ wrkMast.setAppeTime(new Date());
+ wrkMast.setModiTime(new Date());
+ int res = wrkMastMapper.insert(wrkMast);
+ if (res == 0) {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>淇濆瓨宸ヤ綔妗eけ璐�");
+ return true;
+// throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+ }
+ // 宸ヤ綔妗f槑缁嗕繚瀛�
+ if (shallowLoc.getLocSts().equals("F")) {
+ List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", shallowLoc.getLocNo()));
+ for (LocDetl locDetl : locDetls) {
+ WrkDetl wrkDetl = new WrkDetl();
+ wrkDetl.setWrkNo(workNo);
+ wrkDetl.setIoTime(new Date());
+ wrkDetl.setAnfme(locDetl.getAnfme());
+ VersionUtils.setWrkDetl(wrkDetl, locDetl); // 鐗堟湰鎺у埗
+ wrkDetl.setAppeTime(new Date());
+ wrkDetl.setModiTime(new Date());
+ if (!wrkDetlService.insert(wrkDetl)) {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ return true;
+// throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+ }
}
}
- }
- // 淇敼婧愬簱浣嶇姸鎬�
- if (shallowLoc.getLocSts().equals("D") || shallowLoc.getLocSts().equals("F")) {
- shallowLoc.setLocSts("R"); // R.鍑哄簱棰勭害
- shallowLoc.setModiTime(new Date());
- if (!locMastService.updateById(shallowLoc)) {
- throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
+ // 淇敼婧愬簱浣嶇姸鎬�
+ if (shallowLoc.getLocSts().equals("D") || shallowLoc.getLocSts().equals("F")) {
+ shallowLoc.setLocSts("R"); // R.鍑哄簱棰勭害
+ shallowLoc.setModiTime(new Date());
+ if (!locMastService.updateById(shallowLoc)) {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
+ return true;
+// throw new CoolException("鏇存柊婧愬簱浣嶇姸鎬佸け璐�");
+ }
+ } else {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>婧愬簱浣嶅嚭搴撳け璐�");
+ return true;
+// throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�");
}
- } else {
- throw new CoolException("婧愬簱浣嶅嚭搴撳け璐�");
- }
- // 淇敼鐩爣搴撲綅鐘舵��
- if (loc.getLocSts().equals("O")) {
- loc.setLocSts("S"); // S.鍏ュ簱棰勭害
- loc.setModiTime(new Date());
- if (!locMastService.updateById(loc)) {
- throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+ // 淇敼鐩爣搴撲綅鐘舵��
+ if (loc.getLocSts().equals("O")) {
+ loc.setLocSts("S"); // S.鍏ュ簱棰勭害
+ loc.setModiTime(new Date());
+ if (!locMastService.updateById(loc)) {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+ return true;
+// throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+ }
+ } else {
+ log.error("鍙屾繁搴撲綅 --- 娴呭簱浣嶉樆濉炲紓甯革紒 ====>绉昏浆澶辫触");
+ return true;
+// throw new CoolException("绉昏浆澶辫触");
}
- } else {
- throw new CoolException("绉昏浆澶辫触");
}
+
} catch (Exception e) {
log.error("鍙屾繁搴撲綅闃诲锛屽娴呭簱浣嶈繘琛岀Щ杞け璐�", e);
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return true;
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
+ return true;
}
// /**
@@ -3082,9 +3168,9 @@
if (Cools.isEmpty(basDevp) || basDevp.getReportSign()!=1){
continue;
}
- if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){
- continue;
- }
+// if (basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)){
+// continue;
+// }
WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne202(staNo);
if (Cools.isEmpty(wrkMast)){
continue;
@@ -3103,35 +3189,36 @@
// if (inSta.getStaNo() == 203 && devpThread.ioModeOf2F == IoModeType.PAKOUT_MODE) {
// continue;
// }
-
+ if (staProtocol.isEmptyMk()){
+ log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo);
+ continue;
+ }
if (!staProtocol.isLoading()){
log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo);
continue;
}
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
- if (staProtocol.isAutoing()
- && staProtocol.isLoading()
- && staProtocol.isInEnable()
- && (staProtocol.getWorkNo() == 0 || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000))
- ) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
-
+ if (staProtocol.isAutoing() && staProtocol.getWorkNo() == 0) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
+// && staProtocol.isInEnable()
//浠诲姟瀹屾垚
- boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
- Thread.sleep(100);
-
- staProtocol.setWorkNo(wrkMast.getWrkNo());
- staProtocol.setStaNo(144);
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol));
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
+// Thread.sleep(100);
+ StaProtocol staProtocolnew = new StaProtocol();
+ staProtocolnew.setSiteId(staProtocol.getSiteId());
+ staProtocolnew.setWorkNo(wrkMast.getWrkNo());
+ staProtocolnew.setStaNo(144);
+ devpThread.setPakMk(staProtocolnew.getSiteId(), false);
+ devpThread.setReportSign(staProtocolnew.getSiteId(), true);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
}
wrkMast.setWrkSts(52L);
wrkMastMapper.updateById(wrkMast);
- Thread.sleep(100);
+// Thread.sleep(100);
//浠诲姟瀹屾垚
- boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
+// boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
}
}
@@ -3143,7 +3230,7 @@
}
/**
- * 鍏朵粬 ===>> 鐮佸灈瀹屾垚椹卞姩鎵樼洏杩涘叆涓嬩竴姝�
+ * 鍏朵粬 ===>> 鐮佸灈瀹屾垚椹卞姩鎵樼洏杩涘叆涓嬩竴姝� 2===銆�3
*/
public synchronized void stackingCompletionDriveTrayOk2() {
for (DevpSlave devp : slaveProperties.getDevp()) {
@@ -3159,7 +3246,7 @@
staProtocol = staProtocol.clone();
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()!=0 && staProtocol.isOutEnable()) {//
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isPakMk() && staProtocol.getWorkNo()!=0) {//
WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo());
if (wrkMast == null) {
@@ -3172,7 +3259,7 @@
}
if (wrkMast.getIoType()==101){
//浠诲姟瀹屾垚
- boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
wrkMast.setSheetNo("3");
wrkMastMapper.updateById(wrkMast);
}else {
@@ -3181,17 +3268,17 @@
continue;
}
//浠诲姟瀹屾垚
- boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol));
wrkMast.setSheetNo("3");
wrkMastMapper.updateById(wrkMast);
- try{
- Thread.sleep(100);
- }catch (Exception e){
+// try{
+// Thread.sleep(100);
+// }catch (Exception e){
+//
+// }
- }
-
- boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
+// boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol));
}
}
@@ -3338,10 +3425,18 @@
for (int staNo : staNos){
BasDevp basDevp = basDevpService.selectById(staNo);
BasDevp basDevp135 = basDevpService.selectById(135);
- if (basDevp.getWrkNo()==0 || (basDevp.getWrkNo()<10000 && basDevp.getWrkNo()>9899) ){
+ if (basDevp.getWrkNo()==0){
continue;
}
if (basDevp135.getReportSign()!=0){
+ continue;
+ }
+ BasDevp basDevp121 = basDevpService.selectById(121);
+ if (basDevp121.getReportSign()!=0){
+ continue;
+ }
+ BasDevp basDevp120 = basDevpService.selectById(120);
+ if (basDevp120.getReportSign()!=0){
continue;
}
WrkMast wrkMast131 = wrkMastMapper.selectWrkMastUnstackingOne202Two(131);
@@ -3356,8 +3451,8 @@
} else {
staProtocol135 = staProtocol135.clone();
}
- if (staProtocol135.getWorkNo()<9900 || staProtocol135.getWorkNo()>9999 || staProtocol135.getWorkNo()==0
- || !staProtocol135.isLoading() || !staProtocol135.isAutoing()){
+ if ( staProtocol135.getWorkNo()!=0
+ || !staProtocol135.isLoading() || !staProtocol135.isAutoing() || !staProtocol135.isEmptyMk()){
continue;
}
StaProtocol staProtocol = devpThread.getStation().get(staNo);
@@ -3368,6 +3463,26 @@
}
if (!staProtocol.isLoading()){
+ continue;
+ }
+ StaProtocol staProtocol120 = devpThread.getStation().get(120);
+ if (staProtocol120 == null) {
+ continue;
+ } else {
+ staProtocol120 = staProtocol120.clone();
+ }
+
+ if (staProtocol120.isLoading()){
+ continue;
+ }
+ StaProtocol staProtocol121 = devpThread.getStation().get(121);
+ if (staProtocol121 == null) {
+ continue;
+ } else {
+ staProtocol121 = staProtocol121.clone();
+ }
+
+ if (staProtocol121.isLoading()){
continue;
}
// if (!staProtocol.getWorkNo().equals(wrkMast131.getWrkNo())){
@@ -3383,21 +3498,25 @@
// }
//浠诲姟瀹屾垚
- boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135));
- try{
- Thread.sleep(100);
- }catch (Exception e){ }
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(3, staProtocol135));
+// try{
+// Thread.sleep(100);
+// }catch (Exception e){ }
basDevp135.setReportSign(2);
basDevpService.updateById(basDevp135);
int workNo = commonService.getWorkNo(5);
- staProtocol135.setWorkNo(workNo);
- staProtocol135.setStaNo(144);
- devpThread.setPakMk(staProtocol135.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol135));
+
+ StaProtocol staProtocolnew = new StaProtocol();
+ staProtocolnew.setSiteId(staProtocol135.getSiteId());
+ staProtocolnew.setWorkNo(workNo);
+ staProtocolnew.setStaNo(144);
+
+ devpThread.setPakMk(staProtocolnew.getSiteId(), false);
+ boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocolnew));
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
}
- boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135));
+// boolean result2 = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(4, staProtocol135));
}
}
@@ -3438,17 +3557,47 @@
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
}
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
break;
}
WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(rgvProtocol.getTaskNo1().longValue());
- if (Cools.isEmpty(wrkMastSta) || wrkMastSta.getType()!=1 || wrkMastSta.getWrkSts()!=1){
+ if (Cools.isEmpty(wrkMastSta) || wrkMastSta.getType()!=1){
log.error("鏈煡鍒板皬杞︽墽琛屼换鍔℃垨鑰呮墽琛屼换鍔$姸鎬佷笉绗﹀悎锛�"+wrkMastSta);
continue;
}
- WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
+ if (wrkMastSta.getWrkSts()!=1){
+ if (wrkMastSta.getWrkType()==3 && wrkMastSta.getWrkSts()==2 && rgvProtocol.getLoaded1()==1){
+// boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo(),rgvProtocol.getTaskNo1());
+// if (!rgvComplete){
+// log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
+// break;
+// }
+ rgvAvoidanceXYWrkMast(rgvProtocol.getRgvNo(),wrkMastSta.getWrkNo().shortValue());
+ continue;
+ }
+ if (wrkMastSta.getWrkType()==6){
+ boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+ wrkMastSta.setWrkSts(3);
+ wrkMastStaMapper.updateById(wrkMastSta);
+ continue;
+ }
+ continue;
+ }
+ if (wrkMastSta.getWrkType()==5){
+ boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo(),rgvProtocol.getTaskNo1());
+ wrkMastSta.setWrkSts(3);
+ wrkMastStaMapper.updateById(wrkMastSta);
+ continue;
+ }
+ /* WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
if (!Cools.isEmpty(wrkMast) && wrkMastSta.getWrkType()!=5){
Thread.sleep(200);
SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
@@ -3484,7 +3633,7 @@
// }catch (Exception e){
//
// }
- }
+ }*/
boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
@@ -3492,16 +3641,28 @@
}
wrkMastSta.setWrkSts(3);
wrkMastStaMapper.updateById(wrkMastSta);
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}else if (rgvProtocol.getTaskNo2()!=0 && (rgvProtocol.getStatusType2()==RgvStatusType.WAITING || rgvProtocol.getStatusType2()==RgvStatusType.FETCHWAITING)){
if (rgvProtocol.getTaskNo2()==(short)32222){
- boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+ boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo(),rgvProtocol.getTaskNo1());
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
}
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
break;
@@ -3511,7 +3672,7 @@
log.error("鏈煡鍒板皬杞︽墽琛屼换鍔℃垨鑰呮墽琛屼换鍔$姸鎬佷笉绗﹀悎锛�"+wrkMastSta);
continue;
}
- WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
+ /*WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
if (!Cools.isEmpty(wrkMast) && wrkMastSta.getWrkType()!=5){
Thread.sleep(200);
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
@@ -3542,15 +3703,21 @@
// }catch (Exception e){
//
// }
- }
- boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+ }*/
+ boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo(),rgvProtocol.getTaskNo1());
if (!rgvComplete){
log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
break;
}
wrkMastSta.setWrkSts(3);
wrkMastStaMapper.updateById(wrkMastSta);
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}else {
@@ -3585,22 +3752,33 @@
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
- && rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getLoaded1()==0
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
) {
switch (sign){
//鎵ц灏忚溅璐х墿鎼繍浠诲姟
case 1:
signWork = rgvRunWrkMastFullSta(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPutOrTake(rgvSlave);
+ }
break;
//鎵ц灏忚溅绌烘澘鎼繍浠诲姟
case 2://鏀�//鎷嗙洏
signWork = rgvRunWrkMastEmptyStaPut(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPut(rgvSlave);
+ }
break;
case 3://婊℃斁
signWork = rgvRunWrkMastEmptyStaPutFull(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaTake(rgvSlave);
+ }
break;
case 4://鍙栧彔鐩�
signWork = rgvRunWrkMastEmptyStaTake(rgvSlave);
@@ -3610,6 +3788,7 @@
break;
case 6:////鎻愬崌
// signWork = qwe();
+ signWork = rgvRunWrkMastMove(rgvSlave);
break;
default:
break;
@@ -3618,12 +3797,21 @@
switch (signCount){
case 1://鎵ц灏忚溅璐х墿鎼繍浠诲姟
signWork = rgvRunWrkMastFullSta(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPutOrTake(rgvSlave);
+ }
break;
case 2://鏀�//鎷嗙洏
signWork = rgvRunWrkMastEmptyStaPut(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPut(rgvSlave);
+ }
break;
case 3://婊℃斁
signWork = rgvRunWrkMastEmptyStaPutFull(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaTake(rgvSlave);
+ }
break;
case 4://鍙栧彔鐩�
signWork = rgvRunWrkMastEmptyStaTake(rgvSlave);
@@ -3675,12 +3863,19 @@
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
- && rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
&& rgvProtocol.getModeType() == RgvModeType.AUTO
&& rgvProtocol.getLoaded1()==0
&& rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(basRgv.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -3707,6 +3902,40 @@
}
}
Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || staProtocol.isLoading() || staProtocol.getWorkNo() != 0){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (staProtocol.isLoadingSuper()){
+ continue;
+ }
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!staProtocol.isEmptyMk()){
+ continue;
+ }
+ }
+ BasDevp basDevpS = basDevpService.selectById(wrkMastSta.getStaStart());
+ if (!basDevpS.getAutoing().equals("Y") || !basDevpS.getLoading().equals("Y") || basDevpS.getWrkNo()!=wrkMastSta.getWrkNo().intValue()){
+ continue;
+ }
+ StaProtocol staProtocols = devpThread.getStation().get(basDevpS.getDevNo());
+ if (staProtocols == null) {
+ log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocols.isAutoing() || !staProtocols.isLoading() || staProtocols.getWorkNo() != wrkMastSta.getWrkNo().intValue()){
+ continue;
+ }
+
+
log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
boolean sign = rgvTakeFullAll(basRgvMap.getRgvNo(), wrkMastSta);
@@ -3737,6 +3966,184 @@
return false;
}
/**
+ * 鎵ц灏忚溅鎼繍浠诲姟
+ */
+ public synchronized boolean rgvRunWrkMastFullStaPutOrTake(RgvSlave rgvSlave) {
+ try{
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ return false;
+ }
+ BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
+ if (basRgv == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
+ return false;
+ }
+
+ // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
+ if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+ && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
+ && rgvProtocol.getModeType() == RgvModeType.AUTO
+ && rgvProtocol.getLoaded1()==0
+ && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ ) {
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
+ if (basRgvMap == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
+ return false;
+ }
+ List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
+ basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
+ List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);
+ for (WrkMastSta wrkMastSta : wrkMastStaList){
+ if (wrkMastSta.getType()!=1 || wrkMastSta.getWrkType()!=3){//1:婊$増 3锛氬彇鏀�
+ continue;
+ }
+ BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
+ if (!basDevp.getAutoing().equals("Y")){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (basDevp.getEmptyMk().equals("Y")){
+ continue;
+ }
+ if (basDevp.getLoading().equals("Y") && basDevp.getWrkNo()!=0){
+ Date date = new Date();
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing()){
+ continue;
+ }
+ if (staProtocol.isLoading() && staProtocol.getWorkNo() != 0){
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep3(staProtocol.getWorkNo());
+ if (Cools.isEmpty(wrkMast) || wrkMast.getIoType()!=101 || Cools.isEmpty(wrkMast.getSheetNo()) || wrkMast.getSheetNo().equals("0")){
+ continue;
+ }
+ BasDevp basDevpS = basDevpService.selectById(wrkMastSta.getStaStart());
+ if (!basDevpS.getAutoing().equals("Y") || !basDevpS.getLoading().equals("Y") || basDevpS.getWrkNo()!=wrkMastSta.getWrkNo().intValue()){
+ continue;
+ }
+ StaProtocol staProtocols = devpThread.getStation().get(basDevpS.getDevNo());
+ if (staProtocols == null) {
+ log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocols.isAutoing() || !staProtocols.isLoading() || staProtocols.getWorkNo() != wrkMastSta.getWrkNo().intValue()){
+ continue;
+ }
+
+
+ log.info(date+"鍙栬揣浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
+ log.info(date+"鍙栬揣浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
+ boolean sign = rgvTakeFull(basRgvMap.getRgvNo(), wrkMastSta);
+ if (sign){
+ boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd());
+ if (signMap){
+ wrkMastSta.setWrkSts(2);
+ try{
+ wrkMastStaMapper.updateById(wrkMastSta);
+ }catch (Exception e){
+ log.error("鏇存柊灏忚溅浠诲姟澶辫触");
+ }
+ return true;
+ }else {
+ log.error("3978琛岋紝璐х墿鎼繍鍗曞彇浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+ }
+ }else {
+ log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+ }
+ break;
+ }
+ }
+ }
+ }
+ } else if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+ && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
+ && rgvProtocol.getModeType() == RgvModeType.AUTO
+ && rgvProtocol.getLoaded1()==1
+ && rgvProtocol.getTaskNo1()!=0 && rgvProtocol.getTaskNo2()==0
+ ) {// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏈夌墿 鏈夊伐浣滃彿//rgv鍙敤
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
+ if (basRgvMap == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
+ return false;
+ }
+ basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
+ WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(rgvProtocol.getTaskNo1().longValue());
+ if (Cools.isEmpty(wrkMastSta)){
+ return false;
+ }
+ if (wrkMastSta.getType()!=1 || wrkMastSta.getWrkType()!=3){//1:婊$増 3锛氬彇鏀�
+ return false;
+ }
+ BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
+ if (!basDevp.getAutoing().equals("Y")){
+ return false;
+ }
+ if (!basDevp.getLoading().equals("Y") && basDevp.getWrkNo()==0){
+ Date date = new Date();
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鍙栨斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ return false;
+ }
+ if (!staProtocol.isAutoing()){
+ return false;
+ }
+ if (!staProtocol.isLoading() && staProtocol.getWorkNo() == 0){
+ log.info(date+"鍙栬揣浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
+ log.info(date+"鍙栬揣浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
+ boolean sign = rgvPutFull(basRgvMap.getRgvNo(), wrkMastSta);
+ if (sign){
+ boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd());
+ if (signMap){
+ wrkMastSta.setWrkSts(1);
+ try{
+ wrkMastStaMapper.updateById(wrkMastSta);
+ }catch (Exception e){
+ log.error("鏇存柊灏忚溅浠诲姟澶辫触");
+ }
+ return true;
+ }else {
+ log.error("3978琛岋紝璐х墿鎼繍鍗曞彇浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+ }
+ }else {
+ log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+ }
+ return true;
+ }
+ }
+ }
+// }
+ }catch (Exception e){
+ log.error("3978琛屾墽琛屽皬杞︽惉杩愪换鍔′笅鍙戝け璐�");
+ log.error("3978琛�"+e);
+ }
+ return false;
+ }
+ /**
* 鎵ц灏忚溅鎼繍浠诲姟//鎷嗙洏
*/
public synchronized boolean rgvRunWrkMastEmptyStaPut(RgvSlave rgvSlave) {//鎷嗙洏
@@ -3758,10 +4165,19 @@
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==3 || rgvProtocol.getLoaded2()==1 || rgvProtocol.getLoaded2()==4)////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛堝彧鑳芥媶鍙狅級 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗�() 锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(basRgv.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -3790,6 +4206,27 @@
}
}
Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || staProtocol.isLoading() || staProtocol.getWorkNo() != 0){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (staProtocol.isLoadingSuper()){
+ continue;
+ }
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!staProtocol.isEmptyMk()){
+ continue;
+ }
+ }
+
log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
sign = rgvPutEmpty(rgvProtocol.getRgvNo(),wrkMastSta);//鎷嗙洏
@@ -3822,6 +4259,122 @@
}
return false;
}
+ /**
+ * 鎵ц灏忚溅鎼繍浠诲姟//鎷嗙洏
+ */
+ public synchronized boolean rgvRunWrkMastFullStaPut(RgvSlave rgvSlave) {//鎷嗙洏
+ try{
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ return false;
+ }
+ BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
+ if (basRgv == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
+ return false;
+ }
+
+ // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾湁鐗�//rgv鍙敤//鎷嗙洏
+ if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+ && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
+ && rgvProtocol.getModeType() == RgvModeType.AUTO
+ && rgvProtocol.getLoaded1()==1
+ && rgvProtocol.getTaskNo1()!=0 && rgvProtocol.getTaskNo2()==0
+ ) {
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
+ if (basRgvMap == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
+ return false;
+ }
+ basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
+ List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());//鑾峰彇娲诲姩鑼冨洿
+ List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);//鏌ヨ鍙墽琛屼换鍔�
+ for (WrkMastSta wrkMastSta : wrkMastStaList){
+ if (wrkMastSta.getType()!=1 || wrkMastSta.getWrkType()!=6){// 1:婊℃澘 || 宸ヤ綔绫诲瀷 1:鍙栵紙鍙犵洏锛� 2锛氭媶鐩� 5锛氭弧鍙� 6锛氭弧鏀�
+ continue;
+ }
+ boolean sign = false;
+ if ( wrkMastSta.getStaEnd()!=0){//鏀�
+ BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
+ if (!basDevp.getAutoing().equals("Y") || basDevp.getLoading().equals("Y") || basDevp.getWrkNo()!=0){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (basDevp.getLoadingSuper().equals("Y")){
+ continue;
+ }
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!basDevp.getEmptyMk().equals("Y")){
+ continue;
+ }
+ }
+ Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || staProtocol.isLoading() || staProtocol.getWorkNo() != 0){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (staProtocol.isLoadingSuper()){
+ continue;
+ }
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!staProtocol.isEmptyMk()){
+ continue;
+ }
+ }
+
+ log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
+ log.info(date+"鎷嗙洏浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
+// sign = rgvPutEmpty(rgvProtocol.getRgvNo(),wrkMastSta);//鎷嗙洏
+ sign = rgvPutFull(basRgvMap.getRgvNo(), wrkMastSta);
+
+ }else {
+ continue;
+ }
+ if (sign){
+ boolean signMap = rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), wrkMastSta.getStaEnd());
+ if (signMap){
+ wrkMastSta.setWrkSts(2);
+ try{
+ wrkMastStaMapper.updateById(wrkMastSta);
+ }catch (Exception e){
+ log.error("鏇存柊灏忚溅浠诲姟澶辫触");
+ }
+ return true;
+ }else {
+ log.error("3857琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+ }
+ }else {
+ log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+ }
+ break;
+ }
+ }
+// }
+ }catch (Exception e){
+ log.error("3933琛屾墽琛屽皬杞︽斁绌烘澘浠诲姟涓嬪彂澶辫触");
+ log.error("3933琛�"+e);
+ }
+ return false;
+ }
/**
* 鎵ц灏忚溅鎼繍浠诲姟
@@ -3845,10 +4398,19 @@
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==2 || rgvProtocol.getLoaded2()==3 ) ////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -3877,6 +4439,27 @@
}
}
Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"婊℃斁浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || staProtocol.isLoading() || staProtocol.getWorkNo() != 0){
+ continue;
+ }
+ if (basDevp.getDevNo()>117 && basDevp.getDevNo()<124){
+ if (staProtocol.isLoadingSuper()){
+ continue;
+ }
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!staProtocol.isEmptyMk()){
+ continue;
+ }
+ }
+
log.info(date+"婊℃斁浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
log.info(date+"婊℃斁浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
sign = rgvPutEmptyFull(rgvProtocol.getRgvNo(),wrkMastSta);
@@ -3929,10 +4512,19 @@
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
&& (rgvProtocol.getLoaded2()==0 || rgvProtocol.getLoaded2()==1 ) //鐜板満淇敼锛氬彔鐩樻満锛�////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗╋紙鍙兘鎷嗗彔锛� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -3956,6 +4548,22 @@
}
}
Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
+ continue;
+ }
+ if (basDevp.getDevNo()>=118 && basDevp.getDevNo()<=123){
+ if (!staProtocol.isEmptyMk()){
+ continue;
+ }
+ }
+
log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
sign = rgvTakeEmpty(rgvProtocol.getRgvNo(),wrkMastSta);//鍙犵洏
@@ -3989,6 +4597,99 @@
return false;
}
+ public synchronized boolean rgvRunWrkMastFullStaTake(RgvSlave rgvSlave) {//鍙犵洏
+ try{
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ return false;
+ }
+ BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
+ if (basRgv == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
+ return false;
+ }
+
+ // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾棤鐗�//rgv鍙敤
+ if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+ && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
+ && rgvProtocol.getModeType() == RgvModeType.AUTO
+ && rgvProtocol.getLoaded1() == 0
+ && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ ) {
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
+ if (basRgvMap == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
+ return false;
+ }
+ List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
+ basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
+ List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);
+ for (WrkMastSta wrkMastSta : wrkMastStaList){
+ if (wrkMastSta.getType()!=1 || wrkMastSta.getWrkType()!=5){// 1:婊℃澘 || 宸ヤ綔绫诲瀷 1:鍙栵紙鍙犵洏锛� 2锛氭媶鐩� 5锛氭弧鍙� 6锛氭弧鏀�
+ continue;
+ }
+ boolean sign = false;
+ if ( wrkMastSta.getStaStart()!=0){//鍙�
+ BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaStart());
+ if (!basDevp.getAutoing().equals("Y") || !basDevp.getLoading().equals("Y")){
+ continue;
+ }
+ Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
+ continue;
+ }
+
+ log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
+ log.info(date+"鍙犵洏浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
+// sign = rgvTakeEmpty(rgvProtocol.getRgvNo(),wrkMastSta);//鍙犵洏
+ sign = rgvTakeFull(rgvProtocol.getRgvNo(),wrkMastSta);//鍙犵洏
+ }else {
+ continue;
+ }
+ if (sign){
+ boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), basRgvMap.getStartRoute());
+ if (signMap){
+ wrkMastSta.setWrkSts(1);
+ try{
+ wrkMastStaMapper.updateById(wrkMastSta);
+ }catch (Exception e){
+ log.error("鏇存柊灏忚溅浠诲姟澶辫触");
+ }
+ return true;
+ }else {
+ log.error("3879琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+ }
+ }else {
+ log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+ }
+ break;
+ }
+ }
+// }
+ }catch (Exception e){
+ log.error("3989琛屾墽琛屽皬杞﹀彇绌烘澘浠诲姟涓嬪彂澶辫触");
+ log.error("3989琛�"+e);
+ }
+ return false;
+ }
+
public synchronized boolean rgvRunWrkMastEmptyStaTakeFull(RgvSlave rgvSlave) {//婊″彇
try{
// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
@@ -4008,10 +4709,19 @@
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
&& rgvProtocol.getLoaded2()==0 //鐜板満淇敼锛氬彔鐩樻満锛�////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗╋紙鍙兘鎷嗗彔锛� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
if (basRgvMap == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
return false;
@@ -4037,6 +4747,17 @@
continue;
}
Date date = new Date();
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, rgvSlave.getDevpPlcId());
+ StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+ if (staProtocol == null) {
+ log.info(date+"婊″彇浠诲姟涓嬪彂锛氭湭鏌ヨ鍒扮珯鐐逛俊鎭細"+wrkMastSta);
+ continue;
+ }
+ if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
+ continue;
+ }
+
log.info(date+"婊″彇浠诲姟涓嬪彂锛氬皬杞﹀伐浣滄。锛�"+wrkMastSta);
log.info(date+"婊″彇浠诲姟涓嬪彂锛氱洰鏍囩珯鐘舵�侊細"+basDevp);
sign = rgvTakeEmptyFull(rgvProtocol.getRgvNo(),wrkMastSta);
@@ -4055,6 +4776,81 @@
return true;
}else {
log.error("3879琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
+ }
+ }else {
+ log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
+ }
+ break;
+ }
+ }
+// }
+ }catch (Exception e){
+ log.error("3989琛屾墽琛屽皬杞﹀彇绌烘澘浠诲姟涓嬪彂澶辫触");
+ log.error("3989琛�"+e);
+ }
+ return false;
+ }
+ public synchronized boolean rgvRunWrkMastMove(RgvSlave rgvSlave) {//婊″彇
+ try{
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+ RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+ RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+ if (rgvProtocol == null) {
+ return false;
+ }
+ BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
+ if (basRgv == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
+ return false;
+ }
+
+ // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾棤鐗�//rgv鍙敤
+ if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+ && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+ && (rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+ || (rgvProtocol.getStatusType2() == RgvStatusType.SOS100 && rgvProtocol.getTaskNo2()==0))
+ && rgvProtocol.getModeType() == RgvModeType.AUTO
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
+ && rgvProtocol.getTaskNo2()==0
+ ) {
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvProtocol.getRgvNo(),rgvSignTwoType);
+ if (basRgvMap == null) {
+ log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱鍦板浘涓繘琛岀淮鎶わ紒", rgvProtocol.getRgvNo());
+ return false;
+ }
+ List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
+ basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
+ List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);
+ for (WrkMastSta wrkMastSta : wrkMastStaList){
+ if (wrkMastSta.getWrkType()!=4){// 2:绌烘澘 || 宸ヤ綔绫诲瀷 1:鍙栵紙鍙犵洏锛� 2锛氭媶鐩� 5锛氭弧鍙� 6锛氭弧鏀� 4 绉诲姩
+ continue;
+ }
+ boolean sign = false;
+ if ( wrkMastSta.getStaEnd()!=0){//鏀�
+ sign = rgvAvoidanceXY(rgvProtocol.getRgvNo(),wrkMastSta);//鎷嗙洏
+ }else {
+ continue;
+ }
+ if (sign){
+ boolean signMap = rgvMapUpdate(basRgvMap, basRgvMap.getStartRoute(), wrkMastSta.getStaEnd());
+ if (signMap){
+ wrkMastSta.setWrkSts(3);
+ try{
+ wrkMastStaMapper.updateById(wrkMastSta);
+ }catch (Exception e){
+ log.error("鏇存柊灏忚溅浠诲姟澶辫触");
+ }
+ return true;
+ }else {
+ log.error("3857琛岋紝璐х墿鎼繍浠诲姟锛氬伐浣滃彿{}鎵�灞炰换鍔′笅鍙戝悗鍦板浘鍚屾澶辫触",wrkMastSta.getWrkNo());
}
}else {
log.error("宸ヤ綔鍙穥}鎵�灞炰换鍔′笅鍙戝け璐�",wrkMastSta.getWrkNo());
@@ -4101,63 +4897,92 @@
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getLoaded1()==0 //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
- && rgvProtocol.getTaskNo1()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
&& rgvProtocol.getTaskNo2()==0
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
- if (rgvProtocol.getRgvPosI().equals(basRgvMap.getStartRoute())){
-// if (!RouteUtils.RgvRunStaSign(rgvProtocol.getRgvPosI(),RouteUtils.RouteIndexFarMas(rgvProtocol.getRgvNo(),rgvRunSta[rgvProtocol.getRgvNo()-1]),rgvProtocol.getRgvNo())){
-// if (!RouteUtils.RgvRunStaSign(rgvProtocol.getRgvPosI(),rgvRunSta[rgvProtocol.getRgvNo()-1],rgvProtocol.getRgvNo())){
- if (rgvProtocol.getRgvNo()==1){
- signRgv1 = false;
- }else {
- signRgv2 = false;
+ if (rgvProtocol.getRgvNo()!=1){
+ if (!rgvProtocol.getRgvPosI().equals(120) && !rgvProtocol.getRgvPosI().equals(110)){
+ continue;
}
- }
- if (rgvProtocol.getRgvNo()==1 && (rgvProtocol.getRgvPosI().equals(101) || rgvProtocol.getRgvPosI().equals(102) )){
- signRgv1 = false;
- continue;
- } else if (rgvProtocol.getRgvNo()==2 && (rgvProtocol.getRgvPosI().equals(116) || rgvProtocol.getRgvPosI().equals(117) ) ){
- signRgv2 = false;
+ rgvAvoidanceXY(rgvProtocol.getRgvNo());
+// return;
continue;
}
+ if (!rgvProtocol.getRgvPosI().equals(110) && !rgvProtocol.getRgvPosI().equals(108) && !rgvProtocol.getRgvPosI().equals(119)){
+ continue;
+ }
+ Integer count108Y = wrkMastStaMapper.selectAllWrkCount108Y();
+ if (count108Y!=0){
+ continue;
+ }
+// Integer count108 = wrkMastStaMapper.selectAllWrkCount108();
+// if (count108!=0){
+// continue;
+// }
+ rgvAvoidanceXY(rgvProtocol.getRgvNo());
+ continue;
+// BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+// Integer fallMerge = RouteUtils.RouteIndexFarMas(basRgvMap.getRgvNo(), basRgvMap.getEndRoute()); //鑾峰彇鍚堝苟骞叉秹椤�
+// List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(),fallMerge);
+// List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route ,route);
+// if (!wrkMastStaList.isEmpty()){
+// log.info("灏忚溅瀛樺湪鍙墽琛屼换鍔★紝璺宠繃閬胯锛侊紒4214");
+// return;
+// }
+// if (rgvProtocol.getRgvPosI().equals(basRgvMap.getStartRoute())){
+//// if (!RouteUtils.RgvRunStaSign(rgvProtocol.getRgvPosI(),RouteUtils.RouteIndexFarMas(rgvProtocol.getRgvNo(),rgvRunSta[rgvProtocol.getRgvNo()-1]),rgvProtocol.getRgvNo())){
+//// if (!RouteUtils.RgvRunStaSign(rgvProtocol.getRgvPosI(),rgvRunSta[rgvProtocol.getRgvNo()-1],rgvProtocol.getRgvNo())){
+// if (rgvProtocol.getRgvNo()==1){
+// signRgv1 = false;
+// }else {
+// signRgv2 = false;
+// }
+// }
+// if (rgvProtocol.getRgvNo()==1 && (rgvProtocol.getRgvPosI().equals(101) || rgvProtocol.getRgvPosI().equals(102) )){
+// signRgv1 = false;
+// continue;
+// } else if (rgvProtocol.getRgvNo()==2 && (rgvProtocol.getRgvPosI().equals(116) || rgvProtocol.getRgvPosI().equals(117) ) ){
+// signRgv2 = false;
+// continue;
+// }
}else {
signRgv = false;
break;
}
}
- if (signRgv && (signRgv1 || signRgv2)){
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
- RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
- RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
- if (rgvProtocol == null) {
- continue;
- }
-
- // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
- if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
- && rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getLoaded1()==0 //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
- && rgvProtocol.getTaskNo1()==0
- && rgvProtocol.getTaskNo2()==0
- && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
- && rgvProtocol.getStatusType2() == RgvStatusType.IDLE
- ) {
- if (rgvProtocol.getRgvNo()==1 && (rgvProtocol.getRgvPosI().equals(101) || rgvProtocol.getRgvPosI().equals(102) )){
- continue;
- } else if (rgvProtocol.getRgvNo()==2 && (rgvProtocol.getRgvPosI().equals(116) || rgvProtocol.getRgvPosI().equals(117) ) ){
- continue;
- }
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
- rgvAvoidanceXY(rgvProtocol.getRgvNo());
- rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
-
- }
- }
- }
+// if (signRgv && (signRgv1 || signRgv2)){
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+// if (rgvProtocol == null) {
+// continue;
+// }
+//
+// // 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
+// if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
+// && rgvProtocol.getModeType() == RgvModeType.AUTO
+// && rgvProtocol.getLoaded1()==0 //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+// && rgvProtocol.getTaskNo1()==0
+// && rgvProtocol.getTaskNo2()==0
+// && rgvProtocol.getStatusType1() == RgvStatusType.IDLE
+// && rgvProtocol.getStatusType2() == RgvStatusType.IDLE
+// ) {
+// if (rgvProtocol.getRgvNo()==1 && (rgvProtocol.getRgvPosI().equals(101) || rgvProtocol.getRgvPosI().equals(102) )){
+// continue;
+// } else if (rgvProtocol.getRgvNo()==2 && (rgvProtocol.getRgvPosI().equals(116) || rgvProtocol.getRgvPosI().equals(117) ) ){
+// continue;
+// }
+// BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvProtocol.getRgvNo());
+// rgvAvoidanceXY(rgvProtocol.getRgvNo());
+// rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
+//
+// }
+// }
+// }
}catch (Exception e){
log.error("4109琛屾墽琛屽皬杞﹀垵濮嬪寲浠诲姟涓嬪彂澶辫触");
log.error("4109琛�"+e);
@@ -4184,11 +5009,18 @@
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅涓�鏃犵墿//rgv鍙敤
if (rgvProtocol.getStatusType() == RgvStatusType.IDLE
&& rgvProtocol.getModeType() == RgvModeType.AUTO
- && rgvProtocol.getLoaded1()==0 //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
- && rgvProtocol.getTaskNo1()==0
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((rgvProtocol.getTaskNo1()==0 && rgvProtocol.getLoaded1()==0)
+ || (rgvProtocol.getTaskNo1()>0 && rgvProtocol.getLoaded1()==1))
&& rgvProtocol.getTaskNo2()==0
) {
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvSlave.getId());
+
+ RgvOneSign rgvSignTwo = rgvOneSignMapper.selectOneSign("rgvTwo");
+ int rgvSignTwoType = 0;
+ if (!Cools.isEmpty(rgvSignTwo)){
+ rgvSignTwoType = rgvSignTwo.getRgvOneSign();
+ }
+ BasRgvMap basRgvMap = basRgvMapService.selectByIdSignTwo(rgvSlave.getId(),rgvSignTwoType);
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI());
rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
}
@@ -4203,9 +5035,11 @@
* 灏忚溅XY绉诲姩 閬胯
* */
public synchronized boolean rgvAvoidanceXY(Integer rgvId){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
if (rgvId==1){
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
@@ -4213,7 +5047,7 @@
rgvCommand.setTaskNo1((short)32222); // 宸ヤ綅1宸ヤ綔鍙�
rgvCommand.setTaskMode1(RgvTaskModeType.X_MOVE); // 宸ヤ綅1浠诲姟妯″紡: 鍥炲師鐐�
//basRgvMap.getLockStartRoute().shortValue()
- rgvCommand.setSourceStaNo1( (short)101);
+ rgvCommand.setSourceStaNo1( (short)104);
rgvCommand.setCommand((short) 1); //宸ヤ綅1浠诲姟纭
if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(4, rgvCommand))) {
//step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
@@ -4228,14 +5062,128 @@
}
}else {
try{
- BasRgvMap basRgvMap = basRgvMapMapper.selectById(rgvId);
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
rgvCommand.setAckFinish2((short) 0); // 宸ヤ綅2浠诲姟瀹屾垚纭浣�
rgvCommand.setTaskNo2((short)32222); // 宸ヤ綅2宸ヤ綔鍙�
rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
- rgvCommand.setSourceStaNo2((short)117);
+ rgvCommand.setSourceStaNo2((short)114);
+ rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(5, rgvCommand))) {
+ //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
+ return false;
+ } else {
+ return true;
+ }
+ }catch (Exception e){
+ return false;
+
+ }
+ }
+ }
+
+ /*
+ * 灏忚溅XY绉诲姩 閬胯
+ * */
+ public synchronized boolean rgvAvoidanceXYWrkMast(Integer rgvId,short wrkNo1){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
+ if (rgvId==2){
+ try{
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ RgvCommand rgvCommand = new RgvCommand();
+ rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
+ rgvCommand.setTaskNo1(wrkNo1); // 宸ヤ綔鍙�
+ rgvCommand.setAckFinish1((short) 1); // 浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskMode1(RgvTaskModeType.NONE); // 浠诲姟妯″紡
+ rgvCommand.setSourceStaNo1((short)0); // 婧愮珯
+ rgvCommand.setDestinationStaNo1((short)0); // 鐩爣绔�
+ rgvCommand.setAckFinish2((short) 0); // 宸ヤ綅2浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskNo2((short)32222); // 宸ヤ綅2宸ヤ綔鍙�
+ rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
+ rgvCommand.setSourceStaNo2((short)121);
+ rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(10, rgvCommand))) {
+ //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
+ return false;
+ } else {
+ return true;
+ }
+ }catch (Exception e){
+ return false;
+
+ }
+ }else {
+ try{
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ RgvCommand rgvCommand = new RgvCommand();
+ rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
+ rgvCommand.setTaskNo1(wrkNo1); // 宸ヤ綔鍙�
+ rgvCommand.setAckFinish1((short) 1); // 浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskMode1(RgvTaskModeType.NONE); // 浠诲姟妯″紡
+ rgvCommand.setSourceStaNo1((short)0); // 婧愮珯
+ rgvCommand.setDestinationStaNo1((short)0); // 鐩爣绔�
+ rgvCommand.setAckFinish2((short) 0); // 宸ヤ綅2浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskNo2((short)32222); // 宸ヤ綅2宸ヤ綔鍙�
+ rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
+ rgvCommand.setSourceStaNo2((short)118);
+ rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(10, rgvCommand))) {
+ //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
+ return false;
+ } else {
+ return true;
+ }
+ }catch (Exception e){
+ return false;
+
+ }
+ }
+ }
+
+ /*
+ * 灏忚溅XY绉诲姩 閬胯
+ * */
+ public synchronized boolean rgvAvoidanceXY(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
+ if (rgvId==1){
+ try{
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ RgvCommand rgvCommand = new RgvCommand();
+ rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
+ rgvCommand.setAckFinish1((short) 0); // 宸ヤ綅1浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskNo1((short)32222); // 宸ヤ綅1宸ヤ綔鍙�
+ rgvCommand.setTaskMode1(RgvTaskModeType.X_MOVE); // 宸ヤ綅1浠诲姟妯″紡: 鍥炲師鐐�
+ //basRgvMap.getLockStartRoute().shortValue()
+ rgvCommand.setSourceStaNo1( wrkMastSta.getStaEnd().shortValue());
+ rgvCommand.setCommand((short) 1); //宸ヤ綅1浠诲姟纭
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(4, rgvCommand))) {
+ //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}锛屼换鍔℃暟鎹�={}", rgvId, JSON.toJSON(rgvCommand));
+ return false;
+ } else {
+ return true;
+ }
+ }catch (Exception e){
+ return false;
+
+ }
+ }else {
+ try{
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ RgvCommand rgvCommand = new RgvCommand();
+ rgvCommand.setRgvNo(rgvId); // RGV缂栧彿
+ rgvCommand.setAckFinish2((short) 0); // 宸ヤ綅2浠诲姟瀹屾垚纭浣�
+ rgvCommand.setTaskNo2((short)32222); // 宸ヤ綅2宸ヤ綔鍙�
+ rgvCommand.setTaskMode2(RgvTaskModeType.X_MOVE); // 宸ヤ綅2浠诲姟妯″紡: 鍥炲師鐐�
+ rgvCommand.setSourceStaNo2( wrkMastSta.getStaEnd().shortValue());
rgvCommand.setCommand((short) 2); //宸ヤ綅2浠诲姟纭
if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(5, rgvCommand))) {
//step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔� step=9锛屽洖鍘熺偣 9999浠诲姟鍙�
@@ -4256,6 +5204,9 @@
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFullAll(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4282,6 +5233,9 @@
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4307,6 +5261,9 @@
* 灏忚溅鏀捐揣鑷宠緭閫佺嚎浠诲姟
* */
public synchronized boolean rgvPutFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4332,6 +5289,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 鍙犵洏
* */
public synchronized boolean rgvTakeEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4357,6 +5317,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //鎷嗙洏
* */
public synchronized boolean rgvPutEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4382,6 +5345,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 婊″彇
* */
public synchronized boolean rgvTakeEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4407,6 +5373,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //婊℃斁
* */
public synchronized boolean rgvPutEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4432,6 +5401,9 @@
* 灏忚溅澶嶄綅
* */
public synchronized boolean rgvComplete(Integer rgvId){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(3, new RgvCommand()))) {
@@ -4449,10 +5421,40 @@
}
/*
+ * 灏忚溅澶嶄綅
+ * */
+ public synchronized boolean rgvComplete(Integer rgvId,Short taskNo1){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
+ try{
+ RgvCommand rgvCommand = new RgvCommand();
+ rgvCommand.setTaskNo1(taskNo1);
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ if (!MessageQueue.offer(SlaveType.Rgv, rgvId, new Task(8, rgvCommand))) {
+ //step=2,宸ヤ綅1銆�2鍐欎换鍔★紱 step=4锛屽伐浣�1鍐欎换鍔★紱 step=5锛屽伐浣�2鍐欎换鍔�
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}",rgvId);
+ return false;
+ } else {
+ log.info("RGV鍛戒护涓嬪彂鎴愬姛锛孯GV鍙�={}",rgvId);
+ return true;
+ }
+ }catch (Exception e){
+ log.error("RGV鍛戒护涓嬪彂澶辫触锛孯GV鍙�={}銆傚紓甯革細"+e,rgvId);
+ return false;
+ }
+ }
+
+ /*
* 灏忚溅鍦板浘鏇存柊 鏇存柊閿�
* */
public synchronized boolean rgvMapUpdate(BasRgvMap basRgvMapCurrent,Integer staStart,Integer staEnd){
-
+ if (rgvOpen){
+ return true;
+ }
+ if (basRgvMapCurrent.getRgvNo()>2){
+ return true;
+ }
// List<Integer> integers = RouteUtils.RouteMapCurrentFar(basRgvMapCurrent.getNowRoute(),staStart,staEnd, basRgvMapCurrent.getLockStartRoute());
//鏇存柊褰撳墠灏忚溅閿�
try{
@@ -4460,15 +5462,17 @@
// Integer farCurrentStaNo = RouteUtils.RouteIndexFarMas(staEnd, staStart, staEnd, basRgvMapCurrent.getLockStartRoute());//鑾峰彇鏈�杩滅珯鐐�
Integer fallMerge = RouteUtils.RouteIndexFarMas(basRgvMapCurrent.getRgvNo(), farCurrentStaNo); //鑾峰彇鍚堝苟骞叉秹椤�
basRgvMapCurrent.setLockEndRoute(fallMerge);
- basRgvMapMapper.updateById(basRgvMapCurrent);
+
+ basRgvMapService.updateById(basRgvMapCurrent);
//鏇存柊鍙︿竴鍙板皬杞﹀湴鍥�
Integer rgvNoOther = basRgvMapCurrent.getRgvNoOther();
- BasRgvMap basRgvMapOther = basRgvMapMapper.selectById(rgvNoOther);
+ BasRgvMap basRgvMapOther = basRgvMapService.selectById(rgvNoOther);
List<Integer> integers = RouteUtils.RouteMapCurrentFar(fallMerge, basRgvMapCurrent.getLockStartRoute());
Integer lockEndRoute = RouteUtils.RouteMapOtherFarStnNo(integers, basRgvMapCurrent.getLockStartRoute());//鍙︿竴鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�
- basRgvMapOther.setEndRoute(lockEndRoute);
- basRgvMapMapper.updateById(basRgvMapOther);
+ Integer lockEndRouteL = RouteUtils.RouteIndexFarMasL(rgvNoOther, lockEndRoute);//鍙︿竴鍙板皬杞﹀彲娲诲姩鏈�杩滀綅缃�
+ basRgvMapOther.setEndRoute(lockEndRouteL);
+ basRgvMapService.updateById(basRgvMapOther);
return true;
}catch (Exception e){
log.error("灏忚溅鍦板浘鏇存柊鍑洪敊锛�");
@@ -4476,4 +5480,87 @@
}
}
+
+ /**
+ * ste鍏呯數浠诲姟鍒涘缓 //瀹屾垚
+ */
+ public synchronized void armNoStartTwoLo() {
+ int[] staNos =new int[]{215,219};
+ for (int staNo : staNos){
+ try{
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+ StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() == 0 && staProtocol.isPakMk()){
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("armNo"+staNo);
+ if (!Cools.isEmpty(rgvOneSign) && rgvOneSign.getRgvOneSign() == 1){
+ int workNo = commonService.getWorkNo(6);
+
+ StaProtocol staProtocolnew = new StaProtocol();
+ staProtocolnew.setSiteId(staNo);
+ staProtocolnew.setWorkNo(workNo);
+ staProtocolnew.setStaNo(staNo==215? 217:221);
+ boolean result1 = MessageQueue.offer(SlaveType.Devp, 2, new Task(3, staProtocolnew));
+
+ devpThread.setPakMk(staProtocolnew.getSiteId(), false);
+
+ boolean result2 = MessageQueue.offer(SlaveType.Devp, 2, new Task(2, staProtocolnew));
+ if (!result2) {
+ log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", 2);
+ }
+ if (!staProtocol.isLoading()){
+ updateRgvOneSign("armNo"+staNo,0);
+ }
+
+
+ boolean result3 = MessageQueue.offer(SlaveType.Devp, 2, new Task(4, staProtocolnew));
+ }
+ }
+ }catch (Exception e){
+ log.error("绔欑偣"+staNo+"2妤兼満姊拌噦鐮佸灈鍚庢爣璁版竻闄ゅけ璐ワ紝寮傚父淇℃伅锛�"+e);
+ }
+ }
+ }
+
+ public synchronized void armNoCleanUpTwoLo() {
+ int[] staNos =new int[]{215,219};
+ for (int staNo : staNos){
+ try{
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+ StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (!staProtocol.isLoading()){
+ updateRgvOneSign("armNo"+staNo,0);
+ }
+ }catch (Exception e){
+ log.error("绔欑偣"+staNo+"2妤兼満姊拌噦鐮佸灈鍚庢爣璁版竻闄ゅけ璐ワ紝寮傚父淇℃伅锛�"+e);
+ }
+ }
+ }
+
+ public void updateRgvOneSign(String signType,Integer oneSign){
+ try{
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign(signType);
+ if (!Cools.isEmpty(rgvOneSign)){
+ rgvOneSign.setRgvOneSign(oneSign);
+ rgvOneSignMapper.updateById(rgvOneSign);
+ }
+ } catch (Exception e){
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign(signType);
+ if (!Cools.isEmpty(rgvOneSign)){
+ rgvOneSign.setRgvOneSign(999);
+ rgvOneSignMapper.updateById(rgvOneSign);
+ }
+ }
+ }
+
}
--
Gitblit v1.9.1