From 5f685f89bf6501325b6129ecf709b988369eeedd Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 13 十月 2023 10:16:49 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 356 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 280 insertions(+), 76 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 8520b78..d516740 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -3,6 +3,7 @@
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.exception.CoolException;
import com.zy.asrs.entity.*;
@@ -224,7 +225,7 @@
param.setBarcode(barcode);
param.setIoType(1);
param.setSourceStaNo(inSta.getStaNo());
-// param.setLocType1(locTypeDto.getLocType1());
+ param.setLocType1(locTypeDto.getLocType1());
String response = new HttpHandler.Builder()
.setUri(wmsUrl)
.setPath("/rpc/pakin/loc/v1")
@@ -236,8 +237,8 @@
Integer code = jsonObject.getInteger("code");
if (code.equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-// // plc 澶勭悊
-// barcodeThread.setBarcode("");
+ // plc 澶勭悊
+ barcodeThread.setBarcode("");
// staProtocol.setWorkNo(dto.getWorkNo().shortValue());
// staProtocol.setStaNo(dto.getStaNo().shortValue());
// devpThread.setPakMk(staProtocol.getSiteId(), false);
@@ -405,8 +406,8 @@
}
if (staProtocol.isAutoing()
&& staProtocol.isLoading()
- && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
- && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
+// && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999)
+// && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue())
&& staProtocol.isPakMk()){
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
@@ -507,12 +508,18 @@
}
String sourceLocNo = wrkMast.getSourceLocNo().trim();
+ LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯
+ if (liftStaProtocol == null) {
+ continue;
+ }
+
// 鏇存柊宸ヤ綔妗f暟鎹姸鎬�
wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54,107->57
wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵��: 2.璁惧涓婅蛋
wrkMast.setSourceStaNo(pickSta.getStaNo()); // 婧愮珯
- wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
- wrkMast.setCrnNo(dto.getCrnNo());
+// wrkMast.setStaNo(dto.getStaNo()); // 鐩爣绔�
+// wrkMast.setCrnNo(dto.getCrnNo());
+ wrkMast.setStaNo(liftStaProtocol.getStaNo());//鐩爣绔�
wrkMast.setLocNo(sourceLocNo); // 鐩爣搴撲綅 = 鍑哄簱鏃剁殑婧愬簱浣�
wrkMast.setShuttleNo(null); // 绌挎杞︽竻绌�
wrkMast.setModiTime(new Date());
@@ -531,14 +538,16 @@
throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
}
- // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
- staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
- staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- if (!result) {
- News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
- }
+// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
+// staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
+// staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// if (!result) {
+// News.error("鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+// }
+
+ barcodeThread.setBarcode("");//娓呯悊鏉$爜
} else if (code == 500){
if (ledThread != null) {
@@ -549,10 +558,10 @@
}
News.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
} else {
- staProtocol.setWorkNo((short) 32002);
- staProtocol.setStaNo(pickSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// staProtocol.setWorkNo((short) 32002);
+// staProtocol.setStaNo(pickSta.getBackSta().shortValue());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
// led 寮傚父鏄剧ず
if (ledThread != null) {
@@ -689,38 +698,6 @@
continue;
}
}
-
-
-
-
- // 鏍规嵁杈撻�佺嚎plc閬嶅巻
- for (DevpSlave devp : slaveProperties.getDevp()) {
- // 閬嶅巻鍏ュ簱绔�
- for (DevpSlave.StaRack staRack : devp.getRackInStn()) {
- // 鑾峰彇鍏ュ簱绔欎俊鎭�
- DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
- StaProtocol staProtocol = devpThread.getStation().get(staRack.getStaNo());
- if (staProtocol == null) {
- continue;
- } else {
- staProtocol = staProtocol.clone();
- }
- Short workNo = staProtocol.getWorkNo();
- BasDevp basDevp = basDevpService.selectById(staProtocol.getSiteId());
- if (basDevp == null) {
- continue;//绔欑偣淇℃伅涓嶅瓨鍦�
- }
-
- // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢锛岃嚜鍔ㄣ�佹湁鐗┿�佸洓鍚戠┛姊溅鍙彇淇″彿
- if (!(staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isShuttleTakeEnable())) {
- continue;
- }
-
-
-
- }
- }
-
}
// /**
@@ -792,6 +769,12 @@
//鍒ゆ柇灏忚溅浠ょ墝鏄惁鏈鍗犻
if (shuttleProtocol.getToken() != 0) {
return false;//灏忚溅宸茶鐙崰锛岀姝㈠啀娲惧彂浠诲姟
+ }
+
+ //鍒ゆ柇灏忚溅鏄惁瀛樺湪绉诲姩浠诲姟
+ WrkMast hasMoveWorking = wrkMastMapper.selectShuttleHasMoveWorking(wrkMast.getShuttleNo());
+ if (hasMoveWorking != null) {
+ return false;//瀛樺湪绉诲姩浠诲姟锛岀姝㈡墽琛屽叆搴撲换鍔�
}
//鍒ゆ柇灏忚溅鏄惁鍒拌揪杈撻�佺珯鐐瑰簱浣�
@@ -1161,6 +1144,12 @@
//鑾峰彇鎻愬崌鏈哄懡浠�
NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
+ if (wrkMast.getIoType() == 53) {
+ //鎷f枡鍐嶅洖搴擄紝閲嶆柊鍒嗛厤璁惧宸ヤ綔鍙�
+ Random random = new Random();
+ int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//鑾峰彇璁惧宸ヤ綔鍙�
+ liftCommand.setTaskNo((short) deviceWrk);
+ }
ArrayList<NyLiftCommand> commands = new ArrayList<>();
commands.add(liftCommand);
@@ -1196,6 +1185,11 @@
//23.灏忚溅鎼繍瀹屾垚 ==> 24.鎻愬崌鏈烘惉杩愪腑
if (wrkMast.getWrkSts() == 23) {
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo());
+ if (shuttleThread == null) {
+ return false;
+ }
+
//鑾峰彇鍑哄簱绔欑偣(鐩爣绔�)
BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo());
if (basDevp == null) {
@@ -1214,6 +1208,7 @@
if (liftProtocol == null) {
return false;
}
+
if (!liftProtocol.isIdle()) {
return false;
}
@@ -1233,6 +1228,16 @@
return false;//鎵句笉鍒扮珯鐐�
}
Integer startSta = liftStaProtocol.getStaNo();
+
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) {
+ //灏忚溅杩樺湪杈撻�佺珯鐐�
+ //璋冨害灏忚溅閬胯
+ boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread);
+ if (!result) {
+ return false;
+ }
+ }
//鑾风洰鏍囩珯婧愮珯瀵瑰簲鐨勮緭閫佺珯鐐�
BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo());
@@ -1293,7 +1298,7 @@
case 3://3.鎻愬崌鏈烘惉杩愪腑 ==> 4.鎻愬崌鏈烘惉杩愬畬鎴�
wrkMast.setWrkSts(4L);
wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
- if (liftProtocol.getToken() == wrkMast.getWrkNo()) {
+ if (liftProtocol.getToken().equals(wrkMast.getWrkNo())) {
//閲婃斁鎻愬崌鏈轰护鐗�
liftProtocol.setToken(0);
}
@@ -1307,6 +1312,12 @@
//閲婃斁鎻愬崌鏈轰护鐗�
liftProtocol.setToken(0);
}
+
+ if (wrkMast.getMk() == null || !wrkMast.getMk().equals("Y")) {
+ //涓嶉渶瑕佺敤鍒版満姊拌噦锛岀洿鎺ヨ浆29.鍑哄簱瀹屾垚
+ wrkMast.setWrkSts(29L);
+ }
+
break;
case 106://106.鎻愬崌鏈烘惉杩愪腑 ==> 107.鎻愬崌鏈烘惉杩愬畬鎴�
wrkMast.setWrkSts(107L);
@@ -1371,7 +1382,7 @@
continue;
}
- boolean step4 = this.locToLocExecuteStep4(wrkMast);//璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鍑哄簱鍙�
+ boolean step4 = this.locToLocExecuteStep4(wrkMast);//璋冨害杞﹁締鍙栬揣骞惰繍閫佸埌鐩爣搴撲綅
if (!step4) {
continue;
}
@@ -1893,6 +1904,13 @@
}
}
+ if (!Cools.isEmpty(barcode)) {
+ WrkMast wrkMast = wrkMastMapper.selectByBarcode(barcode);//鏉$爜瀛樺湪宸ヤ綔妗�
+ if (wrkMast != null) {
+ continue;
+ }
+ }
+
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, emptyInSta.getLed());
try {
@@ -1915,7 +1933,7 @@
Integer code = jsonObject.getInteger("code");
if (code.equals(200)) {
StartupDto dto = jsonObject.getObject("data", StartupDto.class);
-
+ barcodeThread.setBarcode("");
// // 鏇存柊绔欑偣淇℃伅 涓� 涓嬪彂plc鍛戒护
// staProtocol.setWorkNo(dto.getWorkNo().shortValue());
// staProtocol.setStaNo(dto.getStaNo().shortValue());
@@ -1954,6 +1972,9 @@
// 鑾峰彇鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
StaProtocol staProtocol = devpThread.getStation().get(300);
+ if (staProtocol == null) {
+ continue;
+ }
if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() != 0) {
//鏌ヨ鏄惁鏈夊伐浣滄。
WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
@@ -1965,7 +1986,7 @@
continue;
}
- if (wrkMast.getMk().equals("Y")) {//鏍囪涓篩琛ㄧず闇�瑕佺敤鍒版満姊拌噦鎷f枡
+ if (wrkMast.getMk() != null && wrkMast.getMk().equals("Y")) {//鏍囪涓篩琛ㄧず闇�瑕佺敤鍒版満姊拌噦鎷f枡
Short targetSta = null;//鐩爣绔�
//鍒ゆ柇鏈烘鑷傛嫞鏂欑珯鏄惁绌洪棽
StaProtocol staProtocol303 = devpThread.getStation().get(303);
@@ -1982,19 +2003,56 @@
targetSta = (short) 317;
- //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
- wrkMast.setStaNo(targetSta.intValue());
- if (wrkMastMapper.updateById(wrkMast) > 0) {
- //鍚�300绔欏啓鍏ョ洰鏍囩珯
- staProtocol = staProtocol.clone();
- staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯
- boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
- try {
- Thread.sleep(500);
- } catch (Exception e) {
- e.printStackTrace();
+ if (wrkMast.getStaNo() != 303 && wrkMast.getStaNo() != 317) {
+ //鍚慉GV鍙戣捣缁勬墭璇锋眰
+// try {
+// HashMap<String, Object> param = new HashMap<>();
+// param.put("wrkNo", wrkMast.getWrkNo());
+// String response = new HttpHandler.Builder()
+// .setUri(wmsUrl)
+// .setPath("/openAGV")
+// .setJson(JSON.toJSONString(param))
+// .build()
+// .doPost();
+// JSONObject jsonObject = JSON.parseObject(response);
+// Integer code = jsonObject.getInteger("code");
+// if (code.equals(200)) {//AGV缁勬墭鎴愬姛
+// //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
+// wrkMast.setStaNo(targetSta.intValue());
+// wrkMast.setShuttleNo(null);//閲婃斁灏忚溅
+// if (wrkMastMapper.updateById(wrkMast) > 0) {
+// //鍚�300绔欏啓鍏ョ洰鏍囩珯
+// staProtocol = staProtocol.clone();
+// staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯
+// boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// try {
+// Thread.sleep(500);
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// continue;
+// }
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+// }
+
+ //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
+ wrkMast.setStaNo(targetSta.intValue());
+ wrkMast.setShuttleNo(null);//閲婃斁灏忚溅
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //鍚�300绔欏啓鍏ョ洰鏍囩珯
+ staProtocol = staProtocol.clone();
+ staProtocol.setStaNo(targetSta);//绉诲姩鍒扮洰鏍囩珯
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ try {
+ Thread.sleep(500);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ continue;
}
- continue;
}
}
}
@@ -2008,11 +2066,17 @@
if (wrkMast == null) {
continue;
}
- WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
- if (wrkDetl == null) {
+ List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
+ if (wrkDetls.isEmpty()) {
continue;
}
- RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "303");
+
+ if (wrkMast.getInvWh() == null) {
+ wrkMast.setInvWh("Y");//鏍囪宸茬粡涓嬪彂鏈烘鑷備换鍔�
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303");
+ }
+ }
}else if (staProtocol317.isAutoing() && staProtocol317.isLoading() && staProtocol317.getWorkNo() != 0) {
//璋冨害鏈烘鑷�
//鏌ヨ鏄惁鏈夊伐浣滄。
@@ -2020,11 +2084,123 @@
if (wrkMast == null) {
continue;
}
- WrkDetl wrkDetl = wrkDetlService.selectById(wrkMast.getWrkNo());
- if (wrkDetl == null) {
+ List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
+ if (wrkDetls.isEmpty()) {
continue;
}
- RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetl.getAnfme().intValue(), "317");
+ if (wrkMast.getInvWh() == null) {
+ wrkMast.setInvWh("Y");//鏍囪宸茬粡涓嬪彂鏈烘鑷備换鍔�
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ RobotUtils.sendTask(staProtocol317.getWorkNo().toString(), wrkDetls.size(), "317");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * AGV琛ヨ揣(閫氱煡AGV鍙栬揣)
+ */
+ public void agvRestockInto() {
+ //妫�娴�309鍜�312绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗�
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol309 = devpThread.getStation().get(309);
+ StaProtocol staProtocol312 = devpThread.getStation().get(312);
+ if (staProtocol309 == null || staProtocol312 == null) {
+ continue;
+ }
+
+ if (staProtocol309.isAutoing() && staProtocol309.isLoading()) {
+ // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11);//308绔欐潯鐮佸櫒
+ if (barcodeThread == null) {
+ continue;
+ }
+ String barcode = barcodeThread.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ //閫氱煡AGV鍙栬揣
+ agvRestockCall("CS-301-001-01@3", barcode);
+ }
+ } else if (staProtocol312.isAutoing() && staProtocol312.isLoading()) {
+ // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+ BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 12);//311绔欐潯鐮佸櫒
+ if (barcodeThread == null) {
+ continue;
+ }
+ String barcode = barcodeThread.getBarcode();
+ if(!Cools.isEmpty(barcode)) {
+ //閫氱煡AGV鍙栬揣
+ agvRestockCall("CS-302-001-01@3", barcode);
+ }
+ }
+ }
+ }
+
+ //閫氱煡AGV鍙栬揣
+ private boolean agvRestockCall(String staNo, String barcode) {
+ try {
+ HashMap<String, Object> param = new HashMap<>();
+ param.put("staNo", staNo);
+ param.put("barcode", barcode);
+ String response = new HttpHandler.Builder()
+ .setUri(wmsUrl)
+ .setPath("/callAGV")
+ .setJson(JSON.toJSONString(param))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ Integer code = jsonObject.getInteger("code");
+ if (code.equals(200)) {//鍛煎彨AGV
+ return true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ }
+ return false;
+ }
+
+ // 300绔欐嫞鏂�
+ public void pick300() {
+ //妫�娴�300绔欐槸鍚﹁嚜鍔ㄣ�佹湁鐗┿�佸伐浣滃彿
+ for (DevpSlave devp : slaveProperties.getDevp()) {
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ StaProtocol staProtocol = devpThread.getStation().get(300);
+ if (staProtocol == null) {
+ continue;
+ }
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() != 0) {
+ //鏌ヨ鏄惁鏈夊伐浣滄。
+ WrkMast wrkMast = wrkMastMapper.selectByWorkNo(staProtocol.getWorkNo().intValue());
+ if (wrkMast == null) {
+ continue;
+ }
+
+ if (wrkMast.getWrkSts() != 25) {//25.鎻愬崌鏈烘惉杩愬畬鎴�
+ continue;
+ }
+
+ if (wrkMast.getMk() == null) {
+ Integer sourceStaNo = wrkMast.getSourceStaNo();//婧愮珯
+ Integer staNo = wrkMast.getStaNo();//鐩爣绔�
+ //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
+ wrkMast.setStaNo(sourceStaNo);
+ wrkMast.setSourceStaNo(staNo);
+ if (wrkMastMapper.updateById(wrkMast) > 0) {
+ //鍚�300绔欏啓鍏ョ洰鏍囩珯
+ staProtocol = staProtocol.clone();
+ staProtocol.setStaNo(wrkMast.getStaNo().shortValue());//绉诲姩鍒扮洰鏍囩珯
+ boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+ try {
+ Thread.sleep(500);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
}
}
@@ -2468,7 +2644,7 @@
}
//鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
- NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo());
+ NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id);
List<NyShuttleHttpCommand> commands = result.getCommands();
ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
@@ -2580,7 +2756,8 @@
NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), sourceLiftSta.getStaNo(), wrkMast.getWrkNo());
Random random = new Random();
- liftCommand.setTaskNo((short) Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999))));//鏇存崲闅忔満浠诲姟鍙�
+ int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//鑾峰彇璁惧宸ヤ綔鍙�
+ liftCommand.setTaskNo((short) deviceWrk);//鏇存崲闅忔満浠诲姟鍙�
ArrayList<NyLiftCommand> commands = new ArrayList<>();
commands.add(liftCommand);
@@ -2902,8 +3079,35 @@
// NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
// liftNode.setZ(basLift.getPoint$().getZ());
+ //灏忚溅宸茬粡鍦ㄧ洰鏍囧簱浣嶏紝鐩存帴璁ゅ畾灏忚溅绉诲姩浠诲姟瀹屾垚
+ if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) {
+ if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
+ //閲婃斁灏忚溅浠ょ墝
+ shuttleProtocol.setToken(0);
+ }
+ wrkMast.setWrkSts(111L);//111.灏忚溅绉诲姩瀹屾垚
+ wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
+ wrkMast.setModiTime(now);
+ wrkMastMapper.updateById(wrkMast);
+
+ shuttleProtocol.setShuttleNo((short) 0);//閲婃斁灏忚溅
+ shuttleProtocol.setToken(0);//閲婃斁灏忚溅
+
+ if (wrkMast.getWrkSts() == 111) {
+ // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+ if (wrkMastLocMapper.save(wrkMast.getWrkNo()) <= 0) {
+ log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={0}]澶辫触", wrkMast.getWrkNo());
+ }
+ // 鍒犻櫎宸ヤ綔涓绘。
+ if (!wrkMastService.deleteById(wrkMast)) {
+ log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={0}]澶辫触", wrkMast.getWrkNo());
+ }
+ }
+ return false;
+ }
+
//鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠�
- NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo());
+ NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id);
if (result == null) {
return false;//璺緞璁$畻澶辫触
}
--
Gitblit v1.9.1