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 | 2341 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 1,924 insertions(+), 417 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 a051bab..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;
@@ -47,6 +46,7 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
+import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@@ -73,8 +73,6 @@
@Autowired
private LocMastService locMastService;
@Autowired
- private StaDescService staDescService;
- @Autowired
private BasCrnpService basCrnpService;
@Autowired
private BasRgvService basRgvService;
@@ -93,14 +91,17 @@
@Autowired
private BasRgvPathService basRgvPathService;
@Autowired
- private RedisUtil redisUtil;
- @Autowired
private WrkMastStaMapper wrkMastStaMapper;
@Autowired
- private BasRgvMapMapper basRgvMapMapper;
+ private RgvOneSignMapper rgvOneSignMapper;
+ @Autowired
+ private BasRgvMapService basRgvMapService;
@Value("${wms.url}")
private String wmsUrl;
+
+ @Value("${wms.rgvOpen}")
+ private boolean rgvOpen;
/**
* 缁勬墭
@@ -135,6 +136,47 @@
continue;
} else {
staProtocol = staProtocol.clone();
+ }
+
+ // 灏哄妫�娴嬪紓甯�
+ boolean back = false;
+ String errMsg = "寮傚父锛�";
+ if (staProtocol.isFrontErr()) {
+ errMsg = errMsg+"鍓嶈秴闄愶紱";
+ back = true;
+ }
+ if (staProtocol.isBackErr()) {
+ errMsg = errMsg+"鍚庤秴闄�";
+ back = true;
+ }
+ if (staProtocol.isHighErr()) {
+ errMsg = errMsg+"楂樿秴闄�";
+ back = true;
+ }
+ if (staProtocol.isLeftErr()) {
+ errMsg = errMsg+"宸﹁秴闄�";
+ back = true;
+ }
+ if (staProtocol.isRightErr()) {
+ errMsg = errMsg+"鍙宠秴闄�";
+ back = true;
+ }
+ if (staProtocol.isWeightErr()) {
+ errMsg = errMsg+"瓒呴噸";
+ back = true;
+ }
+ if (staProtocol.isBarcodeErr()) {
+ errMsg = errMsg+"鎵爜澶辫触";
+ back = true;
+ }
+ // 閫�鍥�
+ if (back) {
+ // led 寮傚父鏄剧ず
+ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+ if (ledThread != null) {
+ MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(5, errMsg));
+ }
+ continue;
}
// 鍏ュ嚭搴撴ā寮忓垽鏂�
@@ -383,8 +425,9 @@
// // 鍏ュ嚭搴撴ā寮忓垽鏂�
// 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.selectPakInStep3(staProtocol.getWorkNo());
if (wrkMast == null) {
// 鏃犳嫞鏂欐暟鎹�
@@ -395,64 +438,67 @@
continue;
}
- // 鑾峰彇鐩爣绔�
- Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
- .eq("type_no", wrkMast.getIoType() - 50)
- .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
- .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
- StaDesc staDesc = staDescService.selectOne(wrapper);
- if (Cools.isEmpty(staDesc)) {
- log.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
- continue;
- }
-
+ // 鑾峰彇搴撲綅鍙�
try {
- // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
- if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+ SearchLocParam param = new SearchLocParam();
+ param.setBarcode(wrkMast.getBarcode());
+ param.setIoType(wrkMast.getIoType());
+ param.setSourceStaNo(pickSta.getStaNo()); //浣滀笟绔欑偣
+ param.setLocType1((short)1);
+ String response = "";
+ log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(wmsUrl)
+ .setPath("/rpc/pakin2/loc/v1")
+ .setJson(JSON.toJSONString(param))
+ .setTimeout(15, TimeUnit.SECONDS)
+ .build()
+ .doPost();
+ } catch(Exception e){
+ log.error("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+ log.error("stnToCrnStnPick2===>>鐩樼偣鏌ュ簱浣嶅叆搴撴帴鍙eけ璐�", e);
+ e.printStackTrace();
+ continue;
}
- // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
- if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+ log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+ log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
+ if(response.equals("")) {
+ continue;
}
-
- Date now = new Date();
- // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
- Integer staNo = staDesc.getCrnStn();
- // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
- wrkMast.setIoTime(now);
- wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
- wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
- wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
- wrkMast.setStaNo(staNo); // 鐩爣绔�
- wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
- wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
- wrkMast.setModiTime(now);
- if (wrkMastMapper.updateById(wrkMast) == 0) {
- throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
- }
- // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
- wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
- // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
- LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocSts("Q");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ JSONObject jsonObject = JSON.parseObject(response);
+// 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 {
+ 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(5, 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();
- continue;
- }
-
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo());
- staProtocol.setStaNo(wrkMast.getStaNo());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
}
}
@@ -483,27 +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) {
-// WrkMast wrkMast1 = wrkMastMapper.selectPakInStep5(staProtocol.getSiteId(),"3");
-// if (Cools.isEmpty(wrkMast1) && staProtocol.isEmptyMk()){
-// WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(staProtocol.getSiteId() + 9999L);
-// if (Cools.isEmpty(wrkMastSta)){
-// WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),staProtocol.getSiteId());
-// wrkMastSta1.setType(2);
-// wrkMastSta1.setWrkType(1);
-// wrkMastStaMapper.insert(wrkMastSta1);
-// }
-// continue;
-// }
-// log.error("绔欑偣鍙�"+staProtocol.getSiteId()+"鏈煡璇㈠埌宸ヤ綔妗f锛�");
- // 鏃犳嫞鏂欐暟鎹�
- 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)
@@ -511,65 +544,137 @@
continue;
}
- // 鑾峰彇鐩爣绔�
- Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
- .eq("type_no", wrkMast.getIoType() - 50)
- .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
- .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
- StaDesc staDesc = staDescService.selectOne(wrapper);
- if (Cools.isEmpty(staDesc)) {
- log.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+ String barcode = wrkMast.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)) {
+ continue;
+ }
+ } else {
continue;
}
+ // 鑾峰彇搴撲綅鍙�
try {
- // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
- if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+ SearchLocParam param = new SearchLocParam();
+ param.setBarcode(barcode);
+ param.setIoType(wrkMast.getIoType());
+ param.setSourceStaNo(pickSta.getStaNo()); //浣滀笟绔欑偣
+ param.setLocType1((short)1);
+ String response = "";
+ log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(wmsUrl)
+ .setPath("/rpc/pakin2/loc/v1")
+ .setJson(JSON.toJSONString(param))
+ .setTimeout(15, TimeUnit.SECONDS)
+ .build()
+ .doPost();
+ } catch(Exception e){
+ log.error("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+// log.error("stnToCrnStnPick2===>>鐩樼偣鏌ュ簱浣嶅叆搴撴帴鍙eけ璐�", e);
+// e.printStackTrace();
+ continue;
}
- // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
- if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
- throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+// log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS===>>鍙傛暟锛�" + param);
+// log.info("鍏ュ簱浣滀笟绔�"+pickSta.getStaNo()+"涓嬪彂鐩樼偣鍐嶅叆搴撲换鍔¤姹俉MS杩斿洖缁撴灉===>>" + response);
+ if(response.equals("")) {
+ continue;
}
-
- Date now = new Date();
- // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
- Integer staNo = staDesc.getCrnStn();
- // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
- wrkMast.setIoTime(now);
- wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
- wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
- wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
- wrkMast.setStaNo(staNo); // 鐩爣绔�
- wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
- wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
- wrkMast.setModiTime(now);
- if (wrkMastMapper.updateById(wrkMast) == 0) {
- throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
- }
- // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
- wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
- // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
- LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
- locMast.setLocSts("Q");
- locMast.setModiTime(new Date());
- if (!locMastService.updateById(locMast)) {
- throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+ JSONObject jsonObject = JSON.parseObject(response);
+// 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 {
+ 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();
+// }
+// }
+ } else {
+ log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin2/loc/v1", JSON.toJSONString(param), response);
}
} catch (Exception e) {
- e.printStackTrace();
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
- continue;
+ log.error("stnToCrnStnPick2===>>fail", e);
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo());
- staProtocol.setStaNo(wrkMast.getStaNo());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
+// // 鑾峰彇鐩爣绔�
+// Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
+// .eq("type_no", wrkMast.getIoType() - 50)
+// .eq("stn_no", pickSta.getStaNo()) // 浣滀笟绔欑偣 = 鎷f枡鍑哄簱鐨勭洰鏍囩珯
+// .eq("crn_no", wrkMast.getCrnNo()); // 鍫嗗灈鏈哄彿
+// StaDesc staDesc = staDescService.selectOne(wrapper);
+// if (Cools.isEmpty(staDesc)) {
+// log.error("鍏ュ簱璺緞涓嶅瓨鍦紒type_no={},stn_no={},crn_no={}", wrkMast.getIoType(), pickSta.getStaNo(), wrkMast.getCrnNo());
+// continue;
+// }
+//
+// try {
+// // 淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。
+// if (wrkMastMapper.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) {
+// throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏妗e巻鍙叉。澶辫触");
+// }
+// // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+// if (wrkMastMapper.saveWrkMastLog(wrkMast.getWrkNo()) == 0) {
+// throw new CoolException("淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗eけ璐�");
+// }
+//
+// Date now = new Date();
+// // 鍫嗗灈鏈虹珯鐐�(鐩爣绔�)
+// Integer staNo = staDesc.getCrnStn();
+// // 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
+// wrkMast.setIoTime(now);
+// wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
+// wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
+// wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 婧愮珯
+// wrkMast.setStaNo(staNo); // 鐩爣绔�
+// wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
+// wrkMast.setSourceLocNo(""); // 婧愬簱浣嶆竻绌�
+// wrkMast.setModiTime(now);
+// if (wrkMastMapper.updateById(wrkMast) == 0) {
+// throw new CoolException("鏇存柊宸ヤ綔妗f暟鎹姸鎬佸け璐�");
+// }
+// // 鏇存柊鏄庣粏妗o_time (鍘嗗彶妗e叧鑱斾娇鐢級
+// wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now);
+// // 淇敼搴撲綅鐘舵�� Q.鎷f枡/鐩樼偣/骞舵澘鍐嶅叆搴�
+// LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
+// locMast.setLocSts("Q");
+// locMast.setModiTime(new Date());
+// if (!locMastService.updateById(locMast)) {
+// throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+// continue;
+// }
+//
+// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+// staProtocol.setWorkNo(wrkMast.getWrkNo());
+// staProtocol.setStaNo(wrkMast.getStaNo());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// if (!result) {
+// log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+// }
}
@@ -578,6 +683,164 @@
}
}
+ /**
+ * 2妤�212鍛煎彨绌烘澘
+ */
+ public synchronized void stnToCrnStnPick3Auto(Integer sign) {
+ try{
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+ StaProtocol staProtocol = devpThread.getStation().get(212);
+ if (staProtocol == null) {
+ return;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.getWorkNo()==0 ){
+ switch (sign){
+ //鎵ц灏忚溅璐х墿鎼繍浠诲姟
+ case 1:
+ case 4:
+ stnToCrnStnPick3();
+ return;
+ //鎵ц灏忚溅绌烘澘鎼繍浠诲姟
+ case 2://鏀�//鎷嗙洏
+ case 5://鏀�//鎷嗙洏
+ stnToCrnStnPick4();
+ return;
+ default:
+ return;
+ }
+ } else if (staProtocol.isAutoing() && staProtocol.isLoading()){
+ switch (sign){
+ case 3://婊℃斁
+ case 6://婊℃斁
+ stnToCrnStnPick5();
+ return;
+ default:
+ return;
+ }
+ }
+ }catch (Exception e){
+ log.error("2妤�212鍛煎彨绌烘澘"+e);
+ }
+ }
+ /**
+ * 2妤�212鍛煎彨绌烘澘
+ */
+ public synchronized void stnToCrnStnPick3() {
+ WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne212();
+ if (Cools.isEmpty(wrkMast) || wrkMast.getWrkSts()!=61){//61銆佺瓑寰呯┖鏉�
+ return;
+ }
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ for (DevpSlave.Sta driveSta : devp.getDriveSta()) {
+ if (driveSta.getStaNo()!=215){
+ continue;
+ }
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(driveSta.getStaNo());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo()==0
+ || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000)) ){
+ boolean result1 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+
+ staProtocol.setWorkNo(wrkMast.getWrkNo()-1);
+ staProtocol.setStaNo(driveSta.getStaNo()==215? 217:221);
+ boolean result2 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result2) {
+ log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+ }
+ wrkMast.setWrkSts(62L);
+ wrkMastMapper.updateById(wrkMast);
+
+ boolean result3 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol));
+ return;
+ }
+ }
+ }
+ }
+
+ /**
+ * 2妤�212鍛煎彨绌烘澘
+ */
+ public synchronized void stnToCrnStnPick4() {
+ WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne212();
+ if (Cools.isEmpty(wrkMast) || wrkMast.getWrkSts()!=62){//62銆佺瓑寰呭皬杞︽惉杩�
+ return;
+ }
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ for (DevpSlave.Sta driveSta : devp.getInSta()) {
+ if (driveSta.getStaNo()!=217){
+ continue;
+ }
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(driveSta.getStaNo());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ StaProtocol staProtocol212 = devpThread.getStation().get(212);
+ if (staProtocol212 == null) {
+ continue;
+ } else {
+ staProtocol212 = staProtocol212.clone();
+ }
+ if (staProtocol212.isAutoing() && !staProtocol212.isLoading() && staProtocol212.getWorkNo()==0){
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo()==0
+ || (staProtocol.getWorkNo()>9899 && staProtocol.getWorkNo()<10000) || staProtocol.getWorkNo()==wrkMast.getWrkNo()-1) ){
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(3, staProtocol));
+
+ staProtocol.setWorkNo(wrkMast.getWrkNo());
+ staProtocol.setStaNo(212);
+ boolean result2 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ if (!result2) {
+ log.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+ }
+ wrkMast.setWrkSts(63L);
+ wrkMastMapper.updateById(wrkMast);
+
+// boolean result3 = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(4, staProtocol));
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 2妤�212鍛煎彨绌烘澘
+ */
+ public synchronized void stnToCrnStnPick5() {
+ WrkMast wrkMast = wrkMastMapper.selectWrkMastUnstackingOne212();
+ if (Cools.isEmpty(wrkMast) || wrkMast.getWrkSts()!=63){//63銆佺瓑寰呭畬鎴�
+ return;
+ }
+
+ // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
+ StaProtocol staProtocol = devpThread.getStation().get(212);
+ if (staProtocol == null) {
+ return;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (staProtocol.isAutoing() && staProtocol.isLoading()){
+// boolean result1 = MessageQueue.offer(SlaveType.Devp, 2, new Task(3, staProtocol));
+
+ wrkMast.setWrkSts(64L);
+ wrkMastMapper.updateById(wrkMast);
+
+// boolean result3 = MessageQueue.offer(SlaveType.Devp, 2, new Task(4, staProtocol));
+ return;
+ }
+ }
/**
* 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱 鎷嗗灈浣嶇疆
*/
@@ -599,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);
@@ -932,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);
}
@@ -1026,8 +1310,12 @@
log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
continue;
}
- if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
- && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
+// 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;
}
if (!flag) {
@@ -1076,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);
}
@@ -1208,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;
@@ -1265,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;
}
@@ -1285,6 +1593,13 @@
if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) {
log.error("鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
continue;
+ }
+ //閫�搴撴ā寮忚烦杩�118銆�119鍑哄簱浠诲姟
+ if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==119){
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
+ if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
+ continue;
+ }
}
// 鑾峰彇婧愬簱浣嶄俊鎭�
LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
@@ -1337,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());
@@ -1355,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;
@@ -1367,6 +1692,9 @@
if (null != waitWrkMast && waitWrkMast.getWrkSts() == 4) {
continue;
}
+ } else if (!shallowLoc.getLocSts().equals("O") ){
+ log.error("{}浠诲姟鍑哄簱澶辫触锛屾祬搴撲綅鍫靛锛佹祬搴撲綅鍙�:{},娴呭簱浣嶇姸鎬�:{}", wrkMast.getWrkNo(), shallowLocNo,shallowLoc.getLocSts());
+ continue;
}
}
@@ -2011,6 +2339,10 @@
*/
public synchronized void storeEmptyPlt3() {
try{
+ RgvOneSign rgvOneSign = rgvOneSignMapper.selectOneSign("oneSign");
+ if (Cools.isEmpty(rgvOneSign) || rgvOneSign.getRgvOneSign()==1){
+ return;
+ }
for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
@@ -2028,8 +2360,12 @@
&& rgvProtocol.getModeType() == RgvModeType.AUTO
&& rgvProtocol.getStatusType1() == RgvStatusType.IDLE
&& rgvProtocol.getStatusType2() == RgvStatusType.IDLE
- && rgvProtocol.getTaskNo1()==0 && rgvProtocol.getTaskNo2()==0
- && (rgvProtocol.getLoaded2()==2 || rgvProtocol.getLoaded2()==3 ) ////0 鏃犵墿锛�1 涓�灞傛棤鐗╀簩灞傛湁鐗� 锛�2涓�灞傛湁鐗╀簩灞傛棤鐗� 锛堝彧鑳芥弧鏀撅級锛�3 1銆�2灞傞兘鏈夌墿 4锛氾紙锛夊彧鍏佽鎷嗙洏
+ //鐜板満淇敼锛氬彔鐩樻満锛屼笉婊¢兘绠楁棤鐗╋紝鎬庝箞鍒ゆ柇闇�瑕佽窡鐢垫帶瀵规帴
+ && ((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锛氾紙锛夊彧鍏佽鎷嗙洏
) {
try {
WrkMast wrkMast1 = wrkMastMapper.selectPakOutStep3(122);
@@ -2042,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")
@@ -2087,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()) {
// 鑾峰彇鍙夎溅绔欑偣
@@ -2133,6 +2471,10 @@
ledCommand.setTitle("绌烘澘鍑哄簱");
ledCommand.setEmptyMk(true);
break;
+ case 212:
+ ledCommand.setTitle("绌烘澘鍑哄簱");
+ ledCommand.setEmptyMk(true);
+ break;
default:
log.error("浠诲姟鍏ュ嚭搴撶被鍨嬮敊璇紒锛侊紒[宸ヤ綔鍙凤細{}] [鍏ュ嚭搴撶被鍨嬶細{}]", wrkMast.getWrkNo(), wrkMast.getIoType());
break;
@@ -2143,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);
}
@@ -2211,7 +2561,7 @@
if (staProtocol == null) {
continue;
}
- if (staProtocol.getWorkNo() != 0 && staProtocol.isLoading()) {
+ if (staProtocol.getWorkNo() != 0 || staProtocol.isLoading()) {
reset = false;
break;
}
@@ -2220,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 {
}
- }
+// }
}
}
}
@@ -2319,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;
@@ -2363,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;
}
// /**
@@ -2738,10 +3104,10 @@
*/
public synchronized void stackingCompletionDriveTray() {
try {
- int[] staNos=new int[]{216,220,123};//(3涓叆搴撶珯鐐癸紝1妤�1涓��璐х爜鍨涚珯锛�2妤间袱涓叆搴撶爜鍨涚珯)
+ int[] staNos=new int[]{215,219};//(2妤间袱涓叆搴撶爜鍨涚珯)
for (int staNo : staNos){
BasDevp basDevp = basDevpService.selectById(staNo);
- if (basDevp.getWrkNo()!=9992 || Cools.isEmpty(basDevp.getBarcode())){
+ if ((basDevp.getWrkNo()!=0 && (basDevp.getWrkNo()<9900 || basDevp.getWrkNo()>9999)) || Cools.isEmpty(basDevp.getBarcode())){
continue;
}
Integer zpallet = waitPakinMapper.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", basDevp.getBarcode()).eq("status","N"));
@@ -2772,11 +3138,11 @@
&& staProtocol.isLoading()
&& staProtocol.isInEnable()
&& !staProtocol.isEmptyMk()
- && staProtocol.getWorkNo() == 9992
+ && (basDevp.getWrkNo()==0 || (basDevp.getWrkNo()>=9900 && basDevp.getWrkNo()<=9999))
) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
-
- staProtocol.setWorkNo(9999);
- staProtocol.setStaNo(staNo + 1);
+ int workNo = commonService.getWorkNo(5);
+ staProtocol.setWorkNo(workNo);
+ staProtocol.setStaNo(staNo + 2);
devpThread.setPakMk(staProtocol.getSiteId(), false);
boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol));
if (!result) {
@@ -2802,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;
@@ -2823,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));
}
}
@@ -2863,7 +3230,7 @@
}
/**
- * 鍏朵粬 ===>> 鐮佸灈瀹屾垚椹卞姩鎵樼洏杩涘叆涓嬩竴姝�
+ * 鍏朵粬 ===>> 鐮佸灈瀹屾垚椹卞姩鎵樼洏杩涘叆涓嬩竴姝� 2===銆�3
*/
public synchronized void stackingCompletionDriveTrayOk2() {
for (DevpSlave devp : slaveProperties.getDevp()) {
@@ -2879,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) {
@@ -2887,12 +3254,12 @@
// 鏃犳嫞鏂欐暟鎹�
continue;
}
- if (!wrkMast.getSheetNo().equals("2") || wrkMast.getIoType()<100 || wrkMast.getWrkSts()!=14){
+ if (Cools.isEmpty(wrkMast.getSheetNo()) || !wrkMast.getSheetNo().equals("2") || wrkMast.getIoType()<100 || wrkMast.getWrkSts()!=14){
continue;
}
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 {
@@ -2901,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));
}
}
@@ -3003,8 +3370,20 @@
staProtocol = staProtocol.clone();
}
+ StaProtocol staProtocol147 = devpThread.getStation().get(147);
+ if (staProtocol147 == null) {
+ continue;
+ } else {
+ staProtocol147 = staProtocol147.clone();
+ }
+
if (!staProtocol.isLoading()){
log.info("{}绔欑偣鏃犵墿锛屽紓甯革紒",staNo);
+ continue;
+ }
+
+ if (staProtocol147.isLoading()){
+ log.info("{}绔欑偣鏈夌墿锛�",staProtocol147.getSiteId());
continue;
}
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
@@ -3012,6 +3391,9 @@
&& staProtocol.isLoading()
&& !staProtocol.isEmptyMk()
) {
+
+ boolean result3 = MessageQueue.offer(SlaveType.Devp, 1, new Task(3, staProtocol147));
+
staProtocol.setWorkNo(wrkMast.getWrkNo());
staProtocol.setStaNo(wrkMast.getStaNo());
devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -3019,8 +3401,12 @@
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触==>椹卞姩鐮佸灈浣嶆墭鐩樺墠杩涘け璐ワ紒");
}
+
wrkMast.setSheetNo("5");
wrkMastMapper.updateById(wrkMast);
+
+ boolean result4 = MessageQueue.offer(SlaveType.Devp, 1, new Task(4, staProtocol147));
+
}
}
}catch (Exception e){
@@ -3039,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);
@@ -3057,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);
@@ -3071,6 +3465,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())){
// log.info("绔欑偣宸ヤ綔鍙�={} 涓庤创鏍囧伐浣滃彿={} 涓嶄竴鑷达紝寮傚父锛�",staProtocol.getWorkNo(),wrkMast131.getWrkNo().shortValue());
// }
@@ -3079,25 +3493,30 @@
&& staProtocol.isLoading()
&& basDevp.getReportSign()==0
) {//&& staProtocol.isPakMk() && !Cools.isEmpty(barcode)) {
- if (true){
- return;
- }
+// if (true){
+// return;
+// }
//浠诲姟瀹屾垚
- 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);
- staProtocol135.setWorkNo(32222);
- staProtocol135.setStaNo(144);
- devpThread.setPakMk(staProtocol135.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devpThread.getSlave().getId(), new Task(2, staProtocol135));
+ int workNo = commonService.getWorkNo(5);
+
+ 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));
}
}
@@ -3138,27 +3557,59 @@
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;
}
- boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
- if (!rgvComplete){
- log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
- break;
+ 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;
}
-
- DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
- StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
- WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
- if (!Cools.isEmpty(wrkMast)){
+ 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);
+ StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
+ if (staProtocol == null) {
+ continue;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+ if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
+ continue;
+ }
// 涓嬪彂绔欑偣淇℃伅
staProtocol.setWorkNo(wrkMast.getWrkNo());
staProtocol.setStaNo(wrkMast.getStaNo());
@@ -3182,19 +3633,36 @@
// }catch (Exception e){
//
// }
+ }*/
+ boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
+ 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 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;
@@ -3204,16 +3672,14 @@
log.error("鏈煡鍒板皬杞︽墽琛屼换鍔℃垨鑰呮墽琛屼换鍔$姸鎬佷笉绗﹀悎锛�"+wrkMastSta);
continue;
}
- boolean rgvComplete = rgvComplete(rgvProtocol.getRgvNo());
- if (!rgvComplete){
- log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo());
- break;
- }
- DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
- StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
- WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue());
- if (!Cools.isEmpty(wrkMast)){
+ /*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);
+ StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd());
+ if (!staProtocol.isAutoing() || !staProtocol.isLoading()){
+ continue;
+ }
// 涓嬪彂绔欑偣淇℃伅
staProtocol.setWorkNo(wrkMast.getWrkNo());
staProtocol.setStaNo(wrkMast.getStaNo());
@@ -3221,26 +3687,37 @@
continue;
}
log.error("灏忚溅浠诲姟瀹屾垚涓嬪彂杈撻�佺嚎浠诲姟锛�"+staProtocol);
- try{
- Thread.sleep(1000);
- DevpThread devpThreadEnd = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
- StaProtocol staProtocolEnd = devpThreadEnd.getStation().get(wrkMastSta.getStaEnd());
- log.error("灏忚溅浠诲姟瀹屾垚璇诲彇杈撻�佺嚎浠诲姟锛�"+staProtocolEnd);
- if (staProtocolEnd.getWorkNo()==0 ){ //|| !staProtocolEnd.getWorkNo().equals(wrkMast.getWrkNo())
- staProtocolEnd.setWorkNo(wrkMast.getWrkNo());
- staProtocolEnd.setStaNo(wrkMast.getStaNo());
- if (!MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocolEnd))) {
- continue;
- }
- log.error("灏忚溅浠诲姟瀹屾垚涓嬪彂杈撻�佺嚎浠诲姟绗簩娆★細"+staProtocolEnd);
- }
- }catch (Exception e){
-
- }
+// try{
+// Thread.sleep(1000);
+// DevpThread devpThreadEnd = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+// StaProtocol staProtocolEnd = devpThreadEnd.getStation().get(wrkMastSta.getStaEnd());
+// log.error("灏忚溅浠诲姟瀹屾垚璇诲彇杈撻�佺嚎浠诲姟锛�"+staProtocolEnd);
+// if (staProtocolEnd.getWorkNo()==0 ){ //|| !staProtocolEnd.getWorkNo().equals(wrkMast.getWrkNo())
+// staProtocolEnd.setWorkNo(wrkMast.getWrkNo());
+// staProtocolEnd.setStaNo(wrkMast.getStaNo());
+// if (!MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocolEnd))) {
+// continue;
+// }
+// log.error("灏忚溅浠诲姟瀹屾垚涓嬪彂杈撻�佺嚎浠诲姟绗簩娆★細"+staProtocolEnd);
+// }
+// }catch (Exception e){
+//
+// }
+ }*/
+ 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 {
@@ -3255,7 +3732,8 @@
/**
* 鍏ュ嚭搴� ===>> 灏忚溅浣滀笟涓嬪彂
*/
- public synchronized void rgvIoExecute(Integer sign) {
+ public synchronized boolean rgvIoExecute(Integer sign) {
+ boolean rgvIoExecuteSign = false;
try{
for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
// 鑾峰彇灏忚溅淇℃伅
@@ -3274,99 +3752,133 @@
// 鍙湁褰揜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();
+ signWork = rgvRunWrkMastFullSta(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPutOrTake(rgvSlave);
+ }
break;
//鎵ц灏忚溅绌烘澘鎼繍浠诲姟
case 2://鏀�//鎷嗙洏
- signWork = rgvRunWrkMastEmptyStaPut();
+ signWork = rgvRunWrkMastEmptyStaPut(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaPut(rgvSlave);
+ }
break;
case 3://婊℃斁
- signWork = rgvRunWrkMastEmptyStaPutFull();
+ signWork = rgvRunWrkMastEmptyStaPutFull(rgvSlave);
+ if (!signWork){
+ signWork = rgvRunWrkMastFullStaTake(rgvSlave);
+ }
break;
case 4://鍙栧彔鐩�
- signWork = rgvRunWrkMastEmptyStaTake();
+ signWork = rgvRunWrkMastEmptyStaTake(rgvSlave);
break;
case 5:////婊″彇
- signWork = rgvRunWrkMastEmptyStaTakeFull();
+ signWork = rgvRunWrkMastEmptyStaTakeFull(rgvSlave);
break;
case 6:////鎻愬崌
// signWork = qwe();
+ signWork = rgvRunWrkMastMove(rgvSlave);
break;
default:
break;
}
- }
- for (int signCount = 1;!signWork && signCount<8;signCount++){
- switch (signCount){
- case 1://鎵ц灏忚溅璐х墿鎼繍浠诲姟
- signWork = rgvRunWrkMastFullSta();
- break;
- case 2://鏀�//鎷嗙洏
- signWork = rgvRunWrkMastEmptyStaPut();
- break;
- case 3://婊℃斁
- signWork = rgvRunWrkMastEmptyStaPutFull();
- break;
- case 4://鍙栧彔鐩�
- signWork = rgvRunWrkMastEmptyStaTake();
- break;
- case 5:////婊″彇
- signWork = rgvRunWrkMastEmptyStaTakeFull();
- break;
- case 6:////鎻愬崌
+ for (int signCount = 1;!signWork && signCount<7;signCount++){
+ 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);
+ break;
+ case 5:////婊″彇
+ signWork = rgvRunWrkMastEmptyStaTakeFull(rgvSlave);
+ break;
+ case 6:////鎻愬崌
// signWork = rgvRunWrkMastEmptyStaPut();
- break;
- default:
- if (sign>6){
- rgvRunWrkMastEmptyStaAvoidance();//閬胯
- signWork = true;
- }
- break;
+ break;
+ default:
+ break;
+ }
}
+ }else {
+ continue;
}
-
+ if (!rgvIoExecuteSign){
+ rgvIoExecuteSign = signWork;
+ }
}
+// if (!rgvIoExecuteSign){
+// if (sign>6){
+//
+// }
+// }
}catch (Exception e){
log.error("RGV灏忚溅浠诲姟涓嬪彂鎶ラ敊"+e);
}
+ return rgvIoExecuteSign;
}
/**
* 鎵ц灏忚溅鎼繍浠诲姟
*/
- public synchronized boolean rgvRunWrkMastFullSta() {
+ public synchronized boolean rgvRunWrkMastFullSta(RgvSlave rgvSlave) {
try{
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
if (rgvProtocol == null) {
- continue;
+ return false;
}
BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
if (basRgv == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
- continue;
+ return false;
}
// 鍙湁褰揜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());
- continue;
+ return false;
}
List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
@@ -3376,9 +3888,56 @@
continue;
}
BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
- if (!basDevp.getAutoing().equals("Y") || basDevp.getLoading().equals("Y")){
+ 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;
+ }
+ }
+ 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);
if (sign){
boolean signMap = rgvMapUpdate(basRgvMap, wrkMastSta.getStaStart(), wrkMastSta.getStaEnd());
@@ -3399,7 +3958,7 @@
break;
}
}
- }
+// }
}catch (Exception e){
log.error("3875琛屾墽琛屽皬杞︽惉杩愪换鍔′笅鍙戝け璐�");
log.error("3875琛�"+e);
@@ -3407,20 +3966,198 @@
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() {//鎷嗙洏
+ public synchronized boolean rgvRunWrkMastEmptyStaPut(RgvSlave rgvSlave) {//鎷嗙洏
try{
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
if (rgvProtocol == null) {
- continue;
+ return false;
}
BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
if (basRgv == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
- continue;
+ return false;
}
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾湁鐗�//rgv鍙敤//鎷嗙洏
@@ -3428,13 +4165,22 @@
&& 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());
- continue;
+ return false;
}
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());//鑾峰彇娲诲姩鑼冨洿
@@ -3446,9 +4192,43 @@
boolean sign = false;
if ( wrkMastSta.getStaEnd()!=0){//鏀�
BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
- if (!basDevp.getAutoing().equals("Y") || basDevp.getLoading().equals("Y")){
+ 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);//鎷嗙洏
}else {
continue;
@@ -3472,7 +4252,123 @@
break;
}
}
+// }
+ }catch (Exception e){
+ log.error("3933琛屾墽琛屽皬杞︽斁绌烘澘浠诲姟涓嬪彂澶辫触");
+ log.error("3933琛�"+e);
+ }
+ 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);
@@ -3483,18 +4379,18 @@
/**
* 鎵ц灏忚溅鎼繍浠诲姟
*/
- public synchronized boolean rgvRunWrkMastEmptyStaPutFull() {//婊℃斁
+ public synchronized boolean rgvRunWrkMastEmptyStaPutFull(RgvSlave rgvSlave) {//婊℃斁
try{
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
if (rgvProtocol == null) {
- continue;
+ return false;
}
BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
if (basRgv == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
- continue;
+ return false;
}
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾湁鐗�//rgv鍙敤
@@ -3502,13 +4398,22 @@
&& 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());
- continue;
+ return false;
}
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());//鑾峰彇娲诲姩鑼冨洿
@@ -3520,9 +4425,43 @@
boolean sign = false;
if ( wrkMastSta.getStaEnd()!=0){//婊℃斁
BasDevp basDevp = basDevpService.selectById(wrkMastSta.getStaEnd());
- if (!basDevp.getAutoing().equals("Y") || basDevp.getLoading().equals("Y")){
+ 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 = rgvPutEmptyFull(rgvProtocol.getRgvNo(),wrkMastSta);
}else {
continue;
@@ -3546,7 +4485,7 @@
break;
}
}
- }
+// }
}catch (Exception e){
log.error("3933琛屾墽琛屽皬杞︽斁绌烘澘浠诲姟涓嬪彂澶辫触");
log.error("3933琛�"+e);
@@ -3554,18 +4493,18 @@
return false;
}
- public synchronized boolean rgvRunWrkMastEmptyStaTake() {//鍙犵洏
+ public synchronized boolean rgvRunWrkMastEmptyStaTake(RgvSlave rgvSlave) {//鍙犵洏
try{
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
if (rgvProtocol == null) {
- continue;
+ return false;
}
BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
if (basRgv == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
- continue;
+ return false;
}
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾棤鐗�//rgv鍙敤
@@ -3573,13 +4512,22 @@
&& 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());
- continue;
+ return false;
}
List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
@@ -3594,6 +4542,30 @@
if (!basDevp.getAutoing().equals("Y") || !basDevp.getLoading().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()){
+ 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);//鍙犵洏
}else {
continue;
@@ -3617,7 +4589,7 @@
break;
}
}
- }
+// }
}catch (Exception e){
log.error("3989琛屾墽琛屽皬杞﹀彇绌烘澘浠诲姟涓嬪彂澶辫触");
log.error("3989琛�"+e);
@@ -3625,18 +4597,111 @@
return false;
}
- public synchronized boolean rgvRunWrkMastEmptyStaTakeFull() {//婊″彇
+ public synchronized boolean rgvRunWrkMastFullStaTake(RgvSlave rgvSlave) {//鍙犵洏
try{
- for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
+// 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()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
if (rgvProtocol == null) {
- continue;
+ return false;
}
BasRgv basRgv = basRgvService.selectById(rgvSlave.getId());
if (basRgv == null) {
log.error("{}鍙稲GV灏氭湭鍦ㄦ暟鎹簱杩涜缁存姢锛�", rgvSlave.getId());
- continue;
+ return false;
}
// 鍙湁褰揜GV绌洪棽銆佽嚜鍔�,宸ヤ綅浜屾棤鐗�//rgv鍙敤
@@ -3644,17 +4709,33 @@
&& 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());
- continue;
+ return false;
}
List<Integer> route = RouteUtils.getRoute(basRgvMap.getStartRoute(), basRgvMap.getEndRoute());
basRgvMap.setNowRoute(rgvProtocol.getRgvPosI()); //鏇存柊灏忚溅褰撳墠浣嶇疆绔欑偣鍙�
List<WrkMastSta> wrkMastStaList = wrkMastStaMapper.selectNoInterfereList(route, route);
+ WrkMast wrkMast = wrkMastMapper.selectBy122ManQu(122,110,15L);
+ if (!Cools.isEmpty(wrkMast)){
+ WrkMastSta wrkMastSta = wrkMastStaMapper.selectByWrkNo(wrkMast.getWrkNo().longValue());
+ if (!Cools.isEmpty(wrkMastSta) && wrkMastSta.getType()==2 && wrkMastSta.getWrkType()==5 ){
+ wrkMastStaList.add(wrkMastSta);
+ }
+ }
for (WrkMastSta wrkMastSta : wrkMastStaList){
if (wrkMastSta.getType()!=2 || wrkMastSta.getWrkType()!=5){// 2:绌烘澘 || 宸ヤ綔绫诲瀷 1:鍙栵紙鍙犵洏锛� 2锛氭媶鐩� 5锛氭弧鍙� 6锛氭弧鏀�
continue;
@@ -3665,6 +4746,20 @@
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 = rgvTakeEmptyFull(rgvProtocol.getRgvNo(),wrkMastSta);
}else {
continue;
@@ -3688,7 +4783,82 @@
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());
+ }
+ break;
+ }
+ }
+// }
}catch (Exception e){
log.error("3989琛屾墽琛屽皬杞﹀彇绌烘澘浠诲姟涓嬪彂澶辫触");
log.error("3989琛�"+e);
@@ -3701,10 +4871,17 @@
* */
public synchronized void rgvRunWrkMastEmptyStaAvoidance() {
try{
- Integer integer = wrkMastStaMapper.selectAllWrkStsCount(null,0);//鏌ヨ鐘舵�佷负0鐨勪换鍔�
- if (integer==0){
+// Integer integer = wrkMastStaMapper.selectAllWrkStsCount(null,0);//鏌ヨ鐘舵�佷负0鐨勪换鍔�
+// if (integer==0){
+// return;
+// }
+ WrkMastSta wrkMastSta = wrkMastStaMapper.selectAllWrkStsCountWrkMastSta(null, 0);
+ if (Cools.isEmpty(wrkMastSta)){
return;
}
+ boolean signRgv = true;
+ boolean signRgv1 = true;
+ boolean signRgv2 = true;
for (RgvSlave rgvSlave:slaveProperties.getRgv()) {
RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
@@ -3720,25 +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 (rgvProtocol.getRgvNo()!=1){
+ if (!rgvProtocol.getRgvPosI().equals(120) && !rgvProtocol.getRgvPosI().equals(110)){
+ continue;
+ }
+ rgvAvoidanceXY(rgvProtocol.getRgvNo());
+// return;
continue;
}
- 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) ) ){
+ 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());
- rgvMapUpdate(basRgvMap,basRgvMap.getStartRoute(),basRgvMap.getStartRoute());
+ 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());
+//
+// }
+// }
+// }
}catch (Exception e){
log.error("4109琛屾墽琛屽皬杞﹀垵濮嬪寲浠诲姟涓嬪彂澶辫触");
log.error("4109琛�"+e);
@@ -3765,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());
}
@@ -3784,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缂栧彿
@@ -3794,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浠诲姟鍙�
@@ -3809,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浠诲姟鍙�
@@ -3837,6 +5204,9 @@
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFullAll(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3863,6 +5233,9 @@
* 灏忚溅鍙栬揣鑷冲伐浣嶄换鍔�
* */
public synchronized boolean rgvTakeFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3888,6 +5261,9 @@
* 灏忚溅鏀捐揣鑷宠緭閫佺嚎浠诲姟
* */
public synchronized boolean rgvPutFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3913,6 +5289,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 鍙犵洏
* */
public synchronized boolean rgvTakeEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3938,6 +5317,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //鎷嗙洏
* */
public synchronized boolean rgvPutEmpty(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3963,6 +5345,9 @@
* 灏忚溅鍙栫┖鏉胯嚦宸ヤ綅浠诲姟 婊″彇
* */
public synchronized boolean rgvTakeEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -3988,6 +5373,9 @@
* 灏忚溅鏀剧┖鏉胯嚦杈撻�佺嚎浠诲姟 //婊℃斁
* */
public synchronized boolean rgvPutEmptyFull(Integer rgvId,WrkMastSta wrkMastSta){
+ if (rgvId>20){
+ rgvId = rgvId-20;
+ }
try{
// 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
RgvCommand rgvCommand = new RgvCommand();
@@ -4013,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()))) {
@@ -4030,25 +5421,58 @@
}
/*
+ * 灏忚溅澶嶄綅
+ * */
+ 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{
Integer farCurrentStaNo = RouteUtils.RouteIndexFarMas(basRgvMapCurrent.getNowRoute(), staStart, staEnd, basRgvMapCurrent.getLockStartRoute());//鑾峰彇鏈�杩滅珯鐐�
+// 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("灏忚溅鍦板浘鏇存柊鍑洪敊锛�");
@@ -4056,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