From c1c6e4385c986ac63d7884cfaa818e05207005c9 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 15 六月 2023 17:36:08 +0800
Subject: [PATCH] 出入库代码(暂)
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 518 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 301 insertions(+), 217 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 247c1eb..bbca4a3 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -4,7 +4,6 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
-import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.*;
@@ -60,13 +59,13 @@
@Autowired
private StaDescService staDescService;
@Autowired
- private BasCrnpService basCrnpService;
- @Autowired
private BasDevpService basDevpService;
@Autowired
private BasErrLogService basErrLogService;
@Autowired
private BasSteErrLogService basSteErrLogService;
+ @Autowired
+ private BasShuttleService basShuttleService;
@Autowired
private BasShuttleErrLogService basShuttleErrLogService;
@Autowired
@@ -152,11 +151,12 @@
}
continue;
}
+
// 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
if (staProtocol.isAutoing() && staProtocol.isLoading()
&& staProtocol.isInEnable()
&& !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999))
- && staProtocol.isPakMk()) {
+ ) {
// 鑾峰彇鏉$爜鎵弿浠俊鎭�
BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
@@ -167,10 +167,10 @@
if(!Cools.isEmpty(barcode)) {
// News.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode)|| "00000000".equals(barcode)) {
- staProtocol.setWorkNo((short) 32002);
- staProtocol.setStaNo(inSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// staProtocol.setWorkNo((short) 32002);
+// staProtocol.setStaNo(inSta.getBackSta().shortValue());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
// led 寮傚父鏄剧ず
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
@@ -181,10 +181,10 @@
continue;
}
} else {
- staProtocol.setWorkNo((short) 32002);
- staProtocol.setStaNo(inSta.getBackSta().shortValue());
- devpThread.setPakMk(staProtocol.getSiteId(), false);
- MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
+// staProtocol.setWorkNo((short) 32002);
+// staProtocol.setStaNo(inSta.getBackSta().shortValue());
+// devpThread.setPakMk(staProtocol.getSiteId(), false);
+// MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
// led 寮傚父鏄剧ず
LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
@@ -235,6 +235,18 @@
if (!result) {
throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
}
+
+ // 鍒ゆ柇閲嶅宸ヤ綔妗�
+ WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
+ if (wrkMast == null) { continue; }
+
+ // 鏇存柊宸ヤ綔涓绘。
+ wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵�侊細2.璁惧涓婅蛋
+ wrkMast.setModiTime(new Date());
+ if (wrkMastMapper.updateById(wrkMast) == 0) {
+ News.error("鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", wrkMast.getWrkNo());
+ }
+
} else if (code == 500){
if (ledThread != null) {
String errorMsg = jsonObject.getString("msg");
@@ -595,6 +607,9 @@
continue;
}
LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+ if (liftProtocol == null) {
+ continue;
+ }
if (!liftProtocol.isIdle()) {
continue;
}
@@ -602,7 +617,6 @@
//鎻愬崌鏈哄浜庣┖闂茬姸鎬侊紝杩涜浠诲姟鐨勬仮澶�
liftProtocol.setTaskNo(redisCommand.getWrkNo());//灏嗘彁鍗囨満绾跨▼鍒嗛厤浠诲姟鍙�
liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);//宸ヤ綔鐘舵��
- liftProtocol.setLiftLock(true);//鎻愬崌鏈洪攣瀹�
}else if(key.toString().contains("shuttle_wrk_no_")){//鍥涘悜绌挎杞︿换鍔�
ShuttleRedisCommand redisCommand = JSON.parseObject(map.get(key).toString(), ShuttleRedisCommand.class);
@@ -616,6 +630,9 @@
continue;
}
ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ continue;
+ }
if (!shuttleProtocol.isIdle()) {
continue;
}
@@ -635,19 +652,10 @@
// 鏍规嵁杈撻�佺嚎plc閬嶅巻
for (DevpSlave devp : slaveProperties.getDevp()) {
// 閬嶅巻鍏ュ簱绔�
- for (DevpSlave.StaRack rackInStn : devp.getRackInStn()) {
+ for (DevpSlave.StaRack staRack : devp.getRackInStn()) {
// 鑾峰彇鍏ュ簱绔欎俊鎭�
DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-
- StaProtocol staProtocol = devpThread.getStation().get(rackInStn.getStaNo());
- StaProtocol staProtocol105 = devpThread.getStation().get(105);
- staProtocol105.setWorkNo((short) 752);
- staProtocol105.setStaNo((short) 100);
-
- StaProtocol staProtocol106 = devpThread.getStation().get(106);
- staProtocol106.setWorkNo((short) 753);
- staProtocol106.setStaNo((short) 100);
-
+ StaProtocol staProtocol = devpThread.getStation().get(staRack.getStaNo());
if (staProtocol == null) {
continue;
} else {
@@ -655,8 +663,8 @@
}
Short workNo = staProtocol.getWorkNo();
- // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
- if (true || staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()) {
+ // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢锛岃嚜鍔ㄣ�佹湁鐗┿�佸洓鍚戠┛姊溅鍙彇淇″彿
+ if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isShuttleTakeEnable()) {
WrkMast wrkMast = wrkMastMapper.selectRackInStep48(workNo, staProtocol.getSiteId());
if (wrkMast != null) {
if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 8) {
@@ -697,18 +705,15 @@
assignCommand.setSourceLocNo(currentLocNo);//婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
String locNo = wrkMast.getLocNo();//褰撳墠宸ヤ綔妗e簱浣嶅彿
- Integer lev = Integer.parseInt(locNo.substring(locNo.length() - 2, locNo.length()));//褰撳墠宸ヤ綔妗e簱浣嶅眰楂�
- Integer currentLev = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));//灏忚溅褰撳墠灞傞珮
+ Integer currentLev = Utils.getLev(currentLocNo);//灏忚溅褰撳墠灞傞珮
- //鑾峰彇鎻愬崌鏈�
- LiftSlave liftSlave = slaveProperties.getLift().get(0);
- //鎻愬崌鏈哄簱浣嶅彿
- String liftLocNo = liftSlave.getLiftLocNo(currentLev);
+ //鎻愬崌鏈哄彛绔欑偣搴撲綅鍙�
+ String liftSiteLocNo = Utils.levToOutInStaLocNo(currentLev);
if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
//鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
//鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand,shuttleThread);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftSiteLocNo, locNo, assignCommand,shuttleThread);
if (wrkMast.getWrkSts() == 8) {
//姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
@@ -716,7 +721,7 @@
Short distCode = commands.get(0).getStartCodeNum();//鎻愬崌鏈哄彛浜岀淮鐮�
Short runDirection = commands.get(0).getRunDirection();//杩愯鏂瑰悜
//鑾峰彇鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, runDirection);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, runDirection, (short) 1, 0);
commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
}
assignCommand.setCommands(commands);
@@ -729,11 +734,11 @@
//涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿
//灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftSiteLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
//鍒嗛厤鐩爣搴撲綅
- shuttleProtocol.setLocNo(liftLocNo);
+ shuttleProtocol.setLocNo(liftSiteLocNo);
//鐩爣搴撲綅
- assignCommand.setLocNo(liftLocNo);
+ assignCommand.setLocNo(liftSiteLocNo);
assignCommand.setCommands(commands);
wrkMast.setWrkSts(5L);//灏忚溅杩佺Щ鐘舵��
}
@@ -752,8 +757,18 @@
}
- //鑾峰彇璧风偣-缁堢偣鎸囦护銆俶apType锛�1=銆嬫棤璐у湴鍥撅紝2=銆嬫湁璐у湴鍥�
+ //鑾峰彇璧风偣-缁堢偣鎸囦护銆俶apType锛�0=>鏃犺揣鐗╁湴鍥撅紝1=銆嬫惡甯﹁揣鐗╁嚭鍏ュ簱鍦板浘
public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
+ //鑾峰彇灏忚溅绉诲姩閫熷害
+ BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo());
+ Integer runSpeed = 1000;
+ if (basShuttle != null) {
+ Integer runSpeed1 = basShuttle.getRunSpeed();
+ if (runSpeed1 != null) {
+ runSpeed = runSpeed1;
+ }
+ }
+
//璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType);
List<ShuttleCommand> commands = new ArrayList<>();
@@ -770,15 +785,20 @@
for (ArrayList<NavigateNode> nodes : data) {
//寮�濮嬭矾寰�
NavigateNode startPath = nodes.get(0);
+ //涓棿璺緞
+ NavigateNode middlePath = nodes.get(nodes.size() - 2);
//鐩爣璺緞
NavigateNode endPath = nodes.get(nodes.size() - 1);
Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ Short middleCodeNum = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
//鑾峰彇绉诲姩鍛戒护
- ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
+ ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCodeNum, middleToDistDistance, runSpeed);
commands.add(command);
}
@@ -792,33 +812,47 @@
//鑾峰彇璧风偣-涓偣-缁堢偣鎸囦护
public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNo, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
- //璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
- List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, 1);//灏忚溅鏃犺揣锛岃蛋鍏ュ簱鍦板浘
- List<ShuttleCommand> commands = new ArrayList<>();
- if (calc == null) {
- return null;
+ //鑾峰彇灏忚溅绉诲姩閫熷害
+ BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo());
+ Integer runSpeed = 1000;
+ if (basShuttle != null) {
+ Integer runSpeed1 = basShuttle.getRunSpeed();
+ if (runSpeed1 != null) {
+ runSpeed = runSpeed1;
+ }
}
List<NavigateNode> allNode = new ArrayList<>();
- allNode.addAll(calc);
- //鑾峰彇鍒嗘璺緞
- ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc);
- //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
- for (ArrayList<NavigateNode> nodes : data) {
- //寮�濮嬭矾寰�
- NavigateNode startPath = nodes.get(0);
- //鐩爣璺緞
- NavigateNode endPath = nodes.get(nodes.size() - 1);
- Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ //璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
+ List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, 1);//灏忚溅鏃犺揣锛岃蛋鍏ュ簱鍦板浘
+ List<ShuttleCommand> commands = new ArrayList<>();
- //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
- Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
- //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
- Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
- //鑾峰彇绉诲姩鍛戒护
- ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
- commands.add(command);
+ if (calc != null) {
+ allNode.addAll(calc);
+ //鑾峰彇鍒嗘璺緞
+ ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc);
+ //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+ for (ArrayList<NavigateNode> nodes : data) {
+ //寮�濮嬭矾寰�
+ NavigateNode startPath = nodes.get(0);
+ //涓棿璺緞
+ NavigateNode middlePath = nodes.get(nodes.size() - 2);
+ //鐩爣璺緞
+ NavigateNode endPath = nodes.get(nodes.size() - 1);
+ Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
+
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ Short middleCodeNum = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
+ //鑾峰彇绉诲姩鍛戒护
+ ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCodeNum, middleToDistDistance, runSpeed);
+ commands.add(command);
+ }
}
//灏忚溅鎸囦护鍒拌揪鐩爣浣嶇疆鍚庯紝鍐嶅彂鍑轰竴鏉¢《鍗囨寚浠�
@@ -837,15 +871,20 @@
for (ArrayList<NavigateNode> nodes : data2) {
//寮�濮嬭矾寰�
NavigateNode startPath = nodes.get(0);
+ //涓棿璺緞
+ NavigateNode middlePath = nodes.get(nodes.size() - 2);
//鐩爣璺緞
NavigateNode endPath = nodes.get(nodes.size() - 1);
Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+ Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+ Short middleCodeNum = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());
+ //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCodeNum, middleToDistDistance, runSpeed);
commands.add(moveCommand);
}
@@ -915,11 +954,11 @@
String currentLocNo = shuttleProtocol.getCurrentLocNo();
//灏忚溅褰撳墠灞傞珮
- Integer currentLev = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
+ Integer currentLev = Utils.getLev(currentLocNo);
//鑾峰彇鎻愬崌鏈�
LiftSlave liftSlave = slaveProperties.getLift().get(0);
- //鎻愬崌鏈哄簱浣嶅彿
- String liftLocNo = liftSlave.getLiftLocNo(currentLev);
+ //褰撳墠妤煎眰鎻愬崌鏈鸿緭閫佺珯鐐瑰簱浣嶅彿
+ String liftSiteLocNo = Utils.levToOutInStaLocNo(currentLev);
//鍒嗛厤浠诲姟鍙�
shuttleProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());
@@ -939,8 +978,11 @@
//鍒ゆ柇灏忚溅鍜屽簱浣嶆槸鍚﹀湪鍚屼竴灞�
if (Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
//鍚屼竴灞�(灏嗗皬杞︾Щ鍔ㄥ埌璐х墿浣嶇疆)
-
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftSiteLocNo, assignCommand, shuttleThread);
+ if (commands == null) {
+ //鏈壘鍒拌矾寰勶紝绛夊緟涓嬩竴娆�
+ continue;
+ }
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
//鐩爣搴撲綅
@@ -951,21 +993,21 @@
//涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿(灏嗗皬杞︾Щ鍔ㄥ埌鎻愬崌鏈轰綅缃�)
//灏忚溅鍒版彁鍗囨満鍙f寚浠�
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
- shuttleProtocol.setLocNo(liftLocNo);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftSiteLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
+ shuttleProtocol.setLocNo(liftSiteLocNo);
//鐩爣搴撲綅
- assignCommand.setLocNo(liftLocNo);
+ assignCommand.setLocNo(liftSiteLocNo);
assignCommand.setCommands(commands);
wrkMast.setWrkSts(22L);//灏忚溅杩佺Щ鐘舵��
}
} else if (wrkMast.getWrkSts() == 25) {
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftSiteLocNo, assignCommand, shuttleThread);
//姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
short startCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈轰簩缁寸爜
Short distCode = commands.get(0).getStartCodeNum();//鐩爣浜岀淮鐮�
//鑾峰彇绉诲姩鍛戒护
- ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, commands.get(0).getRunDirection());
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, commands.get(0).getRunDirection(), (short) 1, 0);
commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
//鍒嗛厤鐩爣搴撲綅
@@ -992,7 +1034,7 @@
HashMap<String, Object> map = new HashMap<>();
String locNo = wrkMast.getWrkSts() < 10 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo();//搴撲綅鍙�
LocMast locMast = locMastService.queryByLoc(locNo);//鎵惧埌搴撲綅璁板綍
- String lay = locNo.substring(locNo.length() - 2, locNo.length());//褰撳墠宸ヤ綔妗e簱浣嶅眰楂�
+ int lev = Utils.getLev(locNo);//褰撳墠宸ヤ綔妗e簱浣嶅眰楂�
ShuttleThread recentShuttle = null;//褰撳墠璺濈鏈�杩戠殑鍥涘悜绌挎杞︾嚎绋�
for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
@@ -1007,8 +1049,8 @@
}
String shuttleLocNo = shuttleProtocol.getCurrentLocNo();//浜岀淮鐮佸搴斿簱浣嶅彿
- String shuttleLocNoLay = shuttleLocNo.substring(shuttleLocNo.length() - 2, shuttleLocNo.length());//搴撲綅鍙峰搴斿眰楂�
- if (lay.equals(shuttleLocNoLay)) {
+ int shuttleLocNoLey = Utils.getLev(shuttleLocNo);//搴撲綅鍙峰搴斿眰楂�
+ if (lev == shuttleLocNoLey) {
//褰撳墠鍥涘悜绌挎杞﹀拰宸ヤ綔妗d换鍔″湪鍚屼竴灞傦紝鍒欒皟閰嶈杞﹁締
map.put("sameLay", true);//鍚屼竴灞�
map.put("result", shuttleThread);
@@ -1024,10 +1066,8 @@
String recentShuttleLocNoLay = recentShuttleLocNo.substring(recentShuttleLocNo.length() - 2, recentShuttleLocNo.length());//搴撲綅鍙峰搴斿眰楂�
int recentShuttleLocNoLayInt = Integer.parseInt(recentShuttleLocNoLay);
- int layInt = Integer.parseInt(lay);
- int shuttleLocNoLayInt = Integer.parseInt(shuttleLocNoLay);
- int i = Math.abs(layInt - recentShuttleLocNoLayInt);//宸ヤ綔妗fゼ灞傚噺鏈�杩戠┛姊溅妤煎眰锛屽彇缁濆鍊�
- int j = Math.abs(layInt - shuttleLocNoLayInt);//宸ヤ綔妗fゼ灞傚噺褰撳墠绌挎杞︽ゼ灞傦紝鍙栫粷瀵瑰��
+ int i = Math.abs(lev - recentShuttleLocNoLayInt);//宸ヤ綔妗fゼ灞傚噺鏈�杩戠┛姊溅妤煎眰锛屽彇缁濆鍊�
+ int j = Math.abs(lev - shuttleLocNoLey);//宸ヤ綔妗fゼ灞傚噺褰撳墠绌挎杞︽ゼ灞傦紝鍙栫粷瀵瑰��
if (i < j) {
//鏇存柊鏈�杩戠┛姊溅
recentShuttle = shuttleThread;
@@ -1046,7 +1086,7 @@
LiftSlave liftSlave = slaveProperties.getLift().get(0);
//鎻愬崌鏈哄簱浣嶅彿
String recentLiftLocNo = liftSlave.getLiftLocNo(recentShuttleLocNoLayInt);
- String shuttleLiftLocNo = liftSlave.getLiftLocNo(shuttleLocNoLayInt);
+ String shuttleLiftLocNo = liftSlave.getLiftLocNo(shuttleLocNoLey);
//褰撳墠鏈�杩戝洓鍚戠┛姊溅鍒版彁鍗囨満璺緞
List<NavigateNode> recentShuttlePath = NavigateUtils.calc(recentShuttleLocNo, recentLiftLocNo, ShuttleTaskModeType.PAK_IN.id);
@@ -1078,9 +1118,11 @@
continue;
}
- //鍥涘悜绌挎杞︾姸鎬佷负绛夊緟纭
+ //鍥涘悜绌挎杞︾姸鎬佷负绛夊緟纭銆佸皬杞﹀浜庣┖闂茬姸鎬�
if (shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id //浠诲姟瀹屾垚绛夊緟纭
- && shuttleProtocol.getTaskNo() != 0) {
+ && shuttleProtocol.getTaskNo() != 0
+ && shuttleProtocol.getBusyStatus() == 0
+ ) {
//灏嗕换鍔℃。鏍囪涓哄畬鎴�
WrkMast wrkMast = wrkMastMapper.selectByWorkNo(shuttleProtocol.getTaskNo().intValue());
if (wrkMast != null) {
@@ -1198,55 +1240,60 @@
//鍛戒护list
ArrayList<LiftCommand> commands = new ArrayList<>();
- if (wrkMast.getWrkSts() == 2) {
+ DevpThread devpThread = null;
+ Integer devpId = null;
+ for (DevpSlave devp : slaveProperties.getDevp()){
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ devpId = devp.getId();
+ }
+
+ if (wrkMast.getWrkSts() == 2) {//2.璁惧涓婅蛋
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
- String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
+ String wrkMastLocNo = wrkMast.getLocNo();
//宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
- int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length()));
+ int wrkMastLocNoLey = Utils.getLev(wrkMastLocNo);
//鎻愬崌鏈哄綋鍓嶆ゼ灞�
int liftLev = liftProtocol.getLev().intValue();
- if (liftLev != 1) {
- //鎻愬崌鏈轰笉鍦�1灞�
- LiftCommand command1 = new LiftCommand();
- command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command1.setRun((short) 1);//鍗囬檷
- command1.setDistPosition((short) 1);//鐩爣妤煎眰1灞�
- command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ if (liftLev == 0) {//鎻愬崌鏈哄綋鍓嶆ゼ灞備负0锛屾彁鍗囨満澶卞幓浣嶇疆淇℃伅锛岃鎻愬崌鏈哄墠寰�涓�妤�
+ LiftCommand command = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.ONE.lev);
+ commands.add(command);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+ if (liftLev != LiftLevType.TWO.realLev) {
+ //鎻愬崌鏈轰笉鍦ㄨ緭閫佺嚎妤煎眰锛岃幏鍙栧埌杈撻�佺嚎灞傜殑鎻愬崌鏈哄懡浠�
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
}
- //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵
- LiftCommand command2 = new LiftCommand();
- command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
- command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣姝h浆)
+ LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 3);
+ command2.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+ command2.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
+ command2.setDevpId(devpId);
commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
- LiftCommand command3 = new LiftCommand();
- command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command3.setRun((short) 1);//鍗囬檷
- command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
- command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ Integer levTmp = wrkMastLocNoLey;
+ if (wrkMastLocNoLey >= 2) {
+ levTmp += 1;
+ }
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+ LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), levTmp);
commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
- //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+ //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(姝h浆)
//杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
- LiftCommand command4 = new LiftCommand();
- command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
- command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
+ Integer distStaNo = Utils.levToOutInStaNo(levTmp);
+ command4.setOperaStaNo(distStaNo.shortValue());//鎿嶄綔鐩爣妤煎眰绔欑偣
+ command4.setRotationDire(1);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屾杞�
+ command4.setDevpId(devpId);
commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
- }else {
+
+ wrkMast.setWrkSts(3L);//3.鎻愬崌鏈烘惉杩愪腑
+ }else if(wrkMast.getWrkSts() == 6 || wrkMast.getWrkSts() == 23) {//6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 7.鎻愬崌鏈鸿縼绉诲皬杞︿腑 || 23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
//鎵惧埌鍥涘悜绌挎杞︾殑绾跨▼
@@ -1262,72 +1309,93 @@
//褰撳墠绌挎杞﹀簱浣嶅彿
String currentLocNo = shuttleProtocol.getCurrentLocNo();
//褰撳墠绌挎杞︽ゼ灞�
- int currentLocNoLey = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
+ int currentLocNoLey = Utils.getLev(currentLocNo);
//宸ヤ綔妗g洰鏍囧簱浣嶅彿
String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo();
//宸ヤ綔妗g洰鏍囧簱浣嶆ゼ灞�
- int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length()));
+ int wrkMastLocNoLey = Utils.getLev(wrkMastLocNo);
//鎻愬崌鏈哄綋鍓嶆ゼ灞�
int liftLev = liftProtocol.getLev().intValue();
+ if (liftLev == 0) {//鎻愬崌鏈哄綋鍓嶆ゼ灞備负0锛屾彁鍗囨満澶卞幓浣嶇疆淇℃伅锛岃鎻愬崌鏈哄墠寰�涓�妤�
+ LiftCommand command = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.ONE.lev);
+ commands.add(command);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+
if (liftLev != currentLocNoLey) {
//涓嶅悓妤煎眰
- LiftCommand command1 = new LiftCommand();
- command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command1.setRun((short) 1);//鍗囬檷
- command1.setDistPosition((short) currentLocNoLey);//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
- command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //鑾峰彇鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)鍛戒护
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), currentLocNoLey);
commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
}
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
- LiftCommand command2 = new LiftCommand();
- command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
- command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵(鍙嶈浆)
+ LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 4);
commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
if (liftLev != currentLocNoLey) {
- //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
- LiftCommand command3 = new LiftCommand();
- command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command3.setRun((short) 1);//鍗囬檷
- command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
- command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+ LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
}
//鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
- LiftCommand command4 = new LiftCommand();
- command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
- command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓(姝h浆)
+ LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
- }
- switch (wrkMast.getWrkSts().intValue()) {
- case 2://2.璁惧涓婅蛋
- wrkMast.setWrkSts(3L);//3.鎻愬崌鏈烘惉杩愪腑
- break;//3.鎻愬崌鏈烘惉杩愪腑
- case 6://6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
- wrkMast.setWrkSts(7L);//7.鎻愬崌鏈鸿縼绉诲皬杞︿腑
- break;
- case 23://23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴�
- wrkMast.setWrkSts(24L);//24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
- break;
- case 27://27.灏忚溅鍑哄簱鎼繍瀹屾垚
- wrkMast.setWrkSts(28L);//28.鎻愬崌鏈烘惉杩愪腑
- break;
+ wrkMast.setWrkSts(wrkMast.getWrkSts() == 6 ? 7L : 24L);//6.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 7.鎻愬崌鏈鸿縼绉诲皬杞︿腑 || 23.杩佺Щ灏忚溅鑷虫彁鍗囨満鍙e畬鎴� => 24.鎻愬崌鏈鸿縼绉诲皬杞︿腑
+ } else if (wrkMast.getWrkSts() == 27) {//27.灏忚溅鍑哄簱鎼繍瀹屾垚
+ //宸ヤ綔妗f簮搴撲綅鍙�
+ String wrkMastLocNo = wrkMast.getSourceLocNo();
+ //宸ヤ綔妗f簮搴撲綅妤煎眰
+ int wrkMastLocNoLey = Utils.getLev(wrkMastLocNo);
+
+ //鎻愬崌鏈哄綋鍓嶆ゼ灞�
+ int liftLev = liftProtocol.getLev().intValue();
+ if (liftLev == 0) {//鎻愬崌鏈哄綋鍓嶆ゼ灞備负0锛屾彁鍗囨満澶卞幓浣嶇疆淇℃伅锛岃鎻愬崌鏈哄墠寰�涓�妤�
+ LiftCommand command = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.ONE.lev);
+ commands.add(command);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+
+ //鍒ゆ柇鎻愬崌鏈烘槸鍚﹀埌浣�
+ StaProtocol staProtocol = devpThread.getStation().get(Utils.levToOutInStaNo(wrkMastLocNoLey));//璧峰绔欑偣
+ if (liftLev != wrkMastLocNoLey && wrkMastLocNoLey != 1 || !staProtocol.isLiftArrival()) {
+ //鎻愬崌鏈轰笉鍦ㄥ伐浣滄。婧愬簱浣嶆ゼ灞傦紝璋冨害鎻愬崌鏈�
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), wrkMastLocNoLey);
+ commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
+ }
+
+ //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(鏃犺揣鍙嶈浆)
+ LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 4);
+ command2.setOperaStaNo(staProtocol.getSiteId().shortValue());//杈撻�佺嚎鎿嶄綔绔欑偣鍙�
+ command2.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
+ command2.setDevpId(devpId);//杈撻�佺嚎iD
+ command2.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
+ commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
+
+ //鎻愬崌鏈哄墠寰�鍑哄簱鍙o紝杈撻�佺嚎妤煎眰
+ LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), LiftLevType.TWO.lev);
+ commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
+
+ //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(鍙嶈浆)
+ //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+ LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
+ command4.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+ command4.setRotationDire(2);//缁欒緭閫佺嚎涓嬪彂閾炬潯杞姩淇″彿锛屽弽杞�
+ command4.setDevpId(devpId);
+ commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
+
+ //鎻愬崌鏈洪摼鏉℃墽琛屽畬姣曞悗锛岀粰102绔欏啓鍏ヨ祫鏂�
+ LiftCommand command5 = liftThread.getResetCommand();
+ command5.setDevpId(devpId);//杈撻�佺嚎iD
+ command5.setOperaStaNo((short) 102);//鎿嶄綔102绔�
+ command5.setStaNo((short) 104);//鍐欏叆鍑哄簱鐩爣绔�104
+ command5.setRotationDire(0);//閾炬潯杞姩鍋滄
+ commands.add(command5);
+
+ wrkMast.setWrkSts(28L);//28.鎻愬崌鏈烘惉杩愪腑
}
//鎵�闇�鍛戒护缁勫悎瀹屾瘯锛屾洿鏂版暟鎹簱锛屾彁浜ゅ埌绾跨▼鍘诲伐浣�
@@ -1354,13 +1422,58 @@
continue;
}
- //鎻愬崌鏈轰负绛夊緟纭
- if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id && liftProtocol.getTaskNo() != 0) {
+// //褰撴彁鍗囨満鐘舵�佸浜庡伐浣滀腑锛屼絾鎻愬崌鏈哄疄闄呬负绌洪棽鐘舵�侊紝涓旀椂闀胯秴杩�30绉掞紝鑷姩澶嶄綅
+// if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WORKING.id
+// && liftProtocol.getTaskNo() != 0
+// && !liftProtocol.getRunning()
+// ) {
+// if (liftProtocol.getWrkTime() == null) {
+// continue;
+// }
+//
+// Date wrkTime = liftProtocol.getWrkTime();
+// Date now = new Date();
+// long interval = (now.getTime() - wrkTime.getTime()) / 1000;//璁$畻鏃堕棿宸�
+// if (interval >= 30) {//瓒呰繃30绉掕嚜鍔ㄥ浣�
+// //璁剧疆鎻愬崌鏈轰负绌洪棽鐘舵��
+// liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
+// //浠诲姟鍙锋竻闆�
+// liftProtocol.setTaskNo((short) 0);
+// //鏍囪澶嶄綅
+// liftProtocol.setPakMk(true);
+// //浠诲姟鎸囦护娓呴浂
+// liftProtocol.setAssignCommand(null);
+// News.info("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傛彁鍗囨満鍙�={}", liftProtocol.getLiftNo());
+// }
+// }
+
+ //鎻愬崌鏈轰负绛夊緟纭涓旂┖闂�
+ if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id
+ && liftProtocol.getTaskNo() != 0
+ && !liftProtocol.getRunning()
+ ) {
+
+ DevpThread devpThread = null;
+ Integer devpId = null;
+ for (DevpSlave devp : slaveProperties.getDevp()){
+ // 鑾峰彇鍏ュ簱绔欎俊鎭�
+ devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+ devpId = devp.getId();
+ }
+
//灏嗕换鍔℃。鏍囪涓哄畬鎴�
WrkMast wrkMast = wrkMastMapper.selectByWorkNo372428(liftProtocol.getTaskNo().intValue());
if (wrkMast != null) {
switch (wrkMast.getWrkSts().intValue()) {
case 3://3.鎻愬崌鏈烘惉杩愪腑 ==> 4.鎻愬崌鏈烘惉杩愬畬鎴�
+ //缁欑洰鏍囩珯璁剧疆宸ヤ綔鍙�
+ StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo());//鐩爣绔�
+ staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue());
+ staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
+ boolean result = MessageQueue.offer(SlaveType.Devp, devpId, new Task(2, staProtocol));
+ if (!result) {
+ throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
+ }
wrkMast.setWrkSts(4L);
break;
case 7://7.鎻愬崌鏈鸿縼绉诲皬杞︿腑 ==> 8.鎻愬崌鏈鸿縼绉诲皬杞﹀畬鎴�
@@ -1385,40 +1498,30 @@
liftProtocol.setPakMk(true);
//浠诲姟鎸囦护娓呴浂
liftProtocol.setAssignCommand(null);
- //鎻愬崌鏈鸿В閿�
- liftProtocol.setLiftLock(false);
News.info("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傛彁鍗囨満鍙�={}", liftProtocol.getLiftNo());
} else {
News.error("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅澶辫触锛屼絾鏈壘鍒板伐浣滄。銆傛彁鍗囨満鍙�={}锛屽伐浣滃彿={}", liftProtocol.getLiftNo(), liftProtocol.getTaskNo());
}
}
- //鏌ヨ鏄惁鏈夊厖鐢典换鍔�
- WrkCharge wrkCharge = wrkChargeMapper.selectByWorkNo(liftProtocol.getTaskNo().intValue());
- if (wrkCharge != null) {
- switch (wrkCharge.getWrkSts().intValue()) {
- case 54://鎻愬崌鏈烘惉杩愪腑
- wrkCharge.setWrkSts(55L);//鎻愬崌鏈烘惉杩愬畬鎴�
- break;
- default:
- }
-
- if (wrkChargeMapper.updateById(wrkCharge) > 0) {
- //璁剧疆鎻愬崌鏈轰负绌洪棽鐘舵��
- liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
- //浠诲姟鍙锋竻闆�
- liftProtocol.setTaskNo((short) 0);
- //鏍囪澶嶄綅
- liftProtocol.setPakMk(true);
- //浠诲姟鎸囦护娓呴浂
- liftProtocol.setAssignCommand(null);
- //鎻愬崌鏈鸿В閿�
- liftProtocol.setLiftLock(false);
- News.info("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傛彁鍗囨満鍙�={}", liftProtocol.getLiftNo());
- } else {
- News.error("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅澶辫触锛屼絾鏈壘鍒板伐浣滄。銆傛彁鍗囨満鍙�={}锛屽伐浣滃彿={}", liftProtocol.getLiftNo(), liftProtocol.getTaskNo());
- }
+ //涓嶆槸鍏ュ嚭搴撹皟搴︿换鍔°�佸伐浣滄。浠诲姟锛岃繘琛屾彁鍗囨満鐨勫浣�
+ if (liftProtocol.getAssignCommand() != null) {
+ //璁剧疆鎻愬崌鏈轰负绌洪棽鐘舵��
+ liftProtocol.setProtocolStatus(LiftProtocolStatusType.IDLE);
+ //浠诲姟鍙锋竻闆�
+ liftProtocol.setTaskNo((short) 0);
+ //鏍囪澶嶄綅
+ liftProtocol.setPakMk(true);
+ //浠诲姟鎸囦护娓呴浂
+ liftProtocol.setAssignCommand(null);
+ News.info("鎻愬崌鏈哄凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傛彁鍗囨満鍙�={}", liftProtocol.getLiftNo());
+// LiftAssignCommand assignCommand = liftProtocol.getAssignCommand();
+// if (!assignCommand.getAuto()) {
+// //鎵嬪姩鍛戒护
+//
+// }
}
+
}
}
}
@@ -2178,7 +2281,7 @@
//褰撳墠绌挎杞﹀簱浣嶅彿
String currentLocNo = shuttleProtocol.getCurrentLocNo();
//灏忚溅褰撳墠灞傞珮
- Integer currentLev = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
+ Integer currentLev = currentLocNo == null ? 0 : Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
//鑾峰彇鎻愬崌鏈�
LiftSlave liftSlave = slaveProperties.getLift().get(0);
//鎻愬崌鏈哄簱浣嶅彿
@@ -2273,42 +2376,23 @@
int liftLev = liftProtocol.getLev().intValue();
if (liftLev != currentLev) {
//绌挎杞﹀拰鎻愬崌鏈哄浜庝笉鍚屾ゼ灞�
- LiftCommand command1 = new LiftCommand();
- command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command1.setRun((short) 1);//鍗囬檷
- command1.setDistPosition(currentLev.shortValue());//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
- command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+ //鑾峰彇鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)鍛戒护
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), currentLev);
commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
}
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
- LiftCommand command2 = new LiftCommand();
- command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
- command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵(姝h浆)
+ LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
//鎻愬崌鏈哄墠寰�鐩爣妤煎眰
- LiftCommand command3 = new LiftCommand();
- command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command3.setRun((short) 1);//鍗囬檷
- command3.setDistPosition(chargeLocNoLev.shortValue());//鍏呯數搴撲綅鐩爣妤煎眰
- command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //鑾峰彇鍏呯數搴撲綅鐩爣妤煎眰鍛戒护
+ LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), chargeLocNoLev);
commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
//鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
- //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
- LiftCommand command4 = new LiftCommand();
- command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
- command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
- command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
- command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓(鍙嶈浆)
+ LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
wrkCharge.setWrkSts(54L);//鎻愬崌鏈烘惉杩愪腑
--
Gitblit v1.9.1