From b7e0039880d9f6e71230dbf9c13538de4f8135b8 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 10 六月 2023 19:23:26 +0800
Subject: [PATCH] 输送线条码读取bug、出入库模式信号、链条控制信号
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 316 +++++++++++++++++++---------------------------------
1 files changed, 116 insertions(+), 200 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 21c409f..e462e8a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -84,6 +84,8 @@
@Autowired
private WrkChargeMapper wrkChargeMapper;
@Autowired
+ private BasMapService basMapService;
+ @Autowired
private ErpService erpService;
@Autowired
private OrderMapper orderMapper;
@@ -544,10 +546,35 @@
}
/**
- * 鑾峰彇/鏇存柊瀹炴椂鍦板浘
+ * 鍒濆鍖栧疄鏃跺湴鍥�
*/
- public synchronized void refreshMap() {
+ public synchronized void initRealtimeBasMap() {
+ for (int i = 1; i <= 4; i++) {//鎬诲叡鍥涘眰妤�
+ Object data = redisUtil.get("realtimeBasMap_" + i);
+ if (data == null) {//redis鍦板浘鏁版嵁涓虹┖锛屼粠鏁版嵁搴撲腑鑾峰彇
+ BasMap basMap = basMapService.selectLatestMap(i);
+ if (basMap == null) {
+ //鏁版嵁搴撲腑涔熶笉瀛樺湪鍦板浘鏁版嵁锛屼粠鍦板浘鏂囦欢涓幏鍙�
+ //杞藉叆鍦板浘
+ NavigateMapData mapData = new NavigateMapData(i);
+ List<List<MapNode>> lists = mapData.getJsonData(-1);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
+ //瀛樺叆鏁版嵁搴�
+ basMap = new BasMap();
+ basMap.setData(JSON.toJSONString(lists));
+ basMap.setCreateTime(new Date());
+ basMap.setUpdateTime(new Date());
+ basMap.setLev(i);
+
+ if (!basMapService.insert(basMap)) {
+ log.info("鍦板浘鏁版嵁瀛樺偍澶辫触");
+ }
+ }
+
+ //灏嗘暟鎹簱鍦板浘鏁版嵁瀛樺叆redis
+ redisUtil.set("realtimeBasMap_" + i, JSON.toJSONString(basMap));
+ }
+ }
}
/**
@@ -613,13 +640,13 @@
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 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);
if (staProtocol == null) {
continue;
@@ -681,18 +708,15 @@
if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
//鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
//鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand,shuttleThread);
if (wrkMast.getWrkSts() == 8) {
//姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
- ShuttleCommand moveCommand = new ShuttleCommand();
- moveCommand.setCommandWord((short) 1);
- moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
- moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum());//鎻愬崌鏈哄彛浜岀淮鐮�
- moveCommand.setStartToDistDistance(1300);
- moveCommand.setMiddleToDistDistance(0);
- moveCommand.setRunDirection(commands.get(0).getRunDirection());
- moveCommand.setCommandEnd((short) 1);
+ short startCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+ Short distCode = commands.get(0).getStartCodeNum();//鎻愬崌鏈哄彛浜岀淮鐮�
+ Short runDirection = commands.get(0).getRunDirection();//杩愯鏂瑰悜
+ //鑾峰彇鍛戒护
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, runDirection);
commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
}
assignCommand.setCommands(commands);
@@ -705,7 +729,7 @@
//涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿
//灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(liftLocNo);
//鐩爣搴撲綅
@@ -729,13 +753,16 @@
}
//鑾峰彇璧风偣-缁堢偣鎸囦护銆俶apType锛�1=銆嬫棤璐у湴鍥撅紝2=銆嬫湁璐у湴鍥�
- public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNO,Integer mapType) {
+ public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
//璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
- List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNO, mapType);
+ List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType);
List<ShuttleCommand> commands = new ArrayList<>();
if (calc == null) {
return null;
}
+
+ List<NavigateNode> allNode = new ArrayList<>();
+ allNode.addAll(calc);
//鑾峰彇鍒嗘璺緞
ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc);
@@ -746,36 +773,25 @@
//鐩爣璺緞
NavigateNode endPath = nodes.get(nodes.size() - 1);
Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
-
- ShuttleCommand command = new ShuttleCommand();
- command.setCommandWord((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
- command.setStartCodeNum(startCodeNum);
-
- command.setMiddleCodeNum((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
- command.setDistCodeNum(distCodeNum);
-
- command.setStartToDistDistance(allDistance);
- command.setMiddleToDistDistance(0);
- command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
- command.setPalletLift((short) 1);
- command.setForceMoveDistance(0);
- command.setChargeSwitch((short) 2);
- command.setIOControl((short) 0);
- command.setRadarTmp((short) 0);
- command.setCommandEnd((short) 1);
+ //鑾峰彇绉诲姩鍛戒护
+ ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
commands.add(command);
}
+
+ assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
+ //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+ NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(startLocNo));
+ navigateMapData.writeNavigateNodeToRedisMap(allNode, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+
return commands;
}
//鑾峰彇璧风偣-涓偣-缁堢偣鎸囦护
- public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNO) {
+ 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<>();
@@ -783,6 +799,9 @@
return null;
}
+ List<NavigateNode> allNode = new ArrayList<>();
+ allNode.addAll(calc);
+
//鑾峰彇鍒嗘璺緞
ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc);
//灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
@@ -793,43 +812,25 @@
NavigateNode endPath = nodes.get(nodes.size() - 1);
Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
- ShuttleCommand command = new ShuttleCommand();
- command.setCommandWord((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
- command.setStartCodeNum(startCodeNum);
-
- command.setMiddleCodeNum((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
- command.setDistCodeNum(distCodeNum);
-
- command.setStartToDistDistance(allDistance);
- command.setMiddleToDistDistance(0);
- command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
- command.setPalletLift((short) 1);
- command.setForceMoveDistance(0);
- command.setChargeSwitch((short) 2);
- command.setIOControl((short) 0);
- command.setRadarTmp((short) 0);
- command.setCommandEnd((short) 1);
+ //鑾峰彇绉诲姩鍛戒护
+ ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
commands.add(command);
}
//灏忚溅鎸囦护鍒拌揪鐩爣浣嶇疆鍚庯紝鍐嶅彂鍑轰竴鏉¢《鍗囨寚浠�
- ShuttleCommand command = new ShuttleCommand();
- command.setCommandWord((short) 2);
- command.setPalletLift((short) 1);
- command.setCommandEnd((short) 1);
- commands.add(command);
+ commands.add(shuttleThread.getPalletCommand((short) 1));
//璁$畻灏忚溅涓偣鍒扮粓鐐规墍闇�鍛戒护
- List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNO, 2);//灏忚溅鏈夎揣锛岃蛋鍑哄簱鍦板浘(鍑哄簱鍦板浘鏈変笓鐢ㄨ揣閬�)
+ List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNo, 2);//灏忚溅鏈夎揣锛岃蛋鍑哄簱鍦板浘(鍑哄簱鍦板浘鏈変笓鐢ㄨ揣閬�)
if (calc2 == null) {
return null;
}
+
+ allNode.addAll(calc2);
//鑾峰彇鍒嗘璺緞
ArrayList<ArrayList<NavigateNode>> data2 = NavigateUtils.getSectionPath(calc2);
@@ -840,37 +841,21 @@
NavigateNode endPath = nodes.get(nodes.size() - 1);
Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
- command = new ShuttleCommand();
- command.setCommandWord((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
- command.setStartCodeNum(startCodeNum);
-
- command.setMiddleCodeNum((short) 1);
-
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
- command.setDistCodeNum(distCodeNum);
-
- command.setStartToDistDistance(allDistance);
- command.setMiddleToDistDistance(0);
- command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
- command.setPalletLift((short) 1);
- command.setForceMoveDistance(0);
- command.setChargeSwitch((short) 2);
- command.setIOControl((short) 0);
- command.setRadarTmp((short) 0);
- command.setCommandEnd((short) 1);
- commands.add(command);
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
+ commands.add(moveCommand);
}
//灏忚溅鎸囦护鍒拌揪鐩爣浣嶇疆鍚庯紝鍐嶅彂鍑轰竴鏉℃墭鐩樹笅闄嶆寚浠�
- command = new ShuttleCommand();
- command.setCommandWord((short) 2);
- command.setPalletLift((short) 2);
- command.setCommandEnd((short) 1);
- commands.add(command);
+ commands.add(shuttleThread.getPalletCommand((short) 2));
+
+ assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
+ //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+ NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(startLocNo));
+ navigateMapData.writeNavigateNodeToRedisMap(allNode, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
return commands;
}
@@ -955,7 +940,7 @@
if (Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
//鍚屼竴灞�(灏嗗皬杞︾Щ鍔ㄥ埌璐х墿浣嶇疆)
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
//鐩爣搴撲綅
@@ -966,7 +951,7 @@
//涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿(灏嗗皬杞︾Щ鍔ㄥ埌鎻愬崌鏈轰綅缃�)
//灏忚溅鍒版彁鍗囨満鍙f寚浠�
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
shuttleProtocol.setLocNo(liftLocNo);
//鐩爣搴撲綅
assignCommand.setLocNo(liftLocNo);
@@ -974,17 +959,13 @@
wrkMast.setWrkSts(22L);//灏忚溅杩佺Щ鐘舵��
}
} else if (wrkMast.getWrkSts() == 25) {
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
//姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
- ShuttleCommand moveCommand = new ShuttleCommand();
- moveCommand.setCommandWord((short) 1);//灏忚溅绉诲姩鎸囦护瀛�
- moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//鎻愬崌鏈轰簩缁寸爜
- moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum());
- moveCommand.setStartToDistDistance(1300);
- moveCommand.setMiddleToDistDistance(0);
- moveCommand.setRunDirection(commands.get(0).getRunDirection());
- moveCommand.setCommandEnd((short) 1);
+ short startCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈轰簩缁寸爜
+ Short distCode = commands.get(0).getStartCodeNum();//鐩爣浜岀淮鐮�
+ //鑾峰彇绉诲姩鍛戒护
+ ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, commands.get(0).getRunDirection());
commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
//鍒嗛厤鐩爣搴撲綅
@@ -1226,44 +1207,22 @@
//鎻愬崌鏈哄綋鍓嶆ゼ灞�
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);//閿佸畾鎻愬崌鏈�
-
+ //鎻愬崌鏈轰笉鍦�1灞傦紝鑾峰彇鍒�1灞傜殑鎻愬崌鏈哄懡浠�
+ LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) 1);
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((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
- command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+ //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+ LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) wrkMastLocNoLey);
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
}else {
liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
@@ -1292,45 +1251,24 @@
int liftLev = liftProtocol.getLev().intValue();
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(), (short) currentLocNoLey);
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
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(), (short) wrkMastLocNoLey);
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
}
@@ -2211,22 +2149,21 @@
if (currentLev == chargeLocNoLev) {
//鍚屼竴灞傛棤闇�缁忚繃鎻愬崌鏈�
//鐩存帴璁$畻杞﹀埌鍏呯數搴撲綅
+
+ ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+
//鑾峰彇灏忚溅鍒板厖鐢靛簱浣嶈矾寰勬寚浠�
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
//杩涜鍏呯數涓�
shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING);
- ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+
assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());
assignCommand.setTaskMode((short) 9);//鍏呯數
assignCommand.setTaskNo(wrkCharge.getWrkNo().shortValue());
assignCommand.setCharge(true);//鍏呯數浠诲姟
//鍒涘缓鍏呯數鎸囦护
- ShuttleCommand command = new ShuttleCommand();
- command.setCommandWord((short) 5);//鍏呯數
- command.setShuttleNo(shuttleProtocol.getShuttleNo());
- command.setChargeSwitch((short) 1);//寮�濮嬪厖鐢�
- command.setCommandEnd((short) 1);
+ ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 1);//寮�濮嬪厖鐢�
commands.add(command);
//鎸囦护闆嗗垎閰�
@@ -2240,12 +2177,14 @@
}else {
//涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿
+ ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+
//灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
- List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id);
+ List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
//鍒嗛厤鐩爣搴撲綅
shuttleProtocol.setLocNo(liftLocNo);
- ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
+
assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());
assignCommand.setTaskMode((short) 9);//鍏呯數
assignCommand.setTaskNo(wrkCharge.getWrkNo().shortValue());
@@ -2291,42 +2230,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.shortValue());
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.shortValue());
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);//鎻愬崌鏈烘惉杩愪腑
@@ -2353,11 +2273,7 @@
assignCommand.setCharge(true);
//鍒涘缓鍏呯數鎸囦护
- ShuttleCommand command = new ShuttleCommand();
- command.setCommandWord((short) 5);//鍏呯數
- command.setShuttleNo(shuttleProtocol.getShuttleNo());
- command.setChargeSwitch((short) 2);//鏂紑鍏呯數
- command.setCommandEnd((short) 1);
+ ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 2);//鏂紑鍏呯數
commands.add(command);
//鎸囦护闆嗗垎閰�
--
Gitblit v1.9.1