From 5b5bf0d3fb08926b700b9d9ef127eb86d3241725 Mon Sep 17 00:00:00 2001
From: TQS <56479841@qq.com>
Date: 星期三, 16 四月 2025 15:09:12 +0800
Subject: [PATCH] 添加小车定位失败日志打印
---
src/main/java/com/zy/asrs/controller/SteController.java | 87 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 83 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/SteController.java b/src/main/java/com/zy/asrs/controller/SteController.java
index 7ff7b92..415685f 100644
--- a/src/main/java/com/zy/asrs/controller/SteController.java
+++ b/src/main/java/com/zy/asrs/controller/SteController.java
@@ -7,12 +7,16 @@
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.CrnStatusType;
+import com.zy.asrs.domain.param.CrnDemoParam;
+import com.zy.asrs.domain.param.SteModeParam;
import com.zy.asrs.domain.param.SteOperatorParam;
import com.zy.asrs.domain.vo.SteMsgTableVo;
import com.zy.asrs.domain.vo.SteStateTableVo;
import com.zy.asrs.domain.vo.SteDataVo;
import com.zy.asrs.entity.BasSte;
+import com.zy.asrs.entity.BasSteErr;
import com.zy.asrs.entity.WrkMast;
+import com.zy.asrs.mapper.BasSteErrMapper;
import com.zy.asrs.service.BasSteService;
import com.zy.asrs.service.WrkMastService;
import com.zy.core.cache.MessageQueue;
@@ -20,11 +24,13 @@
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.SteTaskModeType;
+import com.zy.core.model.CrnSlave;
import com.zy.core.model.SteSlave;
import com.zy.core.model.Task;
import com.zy.core.model.command.SteCommand;
import com.zy.core.model.protocol.SteProtocol;
import com.zy.core.properties.SlaveProperties;
+import com.zy.core.properties.SystemProperties;
import com.zy.core.thread.SteThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +55,8 @@
private BasSteService basSteService;
@Autowired
private WrkMastService wrkMastService;
+ @Autowired
+ private BasSteErrMapper basSteErrMapper;
@PostMapping("/table/ste/state")
@ManagerAuth(memo = "绌挎杞︿俊鎭〃")
@@ -69,8 +77,22 @@
if (steProtocol == null) {
continue;
}
- vo.setTaskNo(steProtocol.getTaskNo()); // 浠诲姟鍙�
- vo.setStatusType(steProtocol.mode == 0 ? "绂荤嚎" : "鍦ㄧ嚎"); // 妯″紡鐘舵��
+ vo.setTaskNo(steProtocol.getTaskNo().intValue()); // 浠诲姟鍙�
+ vo.setStatusVal(steProtocol.getMode().intValue()); // 鍦ㄧ嚎鐘舵��
+ String modeName = "绂荤嚎";
+ switch (steProtocol.mode){
+ case -1:
+ modeName = "绂荤嚎";
+ break;
+ case 0:
+ modeName = "鑴辨満";
+ break;
+ case 1:
+ modeName = "鑱旀満";
+ break;
+ }
+ vo.setStatusType(modeName); // 妯″紡
+// vo.setStatusType(steProtocol.mode == 0 ? "绂荤嚎" : "鍦ㄧ嚎"); // 妯″紡鐘舵��
if (!Cools.isEmpty(steProtocol.getStatus())) {
vo.setStatus(steProtocol.getStatusType().desc); // 鐘舵��
}
@@ -95,6 +117,16 @@
if (!Cools.isEmpty(steProtocol.getTrack())) {
vo.setTrack(steProtocol.getTrack()==0?"鉁�":"脳");
}
+ if (!Cools.isEmpty(steProtocol.getChargeStatus())) {
+ vo.setChargeStatus(steProtocol.getChargeStatus()==1?"鉁�":"脳");
+ }
+ if(Cools.isEmpty(steProtocol.getAlarm())){
+ vo.setAlarm1("鏈煡寮傚父");
+ } else if(!Cools.isEmpty(steProtocol.getAlarm()) && steProtocol.getAlarm() > 0){
+ BasSteErr steErr = basSteErrMapper.selectById(steProtocol.getAlarm());
+ vo.setAlarm1(steErr==null?"鏈煡寮傚父":steErr.getErrName());
+ }
+ vo.setAlarm2(Cools.isEmpty(steProtocol.getAlarm0())? "鏈煡":steProtocol.getAlarm0().toString());
}
return R.ok().add(list);
}
@@ -119,7 +151,7 @@
continue;
}
- vo.setWorkNo(steProtocol.getTaskNo()); // 浠诲姟鍙�
+ vo.setWorkNo(steProtocol.getTaskNo().intValue()); // 浠诲姟鍙�
if (steProtocol.getTaskNo() > 0) {
WrkMast wrkMast = wrkMastService.selectById(steProtocol.getTaskNo());
if (wrkMast != null) {
@@ -183,13 +215,19 @@
// 鑾峰彇绌挎杞︿俊鎭�
SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, vo.getSteNo());
SteProtocol steProtocol = steThread.getSteProtocol();
- if (steProtocol != null) {
+ if (steProtocol == null) {
throw new CoolException(vo.getSteNo() + "鍙风┛姊溅涓嶅湪绾匡紝鏃犳硶淇濆瓨");
}
if (!Cools.isEmpty(vo.getRow(), vo.getBay(), vo.getLev())) {
if (!steThread.modifyPosHandle(vo.getRow(), vo.getBay(), vo.getLev())) {
throw new CoolException("鏈嶅姟鍣ㄩ敊璇�");
}
+ }
+ SteCommand steCommand = new SteCommand();
+ steCommand.setTaskNo(vo.getWorkNo());
+ if (MessageQueue.offer(SlaveType.Ste, vo.getSteNo(), new Task(2, steCommand))) {
+ } else {
+ throw new CoolException("鍛戒护涓嬪彂澶辫触");
}
basSte.setPakMk(vo.getPakMk());
basSte.setWrkNo(vo.getWorkNo());
@@ -205,6 +243,43 @@
/****************************************************************/
/************************** 鎵嬪姩鎿嶄綔 ******************************/
/****************************************************************/
+
+ @PostMapping("/mode/switch")
+ @ManagerAuth
+ public R crnDemo(SteModeParam param) throws InterruptedException {
+ if (Cools.isEmpty(param.getSteNo())){
+ return R.error();
+ }
+ if (Cools.isEmpty(param.getPassword())){
+ return R.error("璇疯緭鍏ュ彛浠�");
+ }
+ if (!param.getPassword().equals(SystemProperties.WCS_PASSWORD)){
+ return R.error("鍙d护閿欒");
+ }
+ Thread.sleep(200L);
+ for (SteSlave steSlave : slaveProperties.getSte()) {
+ if (steSlave.getId().equals(param.getSteNo())) {
+ // 鑾峰彇绌挎杞︿俊鎭�
+ SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steSlave.getId());
+ SteProtocol steProtocol = steThread.getSteProtocol();
+ if (steProtocol == null) { continue; }
+ if (steProtocol.loca==0) continue;
+ SteCommand steCommand = new SteCommand();
+ steCommand.setSteNo(param.getSteNo()); // 绌挎杞︾紪鍙�
+ if (steProtocol.getMode() == 0) {
+ steCommand.setControlMode((short) 1);
+ } else {
+ steCommand.setControlMode((short) 0);
+ }
+ if (MessageQueue.offer(SlaveType.Ste, param.getSteNo(), new Task(2, steCommand))) {
+ return R.ok();
+ } else {
+ throw new CoolException("鍛戒护涓嬪彂澶辫触");
+ }
+ }
+ }
+ return R.ok();
+ }
@ManagerAuth(memo = "鎵嬪姩鎿嶄綔")
@PostMapping("/operator/ste")
@@ -229,6 +304,10 @@
steCommand.setSteNo(ste.getId()); // 绌挎杞︾紪鍙�
if (param.getSteTaskMode() == 16) {
steCommand.setComplete(true);
+ } else if (param.getSteTaskMode() == 99) {
+ steCommand.setControlMode((short) 1);
+ } else if (param.getSteTaskMode() == 100) {
+ steCommand.setControlMode((short) 0);
} else {
if (steTaskModeType == null) {
throw new CoolException("浠诲姟绫诲瀷閿欒");
--
Gitblit v1.9.1