From 7238380a5daef00c94eba911d6a6f560a538ed55 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期一, 13 一月 2025 16:48:11 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/command/ShuttleCommand.java | 7
src/main/java/com/zy/core/thread/impl/NyShuttleThread.java | 1
src/main/java/com/zy/common/utils/ShuttleOperaUtils.java | 5
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 118 +++---
src/main/java/com/zy/asrs/domain/vo/LiftStateTableVo.java | 132 -------
src/main/java/com/zy/core/action/ForkLiftAction.java | 10
src/main/resources/mapper/WrkMastMapper.xml | 4
src/main/java/com/zy/asrs/controller/ForkLiftController.java | 109 +++++
src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java | 56 ++
src/main/webapp/views/task.html | 57 ++
src/main/java/com/zy/asrs/controller/ShuttleController.java | 15
src/main/webapp/views/index.html | 2
src/main/resources/application.yml | 2
src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java | 50 +
src/main/webapp/views/forklift.html | 467 +++++++++++++++++++++++++
15 files changed, 799 insertions(+), 236 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/ForkLiftController.java b/src/main/java/com/zy/asrs/controller/ForkLiftController.java
index f9e1d89..7214275 100644
--- a/src/main/java/com/zy/asrs/controller/ForkLiftController.java
+++ b/src/main/java/com/zy/asrs/controller/ForkLiftController.java
@@ -1,21 +1,33 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.core.annotations.ManagerAuth;
+import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
+import com.core.exception.CoolException;
+import com.zy.asrs.domain.param.LiftOperatorParam;
import com.zy.asrs.domain.vo.*;
import com.zy.asrs.entity.BasLift;
import com.zy.asrs.service.BasLiftService;
+import com.zy.common.service.CommonService;
+import com.zy.common.utils.ForkLiftUtils;
import com.zy.common.utils.RedisUtil;
+import com.zy.core.action.ForkLiftAction;
+import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.ForkLiftProtocolStatusType;
+import com.zy.core.enums.ForkLiftTaskModeType;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.ForkLiftSlave;
+import com.zy.core.model.LiftSlave;
+import com.zy.core.model.Task;
import com.zy.core.model.command.*;
import com.zy.core.model.protocol.ForkLiftProtocol;
+import com.zy.core.model.protocol.LiftStaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ForkLiftThread;
import lombok.extern.slf4j.Slf4j;
@@ -26,41 +38,44 @@
import java.util.List;
/**
- * 鎻愬崌鏈烘帴鍙�
+ * 璐у弶鎻愬崌鏈烘帴鍙�
*/
@Slf4j
@RestController
-@RequestMapping("/lift")
+@RequestMapping("/forkLift")
public class ForkLiftController {
+ @Autowired
+ private CommonService commonService;
@Autowired
private SlaveProperties slaveProperties;
@Autowired
private BasLiftService basLiftService;
@Autowired
private RedisUtil redisUtil;
+ @Autowired
+ private ForkLiftAction forkLiftAction;
@PostMapping("/table/lift/state")
@ManagerAuth(memo = "鎻愬崌鏈轰俊鎭〃")
public R liftStateTable(){
- List<LiftStateTableVo> list = new ArrayList<>();
+ ArrayList<JSONObject> list = new ArrayList<>();
for (ForkLiftSlave slave : slaveProperties.getForkLift()) {
// 琛ㄦ牸琛�
- LiftStateTableVo vo = new LiftStateTableVo();
- vo.setLiftNo(slave.getId()); //鎻愬崌鏈哄彿
- list.add(vo);
+ JSONObject baseObj = new JSONObject();
+ baseObj.put("shuttleNo", slave.getId());
+ list.add(baseObj);
// 鑾峰彇鎻愬崌鏈轰俊鎭�
ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId());
if (forkLiftThread == null) {
- vo.setProtocolStatus(ForkLiftProtocolStatusType.NONE.id);//绂荤嚎
continue;
}
ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
- if (forkLiftProtocol == null || forkLiftProtocol.getLiftNo()==null) {
+ if (forkLiftProtocol == null) {
continue;
}
- vo.setTaskNo(forkLiftProtocol.getTaskNo().shortValue()); // 浠诲姟鍙�
- vo.setProtocolStatus(forkLiftProtocol.getProtocolStatusType().id);
+ JSONObject data = JSON.parseObject(JSON.toJSONString(forkLiftProtocol));
+ baseObj.putAll(data);
}
return R.ok().add(list);
}
@@ -240,4 +255,78 @@
return R.ok();
}
+ /****************************************************************/
+ /************************** 鎵嬪姩鎿嶄綔 ******************************/
+ /****************************************************************/
+
+ @ManagerAuth(memo = "鎵嬪姩鎿嶄綔")
+ @PostMapping("/operator/lift")
+ public R liftOperator(LiftOperatorParam param){
+ if (Cools.isEmpty(param.getLiftNo())) {
+ return R.parse(BaseRes.PARAM);
+ }
+
+ ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, param.getLiftNo());
+ if (forkLiftThread == null) {
+ throw new CoolException("鎻愬崌鏈轰笉鍦ㄧ嚎");
+ }
+ ForkLiftProtocol forkLiftProtocol = forkLiftThread.getStatus();
+ if (forkLiftProtocol == null) {
+ throw new CoolException("鎻愬崌鏈轰笉鍦ㄧ嚎");
+ }
+
+ if (param.getLiftTaskMode() == 1) {
+ //灏忚溅鎹㈠眰
+ int workNo = commonService.getWorkNo(99);//鑾峰彇浠诲姟鍙�
+
+ Integer startSta = param.getSourceStaNo();
+ Integer targetSta = param.getStaNo();
+
+ //鑾峰彇鎻愬崌鏈哄懡浠�
+ List<ForkLiftCommand> liftCommand = forkLiftThread.getShuttleSwitchCommand(workNo, startSta, targetSta);
+ ArrayList<ForkLiftCommand> commands = new ArrayList<>();
+ commands.addAll(liftCommand);
+
+ //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
+ LiftAssignCommand assignCommand = new LiftAssignCommand();
+ assignCommand.setCommands(commands);
+ assignCommand.setLiftNo(forkLiftProtocol.getLiftNo().shortValue());
+ assignCommand.setTaskNo((short) workNo);
+ assignCommand.setAuto(false);//鎵嬪姩妯″紡
+ assignCommand.setTaskMode(ForkLiftTaskModeType.SHUTTLE_SWITCH.id.shortValue());
+
+ forkLiftAction.assignWork(forkLiftProtocol.getLiftNo(), assignCommand);
+ return R.ok();
+ } else if (param.getLiftTaskMode() == 2) {
+ //绉诲姩鎵樼洏
+ int workNo = commonService.getWorkNo(99);//鑾峰彇浠诲姟鍙�
+
+ Integer startSta = param.getSourceStaNo();
+ Integer targetSta = param.getStaNo();
+
+ //鑾峰彇鎻愬崌鏈哄懡浠�
+ List<ForkLiftCommand> liftCommand = forkLiftThread.getPickAndPutCommand(workNo, startSta, targetSta);
+ ArrayList<ForkLiftCommand> commands = new ArrayList<>();
+ commands.addAll(liftCommand);
+
+ //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
+ LiftAssignCommand assignCommand = new LiftAssignCommand();
+ assignCommand.setCommands(commands);
+ assignCommand.setLiftNo(forkLiftProtocol.getLiftNo().shortValue());
+ assignCommand.setTaskNo((short) workNo);
+ assignCommand.setAuto(false);//鎵嬪姩妯″紡
+ assignCommand.setTaskMode(ForkLiftTaskModeType.PICK_PUT.id.shortValue());
+
+ forkLiftAction.assignWork(forkLiftProtocol.getLiftNo(), assignCommand);
+ return R.ok();
+ } else if (param.getLiftTaskMode() == 0) {
+ //鎻愬崌鏈哄浣�
+ forkLiftThread.setSyncTaskNo(0);
+ forkLiftThread.setProtocolStatus(ForkLiftProtocolStatusType.IDLE);
+ return R.ok();
+ } else {
+ throw new CoolException("鏈煡鍛戒护");
+ }
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java
index 7c9c950..54e8772 100644
--- a/src/main/java/com/zy/asrs/controller/ShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -15,6 +15,7 @@
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
+import com.zy.common.model.NavigateNode;
import com.zy.common.model.enums.NavigationMapType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.NavigateMapUtils;
@@ -39,6 +40,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
/**
@@ -185,7 +187,16 @@
return R.error("鎸囦护涓嶅瓨鍦�");
}
ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
- return R.ok().add(redisCommand);
+ ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand();
+ List<ShuttleCommand> commands = assignCommand.getCommands();
+
+ HashMap<String, Object> map = new HashMap<>();
+ map.put("commands", commands);
+ map.put("shuttleNo", redisCommand.getShuttleNo());
+ map.put("commandStep", redisCommand.getCommandStep());
+ map.put("wrkNo", redisCommand.getWrkNo());
+
+ return R.ok().add(map);
}
//鍥為��鍛戒护
@@ -367,7 +378,7 @@
return R.error("plc宸叉帀绾�");
}
if (workNo != null) {
- shuttleThread.setTaskNo(workNo);
+ shuttleThread.setSyncTaskNo(workNo);
}
if (pakMk != null) {
shuttleThread.setPakMk(pakMk.equals("Y"));
diff --git a/src/main/java/com/zy/asrs/domain/vo/LiftStateTableVo.java b/src/main/java/com/zy/asrs/domain/vo/LiftStateTableVo.java
index a4c1b38..8200e4b 100644
--- a/src/main/java/com/zy/asrs/domain/vo/LiftStateTableVo.java
+++ b/src/main/java/com/zy/asrs/domain/vo/LiftStateTableVo.java
@@ -24,138 +24,6 @@
*/
private Integer protocolStatus;
- /**
- * 妯″紡
- */
- private Boolean model;
-
- /**
- * 蹇欓棽
- */
- private Boolean busy;
-
- /**
- * 鏈夋墭鐩�
- */
- private Boolean hasTray;
-
- /**
- * 鏈夊皬杞�
- */
- private Boolean hasCar;
-
- /**
- * 璁惧鏁呴殰
- */
- private Boolean deviceError;
-
- /**
- * 鍓嶈秴闄�
- */
- private Boolean frontOverrun;
-
- /**
- * 鍚庤秴闄�
- */
- private Boolean backOverrun;
-
- /**
- * 宸﹁秴闄�
- */
- private Boolean leftOverrun;
-
- /**
- * 鍙宠秴闄�
- */
- private Boolean rightOverrun;
-
- /**
- * 瓒呴珮
- */
- private Boolean overHeight;
-
- /**
- * 瓒呴噸
- */
- private Boolean overWeight;
-
- public String getModel$() {
- if (this.model == null) {
- return "绂荤嚎";
- }
- return this.model ? "鑷姩" : "鎵嬪姩";
- }
-
- public String getBusy$() {
- if (this.busy == null) {
- return "-";
- }
- return this.busy ? "蹇欑" : "绌洪棽";
- }
-
- public String getHasTray$() {
- if (this.hasTray == null) {
- return "-";
- }
- return this.hasTray ? "Y" : "N";
- }
-
- public String getHasCar$() {
- if (this.hasCar == null) {
- return "N";
- }
- return this.hasCar ? "Y" : "N";
- }
-
- public String getDeviceError$() {
- if (this.deviceError == null) {
- return "N";
- }
- return this.deviceError ? "Y" : "N";
- }
-
- public String getFrontOverrun$() {
- if (this.frontOverrun == null) {
- return "N";
- }
- return this.frontOverrun ? "Y" : "N";
- }
-
- public String getBackOverrun$() {
- if (this.backOverrun == null) {
- return "N";
- }
- return this.backOverrun ? "Y" : "N";
- }
-
- public String getLeftOverrun$() {
- if (this.leftOverrun == null) {
- return "N";
- }
- return this.leftOverrun ? "Y" : "N";
- }
-
- public String getRightOverrun$() {
- if (this.rightOverrun == null) {
- return "N";
- }
- return this.rightOverrun ? "Y" : "N";
- }
-
- public String getOverHeight$() {
- if (this.overHeight == null) {
- return "N";
- }
- return this.overHeight ? "Y" : "N";
- }
-
- public String getOverWeight$() {
- if (this.overWeight == null) {
- return "N";
- }
- return this.overWeight ? "Y" : "N";
- }
-
public String getProtocolStatus$() {
if (this.protocolStatus == null) {
return ForkLiftProtocolStatusType.NONE.desc;
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 0cee555..1514ae1 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -839,32 +839,44 @@
//灏嗕换鍔℃。鏍囪涓哄畬鎴�
WrkMast wrkMast = wrkMastService.selectByWorkNo(shuttleProtocol.getTaskNo());
if (wrkMast != null) {
- switch (wrkMast.getWrkSts().intValue()) {
-// case 5://5.灏忚溅鎼繍涓� ==> 9.鍏ュ簱瀹屾垚
-// wrkMast.setWrkSts(9L);
-// shuttleProtocol.setTaskNo(0);
-// if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
-// //閲婃斁灏忚溅浠ょ墝
-// shuttleProtocol.setToken(0);
-// }
-// break;
-// case 22://22.灏忚溅鎼繍涓� ==> 23.灏忚溅鎼繍瀹屾垚
-// wrkMast.setWrkSts(23L);
-// shuttleProtocol.setTaskNo(0);
-// if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
-// //閲婃斁灏忚溅浠ょ墝
-// shuttleProtocol.setToken(0);
-// }
-// break;
- case 302://302.灏忚溅绉诲姩鑷崇珯鐐� ==> 303.灏忚溅绉诲姩鑷崇珯鐐瑰畬鎴�
- wrkMast.setWrkSts(WrkStsType.MOVE_SITE_COMPLETE.sts);
- break;
- case 110://310.灏忚溅绉诲姩涓� ==> 311.灏忚溅绉诲姩瀹屾垚
- wrkMast.setWrkSts(WrkStsType.COMPLETE_MOVE.sts);
- shuttleThread.setTaskNo(0);
- break;
- default:
+ if (wrkMast.getWrkSts() == WrkStsType.MOVE_SITE.sts) {
+ //302.灏忚溅绉诲姩鑷崇珯鐐� ==> 303.灏忚溅绉诲姩鑷崇珯鐐瑰畬鎴�
+ wrkMast.setWrkSts(WrkStsType.MOVE_SITE_COMPLETE.sts);
+ } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_SHUTTLE.sts) {
+ //310.灏忚溅绉诲姩涓� ==> 311.灏忚溅绉诲姩瀹屾垚
+ wrkMast.setWrkSts(WrkStsType.COMPLETE_MOVE.sts);
+ shuttleThread.setSyncTaskNo(0);
+ } else if (wrkMast.getWrkSts() == WrkStsType.CHARGE_SHUTTLE_WORKING.sts) {
+ //204.灏忚溅鍏呯數涓� ==> 205.灏忚溅鍏呯數瀹屾垚
+ wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_COMPLETE.sts);
+ shuttleThread.setSyncTaskNo(0);
}
+// switch (wrkMast.getWrkSts().intValue()) {
+//// case 5://5.灏忚溅鎼繍涓� ==> 9.鍏ュ簱瀹屾垚
+//// wrkMast.setWrkSts(9L);
+//// shuttleProtocol.setTaskNo(0);
+//// if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
+//// //閲婃斁灏忚溅浠ょ墝
+//// shuttleProtocol.setToken(0);
+//// }
+//// break;
+//// case 22://22.灏忚溅鎼繍涓� ==> 23.灏忚溅鎼繍瀹屾垚
+//// wrkMast.setWrkSts(23L);
+//// shuttleProtocol.setTaskNo(0);
+//// if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
+//// //閲婃斁灏忚溅浠ょ墝
+//// shuttleProtocol.setToken(0);
+//// }
+//// break;
+// case 302:
+// wrkMast.setWrkSts(WrkStsType.MOVE_SITE_COMPLETE.sts);
+// break;
+// case WrkStsType.MOVE_SHUTTLE.sts:
+// wrkMast.setWrkSts(WrkStsType.COMPLETE_MOVE.sts);
+// shuttleThread.setSyncTaskNo(0);
+// break;
+// default:
+// }
if (wrkMastService.updateById(wrkMast)) {
//璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
@@ -1833,7 +1845,7 @@
*/
public synchronized void executeShuttleCharge() {
try {
- //鏌ヨ灏忚溅绉诲簱浠诲姟
+ //鏌ヨ灏忚溅鍏呯數浠诲姟
for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
WrkMast wrkMast = wrkMastService.selectChargeWorking(shuttle.getId());
if(wrkMast == null) {
@@ -2001,12 +2013,6 @@
List<ShuttleCommand> commands = shuttleOperaUtils.getShuttleChargeCommand(assignCommand, shuttleThread, false);
assignCommand.setCommands(commands);//杩愯鍛戒护
- wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_COMPLETE.sts);
- wrkMast.setModiTime(new Date());
- if (!wrkMastService.updateById(wrkMast)) {
- return false;
- }
-
//涓嬪彂浠诲姟
shuttleAction.assignWork(shuttleProtocol.getShuttleNo(), assignCommand);
return false;
@@ -2026,22 +2032,22 @@
return false;
}
- ShuttleChargeType chargeType = ShuttleChargeType.get(wrkMast.getMk());
+ ShuttleChargeType chargeType = ShuttleChargeType.get(Integer.parseInt(wrkMast.getMk()));
if(chargeType == null) {
+ return false;
+ }
+
+ //璋冨害灏忚溅鍘诲緟鏈轰綅
+ boolean dispatched = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), chargeType.waitLocNo, wrkMast.getShuttleNo());
+ if (!dispatched) {
return false;
}
wrkMast.setWrkSts(WrkStsType.COMPLETE_CHARGE.sts);
wrkMast.setModiTime(new Date());
if (wrkMastService.updateById(wrkMast)) {
- //璋冨害灏忚溅鍘诲緟鏈轰綅
- boolean dispatched = shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), chargeType.waitLocNo, wrkMast.getShuttleNo());
- if (!dispatched) {
- return false;
- }
return false;
}
-
return false;
}
return true;
@@ -2142,23 +2148,23 @@
assignCommand.setCommands(commands);
- //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
- List<NavigateNode> targetNodes = ForkLiftUtils.getLiftStaNodes(wrkMast.getStaNo());
- if (targetNodes == null) {
- return false;//鏈幏鍙栧埌鑺傜偣
- }
- boolean checkPathIsAvailable = navigateUtils.checkPathIsAvailable(targetNodes, shuttleProtocol.getShuttleNo(), Utils.getLev(wrkMast.getLocNo()));
- if (!checkPathIsAvailable) {
- News.info("{}浠诲姟锛寋}灏忚溅锛岀洰鏍囩珯鐐硅矾寰勮鍗犵敤锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
- return false;//妫�娴嬬洰鏍囩珯鐐硅矾寰勬槸鍚︽湭琚崰鐢�
- }
- //灏濊瘯閿佸畾鐩爣绔欒矾寰�
- boolean result2 = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), shuttleProtocol.getShuttleNo(), targetNodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
- if (!result2) {
- News.info("{}浠诲姟锛寋}灏忚溅锛岃矾寰勯攣瀹氬け璐ワ紝绂佹娲惧彂", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
- return false;//璺緞閿佸畾澶辫触
- }
- //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
+// //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
+// List<NavigateNode> targetNodes = ForkLiftUtils.getLiftStaNodes(wrkMast.getStaNo());
+// if (targetNodes == null) {
+// return false;//鏈幏鍙栧埌鑺傜偣
+// }
+// boolean checkPathIsAvailable = navigateUtils.checkPathIsAvailable(targetNodes, shuttleProtocol.getShuttleNo(), Utils.getLev(wrkMast.getLocNo()));
+// if (!checkPathIsAvailable) {
+// News.info("{}浠诲姟锛寋}灏忚溅锛岀洰鏍囩珯鐐硅矾寰勮鍗犵敤锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
+// return false;//妫�娴嬬洰鏍囩珯鐐硅矾寰勬槸鍚︽湭琚崰鐢�
+// }
+// //灏濊瘯閿佸畾鐩爣绔欒矾寰�
+// boolean result2 = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), shuttleProtocol.getShuttleNo(), targetNodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// if (!result2) {
+// News.info("{}浠诲姟锛寋}灏忚溅锛岃矾寰勯攣瀹氬け璐ワ紝绂佹娲惧彂", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
+// return false;//璺緞閿佸畾澶辫触
+// }
+// //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
wrkMast.setWrkSts(WrkStsType.MOVE_SITE.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓� 301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 302.灏忚溅绉诲姩鑷崇珯鐐�
wrkMast.setModiTime(now);
diff --git a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
index 76e7459..4e09cb9 100644
--- a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java
@@ -78,6 +78,11 @@
assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
+ boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startLocNo), shuttleNo, allNode, true);//閿佸畾璺緞
+ if (!result) {
+ News.error("{} dash {} can't lock path!", startLocNo, endLocNo);
+ return null;//璺緞閿佸畾澶辫触
+ }
return commands;
}
diff --git a/src/main/java/com/zy/core/action/ForkLiftAction.java b/src/main/java/com/zy/core/action/ForkLiftAction.java
index 3c412e4..b6e7c0f 100644
--- a/src/main/java/com/zy/core/action/ForkLiftAction.java
+++ b/src/main/java/com/zy/core/action/ForkLiftAction.java
@@ -63,10 +63,10 @@
return false;
}
- WrkMast wrkMast = wrkMastService.selectByWorkNo(taskNo);
- if (wrkMast == null) {
- return false;
- }
+// WrkMast wrkMast = wrkMastService.selectByWorkNo(taskNo);
+// if (wrkMast == null) {
+// return false;
+// }
LiftRedisCommand redisCommand = JSON.parseObject(obj.toString(), LiftRedisCommand.class);
if (redisCommand == null) {
@@ -96,7 +96,7 @@
ForkLiftCommand command = commands.get(commandStep);
//鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂�
- if (!forkLiftThread.isIdle()) {
+ if (!forkLiftThread.isDeviceIdle()) {
return false;
}
diff --git a/src/main/java/com/zy/core/model/command/ShuttleCommand.java b/src/main/java/com/zy/core/model/command/ShuttleCommand.java
index f80ecf6..a0c8b22 100644
--- a/src/main/java/com/zy/core/model/command/ShuttleCommand.java
+++ b/src/main/java/com/zy/core/model/command/ShuttleCommand.java
@@ -46,4 +46,11 @@
*/
private List<NavigateNode> nodes;
+ public String getMode$() {
+ if (this.mode == null) {
+ return null;
+ }
+
+ return ShuttleCommandModeType.get(this.mode).desc;
+ }
}
diff --git a/src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java b/src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java
index 9d6ecb5..6e29736 100644
--- a/src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/ForkLiftProtocol.java
@@ -25,7 +25,7 @@
private Integer liftNo;
/**
- * 妯″紡0鍗曟満 1鑱旀満
+ * 妯″紡0鎵嬪姩 1鍗曟満 2鑱旀満
*/
private Integer model;
@@ -52,7 +52,7 @@
/**
* 浠诲姟妯″紡
*/
- private Integer mode = ForkLiftTaskModeType.NONE.id;
+ private Integer taskMode = ForkLiftTaskModeType.NONE.id;
/**
* 浠诲姟妯″紡鏋氫妇
@@ -123,17 +123,17 @@
/**
* 璁剧疆浠诲姟妯″紡
*/
- public void setMode(Integer mode) {
- this.mode = mode;
- this.modeType = ForkLiftTaskModeType.get(mode);
+ public void setTaskMode(Integer taskMode) {
+ this.taskMode = taskMode;
+ this.modeType = ForkLiftTaskModeType.get(taskMode);
}
/**
* 璁剧疆浠诲姟妯″紡
*/
- public void setMode(ForkLiftTaskModeType mode) {
- this.mode = mode.id;
- this.modeType = mode;
+ public void setMode(ForkLiftTaskModeType taskMode) {
+ this.taskMode = taskMode.id;
+ this.modeType = taskMode;
}
/**
@@ -186,6 +186,46 @@
}
}
+ public String getModel$() {
+ if (this.model == null) {
+ return "";
+ }
+
+ String name = "";
+ if (this.model == 0) {
+ name = "鎵嬪姩";
+ } else if (this.model == 1) {
+ name = "鍗曟満";
+ }else if (this.model == 2) {
+ name = "鑱旀満";
+ }
+ return name;
+ }
+
+ public String getProtocolStatus$() {
+ if (this.protocolStatus == null) {
+ return "";
+ }
+
+ return ForkLiftProtocolStatusType.get(this.protocolStatus).desc;
+ }
+
+ public String getTaskMode$() {
+ if (this.taskMode == null) {
+ return "";
+ }
+
+ return ForkLiftTaskModeType.get(this.taskMode).desc;
+ }
+
+ public String getIOMode$() {
+ if (this.iOMode == null) {
+ return "";
+ }
+
+ return ForkLiftIoModeType.get(this.iOMode).desc;
+ }
+
@Override
public ForkLiftProtocol clone() {
try {
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
index d761a6e..52f5643 100644
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
@@ -569,6 +569,7 @@
&& this.shuttleProtocol.getMode() == 1
&& this.shuttleProtocol.getPakMk()
&& this.shuttleProtocol.getErrorCode().equals("0")
+ && this.shuttleProtocol.getTaskNo() == 0
&& (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
|| this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id
|| this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.CHARGING_WAITING.id)
diff --git a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
index 9b9122f..f48bd4d 100644
--- a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
@@ -62,16 +62,16 @@
@Override
public boolean connect() {
boolean result = false;
- siemensS7Net = new SiemensS7Net(SiemensPLCS.S1500, slave.getIp());
+ siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp());
siemensS7Net.setRack(slave.getRack().byteValue());
siemensS7Net.setSlot(slave.getSlot().byteValue());
OperateResult connect = siemensS7Net.ConnectServer();
if(connect.IsSuccess){
result = true;
- OutputQueue.DEVP.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+ OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
News.info("璐у弶鎻愬崌鏈鸿繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
} else {
- OutputQueue.DEVP.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
+ OutputQueue.FORKLIFT.offer(MessageFormat.format( "銆恵0}銆戣揣鍙夋彁鍗囨満杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()));
News.error("璐у弶鎻愬崌鏈鸿繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
}
// siemensS7Net.ConnectClose();
@@ -134,7 +134,7 @@
private void readStatus() {
try {
//鑾峰彇鎻愬崌鏈烘暟鎹�
- OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.0", (short) 32);
+ OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.0", (short) 16);
if (result1.IsSuccess) {
if (null == forkLiftProtocol) {
forkLiftProtocol = new ForkLiftProtocol();
@@ -148,19 +148,19 @@
//妯″紡
forkLiftProtocol.setModel((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 0));
//PLC浠诲姟鍙�
- forkLiftProtocol.setWrkNo((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 4));
+ forkLiftProtocol.setWrkNo((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 2));
//浠诲姟鐘舵��
- forkLiftProtocol.setProtocolStatus((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 8));
+ forkLiftProtocol.setProtocolStatus((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 4));
//浠诲姟妯″紡
- forkLiftProtocol.setModel((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 12));
+ forkLiftProtocol.setTaskMode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 6));
//鍙栬揣鏁版嵁
- forkLiftProtocol.setPick((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 16));
+ forkLiftProtocol.setPick((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 8));
//鏀捐揣鏁版嵁
- forkLiftProtocol.setPut((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 20));
+ forkLiftProtocol.setPut((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 10));
//鍑哄叆搴撴ā寮�
- forkLiftProtocol.setIOMode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 24));
+ forkLiftProtocol.setIOMode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 12));
//鏁呴殰鐮�
- forkLiftProtocol.setErrorCode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 28));
+ forkLiftProtocol.setErrorCode((int) siemensS7Net.getByteTransform().TransInt16(result1.Content, 14));
//************琛ュ厖鎵╁睍瀛楁*************
InnerForkLiftExtend forkLiftExtend = (InnerForkLiftExtend) forkLiftProtocol.getExtend();
@@ -260,7 +260,7 @@
array[3] = command.getPut();//鏀捐揣鏁版嵁
OperateResult result = siemensS7Net.Write("DB103.0", array);
if (result.IsSuccess) {
- OperateResult result2 = siemensS7Net.Write("DB103.16", command.getConfirm());
+ OperateResult result2 = siemensS7Net.Write("DB103.8", command.getConfirm());
if (result2.IsSuccess) {
response.setResult(true);
}
@@ -282,23 +282,43 @@
public boolean isIdle() {
if (this.forkLiftProtocol.getTaskNo() == null
|| this.forkLiftProtocol.getProtocolStatus() == null
+ || this.forkLiftProtocol.getModel() == null
) {
return false;
}
boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id
- && this.forkLiftProtocol.getTaskNo() == 0;
+ && this.forkLiftProtocol.getWrkNo() == 0
+ && this.forkLiftProtocol.getTaskNo() == 0
+ && this.forkLiftProtocol.getModel() == 2;
return res;
}
@Override
public boolean isDeviceIdle() {
- return false;
+ return isDeviceIdle(null);
}
@Override
public boolean isDeviceIdle(ExecuteSupport support) {
- return false;
+ if (null != support) {
+ Boolean judgement = support.judgement();
+ if (judgement != null && !judgement) {
+ return true;
+ }
+ }
+
+ if (this.forkLiftProtocol.getTaskNo() == null
+ || this.forkLiftProtocol.getProtocolStatus() == null
+ || this.forkLiftProtocol.getModel() == null
+ ) {
+ return false;
+ }
+
+ boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id
+ && this.forkLiftProtocol.getWrkNo() == 0
+ && this.forkLiftProtocol.getModel() == 2;
+ return res;
}
@Override
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 05d2c06..35545c5 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -140,7 +140,7 @@
# 璐у弶鎻愬崌鏈�1
forkLift[0]:
id: 1
- ip: 10.10.10.131
+ ip: 10.10.20.20
port: 102
rack: 0
slot: 0
diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml
index c6e02e4..f634991 100644
--- a/src/main/resources/mapper/WrkMastMapper.xml
+++ b/src/main/resources/mapper/WrkMastMapper.xml
@@ -139,7 +139,7 @@
where 1=1
and shuttle_no = #{shuttleNo}
and wrk_sts not in (9,10,109,110,210)
- and io_type not in (200)
+ and io_type not in (200,300)
order by io_pri desc,io_time,wrk_no asc
limit 0,1
</select>
@@ -163,7 +163,7 @@
<select id="selectChargeWorking" resultMap="BaseResultMap">
select * from asr_wrk_mast
- where wrk_sts in (201,202,203)
+ where io_type in (300)
and shuttle_no = #{shuttleNo}
order by io_pri desc,io_time,wrk_no asc
</select>
diff --git a/src/main/webapp/views/forklift.html b/src/main/webapp/views/forklift.html
new file mode 100644
index 0000000..205a290
--- /dev/null
+++ b/src/main/webapp/views/forklift.html
@@ -0,0 +1,467 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>鎻愬崌鏈虹洃鎺х鐞�</title>
+ <link rel="stylesheet" type="text/css" href="../static/css/normalize.css">
+ <link rel="stylesheet" type="text/css" href="../static/css/common.css">
+ <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
+ <link rel="stylesheet" href="../static/css/lift.css">
+ <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
+ <script type="text/javascript" src="../static/js/layer/layer.js"></script>
+ <script type="text/javascript" src="../static/layui/layui.js"></script>
+ <script type="text/javascript" src="../static/js/common.js"></script>
+</head>
+<body>
+<div style="padding: 10px;height: 100%;float: left;width: 6%">
+ <div class="button-window"></div>
+</div>
+<div style="height: 100%;padding-left: 6%">
+ <div style="padding: 10px;height: 100%">
+ <!-- 鏃ュ織鐩戞帶鏉� -->
+ <div class="log-board">
+ <div class="command-log" id="commandLogId" style="width: 10%;">
+ </div>
+ <div class="lift-state" style="width: 90%;">
+ <table id="lift-state-table">
+ <thead>
+ <tr>
+ <th>鎻愬崌鏈�</th>
+ <th>宸ヤ綔鍙�</th>
+ <th>PLC浠诲姟鍙�</th>
+ <th>妯″紡</th>
+ <th>浠诲姟鐘舵��</th>
+ <th>浠诲姟妯″紡</th>
+ <th>鍙栬揣鏁版嵁</th>
+ <th>鏀捐揣鏁版嵁</th>
+ <th>鍑哄叆搴撴ā寮�</th>
+ <th>鏁呴殰鐮�</th>
+ </tr>
+ </thead>
+ <tbody>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ <!-- 鎻愬崌鏈虹姸鎬� -->
+ <div class="lift-msg">
+ <table id="lift-msg-table">
+ <thead>
+ <tr>
+ <th>鎻愬崌鏈�</th>
+ <th>宸ヤ綔鍙�</th>
+ <th>浠诲姟鍦板潃</th>
+ <th>鐩殑鍦板潃</th>
+ <th>宸插畬鎴愮殑浠诲姟鍙�</th>
+ <th>灞�</th>
+ <th>浣滀笟鏍囪</th>
+ <th>绌挎杞﹀彿</th>
+ </tr>
+ </thead>
+ <tbody>
+ </tbody>
+ </table>
+ </div>
+ <!-- 鎵嬪姩鎿嶄綔 -->
+ <div class="lift-operation">
+ <!-- 閬僵灞� -->
+ <div class="lift-operation-shade">
+ <span class="lift-operation-shade-span">
+ WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
+ </span>
+ </div>
+ <!-- 璁惧浠诲姟閫夋嫨 -->
+ <div class="task-select">
+ <!-- 閫夋嫨 -->
+ <div id="lift-select" class="operator-item">
+ <span class="select-title">鎻愬崌鏈哄彿</span>
+ <div class="select-container" id="liftRadioBoxId">
+ <!-- <label><input type="radio" name="liftSelect" value="1" checked> 1鍙锋彁鍗囨満</label>-->
+ </div>
+ </div>
+ </div>
+
+ <!-- 璁惧浠诲姟鎿嶄綔 -->
+ <div class="task-operator">
+ <fieldset>
+ <legend>鎵嬪姩鎿嶄綔</legend>
+ <div class="button-group">
+ <div class="select-container-item">
+ <span>婧愮珯</span>
+ <label><input id="sourceStaNo" type="text" name="sourceStaNo" /></label>
+ </div>
+ <div class="select-container-item">
+ <span>鐩爣绔�</span>
+ <label><input id="staNo" type="text" name="staNo" /></label>
+ </div>
+ <button class="item" onclick="liftOperator(1)">灏忚溅鎹㈠眰</button>
+ <button class="item" onclick="liftOperator(2)">绉诲姩鎵樼洏</button>
+ <button class="item" onclick="liftOperator(0)">澶嶄綅</button>
+ </div>
+ </fieldset>
+ </div>
+
+ </div>
+ <!-- 鎻愬崌鏈烘棩蹇楄緭鍑� -->
+ <div class="lift-output-board">
+ <textarea id="lift-output"></textarea>
+ </div>
+
+ <div id="lift-detl" style="display: none">
+ <div>
+ <div class="form-item">
+ <label class="form-label">绔欏彿:</label>
+ <div class="form-input">
+ <input id="liftNo" name="liftNo" class="layui-input" lay-verify="required|number" autocomplete="off" disabled="disabled">
+ </div>
+ </div>
+ <div class="form-item">
+ <label class="form-label">宸ヤ綔鍙�:</label>
+ <div class="form-input">
+ <input id="workNo" name="workNo" type="number" class="layui-input" lay-verify="number" autocomplete="off">
+ </div>
+ </div>
+ <div class="form-item">
+ <label class="form-label">浣滀笟鏍囪:</label>
+ <div class="form-input">
+ <input id="pakMk" name="pakMk" type="text" class="layui-input" autocomplete="off">
+ </div>
+ </div>
+ <div class="form-item form-button-container">
+ <button class="form-button" id="save">淇濆瓨</button>
+ <button class="form-button" id="cancel" style="background-color: #D0D0D0">鍙栨秷</button>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
+<script>
+ // 绌虹櫧琛屾暟
+ var liftStateTableBlankRows = 0;
+ var liftMsgTableBlankRows = 0;
+ // 瀹為檯琛屾暟
+ var liftStateTableFullRows = 0;
+ var liftMsgTableFullRows = 0;
+ // 鍒濆鍖�
+ var liftOutputDom = document.getElementById("lift-output");
+ $(document).ready(function() {
+ initliftStateTable();
+ getliftStateInfo();
+ initliftMsgTable();
+ getliftMsgInfo();
+ operatorBlockShow();
+ setliftRadio();
+ });
+
+ setInterval(function () {
+ getliftStateInfo()
+ getliftMsgInfo();
+ },1000)
+ setInterval(function () {
+ getliftOutput();
+ operatorBlockShow();
+ },500);
+
+ // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
+ function operatorBlockShow() {
+ if (parent.systemRunning) {
+ $('.lift-operation').css("opacity", "0.5");
+ $('.lift-operation-shade').show();
+ $('.lift-operation-shade-span').show();
+ } else {
+ $('.lift-operation').css("opacity", "1");
+ $('.lift-operation-shade').hide();
+ $('.lift-operation-shade-span').hide();
+ }
+ }
+
+ $(document).on('click ','#save', function () {
+ http.post(baseUrl+ "/forkLift/detl/update", {
+ liftNo: $('#liftNo').val(),
+ workNo: $('#workNo').val(),
+ pakMk: $('#pakMk').val(),
+ token: $('#token').val(),
+ }, function (res) {
+ layer.msg("淇敼鎴愬姛", {icon: 1,});
+ layer.close(layerDetl);
+ })
+ })
+
+ function setliftRadio() {
+ $.ajax({
+ url: baseUrl+ "/forkLift/table/lift/state",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ let table = res.data;
+ for (let i=1;i<=table.length;i++){
+ //娓叉煋鎻愬崌鏈洪�夐」html
+ let liftRadioBox = '<label><input type="radio" name="liftSelect" ';
+ if (i === 1) {
+ liftRadioBox += 'checked '
+ }
+ liftRadioBox += 'value="' + table[i - 1].liftNo + '"> ' + table[i - 1].liftNo + '鍙锋彁鍗囨満</label>'
+ $("#liftRadioBoxId").append(liftRadioBox)
+
+
+ //娓叉煋鎻愬崌鏈烘暟鎹淮鎶ゅ拰璁惧淇℃伅html
+ let liftCommandLogBox = '<div class="lift-command-item" data-liftNo="' + table[i - 1].liftNo + '">\n' +
+ '<label>' + table[i - 1].liftNo + '#</label>\n' +
+ '</div>'
+ $("#commandLogId").append(liftCommandLogBox);
+ }
+ } else if (res.code === 403){
+ window.location.href = baseUrl+"/login";
+ } else {
+ console.log(res.msg);
+ }
+ }
+ });
+ }
+
+ // 鎻愬崌鏈轰俊鎭〃鑾峰彇 ---- 琛ㄤ竴
+ function getliftStateInfo() {
+ let tableEl = $('#lift-state-table');
+ $.ajax({
+ url: baseUrl+ "/forkLift/table/lift/state",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ let table = res.data;
+ if (table.length > liftStateTableBlankRows && table.length !== liftStateTableFullRows) {
+ initliftStateTable(table.length-liftStateTableBlankRows);
+ liftStateTableFullRows = table.length;
+ }
+ for (let i=1;i<=table.length;i++){
+ // $("#mode-"+table[i-1].liftNo).html(table[i-1].statusVal===0?'鑱旀満':'鑴辨満');
+ let tr = tableEl.find("tr").eq(i);
+ setVal(tr.children("td").eq(0), table[i-1].liftNo);
+ setVal(tr.children("td").eq(1), table[i-1].taskNo);
+ setVal(tr.children("td").eq(2), table[i-1].wrkNo);
+ setVal(tr.children("td").eq(3), table[i-1].model$);
+ setVal(tr.children("td").eq(4), table[i-1].protocolStatus$);
+ setVal(tr.children("td").eq(5), table[i-1].taskMode$);
+ setVal(tr.children("td").eq(6), table[i-1].pick);
+ setVal(tr.children("td").eq(7), table[i-1].put);
+ setVal(tr.children("td").eq(8), table[i-1].iOMode$);
+ setVal(tr.children("td").eq(9), table[i-1].errorCode);
+ }
+ } else if (res.code === 403){
+ window.location.href = baseUrl+"/login";
+ } else {
+ console.log(res.msg);
+ }
+ }
+ });
+ }
+
+ // 鎻愬崌鏈烘暟鎹〃鑾峰彇 ---- 琛ㄤ簩
+ function getliftMsgInfo() {
+ let tableEl = $('#lift-msg-table');
+ $.ajax({
+ url: baseUrl+ "/forkLift/table/lift/msg",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ var table = res.data;
+ if (table.length > liftMsgTableBlankRows && table.length !== liftMsgTableFullRows) {
+ initliftMsgTable(table.length-liftMsgTableBlankRows);
+ liftMsgTableFullRows = table.length;
+ }
+ for (var i=1;i<=table.length;i++){
+ var tr = tableEl.find("tr").eq(i);
+ setVal(tr.children("td").eq(0), table[i-1].liftNo);
+ setVal(tr.children("td").eq(1), table[i-1].workNo);
+ setVal(tr.children("td").eq(2), table[i-1].taskAddress);
+ setVal(tr.children("td").eq(3), table[i-1].distAddress);
+ setVal(tr.children("td").eq(4), table[i-1].completeTaskNo);
+ setVal(tr.children("td").eq(5), table[i-1].lev);
+ setVal(tr.children("td").eq(6), table[i-1].pakMk);
+ setVal(tr.children("td").eq(7), table[i-1].shuttleNo);
+ }
+ } else if (res.code === 403){
+ window.location.href = baseUrl+"/login";
+ } else {
+ console.log(res.msg);
+ }
+ }
+ });
+ }
+
+ // 鎻愬崌鏈烘棩蹇楄緭鍑� -----------------------------------------------------------------------
+ function getliftOutput() {
+ $.ajax({
+ url: baseUrl + "/forkLift/output/lift",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ liftOutput(res.data);
+ } else if (res.code === 403) {
+ window.location.href = baseUrl + "/login";
+ } else {
+ console.log(res.msg);
+ }
+ }
+ })
+ }
+
+ // 浠诲姟鎸囦护涓嬪彂
+ function liftOperator(liftTaskMode) {
+ http.post(baseUrl+"/forkLift/operator/lift", {
+ liftNo: $('input[name="liftSelect"]:checked').val(),
+ liftTaskMode: liftTaskMode,
+ lev: $("#liftLev").val(),
+ sourceStaNo: $("#sourceStaNo").val(),
+ staNo: $("#staNo").val()
+ }, function (res) {
+ layer.msg(res.msg, {icon: 1});
+ });
+ }
+
+
+ // ------------------------------------------------------------------------------------------------
+
+ // 鎻愬崌鏈轰俊鎭〃鑾峰彇 ----- 琛ㄤ竴
+ function initliftStateTable(row) {
+ let line;
+ if (row === undefined){
+ let one = $('#lift-state-table thead').height();
+ let total = $('.lift-state').height();
+ let count = total / one;
+ count = parseInt(count) - 1;
+ liftStateTableBlankRows = count;
+ line = count;
+ } else {
+ line = row;
+ }
+ let html = "";
+ for (let i = 0; i < line; i ++){
+ html += " <tr>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " </tr>\n";
+ }
+ $('#lift-state-table tbody').after(html);
+ }
+
+ // 鎻愬崌鏈烘暟鎹〃鑾峰彇 ----- 琛ㄤ簩
+ function initliftMsgTable(row) {
+ let line;
+ if (row === undefined){
+ let one = $('#lift-msg-table thead').height();
+ let total = $('.lift-msg').height();
+ let count = total / one;
+ count = parseInt(count) - 1;
+ liftMsgTableBlankRows = count;
+ line = count;
+ } else {
+ line = row;
+ }
+ let html = "";
+ for (let i = 0; i < line; i ++){
+ html += " <tr>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " <td></td>\n" +
+ " </tr>\n";
+ }
+ $('#lift-msg-table tbody').after(html);
+ }
+
+ // 鏃ュ織杈撳嚭妗�
+ function liftOutput(content){
+ liftOutputDom.value += content;
+ liftOutputDom.scrollTop = liftOutputDom.scrollHeight;
+ }
+
+ // 璇︽儏鎿嶄綔 -------------------------------------------------------------------------
+ var layerDetl;
+ $(document).on('dblclick ','#lift-msg-table tr', function () {
+ var liftNo = $(this).children("td").eq(0).html();
+ if (liftNo !== null && liftNo !== "") {
+ layerDetl = layer.open({
+ type: 1,
+ title: false,
+ shadeClose: true,
+ offset: 'rt',
+ anim: 5,
+ shade: [0],
+ area: ['340px', '255px'],
+ closeBtn: 0,
+ content: $("#lift-detl"),
+ success: function(layero, index){
+ $.ajax({
+ url: baseUrl+ "/forkLift/table/lift/msg",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ var table = res.data;
+ for (var i=1;i<=table.length;i++){
+ if (liftNo == table[i-1].liftNo) {
+ $('#liftNo').val(liftNo);
+ $('#workNo').val(table[i-1].workNo);
+ $('#pakMk').val(table[i-1].pakMk);
+ $('#token').val(table[i-1].token);
+ }
+ }
+ } else if (res.code === 403){
+ window.location.href = baseUrl+"/login";
+ } else {
+ console.log(res.msg);
+ }
+ }
+ });
+ },
+ end: function () {
+ $('#liftNo').val("");
+ $('#workNo').val("");
+ $('#pakMk').val("");
+ $('#token').val("");
+ }
+ })
+ }
+ });
+
+ $(document).on('click ','#cancel', function () {
+ $('#liftNo').val("");
+ $('#workNo').val("");
+ $('#pakMk').val("");
+ $('#token').val("");
+ layer.close(layerDetl);
+ })
+
+</script>
diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index 74db576..1f51411 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -20,7 +20,7 @@
<ul class="cl-effect-4">
<li><a id="console" onclick="nav(this.id)" class="nav-select" href="#">涓绘帶鍥�</a></li>
<li><a id="pipeline" onclick="nav(this.id)" class="nav-unselect" href="#">杈撻�佽澶�</a></li>
- <li><a id="lift" onclick="nav(this.id)" class="nav-unselect" href="#">鎻愬崌鏈�</a></li>
+ <li><a id="forklift" onclick="nav(this.id)" class="nav-unselect" href="#">鎻愬崌鏈�</a></li>
<!-- <li><a id="ste" onclick="nav(this.id)" class="nav-unselect" href="#">绌挎杞�</a></li>-->
<li><a id="shuttle" onclick="nav(this.id)" class="nav-unselect" href="#">鍥涘悜绌挎杞�</a></li>
<li><a id="task" onclick="nav(this.id)" class="nav-unselect" href="#">浠诲姟绠$悊</a></li>
diff --git a/src/main/webapp/views/task.html b/src/main/webapp/views/task.html
index cd5fb35..d4b48bb 100644
--- a/src/main/webapp/views/task.html
+++ b/src/main/webapp/views/task.html
@@ -80,18 +80,39 @@
</div>
<el-dialog :title="shuttleCommandTitle" :visible.sync="shuttleCommandVisible">
- <el-table ref="singleTable" :data="shuttleCommandData.assignCommand.commands" style="width: 100%;" :row-class-name="tableRowClassName">
- <el-table-column property="mode" label="鍛戒护绫诲瀷">
+ <el-table ref="singleTable" :data="shuttleCommandData.commands" style="width: 100%;" :row-class-name="tableRowClassName">
+ <el-table-column property="mode$" label="鍛戒护绫诲瀷">
</el-table-column>
<el-table-column property="start" label="璧风偣">
+ <template slot-scope="scope">
+ <div v-if="scope.row.nodes">
+ x:{{ scope.row.nodes[0].x }}
+ y:{{ scope.row.nodes[0].y }}
+ z:{{ scope.row.nodes[0].z }}
+ </div>
+ </template>
</el-table-column>
<el-table-column property="target" label="缁堢偣">
+ <template slot-scope="scope">
+ <div v-if="scope.row.nodes">
+ x:{{ scope.row.nodes[scope.row.nodes.length-1].x }}
+ y:{{ scope.row.nodes[scope.row.nodes.length-1].y }}
+ z:{{ scope.row.nodes[scope.row.nodes.length-1].z }}
+ </div>
+ </template>
</el-table-column>
- <el-table-column property="taskId" label="taskId">
+ <el-table-column property="taskNo" label="浠诲姟鍙�">
</el-table-column>
- <el-table-column property="robotId" label="robotId">
+ <el-table-column property="shuttleNo" label="绌挎杞�">
</el-table-column>
<el-table-column property="complete" label="鏄惁瀹屾垚">
+ <template slot-scope="scope">
+ <el-switch
+ v-model="scope.row.complete"
+ active-color="#13ce66"
+ @change="changeComplete(scope)">
+ </el-switch>
+ </template>
</el-table-column>
<el-table-column label="鎿嶄綔" width="100">
<template slot-scope="scope">
@@ -345,6 +366,34 @@
}
}
});
+ },
+ changeComplete(scope) {
+ let that = this;
+ let idx = scope.$index;
+ $.ajax({
+ url: baseUrl + "/shuttle/command/completeSwitch",
+ headers: {
+ 'token': localStorage.getItem('token')
+ },
+ data: {
+ wrkNo: that.shuttleCommandWrkNo,
+ commandStep: idx,
+ complete: scope.row.complete ? 1 : 0
+ },
+ method: 'GET',
+ success: function(res) {
+ if (res.code == 200) {
+ that.showShuttleCommand(that.shuttleCommandWrkNo)
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ that.$message({
+ message: res.msg,
+ type: 'error'
+ });
+ }
+ }
+ });
}
},
})
--
Gitblit v1.9.1