From 7c6fb7f8113dc85dc74d41e5a6a80adf7edcc2a1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 19 九月 2022 14:35:58 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 95 insertions(+), 4 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 a11a2ea..d2893de 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -427,6 +427,8 @@
crnProtocol.setLastIo("O");
}
}
+ // 搴撲綅绉昏浆
+ this.locToLoc(crn, crnProtocol);
}
}
}
@@ -772,6 +774,99 @@
}
}
return false;
+ }
+
+ /**
+ * 搴撲綅绉昏浆
+ */
+ public void locToLoc(CrnSlave slave, CrnProtocol crnProtocol){
+ // 鑾峰彇宸ヤ綔妗d俊鎭�
+ WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId());
+ if (null == wrkMast) {
+ return;
+ }
+ // 鑾峰彇婧愬簱浣嶄俊鎭�
+ LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
+ if (null == sourceSta) {
+ log.error("宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈡簮搴撲綅澶辫触锛佸伐浣滃彿={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
+ return;
+ }
+ // 婧愬簱浣� 搴撲綅鐘舵�佸垽鏂�
+ if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("S")) {
+ return;
+ }
+ // 鑾峰彇鐩爣搴撲綅淇℃伅
+ LocMast sta = locMastService.selectById(wrkMast.getLocNo());
+ if (null == sta) {
+ log.error("宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈢洰鏍囧簱浣嶅け璐ワ紒宸ヤ綔鍙�={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getLocNo());
+ return;
+ }
+ // 鑾峰彇鍫嗗灈鏈轰俊鎭� 骞� 鍒ゆ柇鏄惁鍙叆鍑�
+ BasCrnp basCrnp = basCrnpService.selectById(slave.getId());
+ if (!basCrnp.getInEnable().equals("Y") && !basCrnp.getOutEnable().equals("Y")) {
+ return;
+ }
+
+ // 鍫嗗灈鏈烘帶鍒惰繃婊�
+ if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
+ return;
+ }
+
+ // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
+ if (wrkMastMapper.selectWorking(slave.getId()) != null) {
+ return;
+ }
+
+
+
+ // 婧愬簱浣� ===>> 鏈�澶栧眰搴撲綅
+ if (locMastService.isOutMost(wrkMast.getSourceLocNo())) {
+ // 鐩爣搴撲綅 ===>> 鏈�澶栧眰搴撲綅
+ if (locMastService.isOutMost(wrkMast.getLocNo())) {
+ // 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
+ crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+ crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡: 搴撲綅绉昏浆
+ crnCommand.setSourcePosX(sourceSta.getRow1().shortValue()); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY(sourceSta.getBay1().shortValue()); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue()); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX(sta.getRow1().shortValue()); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY(sta.getBay1().shortValue()); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ(sta.getLev1().shortValue()); // 鐩爣搴撲綅灞�
+ if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
+ log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+ } else {
+ // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 16.鍚婅溅鍑哄簱涓�
+ Date now = new Date();
+ wrkMast.setWrkSts(16L);
+ wrkMast.setCrnStrTime(now);
+ wrkMast.setModiTime(now);
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ log.error("銆愬簱浣嶇Щ杞�� 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+ }
+ }
+ } else {
+
+
+
+ }
+
+ } else {
+
+ }
+
+
+
+
+
+
+
+
+
+
+
}
/**
@@ -1545,9 +1640,5 @@
}
}
}
-
-
-
-
}
--
Gitblit v1.9.1