From 84a9e3a9a624526116b42ab15e27ec852eaa7c21 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 27 七月 2023 14:02:41 +0800
Subject: [PATCH] Shuttle Base Data
---
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java | 2
src/main/java/com/zy/asrs/entity/BasShuttle.java | 369 +++++-
src/main/webapp/views/shuttle_zs.html | 595 ++++++++++++
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 24
src/main/java/com/zy/core/thread/ShuttleThread.java | 122 +-
src/main/resources/mapper/BasShuttleMapper.xml | 58
src/main/java/com/zy/common/utils/NavigatePositionConvert.java | 7
src/main/java/com/zy/core/ServerBootstrap.java | 2
src/main/java/com/zy/core/enums/ShuttleStatusType.java | 13
src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java | 431 +++++++++
src/main/webapp/static/readStatus.json | 58 +
src/main/java/com/zy/asrs/controller/ShuttleController.java | 133 --
src/main/java/com/zy/common/utils/NyHttpUtils.java | 17
src/main/java/com/zy/core/thread/NyShuttleThread.java | 815 +++++++++++++++++
src/main/java/com/zy/core/MainProcess.java | 20
src/main/webapp/views/shuttle.html | 101 -
16 files changed, 2,388 insertions(+), 379 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java
index 035c9f6..1614b21 100644
--- a/src/main/java/com/zy/asrs/controller/ShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -10,14 +10,12 @@
import com.zy.asrs.domain.param.ShuttleOperatorParam;
import com.zy.asrs.domain.vo.*;
import com.zy.asrs.entity.BasShuttle;
-import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.service.CommonService;
-import com.zy.common.utils.NavigatePositionConvert;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
@@ -28,8 +26,10 @@
import com.zy.core.model.command.ShuttleAssignCommand;
import com.zy.core.model.command.ShuttleCommand;
import com.zy.core.model.command.ShuttleRedisCommand;
+import com.zy.core.model.protocol.NyShuttleProtocol;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.NyShuttleThread;
import com.zy.core.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,73 +61,20 @@
@PostMapping("/table/shuttle/state")
@ManagerAuth(memo = "鍥涘悜绌挎杞︿俊鎭〃")
- public R steStateTable(){
- List<ShuttleStateTableVo> list = new ArrayList<>();
+ public R shuttleStateTable(){
+ ArrayList<NyShuttleProtocol> list = new ArrayList<>();
List<BasShuttle> shuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().orderBy("shuttle_no"));
for (BasShuttle basShuttle : shuttles) {
- // 琛ㄦ牸琛�
- ShuttleStateTableVo vo = new ShuttleStateTableVo();
- vo.setShuttleNo(basShuttle.getShuttleNo()); //鍥涘悜绌挎杞﹀彿
- list.add(vo);
// 鑾峰彇鍥涘悜绌挎杞︿俊鎭�
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, basShuttle.getShuttleNo());
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, basShuttle.getShuttleNo());
if (shuttleThread == null) {
- vo.setStatus(ShuttleProtocolStatusType.OFFLINE.id);//璁惧绂荤嚎
- vo.setBusyStatus(ShuttleProtocolStatusType.OFFLINE.desc);
continue;
}
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) {
continue;
}
- vo.setTaskNo(shuttleProtocol.getTaskNo().intValue()); // 浠诲姟鍙�
- vo.setBusyStatus(shuttleProtocol.getBusyStatusType().desc); //鍥涘悜绌挎杞︾姸鎬�
- vo.setStatus(shuttleProtocol.getProtocolStatusType().id);//褰撳墠浠诲姟鐘舵��
- vo.setCurrentCode(shuttleProtocol.getCurrentCode());//褰撳墠浜岀淮鐮�
- LocMast currentLocMast = locMastService.queryByQrCode(shuttleProtocol.getCurrentCode().toString());
- if (currentLocMast == null) {
- vo.setLocNo("");//鑾峰彇褰撳墠搴撲綅鍙�
- vo.setLocNoX(0);
- vo.setLocNoY(0);
- vo.setLocNoLev(0);//褰撳墠搴撲綅灞傞珮
- }else {
- vo.setLocNo(currentLocMast.getLocNo());//鑾峰彇褰撳墠搴撲綅鍙�
- int[] locNoXY = NavigatePositionConvert.positionToXY(currentLocMast.getLocNo());//鑾峰彇搴撲綅鍙稾Y鍧愭爣
- vo.setLocNoX(locNoXY[0]);
- vo.setLocNoY(locNoXY[1]);
- vo.setLocNoLev(Utils.getLev(currentLocMast.getLocNo()));//褰撳墠搴撲綅灞傞珮
- }
- vo.setBatteryPower(shuttleProtocol.getBatteryPower$() == null ? "" : shuttleProtocol.getBatteryPower$() + "%");//鐢垫睜鐢甸噺
- vo.setBatteryTemp(shuttleProtocol.getBatteryTemp$() == null ? "" : shuttleProtocol.getBatteryTemp$() + "掳");//鐢垫睜娓╁害
- if (!Cools.isEmpty(shuttleProtocol.getErrorCode())) {
- vo.setErrorCode(shuttleProtocol.getErrorCodeType());//閿欒缂栧彿
- }
- vo.setPlcOutputStatusIO(shuttleProtocol.getPlcOutputStatusIO());//Plc杈撳嚭鐘舵�両O
- if (!Cools.isEmpty(shuttleProtocol.getPlcOutputLift())) {
- vo.setPlcOutputLift(shuttleProtocol.getPlcOutputLift());
- }
- if (!Cools.isEmpty(shuttleProtocol.getPlcOutputTransfer())) {
- vo.setPlcOutputTransfer(shuttleProtocol.getPlcOutputTransfer());
- }
- if (!Cools.isEmpty(shuttleProtocol.getPlcOutputBrake())) {
- vo.setPlcOutputBrake(shuttleProtocol.getPlcOutputBrake());
- }
- if (!Cools.isEmpty(shuttleProtocol.getPlcOutputCharge())) {
- vo.setPlcOutputCharge(shuttleProtocol.getPlcOutputCharge());
- }
- if (!Cools.isEmpty(shuttleProtocol.getStatusErrorCode())) {
- vo.setStatusErrorCode(shuttleProtocol.getStatusErrorCode$());//閿欒淇℃伅鐮�
- }
- vo.setPlcInputStatus(shuttleProtocol.getPlcInputStatus());//PLC杈撳叆鐘舵��
- vo.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode());//褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
- vo.setCodeOffsetX(shuttleProtocol.getCodeOffsetX());//璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
- vo.setCodeOffsetY(shuttleProtocol.getCodeOffsetY());//璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
- vo.setCurrentVoltage(shuttleProtocol.getCurrentVoltage());//褰撳墠鐨勭數鍘嬪��
- vo.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue());//褰撳墠鐨勬ā鎷熼噺鍊�
- vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
- vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//褰撳墠鐨勮璧颁己鏈嶉�熷害
- vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad());//褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
- vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad());//褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+ list.add(shuttleProtocol);
}
return R.ok().add(list);
}
@@ -177,7 +124,7 @@
vo.setPakMk(shuttleProtocol.getPakMk()?"Y" : "N"); // 浣滀笟鏍囪
vo.setLocNo(shuttleProtocol.getLocNo());//鍥涘悜绌挎杞﹀綋鍓嶅簱浣嶅彿
vo.setLev(shuttleProtocol.getLocNo() == null ? 0 : Utils.getLev(shuttleProtocol.getLocNo()));//鍥涘悜绌挎杞﹀綋鍓嶅眰楂�
- vo.setRunSpeed(basShuttle.getRunSpeed());//鍥涘悜绌挎杞﹁繍琛岄�熷害(璁剧疆)
+// vo.setRunSpeed(basShuttle.getRunSpeed());//鍥涘悜绌挎杞﹁繍琛岄�熷害(璁剧疆)
vo.setChargeLine(basShuttle.getChargeLine());//鍏呯數闃堝��
}
return R.ok().add(list);
@@ -200,51 +147,6 @@
i++;
}
return R.ok().add(str.toString());
- }
-
- @GetMapping("/detl/{shuttleNo}")
- public R steDetl(@PathVariable("shuttleNo") Integer shuttleNo){
- ShuttleDataVo vo = new ShuttleDataVo();
- for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
- if (shuttleNo.equals(shuttleSlave.getId())) {
- vo.setShuttleNo(shuttleSlave.getId());
- BasShuttle basShuttle = basShuttleService.selectById(shuttleSlave.getId());
- if (!Cools.isEmpty(basShuttle)) {
- vo.setWorkNo(basShuttle.getWrkNo());
- vo.setPakMk(basShuttle.getPakMk());
- }
- break;
- }
- }
- return R.ok().add(vo);
- }
-
- @GetMapping("/sensor/detl/{shuttleNo}")
- public R shuttleSensorDetl(@PathVariable("shuttleNo") Integer shuttleNo){
- ShuttleSensorDataVo vo = new ShuttleSensorDataVo();
- for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
- if (shuttleNo.equals(shuttleSlave.getId())) {
- vo.setShuttleNo(shuttleSlave.getId());
- // 鑾峰彇绌挎杞︿俊鎭�
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
- if (shuttleThread == null) {
- return R.error("璁惧涓嶅湪绾�");
- }
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
- if (shuttleProtocol == null) {
- return R.error("璁惧涓嶅湪绾�");
- }
-
- // 绌挎杞﹀紓甯� -----------
-
- // 绌挎杞︽彁绀轰俊鎭� ----------------------
-
- // 鐘舵�佷俊鎭� -------------
-
- break;
- }
- }
- return R.ok().add(vo);
}
@RequestMapping(value = "/command/query")
@@ -298,11 +200,11 @@
}
ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
Short shuttleNo = redisCommand.getShuttleNo();
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo.intValue());
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo.intValue());
if (shuttleThread == null) {
return R.error();
}
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
if (shuttleProtocol == null) {
return R.error();
}
@@ -310,7 +212,7 @@
return R.error();
}
//鍥涘悜绌挎杞﹀浜庣┖闂茬姸鎬侊紝杩涜浠诲姟鐨勬仮澶�
- shuttleProtocol.setTaskNo(redisCommand.getWrkNo());//灏嗗洓鍚戠┛姊溅绾跨▼鍒嗛厤浠诲姟鍙�
+ shuttleProtocol.setTaskNo(redisCommand.getWrkNo().intValue());//灏嗗洓鍚戠┛姊溅绾跨▼鍒嗛厤浠诲姟鍙�
shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WORKING);//宸ヤ綔鐘舵��
return R.ok();
}
@@ -349,11 +251,11 @@
for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
if (param.getShuttleNo().equals(shuttleSlave.getId())) {
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());
if (shuttleThread == null) {
throw new CoolException("鍥涘悜绌挎杞︿笉鍦ㄧ嚎");
}
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
if (shuttleProtocol == null) {
throw new CoolException("鍥涘悜绌挎杞︿笉鍦ㄧ嚎");
}
@@ -377,13 +279,13 @@
@PostMapping("/detl/update")
@ManagerAuth(memo = "淇敼鏁版嵁")
public R shuttleUpdate(@RequestParam Integer shuttleNo,
- @RequestParam Short workNo,
+ @RequestParam Integer workNo,
@RequestParam String pakMk){
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
if (shuttleThread == null) {
return R.error("plc宸叉帀绾�");
}
- ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
if (shuttleProtocol == null) {
return R.error("plc宸叉帀绾�");
}
@@ -399,12 +301,11 @@
@PostMapping("/runSpeed/{shuttleNo}")
@ManagerAuth
public R setRunSpeed(@PathVariable("shuttleNo") String shuttleNo, @RequestParam("runSpeed") Integer runSpeed, @RequestParam("chargeLine") Integer chargeLine) {
-
BasShuttle basShuttle = basShuttleService.selectById(shuttleNo);
if (basShuttle == null) {
return R.error("鍥涘悜绌挎杞︿笉瀛樺湪");
}
- basShuttle.setRunSpeed(runSpeed);
+// basShuttle.setRunSpeed(runSpeed);
basShuttle.setChargeLine(chargeLine);
if (!basShuttleService.updateById(basShuttle)) {
return R.error();
diff --git a/src/main/java/com/zy/asrs/entity/BasShuttle.java b/src/main/java/com/zy/asrs/entity/BasShuttle.java
index 62f83ef..06ef802 100644
--- a/src/main/java/com/zy/asrs/entity/BasShuttle.java
+++ b/src/main/java/com/zy/asrs/entity/BasShuttle.java
@@ -125,135 +125,296 @@
@TableField("pak_mk")
private Boolean pakMk;
- /**
- * 灏忚溅蹇欑姸鎬佷綅
- */
- @ApiModelProperty(value= "灏忚溅蹇欑姸鎬佷綅")
- @TableField("busy_status")
- private Integer busyStatus;
+// /**
+// * 灏忚溅蹇欑姸鎬佷綅
+// */
+// @ApiModelProperty(value= "灏忚溅蹇欑姸鎬佷綅")
+//// @TableField("busy_status")
+// private Integer busyStatus;
+//
+// /**
+// * 褰撳墠浜岀淮鐮�
+// */
+// @ApiModelProperty(value= "褰撳墠浜岀淮鐮�")
+//// @TableField("current_code")
+// private Integer currentCode;
+//
+// /**
+// * 鐢垫睜鐢甸噺鐧惧垎姣�
+// */
+// @ApiModelProperty(value= "鐢垫睜鐢甸噺鐧惧垎姣�")
+//// @TableField("battery_power")
+// private Integer batteryPower;
+//
+// /**
+// * 鐢垫睜娓╁害
+// */
+// @ApiModelProperty(value= "鐢垫睜娓╁害")
+//// @TableField("battery_temp")
+// private Integer batteryTemp;
+//
+// /**
+// * 閿欒缂栧彿
+// */
+// @ApiModelProperty(value= "閿欒缂栧彿")
+//// @TableField("error_code")
+// private Integer errorCode;
+//
+// /**
+// * Plc杈撳嚭鐘舵�両O
+// */
+// @ApiModelProperty(value= "Plc杈撳嚭鐘舵�両O")
+//// @TableField("plc_output_status_io")
+// private Integer plcOutputStatusIo;
+//
+// /**
+// * 閿欒淇℃伅鐮�
+// */
+// @ApiModelProperty(value= "閿欒淇℃伅鐮�")
+//// @TableField("status_error_code")
+// private Integer statusErrorCode;
+//
+// /**
+// * PLC杈撳叆鐘舵��
+// */
+// @ApiModelProperty(value= "PLC杈撳叆鐘舵��")
+//// @TableField("plc_input_status")
+// private Integer plcInputStatus;
+//
+// /**
+// * 褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+// */
+// @ApiModelProperty(value= "褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��")
+//// @TableField("current_or_before_code")
+// private Integer currentOrBeforeCode;
+//
+// /**
+// * 璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+// */
+// @ApiModelProperty(value= "璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�")
+//// @TableField("code_offset_x")
+// private Integer codeOffsetX;
+//
+// /**
+// * 璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+// */
+// @ApiModelProperty(value= "璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�")
+//// @TableField("code_offset_y")
+// private Integer codeOffsetY;
+//
+// /**
+// * 褰撳墠鐨勭數鍘嬪��
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勭數鍘嬪��")
+//// @TableField("current_voltage")
+// private Integer currentVoltage;
+//
+// /**
+// * 褰撳墠鐨勬ā鎷熼噺鍊�
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勬ā鎷熼噺鍊�")
+//// @TableField("current_analog_value")
+// private Integer currentAnalogValue;
+//
+// /**
+// * 褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勫崌闄嶄己鏈嶉�熷害")
+//// @TableField("current_lift_servo_speed")
+// private Integer currentLiftServoSpeed;
+//
+// /**
+// * 褰撳墠鐨勮璧颁己鏈嶉�熷害
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勮璧颁己鏈嶉�熷害")
+//// @TableField("current_move_servo_speed")
+// private Integer currentMoveServoSpeed;
+//
+// /**
+// * 褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼")
+//// @TableField("current_lift_servo_load")
+// private Integer currentLiftServoLoad;
+//
+// /**
+// * 褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+// */
+// @ApiModelProperty(value= "褰撳墠鐨勮璧颁己鏈嶈礋杞界巼")
+//// @TableField("current_move_servo_load")
+// private Integer currentMoveServoLoad;
+//
+// /**
+// * 灏忚溅杩愯閫熷害
+// */
+// @ApiModelProperty(value= "灏忚溅杩愯閫熷害")
+//// @TableField("run_speed")
+// private Integer runSpeed;
/**
- * 褰撳墠浜岀淮鐮�
+ * 鐗涚溂-宸ヤ綔妯″紡
*/
- @ApiModelProperty(value= "褰撳墠浜岀淮鐮�")
- @TableField("current_code")
- private Integer currentCode;
+ @ApiModelProperty(value= "宸ヤ綔妯″紡")
+ @TableField("working_mode")
+ private Integer workingMode;
/**
- * 鐢垫睜鐢甸噺鐧惧垎姣�
+ * 鐗涚溂-杩愯鐘舵��
*/
- @ApiModelProperty(value= "鐢垫睜鐢甸噺鐧惧垎姣�")
- @TableField("battery_power")
- private Integer batteryPower;
+ @ApiModelProperty(value= "杩愯鐘舵��")
+ @TableField("free")
+ private Integer free;
/**
- * 鐢垫睜娓╁害
+ * 鐗涚溂-褰撳墠閫熷害
*/
- @ApiModelProperty(value= "鐢垫睜娓╁害")
- @TableField("battery_temp")
- private Integer batteryTemp;
+ @ApiModelProperty(value= "褰撳墠閫熷害")
+ @TableField("speed")
+ private Integer speed;
/**
- * 閿欒缂栧彿
+ * 鐗涚溂-璐熻浇鐘舵��
*/
- @ApiModelProperty(value= "閿欒缂栧彿")
- @TableField("error_code")
- private Integer errorCode;
+ @ApiModelProperty(value= "璐熻浇鐘舵��")
+ @TableField("load_state")
+ private Integer loadState;
/**
- * Plc杈撳嚭鐘舵�両O
+ * 鐗涚溂-绠″埗鐘舵��
*/
- @ApiModelProperty(value= "Plc杈撳嚭鐘舵�両O")
- @TableField("plc_output_status_io")
- private Integer plcOutputStatusIo;
+ @ApiModelProperty(value= "绠″埗鐘舵��")
+ @TableField("suspend_state")
+ private Integer suspendState;
/**
- * 閿欒淇℃伅鐮�
+ * 鐗涚溂-椤跺崌浣嶇疆
*/
- @ApiModelProperty(value= "閿欒淇℃伅鐮�")
- @TableField("status_error_code")
- private Integer statusErrorCode;
+ @ApiModelProperty(value= "椤跺崌浣嶇疆")
+ @TableField("lift_position")
+ private Integer liftPosition;
/**
- * PLC杈撳叆鐘舵��
+ * 鐗涚溂-杩愯鏂瑰悜
*/
- @ApiModelProperty(value= "PLC杈撳叆鐘舵��")
- @TableField("plc_input_status")
- private Integer plcInputStatus;
+ @ApiModelProperty(value= "杩愯鏂瑰悜")
+ @TableField("run_dir")
+ private Integer runDir;
/**
- * 褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+ * 鐗涚溂-杩愯鏂瑰悜
*/
- @ApiModelProperty(value= "褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��")
- @TableField("current_or_before_code")
- private Integer currentOrBeforeCode;
+ @ApiModelProperty(value= "杩愯鏂瑰悜")
+ @TableField("run_dir2")
+ private Integer runDir2;
/**
- * 璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+ * 鐗涚溂-鍏呯數鐘舵��
*/
- @ApiModelProperty(value= "璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�")
- @TableField("code_offset_x")
- private Integer codeOffsetX;
+ @ApiModelProperty(value= "鍏呯數鐘舵��")
+ @TableField("charg_state")
+ private Integer chargState;
/**
- * 璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+ * 鐗涚溂-鐢垫睜鐢甸噺
*/
- @ApiModelProperty(value= "璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�")
- @TableField("code_offset_y")
- private Integer codeOffsetY;
+ @ApiModelProperty(value= "鐢垫睜鐢甸噺")
+ @TableField("power_percent")
+ private Integer powerPercent;
/**
- * 褰撳墠鐨勭數鍘嬪��
+ * 鐗涚溂-鏈�楂樼數鑺數鍘�
*/
- @ApiModelProperty(value= "褰撳墠鐨勭數鍘嬪��")
- @TableField("current_voltage")
- private Integer currentVoltage;
+ @ApiModelProperty(value= "鏈�楂樼數鑺數鍘�")
+ @TableField("max_cell_voltage")
+ private Integer maxCellVoltage;
/**
- * 褰撳墠鐨勬ā鎷熼噺鍊�
+ * 鐗涚溂-鏈�浣庣數鑺數鍘�
*/
- @ApiModelProperty(value= "褰撳墠鐨勬ā鎷熼噺鍊�")
- @TableField("current_analog_value")
- private Integer currentAnalogValue;
+ @ApiModelProperty(value= "鏈�浣庣數鑺數鍘�")
+ @TableField("min_cell_voltage")
+ private Integer minCellVoltage;
/**
- * 褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+ * 鐗涚溂-鐢垫睜鐢靛帇
*/
- @ApiModelProperty(value= "褰撳墠鐨勫崌闄嶄己鏈嶉�熷害")
- @TableField("current_lift_servo_speed")
- private Integer currentLiftServoSpeed;
+ @ApiModelProperty(value= "鐢垫睜鐢靛帇")
+ @TableField("voltage")
+ private Integer voltage;
/**
- * 褰撳墠鐨勮璧颁己鏈嶉�熷害
+ * 鐗涚溂-鍏呮斁鐢靛惊鐜鏁�
*/
- @ApiModelProperty(value= "褰撳墠鐨勮璧颁己鏈嶉�熷害")
- @TableField("current_move_servo_speed")
- private Integer currentMoveServoSpeed;
+ @ApiModelProperty(value= "鍏呮斁鐢靛惊鐜鏁�")
+ @TableField("charge_cycle_times")
+ private Integer chargeCycleTimes;
/**
- * 褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+ * 鐗涚溂-鍓╀綑鐢甸噺
*/
- @ApiModelProperty(value= "褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼")
- @TableField("current_lift_servo_load")
- private Integer currentLiftServoLoad;
+ @ApiModelProperty(value= "鍓╀綑鐢甸噺")
+ @TableField("surplus_quantity")
+ private Integer surplusQuantity;
/**
- * 褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+ * 鐗涚溂-鎬荤數閲�
*/
- @ApiModelProperty(value= "褰撳墠鐨勮璧颁己鏈嶈礋杞界巼")
- @TableField("current_move_servo_load")
- private Integer currentMoveServoLoad;
+ @ApiModelProperty(value= "鎬荤數閲�")
+ @TableField("count_quantity")
+ private Integer countQuantity;
/**
- * 灏忚溅杩愯閫熷害
+ * 鐗涚溂-瀹為檯搴撲綅
*/
- @ApiModelProperty(value= "灏忚溅杩愯閫熷害")
- @TableField("run_speed")
- private Integer runSpeed;
+ @ApiModelProperty(value= "瀹為檯搴撲綅")
+ @TableField("point")
+ private String point;
+
+ /**
+ * 鐗涚溂-瀹為檯鍧愭爣
+ */
+ @ApiModelProperty(value= "瀹為檯鍧愭爣")
+ @TableField("coord")
+ private String coord;
+
+ /**
+ * 鐗涚溂-浠诲姟鐩殑搴撲綅
+ */
+ @ApiModelProperty(value= "浠诲姟鐩殑搴撲綅")
+ @TableField("task")
+ private String task;
+
+ /**
+ * 鐗涚溂-浠诲姟鐘舵��
+ */
+ @ApiModelProperty(value= "浠诲姟鐘舵��")
+ @TableField("task_state")
+ private Integer taskState;
+
+ /**
+ * 鐗涚溂-鏁呴殰鐘舵��
+ */
+ @ApiModelProperty(value= "鏁呴殰鐘舵��")
+ @TableField("err_state")
+ private Integer errState;
+
+ /**
+ * 鐗涚溂-鎬婚噷绋嬫暟
+ */
+ @ApiModelProperty(value= "鎬婚噷绋嬫暟")
+ @TableField("status_sum")
+ private String statusSum;
+
+ /**
+ * 鐗涚溂-闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�
+ */
+ @ApiModelProperty(value= "闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�")
+ @TableField("err_time")
+ private Integer errTime;
public BasShuttle() {}
- public BasShuttle(Integer shuttleNo,Integer status,Integer shuttleStatus,Integer wrkNo,String idleLoc,Integer autoCharge,Integer chargeLine,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer liftNo,Boolean pakMk,Integer busyStatus,Integer currentCode,Integer batteryPower,Integer batteryTemp,Integer errorCode,Integer plcOutputStatusIo,Integer statusErrorCode,Integer plcInputStatus,Integer currentOrBeforeCode,Integer codeOffsetX,Integer codeOffsetY,Integer currentVoltage,Integer currentAnalogValue,Integer currentLiftServoSpeed,Integer currentMoveServoSpeed,Integer currentLiftServoLoad,Integer currentMoveServoLoad) {
+ public BasShuttle(Integer shuttleNo, Integer status, Integer shuttleStatus, Integer wrkNo, String idleLoc, Integer autoCharge, Integer chargeLine, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo, Integer liftNo, Boolean pakMk, Integer busyStatus, Integer currentCode, Integer batteryPower, Integer batteryTemp, Integer errorCode, Integer plcOutputStatusIo, Integer statusErrorCode, Integer plcInputStatus, Integer currentOrBeforeCode, Integer codeOffsetX, Integer codeOffsetY, Integer currentVoltage, Integer currentAnalogValue, Integer currentLiftServoSpeed, Integer currentMoveServoSpeed, Integer currentLiftServoLoad, Integer currentMoveServoLoad, Integer runSpeed, Integer workingMode, Integer free, Integer speed, Integer loadState, Integer suspendState, Integer liftPosition, Integer runDir, Integer runDir2, Integer chargState, Integer powerPercent, Integer maxCellVoltage, Integer minCellVoltage, Integer voltage, Integer chargeCycleTimes, Integer surplusQuantity, Integer countQuantity, String point, String coord, String task, Integer taskState, Integer errState, String statusSum, Integer errTime) {
this.shuttleNo = shuttleNo;
this.status = status;
this.shuttleStatus = shuttleStatus;
@@ -268,23 +429,47 @@
this.memo = memo;
this.liftNo = liftNo;
this.pakMk = pakMk;
- this.busyStatus = busyStatus;
- this.currentCode = currentCode;
- this.batteryPower = batteryPower;
- this.batteryTemp = batteryTemp;
- this.errorCode = errorCode;
- this.plcOutputStatusIo = plcOutputStatusIo;
- this.statusErrorCode = statusErrorCode;
- this.plcInputStatus = plcInputStatus;
- this.currentOrBeforeCode = currentOrBeforeCode;
- this.codeOffsetX = codeOffsetX;
- this.codeOffsetY = codeOffsetY;
- this.currentVoltage = currentVoltage;
- this.currentAnalogValue = currentAnalogValue;
- this.currentLiftServoSpeed = currentLiftServoSpeed;
- this.currentMoveServoSpeed = currentMoveServoSpeed;
- this.currentLiftServoLoad = currentLiftServoLoad;
- this.currentMoveServoLoad = currentMoveServoLoad;
+// this.busyStatus = busyStatus;
+// this.currentCode = currentCode;
+// this.batteryPower = batteryPower;
+// this.batteryTemp = batteryTemp;
+// this.errorCode = errorCode;
+// this.plcOutputStatusIo = plcOutputStatusIo;
+// this.statusErrorCode = statusErrorCode;
+// this.plcInputStatus = plcInputStatus;
+// this.currentOrBeforeCode = currentOrBeforeCode;
+// this.codeOffsetX = codeOffsetX;
+// this.codeOffsetY = codeOffsetY;
+// this.currentVoltage = currentVoltage;
+// this.currentAnalogValue = currentAnalogValue;
+// this.currentLiftServoSpeed = currentLiftServoSpeed;
+// this.currentMoveServoSpeed = currentMoveServoSpeed;
+// this.currentLiftServoLoad = currentLiftServoLoad;
+// this.currentMoveServoLoad = currentMoveServoLoad;
+// this.runSpeed = runSpeed;
+ this.workingMode = workingMode;
+ this.free = free;
+ this.speed = speed;
+ this.loadState = loadState;
+ this.suspendState = suspendState;
+ this.liftPosition = liftPosition;
+ this.runDir = runDir;
+ this.runDir2 = runDir2;
+ this.chargState = chargState;
+ this.powerPercent = powerPercent;
+ this.maxCellVoltage = maxCellVoltage;
+ this.minCellVoltage = minCellVoltage;
+ this.voltage = voltage;
+ this.chargeCycleTimes = chargeCycleTimes;
+ this.surplusQuantity = surplusQuantity;
+ this.countQuantity = countQuantity;
+ this.point = point;
+ this.coord = coord;
+ this.task = task;
+ this.taskState = taskState;
+ this.errState = errState;
+ this.statusSum = statusSum;
+ this.errTime = errTime;
}
// BasShuttle basShuttle = new BasShuttle(
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 08aad9e..2dbac01 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -909,12 +909,12 @@
//鑾峰彇灏忚溅绉诲姩閫熷害
BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo());
Integer runSpeed = 1000;
- if (basShuttle != null) {
- Integer runSpeed1 = basShuttle.getRunSpeed();
- if (runSpeed1 != null) {
- runSpeed = runSpeed1;
- }
- }
+// if (basShuttle != null) {
+// Integer runSpeed1 = basShuttle.getRunSpeed();
+// if (runSpeed1 != null) {
+// runSpeed = runSpeed1;
+// }
+// }
//璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType, Utils.getShuttlePoints(shuttleThread.getSlave().getId(), Utils.getLev(startLocNo)));
@@ -979,12 +979,12 @@
//鑾峰彇灏忚溅绉诲姩閫熷害
BasShuttle basShuttle = basShuttleService.selectById(assignCommand.getShuttleNo());
Integer runSpeed = 1000;
- if (basShuttle != null) {
- Integer runSpeed1 = basShuttle.getRunSpeed();
- if (runSpeed1 != null) {
- runSpeed = runSpeed1;
- }
- }
+// if (basShuttle != null) {
+// Integer runSpeed1 = basShuttle.getRunSpeed();
+// if (runSpeed1 != null) {
+// runSpeed = runSpeed1;
+// }
+// }
List<NavigateNode> allNode = new ArrayList<>();
diff --git a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
index be0be98..47d2b93 100644
--- a/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
+++ b/src/main/java/com/zy/common/utils/NavigatePositionConvert.java
@@ -5,6 +5,7 @@
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.LocMastService;
+import com.zy.asrs.utils.Utils;
/**
* 搴撲綅缂栧彿鍜孉*绠楁硶鐨剎y杞磋浆鎹㈠伐鍏风被
@@ -34,6 +35,12 @@
return Short.parseShort(sb.toString());
}
+ //xyz杞磋浆搴撲綅鍙�
+ public static String xyzToLocNo(int x, int y, int z) {
+ String locNo = Utils.getLocNo(x, y, z);
+ return locNo;
+ }
+
//xyz杞磋浆鍧愭爣缂栧彿
public static Short xyToPosition(int x, int y, int z) {
StringBuffer sb = new StringBuffer();
diff --git a/src/main/java/com/zy/common/utils/NyHttpUtils.java b/src/main/java/com/zy/common/utils/NyHttpUtils.java
index 9176d0c..5c28076 100644
--- a/src/main/java/com/zy/common/utils/NyHttpUtils.java
+++ b/src/main/java/com/zy/common/utils/NyHttpUtils.java
@@ -273,21 +273,24 @@
try {
String response = new HttpHandler.Builder()
.setUri(requestUrl)
- .setPath("/test")
+ .setPath("/static/readStatus.json")
.setJson(JSON.toJSONString(httpCommand))
.build()
- .doPost();
+ .doGet();
JSONObject jsonObject = JSON.parseObject(response);
- JSONObject request = jsonObject.getJSONObject("request");
- JSONObject body = request.getJSONObject("body");
- if (body.get("result").equals("success")) {
+ JSONObject response2 = jsonObject.getJSONObject("response");
+ JSONObject body = response2.getJSONObject("body");
+
+ if (body.get("responseType").equals("state")) {//璇诲彇鐘舵�侊紝涓嶉渶瑕佸垽鏂璼uccess
return body;
}
+ if (body.get("result").equals("success")) {
+ return body;
+ }
} catch (Exception e) {
- e.printStackTrace();
+// e.printStackTrace();
}
-
return null;
}
diff --git a/src/main/java/com/zy/core/MainProcess.java b/src/main/java/com/zy/core/MainProcess.java
index 28f02f5..5cdc757 100644
--- a/src/main/java/com/zy/core/MainProcess.java
+++ b/src/main/java/com/zy/core/MainProcess.java
@@ -57,20 +57,20 @@
// mainService.restartTaskFromRedis();
// 鎷f枡銆佸苟鏉裤�佺洏鐐瑰啀鍏ュ簱
mainService.stnToCrnStnPick();
- // 鍏ュ簱 ===>> 鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
- mainService.shuttleIoInExecute();
- // 鍑哄簱 ===>> 鍥涘悜绌挎杞﹀嚭搴撲綔涓氫笅鍙�
- mainService.shuttleIoOutExecute();
- //鍥涘悜绌挎杞︿换鍔″畬鎴�
- mainService.shuttleFinished();
+// // 鍏ュ簱 ===>> 鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
+// mainService.shuttleIoInExecute();
+// // 鍑哄簱 ===>> 鍥涘悜绌挎杞﹀嚭搴撲綔涓氫笅鍙�
+// mainService.shuttleIoOutExecute();
+// //鍥涘悜绌挎杞︿换鍔″畬鎴�
+// mainService.shuttleFinished();
//鎻愬崌鏈轰换鍔�
mainService.liftIoExecute();
//鎻愬崌鏈轰换鍔″畬鎴�
mainService.liftFinished();
//搴撲綅绉昏浆
mainService.locToLocExecute();
- // 寮傚父淇℃伅璁板綍
- mainService.recErr();
+// // 寮傚父淇℃伅璁板綍
+// mainService.recErr();
// 鍏ュ簱 ===>> 绌烘爤鏉垮垵濮嬪寲鍏ュ簱,鍙夎溅鍏ュ簱绔欐斁璐�
mainService.storeEmptyPlt();
// 鍑哄簱 ===>> 宸ヤ綔妗d俊鎭啓鍏ed鏄剧ず鍣�
@@ -78,8 +78,8 @@
// 鍏朵粬 ===>> LED鏄剧ず鍣ㄥ浣嶏紝鏄剧ず榛樿淇℃伅
mainService.ledReset();
// 绌挎杞� ===>> 灏忚溅鐢甸噺妫�娴嬪厖鐢�
- mainService.loopShuttleCharge();
- mainService.executeShuttleCharge();
+// mainService.loopShuttleCharge();
+// mainService.executeShuttleCharge();
// //鍑哄叆搴撴ā寮�
// i++;
diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index 2b4d6c3..781ce85 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -93,7 +93,7 @@
// 鍒濆鍖栧洓鍚戠┛姊溅
News.info("鍒濆鍖栧洓鍚戠┛姊溅......................................................");
for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
- ShuttleThread shuttleThread = new ShuttleThread(shuttleSlave,redisUtil);
+ NyShuttleThread shuttleThread = new NyShuttleThread(shuttleSlave,redisUtil);
new Thread(shuttleThread).start();
SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), shuttleThread);
}
diff --git a/src/main/java/com/zy/core/enums/ShuttleStatusType.java b/src/main/java/com/zy/core/enums/ShuttleStatusType.java
index 479b65f..5c1f5e7 100644
--- a/src/main/java/com/zy/core/enums/ShuttleStatusType.java
+++ b/src/main/java/com/zy/core/enums/ShuttleStatusType.java
@@ -2,28 +2,27 @@
/**
* 鍥涘悜绌挎杞�
- * Wm200 灏忚溅蹇欑姸鎬佷綅
*/
public enum ShuttleStatusType {
- IDLE((short)0, "绌洪棽"),
- BUSY((short)1, "蹇�"),
+ IDLE(1, "绌洪棽"),
+ BUSY(0, "蹇�"),
;
- public Short id;
+ public Integer id;
public String desc;
- ShuttleStatusType(Short id,String desc) {
+ ShuttleStatusType(Integer id,String desc) {
this.id = id;
this.desc = desc;
}
- public static ShuttleStatusType get(Short id) {
+ public static ShuttleStatusType get(Integer id) {
if (null == id) {
return null;
}
for (ShuttleStatusType type : ShuttleStatusType.values()) {
- if (type.id.equals(id.shortValue())) {
+ if (type.id == id) {
return type;
}
}
diff --git a/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
new file mode 100644
index 0000000..7169ca8
--- /dev/null
+++ b/src/main/java/com/zy/core/model/protocol/NyShuttleProtocol.java
@@ -0,0 +1,431 @@
+package com.zy.core.model.protocol;
+
+import com.alibaba.fastjson.JSON;
+import com.core.common.SpringUtils;
+import com.zy.asrs.service.BasShuttleService;
+import com.zy.common.utils.NavigatePositionConvert;
+import com.zy.core.News;
+import com.zy.core.enums.ShuttleErrorCodeType;
+import com.zy.core.enums.ShuttleProtocolStatusType;
+import com.zy.core.enums.ShuttleStatusType;
+import com.zy.core.model.command.ShuttleAssignCommand;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.List;
+
+/**
+ * 鐗涚溂鍥涘悜绌挎杞�
+ */
+@Slf4j
+@Data
+public class NyShuttleProtocol {
+
+ /**
+ * 鍥涘悜绌挎杞﹀彿
+ */
+ private Short shuttleNo;
+
+ /**
+ * 浠诲姟鍙�
+ */
+ private Integer taskNo = 0;
+
+ /**
+ * 浠诲姟鎸囦护
+ */
+ private ShuttleAssignCommand assignCommand;
+
+ /**
+ * 褰撳墠灏忚溅鐘舵�侊紙鍐呴儴鑷垜缁存姢锛�
+ */
+ private Integer protocolStatus;
+
+ /**
+ * 褰撳墠灏忚溅鐘舵�佹灇涓�
+ */
+ private ShuttleProtocolStatusType protocolStatusType;
+
+ /**
+ * 婧愬簱浣�
+ */
+ private String sourceLocNo;
+
+ /**
+ * 鐩爣搴撲綅
+ */
+ private String locNo;
+
+ /**
+ * 浣滀笟鏍囪
+ */
+ private Boolean pakMk = false;
+
+ /**
+ * 鎵嬪姩鐘舵��/鑷姩鐘舵��
+ * 0/1
+ */
+ private Integer workingMode;
+
+ /**
+ * 0:杩愯涓�1锛氱┖闂层�傦紙杞﹁嚜鍔ㄦā寮忎笅锛屽湪
+ * 闈欐鐘舵�佷笅锛屼笖娌℃湁鍏朵粬浠诲姟涓旀弧瓒冲彂閫�
+ * 鏂颁换鍔$殑鐘舵�侊級
+ */
+ private Integer free;
+
+ /**
+ * 褰撳墠閫熷害锛屽崟浣峬m/s
+ */
+ private Integer speed;
+
+ /**
+ * 璐熻浇鐘舵�佹棤/鏈夎礋杞�
+ * 0/1
+ */
+ private Integer loadState;
+
+ /**
+ * 绠″埗鐘舵�佷笉鍦ㄧ鍒朵笅/琚鍒朵腑
+ * 0/1
+ */
+ private Integer suspendState;
+
+ /**
+ * 椤跺崌浣嶇疆0-鏈煡1-涓嬮檷浣嶇疆2-鎵樹妇浣嶇疆
+ */
+ private Integer liftPosition;
+
+ /**
+ * 杩愯鏂瑰悜0-鏈煡1-X鍚�2-Y鍚�
+ */
+ private Integer runDir;
+
+ /**
+ * 杩愯鏂瑰悜0-鏈煡锛堥潤姝級1-X+鍚�2-X鍚�3-Y+鍚�4-Y-鍚�
+ */
+ private Integer runDir2;
+
+ /**
+ * 鍏呯數鐘舵��0涓嶅湪鍏呯數鐘舵��1鍏呯數涓�
+ */
+ private Integer chargState;
+
+ /**
+ * 鐢垫睜鐢甸噺0%-100%
+ */
+ private Integer powerPercent;
+
+ /**
+ * 鏈�楂樼數鑺數鍘�(mV)
+ */
+ private Integer maxCellVoltage;
+
+ /**
+ * 鏈�浣庣數鑺數鍘�(mV)锛屼綆浜�2900mv闇�瑕佺珛鍗冲厖鐢�
+ */
+ private Integer minCellVoltage;
+
+ /**
+ * 鐢垫睜鐢靛帇锛坢V锛�
+ */
+ private Integer voltage;
+
+ /**
+ * 鍏呮斁鐢靛惊鐜鏁�
+ */
+ private Integer chargeCycleTimes;
+
+ /**
+ * 鍓╀綑鐢甸噺/10(A)
+ */
+ private Integer surplusQuantity;
+
+ /**
+ * 鎬荤數閲�/10(A)
+ */
+ private Integer countQuantity;
+
+ /**
+ * 瀹為檯搴撲綅xyz
+ */
+ private NyShuttlePointClass point;
+
+ /**
+ * 瀹為檯鍧愭爣xyz鍗曚綅mm
+ */
+ private NyShuttlePointClass coord;
+
+ /**
+ * 浠诲姟鐩殑搴撲綅xyztaskId(姝e湪鍔ㄤ綔鐨勪换鍔D)lastTaskId(鏈�鍚庝竴涓畬鎴愮殑浠诲姟ID)recentTaskId(鏀跺埌鐨勬渶鍚庝竴涓换鍔D)
+ */
+ private TaskClass task;
+
+ /**
+ * 浠诲姟鐘舵��0鏃犱换鍔�1鏈変换鍔�
+ */
+ private Integer taskState;
+
+ /**
+ * 鏁呴殰鐘舵��0鏃犳晠闅�1鏁呴殰涓�
+ */
+ private Integer errState;
+
+ /**
+ * 鏁呴殰鐮�
+ */
+ private List<Integer> errCode;
+
+ /**
+ * mileage鎬婚噷绋嬫暟(绫�)锛宭iftNumber椤跺崌鎬绘暟dropNumber涓嬮檷鎬绘暟reversingX鎹鎬绘暟reversingY鎹鎬绘暟
+ */
+ private StatusSumClass statusSum;
+
+ /**
+ * 闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�(S)
+ */
+ private Integer errTime;
+
+ //鎬婚噷绋嬫暟
+ @Data
+ public static class StatusSumClass {
+ private Integer mileage;//鎬婚噷绋嬫暟(绫�)
+ private Integer liftNumber;//椤跺崌鎬绘暟
+ private Integer dropNumber;//涓嬮檷鎬绘暟
+ private Integer reversingX;//鎹鎬绘暟
+ private Integer reversingY;//鎹鎬绘暟
+ }
+
+ @Data
+ public static class NyShuttlePointClass{
+ private Integer x;
+ private Integer y;
+ private Integer z;
+ }
+
+ //浠诲姟鐩殑搴撲綅
+ @Data
+ public static class TaskClass extends NyShuttlePointClass{
+ private Integer taskState;
+ private Integer taskId;//褰撳墠浠诲姟ID
+ private Integer lastTaskId;//涓婁竴娆″畬鎴愮殑浠诲姟ID
+ private Integer recentTaskId;//鏈�鍚庝竴娆℃帴鏀跺埌鐨勪换鍔D
+ }
+
+ public String getFree$() {
+ if (this.getFree() == null) {
+ return "";
+ }
+ return this.getFree() == 1 ? "绌洪棽" : "杩愯涓�";
+ }
+
+ public String getLoadState$() {
+ if (this.getLoadState() == null) {
+ return "";
+ }
+ return this.getLoadState() == 1 ? "鏈�" : "鏃�";
+ }
+
+ public String getSuspendState$() {
+ if (this.getSuspendState() == null) {
+ return "";
+ }
+ return this.getSuspendState() == 1 ? "鏄�" : "鍚�";
+ }
+
+ public String getPowerPercent$() {
+ if (this.getPowerPercent() == null) {
+ return "";
+ }
+ return this.getPowerPercent() + "%";
+ }
+
+ public String getLiftPosition$() {
+ if (this.getLiftPosition() == null) {
+ return "";
+ }
+
+ switch (this.getRunDir()) {
+ case 0:
+ return "鏈煡";
+ case 1:
+ return "涓嬮檷浣嶇疆";
+ case 2:
+ return "鎵樹妇浣嶇疆";
+ default:
+ return this.getLiftPosition().toString();
+ }
+ }
+
+ public String getChargState$() {
+ if (this.getChargState() == null) {
+ return "";
+ }
+ return this.getChargState() == 1 ? "鍏呯數涓�" : "鏈厖鐢�";
+ }
+
+ public String getMaxCellVoltage$() {
+ if (this.getMaxCellVoltage() == null) {
+ return "";
+ }
+ return this.getMaxCellVoltage() + "mV";
+ }
+
+ public String getMinCellVoltage$() {
+ if (this.getMinCellVoltage() == null) {
+ return "";
+ }
+ return this.getMinCellVoltage() + "mV";
+ }
+
+ public String getVoltage$() {
+ if (this.getVoltage() == null) {
+ return "";
+ }
+ return this.getVoltage() + "mV";
+ }
+
+ public String getTaskState$() {
+ if (this.getTaskState() == null) {
+ return "";
+ }
+ return this.getTaskState() == 1 ? "鏈変换鍔�" : "鏃犱换鍔�";
+ }
+
+ public String getErrState$() {
+ if (this.getErrState() == null) {
+ return "";
+ }
+ return this.getErrState() == 1 ? "鏁呴殰涓�" : "鏃犳晠闅�";
+ }
+
+ public String getRunDir$() {
+ if (this.getRunDir() == null) {
+ return "";
+ }
+
+ switch (this.getRunDir()) {
+ case 0:
+ return "鏈煡";
+ case 1:
+ return "X鍚�";
+ case 2:
+ return "Y鍚�";
+ default:
+ return "鏈煡";
+ }
+ }
+
+ public String getRunDir2$() {
+ if (this.getRunDir2() == null) {
+ return "";
+ }
+
+ switch (this.getRunDir2()) {
+ case 0:
+ return "鏈煡";
+ case 1:
+ return "X+鍚�";
+ case 2:
+ return "X-鍚�";
+ case 3:
+ return "Y+鍚�";
+ case 4:
+ return "Y-鍚�";
+ default:
+ return "鏈煡";
+ }
+ }
+
+ /**
+ * 璁剧疆灏忚溅鐘舵��
+ */
+ public void setProtocolStatus(Integer status) {
+ this.protocolStatus = status;
+ this.protocolStatusType = ShuttleProtocolStatusType.get(status);
+ }
+
+ /**
+ * 璁剧疆灏忚溅鐘舵��
+ */
+ public void setProtocolStatus(ShuttleProtocolStatusType status) {
+ this.protocolStatus = status.id;
+ this.protocolStatusType = status;
+ }
+
+ public String getProtocolStatus$() {
+ if (this.getProtocolStatus() == null) {
+ return "";
+ }
+ return ShuttleProtocolStatusType.get(this.getProtocolStatus()).desc;
+ }
+
+ public String getPakMk$() {
+ if (this.getPakMk() == null) {
+ return "";
+ }
+ return this.getPakMk() ? "Y" : "N";
+ }
+
+ public String getPoint$() {
+ if (this.getPoint() == null) {
+ return "";
+ }
+ return NavigatePositionConvert.xyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ());
+ }
+
+ public String getCoord$() {
+ if (this.getCoord() == null) {
+ return "";
+ }
+ return JSON.toJSONString(this.getCoord());
+ }
+
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+ public Boolean isIdle() {
+ boolean res = this.free == ShuttleStatusType.IDLE.id
+ && this.pakMk.equals(true)
+ && this.errState == 0
+ && this.taskNo == 0
+ && this.protocolStatus == ShuttleProtocolStatusType.IDLE.id
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺
+ try {
+ Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+ if (chargeLine == null) {
+ return false;
+ }
+ return this.getPowerPercent() >= chargeLine;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵�侊紝浼犲叆鐨則askNo鍜屽綋鍓峵askNo鐩稿悓鏃跺厑璁告斁琛�
+ public Boolean isIdle(int taskNo) {
+ boolean res = this.free == ShuttleStatusType.IDLE.id
+ && this.pakMk.equals(true)
+ && this.errState == 0
+ && (this.taskNo == 0 || this.taskNo == taskNo)
+ && this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺
+ try {
+ Integer chargeLine = SpringUtils.getBean(BasShuttleService.class).selectById(this.shuttleNo).getChargeLine();
+ return this.getPowerPercent() > chargeLine;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
index 9cf73ce..bcbc38e 100644
--- a/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -184,7 +184,7 @@
public void setBusyStatus(Short status) {
this.busyStatus = status;
- this.busyStatusType = ShuttleStatusType.get(status);
+ this.busyStatusType = ShuttleStatusType.get(status.intValue());
}
public void setBusyStatus(ShuttleStatusType type) {
diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
new file mode 100644
index 0000000..44bcc59
--- /dev/null
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -0,0 +1,815 @@
+package com.zy.core.thread;
+
+import com.alibaba.fastjson.JSONObject;
+import com.core.common.DateUtils;
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.*;
+import com.zy.asrs.service.*;
+
+import com.zy.common.utils.*;
+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.*;
+import com.zy.core.model.ShuttleSlave;
+import com.zy.core.model.Task;
+import com.zy.core.model.command.NyShuttleHttpCommand;
+import com.zy.core.model.command.ShuttleAssignCommand;
+import com.zy.core.model.command.ShuttleCommand;
+import com.zy.core.model.protocol.NyShuttleProtocol;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * 鐗涚溂鍥涘悜绌挎杞︾嚎绋�
+ */
+@Data
+@Slf4j
+public class NyShuttleThread implements Runnable, ThreadHandler {
+
+ private ShuttleSlave slave;
+ private NyShuttleProtocol shuttleProtocol;
+ private RedisUtil redisUtil;
+
+ public NyShuttleThread(ShuttleSlave slave,RedisUtil redisUtil) {
+ this.slave = slave;
+ this.redisUtil = redisUtil;
+ }
+
+ @Override
+ public void run() {
+ this.connect();
+ while (true) {
+ try {
+ int step = 1;
+ Task task = MessageQueue.poll(SlaveType.Shuttle, slave.getId());
+ if (task != null) {
+ step = task.getStep();
+ }
+ switch (step) {
+ // 璇绘暟鎹�
+ case 1:
+ read();
+ break;
+ // 鍐欏叆鏁版嵁
+ case 2:
+ write((ShuttleCommand) task.getData());
+ break;
+ //涓嬪彂浠诲姟
+ case 3:
+ assignWork((ShuttleAssignCommand) task.getData());
+ break;
+ default:
+ break;
+ }
+ Thread.sleep(500);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void read() {
+ try {
+ readStatus();
+ //鍥涘悜绌挎杞︾┖闂层�佹湁浠诲姟銆佹爣璁颁负true銆佸瓨鍦ㄤ换鍔℃寚浠わ紝闇�瑕佹墽琛屼换鍔$殑涓嬩竴鏉℃寚浠�
+ if (shuttleProtocol.getFree() == ShuttleStatusType.IDLE.id
+ && shuttleProtocol.getTaskNo() != 0
+ && shuttleProtocol.getPakMk()) {
+ //鎵ц涓嬩竴姝ユ寚浠�
+ executeWork(shuttleProtocol.getTaskNo());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ }
+ }
+
+ private void readStatus() {
+ try {
+ if (null == shuttleProtocol) {
+ shuttleProtocol = new NyShuttleProtocol();
+ shuttleProtocol.setShuttleNo(slave.getId().shortValue());
+ shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ }
+
+ //----------璇诲彇鍥涘悜绌挎杞︾姸鎬�-----------
+ NyShuttleHttpCommand readStatusCommand = NyHttpUtils.getReadStatusCommand(slave.getId());
+ JSONObject jsonObject = NyHttpUtils.requestCommand(readStatusCommand);
+ if (jsonObject == null) {
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ }else {
+ //鎵嬪姩鐘舵��/鑷姩鐘舵��
+ shuttleProtocol.setWorkingMode(jsonObject.getInteger("workingMode"));
+ //鍏佽鐘舵�� 0:杩愯涓�1锛氱┖闂�
+ shuttleProtocol.setFree(jsonObject.getInteger("free"));
+ //褰撳墠閫熷害
+ shuttleProtocol.setSpeed(jsonObject.getInteger("speed"));
+ //璐熻浇鐘舵��
+ shuttleProtocol.setLoadState(jsonObject.getInteger("loadState"));
+ //绠″埗鐘舵��
+ shuttleProtocol.setSuspendState(jsonObject.getInteger("suspendState"));
+ //椤跺崌浣嶇疆
+ shuttleProtocol.setLiftPosition(jsonObject.getInteger("liftPosition"));
+ //杩愯鏂瑰悜
+ shuttleProtocol.setRunDir(jsonObject.getInteger("runDir"));
+ //杩愯鏂瑰悜
+ shuttleProtocol.setRunDir2(jsonObject.getInteger("runDir2"));
+ //鍏呯數鐘舵��
+ shuttleProtocol.setChargState(jsonObject.getInteger("chargState"));
+ //鐢垫睜鐢甸噺
+ shuttleProtocol.setPowerPercent(jsonObject.getInteger("powerPercent"));
+ //鏈�楂樼數鑺數鍘�(mV)
+ shuttleProtocol.setMaxCellVoltage(jsonObject.getInteger("maxCellVoltage"));
+ //鏈�浣庣數鑺數鍘�(mV)
+ shuttleProtocol.setMinCellVoltage(jsonObject.getInteger("minCellVoltage"));
+ //鐢垫睜鐢靛帇
+ shuttleProtocol.setVoltage(jsonObject.getInteger("voltage"));
+ //鍏呮斁鐢靛惊鐜鏁�
+ shuttleProtocol.setChargeCycleTimes(jsonObject.getInteger("chargeCycleTimes"));
+ //鍓╀綑鐢甸噺
+ shuttleProtocol.setSurplusQuantity(jsonObject.getInteger("surplusQuantity"));
+ //鎬荤數閲�
+ shuttleProtocol.setCountQuantity(jsonObject.getInteger("countQuantity"));
+ //瀹為檯搴撲綅xyz
+ shuttleProtocol.setPoint(jsonObject.getObject("point", NyShuttleProtocol.NyShuttlePointClass.class));
+ //瀹為檯鍧愭爣xyz
+ shuttleProtocol.setCoord(jsonObject.getObject("coord", NyShuttleProtocol.NyShuttlePointClass.class));
+ //浠诲姟鐩殑搴撲綅
+ shuttleProtocol.setTask(jsonObject.getObject("task", NyShuttleProtocol.TaskClass.class));
+ //浠诲姟鐘舵��
+ shuttleProtocol.setTaskState(jsonObject.getInteger("taskState"));
+ //鏁呴殰鐘舵��
+ shuttleProtocol.setErrState(jsonObject.getInteger("errState"));
+ ArrayList<Integer> errCode = new ArrayList<>();
+ for (Object o : jsonObject.getJSONArray("errCode")) {
+ errCode.add(Integer.parseInt(o.toString()));
+ }
+ //鏁呴殰鐮�
+ shuttleProtocol.setErrCode(errCode);
+ //鎬婚噷绋嬫暟
+ shuttleProtocol.setStatusSum(jsonObject.getObject("statusSum", NyShuttleProtocol.StatusSumClass.class));
+ //闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�
+ shuttleProtocol.setErrTime(jsonObject.getInteger("errTime"));
+
+ //灏忚溅澶勪簬杩愯涓紝灏嗘爣璁扮疆涓簍rue
+ if (shuttleProtocol.getFree() == 0) {
+ shuttleProtocol.setPakMk(true);
+ }
+
+ //灏嗗洓鍚戠┛姊溅鐘舵�佷繚瀛樿嚦鏁版嵁搴�
+ BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+ BasShuttle basShuttle = shuttleService.selectById(slave.getId());
+ if (basShuttle == null) {
+ basShuttle = new BasShuttle();
+ //鍥涘悜绌挎杞﹀彿
+ basShuttle.setShuttleNo(slave.getId());
+ shuttleService.insert(basShuttle);
+ }
+ //宸ヤ綔妯″紡
+ basShuttle.setWorkingMode(shuttleProtocol.getWorkingMode());
+ //杩愯鐘舵��
+ basShuttle.setFree(shuttleProtocol.getFree());
+ //褰撳墠閫熷害
+ basShuttle.setSpeed(shuttleProtocol.getSpeed());
+ //璐熻浇鐘舵��
+ basShuttle.setLoadState(shuttleProtocol.getLoadState());
+ //绠″埗鐘舵��
+ basShuttle.setSuspendState(shuttleProtocol.getSuspendState());
+ //椤跺崌浣嶇疆
+ basShuttle.setLiftPosition(shuttleProtocol.getLiftPosition());
+ //杩愯鏂瑰悜
+ basShuttle.setRunDir(shuttleProtocol.getRunDir());
+ //杩愯鏂瑰悜
+ basShuttle.setRunDir2(shuttleProtocol.getRunDir2());
+ //鍏呯數鐘舵��
+ basShuttle.setChargState(shuttleProtocol.getChargState());
+ //鐢垫睜鐢甸噺
+ basShuttle.setPowerPercent(shuttleProtocol.getPowerPercent());
+ //鏈�楂樼數鑺數鍘�
+ basShuttle.setMaxCellVoltage(shuttleProtocol.getMaxCellVoltage());
+ //鐢垫睜鐢靛帇
+ basShuttle.setVoltage(shuttleProtocol.getVoltage());
+ //鍏呮斁鐢靛惊鐜鏁�
+ basShuttle.setChargeCycleTimes(shuttleProtocol.getChargeCycleTimes());
+ //鍓╀綑鐢甸噺
+ basShuttle.setSurplusQuantity(shuttleProtocol.getSurplusQuantity());
+ //鎬荤數閲�
+ basShuttle.setCountQuantity(shuttleProtocol.getCountQuantity());
+ //瀹為檯搴撲綅
+ basShuttle.setPoint(JSONObject.toJSONString(shuttleProtocol.getPoint()));
+ //瀹為檯鍧愭爣
+ basShuttle.setCoord(JSONObject.toJSONString(shuttleProtocol.getCoord()));
+ //浠诲姟鐩殑搴撲綅
+ basShuttle.setTask(JSONObject.toJSONString(shuttleProtocol.getTask()));
+ //浠诲姟鐘舵��
+ basShuttle.setTaskState(shuttleProtocol.getTaskState());
+ //鏁呴殰鐘舵��
+ basShuttle.setErrState(shuttleProtocol.getErrState());
+ //鎬婚噷绋嬫暟
+ basShuttle.setStatusSum(JSONObject.toJSONString(shuttleProtocol.getStatusSum()));
+ //闈炶嚜鍔ㄧ姸鎬佹椂闂磋鏃�
+ basShuttle.setErrTime(shuttleProtocol.getErrTime());
+ //浠诲姟鍙�
+ basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue());
+ //淇敼鏃堕棿
+ basShuttle.setUpdateTime(new Date());
+ //浣滀笟鏍囪
+ basShuttle.setPakMk(shuttleProtocol.getPakMk());
+ if (shuttleService.updateById(basShuttle)) {
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+// log.info(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝洓鍚戠┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+ }
+ }
+
+ @Override
+ public boolean connect() {
+ return true;
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ private boolean write(ShuttleCommand command){
+ if (null == command) {
+ News.error("鍥涘悜绌挎杞﹀啓鍏ュ懡浠や负绌�");
+ return false;
+ }
+ BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+ if (shuttleService == null) {
+ News.error("绯荤粺閿欒");
+ return false;
+ }
+
+ BasShuttle basShuttle = shuttleService.selectById(slave.getId().shortValue());
+ if (basShuttle == null) {
+ News.error("鍥涘悜绌挎杞︿笉瀛樺湪");
+ return false;
+ }
+// command.setShuttleNo(slave.getId().shortValue());
+// short[] array = getCommandArr(command);//鑾峰彇鍛戒护鎶ユ枃
+// OperateResult result = modbusTcpNet.Write("0", array);
+// if (result != null && result.IsSuccess) {
+// News.info("鍥涘悜绌挎杞﹀懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
+// OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
+//
+// try {
+// Thread.sleep(3000);//鍛戒护涓嬪彂鍚庝紤鐪�
+// } catch (InterruptedException e) {
+// throw new RuntimeException(e);
+// }
+//
+// for (int i = 0; i < 5; i++) {
+// if (command.getCommandWord().intValue() == 5 || command.getCommandWord().intValue() == 6) {
+// break;//鍏呯數寮�鍏冲拰绯荤粺澶嶄綅涓嶉渶瑕侀噸鍙戞満鍒�
+// }
+// readStatus();//閲嶆柊璇诲彇鐘舵��
+// if (shuttleProtocol.getBusyStatusType().equals(ShuttleStatusType.BUSY)) {
+// break;
+// }
+//
+// //鍒ゆ柇鏄惁杩愯涓紝濡備笉杩愯锛岄噸鏂颁笅鍙戝懡浠�
+// result = modbusTcpNet.Write("0", array);
+// News.info("鍥涘悜绌挎杞﹀懡浠や笅鍙慬id:{}] >>>>> {},娆℃暟锛歿}", slave.getId(), JSON.toJSON(command), i);
+// OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2},娆℃暟锛歿}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command), i));
+// try {
+// Thread.sleep(300);//鍛戒护涓嬪彂鍚庝紤鐪�
+// } catch (InterruptedException e) {
+// throw new RuntimeException(e);
+// }
+// }
+//
+// return true;
+// } else {
+// OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆戝啓鍏ュ洓鍚戠┛姊溅plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}],娆℃暟锛歿}", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+// News.error("鍐欏叆鍥涘悜绌挎杞lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+// return false;
+// }
+
+ return false;
+ }
+
+ //鍒嗛厤浠诲姟
+ private void assignWork(ShuttleAssignCommand assignCommand) {
+// ShuttleRedisCommand redisCommand = new ShuttleRedisCommand();
+//
+// if (!assignCommand.getAuto()) {
+// List<NavigateNode> allNode = new ArrayList<>();
+// List<ShuttleCommand> commands = new ArrayList<>();
+// LocMastService locMastService = SpringUtils.getBean(LocMastService.class);
+// BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+// NavigateMapData navigateMapData;
+//
+// //鑾峰彇灏忚溅绉诲姩閫熷害
+// BasShuttle basShuttle = shuttleService.selectById(slave.getId());
+// Integer runSpeed = 1000;
+// if (basShuttle != null) {
+// Integer runSpeed1 = basShuttle.getRunSpeed();
+// if (runSpeed1 != null) {
+// runSpeed = runSpeed1;
+// }
+// }
+//
+// LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
+// LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+//
+// switch (assignCommand.getTaskMode()) {
+// case 1://鍏ュ簱
+// case 2://鍑哄簱
+// //灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
+// //璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
+// LocMast currentLocMast = locMastService.queryByQrCode(shuttleProtocol.getCurrentCode().toString());
+// List<NavigateNode> firstMastResult = NavigateUtils.calc(currentLocMast.getLocNo(), assignCommand.getSourceLocNo(), NavigationMapType.NORMAL.id, Utils.getShuttlePoints(assignCommand.getShuttleNo().intValue(), Utils.getLev(currentLocMast.getLocNo())));//灏忚溅鍒颁腑鐐癸紝澶勪簬鏃犺揣鐘舵�侊紝浣跨敤姝e父閫氶亾鍦板浘
+// boolean checkResult = Utils.checkShuttlePath(firstMastResult, shuttleProtocol.getShuttleNo().intValue());
+// if (firstMastResult != null && checkResult) {
+// allNode.addAll(firstMastResult);//灏嗚妭鐐硅繘琛屼繚瀛�
+// //鑾峰彇鍒嗘璺緞
+// ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(firstMastResult);
+// //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+// for (ArrayList<NavigateNode> nodes : data) {
+// //寮�濮嬭矾寰�
+// NavigateNode startPath = nodes.get(0);
+// //涓棿璺緞
+// NavigateNode middlePath = nodes.get(nodes.size() - 2);
+// //鐩爣璺緞
+// NavigateNode endPath = nodes.get(nodes.size() - 1);
+// Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+// Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
+//
+// //姝e父绉诲姩鍛戒护
+// Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//寮�濮嬩簩缁寸爜
+// Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//鐩爣浜岀淮鐮�
+// Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//鐩爣浜岀淮鐮�
+// commands.add(getMoveCommand(startCode, distCode, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCode, middleToDistDistance, runSpeed));
+// }
+//
+// //鎵樼洏椤跺崌
+// commands.add(getPalletCommand((short) 1));
+// }else {
+// //娌℃湁璁$畻鍒拌矾寰勶紝鍙兘瀛樺湪灏忚溅浣嶇疆灏辨槸璧风偣浣嶇疆
+// if (currentLocMast.getLocNo().equals(assignCommand.getSourceLocNo())) {
+// //灏忚溅浣嶇疆灏辨槸璧风偣浣嶇疆锛屾棤闇�绉诲姩锛岀洿鎺ラ《鍗�
+// //鎵樼洏椤跺崌
+// commands.add(getPalletCommand((short) 1));
+// }
+// }
+//
+// //璁$畻涓偣鍒扮粓鐐硅矾寰�
+// List<NavigateNode> secMastResult = NavigateUtils.calc(assignCommand.getSourceLocNo(), assignCommand.getLocNo(), NavigationMapType.DFX.id, Utils.getShuttlePoints(assignCommand.getShuttleNo().intValue(), Utils.getLev(assignCommand.getSourceLocNo())));//灏忚溅浠庝腑鐐瑰埌缁堢偣锛屽浜庢湁璐х姸鎬侊紝浣跨敤DFX鍦板浘
+// boolean checkResult2 = Utils.checkShuttlePath(secMastResult, shuttleProtocol.getShuttleNo().intValue());
+// if (secMastResult != null && checkResult2) {
+// allNode.addAll(secMastResult);//灏嗚妭鐐硅繘琛屼繚瀛�
+// //鑾峰彇鍒嗘璺緞
+// ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(secMastResult);
+// //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+// for (ArrayList<NavigateNode> nodes : data) {
+// //寮�濮嬭矾寰�
+// NavigateNode startPath = nodes.get(0);
+// //涓棿璺緞
+// NavigateNode middlePath = nodes.get(nodes.size() - 2);
+// //鐩爣璺緞
+// NavigateNode endPath = nodes.get(nodes.size() - 1);
+// Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+// Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
+//
+// //姝e父绉诲姩鍛戒护
+// Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//寮�濮嬩簩缁寸爜
+// Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//涓棿浜岀淮鐮�
+// Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//鐩爣浜岀淮鐮�
+// commands.add(getMoveCommand(startCode, distCode, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCode, middleToDistDistance, runSpeed));
+// }
+//
+// //鎵樼洏涓嬮檷
+// commands.add(getPalletCommand((short) 2));
+// }
+//
+// if (firstMastResult == null || secMastResult == null) {
+// throw new CoolException(MessageFormat.format( "鍥涘悜绌挎杞﹀嚭鍏ュ簱璺緞鎼滅储澶辫触 ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort()));
+// }
+//
+// navigateMapData = new NavigateMapData(Utils.getLev(currentLocMast.getLocNo()));
+// //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// navigateMapData.writeNavigateNodeToRedisMap(firstMastResult, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// navigateMapData.writeNavigateNodeToRedisMap(secMastResult, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// break;
+// case 3://鎵樼洏椤跺崌
+// case 4://鎵樼洏涓嬮檷
+// commands.add(getPalletCommand(assignCommand.getTaskMode() == 3 ? (short) 1 : (short) 2));
+// break;
+// case 5://寮哄埗宸︾Щ
+// commands.add(getForceMoveCommand((short) 2));
+// break;
+// case 6://寮哄埗鍙崇Щ
+// commands.add(getForceMoveCommand((short) 1));
+// break;
+// case 7://寮哄埗涓婄Щ
+// commands.add(getForceMoveCommand((short) 3));
+// break;
+// case 8://寮哄埗涓嬬Щ
+// commands.add(getForceMoveCommand((short) 4));
+// break;
+// case 9://鐘舵�佸浣�
+// ShuttleCommand reset = getResetCommand();
+// commands.add(reset);
+// break;
+// case 10://姝f柟鍚�(鍙�)瀵诲簱浣�
+// commands.add(getFindLocCommand((short) 1));
+// break;
+// case 11://璐熸柟鍚�(宸�)瀵诲簱浣�
+// commands.add(getFindLocCommand((short) 2));
+// break;
+// case 12://鍚戞鏂瑰悜(鍓�)瀵诲簱浣�
+// commands.add(getFindLocCommand((short) 4));
+// break;
+// case 13://鍚戣礋鏂瑰悜(鍚�)瀵诲簱浣�
+// commands.add(getFindLocCommand((short) 3));
+// break;
+// case 14://绉诲姩鍒扮洰鏍囧簱浣�
+// String startQr = shuttleProtocol.getCurrentCode().toString();//璧峰浣嶇疆
+// //濡傛灉绌挎杞﹀湪鎻愬崌鏈哄唴锛岀Щ鍔ㄦ椂闇�瑕佸厛涓嬪彂鍑烘彁鍗囨満鍛戒护
+// if (liftProtocol.getBarcode().intValue() == shuttleProtocol.getCurrentCode().intValue()) {
+// //绌挎杞﹀嚭鎻愬崌鏈�
+// Short liftArrival = liftProtocol.getPositionArrivalFeedback();//鎻愬崌鏈轰綅缃弽棣�
+// String liftSiteLocNo = Utils.liftArrivalToOutInStaLocNo(liftArrival);
+// LocMast locMast1 = locMastService.selectById(liftSiteLocNo);
+// ShuttleCommand moveCommand = getMoveCommand(liftProtocol.getBarcode(), Short.parseShort(locMast1.getQrCodeValue()), 1600, ShuttleRunDirection.BOTTOM.id, null, null, runSpeed);
+// commands.add(moveCommand);
+//
+// //璧峰浣嶇疆淇敼涓烘彁鍗囨満鍙g珯鐐逛綅缃�
+// startQr = locMast1.getQrCodeValue();
+// }
+//
+// LocMast locMast = locMastService.queryByQrCode(startQr);
+// List<NavigateNode> result = NavigateUtils.calc(locMast.getLocNo(), assignCommand.getLocNo(), NavigationMapType.NONE.id, Utils.getShuttlePoints(assignCommand.getShuttleNo().intValue(), Utils.getLev(locMast.getLocNo())));//鎵嬪姩鍛戒护-绉诲姩鍛戒护锛屼娇鐢ㄦ棤杩囨护鍦板浘
+// boolean checkResult3 = Utils.checkShuttlePath(result, shuttleProtocol.getShuttleNo().intValue());
+// if (result != null && checkResult3) {
+// //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// navigateMapData = new NavigateMapData(Utils.getLev(locMast.getLocNo()));
+// navigateMapData.writeNavigateNodeToRedisMap(result, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+//
+// allNode.addAll(result);//灏嗚妭鐐硅繘琛屼繚瀛�
+// //鑾峰彇鍒嗘璺緞
+// ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(result);
+// //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+// for (ArrayList<NavigateNode> nodes : data) {
+// //寮�濮嬭矾寰�
+// NavigateNode startPath = nodes.get(0);
+// //涓棿璺緞
+// NavigateNode middlePath = nodes.get(nodes.size() - 2);
+// //鐩爣璺緞
+// NavigateNode endPath = nodes.get(nodes.size() - 1);
+// Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+// Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
+// Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//寮�濮嬩簩缁寸爜
+// Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//涓棿浜岀淮鐮�
+// Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//鐩爣浜岀淮鐮�
+// //姝e父绉诲姩鍛戒护
+// commands.add(getMoveCommand(startCode, distCode, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCode, middleToDistDistance, runSpeed));
+// }
+// }
+// break;
+// case 15://鍏呯數寮�鍏�
+// commands.add(getChargeSwitchCommand());
+// break;
+// case 16://绉诲姩鍒版彁鍗囨満
+// LocMast locMast1 = locMastService.queryByQrCode(shuttleProtocol.getCurrentCode().toString());
+// int lev = Utils.getLev(locMast1.getLocNo());//绌挎杞﹀綋鍓嶉珮搴�
+// String liftSiteLocNo = Utils.levToOutInStaLocNo(lev);//褰撳墠妤煎眰绔欑偣搴撲綅鍙�
+// LocMast liftSitelocMast = locMastService.selectById(liftSiteLocNo);
+// List<NavigateNode> result1 = NavigateUtils.calc(locMast1.getLocNo(), liftSiteLocNo, NavigationMapType.NONE.id, Utils.getShuttlePoints(assignCommand.getShuttleNo().intValue(), Utils.getLev(locMast1.getLocNo())));//绉诲姩鍒版彁鍗囨満锛屼娇鐢ㄦ棤杩囨护鍦板浘
+// boolean checkResult4 = Utils.checkShuttlePath(result1, shuttleProtocol.getShuttleNo().intValue());
+// Short endStartCode = null;
+// if (result1 != null && checkResult4) {
+// //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+// navigateMapData = new NavigateMapData(Utils.getLev(locMast1.getLocNo()));
+// navigateMapData.writeNavigateNodeToRedisMap(result1, true);////鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+//
+// allNode.addAll(result1);//灏嗚妭鐐硅繘琛屼繚瀛�
+// //鑾峰彇鍒嗘璺緞
+// ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(result1);
+// //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+// for (ArrayList<NavigateNode> nodes : data) {
+// //寮�濮嬭矾寰�
+// NavigateNode startPath = nodes.get(0);
+// //涓棿璺緞
+// NavigateNode middlePath = nodes.get(nodes.size() - 2);
+// //鐩爣璺緞
+// NavigateNode endPath = nodes.get(nodes.size() - 1);
+// Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
+// Integer middleToDistDistance = NavigateUtils.getMiddleToDistDistance(nodes, middlePath);//璁$畻涓棿鐐瑰埌鐩爣鐐硅璧拌窛绂�
+// Short startCode = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());//寮�濮嬩簩缁寸爜
+// Short middleCode = NavigatePositionConvert.xyToPosition(middlePath.getX(), middlePath.getY(), middlePath.getZ());//涓棿浜岀淮鐮�
+// Short distCode = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());//鐩爣浜岀淮鐮�
+// endStartCode = distCode;
+// //姝e父绉诲姩鍛戒护
+// commands.add(getMoveCommand(startCode, distCode, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id, middleCode, middleToDistDistance, runSpeed));
+// }
+// }
+//
+// if (endStartCode == null && shuttleProtocol.getCurrentCode() == Short.parseShort(liftSitelocMast.getQrCodeValue())) {
+// //绌挎杞﹀凡缁忓湪鎻愬崌鏈虹珯鐐瑰彛
+// endStartCode = shuttleProtocol.getCurrentCode();
+// }
+//
+// //澧炲姞绉诲姩杩涙彁鍗囨満鍛戒护
+// ShuttleCommand moveCommand = getMoveCommand(endStartCode, liftProtocol.getBarcode(), 1600, ShuttleRunDirection.TOP.id, null, null, runSpeed);
+// commands.add(moveCommand);
+// break;
+// default:
+// }
+// assignCommand.setCommands(commands);
+// assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
+// }
+//
+// redisCommand.setShuttleNo(assignCommand.getShuttleNo());//鍥涘悜绌挎杞﹀彿
+// redisCommand.setWrkNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
+// redisCommand.setCommandStep(0);//鍛戒护鎵ц姝ュ簭
+// redisCommand.setAssignCommand(assignCommand);//鍛戒护
+// redisCommand.setErrorCommands(new ArrayList<ShuttleCommand>());//鍙戠敓閿欒鏃跺皾璇曟墽琛岀殑鎸囦护锛屼紭鍏堢骇鏈�楂�
+// shuttleProtocol.setTaskNo(assignCommand.getTaskNo());
+// shuttleProtocol.setAssignCommand(assignCommand);
+// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WORKING);
+// //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+// redisUtil.set("shuttle_wrk_no_" + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand));
+// //鎵ц涓嬪彂浠诲姟
+// executeWork(assignCommand.getTaskNo());
+ }
+
+ //鎵ц涓嬪彂鐨勬寚浠�
+ private boolean executeWork(Integer wrkNo) {
+// //璇诲彇redis鏁版嵁
+// if (wrkNo == null) {
+// return false;
+// }
+//
+// WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
+//
+// Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
+// if (o == null) {
+// return false;
+// }
+// ShuttleRedisCommand redisCommand = JSON.parseObject(o.toString(), ShuttleRedisCommand.class);
+//
+// if (shuttleProtocol.getBusyStatus().intValue() == ShuttleStatusType.BUSY.id) {
+// return false;//灏忚溅鐘舵�佸繖
+// }
+//
+// if (!checkLiftStation(wrkNo)) {//妫�娴嬫槸鍚︽湁鎻愬崌鏈虹珯鐐癸紝鏈夊垯璋冨害鎻愬崌鏈�
+// return false;
+// }
+//
+// LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
+// LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+//
+// List<ShuttleCommand> commands = redisCommand.getAssignCommand().getCommands();
+// //褰撳墠姝ュ簭
+// int commandStep = redisCommand.getCommandStep();
+// //path璺緞鏁扮洰
+// int size = commands.size();
+// ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand();
+//
+// if (commandStep != 0) {
+// //鍒ゆ柇涓婁竴鏉℃寚浠ゆ槸鍚﹀畬鎴�
+// ShuttleCommand command = commands.get(commandStep - 1);
+// if (command.getCommandWord().intValue() == 1) {
+// //绉诲姩鍛戒护
+// if (command.getDistCodeNum().intValue() == shuttleProtocol.getCurrentCode().intValue()) {
+// //涓婁竴鏉℃寚浠ょ殑鐩爣浣嶇疆鍜屽綋鍓嶅皬杞︿綅缃浉鍚岋紝鍒欒瀹氫笂涓�鏉′换鍔″畬鎴�
+// command.setComplete(true);
+//
+// //涓婁竴鏉℃寚浠よ捣鐐规槸鎻愬崌鏈轰簩缁寸爜锛屽垯娓呴浂鎻愬崌鏈轰换鍔″彿
+// if (command.getStartCodeNum().intValue() == liftProtocol.getBarcode().intValue()) {
+// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹀浜庣┖闂�
+// if (liftProtocol.isIdleNoTask() && liftProtocol.getTaskNo().intValue() == redisCommand.getWrkNo().intValue()) {
+// liftProtocol.setTaskNo((short) 0);//娓呯┖浠诲姟鍙�
+// WrkMast wrkMast = wrkMastService.selectById(wrkNo);
+// if (wrkMast != null) {
+// wrkMast.setLiftNo(null);//瑙i攣鎻愬崌鏈�
+// wrkMastService.updateById(wrkMast);
+// }
+// }
+// }
+//
+// //鍏ュ簱鍛戒护锛屽綋灏忚溅鍙栧畬璐у悗锛岄渶瑕佸皢鎻愬崌鏈洪噴鏀�
+// if (assignCommand.getTaskMode().intValue() == ShuttleTaskModeType.PAK_IN.id) {
+// //鍒ゆ柇涓婁竴鏉℃寚浠ょ殑璧风偣鏄惁涓鸿緭閫佺珯鐐逛笖鐩爣鐐逛笉鏄彁鍗囨満鍐呴儴浜岀淮鐮�
+// Short startCodeNum = command.getStartCodeNum();
+// BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+// BasDevp basDevp = basDevpService.queryByQrCode(startCodeNum.intValue());//鐩爣绔欑偣
+// if (basDevp != null && command.getDistCodeNum().intValue() != liftProtocol.getBarcode().intValue()) {
+// //涓婁竴鏉℃寚浠ょ殑璧风偣涓鸿緭閫佺珯鐐逛笖鐩爣鐐逛笉鏄彁鍗囨満鍐呴儴浜岀淮鐮�
+// //姝ゆ椂灏忚溅搴旇宸茬粡绂诲紑杈撻�佺珯鐐癸紝鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂蹭笖鏈夊伐浣滃彿
+// if (liftProtocol.isIdleNoTask() && liftProtocol.getTaskNo().intValue() == redisCommand.getWrkNo().intValue()) {
+// liftProtocol.setTaskNo((short) 0);//娓呯┖浠诲姟鍙�
+// WrkMast wrkMast = wrkMastService.selectById(wrkNo);
+// if (wrkMast != null) {
+// wrkMast.setLiftNo(null);//瑙i攣鎻愬崌鏈�
+// wrkMastService.updateById(wrkMast);
+// }
+// }
+// }
+// }
+//
+// }
+// } else if (command.getCommandWord().intValue() == 2) {
+// //鎵樼洏椤跺崌鍛戒护
+// if (command.getPalletLift().intValue() == 1) {
+// //椤跺崌
+// //鍒ゆ柇鏄惁椤跺崌鍒颁綅
+// if (shuttleProtocol.getPlcOutputLift()) {
+// //鑷姩妯″紡
+// if (assignCommand.getAuto() && shuttleProtocol.getPlcInputStatus().intValue() == 1) {
+// //椤跺崌鍒颁綅,涓旀墭鐩橀浄杈炬湁鐗╋紝璁ゅ畾浠诲姟瀹屾垚
+// command.setComplete(true);
+// }else {
+// //鎵嬪姩妯″紡锛屼笉鍒ゆ柇鎵樼洏闆疯揪
+// //椤跺崌鍒颁綅锛岃瀹氫换鍔″畬鎴�
+// command.setComplete(true);
+// }
+// }
+// }else {
+// //涓嬮檷
+// //鍒ゆ柇鏄惁涓嬮檷鍒颁綅锛屽垽鏂墭鐩橀浄杈炬槸鍚︽棤鐗�
+// if (!shuttleProtocol.getPlcOutputLift() && !shuttleProtocol.getPlcOutputTransfer()) {
+// //鑷姩妯″紡
+// if (assignCommand.getAuto() && shuttleProtocol.getPlcInputStatus().intValue() == 0) {
+// //涓嬮檷鍒颁綅锛屼笖鎵樼洏闆疯揪鏃犵墿锛岃瀹氫换鍔″畬鎴�
+// command.setComplete(true);
+// }else {
+// //鎵嬪姩妯″紡锛屼笉鍒ゆ柇鎵樼洏闆疯揪
+// //涓嬮檷鍒颁綅锛屼笖鎵樼洏闆疯揪鏃犵墿锛岃瀹氫换鍔″畬鎴�
+// command.setComplete(true);
+// }
+// }
+// }
+// } else if (command.getCommandWord().intValue() == 5) {
+// //鍏呯數鍛戒护
+// //鍒ゆ柇灏忚溅鍏呯數寮�鍏�
+// if (shuttleProtocol.getPlcOutputCharge()) {
+// //姝e父鍏呯數锛岃瀹氫换鍔″畬鎴�
+// command.setComplete(true);
+// }
+// }
+// //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+// redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+//
+// if (!command.getComplete()) {
+// //涓婁竴鏉′换鍔℃湭瀹屾垚锛岀姝笅鍙戝懡浠�
+// return false;
+// }
+// }
+//
+// if (commands.size() == 0) {
+// return false;
+// }
+//
+// //鍙栧嚭鍛戒护
+// ShuttleCommand command = commands.get(commandStep);
+//
+// if (assignCommand.getTaskMode() == ShuttleTaskModeType.PAK_IN.id.shortValue()
+// || assignCommand.getTaskMode() == ShuttleTaskModeType.PAK_OUT.id.shortValue()
+// ) {
+// //灏忚溅澶卞幓鍧愭爣锛岀姝笅鍙戝懡浠�
+// if (shuttleProtocol.getCurrentCode() == 0) {
+// return false;
+// }
+// }
+//
+//
+// //鍒ゆ柇灏忚溅褰撳墠浜岀淮鐮佹槸鍚︿负鎻愬崌鏈轰簩缁寸爜
+// if (shuttleProtocol.getCurrentCode().intValue() == liftProtocol.getBarcode().intValue()) {
+// //灏忚溅褰撳墠鍛戒护璧峰浣嶇疆灏辨槸鎻愬崌鏈轰簩缁寸爜锛岃鏄庡皬杞﹂渶瑕佸悜鎻愬崌鏈哄绉诲姩锛屽垯闇�瑕佸垽鏂姸鎬佹槸鍚︽弧瓒�
+// if (command.getStartCodeNum().intValue() == liftProtocol.getBarcode().intValue()){
+// //鎻愬崌鏈烘槸鍚︾┖闂诧紝鎻愬崌鏈烘槸鍚﹀埌杈剧洰鏍囨ゼ灞傦紝鐩爣妤煎眰鏄惁缁欏嚭鎻愬崌鏈哄埌浣嶄俊鍙蜂綅
+// if (!liftProtocol.isIdleNoTask()) {
+// return false;//鎻愬崌鏈哄繖锛岀姝笅鍙戝懡浠�
+// }
+// if (liftProtocol.getTaskNo().intValue() != 0 && liftProtocol.getTaskNo().intValue() != wrkNo) {
+// //鎻愬崌鏈哄伐浣滃彿鍜屽綋鍓嶅伐浣滀笉鐩稿悓锛岀姝笅鍙戝懡浠�
+// return false;
+// }
+//
+// Short distCodeNum = command.getDistCodeNum();//鐩爣浜岀淮鐮�
+// BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+// BasDevp basDevp = basDevpService.queryByQrCode(distCodeNum.intValue());//鐩爣绔欑偣
+// if (basDevp == null) {
+// return false;//鎵句笉鍒扮洰鏍囩珯锛岀姝笅鍙戝懡浠�
+// }
+//
+// int lev = Utils.getLev(basDevp.getLocNo());//鐩爣浜岀淮鐮佹墍鍦ㄦゼ灞�
+// int liftLev = liftProtocol.getLev().intValue();//鎻愬崌鏈烘墍鍦ㄦゼ灞�
+// if (liftLev != lev) {
+// return false;//鎻愬崌鏈轰笉鍦ㄧ洰鏍囨ゼ灞傦紝绂佹涓嬪彂鍛戒护
+// }
+//
+// //鑾峰彇鐩爣绔欎俊鎭�
+// SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+// StaProtocol staProtocol = devpThread.getStation().get(basDevp.getDevNo());
+// if (staProtocol == null) {
+// return false;//绔欑偣淇℃伅涓嶅瓨鍦紝绂佹涓嬪彂鍛戒护
+// }
+// if (!staProtocol.isLiftArrival()) {
+// return false;//绔欑偣鎻愬崌鏈哄埌浣嶄俊鍙穎alse锛岀姝笅鍙戝懡浠�
+// }
+//
+// //鏉′欢婊¤冻锛屽崰鐢ㄦ彁鍗囨満
+// liftProtocol.setTaskNo(wrkNo);
+// }
+// }
+//
+// //涓嬪彂鍛戒护
+// if (!write(command)) {
+// News.error("鍥涘悜绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+// return false;
+// } else {
+// News.info("鍥涘悜绌挎杞﹀懡浠や笅鍙戞垚鍔燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+//
+// //灏嗘爣璁扮疆涓篺alse(闃叉閲嶅彂)
+// shuttleProtocol.setPakMk(false);
+//
+// //淇濆瓨鏁版嵁鍒版暟鎹簱鍋氭祦姘�
+// BasShuttleOptService shuttleOptService = SpringUtils.getBean(BasShuttleOptService.class);
+// if (shuttleOptService != null) {
+// short[] commandArr = getCommandArr(command);//鑾峰彇鍛戒护鎶ユ枃
+// BasShuttleOpt opt = new BasShuttleOpt(
+// assignCommand.getTaskNo().intValue(),
+// assignCommand.getShuttleNo().intValue(),
+// new Date(),
+// ShuttleTaskModeType.get(assignCommand.getTaskMode()).desc,
+// assignCommand.getSourceLocNo(),
+// assignCommand.getLocNo(),
+// null,
+// null,
+// null,
+// JSON.toJSONString(command),
+// JSON.toJSONString(commandArr)
+// );
+// shuttleOptService.insert(opt);
+// }
+//
+// //鍒ゆ柇鏁版嵁鏄惁鎵ц瀹屾垚
+// if (commandStep < size - 1) {
+// //鏇存柊redis鏁版嵁
+// //姝ュ簭澧炲姞
+// commandStep++;
+// redisCommand.setCommandStep(commandStep);
+// //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+// redisUtil.set("shuttle_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+// }else {
+// //宸叉墽琛屽畬鎴�
+//
+// if (redisCommand.getLiftSecurityMk()) {
+// //鏇鹃攣瀹氳繃鎻愬崌鏈猴紝闇�瑕佽繘琛岃В閿�
+// if (liftProtocol != null) {
+// liftProtocol.setSecurityMk(false);
+// }
+// }
+//
+// String locNo = shuttleProtocol.getLocNo() == null ? shuttleProtocol.getSourceLocNo() : shuttleProtocol.getLocNo();
+// if (locNo != null) {
+// //瑙i櫎閿佸畾鐨勫簱浣嶈矾寰�
+// NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(locNo));
+// navigateMapData.writeNavigateNodeToRedisMap(redisCommand.getAssignCommand().getNodes(), false);
+// }
+//
+// //鍒犻櫎redis
+// redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo());
+//
+// if (!assignCommand.getAuto()) {
+// //鎵嬪姩妯″紡涓嶆姏鍑虹瓑寰呯姸鎬侊紝鐩存帴澶嶄綅
+// //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
+// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+// //浠诲姟鍙锋竻闆�
+// shuttleProtocol.setTaskNo((short) 0);
+// //鏍囪澶嶄綅
+// shuttleProtocol.setPakMk(true);
+// News.info("鍥涘悜绌挎杞︽墜鍔ㄤ换鍔℃墽琛屽畬鎴愶紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+// }else {
+// if (!assignCommand.getCharge()) {
+// //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+// }else {
+// shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
+// }
+// News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+// }
+//
+// }
+//
+// }
+ return true;
+ }
+
+}
diff --git a/src/main/java/com/zy/core/thread/ShuttleThread.java b/src/main/java/com/zy/core/thread/ShuttleThread.java
index 6171b4d..8a43bc3 100644
--- a/src/main/java/com/zy/core/thread/ShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -190,61 +190,61 @@
shuttleProtocol.setPakMk(true);
}
- //灏嗗洓鍚戠┛姊溅鐘舵�佷繚瀛樿嚦鏁版嵁搴�
- BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
- BasShuttle basShuttle = shuttleService.selectById(slave.getId());
- if (basShuttle == null) {
- basShuttle = new BasShuttle();
- //鍥涘悜绌挎杞﹀彿
- basShuttle.setShuttleNo(slave.getId());
- shuttleService.insert(basShuttle);
- }
- //灏忚溅蹇欑姸鎬佷綅
- basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue());
- //褰撳墠浜岀淮鐮�
- basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue());
- //鐢垫睜鐢甸噺鐧惧垎姣�
- basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue());
- //鐢垫睜娓╁害
- basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue());
- //閿欒缂栧彿
- basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue());
- //Plc杈撳嚭鐘舵�両O
- basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue());
- //閿欒淇℃伅鐮�
- basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue());
- //PLC杈撳叆鐘舵��
- basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue());
- //褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
- basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue());
- //璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
- basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue());
- //璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
- basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue());
- //褰撳墠鐨勭數鍘嬪��
- basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue());
- //褰撳墠鐨勬ā鎷熼噺鍊�
- basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue());
- //褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
- basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue());
- //褰撳墠鐨勮璧颁己鏈嶉�熷害
- basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue());
- //褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
- basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue());
- //褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
- basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue());
- //褰撳墠灏忚溅鐘舵�侊紙鍐呴儴鑷垜缁存姢锛�
- basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus());
- //浠诲姟鍙�
- basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue());
- //淇敼鏃堕棿
- basShuttle.setUpdateTime(new Date());
- //浣滀笟鏍囪
- basShuttle.setPakMk(shuttleProtocol.getPakMk());
- if (shuttleService.updateById(basShuttle)) {
- OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
-// log.info(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
- }
+// //灏嗗洓鍚戠┛姊溅鐘舵�佷繚瀛樿嚦鏁版嵁搴�
+// BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+// BasShuttle basShuttle = shuttleService.selectById(slave.getId());
+// if (basShuttle == null) {
+// basShuttle = new BasShuttle();
+// //鍥涘悜绌挎杞﹀彿
+// basShuttle.setShuttleNo(slave.getId());
+// shuttleService.insert(basShuttle);
+// }
+// //灏忚溅蹇欑姸鎬佷綅
+// basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue());
+// //褰撳墠浜岀淮鐮�
+// basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue());
+// //鐢垫睜鐢甸噺鐧惧垎姣�
+// basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue());
+// //鐢垫睜娓╁害
+// basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue());
+// //閿欒缂栧彿
+// basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue());
+// //Plc杈撳嚭鐘舵�両O
+// basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue());
+// //閿欒淇℃伅鐮�
+// basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue());
+// //PLC杈撳叆鐘舵��
+// basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue());
+// //褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+// basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue());
+// //璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+// basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue());
+// //璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+// basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue());
+// //褰撳墠鐨勭數鍘嬪��
+// basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue());
+// //褰撳墠鐨勬ā鎷熼噺鍊�
+// basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue());
+// //褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+// basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue());
+// //褰撳墠鐨勮璧颁己鏈嶉�熷害
+// basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue());
+// //褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+// basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue());
+// //褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+// basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue());
+// //褰撳墠灏忚溅鐘舵�侊紙鍐呴儴鑷垜缁存姢锛�
+// basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus());
+// //浠诲姟鍙�
+// basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue());
+// //淇敼鏃堕棿
+// basShuttle.setUpdateTime(new Date());
+// //浣滀笟鏍囪
+// basShuttle.setPakMk(shuttleProtocol.getPakMk());
+// if (shuttleService.updateById(basShuttle)) {
+// OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+//// log.info(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+// }
}else {
OutputQueue.SHUTTLE.offer(MessageFormat.format("銆恵0}銆憑1}鍥涘悜绌挎杞lc鐘舵�佷俊鎭け璐�", DateUtils.convert(new Date()), slave.getId()));
@@ -414,12 +414,12 @@
//鑾峰彇灏忚溅绉诲姩閫熷害
BasShuttle basShuttle = shuttleService.selectById(slave.getId());
Integer runSpeed = 1000;
- if (basShuttle != null) {
- Integer runSpeed1 = basShuttle.getRunSpeed();
- if (runSpeed1 != null) {
- runSpeed = runSpeed1;
- }
- }
+// if (basShuttle != null) {
+// Integer runSpeed1 = basShuttle.getRunSpeed();
+// if (runSpeed1 != null) {
+// runSpeed = runSpeed1;
+// }
+// }
LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, 1);
LiftProtocol liftProtocol = liftThread.getLiftProtocol();
diff --git a/src/main/resources/mapper/BasShuttleMapper.xml b/src/main/resources/mapper/BasShuttleMapper.xml
index 181726d..a511c7b 100644
--- a/src/main/resources/mapper/BasShuttleMapper.xml
+++ b/src/main/resources/mapper/BasShuttleMapper.xml
@@ -18,23 +18,47 @@
<result column="memo" property="memo" />
<result column="lift_no" property="liftNo" />
<result column="pak_mk" property="pakMk" />
- <result column="busy_status" property="busyStatus" />
- <result column="current_code" property="currentCode" />
- <result column="battery_power" property="batteryPower" />
- <result column="battery_temp" property="batteryTemp" />
- <result column="error_code" property="errorCode" />
- <result column="plc_output_status_io" property="plcOutputStatusIo" />
- <result column="status_error_code" property="statusErrorCode" />
- <result column="plc_input_status" property="plcInputStatus" />
- <result column="current_or_before_code" property="currentOrBeforeCode" />
- <result column="code_offset_x" property="codeOffsetX" />
- <result column="code_offset_y" property="codeOffsetY" />
- <result column="current_voltage" property="currentVoltage" />
- <result column="current_analog_value" property="currentAnalogValue" />
- <result column="current_lift_servo_speed" property="currentLiftServoSpeed" />
- <result column="current_move_servo_speed" property="currentMoveServoSpeed" />
- <result column="current_lift_servo_load" property="currentLiftServoLoad" />
- <result column="current_move_servo_load" property="currentMoveServoLoad" />
+<!-- <result column="busy_status" property="busyStatus" />-->
+<!-- <result column="current_code" property="currentCode" />-->
+<!-- <result column="battery_power" property="batteryPower" />-->
+<!-- <result column="battery_temp" property="batteryTemp" />-->
+<!-- <result column="error_code" property="errorCode" />-->
+<!-- <result column="plc_output_status_io" property="plcOutputStatusIo" />-->
+<!-- <result column="status_error_code" property="statusErrorCode" />-->
+<!-- <result column="plc_input_status" property="plcInputStatus" />-->
+<!-- <result column="current_or_before_code" property="currentOrBeforeCode" />-->
+<!-- <result column="code_offset_x" property="codeOffsetX" />-->
+<!-- <result column="code_offset_y" property="codeOffsetY" />-->
+<!-- <result column="current_voltage" property="currentVoltage" />-->
+<!-- <result column="current_analog_value" property="currentAnalogValue" />-->
+<!-- <result column="current_lift_servo_speed" property="currentLiftServoSpeed" />-->
+<!-- <result column="current_move_servo_speed" property="currentMoveServoSpeed" />-->
+<!-- <result column="current_lift_servo_load" property="currentLiftServoLoad" />-->
+<!-- <result column="current_move_servo_load" property="currentMoveServoLoad" />-->
+
+ <result column="working_mode" property="workingMode" />
+ <result column="free" property="free" />
+ <result column="speed" property="speed" />
+ <result column="load_state" property="loadState" />
+ <result column="suspend_state" property="suspendState" />
+ <result column="lift_position" property="liftPosition" />
+ <result column="run_dir" property="runDir" />
+ <result column="run_dir2" property="runDir2" />
+ <result column="charg_state" property="chargState" />
+ <result column="power_percent" property="powerPercent" />
+ <result column="max_cell_voltage" property="maxCellVoltage" />
+ <result column="min_cell_voltage" property="minCellVoltage" />
+ <result column="voltage" property="voltage" />
+ <result column="charge_cycle_times" property="chargeCycleTimes" />
+ <result column="surplus_quantity" property="surplusQuantity" />
+ <result column="count_quantity" property="countQuantity" />
+ <result column="point" property="point" />
+ <result column="coord" property="coord" />
+ <result column="task" property="task" />
+ <result column="task_state" property="taskState" />
+ <result column="err_state" property="errState" />
+ <result column="status_sum" property="statusSum" />
+ <result column="err_time" property="errTime" />
</resultMap>
diff --git a/src/main/webapp/static/readStatus.json b/src/main/webapp/static/readStatus.json
new file mode 100644
index 0000000..33593c4
--- /dev/null
+++ b/src/main/webapp/static/readStatus.json
@@ -0,0 +1,58 @@
+{
+ "msgType": "responseMsg",
+ "robotId": 50001,
+ "response": {
+ "header": {
+ "responseId": 1234,
+ "version": "1.0"
+ },
+ "body": {
+ "responseType": "state",
+ "workingMode": 1,
+ "free": 1,
+ "speed": 1000,
+ "loadState": 1,
+ "suspendState": 0,
+ "liftPosition": 1,
+ "runDir": 1,
+ "runDir2": 1,
+ "chargState": 0,
+ "powerPercent": 0,
+ "maxCellVoltage": 4165,
+ "minCellVoltage": 4147,
+ "voltage": 5405,
+ "chargeCycleTimes": 0,
+ "surplusQuantity": 450,
+ "countQuantity": 500,
+ "point": {
+ "x": 1,
+ "y": 2,
+ "z": 1
+ },
+ "coord": {
+ "x": 1000,
+ "y": 2000,
+ "z": 1
+ },
+ "task": {
+ "x": 1,
+ "y": 2,
+ "z": 1,
+ "taskState": 0,
+ "taskId": 0,
+ "lastTaskId": 0,
+ "recentTaskId": 0
+ },
+ "errState": 1,
+ "errCode": [0, 0, 0, 0, 0],
+ "statusSum": {
+ "mileage": 0,
+ "liftNumber": 0,
+ "dropNumber": 0,
+ "reversingX": 0,
+ "reversingY": 0
+ },
+ "errTime": 68391
+ }
+ }
+}
diff --git a/src/main/webapp/views/shuttle.html b/src/main/webapp/views/shuttle.html
index c0621a7..d5be706 100644
--- a/src/main/webapp/views/shuttle.html
+++ b/src/main/webapp/views/shuttle.html
@@ -35,21 +35,17 @@
<th>鍥涘悜绌挎杞�</th>
<th>浠诲姟鐘舵��</th>
<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>
+ <th>褰撳墠閫熷害</th>
+ <th>璐熻浇鐘舵��</th>
+ <th>椤跺崌浣嶇疆</th>
+ <th>杩愯鏂瑰悜</th>
+ <th>杩愯鏂瑰悜2</th>
+ <th>鍏呯數鐘舵��</th>
+ <th>鏁呴殰鐘舵��</th>
+ <th>鏁呴殰鐮�</th>
</tr>
</thead>
<tbody>
@@ -64,16 +60,16 @@
<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>
+ <th>鎬婚噷绋嬫暟</th>
<th>浣滀笟鏍囪</th>
- <th>搴撲綅鍙�</th>
- <th>褰撳墠妤煎眰</th>
</tr>
</thead>
<tbody>
@@ -274,7 +270,7 @@
pakMk: $('#pakMk').val(),
}, function (res) {
layer.msg("淇敼鎴愬姛", {icon: 1,});
- layer.close(layerIdx);
+ layer.close(layerDetl);
})
})
@@ -331,23 +327,19 @@
// $("#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);
+ 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].point$);
+ setVal(tr.children("td").eq(4), table[i-1].coord$);
+ setVal(tr.children("td").eq(5), table[i-1].powerPercent$);
+ setVal(tr.children("td").eq(6), table[i-1].speed);
+ setVal(tr.children("td").eq(7), table[i-1].loadState$);
+ setVal(tr.children("td").eq(8), table[i-1].liftPosition$);
+ setVal(tr.children("td").eq(9), table[i-1].runDir$);
+ setVal(tr.children("td").eq(10), table[i-1].runDir2$);
+ setVal(tr.children("td").eq(11), table[i-1].chargState$);
+ setVal(tr.children("td").eq(12), table[i-1].errState$);
+ setVal(tr.children("td").eq(13), table[i-1].errCode);
}
} else if (res.code === 403){
window.location.href = baseUrl+"/login";
@@ -362,7 +354,7 @@
function getShuttleMsgInfo() {
let tableEl = $('#shuttle-msg-table');
$.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/msg",
+ url: baseUrl+ "/shuttle/table/shuttle/state",
headers: {'token': localStorage.getItem('token')},
method: 'POST',
success: function (res) {
@@ -375,18 +367,17 @@
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);
-
+ 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.mileage);
+ setVal(tr.children("td").eq(11), table[i-1].pakMk$);
if (table[i-1].shuttleNo == parseInt($('input[name="shuttleSelect"]:checked').val())) {
$("#runSpeedText").text(table[i-1].runSpeed)
$("#chargeLineText").text(table[i-1].chargeLine + "%")
@@ -554,7 +545,7 @@
content: $("#shuttle-detl"),
success: function(layero, index){
$.ajax({
- url: baseUrl+ "/shuttle/table/shuttle/msg",
+ url: baseUrl+ "/shuttle/table/shuttle/state",
headers: {'token': localStorage.getItem('token')},
method: 'POST',
success: function (res) {
@@ -563,8 +554,8 @@
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);
+ $('#workNo').val(table[i-1].taskNo);
+ $('#pakMk').val(table[i-1].pakMk$);
}
}
} else if (res.code === 403){
diff --git a/src/main/webapp/views/shuttle_zs.html b/src/main/webapp/views/shuttle_zs.html
new file mode 100644
index 0000000..c0621a7
--- /dev/null
+++ b/src/main/webapp/views/shuttle_zs.html
@@ -0,0 +1,595 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>鍥涘悜绌挎杞︾洃鎺х鐞�</title>
+ <link rel="stylesheet" type="text/css" href="../static/css/normalize.css">
+ <link rel="stylesheet" type="text/css" href="../static/css/common.css">
+ <link rel="stylesheet" type="text/css" href="../static/layui/css/layui.css">
+ <link rel="stylesheet" href="../static/css/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>
--
Gitblit v1.9.1