From 8b4f5b2b23023986db813242cd04f4650537decd Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 05 十一月 2025 16:51:26 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java | 28 +
src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java | 53 ++
src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java | 254 ++++++++++
src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java | 42 +
src/main/java/com/zy/core/network/entity/ZyCrnStatusEntity.java | 125 +++++
src/main/java/com/zy/core/model/command/CrnCommand.java | 68 ++
src/main/java/com/zy/core/model/protocol/CrnProtocol.java | 19
src/main/java/com/zy/core/ServerBootstrap.java | 42 -
src/main/java/com/zy/core/enums/CrnTaskModeType.java | 46 +
/dev/null | 211 --------
src/main/java/com/zy/core/network/DeviceConnectPool.java | 36 +
src/main/java/com/zy/asrs/controller/ConsoleController.java | 185 +++++++
src/main/java/com/zy/core/network/ZyCrnConnectThread.java | 69 ++
src/main/java/com/zy/core/cache/OutputQueue.java | 14
src/main/java/com/zy/core/network/api/ZyCrnConnectApi.java | 17
src/main/java/com/zy/core/thread/CrnThread.java | 12
src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java | 231 +++++++++
17 files changed, 1,197 insertions(+), 255 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/ConsoleController.java b/src/main/java/com/zy/asrs/controller/ConsoleController.java
index 50c24b6..5509d4b 100644
--- a/src/main/java/com/zy/asrs/controller/ConsoleController.java
+++ b/src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -1,12 +1,36 @@
package com.zy.asrs.controller;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
+import com.core.exception.CoolException;
+import com.zy.asrs.domain.enums.CrnStatusType;
import com.zy.asrs.domain.param.SystemSwitchParam;
+import com.zy.asrs.domain.vo.CrnDetailVo;
+import com.zy.asrs.domain.vo.CrnLatestDataVo;
+import com.zy.asrs.entity.BasCrnpErr;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.entity.WrkMast;
+import com.zy.asrs.service.BasCrnpErrService;
+import com.zy.asrs.service.DeviceConfigService;
+import com.zy.asrs.service.WrkMastService;
+import com.zy.common.CodeRes;
+import com.zy.core.Slave;
+import com.zy.core.ThreadHandler;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.CrnModeType;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.protocol.CrnProtocol;
import com.zy.core.properties.SystemProperties;
+import com.zy.core.thread.CrnThread;
+import com.zy.core.thread.impl.ZySiemensCrnThread;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
/**
* 涓绘帶鍥炬帴鍙�
@@ -16,6 +40,13 @@
@RestController
@RequestMapping("/console")
public class ConsoleController {
+
+ @Autowired
+ private DeviceConfigService deviceConfigService;
+ @Autowired
+ private WrkMastService wrkMastService;
+ @Autowired
+ private BasCrnpErrService basCrnpErrService;
@PostMapping("/system/running/status")
@ManagerAuth(memo = "绯荤粺杩愯鐘舵��")
@@ -42,4 +73,158 @@
return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get()));
}
+// @PostMapping("/latest/data/site")
+// @ManagerAuth(memo = "绔欑偣瀹炴椂鏁版嵁")
+// public R siteLatestData(){
+// List<SiteLatestDataVo> vos = new ArrayList<>();
+// Map<Integer, StaProtocol> stations = new HashMap<>();
+// for (DevpSlave devp : slaveProperties.getDevp()) {
+// DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
+// if (null != devpThread) {
+// stations.putAll(devpThread.getStation());
+// }
+// }
+// for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) {
+// SiteLatestDataVo vo = new SiteLatestDataVo();
+// StaProtocol staProtocol = entry.getValue();
+// vo.setSiteId(String.valueOf(entry.getKey())); // 绔欑偣缂栧彿
+// vo.setWorkNo(staProtocol.getWorkNo()); // 宸ヤ綔鍙�
+// vo.setSiteStatus(SiteStatusType.process(staProtocol)); // 鐘舵��
+// vos.add(vo);
+// }
+// return R.ok().add(vos);
+// }
+
+ @PostMapping("/latest/data/crn")
+ @ManagerAuth(memo = "鍫嗗灈鏈哄疄鏃舵暟鎹�")
+ public R crnLatestData(){
+ List<CrnLatestDataVo> vos = new ArrayList<>();
+
+ List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+ .eq("device_type", String.valueOf(SlaveType.Crn)));
+ for (DeviceConfig deviceConfig : crnList) {
+ // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+ CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, deviceConfig.getDeviceNo());
+ if (crnThread == null) {
+ continue;
+ }
+
+ CrnProtocol crnProtocol = crnThread.getStatus();
+ if (crnProtocol == null) {
+ continue;
+ }
+ CrnLatestDataVo vo = new CrnLatestDataVo();
+ vo.setCrnId(crnProtocol.getCrnNo()); // 鍫嗗灈鏈虹紪鍙�
+
+ vo.setOffset((double) new Random().nextInt(560)); // 鍫嗗灈鏈哄亸绉婚噺
+ vo.setBay(crnProtocol.getBay()); // 褰撳墠鍒�
+ /**
+ * 鍫嗗灈鏈虹姸鎬佸垽鏂�
+ */
+ if (crnProtocol.getAlarm() > 0) {
+ vo.setCrnStatus(CrnStatusType.MACHINE_ERROR);
+ } else {
+ if (crnProtocol.getTaskNo()>0) {
+ WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
+ if (wrkMast != null) {
+ vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType()));
+ } else {
+ vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO);
+ }
+ } else {
+ vo.setCrnStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO: CrnStatusType.MACHINE_UN_AUTO);
+ }
+ }
+ vos.add(vo);
+ }
+ return R.ok().add(vos);
+ }
+
+// @PostMapping("/latest/data/rgv")
+// @ManagerAuth(memo = "RGV瀹炴椂鏁版嵁")
+// public R rgvLatestData(){
+// List<RgvLatestDataVo> vos = new ArrayList<>();
+// for (RgvSlave rgvSlave : slaveProperties.getRgv()) {
+// // 鑾峰彇鍫嗗灈鏈轰俊鎭�
+// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId());
+// if (rgvThread == null) {
+// continue;
+// }
+// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol();
+// if (rgvProtocol == null) {
+// continue;
+// }
+// RgvLatestDataVo vo = new RgvLatestDataVo();
+// vo.setRgvId(rgvProtocol.getRgvNo()); // RGV缂栧彿
+// vo.setTrackSiteNo(String.valueOf(rgvProtocol.getRgvPos()));
+// vo.setRgvStatus(rgvProtocol.getStatusType());
+// vos.add(vo);
+//
+// }
+// Object object = redisUtil.get("rgvLatestData");
+// List<Object> siteLatestDataVos = JSON.parseArray(object.toString());
+// return R.ok().add(siteLatestDataVos);
+// }
+
+// @PostMapping("/latest/data/barcode")
+// @ManagerAuth(memo = "鏉$爜鎵弿浠疄鏃舵暟鎹�")
+// public R barcodeLatestData(){
+// List<BarcodeDataVo> list = new ArrayList<>();
+// for (Slave barcode : slaveProperties.getBarcode()) {
+// BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId());
+// if (null == barcodeThread) {
+// continue;
+// }
+// BarcodeDataVo vo = new BarcodeDataVo();
+// vo.setBarcodeId(barcode.getId());
+// vo.setCodeValue(barcodeThread.getBarcode());
+// list.add(vo);
+// }
+// return R.ok().add(list);
+// }
+
+ @PostMapping("/crn/detail")
+ @ManagerAuth(memo = "鍫嗗灈鏈鸿澶囨暟鎹鎯�")
+ public R crnDetail(@RequestParam Integer crnNo){
+ if (Cools.isEmpty(crnNo)){
+ return R.parse(CodeRes.EMPTY);
+ }
+ CrnDetailVo vo = new CrnDetailVo();
+
+ DeviceConfig deviceConfig = deviceConfigService.selectOne(new EntityWrapper<DeviceConfig>()
+ .eq("device_type", String.valueOf(SlaveType.Crn))
+ .eq("device_no", crnNo)
+ );
+
+ if (deviceConfig == null) {
+ return R.error("璁惧涓嶅瓨鍦�");
+ }
+
+ CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crnNo);
+ CrnProtocol crnProtocol = crnThread.getStatus();
+ vo.setCrnNo(crnNo);
+ vo.setWorkNo(crnProtocol.getTaskNo());
+ vo.setCrnStatus(crnProtocol.getStatusType().desc);
+
+ if (crnProtocol.getAlarm() > 0) {
+ BasCrnpErr crnError = basCrnpErrService.selectById(crnProtocol.getAlarm());
+ vo.setError(crnError == null ? "鏈煡寮傚父" : crnError.getErrName());
+ }
+
+ if (crnProtocol.getTaskNo() > 0) {
+ WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
+ if (wrkMast != null) {
+ vo.setSourceStaNo(String.valueOf(wrkMast.getSourceStaNo()));
+ vo.setStaNo(String.valueOf(wrkMast.getStaNo()));
+ vo.setWrkSts(wrkMast.getWrkSts$()); // 宸ヤ綔鐘舵��
+ vo.setIoType(wrkMast.getIoType$()); // 鍏ュ嚭搴撶被鍨�
+ vo.setSourceLocNo(wrkMast.getSourceLocNo$());
+ vo.setLocNo(wrkMast.getLocNo$());
+ vo.setCrnStatus(crnProtocol.getStatusType().desc);
+ vo.setError(""); // todo
+ }
+ }
+ return R.ok().add(vo);
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java b/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java
new file mode 100644
index 0000000..99b6d01
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/enums/CrnStatusType.java
@@ -0,0 +1,53 @@
+package com.zy.asrs.domain.enums;
+
+/**
+ * 鍫嗗灈鏈虹姸鎬佹灇涓�
+ */
+public enum CrnStatusType {
+
+ // 鍏ュ簱
+ MACHINE_PAKIN("鍏ュ簱"),
+ // 鍑哄簱
+ MACHINE_PAKOUT("鍑哄簱"),
+ // 搴撳埌搴�
+ MACHINE_STOCK_MOVE("搴撳埌搴�"),
+ // 绔欏埌绔�
+ MACHINE_SITE_MOVE("绔欏埌绔�"),
+ // p to p
+ MACHINE_P_MOVE("PToP"),
+ // 寮傚父
+ MACHINE_ERROR("寮傚父"),
+ // 鑷姩
+ MACHINE_AUTO("鑷姩"),
+ // 闈炶嚜鍔�/鎵嬪姩
+ MACHINE_UN_AUTO("闈炶嚜鍔�"),
+ ;
+
+ private String desc;
+ CrnStatusType(String desc){
+ this.desc = desc;
+ }
+
+ public String getDesc() {
+ return desc;
+ }
+
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+
+ public static CrnStatusType process(Integer ioType){
+ if (ioType>100) {
+ return MACHINE_PAKOUT;
+ } else if (ioType < 100 && ioType!=3 && ioType!=6 && ioType!=11) {
+ return MACHINE_PAKIN;
+ } else if (ioType == 3) {
+ return MACHINE_SITE_MOVE;
+ } else if (ioType == 11) {
+ return MACHINE_STOCK_MOVE;
+ } else {
+ return MACHINE_ERROR;
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java
new file mode 100644
index 0000000..6bc9aa6
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/vo/CrnDetailVo.java
@@ -0,0 +1,42 @@
+package com.zy.asrs.domain.vo;
+
+import lombok.Data;
+
+/**
+ * 鍫嗗灈鏈鸿鎯呰鍥惧璞�
+ * Created by vincent on 2020-06-03
+ */
+@Data
+public class CrnDetailVo {
+
+ // 鍫嗗灈鏈哄彿
+ private Integer crnNo;
+
+ // 宸ヤ綔鍙�
+ private Integer workNo;
+
+ // 婧愮珯
+ private String sourceStaNo = "";
+
+ // 鐩爣绔�
+ private String staNo = "";
+
+ // 宸ヤ綔鐘舵��
+ private String wrkSts = "";
+
+ // 鍑哄叆绫诲瀷
+ private String ioType = "";
+
+ // 婧愬簱浣�
+ private String sourceLocNo = "";
+
+ // 鐩爣搴撲綅
+ private String locNo = "";
+
+ // 鍫嗗灈鏈虹姸鎬�
+ private String crnStatus = "";
+
+ // 寮傚父
+ private String error = "";
+
+}
diff --git a/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java b/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java
new file mode 100644
index 0000000..fa1c45f
--- /dev/null
+++ b/src/main/java/com/zy/asrs/domain/vo/CrnLatestDataVo.java
@@ -0,0 +1,28 @@
+package com.zy.asrs.domain.vo;
+
+import com.zy.asrs.domain.enums.CrnStatusType;
+import lombok.Data;
+
+/**
+ * 鍫嗗灈鏈烘渶鏂版暟鎹鍥惧璞�
+ * Created by vincent on 2020-06-01
+ */
+@Data
+public class CrnLatestDataVo {
+
+ // 鍫嗗灈鏈虹紪鍙�
+ private Integer crnId;
+
+ // 鍋忕Щ閲�
+ private Double offset;
+
+ // 褰撳墠鍒�
+ private Integer bay;
+
+ private CrnStatusType crnStatus;
+
+ public String getCrnStatus(){
+ return crnStatus.toString().toLowerCase().replaceAll("_", "-");
+ }
+
+}
diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index 7cadf28..daa86a0 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -1,11 +1,14 @@
package com.zy.core;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.exception.CoolException;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.MessageQueue;
+import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
+import com.zy.core.thread.impl.ZySiemensCrnThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
@@ -77,31 +80,20 @@
}
private void initThread(){
-// News.info("鍒濆鍖栧爢鍨涙満........................................................");
-// List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
-// .eq("device_type", String.valueOf(SlaveType.Crn)));
-// for (DeviceConfig deviceConfig : crnList) {
-// BasLift basLift = basLiftService.selectOne(new EntityWrapper<BasLift>().eq("lift_no", deviceConfig.getDeviceNo()));
-// if (basLift == null) {
-// throw new CoolException("鏈厤缃揣鍙夋彁鍗囨満鏁版嵁");
-// }
-//
-// ThreadHandler thread = null;
-// if (deviceConfig.getThreadImpl().equals("ZyForkLiftThread")) {
-// thread = new ZyForkLiftThread(deviceConfig, basLift.getStationList$(), redisUtil);
-// } else {
-// throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
-// }
-//
-// new Thread(thread).start();
-// SlaveConnection.put(SlaveType.ForkLift, deviceConfig.getDeviceNo(), thread);
-//
-// if (deviceConfig.getFake() == 1) {
-// fakeDevices.add(deviceConfig);
-// }else {
-// allDevices.add(deviceConfig);
-// }
-// }
+ News.info("鍒濆鍖栧爢鍨涙満........................................................");
+ List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+ .eq("device_type", String.valueOf(SlaveType.Crn)));
+ for (DeviceConfig deviceConfig : crnList) {
+ ThreadHandler thread = null;
+ if (deviceConfig.getThreadImpl().equals("ZySiemensCrnThread")) {
+ thread = new ZySiemensCrnThread(deviceConfig, redisUtil);
+ } else {
+ throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ }
+
+ new Thread(thread).start();
+ SlaveConnection.put(SlaveType.Crn, deviceConfig.getDeviceNo(), thread);
+ }
}
diff --git a/src/main/java/com/zy/core/cache/OutputQueue.java b/src/main/java/com/zy/core/cache/OutputQueue.java
index edb1923..7e08c3c 100644
--- a/src/main/java/com/zy/core/cache/OutputQueue.java
+++ b/src/main/java/com/zy/core/cache/OutputQueue.java
@@ -9,11 +9,13 @@
*/
public class OutputQueue {
- //鍥涘悜绌挎杞﹁緭鍑烘棩蹇�
- public static ArrayBlockingQueue<String> SHUTTLE = new ArrayBlockingQueue<>(32);
- //鎻愬崌鏈鸿緭鍑烘棩蹇�
- public static ArrayBlockingQueue<String> LIFT = new ArrayBlockingQueue<>(32);
- //璐у弶鎻愬崌鏈鸿緭鍑烘棩蹇�
- public static ArrayBlockingQueue<String> FORKLIFT = new ArrayBlockingQueue<>(32);
+ // 鍫嗗灈鏈鸿緭鍑烘棩蹇�
+ public static ArrayBlockingQueue<String> CRN = new ArrayBlockingQueue<>(32);
+ // 杈撻�佺嚎杈撳嚭鏃ュ織
+ public static ArrayBlockingQueue<String> DEVP = new ArrayBlockingQueue<>(32);
+ // 鏉$爜鍣ㄨ緭鍑烘棩蹇�
+ public static ArrayBlockingQueue<JSONObject> BARCODE = new ArrayBlockingQueue<>(32);
+ // rgv杈撳嚭鏃ュ織
+ public static ArrayBlockingQueue<String> RGV = new ArrayBlockingQueue<>(32);
}
diff --git a/src/main/java/com/zy/core/enums/CrnTaskModeType.java b/src/main/java/com/zy/core/enums/CrnTaskModeType.java
new file mode 100644
index 0000000..4352064
--- /dev/null
+++ b/src/main/java/com/zy/core/enums/CrnTaskModeType.java
@@ -0,0 +1,46 @@
+package com.zy.core.enums;
+
+public enum CrnTaskModeType {
+
+ NONE(0), // 鏃�
+ PAKIN(1), // 鍏ュ簱
+ PAKOUT(2), // 鍑哄簱
+ LOC_MOVE(3), // 搴撲綅绉昏浆
+ X_MOVE(4), // 绔欎綅绉昏浆
+ Y_MOVE(5), // 绔欎綅绉昏浆
+ XY_MOVE(6), // 绔欎綅绉昏浆
+ CRN_MOVE(7), // 鍫嗗灈鏈虹Щ鍔╔YZ
+ BACK_ORIGIN(8), // 鍥炲弽鍘熺偣
+ CLEAR(9), // 娓呴敊
+ ;
+
+ public Integer id;
+ CrnTaskModeType(Integer id) {
+ this.id = id;
+ }
+
+ public static CrnTaskModeType get(Integer id) {
+ if (null == id) {
+ return null;
+ }
+ for (CrnTaskModeType type : CrnTaskModeType.values()) {
+ if (type.id.equals(id)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ public static CrnTaskModeType get(CrnTaskModeType type) {
+ if (null == type) {
+ return null;
+ }
+ for (CrnTaskModeType crnTaskModeType : CrnTaskModeType.values()) {
+ if (crnTaskModeType == type) {
+ return crnTaskModeType;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/com/zy/core/model/command/CrnCommand.java b/src/main/java/com/zy/core/model/command/CrnCommand.java
new file mode 100644
index 0000000..c31a1e9
--- /dev/null
+++ b/src/main/java/com/zy/core/model/command/CrnCommand.java
@@ -0,0 +1,68 @@
+package com.zy.core.model.command;
+
+import lombok.Data;
+/**
+ * 鍫嗗灈鏈哄懡浠ゆ姤鏂�
+ * Created by vincent on 2020/8/11
+ */
+@Data
+public class CrnCommand {
+
+ // 鍫嗗灈鏈哄彿
+ private Integer crnNo = 0;
+
+ // 浠诲姟瀹屾垚纭浣�
+ private Short ackFinish = 0;
+
+ // 浠诲姟鍙�
+ private Short taskNo = 0;
+
+ /**
+ * 浠诲姟妯″紡锛�
+ * 0 = 鏃�
+ * 1 = 鍏ュ簱 婧愬拰鐩爣閮藉彂
+ * 2 = 鍑哄簱 婧愬拰鐩爣閮藉彂
+ * 3 = 搴撲綅绉昏浆 婧愬拰鐩爣閮藉彂
+ * 4 = 绔欎綅绉昏浆 婧愬拰鐩爣閮藉彂
+ * 5 = 鍥炲師鐐� 涓嶇敤鍙�
+ * 6 = 鍘诲弽鍘熺偣 鐩爣鍙�
+ * 7 = 鍧愭爣绉昏 鍙栬揣鍙�
+ * 90 = 璁剧疆鏃堕棿
+ * 99 = 鍙栨秷褰撳墠浠诲姟
+ */
+ private Short taskMode = 0;
+
+ // 婧愪綅缃帓鍙�
+ private Short sourcePosX = 0;
+
+ // 婧愪綅缃垪鍙�
+ private Short sourcePosY = 0;
+
+ // 婧愪綅缃眰鍙�
+ private Short sourcePosZ = 0;
+
+ // 婧愮珯
+ private Short sourceStaNo = 0;
+
+ // 婧愬贩閬�
+ private Short sourceLane = 0;
+
+ // 鐩爣浣嶇疆鎺掑彿
+ private Short destinationPosX = 0;
+
+ // 鐩爣浣嶇疆鍒楀彿
+ private Short destinationPosY = 0;
+
+ // 鐩爣浣嶇疆灞傚彿
+ private Short destinationPosZ = 0;
+
+ // 鐩爣绔�
+ private Short destinationStaNo = 0;
+
+ // 鐩爣宸烽亾
+ private Short destinationLane = 0;
+
+ // 浠诲姟纭 0锛氭湭纭 1锛氬凡纭
+ private Short command = 0;
+
+}
diff --git a/src/main/java/com/zy/core/model/protocol/CrnProtocol.java b/src/main/java/com/zy/core/model/protocol/CrnProtocol.java
index 43d6ec0..0ce9df7 100644
--- a/src/main/java/com/zy/core/model/protocol/CrnProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/CrnProtocol.java
@@ -24,11 +24,6 @@
public CrnModeType modeType;
/**
- * 1 = 鎬ュ仠
- */
- public Integer eStop;
-
- /**
* 寮傚父鐮�
*/
public Integer alarm;
@@ -110,37 +105,37 @@
/**
* X琛岃蛋绾块�熷害m/min
*/
- private Float xSpeed;
+ private Integer xSpeed;
/**
* Y琛岃蛋绾块�熷害m/min
*/
- private Float ySpeed;
+ private Integer ySpeed;
/**
* Z琛岃蛋绾块�熷害m/min
*/
- private Float zSpeed;
+ private Integer zSpeed;
/**
* 鍫嗗灈鏈虹疮璁¤蛋琛岃窛绂籯m
*/
- public Float xDistance;
+ public Integer xDistance;
/**
* 鍫嗗灈鏈虹疮璁″崌闄嶈窛绂籯m
*/
- public Float yDistance;
+ public Integer yDistance;
/**
* 鍫嗗灈鏈虹疮璁¤蛋琛屾椂闀縣
*/
- public Float xDuration;
+ public Integer xDuration;
/**
* 鍫嗗灈鏈虹疮璁″崌闄嶆椂闀縣
*/
- public Float yDuration;
+ public Integer yDuration;
/**
* 鏈�杩戜竴娆″叆鍑哄簱绫诲瀷
diff --git a/src/main/java/com/zy/core/network/DeviceConnectPool.java b/src/main/java/com/zy/core/network/DeviceConnectPool.java
new file mode 100644
index 0000000..fa04266
--- /dev/null
+++ b/src/main/java/com/zy/core/network/DeviceConnectPool.java
@@ -0,0 +1,36 @@
+package com.zy.core.network;
+
+import com.zy.core.ThreadHandler;
+import com.zy.core.enums.SlaveType;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class DeviceConnectPool {
+
+ private static final String _LINK = "_";
+
+ private static final Map<String, ThreadHandler> conContain = new ConcurrentHashMap<>();
+
+ public static void put(SlaveType type, Integer id, ThreadHandler thread) {
+ String key = toKey(type, id);
+ remove(type, id);
+ conContain.put(key, thread);
+ }
+
+ public static ThreadHandler get(SlaveType type, Integer id) {
+ return conContain.get(toKey(type, id));
+ }
+
+ public static void remove(SlaveType type, Integer id) {
+ Object object = get(type, id);
+ if (null == object) {
+ return;
+ }
+ conContain.remove(toKey(type, id));
+ }
+
+ private static String toKey(SlaveType type, Integer id){
+ return type.toString() + _LINK + id;
+ }
+
+}
diff --git a/src/main/java/com/zy/core/network/ZyCrnConnectThread.java b/src/main/java/com/zy/core/network/ZyCrnConnectThread.java
new file mode 100644
index 0000000..5df657b
--- /dev/null
+++ b/src/main/java/com/zy/core/network/ZyCrnConnectThread.java
@@ -0,0 +1,69 @@
+package com.zy.core.network;
+
+import HslCommunication.Profinet.Siemens.SiemensS7Net;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.core.ThreadHandler;
+import com.zy.core.model.CommandResponse;
+import com.zy.core.model.command.CrnCommand;
+import com.zy.core.network.api.ZyCrnConnectApi;
+import com.zy.core.network.entity.ZyCrnStatusEntity;
+import com.zy.core.network.real.ZyCrnRealConnect;
+import lombok.extern.slf4j.Slf4j;
+
+
+@Slf4j
+public class ZyCrnConnectThread implements ThreadHandler{
+
+ private boolean connected = false;
+ private SiemensS7Net siemensNet;
+ private DeviceConfig deviceConfig;
+ private ZyCrnConnectApi zyCrnConnectApi;
+
+ public ZyCrnConnectThread(SiemensS7Net siemensS7Net, DeviceConfig deviceConfig) {
+ this.siemensNet = siemensS7Net;
+ this.deviceConfig = deviceConfig;
+ }
+
+ @Override
+ @SuppressWarnings("InfiniteLoopStatement")
+ public void run() {
+ while (true) {
+ try {
+ if (!connected) {
+ connect();
+ }
+
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public boolean connect() {
+ if (deviceConfig.getFake() == 0) {
+ zyCrnConnectApi = new ZyCrnRealConnect(siemensNet, deviceConfig);
+ }
+
+ boolean connect = zyCrnConnectApi.connect();
+ connected = connect;
+ return connect;
+ }
+
+ @Override
+ public void close() {
+ zyCrnConnectApi.disconnect();
+ zyCrnConnectApi = null;
+ connected = false;
+ }
+
+ public ZyCrnStatusEntity getStatus() {
+ return zyCrnConnectApi.getStatus();
+ }
+
+ public CommandResponse sendCommand(CrnCommand command) {
+ return zyCrnConnectApi.sendCommand(command);
+ }
+
+}
diff --git a/src/main/java/com/zy/core/network/api/ZyCrnConnectApi.java b/src/main/java/com/zy/core/network/api/ZyCrnConnectApi.java
new file mode 100644
index 0000000..ab07f10
--- /dev/null
+++ b/src/main/java/com/zy/core/network/api/ZyCrnConnectApi.java
@@ -0,0 +1,17 @@
+package com.zy.core.network.api;
+
+import com.zy.core.model.CommandResponse;
+import com.zy.core.model.command.CrnCommand;
+import com.zy.core.network.entity.ZyCrnStatusEntity;
+
+public interface ZyCrnConnectApi {
+
+ boolean connect();
+
+ boolean disconnect();
+
+ ZyCrnStatusEntity getStatus();//璁惧鐘舵��
+
+ CommandResponse sendCommand(CrnCommand command);//涓嬪彂鍛戒护
+
+}
diff --git a/src/main/java/com/zy/core/network/entity/ZyCrnStatusEntity.java b/src/main/java/com/zy/core/network/entity/ZyCrnStatusEntity.java
new file mode 100644
index 0000000..470e08c
--- /dev/null
+++ b/src/main/java/com/zy/core/network/entity/ZyCrnStatusEntity.java
@@ -0,0 +1,125 @@
+package com.zy.core.network.entity;
+
+import lombok.Data;
+
+@Data
+public class ZyCrnStatusEntity {
+
+ /**
+ * 鍫嗗灈鏈哄彿
+ */
+ private Integer crnNo;
+
+ /**
+ * 1 = 鎵嬪姩妯″紡
+ * 2 = 鑷姩妯″紡
+ * 3 = 鐢佃剳妯″紡
+ */
+ public Integer mode;
+
+ /**
+ * 寮傚父鐮�
+ */
+ public Integer alarm;
+
+ /**
+ * 浠诲姟鍙�
+ */
+ public Integer taskNo = 0;
+
+ /**
+ * 鍫嗗灈鏈哄綋鍓嶇姸鎬�
+ * 0锛氱┖闂诧紝鏃犱换鍔�
+ * 1锛氬彇璐у畾浣嶄腑
+ * 2锛氬彇璐т腑
+ * 3锛氬彇璐у畬鎴愶紝鏀捐揣瀹氫綅涓�
+ * 4锛氭斁璐т腑
+ * 5锛氬洖鍘熺偣涓�
+ * 6锛氬弽鍘熺偣
+ * 7锛氬簱浣嶇Щ浣�
+ * 90锛氫换鍔″畬鎴愮瓑寰匴CS纭
+ * 99锛氭姤璀�
+ */
+ public Integer status;
+
+ /**
+ * 鍫嗗灈鏈哄綋鍓嶅垪鍙�
+ */
+ public Integer bay;
+
+ /**
+ * 鍫嗗灈鏈哄綋鍓嶅眰鍙�
+ */
+ public Integer level;
+
+ /**
+ * 褰撳墠璐у弶浣嶇疆
+ * 0 = 璐у弶鍘熶綅
+ * 1 = 璐у弶鍦ㄥ乏渚�
+ * 2 = 璐у弶鍦ㄥ彸渚�
+ */
+ public Integer forkPos;
+
+ /**
+ * 褰撳墠杞借揣鍙颁綅缃�
+ * 0 = 涓嬪畾浣�
+ * 1 = 涓婂畾浣�
+ */
+ public Integer liftPos;
+
+ /**
+ * 璧拌鍦ㄥ畾浣�
+ * 0 = 鍦ㄥ畾浣�
+ * 1 = 涓嶅湪瀹氫綅
+ */
+ public Integer walkPos;
+
+ /**
+ * 杞借揣鍙版湁鐗�
+ */
+ public Integer loaded;
+
+ /**
+ * X琛岃蛋绾块�熷害m/min
+ */
+ private Integer xSpeed;
+
+ /**
+ * Y琛岃蛋绾块�熷害m/min
+ */
+ private Integer ySpeed;
+
+ /**
+ * Z琛岃蛋绾块�熷害m/min
+ */
+ private Integer zSpeed;
+
+ /**
+ * 鍫嗗灈鏈虹疮璁¤蛋琛岃窛绂籯m
+ */
+ public Integer xDistance;
+
+ /**
+ * 鍫嗗灈鏈虹疮璁″崌闄嶈窛绂籯m
+ */
+ public Integer yDistance;
+
+ /**
+ * 鍫嗗灈鏈虹疮璁¤蛋琛屾椂闀縣
+ */
+ public Integer xDuration;
+
+ /**
+ * 鍫嗗灈鏈虹疮璁″崌闄嶆椂闀縣
+ */
+ public Integer yDuration;
+
+ private Integer temp1;
+
+ private Integer temp2;
+
+ private Integer temp3;
+
+ private Integer temp4;
+
+}
diff --git a/src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java b/src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java
new file mode 100644
index 0000000..4629f30
--- /dev/null
+++ b/src/main/java/com/zy/core/network/real/ZyCrnRealConnect.java
@@ -0,0 +1,231 @@
+package com.zy.core.network.real;
+
+import HslCommunication.Core.Types.OperateResult;
+import HslCommunication.Core.Types.OperateResultExOne;
+import HslCommunication.Profinet.Siemens.SiemensS7Net;
+import com.alibaba.fastjson.JSON;
+import com.core.common.DateUtils;
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasCrnpOpt;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.service.BasCrnpOptService;
+import com.zy.asrs.utils.Utils;
+import com.zy.core.News;
+import com.zy.core.cache.OutputQueue;
+import com.zy.core.model.CommandResponse;
+import com.zy.core.model.command.CrnCommand;
+import com.zy.core.network.api.ZyCrnConnectApi;
+import com.zy.core.network.entity.ZyCrnStatusEntity;
+
+import java.text.MessageFormat;
+import java.util.Date;
+
+public class ZyCrnRealConnect implements ZyCrnConnectApi {
+
+ private SiemensS7Net siemensNet;
+ private DeviceConfig deviceConfig;
+
+ public ZyCrnRealConnect(SiemensS7Net siemensS7Net, DeviceConfig deviceConfig) {
+ this.siemensNet = siemensS7Net;
+ this.deviceConfig = deviceConfig;
+ }
+
+ public boolean connect() {
+ boolean connected = false;
+ OperateResult connect = siemensNet.ConnectServer();
+ if(connect.IsSuccess){
+ connected = true;
+ OutputQueue.CRN.offer(MessageFormat.format( "銆恵0}銆戝爢鍨涙満plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
+ News.info("SiemensCrn"+" - 1"+" - 鍫嗗灈鏈簆lc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ } else {
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝爢鍨涙満plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
+ News.error("SiemensCrn"+" - 2"+" - 鍫嗗灈鏈簆lc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ }
+// siemensNet.ConnectClose();
+ return connected;
+ }
+
+ @Override
+ public boolean disconnect() {
+ siemensNet.ConnectClose();
+ return true;
+ }
+
+ @Override
+ public ZyCrnStatusEntity getStatus() {
+ try {
+ OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56);
+ if (result.IsSuccess) {
+ ZyCrnStatusEntity crnStatus = new ZyCrnStatusEntity();
+ crnStatus.setCrnNo(deviceConfig.getDeviceNo());
+ crnStatus.setMode((int) siemensNet.getByteTransform().TransInt16(result.Content, 0));
+ crnStatus.setTaskNo((int) siemensNet.getByteTransform().TransInt16(result.Content, 2));
+ crnStatus.setStatus((int) siemensNet.getByteTransform().TransInt16(result.Content, 4));
+ crnStatus.setBay((int) siemensNet.getByteTransform().TransInt16(result.Content, 6));
+ crnStatus.setLevel((int) siemensNet.getByteTransform().TransInt16(result.Content, 8));
+ crnStatus.setForkPos((int) siemensNet.getByteTransform().TransInt16(result.Content, 10));
+ crnStatus.setLiftPos((int) siemensNet.getByteTransform().TransInt16(result.Content, 12));
+ crnStatus.setWalkPos((int) siemensNet.getByteTransform().TransInt16(result.Content, 14));
+ crnStatus.setLoaded((int) siemensNet.getByteTransform().TransInt16(result.Content, 16));
+ crnStatus.setAlarm((int) siemensNet.getByteTransform().TransInt16(result.Content, 18));
+ crnStatus.setTemp1((int) siemensNet.getByteTransform().TransInt16(result.Content, 20));
+ crnStatus.setTemp2((int) siemensNet.getByteTransform().TransInt16(result.Content, 22));
+ crnStatus.setTemp3((int) siemensNet.getByteTransform().TransInt16(result.Content, 24));
+ crnStatus.setTemp4((int) siemensNet.getByteTransform().TransInt16(result.Content, 26));
+ crnStatus.setXSpeed((int) siemensNet.getByteTransform().TransInt16(result.Content, 28));
+ crnStatus.setYSpeed((int) siemensNet.getByteTransform().TransInt16(result.Content, 32));
+ crnStatus.setZSpeed((int) siemensNet.getByteTransform().TransInt16(result.Content, 36));
+ crnStatus.setXDistance((int) siemensNet.getByteTransform().TransInt16(result.Content, 40));
+ crnStatus.setYDistance((int) siemensNet.getByteTransform().TransInt16(result.Content, 44));
+ crnStatus.setXDuration((int) siemensNet.getByteTransform().TransInt16(result.Content, 48));
+ crnStatus.setYDuration((int) siemensNet.getByteTransform().TransInt16(result.Content, 52));
+
+ return crnStatus;
+ } else {
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
+ News.error("SiemensCrn"+" - 4"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
+ News.error("SiemensCrn"+" - 5"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ }
+ return null;
+ }
+
+ @Override
+ public CommandResponse sendCommand(CrnCommand command) {
+ CommandResponse response = new CommandResponse(false);
+ try {
+ if (null == command) {
+ News.error("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
+ response.setMessage("鍫嗗灈鏈哄啓鍏ュ懡浠や负绌�");
+ return response;
+ }
+
+ int writeAck = 0;
+ boolean ackResult = false;
+ do {
+ OperateResult resultAck = siemensNet.Write("DB100.0", (short) 0);
+ if (resultAck.IsSuccess) {
+ Thread.sleep(200);
+ OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 2);
+ short ack = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0);
+ if (ack != 0) {
+ writeAck++;
+ } else {
+ News.info("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", command.getCrnNo(), "ack澶嶄綅瀹屾垚");
+ ackResult = true;
+ break;
+ }
+ }
+ } while (writeAck < 5);
+
+ if (!ackResult) {
+ response.setMessage("鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}" + command.getCrnNo() + "ack澶嶄綅澶辫触");
+ return response;
+ }
+
+ short[] array = new short[10];
+ array[0] = command.getAckFinish();
+ array[1] = command.getTaskNo();
+ array[2] = command.getTaskMode();
+ array[3] = command.getSourcePosX();
+ array[4] = command.getSourcePosY();
+ array[5] = command.getSourcePosZ();
+ array[6] = command.getDestinationPosX();
+ array[7] = command.getDestinationPosY();
+ array[8] = command.getDestinationPosZ();
+ array[9] = command.getCommand();
+
+ OperateResult result = null;
+ int idx = 0;
+ do {
+ OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20);
+ if (resultRead.IsSuccess) {
+ if (command.getAckFinish() == 0) {
+ short taskNo = siemensNet.getByteTransform().TransInt16(resultRead.Content, 2);
+ short taskMode = siemensNet.getByteTransform().TransInt16(resultRead.Content, 4);
+ short sourcePosX = siemensNet.getByteTransform().TransInt16(resultRead.Content, 6);
+ short sourcePosY = siemensNet.getByteTransform().TransInt16(resultRead.Content, 8);
+ short sourcePosZ = siemensNet.getByteTransform().TransInt16(resultRead.Content, 10);
+ short destinationPosX = siemensNet.getByteTransform().TransInt16(resultRead.Content, 12);
+ short destinationPosY = siemensNet.getByteTransform().TransInt16(resultRead.Content, 14);
+ short destinationPosZ = siemensNet.getByteTransform().TransInt16(resultRead.Content, 16);
+ if (taskNo == 0 || taskMode == 0 || sourcePosX == 0 || sourcePosY == 0 || sourcePosZ == 0 || destinationPosX == 0 || destinationPosY == 0 || destinationPosZ == 0) {
+ result = siemensNet.Write("DB100.0", array);
+ } else {
+ break;
+ }
+ } else {
+ short ackFinish = siemensNet.getByteTransform().TransInt16(resultRead.Content, 0);
+ if (ackFinish != command.getAckFinish()) {
+ result = siemensNet.Write("DB100.0", array);
+ } else {
+ break;
+ }
+ }
+ }
+ idx++;
+ Thread.sleep(500L);
+ } while (idx < 5);
+
+ if (command.getAckFinish() == 0) {
+ short commandFinish = 1;
+ int i = 0;
+ do {
+ OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 4);
+ OperateResultExOne<byte[]> resultReadConfirm = siemensNet.Read("DB100.18", (short) 2);
+ if (resultRead.IsSuccess && resultReadConfirm.IsSuccess) {
+ short taskNo = siemensNet.getByteTransform().TransInt16(resultRead.Content, 2);
+ short confirm = siemensNet.getByteTransform().TransInt16(resultReadConfirm.Content, 0);
+ if (taskNo != 0 && confirm == 0) {
+ result = siemensNet.Write("DB100.18", commandFinish);
+ }
+ }
+ i++;
+ Thread.sleep(500L);
+ } while (i < 5);
+ }
+
+ if (result != null && result.IsSuccess) {
+ News.info("SiemensCrn" + " - 7" + " - 鍫嗗灈鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", command.getCrnNo(), JSON.toJSON(command));
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), command.getCrnNo(), JSON.toJSON(command)));
+ response.setResult(true);
+ response.setMessage("鍛戒护涓嬪彂鎴愬姛");
+ } else {
+ News.error("SiemensCrn" + " - 8" + " - 鍐欏叆鍫嗗灈鏈簆lc鏁版嵁澶辫触 ===>> [id:{}]", command.getCrnNo());
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ爢鍨涙満plc鏁版嵁澶辫触 ===>> [id:{1}]", DateUtils.convert(new Date()), command.getCrnNo()));
+ response.setResult(false);
+ response.setMessage("鍛戒护涓嬪彂澶辫触");
+ }
+
+ return response;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }finally {
+ String sourceLocNo = Utils.getLocNo(command.getSourcePosX(), command.getSourcePosY(), command.getSourcePosZ());
+ String targetLocNo = Utils.getLocNo(command.getDestinationPosX(), command.getDestinationPosY(), command.getDestinationPosZ());
+
+ // 鏃ュ織璁板綍
+ BasCrnpOptService bean = SpringUtils.getBean(BasCrnpOptService.class);
+ BasCrnpOpt basCrnpOpt = new BasCrnpOpt(
+ command.getTaskNo().intValue(), // 浠诲姟鍙�
+ command.getCrnNo(), // 鍫嗗灈鏈篬闈炵┖]
+ new Date(), // 涓嬪彂鏃堕棿
+ String.valueOf(command.getTaskMode()), // 妯″紡
+ sourceLocNo, //婧愬簱浣�
+ targetLocNo, //鐩爣搴撲綅
+ null, // 淇敼鏃堕棿
+ null, // 淇敼浜哄憳
+ null, // 澶囨敞
+ JSON.toJSONString(command), // 鎸囦护
+ JSON.toJSONString(command), // 绯荤粺鐘舵��
+ 1, // 涓嬪彂鐘舵�亄0:鏈笅鍙�,1:宸蹭笅鍙憓
+ JSON.toJSONString(response) // 鍝嶅簲
+ );
+ bean.insert(basCrnpOpt);
+ }
+ return response;
+ }
+}
diff --git a/src/main/java/com/zy/core/thread/CrnThread.java b/src/main/java/com/zy/core/thread/CrnThread.java
index 3c9d73d..d4295fb 100644
--- a/src/main/java/com/zy/core/thread/CrnThread.java
+++ b/src/main/java/com/zy/core/thread/CrnThread.java
@@ -1,10 +1,20 @@
package com.zy.core.thread;
import com.zy.core.ThreadHandler;
+import com.zy.core.model.CommandResponse;
+import com.zy.core.model.command.CrnCommand;
import com.zy.core.model.protocol.CrnProtocol;
public interface CrnThread extends ThreadHandler {
- CrnProtocol getCrnProtocol();
+ CrnProtocol getStatus();
+
+ CrnCommand getPickAndPutCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo);//鍙栨斁璐�
+
+ CrnCommand getMoveCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo);//绉诲姩
+
+ CrnCommand getResetCommand(Integer crnNo);//澶嶄綅
+
+ CommandResponse sendCommand(CrnCommand command);//涓嬪彂鍛戒护
}
diff --git a/src/main/java/com/zy/core/thread/ShuttleThread.java b/src/main/java/com/zy/core/thread/ShuttleThread.java
deleted file mode 100644
index a6a8562..0000000
--- a/src/main/java/com/zy/core/thread/ShuttleThread.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.zy.core.thread;
-
-
-
-import com.zy.core.ThreadHandler;
-
-public interface ShuttleThread extends ThreadHandler {
-
-
-}
diff --git a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java b/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
deleted file mode 100644
index 65cb21e..0000000
--- a/src/main/java/com/zy/core/thread/impl/NyShuttleThread.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.zy.core.thread.impl;
-
-import com.zy.core.thread.ShuttleThread;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@SuppressWarnings("all")
-public class NyShuttleThread implements ShuttleThread {
-
- @Override
- public boolean connect() {
- return false;
- }
-
- @Override
- public void close() {
-
- }
-
- @Override
- public void run() {
-
- }
-}
diff --git a/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
new file mode 100644
index 0000000..b2ec61c
--- /dev/null
+++ b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
@@ -0,0 +1,254 @@
+package com.zy.core.thread.impl;
+
+import HslCommunication.Profinet.Siemens.SiemensPLCS;
+import HslCommunication.Profinet.Siemens.SiemensS7Net;
+import com.alibaba.fastjson.JSON;
+import com.core.common.DateUtils;
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.DeviceConfig;
+import com.zy.asrs.entity.DeviceDataLog;
+import com.zy.asrs.service.DeviceDataLogService;
+import com.zy.asrs.utils.Utils;
+import com.zy.common.utils.RedisUtil;
+import com.zy.core.News;
+import com.zy.core.ThreadHandler;
+import com.zy.core.cache.MessageQueue;
+import com.zy.core.cache.OutputQueue;
+import com.zy.core.enums.CrnTaskModeType;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.CommandResponse;
+import com.zy.core.model.Task;
+import com.zy.core.model.command.CrnCommand;
+import com.zy.core.model.protocol.CrnProtocol;
+import com.zy.core.network.DeviceConnectPool;
+import com.zy.core.network.ZyCrnConnectThread;
+import com.zy.core.network.entity.ZyCrnStatusEntity;
+import com.zy.core.thread.CrnThread;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.text.MessageFormat;
+import java.util.Date;
+
+/**
+ * 鍫嗗灈鏈虹嚎绋�
+ * Created by vincent on 2020/8/4
+ */
+@Data
+@Slf4j
+public class ZySiemensCrnThread implements Runnable, CrnThread {
+
+ private DeviceConfig deviceConfig;
+ private RedisUtil redisUtil;
+ private ZyCrnConnectThread zyCrnConnectThread;
+ private CrnProtocol crnProtocol;
+ private boolean resetFlag = false;
+
+ public ZySiemensCrnThread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
+ this.deviceConfig = deviceConfig;
+ this.redisUtil = redisUtil;
+ }
+
+ @Override
+ @SuppressWarnings("InfiniteLoopStatement")
+ public void run() {
+ this.connect();
+ this.initCrn();
+ while (true) {
+ try {
+ int step = 1;
+ Task task = MessageQueue.poll(SlaveType.Crn, deviceConfig.getDeviceNo());
+ if (task != null) {
+ step = task.getStep();
+ }
+ switch (step) {
+ // 璇绘暟鎹�
+ case 1:
+ readStatus();
+ break;
+ default:
+ break;
+ }
+ Thread.sleep(200);
+ } catch (Exception e) {
+// e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 鍒濆鍖栧爢鍨涙満鐘舵��
+ */
+ private void initCrn() {
+ if (null == crnProtocol) {
+ crnProtocol = new CrnProtocol();
+ crnProtocol.setCrnNo(deviceConfig.getDeviceNo());
+ }
+ crnProtocol.setMode(-1);
+ crnProtocol.setTaskNo(0);
+ crnProtocol.setStatus(-1);
+ crnProtocol.setBay(0);
+ crnProtocol.setLevel(0);
+ crnProtocol.setForkPos(-1);
+ crnProtocol.setLiftPos(-1);
+ crnProtocol.setWalkPos(0);
+ crnProtocol.setLoaded(0);
+ crnProtocol.setAlarm(0);
+ crnProtocol.setXSpeed(0);
+ crnProtocol.setYSpeed(0);
+ crnProtocol.setZSpeed(0);
+ crnProtocol.setXDistance(0);
+ crnProtocol.setYDistance(0);
+ crnProtocol.setXDuration(0);
+ crnProtocol.setYDuration(0);
+ }
+
+ @Override
+ public boolean connect() {
+ SiemensS7Net siemensS7Net = new SiemensS7Net(SiemensPLCS.S1200, deviceConfig.getIp());
+ ThreadHandler thread = new ZyCrnConnectThread(siemensS7Net, deviceConfig);
+ new Thread(thread).start();
+ DeviceConnectPool.put(SlaveType.Crn, deviceConfig.getDeviceNo(), thread);
+ return true;
+ }
+
+ /**
+ * 璇诲彇鐘舵��
+ */
+ private void readStatus(){
+ ZyCrnStatusEntity crnStatus = zyCrnConnectThread.getStatus();
+ if (crnStatus == null) {
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
+ News.error("SiemensCrn"+" - 5"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ return;
+ }
+
+ crnProtocol.setMode(crnStatus.getMode());
+ crnProtocol.setTaskNo(crnStatus.getTaskNo());
+ crnProtocol.setStatus(crnStatus.getStatus());
+ crnProtocol.setBay(crnStatus.getBay());
+ crnProtocol.setLevel(crnStatus.getLevel());
+ crnProtocol.setForkPos(crnStatus.getForkPos());
+ crnProtocol.setLiftPos(crnStatus.getLiftPos());
+ crnProtocol.setWalkPos(crnStatus.getWalkPos());
+ crnProtocol.setLoaded(crnStatus.getLoaded());
+ crnProtocol.setAlarm(crnStatus.getAlarm());
+ crnProtocol.setTemp1(crnStatus.getTemp1());
+ crnProtocol.setTemp2(crnStatus.getTemp2());
+ crnProtocol.setTemp3(crnStatus.getTemp3());
+ crnProtocol.setTemp4(crnStatus.getTemp4());
+ crnProtocol.setXSpeed(crnStatus.getXSpeed());
+ crnProtocol.setYSpeed(crnStatus.getYSpeed());
+ crnProtocol.setZSpeed(crnStatus.getZSpeed());
+ crnProtocol.setXDistance(crnStatus.getXDistance());
+ crnProtocol.setYDistance(crnStatus.getYDistance());
+ crnProtocol.setXDuration(crnStatus.getXDuration());
+ crnProtocol.setYDuration(crnStatus.getYDuration());
+
+ OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), deviceConfig.getDeviceNo()));
+
+// // 澶嶄綅淇″彿
+// if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) {
+// if (resetFlag) {
+// if(crnProtocol.getTaskNo()==9999){
+// backHpFlag = false;
+// }
+// CrnCommand crnCommand = new CrnCommand();
+// crnCommand.setAckFinish((short)1);
+// if (write(crnCommand)) {
+// resetFlag = false;
+// }
+// }
+// }
+
+ if (crnProtocol.getAlarm() > 0) {
+ crnProtocol.setLastCommandTime(-1L);
+ }
+
+ if (crnProtocol.getAlarm() == 0 && crnProtocol.getLastCommandTime() == -1) {
+ crnProtocol.setLastCommandTime(System.currentTimeMillis());
+ }
+
+ if (System.currentTimeMillis() - crnProtocol.getDeviceDataLog() > 1000 * 1) {
+ //閲囬泦鏃堕棿瓒呰繃1s锛屼繚瀛樹竴娆℃暟鎹褰�
+ //淇濆瓨鏁版嵁璁板綍
+ DeviceDataLogService deviceDataLogService = SpringUtils.getBean(DeviceDataLogService.class);
+ DeviceDataLog deviceDataLog = new DeviceDataLog();
+ deviceDataLog.setOriginData(JSON.toJSONString(crnStatus));
+ deviceDataLog.setWcsData(JSON.toJSONString(crnProtocol));
+ deviceDataLog.setType(String.valueOf(SlaveType.Crn));
+ deviceDataLog.setDeviceNo(crnProtocol.getCrnNo());
+ deviceDataLog.setCreateTime(new Date());
+ deviceDataLogService.insert(deviceDataLog);
+
+ //鏇存柊閲囬泦鏃堕棿
+ crnProtocol.setDeviceDataLog(System.currentTimeMillis());
+ }
+ }
+
+ @Override
+ public void close() {
+ zyCrnConnectThread.close();
+ }
+
+ @Override
+ public CrnProtocol getStatus() {
+ return this.crnProtocol;
+ }
+
+ @Override
+ public CrnCommand getPickAndPutCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo) {
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(crnNo); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo(taskNo.shortValue()); // 宸ヤ綔鍙�
+ crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE.id.shortValue()); // 浠诲姟妯″紡: 搴撲綅绉昏浆
+ crnCommand.setSourcePosX((short) Utils.getRow(sourceLocNo)); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY((short) Utils.getBay(sourceLocNo)); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ((short) Utils.getLev(sourceLocNo)); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX((short) Utils.getRow(targetLocNo)); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY((short) Utils.getBay(targetLocNo)); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ((short) Utils.getLev(targetLocNo)); // 鐩爣搴撲綅灞�
+ crnCommand.setCommand((short) 1); // 浠诲姟纭
+ return crnCommand;
+ }
+
+ @Override
+ public CrnCommand getMoveCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo) {
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(crnNo); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo(taskNo.shortValue()); // 宸ヤ綔鍙�
+ crnCommand.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣�
+ crnCommand.setTaskMode(CrnTaskModeType.CRN_MOVE.id.shortValue()); // 浠诲姟妯″紡: 鍫嗗灈鏈虹Щ鍔�
+ crnCommand.setSourcePosX((short) Utils.getRow(sourceLocNo)); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY((short) Utils.getBay(sourceLocNo)); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ((short) Utils.getLev(sourceLocNo)); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX((short) 0); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY((short) 0); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ((short) 0); // 鐩爣搴撲綅灞�
+ crnCommand.setCommand((short) 1); // 浠诲姟纭
+ return crnCommand;
+ }
+
+ @Override
+ public CrnCommand getResetCommand(Integer crnNo) {
+ CrnCommand crnCommand = new CrnCommand();
+ crnCommand.setCrnNo(crnNo); // 鍫嗗灈鏈虹紪鍙�
+ crnCommand.setTaskNo((short) 0); // 宸ヤ綔鍙�
+ crnCommand.setAckFinish((short) 1); // 浠诲姟瀹屾垚纭浣�
+ crnCommand.setTaskMode(CrnTaskModeType.NONE.id.shortValue()); // 浠诲姟妯″紡
+ crnCommand.setSourcePosX((short)0); // 婧愬簱浣嶆帓
+ crnCommand.setSourcePosY((short)0); // 婧愬簱浣嶅垪
+ crnCommand.setSourcePosZ((short)0); // 婧愬簱浣嶅眰
+ crnCommand.setDestinationPosX((short)0); // 鐩爣搴撲綅鎺�
+ crnCommand.setDestinationPosY((short)0); // 鐩爣搴撲綅鍒�
+ crnCommand.setDestinationPosZ((short)0); // 鐩爣搴撲綅灞�
+ crnCommand.setCommand((short) 1); // 浠诲姟纭
+ return crnCommand;
+ }
+
+ @Override
+ public synchronized CommandResponse sendCommand(CrnCommand command) {
+ this.crnProtocol.setLastCommandTime(System.currentTimeMillis());
+ return zyCrnConnectThread.sendCommand(command);
+ }
+}
diff --git a/src/main/webapp/views/lift.html b/src/main/webapp/views/lift.html
deleted file mode 100644
index b244b82..0000000
--- a/src/main/webapp/views/lift.html
+++ /dev/null
@@ -1,456 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>鎻愬崌鏈虹洃鎺х郴缁�</title>
- <link rel="stylesheet" href="../static/vue/element/element.css">
- <link rel="stylesheet" href="../static/css/shuttle_page.min.css">
- <script src="../static/js/shuttle_page.js"></script>
- <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
- <script type="text/javascript" src="../static/js/common.js"></script>
- <script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
- <script type="text/javascript" src="../static/vue/element/element.js"></script>
- <style>
- body {
- font-family: 'Noto Sans SC', sans-serif;
- background-color: #0f172a;
- color: #e2e8f0;
- }
- .card {
- background-color: #1e293b;
- border-radius: 0.75rem;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- transition: all 0.3s ease;
- }
- /*.card:hover {*/
- /* transform: translateY(-2px);*/
- /* box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);*/
- /*}*/
- .btn {
- background-color: #3b82f6;
- color: white;
- border-radius: 0.5rem;
- padding: 0.5rem 1rem;
- transition: all 0.3s ease;
- }
- .btn:hover {
- background-color: #2563eb;
- transform: translateY(-1px);
- }
- .status-active {
- color: #4ade80;
- }
- .status-inactive {
- color: #f87171;
- }
- .progress-bar {
- height: 0.75rem;
- border-radius: 0.375rem;
- background-color: #334155;
- }
- .progress-fill {
- height: 100%;
- border-radius: 0.375rem;
- background-color: #4ade80;
- transition: width 0.5s ease;
- }
- .table-striped tbody tr:nth-child(odd) {
- background-color: #1e293b;
- }
- .table-striped tbody tr:nth-child(even) {
- background-color: #1a2537;
- }
- </style>
-</head>
-<body class="min-h-screen">
- <div id="app">
- <div class="container mx-auto px-4 py-8">
- <!-- 椤堕儴鏍囬鍜岀姸鎬佹爮 -->
- <div class="flex flex-col md:flex-row justify-between items-center mb-8">
- <h1 class="text-3xl font-bold text-blue-400 mb-4 md:mb-0">
- <i class="fas fa-robot mr-2"></i>鎻愬崌鏈虹洃鎺х郴缁�
- </h1>
- <div class="flex items-center space-x-4">
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
- <span>鍦ㄧ嚎: {{ deviceStatusCountMap.online }}</span>
- </div>
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
- <span>鏁呴殰: {{ deviceStatusCountMap.error }}</span>
- </div>
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
- <span>绂荤嚎: {{ deviceStatusCountMap.offline }}</span>
- </div>
- </div>
- </div>
-
- <!-- 涓昏鐩戞帶鍖哄煙 -->
- <div class="card p-6 mb-8">
- <!-- 鎻愬崌鏈虹姸鎬佽〃鏍� -->
- <div class="card p-6">
- <div class="flex justify-between items-center mb-4">
- <h2 class="text-xl font-semibold text-blue-300">
- <i class="fas fa-list-alt mr-2"></i>鎻愬崌鏈虹姸鎬�
- </h2>
- <div class="relative">
- <select v-model="selectListStatus" class="bg-slate-700 text-white rounded px-3 py-1 pr-8">
- <option value="all">鍏ㄩ儴鐘舵��</option>
- <option value="online">鍦ㄧ嚎</option>
- <option value="idle">绌洪棽</option>
- <option value="running">杩愯涓�</option>
- <option value="offline">绂荤嚎</option>
- <option value="error">鏁呴殰</option>
- </select>
- </div>
- </div>
- <div class="overflow-auto" style="height: 500px;">
- <table class="w-full table-striped">
- <thead>
- <tr class="text-left text-slate-300 border-b border-slate-600 bg-slate-800 sticky top-0 z-10">
- <th class="py-3 px-4">缂栧彿</th>
- <th class="py-3 px-4">宸ヤ綔鍙�</th>
- <th class="py-3 px-4">PLC宸ヤ綔鍙�</th>
- <th class="py-3 px-4">璁惧妯″紡</th>
- <th class="py-3 px-4">璁惧鐘舵��</th>
- <th class="py-3 px-4">浠诲姟鐘舵��</th>
- <th class="py-3 px-4">浠诲姟妯″紡</th>
- <th class="py-3 px-4">鍙栬揣鏁版嵁</th>
- <th class="py-3 px-4">鏀捐揣鏁版嵁</th>
- <th class="py-3 px-4">鍑哄叆搴撴ā寮�</th>
- <th class="py-3 px-4">鎵樼洏</th>
- <th class="py-3 px-4">灏忚溅</th>
- <th class="py-3 px-4">鏁呴殰鐮�</th>
- <th class="py-3 px-4">灞�</th>
- <th class="py-3 px-4">绔欑偣淇℃伅</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item,idx) in liftList" :key="idx" class="hover:bg-slate-700">
- <td class="py-3 px-4">{{ item.liftNo }}</td>
- <td class="py-3 px-4">{{ item.taskNo }}</td>
- <td class="py-3 px-4">{{ item.plcTaskNo }}</td>
- <td class="py-3 px-4">{{ item.model$ }}</td>
- <td class="py-3 px-4">{{ item.deviceStatus$ }}</td>
- <td class="py-3 px-4">{{ item.protocolStatus$ }}</td>
- <td class="py-3 px-4">{{ item.taskMode$ }}</td>
- <td class="py-3 px-4">{{ item.pick }}</td>
- <td class="py-3 px-4">{{ item.put }}</td>
- <td class="py-3 px-4">{{ item.iOMode$ }}</td>
- <td class="py-3 px-4">{{ item.hasTray ? '鏈�':'鏃�' }}</td>
- <td class="py-3 px-4">{{ item.hasCar ? '鏈�':'鏃�' }}</td>
- <td class="py-3 px-4">{{ item.errorCode }}</td>
- <td class="py-3 px-4">{{ item.lev }}</td>
- <td class="py-3 px-4">
- <div v-for="(sta,id) in item.liftStaProtocols" :key="id">
- {{ sta.siteId }}绔欙紝鎵樼洏锛歿{ sta.hasTray ? 'Y':'N' }}锛屽皬杞︼細{{ sta.hasCar ? 'Y':'N' }}
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
-
- <!-- 鎿嶄綔鎺у埗鍖哄煙 -->
- <div class="card p-6 mb-8">
- <h2 class="text-xl font-semibold text-blue-300 mb-4">
- <i class="fas fa-sliders-h mr-2"></i>鎺у埗闈㈡澘
- </h2>
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-2">
- <div class="bg-slate-700 p-4 rounded-lg">
- <h3 class="text-lg font-medium mb-2">璁惧鎺у埗</h3>
- <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
- <div>
- <el-input @change="changeControlLiftNo" v-model="controlData.liftNo" style="width: 150px;" placeholder="缂栧彿"></el-input>
- </div>
- <div>
- <el-input v-model="controlData.sourceStaNo" style="width: 200px;" placeholder="婧愮珯"></el-input>
- </div>
- <div>
- <el-input v-model="controlData.staNo" style="width: 200px;" placeholder="鐩爣绔�"></el-input>
- </div>
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg">
- <h3 class="text-lg font-medium mb-2">璁惧鎸囦护</h3>
- <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('movePallet')">
- <i class="fas fa-level-up mr-1"></i>绉诲姩鎵樼洏
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('switchShuttle')">
- <i class="fas fa-level-down mr-1"></i>灏忚溅鎹㈠眰
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('move')">
- <i class="fas fa-battery-three-quarters mr-1"></i>绉诲姩
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="liftOperator('reset')">
- <i class="fas fa-home mr-1"></i>澶嶄綅
- </button>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
-</body>
-
-<script>
- var app = new Vue({
- el: '#app',
- data: {
- ws: null,
- liftList: [], //鎻愬崌鏈洪泦鍚�
- liftAllList: [],
- selectListStatus: "all",
- deviceStatusCountMap: {},
- controlData: {
- liftNo: "",
- taskNo: "",
- sourceLocNo: "",
- targetLocNo: ""
- },
- controlLiftInfo: null,
- },
- created() {
- this.init()
- },
- watch: {
-
- },
- methods: {
- init() {
- this.consoleInterval = setInterval(() => {
- this.websocketConnect();
-
- this.getLiftStateInfo() //鑾峰彇鎻愬崌鏈轰俊鎭�
- }, 1000)
- },
- getLiftStateInfo() {
- this.sendWs(JSON.stringify({
- "url": "/lift/table/lift/state",
- "data": {}
- }))
- },
- setLiftStateInfo(res) {
- // 鎻愬崌鏈轰俊鎭〃鑾峰彇
- if (res.code == 200) {
- let list = res.data;
-
- let allList = []
- let runningList = []
- let idleList = []
- let errorList = []
- let offlineList = []
- let onlineList = []
-
- list.forEach((item) => {
- allList.push(item)
-
- if(item.protocolStatusType == "WORKING") {
- runningList.push(item)
- }
-
- if(item.protocolStatusType == "IDLE") {
- idleList.push(item)
- }
-
- if(item.errorCode > 0) {
- errorList.push(item)
- }
-
- if (item.protocolStatusType == "NONE") {
- offlineList.push(item)
- }else {
- onlineList.push(item)
- }
- })
-
- if (this.selectListStatus == "all") {
- this.liftList = allList;
- }else if (this.selectListStatus == "running") {
- this.liftList = runningList;
- }else if (this.selectListStatus == "idle") {
- this.liftList = idleList;
- }else if (this.selectListStatus == "error") {
- this.liftList = errorList;
- }else if (this.selectListStatus == "offline") {
- this.liftList = offlineList;
- }else if (this.selectListStatus == "online") {
- this.liftList = onlineList;
- }
-
- let tmpMap = {
- idle: idleList.length,
- running: runningList.length,
- error: errorList.length,
- offline: offlineList.length,
- online: idleList.length + runningList.length,
- }
- this.deviceStatusCountMap = tmpMap;
-
- this.liftAllList = allList;
- if (this.controlLiftInfo != null) {
- allList.forEach((item) => {
- if(item.liftNo == this.controlLiftInfo.liftNo) {
- this.controlLiftInfo = item;
- }
- });
- }
- }
- },
- liftOperator(type) {
- let that = this;
- if (this.controlData.liftNo == null || this.controlData.liftNo == "") {
- this.$message({
- message: '璇疯緭鍏ヨ澶囩紪鍙�',
- type: 'warning'
- });
- return;
- }
-
- let requestParam = {
- liftNo: this.controlData.liftNo
- };
-
- if (type == 'movePallet') {
- if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
- this.$message({
- message: '璇疯緭鍏ユ簮绔�',
- type: 'warning'
- });
- return;
- }
-
- if (this.controlData.staNo == null || this.controlData.staNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囩珯',
- type: 'warning'
- });
- return;
- }
-
- requestParam.liftTaskMode = 1;
- requestParam.sourceStaNo = this.controlData.sourceStaNo;
- requestParam.staNo = this.controlData.staNo;
- }else if (type == 'switchShuttle') {
- if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
- this.$message({
- message: '璇疯緭鍏ユ簮绔�',
- type: 'warning'
- });
- return;
- }
-
- if (this.controlData.staNo == null || this.controlData.staNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囩珯',
- type: 'warning'
- });
- return;
- }
-
- requestParam.liftTaskMode = 2;
- requestParam.sourceStaNo = this.controlData.sourceStaNo;
- requestParam.staNo = this.controlData.staNo;
- }else if (type == 'move') {
- if (this.controlData.sourceStaNo == null || this.controlData.sourceStaNo == "") {
- this.$message({
- message: '璇疯緭鍏ユ簮绔�',
- type: 'warning'
- });
- return;
- }
-
- if (this.controlData.staNo == null || this.controlData.staNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囩珯',
- type: 'warning'
- });
- return;
- }
-
- requestParam.liftTaskMode = 3;
- requestParam.sourceStaNo = this.controlData.sourceStaNo;
- requestParam.staNo = this.controlData.staNo;
- }else if (type == 'reset') {
- requestParam.liftTaskMode = 9996;
- }
-
- $.ajax({
- url: baseUrl + "/lift/operator/lift",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: requestParam,
- success: function (res) {
- if (res.code === 200) {
- that.$message({
- message: res.msg,
- type: 'success'
- });
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- that.$message({
- message: res.msg,
- type: 'warning'
- });
- }
- }
- });
- },
- changeControlLiftNo() {
- let liftNo = this.controlData.liftNo;
- if (liftNo == null || liftNo == "") {
- this.controlLiftInfo = null
- }
-
- this.liftAllList.forEach((item) => {
- if (item.liftNo == liftNo) {
- this.controlLiftInfo = item;
- }
- });
- },
- websocketConnect() {
- if (this.ws == null) {
- this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
- this.ws.onopen = this.webSocketOnOpen
- this.ws.onerror = this.webSocketOnError
- this.ws.onmessage = this.webSocketOnMessage
- this.ws.onclose = this.webSocketClose
- }
- },
- webSocketOnOpen(e) {
- console.log("open");
- },
- webSocketOnError(e) {
- this.ws = null;
- console.log(e);
- },
- webSocketOnMessage(e) {
- const result = JSON.parse(e.data);
- if (result.url == "/lift/table/lift/state") {
- this.setLiftStateInfo(JSON.parse(result.data))
- }
- },
- webSocketClose(e) {
- this.ws = null;
- console.log("close");
- },
- sendWs(message) {
- if (this.ws == null) {
- return;
- }
-
- if (this.ws.readyState == WebSocket.OPEN) {
- this.ws.send(message);
- }
- }
- }
- })
-</script>
-</html>
\ No newline at end of file
diff --git a/src/main/webapp/views/lift_old.html b/src/main/webapp/views/lift_old.html
deleted file mode 100644
index f8db854..0000000
--- a/src/main/webapp/views/lift_old.html
+++ /dev/null
@@ -1,507 +0,0 @@
-<!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_wcs.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>浠诲姟鐘舵��</th>
- <th>妯″紡</th>
- <th>蹇欓棽</th>
- <th>鏈夋墭鐩�</th>
- <th>鏈夊皬杞�</th>
- <th>璁惧鏁呴殰</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>
- <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">
- <select id="liftLev">
- <option value="1" selected>1F</option>
- <option value="2">2F</option>
- <option value="3">3F</option>
- <option value="4">4F</option>
- <option value="5">5F</option>
- <option value="6">6F</option>
- <option value="7">7F</option>
- <option value="8">8F</option>
- <option value="9">9F</option>
- <option value="10">10F</option>
- </select>
- <button class="item" onclick="liftOperator(1)">绉诲姩鎻愬崌鏈�</button>
-
- <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(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">
- <label class="form-label">浠ょ墝:</label>
- <div class="form-input">
- <input id="token" name="token" 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();
- }
- }
-
- function getColor(res,e){
- $(e).val(res?"鉁�":"鈥�");
- if (res){
- $(e).attr("style", "color: #FD482C;");
- }else {
- $(e).attr("style", "color: #00FF00;");
- }
- }
-
- $(document).on('click ','#save', function () {
- http.post(baseUrl+ "/lift/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+ "/lift/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+ "/lift/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].protocolStatus$);
- setVal(tr.children("td").eq(3), table[i-1].model$);
- setVal(tr.children("td").eq(4), table[i-1].busy$);
- setVal(tr.children("td").eq(5), table[i-1].hasTray$);
- setVal(tr.children("td").eq(6), table[i-1].hasCar$);
- setVal(tr.children("td").eq(7), table[i-1].deviceError$);
- setVal(tr.children("td").eq(8), table[i-1].frontOverrun$);
- setVal(tr.children("td").eq(9), table[i-1].backOverrun$);
- setVal(tr.children("td").eq(10), table[i-1].leftOverrun$);
- setVal(tr.children("td").eq(11), table[i-1].rightOverrun$);
- setVal(tr.children("td").eq(12), table[i-1].overHeight$);
- setVal(tr.children("td").eq(13), table[i-1].overWeight$);
- setVal(tr.children("td").eq(14), table[i-1].errCode$);
- }
- } 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+ "/lift/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);
- setVal(tr.children("td").eq(8), table[i-1].token);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 鎻愬崌鏈烘棩蹇楄緭鍑� -----------------------------------------------------------------------
- function getliftOutput() {
- $.ajax({
- url: baseUrl + "/lift/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+"/lift/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+ "/lift/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/shuttle.html b/src/main/webapp/views/shuttle.html
deleted file mode 100644
index 01c3d7f..0000000
--- a/src/main/webapp/views/shuttle.html
+++ /dev/null
@@ -1,617 +0,0 @@
-<!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_wcs.css">
- <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
- <link rel="stylesheet" href="../static/css/shuttle.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: 5%;">-->
- <!--<!– <div data-shuttleNo="1" class="shuttle-command-item">–>-->
- <!--<!– <label>1#</label>–>-->
- <!--<!– <button class="demoBtn pos-btn">鏁版嵁缁存姢</button>–>-->
- <!--<!– <button id="mode-1" class="demoBtn mode-btn" >璁惧淇℃伅</button>–>-->
- <!--<!– </div>–>-->
- <!-- </div>-->
- <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
- <div class="shuttle-state" style="width: 100%;">
- <table id="shuttle-state-table">
- <thead>
- <tr>
- <th>鍥涘悜绌挎杞�</th>
- <th>浠诲姟鐘舵��</th>
- <th>灏忚溅鐘舵��</th>
- <th>宸ヤ綔妯″紡</th>
- <th>瀹為檯搴撲綅</th>
- <th>瀹為檯鍧愭爣</th>
- <th>鐢甸噺</th>
- <th>褰撳墠閫熷害</th>
- <th>璐熻浇鐘舵��</th>
- <th>椤跺崌浣嶇疆</th>
- <th>鍏呯數鐘舵��</th>
- <th>鏁呴殰鐮�</th>
- <th>绠″埗鐘舵��</th>
- <th>浣庣數閲�</th>
- <th>婕旂ず妯″紡</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- <!-- 绌挎杞︾姸鎬� -->
- <div class="shuttle-msg">
- <table id="shuttle-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="shuttle-operation">
- <!-- 閬僵灞� -->
- <div class="shuttle-operation-shade">
- <span class="shuttle-operation-shade-span">
- WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
- </span>
- </div>
- <!-- 璁惧浠诲姟閫夋嫨 -->
- <div class="task-select">
- <!-- 閫夋嫨 -->
- <div id="shuttle-select" class="operator-item" style="width: 100%;">
- <span class="select-title">鍥涘悜绌挎杞﹀彿</span>
- <div class="select-container" id="shuttleRadioBoxId" style="display: flex;flex-wrap: wrap;justify-content: center;align-items: center;">
- <!-- <label><input type="radio" name="shuttleSelect" value="1" checked> 1鍙风┛姊溅</label>-->
- </div>
- </div>
- </div>
-
- <!-- 璁惧浠诲姟鎿嶄綔 -->
- <div class="task-operator">
- <fieldset style="height: auto;padding-bottom: 20px;">
- <legend>鎵嬪姩鎿嶄綔</legend>
- <div style="display: flex;">
- <div style="width: 30%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">婧愬簱浣�/鐩爣搴撲綅</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 20px 10px;">
- <div class="select-container-item">
- <span>婧愬簱浣�</span>
- <label><input id="sourceLocNo" type="text" name="sourceLocNo" /></label>
- </div>
- <div class="select-container-item">
- <span>鐩爣搴撲綅</span>
- <label><input id="distLocNo" type="text" name="distLocNo" /></label>
- </div>
-
- <div style="margin-top: 10px;">
- <button class="item" onclick="shuttleOperator(9)">鎼繍璐х墿</button>
- <button class="item" onclick="shuttleOperator(4)">绉诲姩鍒扮洰鏍囧簱浣�</button>
- <button class="item" onclick="shuttleOperator(5)">绉诲姩鍒扮洰鏍囧簱浣�(浠诲姟)</button>
- <!-- <button class="item" onclick="shuttleOperator(16)">绉诲姩鍒版彁鍗囨満</button>-->
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 40%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">鐩稿叧鎸囦护</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 10px 10px;">
- <div class="button-group">
- <button class="item" onclick="shuttleOperator(1)">鎵樼洏椤跺崌</button>
- <button class="item" onclick="shuttleOperator(2)">鎵樼洏涓嬮檷</button>
- <button class="item" onclick="shuttleOperator(15)">鍏呯數寮�</button>
- <button class="item" onclick="shuttleOperator(16)">鍏呯數鍏�</button>
- <button class="item" onclick="shuttleOperator(3)">澶嶄綅</button>
- <button class="item" onclick="shuttleOperator(12)">婕旂ず妯″紡-寮�</button>
- <button class="item" onclick="shuttleOperator(13)">婕旂ず妯″紡-鍏�</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </fieldset>
- </div>
-
- </div>
- <!-- 绌挎杞︽棩蹇楄緭鍑� -->
- <div class="shuttle-output-board">
- <textarea id="shuttle-output"></textarea>
- </div>
- </div>
-</div>
-
-<div id="shuttle-detl" style="display: none">
- <div>
- <div class="form-item">
- <label class="form-label">绌挎杞﹀彿:</label>
- <div class="form-input">
- <input id="shuttleNo" name="shuttleNo" 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>
-</body>
-</html>
-<script>
- // 绌虹櫧琛屾暟
- var shuttleStateTableBlankRows = 0;
- var shuttleMsgTableBlankRows = 0;
- // 瀹為檯琛屾暟
- var shuttleStateTableFullRows = 0;
- var shuttleMsgTableFullRows = 0;
- // 鍒濆鍖�
- var shuttleOutputDom = document.getElementById("shuttle-output");
-
- var ws = new WebSocket("ws://" + window.location.host + baseUrl + "/shuttle/websocket");
-
- //褰揥ebSocket鍒涘缓鎴愬姛鏃讹紝瑙﹀彂onopen浜嬩欢
- ws.onopen = function(){
- console.log("open");
- }
-
- //褰撳鎴风鏀跺埌鏈嶅姟绔彂鏉ョ殑娑堟伅鏃讹紝瑙﹀彂onmessage浜嬩欢
- ws.onmessage = function(e){
- const result = JSON.parse(e.data);
- if (result.url == "/shuttle/table/shuttle/state") {
- setShuttleStateInfo(JSON.parse(result.data))
- setShuttleMsgInfo(JSON.parse(result.data))
- }else if (result.url == "/shuttle/output/shuttle") {
- setShuttleOutput(JSON.parse(result.data))
- }
- // console.log(e.data,result);
- }
-
- //褰撳鎴风鏀跺埌鏈嶅姟绔彂閫佺殑鍏抽棴杩炴帴璇锋眰鏃讹紝瑙﹀彂onclose浜嬩欢
- ws.onclose = function(e){
- console.log("close");
- }
-
- //濡傛灉鍑虹幇杩炴帴銆佸鐞嗐�佹帴鏀躲�佸彂閫佹暟鎹け璐ョ殑鏃跺�欒Е鍙憃nerror浜嬩欢
- ws.onerror = function(e) {
- console.log(e);
- }
-
- $(document).ready(function() {
- initShuttleStateTable();
- getShuttleStateInfo();
- initShuttleMsgTable();
- operatorBlockShow();
- setShuttleRadio();
- });
-
- setInterval(function () {
- getShuttleStateInfo();
- },1000)
- setInterval(function () {
- getShuttleOutput();
- operatorBlockShow();
- },500);
-
- // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
- function operatorBlockShow() {
- if (parent.systemRunning) {
- $('.shuttle-operation').css("opacity", "0.5");
- $('.shuttle-operation-shade').show();
- $('.shuttle-operation-shade-span').show();
- } else {
- $('.shuttle-operation').css("opacity", "1");
- $('.shuttle-operation-shade').hide();
- $('.shuttle-operation-shade-span').hide();
- }
- }
-
- function getColor(res,e){
- $(e).val(res?"鉁�":"鈥�");
- if (res){
- $(e).attr("style", "color: #FD482C;");
- }else {
- $(e).attr("style", "color: #00FF00;");
- }
- }
-
- $(document).on('click ','#save', function () {
- http.post(baseUrl+ "/shuttle/detl/update", {
- shuttleNo: $('#shuttleNo').val(),
- workNo: $('#workNo').val(),
- pakMk: $('#pakMk').val(),
- }, function (res) {
- layer.msg("淇敼鎴愬姛", {icon: 1,});
- layer.close(layerDetl);
- })
- })
-
- function setShuttleRadio() {
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/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 shuttleRadioBox = '<label><input type="radio" name="shuttleSelect" ';
- if (i === 1) {
- shuttleRadioBox += 'checked '
- }
- shuttleRadioBox += 'value="' + table[i - 1].shuttleNo + '"> ' + table[i - 1].shuttleNo + '鍙风┛姊溅</label>'
- $("#shuttleRadioBoxId").append(shuttleRadioBox)
-
-
- //娓叉煋鍥涘悜绌挎杞︽暟鎹淮鎶ゅ拰璁惧淇℃伅html
- let shuttleCommandLogBox = '<div class="shuttle-command-item" data-shuttleNo="' + table[i - 1].shuttleNo + '">\n' +
- '<label>' + table[i - 1].shuttleNo + '#</label>\n' +
- // '<button class="demoBtn pos-btn">鏁版嵁缁存姢</button>\n' +
- // '<button class="demoBtn mode-btn" id="mode-' + table[i - 1].shuttleNo + '">璁惧淇℃伅</button>\n' +
- '</div>'
- $("#commandLogId").append(shuttleCommandLogBox);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
- function getShuttleStateInfo() {
- sendWs(JSON.stringify({
- "url": "/shuttle/table/shuttle/state",
- "data": {}
- }))
- }
-
- // 鍥涘悜绌挎杞︿俊鎭〃璁剧疆 ---- 琛ㄤ竴
- function setShuttleStateInfo(res) {
- let tableEl = $('#shuttle-state-table');
- if (res.code === 200){
- let table = res.data;
- if (table.length > shuttleStateTableBlankRows && table.length !== shuttleStateTableFullRows) {
- initShuttleStateTable(table.length-shuttleStateTableBlankRows);
- shuttleStateTableFullRows = table.length;
- }
- for (let i=1;i<=table.length;i++){
- // $("#mode-"+table[i-1].shuttleNo).html(table[i-1].statusVal===0?'鑱旀満':'鑴辨満');
- let tr = tableEl.find("tr").eq(i);
- let suspendState;
- if (table[i - 1]['extend'] != undefined) {
- suspendState = table[i-1]['extend'].suspendState
- }
-
- setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].protocolStatus$);
- setVal(tr.children("td").eq(2), table[i-1].deviceStatus$);
- setVal(tr.children("td").eq(3), table[i-1].mode$);
- setVal(tr.children("td").eq(4), table[i-1].currentLocNo);
- setVal(tr.children("td").eq(5), table[i-1].currentCode);
- setVal(tr.children("td").eq(6), table[i-1].batteryPower);
- setVal(tr.children("td").eq(7), table[i-1].speed);
- setVal(tr.children("td").eq(8), table[i-1].hasPallet$);
- setVal(tr.children("td").eq(9), table[i-1].hasLift$);
- setVal(tr.children("td").eq(10), table[i-1].hasCharge$);
- setVal(tr.children("td").eq(11), table[i-1].statusErrorCode$);
- setVal(tr.children("td").eq(12), suspendState);
- setVal(tr.children("td").eq(13), table[i-1].lowerPower);
- setVal(tr.children("td").eq(14), table[i-1].demo$);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 鍥涘悜绌挎杞︽暟鎹〃鑾峰彇 ---- 琛ㄤ簩
- function setShuttleMsgInfo(res) {
- let tableEl = $('#shuttle-msg-table');
- if (res.code === 200){
- var table = res.data;
- if (table.length > shuttleMsgTableBlankRows && table.length !== shuttleMsgTableFullRows) {
- initShuttleMsgTable(table.length-shuttleMsgTableBlankRows);
- shuttleMsgTableFullRows = table.length;
- }
- for (var i=1;i<=table.length;i++){
- var tr = tableEl.find("tr").eq(i);
- let maxCellVoltage;
- let minCellVoltage;
- let voltage;
- let chargeCycleTimes;
- let surplusQuantity;
- let countQuantity;
- if (table[i - 1]['extend'] != undefined) {
- maxCellVoltage = table[i-1]['extend'].maxCellVoltage
- minCellVoltage = table[i-1]['extend'].minCellVoltage
- voltage = table[i-1]['extend'].voltage
- chargeCycleTimes = table[i-1]['extend'].chargeCycleTimes
- surplusQuantity = table[i-1]['extend'].surplusQuantity
- countQuantity = table[i-1]['extend'].countQuantity
- }
-
- setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].taskNo);
- setVal(tr.children("td").eq(2), table[i-1].sourceLocNo);
- setVal(tr.children("td").eq(3), table[i-1].locNo);
- setVal(tr.children("td").eq(4), voltage);
- setVal(tr.children("td").eq(5), surplusQuantity);
- setVal(tr.children("td").eq(6), countQuantity);
- setVal(tr.children("td").eq(7), table[i-1].pakMk$);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 绌挎杞︽棩蹇楄緭鍑� -----------------------------------------------------------------------
- function getShuttleOutput() {
- sendWs(JSON.stringify({
- "url": "/shuttle/output/shuttle",
- "data": {}
- }))
- }
-
- function setShuttleOutput(res) {
- if (res.code === 200) {
- shuttleOutput(res.data);
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 浠诲姟鎸囦护涓嬪彂
- function shuttleOperator(shuttleTaskMode) {
- http.post(baseUrl+"/shuttle/operator/shuttle", {
- shuttleNo: $('input[name="shuttleSelect"]:checked').val(),
- shuttleTaskMode: shuttleTaskMode,
- sourceLocNo: $("#sourceLocNo").val(),
- distLocNo: $("#distLocNo").val()
- }, function (res) {
- layer.msg(res.msg, {icon: 1});
- });
- }
-
- // 璺戝簱
- function moveLoc() {
- $.ajax({
- url: baseUrl + "/shuttle/moveLoc",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- shuttleNo: $('input[name="shuttleSelect"]:checked').val(),
- xStart: $("#xStart").val(),
- xTarget: $("#xTarget").val(),
- yStart: $("#yStart").val(),
- yTarget: $("#yTarget").val(),
- moveType: $('input[name="moveType"]:checked').val()
- },
- success: function (res) {
- if (res.code === 200) {
- layer.msg(res.msg, {icon: 1});
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- console.log(res.msg);
- }
- }
- })
- }
-
-
- // ------------------------------------------------------------------------------------------------
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ----- 琛ㄤ竴
- function initShuttleStateTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-state-table thead').height();
- let total = $('.shuttle-state').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleStateTableBlankRows = 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" +
- " <td></td>\n" +
- " </tr>\n";
- }
- $('#shuttle-state-table tbody').after(html);
- }
-
- // 绌挎杞︽暟鎹〃鑾峰彇 ----- 琛ㄤ簩
- function initShuttleMsgTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-msg-table thead').height();
- let total = $('.shuttle-msg').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleMsgTableBlankRows = 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";
- }
- $('#shuttle-msg-table tbody').after(html);
- }
-
- // 鏃ュ織杈撳嚭妗�
- function shuttleOutput(content){
- shuttleOutputDom.value += content;
- shuttleOutputDom.scrollTop = shuttleOutputDom.scrollHeight;
- }
-
- //鍥涘悜绌挎杞﹂厤缃弬鏁颁繚瀛�
- function shuttleParamSave() {
- $.ajax({
- url: baseUrl+ "/shuttle/runSpeed/" + $('input[name="shuttleSelect"]:checked').val(),
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- runSpeed: $("#runSpeed").val(),
- chargeLine: $("#chargeLine").val(),
- },
- success: function (res) {
- if (res.code === 200){
- layer.msg("閰嶇疆宸蹭繚瀛�", {icon: 1,});
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 璇︽儏鎿嶄綔 -------------------------------------------------------------------------
- var layerDetl;
- $(document).on('dblclick ','#shuttle-msg-table tr', function () {
- var shuttleNo = $(this).children("td").eq(0).html();
- if (shuttleNo !== null && shuttleNo !== "") {
- layerDetl = layer.open({
- type: 1,
- title: false,
- shadeClose: true,
- offset: 'rt',
- anim: 5,
- shade: [0],
- area: ['340px', '255px'],
- closeBtn: 0,
- content: $("#shuttle-detl"),
- success: function(layero, index){
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/state",
- 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 (shuttleNo == table[i-1].shuttleNo) {
- $('#shuttleNo').val(shuttleNo);
- $('#workNo').val(table[i-1].taskNo);
- $('#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 () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- $('#token').val("");
- }
- })
- }
- });
-
- $(document).on('click ','#cancel', function () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- $('#token').val("");
- layer.close(layerDetl);
- })
-
- function sendWs(message) {
- if (ws.readyState == WebSocket.OPEN) {
- ws.send(message)
- }
- }
-
-</script>
diff --git a/src/main/webapp/views/shuttle2.html b/src/main/webapp/views/shuttle2.html
deleted file mode 100644
index 48a661a..0000000
--- a/src/main/webapp/views/shuttle2.html
+++ /dev/null
@@ -1,657 +0,0 @@
-<!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_wcs.css">
- <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
- <link rel="stylesheet" href="../static/css/shuttle.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: 5%;">-->
-<!--<!– <div data-shuttleNo="1" class="shuttle-command-item">–>-->
-<!--<!– <label>1#</label>–>-->
-<!--<!– <button class="demoBtn pos-btn">鏁版嵁缁存姢</button>–>-->
-<!--<!– <button id="mode-1" class="demoBtn mode-btn" >璁惧淇℃伅</button>–>-->
-<!--<!– </div>–>-->
-<!-- </div>-->
- <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
- <div class="shuttle-state" style="width: 100%;">
- <table id="shuttle-state-table">
- <thead>
- <tr>
- <th>鍥涘悜绌挎杞�</th>
- <th>浠诲姟鐘舵��</th>
- <th>灏忚溅鐘舵��</th>
- <th>宸ヤ綔妯″紡</th>
- <th>瀹為檯搴撲綅</th>
- <th>瀹為檯鍧愭爣</th>
- <th>鐢甸噺</th>
- <th>褰撳墠閫熷害</th>
- <th>璐熻浇鐘舵��</th>
- <th>椤跺崌浣嶇疆</th>
- <th>杩愯鏂瑰悜</th>
- <th>杩愯鏂瑰悜2</th>
- <th>鍏呯數鐘舵��</th>
- <th>鏁呴殰鐘舵��</th>
- <th>鏁呴殰鐮�</th>
- <th>绠″埗鐘舵��</th>
- <th>浣庣數閲�</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- <!-- 绌挎杞︾姸鎬� -->
- <div class="shuttle-msg">
- <table id="shuttle-msg-table">
- <thead>
- <tr>
- <th>鍥涘悜绌挎杞�</th>
- <th>宸ヤ綔鍙�</th>
- <th>婧愬簱浣�</th>
- <th>鐩爣搴撲綅</th>
- <th>鏈�楂樼數鑺數鍘�</th>
- <th>鏈�浣庣數鑺數鍘�</th>
- <th>鐢垫睜鐢靛帇</th>
- <th>鍏呮斁鐢靛惊鐜鏁�</th>
- <th>鍓╀綑鐢甸噺</th>
- <th>鎬荤數閲�</th>
- <th>鎬婚噷绋嬫暟</th>
- <th>浣滀笟鏍囪</th>
- <th>褰撳墠搴撲綅</th>
- <th>浠ょ墝</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- <!-- 鎵嬪姩鎿嶄綔 -->
- <div class="shuttle-operation">
- <!-- 閬僵灞� -->
- <div class="shuttle-operation-shade">
- <span class="shuttle-operation-shade-span">
- WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
- </span>
- </div>
- <!-- 璁惧浠诲姟閫夋嫨 -->
- <div class="task-select">
- <!-- 閫夋嫨 -->
- <div id="shuttle-select" class="operator-item" style="width: 100%;">
- <span class="select-title">鍥涘悜绌挎杞﹀彿</span>
- <div class="select-container" id="shuttleRadioBoxId" style="display: flex;flex-wrap: wrap;justify-content: center;align-items: center;">
-<!-- <label><input type="radio" name="shuttleSelect" value="1" checked> 1鍙风┛姊溅</label>-->
- </div>
- </div>
- </div>
-
- <!-- 璁惧浠诲姟鎿嶄綔 -->
- <div class="task-operator">
- <fieldset style="height: auto;padding-bottom: 20px;">
- <legend>鎵嬪姩鎿嶄綔</legend>
- <div style="display: flex;">
- <div style="width: 30%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">婧愬簱浣�/鐩爣搴撲綅</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 20px 10px;">
- <div class="select-container-item">
- <span>婧愬簱浣�</span>
- <label><input id="sourceLocNo" type="text" name="sourceLocNo" /></label>
- </div>
- <div class="select-container-item">
- <span>鐩爣搴撲綅</span>
- <label><input id="distLocNo" type="text" name="distLocNo" /></label>
- </div>
-
- <div style="margin-top: 10px;">
- <button class="item" onclick="shuttleOperator(18)">鎼繍璐х墿</button>
- <button class="item" onclick="shuttleOperator(14)">绉诲姩鍒扮洰鏍囧簱浣�</button>
- <button class="item" onclick="shuttleOperator(23)">绉诲姩鍒扮洰鏍囧簱浣�(浠诲姟)</button>
-<!-- <button class="item" onclick="shuttleOperator(16)">绉诲姩鍒版彁鍗囨満</button>-->
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 40%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">鐩稿叧鎸囦护</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 10px 10px;">
- <div class="button-group">
- <button class="item" onclick="shuttleOperator(3)">鎵樼洏椤跺崌</button>
- <button class="item" onclick="shuttleOperator(4)">鎵樼洏涓嬮檷</button>
- <button class="item" onclick="shuttleOperator(15)">鍏呯數寮�鍏�</button>
- <button class="item" onclick="shuttleOperator(9)">澶嶄綅</button>
- <button class="item" onclick="shuttleOperator(21)">绠″埗</button>
- <button class="item" onclick="shuttleOperator(22)">鍙栨秷绠″埗</button>
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 30%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">璺戝簱绯荤粺</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 20px 10px;">
- <div class="select-container-item">
- <span>X璧风偣</span>
- <label><input id="xStart" type="text" name="xStart" /></label>
- </div>
- <div class="select-container-item">
- <span>X缁堢偣</span>
- <label><input id="xTarget" type="text" name="xTarget" /></label>
- </div>
- <div class="select-container-item">
- <span>Y璧风偣</span>
- <label><input id="yStart" type="text" name="yStart" /></label>
- </div>
- <div class="select-container-item">
- <span>Y缁堢偣</span>
- <label><input id="yTarget" type="text" name="yTarget" /></label>
- </div>
- <div>
- <label><input type="radio" name="moveType" value="0"> 璺戣建閬�</label>
- <label><input type="radio" name="moveType" value="1"> 璺戝簱浣�</label>
- <label><input type="radio" name="moveType" value="2"> 姣嶈建閬撳惊鐜窇</label>
- <label><input type="radio" name="moveType" value="3"> 瀛愯建閬撳惊鐜窇</label>
- </div>
- <div style="margin-top: 10px;">
- <button class="item" onclick="moveLoc()">璺戝簱</button>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </fieldset>
- </div>
-
- </div>
- <!-- 绌挎杞︽棩蹇楄緭鍑� -->
- <div class="shuttle-output-board">
- <textarea id="shuttle-output"></textarea>
- </div>
- </div>
- </div>
-
- <div id="shuttle-detl" style="display: none">
- <div>
- <div class="form-item">
- <label class="form-label">绌挎杞﹀彿:</label>
- <div class="form-input">
- <input id="shuttleNo" name="shuttleNo" 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">
- <label class="form-label">浠ょ墝:</label>
- <div class="form-input">
- <input id="token" name="token" 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>
-</body>
-</html>
-<script>
- // 绌虹櫧琛屾暟
- var shuttleStateTableBlankRows = 0;
- var shuttleMsgTableBlankRows = 0;
- // 瀹為檯琛屾暟
- var shuttleStateTableFullRows = 0;
- var shuttleMsgTableFullRows = 0;
- // 鍒濆鍖�
- var shuttleOutputDom = document.getElementById("shuttle-output");
-
- var ws = new WebSocket("ws://" + window.location.host + baseUrl + "/shuttle/websocket");
-
- //褰揥ebSocket鍒涘缓鎴愬姛鏃讹紝瑙﹀彂onopen浜嬩欢
- ws.onopen = function(){
- console.log("open");
- }
-
- //褰撳鎴风鏀跺埌鏈嶅姟绔彂鏉ョ殑娑堟伅鏃讹紝瑙﹀彂onmessage浜嬩欢
- ws.onmessage = function(e){
- const result = JSON.parse(e.data);
- if (result.url == "/shuttle/table/shuttle/state") {
- setShuttleStateInfo(JSON.parse(result.data))
- setShuttleMsgInfo(JSON.parse(result.data))
- }else if (result.url == "/shuttle/output/shuttle") {
- setShuttleOutput(JSON.parse(result.data))
- }
- // console.log(e.data,result);
- }
-
- //褰撳鎴风鏀跺埌鏈嶅姟绔彂閫佺殑鍏抽棴杩炴帴璇锋眰鏃讹紝瑙﹀彂onclose浜嬩欢
- ws.onclose = function(e){
- console.log("close");
- }
-
- //濡傛灉鍑虹幇杩炴帴銆佸鐞嗐�佹帴鏀躲�佸彂閫佹暟鎹け璐ョ殑鏃跺�欒Е鍙憃nerror浜嬩欢
- ws.onerror = function(e) {
- console.log(e);
- }
-
- $(document).ready(function() {
- initShuttleStateTable();
- getShuttleStateInfo();
- initShuttleMsgTable();
- operatorBlockShow();
- setShuttleRadio();
- });
-
- setInterval(function () {
- getShuttleStateInfo();
- },1000)
- setInterval(function () {
- getShuttleOutput();
- operatorBlockShow();
- },500);
-
- // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
- function operatorBlockShow() {
- if (parent.systemRunning) {
- $('.shuttle-operation').css("opacity", "0.5");
- $('.shuttle-operation-shade').show();
- $('.shuttle-operation-shade-span').show();
- } else {
- $('.shuttle-operation').css("opacity", "1");
- $('.shuttle-operation-shade').hide();
- $('.shuttle-operation-shade-span').hide();
- }
- }
-
- function getColor(res,e){
- $(e).val(res?"鉁�":"鈥�");
- if (res){
- $(e).attr("style", "color: #FD482C;");
- }else {
- $(e).attr("style", "color: #00FF00;");
- }
- }
-
- $(document).on('click ','#save', function () {
- http.post(baseUrl+ "/shuttle/detl/update", {
- shuttleNo: $('#shuttleNo').val(),
- workNo: $('#workNo').val(),
- pakMk: $('#pakMk').val(),
- token: $('#token').val(),
- }, function (res) {
- layer.msg("淇敼鎴愬姛", {icon: 1,});
- layer.close(layerDetl);
- })
- })
-
- function setShuttleRadio() {
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/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 shuttleRadioBox = '<label><input type="radio" name="shuttleSelect" ';
- if (i === 1) {
- shuttleRadioBox += 'checked '
- }
- shuttleRadioBox += 'value="' + table[i - 1].shuttleNo + '"> ' + table[i - 1].shuttleNo + '鍙风┛姊溅</label>'
- $("#shuttleRadioBoxId").append(shuttleRadioBox)
-
-
- //娓叉煋鍥涘悜绌挎杞︽暟鎹淮鎶ゅ拰璁惧淇℃伅html
- let shuttleCommandLogBox = '<div class="shuttle-command-item" data-shuttleNo="' + table[i - 1].shuttleNo + '">\n' +
- '<label>' + table[i - 1].shuttleNo + '#</label>\n' +
- // '<button class="demoBtn pos-btn">鏁版嵁缁存姢</button>\n' +
- // '<button class="demoBtn mode-btn" id="mode-' + table[i - 1].shuttleNo + '">璁惧淇℃伅</button>\n' +
- '</div>'
- $("#commandLogId").append(shuttleCommandLogBox);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
- function getShuttleStateInfo() {
- sendWs(JSON.stringify({
- "url": "/shuttle/table/shuttle/state",
- "data": {}
- }))
- }
-
- // 鍥涘悜绌挎杞︿俊鎭〃璁剧疆 ---- 琛ㄤ竴
- function setShuttleStateInfo(res) {
- let tableEl = $('#shuttle-state-table');
- if (res.code === 200){
- let table = res.data;
- if (table.length > shuttleStateTableBlankRows && table.length !== shuttleStateTableFullRows) {
- initShuttleStateTable(table.length-shuttleStateTableBlankRows);
- shuttleStateTableFullRows = table.length;
- }
- for (let i=1;i<=table.length;i++){
- // $("#mode-"+table[i-1].shuttleNo).html(table[i-1].statusVal===0?'鑱旀満':'鑴辨満');
- let tr = tableEl.find("tr").eq(i);
- setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].protocolStatus$);
- setVal(tr.children("td").eq(2), table[i-1].free$);
- setVal(tr.children("td").eq(3), table[i-1].workingMode$);
- setVal(tr.children("td").eq(4), table[i-1].point$);
- setVal(tr.children("td").eq(5), table[i-1].point$$);
- setVal(tr.children("td").eq(6), table[i-1].powerPercent$);
- setVal(tr.children("td").eq(7), table[i-1].speed);
- setVal(tr.children("td").eq(8), table[i-1].loadState$);
- setVal(tr.children("td").eq(9), table[i-1].liftPosition$);
- setVal(tr.children("td").eq(10), table[i-1].runDir$);
- setVal(tr.children("td").eq(11), table[i-1].runDir2$);
- setVal(tr.children("td").eq(12), table[i-1].chargState$);
- setVal(tr.children("td").eq(13), table[i-1].errState$);
- setVal(tr.children("td").eq(14), table[i-1].errCode$);
- setVal(tr.children("td").eq(15), table[i-1].suspendState$);
- setVal(tr.children("td").eq(16), table[i-1].lowerPower);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 鍥涘悜绌挎杞︽暟鎹〃鑾峰彇 ---- 琛ㄤ簩
- function setShuttleMsgInfo(res) {
- let tableEl = $('#shuttle-msg-table');
- if (res.code === 200){
- var table = res.data;
- if (table.length > shuttleMsgTableBlankRows && table.length !== shuttleMsgTableFullRows) {
- initShuttleMsgTable(table.length-shuttleMsgTableBlankRows);
- shuttleMsgTableFullRows = 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].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].taskNo);
- setVal(tr.children("td").eq(2), table[i-1].sourceLocNo);
- setVal(tr.children("td").eq(3), table[i-1].locNo);
- setVal(tr.children("td").eq(4), table[i-1].maxCellVoltage$);
- setVal(tr.children("td").eq(5), table[i-1].minCellVoltage$);
- setVal(tr.children("td").eq(6), table[i-1].voltage$);
- setVal(tr.children("td").eq(7), table[i-1].chargeCycleTimes);
- setVal(tr.children("td").eq(8), table[i-1].surplusQuantity);
- setVal(tr.children("td").eq(9), table[i-1].countQuantity);
- setVal(tr.children("td").eq(10), table[i-1].statusSum ? table[i - 1].statusSum.mileage : '');
- setVal(tr.children("td").eq(11), table[i-1].pakMk$);
- setVal(tr.children("td").eq(12), table[i-1].currentLocNo);
- setVal(tr.children("td").eq(13), table[i-1].token);
- if (table[i-1].shuttleNo == parseInt($('input[name="shuttleSelect"]:checked').val())) {
- $("#runSpeedText").text(table[i-1].runSpeed)
- $("#chargeLineText").text(table[i-1].chargeLine + "%")
- }
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 绌挎杞︽棩蹇楄緭鍑� -----------------------------------------------------------------------
- function getShuttleOutput() {
- sendWs(JSON.stringify({
- "url": "/shuttle/output/shuttle",
- "data": {}
- }))
- }
-
- function setShuttleOutput(res) {
- if (res.code === 200) {
- shuttleOutput(res.data);
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- console.log(res.msg);
- }
- }
-
- // 浠诲姟鎸囦护涓嬪彂
- function shuttleOperator(shuttleTaskMode) {
- http.post(baseUrl+"/shuttle/operator/shuttle", {
- shuttleNo: $('input[name="shuttleSelect"]:checked').val(),
- shuttleTaskMode: shuttleTaskMode,
- sourceLocNo: $("#sourceLocNo").val(),
- distLocNo: $("#distLocNo").val()
- }, function (res) {
- layer.msg(res.msg, {icon: 1});
- });
- }
-
- // 璺戝簱
- function moveLoc() {
- $.ajax({
- url: baseUrl + "/shuttle/moveLoc",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- shuttleNo: $('input[name="shuttleSelect"]:checked').val(),
- xStart: $("#xStart").val(),
- xTarget: $("#xTarget").val(),
- yStart: $("#yStart").val(),
- yTarget: $("#yTarget").val(),
- moveType: $('input[name="moveType"]:checked').val()
- },
- success: function (res) {
- if (res.code === 200) {
- layer.msg(res.msg, {icon: 1});
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- console.log(res.msg);
- }
- }
- })
- }
-
-
- // ------------------------------------------------------------------------------------------------
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ----- 琛ㄤ竴
- function initShuttleStateTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-state-table thead').height();
- let total = $('.shuttle-state').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleStateTableBlankRows = 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" +
- " <td></td>\n" +
- " </tr>\n";
- }
- $('#shuttle-state-table tbody').after(html);
- }
-
- // 绌挎杞︽暟鎹〃鑾峰彇 ----- 琛ㄤ簩
- function initShuttleMsgTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-msg-table thead').height();
- let total = $('.shuttle-msg').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleMsgTableBlankRows = 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";
- }
- $('#shuttle-msg-table tbody').after(html);
- }
-
- // 鏃ュ織杈撳嚭妗�
- function shuttleOutput(content){
- shuttleOutputDom.value += content;
- shuttleOutputDom.scrollTop = shuttleOutputDom.scrollHeight;
- }
-
- //鍥涘悜绌挎杞﹂厤缃弬鏁颁繚瀛�
- function shuttleParamSave() {
- $.ajax({
- url: baseUrl+ "/shuttle/runSpeed/" + $('input[name="shuttleSelect"]:checked').val(),
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- runSpeed: $("#runSpeed").val(),
- chargeLine: $("#chargeLine").val(),
- },
- success: function (res) {
- if (res.code === 200){
- layer.msg("閰嶇疆宸蹭繚瀛�", {icon: 1,});
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 璇︽儏鎿嶄綔 -------------------------------------------------------------------------
- var layerDetl;
- $(document).on('dblclick ','#shuttle-msg-table tr', function () {
- var shuttleNo = $(this).children("td").eq(0).html();
- if (shuttleNo !== null && shuttleNo !== "") {
- layerDetl = layer.open({
- type: 1,
- title: false,
- shadeClose: true,
- offset: 'rt',
- anim: 5,
- shade: [0],
- area: ['340px', '255px'],
- closeBtn: 0,
- content: $("#shuttle-detl"),
- success: function(layero, index){
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/state",
- 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 (shuttleNo == table[i-1].shuttleNo) {
- $('#shuttleNo').val(shuttleNo);
- $('#workNo').val(table[i-1].taskNo);
- $('#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 () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- $('#token').val("");
- }
- })
- }
- });
-
- $(document).on('click ','#cancel', function () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- $('#token').val("");
- layer.close(layerDetl);
- })
-
- function sendWs(message) {
- if (ws.readyState == WebSocket.OPEN) {
- ws.send(message)
- }
- }
-
-</script>
diff --git a/src/main/webapp/views/shuttleNew.html b/src/main/webapp/views/shuttleNew.html
deleted file mode 100644
index 138a1ff..0000000
--- a/src/main/webapp/views/shuttleNew.html
+++ /dev/null
@@ -1,677 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>鍥涘悜绌挎杞︾洃鎺х郴缁�</title>
- <link rel="stylesheet" href="../static/vue/element/element.css">
- <link rel="stylesheet" href="../static/css/shuttle_page.min.css">
- <script src="../static/js/shuttle_page.js"></script>
- <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
- <script type="text/javascript" src="../static/js/common.js"></script>
- <script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
- <script type="text/javascript" src="../static/vue/element/element.js"></script>
- <style>
- body {
- font-family: 'Noto Sans SC', sans-serif;
- background-color: #0f172a;
- color: #e2e8f0;
- }
- .card {
- background-color: #1e293b;
- border-radius: 0.75rem;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- transition: all 0.3s ease;
- }
- /*.card:hover {*/
- /* transform: translateY(-2px);*/
- /* box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);*/
- /*}*/
- .btn {
- background-color: #3b82f6;
- color: white;
- border-radius: 0.5rem;
- padding: 0.5rem 1rem;
- transition: all 0.3s ease;
- }
- .btn:hover {
- background-color: #2563eb;
- transform: translateY(-1px);
- }
- .status-active {
- color: #4ade80;
- }
- .status-inactive {
- color: #f87171;
- }
- .progress-bar {
- height: 0.75rem;
- border-radius: 0.375rem;
- background-color: #334155;
- }
- .progress-fill {
- height: 100%;
- border-radius: 0.375rem;
- background-color: #4ade80;
- transition: width 0.5s ease;
- }
- .table-striped tbody tr:nth-child(odd) {
- background-color: #1e293b;
- }
- .table-striped tbody tr:nth-child(even) {
- background-color: #1a2537;
- }
- </style>
-</head>
-<body class="min-h-screen">
- <div id="app">
- <div class="container mx-auto px-4 py-8">
- <!-- 椤堕儴鏍囬鍜岀姸鎬佹爮 -->
- <div class="flex flex-col md:flex-row justify-between items-center mb-8">
- <h1 class="text-3xl font-bold text-blue-400 mb-4 md:mb-0">
- <i class="fas fa-robot mr-2"></i>鍥涘悜绌挎杞︾洃鎺х郴缁�
- </h1>
- <div class="flex items-center space-x-4">
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
- <span>鍦ㄧ嚎: {{ deviceStatusCountMap.online }}</span>
- </div>
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
- <span>鏁呴殰: {{ deviceStatusCountMap.error }}</span>
- </div>
- <div class="flex items-center">
- <div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
- <span>绂荤嚎: {{ deviceStatusCountMap.offline }}</span>
- </div>
- </div>
- </div>
-
- <!-- 涓昏鐩戞帶鍖哄煙 -->
- <div class="card p-6 mb-8">
- <!-- 绌挎杞︾姸鎬佽〃鏍� -->
- <div class="card p-6">
- <div class="flex justify-between items-center mb-4">
- <h2 class="text-xl font-semibold text-blue-300">
- <i class="fas fa-list-alt mr-2"></i>绌挎杞︾姸鎬�
- </h2>
- <div class="relative">
- <select v-model="selectListStatus" class="bg-slate-700 text-white rounded px-3 py-1 pr-8">
- <option value="all">鍏ㄩ儴鐘舵��</option>
- <option value="online">鍦ㄧ嚎</option>
- <option value="idle">绌洪棽</option>
- <option value="running">杩愯涓�</option>
- <option value="offline">绂荤嚎</option>
- <option value="error">鏁呴殰</option>
- </select>
- </div>
- </div>
- <div class="overflow-auto" style="height: 500px;">
- <table class="w-full table-striped">
- <thead>
- <tr class="text-left text-slate-300 border-b border-slate-600 bg-slate-800 sticky top-0 z-10">
- <th class="py-3 px-4">缂栧彿</th>
- <th class="py-3 px-4">宸ヤ綔鍙�</th>
- <th class="py-3 px-4">浠诲姟鐘舵��</th>
- <th class="py-3 px-4">灏忚溅鐘舵��</th>
- <th class="py-3 px-4">妯″紡</th>
- <th class="py-3 px-4">搴撲綅</th>
- <th class="py-3 px-4">鍧愭爣</th>
- <th class="py-3 px-4">鐢甸噺</th>
- <th class="py-3 px-4">鐢靛帇</th>
- <th class="py-3 px-4">閫熷害</th>
- <th class="py-3 px-4">璐熻浇</th>
- <th class="py-3 px-4">椤跺崌</th>
- <th class="py-3 px-4">鍏呯數</th>
- <th class="py-3 px-4">鏁呴殰鐮�</th>
-<!-- <th class="py-3 px-4">绠″埗</th>-->
- <th class="py-3 px-4">浣庣數閲�</th>
- <th class="py-3 px-4">婕旂ず妯″紡</th>
- <th class="py-3 px-4">鏍囪</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item,idx) in shuttleList" :key="idx" class="hover:bg-slate-700">
- <td class="py-3 px-4">{{ item.shuttleNo }}</td>
- <td class="py-3 px-4">{{ item.taskNo }}</td>
- <td class="py-3 px-4">{{ item.protocolStatus$ }}</td>
- <td class="py-3 px-4">{{ item.deviceStatus$ }}</td>
- <td class="py-3 px-4">{{ item.mode$ }}</td>
- <td class="py-3 px-4">{{ item.currentLocNo }}</td>
- <td class="py-3 px-4">{{ item.currentCode }}</td>
- <td class="py-3 px-4">
- <div class="w-full bg-gray-200 rounded-full h-2.5">
- <div v-if="item.batteryPower>=70&&item.batteryPower<=100">
- <div class="bg-green-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
- </div>
- <div v-else-if="item.batteryPower>=40&&item.batteryPower<70">
- <div class="bg-yellow-500 h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
- </div>
- <div v-else>
- <div class="red h-2.5 rounded-full" :style="{width: item.batteryPower + '%'}"></div>
- </div>
- </div>
- <span class="text-xs text-gray-500">{{ item.batteryPower }}%</span>
- </td>
- <td class="py-3 px-4">{{ item.extend.voltage }}</td>
- <td class="py-3 px-4">{{ item.speed }}</td>
- <td class="py-3 px-4">{{ item.hasPallet$ }}</td>
- <td class="py-3 px-4">{{ item.hasLift$ }}</td>
- <td class="py-3 px-4">{{ item.hasCharge$ }}</td>
- <td class="py-3 px-4">{{ item.statusErrorCode$ }}</td>
- <!-- <td class="py-3 px-4">{{ item.suspendState }}</td>-->
- <td class="py-3 px-4">{{ item.lowerPower }}</td>
- <td class="py-3 px-4">{{ item.demo$ }}</td>
- <td class="py-3 px-4">{{ item.pakMk$ }}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
-
- <!-- 鎿嶄綔鎺у埗鍖哄煙 -->
- <div class="card p-6 mb-8">
- <h2 class="text-xl font-semibold text-blue-300 mb-4">
- <i class="fas fa-sliders-h mr-2"></i>鎺у埗闈㈡澘
- </h2>
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-2">
- <div class="bg-slate-700 p-4 rounded-lg">
- <h3 class="text-lg font-medium mb-2">杞﹁締鎺у埗</h3>
- <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
- <div>
- <el-input @change="changeControlShuttleNo" v-model="controlData.shuttleNo" style="width: 150px;" placeholder="杞﹁締缂栧彿"></el-input>
- </div>
- <div>
- <el-input @change="changeControlShuttleNo" v-model="controlData.taskNo" style="width: 150px;" placeholder="宸ヤ綔鍙�"></el-input>
- </div>
- <div>
- <el-input v-model="controlData.sourceLocNo" style="width: 200px;" placeholder="婧愬簱浣�"></el-input>
- </div>
- <div>
- <el-input v-model="controlData.targetLocNo" style="width: 200px;" placeholder="鐩爣搴撲綅"></el-input>
- </div>
- <div>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('writeTaskNo')">
- <i class="fas fa-credit-card-alt mr-1"></i>鍐欏叆宸ヤ綔鍙�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('transport')">
- <i class="fas fa-truck mr-1"></i>鎼繍璐х墿
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('move')">
- <i class="fas fa-car mr-1"></i>绉诲姩鍒扮洰鏍囧簱浣�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('moveTask')">
- <i class="fas fa-car mr-1"></i>绉诲姩鍒扮洰鏍囧簱浣�(浠诲姟)
- </button>
- </div>
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg">
- <h3 class="text-lg font-medium mb-2">璁惧鎸囦护</h3>
- <div class="flex flex-wrap gap-2" style="display: flex;justify-content: center;">
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('palletLift')">
- <i class="fas fa-level-up mr-1"></i>鎵樼洏椤跺崌
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('palletDown')">
- <i class="fas fa-level-down mr-1"></i>鎵樼洏涓嬮檷
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('chargeOn')">
- <i class="fas fa-battery-three-quarters mr-1"></i>鍏呯數-寮�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('chargeOff')">
- <i class="fas fa-battery-empty mr-1"></i>鍏呯數-鍏�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('reset')">
- <i class="fas fa-home mr-1"></i>澶嶄綅
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('demoOn')">
- <i class="fas fa-hourglass-half mr-1"></i>婕旂ず-寮�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('demoOff')">
- <i class="fas fa-hourglass-empty mr-1"></i>婕旂ず-鍏�
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('clearPath')">
- <i class="fas fa-anchor mr-1"></i>娓呴櫎璺緞
- </button>
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="shuttleOperator('restartCalcPath')">
- <i class="fas fa-anchor mr-1"></i>閲嶆柊璁$畻璺緞
- </button>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 鏃ュ織鍖哄煙 -->
- <div class="card p-6">
- <div class="flex justify-between items-center mb-4">
- <h2 class="text-xl font-semibold text-blue-300">
- <i class="fas fa-history mr-2"></i>杞﹁締淇℃伅
- </h2>
- </div>
- <div class="bg-slate-800 rounded-lg p-4">
- <div v-if="controlShuttleInfo != null" style="display: flex;flex-wrap: wrap;justify-content: space-around;">
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">杞﹁締缂栧彿</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.shuttleNo}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">宸ヤ綔鍙�</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.taskNo}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">浠诲姟鐘舵��</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.protocolStatus$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">灏忚溅鐘舵��</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.deviceStatus$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">妯″紡</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.mode$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">搴撲綅</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.currentLocNo}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">鍧愭爣</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.currentCode}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">鐢甸噺</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.batteryPower}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">鐢靛帇</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.extend.voltage}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">閫熷害</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.speed}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">璐熻浇</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.hasPallet$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">椤跺崌</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.hasLift$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">鍏呯數</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.hasCharge$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">鏁呴殰鐮�</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.statusErrorCode$}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">浣庣數閲�</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.lowerPower}}
- </div>
- </div>
- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">
- <h3 class="text-lg font-medium mb-2">婕旂ず妯″紡</h3>
- <div class="flex flex-wrap gap-4">
- {{controlShuttleInfo.demo$}}
- </div>
- </div>
-<!-- <div class="bg-slate-700 p-4 rounded-lg" style="width: 20%;margin-right: 10px;margin-top: 10px;">-->
-<!-- <h3 class="text-lg font-medium mb-2">鏍囪</h3>-->
-<!-- <div class="flex flex-wrap gap-4">-->
-<!-- {{controlShuttleInfo.pakMk$}}-->
-<!-- </div>-->
-<!-- </div>-->
- </div>
-
-<!-- <div class="overflow-y-auto max-h-60">-->
-<!-- <div class="flex items-start py-2 border-b border-slate-700">-->
-<!-- <div class="w-24 text-sm text-slate-400">14:30:22</div>-->
-<!-- <div class="flex-1">-->
-<!-- <span class="text-green-400">[INFO]</span> 绌挎杞C001瀹屾垚浠诲姟T001-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- <div class="flex items-start py-2 border-b border-slate-700">-->
-<!-- <div class="w-24 text-sm text-slate-400">14:28:15</div>-->
-<!-- <div class="flex-1">-->
-<!-- <span class="text-blue-400">[SYSTEM]</span> 绯荤粺鑷姩澶囦唤瀹屾垚-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- <div class="flex items-start py-2 border-b border-slate-700">-->
-<!-- <div class="w-24 text-sm text-slate-400">14:25:47</div>-->
-<!-- <div class="flex-1">-->
-<!-- <span class="text-yellow-400">[WARNING]</span> 绌挎杞C004鐢甸噺浣庝簬30%-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- <div class="flex items-start py-2 border-b border-slate-700">-->
-<!-- <div class="w-24 text-sm text-slate-400">14:22:33</div>-->
-<!-- <div class="flex-1">-->
-<!-- <span class="text-green-400">[INFO]</span> 鏂颁换鍔004宸叉坊鍔犲埌闃熷垪-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- <div class="flex items-start py-2 border-b border-slate-700">-->
-<!-- <div class="w-24 text-sm text-slate-400">14:20:18</div>-->
-<!-- <div class="flex-1">-->
-<!-- <span class="text-green-400">[INFO]</span> 绌挎杞C002寮�濮嬫墽琛屼换鍔002-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- </div>-->
- </div>
- </div>
-
- </div>
- </div>
-</body>
-
-<script>
- var app = new Vue({
- el: '#app',
- data: {
- ws: null,
- shuttleList: [], //鍥涘悜绌挎杞﹂泦鍚�
- shuttleAllList: [],
- selectListStatus: "all",
- deviceStatusCountMap: {},
- controlData: {
- shuttleNo: "",
- taskNo: "",
- sourceLocNo: "",
- targetLocNo: ""
- },
- controlShuttleInfo: null,
- },
- created() {
- this.init()
- },
- watch: {
-
- },
- methods: {
- init() {
- this.consoleInterval = setInterval(() => {
- this.websocketConnect();
-
- this.getShuttleStateInfo() //鑾峰彇鍥涘悜绌挎杞︿俊鎭�
- }, 1000)
- },
- getShuttleStateInfo() {
- this.sendWs(JSON.stringify({
- "url": "/shuttle/table/shuttle/state",
- "data": {}
- }))
- },
- setShuttleStateInfo(res) {
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇
- if (res.code == 200) {
- let list = res.data;
-
- let allList = []
- let runningList = []
- let idleList = []
- let errorList = []
- let offlineList = []
- let onlineList = []
-
- list.forEach((item) => {
- allList.push(item)
-
- if(item.deviceStatus == 0 && item.protocolStatusType != "OFFLINE") {
- runningList.push(item)
- }
-
- if(item.deviceStatus == 1 && item.protocolStatusType != "OFFLINE") {
- idleList.push(item)
- }
-
- if(parseInt(item.statusErrorCode) > 0) {
- errorList.push(item)
- }
-
- if (item.protocolStatusType == "OFFLINE") {
- offlineList.push(item)
- }else {
- onlineList.push(item)
- }
- })
-
- if (this.selectListStatus == "all") {
- this.shuttleList = allList;
- }else if (this.selectListStatus == "running") {
- this.shuttleList = runningList;
- }else if (this.selectListStatus == "idle") {
- this.shuttleList = idleList;
- }else if (this.selectListStatus == "error") {
- this.shuttleList = errorList;
- }else if (this.selectListStatus == "offline") {
- this.shuttleList = offlineList;
- }else if (this.selectListStatus == "online") {
- this.shuttleList = onlineList;
- }
-
- let tmpMap = {
- idle: idleList.length,
- running: runningList.length,
- error: errorList.length,
- offline: offlineList.length,
- online: idleList.length + runningList.length,
- }
- this.deviceStatusCountMap = tmpMap;
-
- this.shuttleAllList = allList;
- if (this.controlShuttleInfo != null) {
- allList.forEach((item) => {
- if(item.shuttleNo == this.controlShuttleInfo.shuttleNo) {
- this.controlShuttleInfo = item;
- }
- });
- }
- }
- },
- shuttleOperator(type) {
- let that = this;
- if (this.controlData.shuttleNo == null || this.controlData.shuttleNo == "") {
- this.$message({
- message: '璇疯緭鍏ヨ溅杈嗙紪鍙�',
- type: 'warning'
- });
- return;
- }
-
- let requestParam = {
- shuttleNo: this.controlData.shuttleNo
- };
-
- if (type == 'transport') {
- if (this.controlData.sourceLocNo == null || this.controlData.sourceLocNo == "") {
- this.$message({
- message: '璇疯緭鍏ユ簮搴撲綅',
- type: 'warning'
- });
- return;
- }
-
- if (this.controlData.targetLocNo == null || this.controlData.targetLocNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囧簱浣�',
- type: 'warning'
- });
- return;
- }
-
- requestParam.shuttleTaskMode = 9;
- requestParam.sourceLocNo = this.controlData.sourceLocNo;
- requestParam.distLocNo = this.controlData.targetLocNo;
- }else if (type == 'move') {
- if (this.controlData.targetLocNo == null || this.controlData.targetLocNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囧簱浣�',
- type: 'warning'
- });
- return;
- }
-
- requestParam.shuttleTaskMode = 4;
- requestParam.sourceLocNo = this.controlData.targetLocNo;
- requestParam.distLocNo = this.controlData.targetLocNo;
- }else if (type == 'moveTask') {
- if (this.controlData.targetLocNo == null || this.controlData.targetLocNo == "") {
- this.$message({
- message: '璇疯緭鍏ョ洰鏍囧簱浣�',
- type: 'warning'
- });
- return;
- }
-
- requestParam.shuttleTaskMode = 5;
- requestParam.sourceLocNo = this.controlData.targetLocNo;
- requestParam.distLocNo = this.controlData.targetLocNo;
- }else if (type == 'palletLift') {
- requestParam.shuttleTaskMode = 1;
- }else if (type == 'palletDown') {
- requestParam.shuttleTaskMode = 2;
- }else if (type == 'chargeOn') {
- requestParam.shuttleTaskMode = 15;
- }else if (type == 'chargeOff') {
- requestParam.shuttleTaskMode = 16;
- }else if (type == 'reset') {
- requestParam.shuttleTaskMode = 3;
- }else if (type == 'demoOn') {
- requestParam.shuttleTaskMode = 12;
- }else if (type == 'demoOff') {
- requestParam.shuttleTaskMode = 13;
- }else if (type == 'clearPath') {
- requestParam.shuttleTaskMode = 17;
- }else if (type == 'restartCalcPath') {
- requestParam.shuttleTaskMode = 18;
- }else if (type == 'writeTaskNo') {
- requestParam.workNo = this.controlData.taskNo;
- requestParam.pakMk = "Y";
-
- $.ajax({
- url: baseUrl + "/shuttle/detl/update",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: requestParam,
- success: function (res) {
- if (res.code === 200) {
- that.$message({
- message: res.msg,
- type: 'success'
- });
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- that.$message({
- message: res.msg,
- type: 'warning'
- });
- }
- }
- });
- return;
- }
-
- $.ajax({
- url: baseUrl + "/shuttle/operator/shuttle",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: requestParam,
- success: function (res) {
- if (res.code === 200) {
- that.$message({
- message: res.msg,
- type: 'success'
- });
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- that.$message({
- message: res.msg,
- type: 'warning'
- });
- }
- }
- });
- },
- changeControlShuttleNo() {
- let shuttleNo = this.controlData.shuttleNo;
- if (shuttleNo == null || shuttleNo == "") {
- this.controlShuttleInfo = null
- }
-
- this.shuttleAllList.forEach((item) => {
- if (item.shuttleNo == shuttleNo) {
- this.controlShuttleInfo = item;
- }
- });
- },
- websocketConnect() {
- if (this.ws == null) {
- this.ws = new WebSocket("ws://" + window.location.host + baseUrl + "/console/websocket");
- this.ws.onopen = this.webSocketOnOpen
- this.ws.onerror = this.webSocketOnError
- this.ws.onmessage = this.webSocketOnMessage
- this.ws.onclose = this.webSocketClose
- }
- },
- webSocketOnOpen(e) {
- console.log("open");
- },
- webSocketOnError(e) {
- this.ws = null;
- console.log(e);
- },
- webSocketOnMessage(e) {
- const result = JSON.parse(e.data);
- if (result.url == "/shuttle/table/shuttle/state") {
- this.setShuttleStateInfo(JSON.parse(result.data))
- }
- },
- webSocketClose(e) {
- this.ws = null;
- console.log("close");
- },
- sendWs(message) {
- if (this.ws == null) {
- return;
- }
-
- if (this.ws.readyState == WebSocket.OPEN) {
- this.ws.send(message);
- }
- }
- }
- })
-</script>
-</html>
\ No newline at end of file
diff --git a/src/main/webapp/views/shuttle_zs.html b/src/main/webapp/views/shuttle_zs.html
deleted file mode 100644
index 4ce44b2..0000000
--- a/src/main/webapp/views/shuttle_zs.html
+++ /dev/null
@@ -1,595 +0,0 @@
-<!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_wcs.css">
- <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
- <link rel="stylesheet" href="../static/css/shuttle.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: 5%;">
-<!-- <div data-shuttleNo="1" class="shuttle-command-item">-->
-<!-- <label>1#</label>-->
-<!-- <button class="demoBtn pos-btn">鏁版嵁缁存姢</button>-->
-<!-- <button id="mode-1" class="demoBtn mode-btn" >璁惧淇℃伅</button>-->
-<!-- </div>-->
- </div>
- <!-- 鍫嗗灈鏈虹姸鎬佷綅淇℃伅 -->
- <div class="shuttle-state" style="width: 95%;">
- <table id="shuttle-state-table">
- <thead>
- <tr>
- <th>鍥涘悜绌挎杞�</th>
- <th>浠诲姟鐘舵��</th>
- <th>灏忚溅鐘舵��</th>
- <th>褰撳墠浜岀淮鐮�</th>
- <th>鐢甸噺</th>
- <th>鐢垫睜娓╁害</th>
- <th>閿欒缂栧彿</th>
- <th>plc杈撳嚭鐘舵�両O-椤跺崌浣�</th>
- <th>plc杈撳嚭鐘舵�両O-鎹㈠悜浣�</th>
- <th>plc杈撳嚭鐘舵�両O-鎶遍椄浣�</th>
- <th>plc杈撳嚭鐘舵�両O-鍏呯數浣�</th>
- <th>閿欒淇℃伅鐮�</th>
- <th>plc杈撳叆鐘舵��(鍏夌數鏈夌墿)</th>
- <th>褰撳墠鎴栦箣鍓嶄簩缁寸爜</th>
- <th>x鍋忕Щ閲�</th>
- <th>y鍋忕Щ閲�</th>
- <th>鐢靛帇</th>
- <th>妯℃嫙閲�</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- </div>
- <!-- 绌挎杞︾姸鎬� -->
- <div class="shuttle-msg">
- <table id="shuttle-msg-table">
- <thead>
- <tr>
- <th>鍥涘悜绌挎杞�</th>
- <th>宸ヤ綔鍙�</th>
- <th>鐘舵��</th>
- <th>婧愬簱浣�</th>
- <th>鐩爣搴撲綅</th>
- <th>鍗囬檷浼烘湇閫熷害</th>
- <th>琛岃蛋浼烘湇閫熷害</th>
- <th>鍗囬檷浼烘湇璐熻浇</th>
- <th>琛岃蛋浼烘湇璐熻浇</th>
- <th>浣滀笟鏍囪</th>
- <th>搴撲綅鍙�</th>
- <th>褰撳墠妤煎眰</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
- <!-- 鎵嬪姩鎿嶄綔 -->
- <div class="shuttle-operation">
- <!-- 閬僵灞� -->
- <div class="shuttle-operation-shade">
- <span class="shuttle-operation-shade-span">
- WCS 绯荤粺杩愯涓紝璇峰仠姝㈠悗鎿嶄綔
- </span>
- </div>
- <!-- 璁惧浠诲姟閫夋嫨 -->
- <div class="task-select">
- <!-- 閫夋嫨 -->
- <div id="shuttle-select" class="operator-item">
- <span class="select-title">鍥涘悜绌挎杞﹀彿</span>
- <div class="select-container" id="shuttleRadioBoxId">
-<!-- <label><input type="radio" name="shuttleSelect" value="1" checked> 1鍙风┛姊溅</label>-->
- </div>
- </div>
- </div>
-
- <!-- 璁惧浠诲姟鎿嶄綔 -->
- <div class="task-operator">
- <fieldset style="height: auto;padding-bottom: 20px;">
- <legend>鎵嬪姩鎿嶄綔</legend>
- <div style="display: flex;">
- <div style="width: 30%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">婧愬簱浣�/鐩爣搴撲綅</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 20px 10px;">
- <div class="select-container-item">
- <span>婧愬簱浣�</span>
- <label><input id="sourceLocNo" type="text" name="sourceLocNo" /></label>
- </div>
- <div class="select-container-item">
- <span>鐩爣搴撲綅</span>
- <label><input id="distLocNo" type="text" name="distLocNo" /></label>
- </div>
-
- <div style="margin-top: 10px;">
- <button class="item" onclick="shuttleOperator(1)">鍏ュ簱</button>
- <button class="item" onclick="shuttleOperator(2)">鍑哄簱</button>
- <button class="item" onclick="shuttleOperator(14)">绉诲姩鍒扮洰鏍囧簱浣�</button>
- <button class="item" onclick="shuttleOperator(16)">绉诲姩鍒版彁鍗囨満</button>
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 40%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">鐩稿叧鎸囦护</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 10px 10px;">
- <div class="button-group">
- <button class="item" onclick="shuttleOperator(3)">鎵樼洏椤跺崌</button>
- <button class="item" onclick="shuttleOperator(4)">鎵樼洏涓嬮檷</button>
- <button class="item" onclick="shuttleOperator(5)">宸︾Щ</button>
- <button class="item" onclick="shuttleOperator(6)">鍙崇Щ</button>
- <button class="item" onclick="shuttleOperator(7)">鍚庣Щ</button>
- <button class="item" onclick="shuttleOperator(8)">鍓嶇Щ</button>
- <button class="item" onclick="shuttleOperator(9)">澶嶄綅</button>
- <button class="item" onclick="shuttleOperator(10)">姝f柟鍚�(鍙�)瀵诲簱浣�</button>
- <button class="item" onclick="shuttleOperator(11)">璐熸柟鍚�(宸�)瀵诲簱浣�</button>
- <button class="item" onclick="shuttleOperator(12)">姝f柟鍚�(鍓�)瀵诲簱浣�</button>
- <button class="item" onclick="shuttleOperator(13)">璐熸柟鍚�(鍚�)瀵诲簱浣�</button>
- <button class="item" onclick="shuttleOperator(15)">鍏呯數寮�鍏�</button>
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 20%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">璁剧疆閰嶇疆鍙傛暟</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 10px 10px;">
- <div class="select-container-item">
- <span>杩愯閫熷害</span>
- <label><input id="runSpeed" type="text" name="runSpeed" /></label>
- </div>
- <div class="select-container-item">
- <span>鍏呯數闃堝��</span>
- <label><input id="chargeLine" type="text" name="runSpeed" /></label>
- </div>
-
- <div>
- <button class="item" onclick="shuttleParamSave()">淇濆瓨</button>
- </div>
- </div>
- </div>
- </div>
-
- <div style="width: 15%;">
- <div class="operator-item" style="height: auto;width: 100%;">
- <span class="select-title">閰嶇疆鍙傛暟</span>
- <div class="select-container" style="height: auto;padding: 30px 10px 10px 10px;">
- <div>杩愯閫熷害锛�<span id="runSpeedText"></span></div>
- <div>鍏呯數闃堝�硷細<span id="chargeLineText"></span></div>
- </div>
- </div>
- </div>
- </div>
- </fieldset>
- </div>
-
- </div>
- <!-- 绌挎杞︽棩蹇楄緭鍑� -->
- <div class="shuttle-output-board">
- <textarea id="shuttle-output"></textarea>
- </div>
- </div>
- </div>
-
- <div id="shuttle-detl" style="display: none">
- <div>
- <div class="form-item">
- <label class="form-label">绌挎杞﹀彿:</label>
- <div class="form-input">
- <input id="shuttleNo" name="shuttleNo" 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>
-</body>
-</html>
-<script>
- // 绌虹櫧琛屾暟
- var shuttleStateTableBlankRows = 0;
- var shuttleMsgTableBlankRows = 0;
- // 瀹為檯琛屾暟
- var shuttleStateTableFullRows = 0;
- var shuttleMsgTableFullRows = 0;
- // 鍒濆鍖�
- var shuttleOutputDom = document.getElementById("shuttle-output");
- $(document).ready(function() {
- initShuttleStateTable();
- getShuttleStateInfo();
- initShuttleMsgTable();
- getShuttleMsgInfo();
- operatorBlockShow();
- setShuttleRadio();
- });
-
- setInterval(function () {
- getShuttleStateInfo()
- getShuttleMsgInfo();
- },1000)
- setInterval(function () {
- getShuttleOutput();
- operatorBlockShow();
- },500);
-
- // 鍒ゆ柇鎵嬪姩鎿嶄綔妯″潡鏄惁鍙敤
- function operatorBlockShow() {
- if (parent.systemRunning) {
- $('.shuttle-operation').css("opacity", "0.5");
- $('.shuttle-operation-shade').show();
- $('.shuttle-operation-shade-span').show();
- } else {
- $('.shuttle-operation').css("opacity", "1");
- $('.shuttle-operation-shade').hide();
- $('.shuttle-operation-shade-span').hide();
- }
- }
-
- function getColor(res,e){
- $(e).val(res?"鉁�":"鈥�");
- if (res){
- $(e).attr("style", "color: #FD482C;");
- }else {
- $(e).attr("style", "color: #00FF00;");
- }
- }
-
- $(document).on('click ','#save', function () {
- http.post(baseUrl+ "/shuttle/detl/update", {
- shuttleNo: $('#shuttleNo').val(),
- workNo: $('#workNo').val(),
- pakMk: $('#pakMk').val(),
- }, function (res) {
- layer.msg("淇敼鎴愬姛", {icon: 1,});
- layer.close(layerIdx);
- })
- })
-
- function setShuttleRadio() {
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/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 shuttleRadioBox = '<label><input type="radio" name="shuttleSelect" ';
- if (i === 1) {
- shuttleRadioBox += 'checked '
- }
- shuttleRadioBox += 'value="' + table[i - 1].shuttleNo + '"> ' + table[i - 1].shuttleNo + '鍙风┛姊溅</label>'
- $("#shuttleRadioBoxId").append(shuttleRadioBox)
-
-
- //娓叉煋鍥涘悜绌挎杞︽暟鎹淮鎶ゅ拰璁惧淇℃伅html
- let shuttleCommandLogBox = '<div class="shuttle-command-item" data-shuttleNo="' + table[i - 1].shuttleNo + '">\n' +
- '<label>' + table[i - 1].shuttleNo + '#</label>\n' +
- // '<button class="demoBtn pos-btn">鏁版嵁缁存姢</button>\n' +
- // '<button class="demoBtn mode-btn" id="mode-' + table[i - 1].shuttleNo + '">璁惧淇℃伅</button>\n' +
- '</div>'
- $("#commandLogId").append(shuttleCommandLogBox);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ---- 琛ㄤ竴
- function getShuttleStateInfo() {
- let tableEl = $('#shuttle-state-table');
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/state",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- success: function (res) {
- if (res.code === 200){
- let table = res.data;
- if (table.length > shuttleStateTableBlankRows && table.length !== shuttleStateTableFullRows) {
- initShuttleStateTable(table.length-shuttleStateTableBlankRows);
- shuttleStateTableFullRows = table.length;
- }
- for (let i=1;i<=table.length;i++){
- // $("#mode-"+table[i-1].shuttleNo).html(table[i-1].statusVal===0?'鑱旀満':'鑴辨満');
- let tr = tableEl.find("tr").eq(i);
- setVal(tr.children("td").eq(0), table[i-1].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].status$);
- setVal(tr.children("td").eq(2), table[i-1].busyStatus);
- setVal(tr.children("td").eq(3), table[i-1].currentCode);
- setVal(tr.children("td").eq(4), table[i-1].batteryPower);
- setVal(tr.children("td").eq(5), table[i-1].batteryTemp);
- setVal(tr.children("td").eq(6), table[i-1].errorCode);
- setVal(tr.children("td").eq(7), table[i-1].plcOutputLift$);//椤跺崌浣�
- setVal(tr.children("td").eq(8), table[i-1].plcOutputTransfer$);//鎹㈠悜浣�
- setVal(tr.children("td").eq(9), table[i-1].plcOutputBrake$);//鎶遍椄浣�
- setVal(tr.children("td").eq(10), table[i-1].plcOutputCharge$);//鍏呯數浣�
- setVal(tr.children("td").eq(11), table[i-1].statusErrorCode);
- setVal(tr.children("td").eq(12), table[i-1].plcInputStatus);
- setVal(tr.children("td").eq(13), table[i-1].currentOrBeforeCode);
- setVal(tr.children("td").eq(14), table[i-1].codeOffsetX);
- setVal(tr.children("td").eq(15), table[i-1].codeOffsetY);
- setVal(tr.children("td").eq(16), table[i-1].currentVoltage$);
- setVal(tr.children("td").eq(17), table[i-1].currentAnalogValue);
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 鍥涘悜绌挎杞︽暟鎹〃鑾峰彇 ---- 琛ㄤ簩
- function getShuttleMsgInfo() {
- let tableEl = $('#shuttle-msg-table');
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/msg",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- success: function (res) {
- if (res.code === 200){
- var table = res.data;
- if (table.length > shuttleMsgTableBlankRows && table.length !== shuttleMsgTableFullRows) {
- initShuttleMsgTable(table.length-shuttleMsgTableBlankRows);
- shuttleMsgTableFullRows = 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].shuttleNo);
- setVal(tr.children("td").eq(1), table[i-1].workNo);
- setVal(tr.children("td").eq(2), table[i-1].status);
- setVal(tr.children("td").eq(3), table[i-1].sourceLocNo);
- setVal(tr.children("td").eq(4), table[i-1].distLocNo);
- setVal(tr.children("td").eq(5), table[i-1].currentLiftServoSpeed);
- setVal(tr.children("td").eq(6), table[i-1].currentMoveServoSpeed);
- setVal(tr.children("td").eq(7), table[i-1].currentLiftServoLoad);
- setVal(tr.children("td").eq(8), table[i-1].currentMoveServoLoad);
- setVal(tr.children("td").eq(9), table[i-1].pakMk);
- setVal(tr.children("td").eq(10), table[i-1].locNo);
- setVal(tr.children("td").eq(11), table[i-1].lev);
-
- if (table[i-1].shuttleNo == parseInt($('input[name="shuttleSelect"]:checked').val())) {
- $("#runSpeedText").text(table[i-1].runSpeed)
- $("#chargeLineText").text(table[i-1].chargeLine + "%")
- }
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 绌挎杞︽棩蹇楄緭鍑� -----------------------------------------------------------------------
- function getShuttleOutput() {
- $.ajax({
- url: baseUrl + "/shuttle/output/shuttle",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- success: function (res) {
- if (res.code === 200) {
- shuttleOutput(res.data);
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- console.log(res.msg);
- }
- }
- })
- }
-
- // 浠诲姟鎸囦护涓嬪彂
- function shuttleOperator(shuttleTaskMode) {
- http.post(baseUrl+"/shuttle/operator/shuttle", {
- shuttleNo: $('input[name="shuttleSelect"]:checked').val(),
- shuttleTaskMode: shuttleTaskMode,
- sourceLocNo: $("#sourceLocNo").val(),
- distLocNo: $("#distLocNo").val()
- }, function (res) {
- layer.msg(res.msg, {icon: 1});
- });
- }
-
-
- // ------------------------------------------------------------------------------------------------
-
- // 鍥涘悜绌挎杞︿俊鎭〃鑾峰彇 ----- 琛ㄤ竴
- function initShuttleStateTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-state-table thead').height();
- let total = $('.shuttle-state').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleStateTableBlankRows = 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" +
- " <td></td>\n" +
- " </tr>\n";
- }
- $('#shuttle-state-table tbody').after(html);
- }
-
- // 绌挎杞︽暟鎹〃鑾峰彇 ----- 琛ㄤ簩
- function initShuttleMsgTable(row) {
- let line;
- if (row === undefined){
- let one = $('#shuttle-msg-table thead').height();
- let total = $('.shuttle-msg').height();
- let count = total / one;
- count = parseInt(count) - 1;
- shuttleMsgTableBlankRows = 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";
- }
- $('#shuttle-msg-table tbody').after(html);
- }
-
- // 鏃ュ織杈撳嚭妗�
- function shuttleOutput(content){
- shuttleOutputDom.value += content;
- shuttleOutputDom.scrollTop = shuttleOutputDom.scrollHeight;
- }
-
- //鍥涘悜绌挎杞﹂厤缃弬鏁颁繚瀛�
- function shuttleParamSave() {
- $.ajax({
- url: baseUrl+ "/shuttle/runSpeed/" + $('input[name="shuttleSelect"]:checked').val(),
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- runSpeed: $("#runSpeed").val(),
- chargeLine: $("#chargeLine").val(),
- },
- success: function (res) {
- if (res.code === 200){
- layer.msg("閰嶇疆宸蹭繚瀛�", {icon: 1,});
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- }
-
- // 璇︽儏鎿嶄綔 -------------------------------------------------------------------------
- var layerDetl;
- $(document).on('dblclick ','#shuttle-msg-table tr', function () {
- var shuttleNo = $(this).children("td").eq(0).html();
- if (shuttleNo !== null && shuttleNo !== "") {
- layerDetl = layer.open({
- type: 1,
- title: false,
- shadeClose: true,
- offset: 'rt',
- anim: 5,
- shade: [0],
- area: ['340px', '255px'],
- closeBtn: 0,
- content: $("#shuttle-detl"),
- success: function(layero, index){
- $.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/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 (shuttleNo == table[i-1].shuttleNo) {
- $('#shuttleNo').val(shuttleNo);
- $('#workNo').val(table[i-1].workNo);
- $('#pakMk').val(table[i-1].pakMk);
- }
- }
- } else if (res.code === 403){
- window.location.href = baseUrl+"/login";
- } else {
- console.log(res.msg);
- }
- }
- });
- },
- end: function () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- }
- })
- }
- });
-
- $(document).on('click ','#cancel', function () {
- $('#shuttleNo').val("");
- $('#workNo').val("");
- $('#pakMk').val("");
- layer.close(layerDetl);
- })
-
-
-</script>
diff --git a/src/main/webapp/views/trafficControl.html b/src/main/webapp/views/trafficControl.html
deleted file mode 100644
index 2d7670d..0000000
--- a/src/main/webapp/views/trafficControl.html
+++ /dev/null
@@ -1,211 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>浜ら�氱鍒剁洃鎺т腑蹇�</title>
- <link rel="stylesheet" href="../static/vue/element/element.css">
- <link rel="stylesheet" href="../static/css/shuttle_page.min.css">
- <script src="../static/js/shuttle_page.js"></script>
- <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
- <script type="text/javascript" src="../static/js/common.js"></script>
- <script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
- <script type="text/javascript" src="../static/vue/element/element.js"></script>
- <style>
- body {
- font-family: 'Noto Sans SC', sans-serif;
- background-color: #0f172a;
- color: #e2e8f0;
- }
- .card {
- background-color: #1e293b;
- border-radius: 0.75rem;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- transition: all 0.3s ease;
- }
- /*.card:hover {*/
- /* transform: translateY(-2px);*/
- /* box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2);*/
- /*}*/
- .btn {
- background-color: #3b82f6;
- color: white;
- border-radius: 0.5rem;
- padding: 0.5rem 1rem;
- transition: all 0.3s ease;
- }
- .btn:hover {
- background-color: #2563eb;
- transform: translateY(-1px);
- }
- .status-active {
- color: #4ade80;
- }
- .status-inactive {
- color: #f87171;
- }
- .progress-bar {
- height: 0.75rem;
- border-radius: 0.375rem;
- background-color: #334155;
- }
- .progress-fill {
- height: 100%;
- border-radius: 0.375rem;
- background-color: #4ade80;
- transition: width 0.5s ease;
- }
- .table-striped tbody tr:nth-child(odd) {
- background-color: #1e293b;
- }
- .table-striped tbody tr:nth-child(even) {
- background-color: #1a2537;
- }
- </style>
-</head>
-<body class="min-h-screen">
- <div id="app">
- <div class="container mx-auto px-4 py-8">
- <!-- 椤堕儴鏍囬鍜岀姸鎬佹爮 -->
- <div class="flex flex-col md:flex-row justify-between items-center mb-8">
- <h1 class="text-3xl font-bold text-blue-400 mb-4 md:mb-0">
- <i class="fas fa-robot mr-2"></i>浜ら�氱鍒剁洃鎺т腑蹇�
- </h1>
- </div>
-
- <!-- 鎿嶄綔鎺у埗鍖哄煙 -->
- <div class="card p-6 mb-8">
- <h2 class="text-xl font-semibold text-blue-300 mb-4">
- <i class="fas fa-sliders-h mr-2"></i>淇℃伅
- </h2>
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-2">
- <div v-for="(item) in controlList" class="bg-slate-700 p-4 rounded-lg">
- <div class="gap-2">
- <div class="p-2">
- <button class="btn bg-slate-600 hover:bg-slate-500" @click="cancelTraffic(item)">
- <i class="fas fa-home mr-1"></i>鐢宠鍙栨秷
- </button>
- </div>
- <div class="p-2">
- 杞﹁締缂栧彿锛歿{ item.shuttleNo }}
- </div>
- <div class="p-2">
- 浠诲姟鍙凤細{{ item.taskNo }}
- </div>
- <div class="p-2">
- 浠诲姟鏄惁瀛樺湪锛歿{ item.taskExist }}
- </div>
- <div class="p-2">
- 褰撳墠琛岄┒鑺傜偣锛歿{ item.nodeList }}
- </div>
- <div class="p-2">
- 鎬昏妭鐐癸細{{ item.totalNodeList }}
- </div>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
-</body>
-
-<script>
- var app = new Vue({
- el: '#app',
- data: {
- ws: null,
- controlList: []
- },
- created() {
- this.init()
- },
- watch: {
-
- },
- methods: {
- init() {
- this.consoleInterval = setInterval(() => {
- this.getTrafficControlInfos()
- }, 1000)
- },
- getTrafficControlInfos() {
- let that = this;
- $.ajax({
- url: baseUrl + "/trafficControl/getTrafficControlInfos",
- headers: {'token': localStorage.getItem('token')},
- method: 'GET',
- data: {},
- success: function (res) {
- if (res.code === 200) {
- let list = []
- res.data.forEach((item) => {
- let nodeList = []
- item.nodeList.forEach((nodeItem) => {
- let tmp = {
- x: nodeItem.x,
- y: nodeItem.y,
- z: nodeItem.z
- }
- nodeList.push(tmp)
- })
-
- let totalNodeList = []
- item.totalNodeList.forEach((nodeItem) => {
- let tmp = {
- x: nodeItem.x,
- y: nodeItem.y,
- z: nodeItem.z
- }
- totalNodeList.push(tmp)
- })
-
- item.nodeList = nodeList;
- item.totalNodeList = totalNodeList;
-
- list.push(item)
- })
-
- that.controlList = list;
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- that.$message({
- message: res.msg,
- type: 'warning'
- });
- }
- }
- });
- },
- cancelTraffic(item) {
- let that = this;
- $.ajax({
- url: baseUrl + "/trafficControl/cancelTraffic",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- data: {
- shuttleNo: item.shuttleNo,
- taskNo: item.taskNo
- },
- success: function (res) {
- if (res.code === 200) {
- that.$message({
- message: res.msg,
- type: 'success'
- });
- } else if (res.code === 403) {
- window.location.href = baseUrl + "/login";
- } else {
- that.$message({
- message: res.msg,
- type: 'warning'
- });
- }
- }
- });
- }
- }
- })
-</script>
-</html>
\ No newline at end of file
--
Gitblit v1.9.1