From a3c70ef5ed3c18209b37ba01a8ab3eb0eea0d7cb Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 12 十二月 2023 16:49:52 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/CrnController.java | 65 ++++++++++++++++---------------- 1 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/CrnController.java b/src/main/java/com/zy/asrs/controller/CrnController.java index e7b9991..314a8fa 100644 --- a/src/main/java/com/zy/asrs/controller/CrnController.java +++ b/src/main/java/com/zy/asrs/controller/CrnController.java @@ -1,10 +1,7 @@ package com.zy.asrs.controller; -import HslCommunication.Profinet.Siemens.SiemensS7Net; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.plugins.Page; import com.core.annotations.ManagerAuth; import com.core.common.Cools; import com.core.common.R; @@ -22,8 +19,8 @@ import com.zy.asrs.service.LocMastService; import com.zy.asrs.service.WrkMastService; import com.zy.asrs.service.impl.MainServiceImpl; +import com.zy.asrs.utils.CommandUtils; import com.zy.asrs.utils.VersionUtils; -import com.zy.common.utils.HttpHandler; import com.zy.core.CrnThread; import com.zy.core.cache.MessageQueue; import com.zy.core.cache.OutputQueue; @@ -134,8 +131,8 @@ vo.setLiftPos(crnProtocol.getLiftPosType().desc); vo.setWalkPos(crnProtocol.getWalkPos()==1?"涓嶅湪瀹氫綅":"鍦ㄥ畾浣�"); vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); - if (crnProtocol.getAlarm1() > 0) { - BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm1()); + if (crnProtocol.getAlarm() > 0) { + BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); vo.setAlarm(crnError==null?"鏈煡寮傚父":crnError.getErrName()); } } @@ -384,12 +381,13 @@ command.setTaskNo((short) 0); // 宸ヤ綔鍙� command.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� command.setTaskMode(CrnTaskModeType.PAKIN); // 浠诲姟妯″紡 - command.setSourcePosX(param.getSourceRow()); // 婧愬簱浣嶆帓 - command.setSourcePosY(param.getSourceBay()); // 婧愬簱浣嶅垪 - command.setSourcePosZ(param.getSourceLev()); // 婧愬簱浣嶅眰 - command.setDestinationPosX(param.getRow()); // 鐩爣搴撲綅鎺� - command.setDestinationPosY(param.getBay()); // 鐩爣搴撲綅鍒� - command.setDestinationPosZ(param.getLev()); // 鐩爣搴撲綅灞� + command.setSourcePosZ(param.getSourceRow()); // 婧愬簱浣嶆帓 + command.setSourcePosX(param.getSourceBay()); // 婧愬簱浣嶅垪 + command.setSourcePosY(param.getSourceLev()); // 婧愬簱浣嶅眰 + command.setDestinationPosZ(param.getRow()); // 鐩爣搴撲綅鎺� + command.setDestinationPosX(param.getBay()); // 鐩爣搴撲綅鍒� + command.setDestinationPosY(param.getLev()); // 鐩爣搴撲綅灞� + command.setCommand((short)1); return crnControl(command)?R.ok():R.error(); } @@ -401,12 +399,12 @@ command.setTaskNo((short) 0); // 宸ヤ綔鍙� command.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� command.setTaskMode(CrnTaskModeType.PAKOUT); // 浠诲姟妯″紡 - command.setSourcePosX(param.getSourceRow()); // 婧愬簱浣嶆帓 - command.setSourcePosY(param.getSourceBay()); // 婧愬簱浣嶅垪 - command.setSourcePosZ(param.getSourceLev()); // 婧愬簱浣嶅眰 - command.setDestinationPosX(param.getRow()); // 鐩爣搴撲綅鎺� - command.setDestinationPosY(param.getBay()); // 鐩爣搴撲綅鍒� - command.setDestinationPosZ(param.getLev()); // 鐩爣搴撲綅灞� + command.setSourcePosZ(param.getSourceRow()); // 婧愬簱浣嶆帓 + command.setSourcePosX(param.getSourceBay()); // 婧愬簱浣嶅垪 + command.setSourcePosY(param.getSourceLev()); // 婧愬簱浣嶅眰 + command.setDestinationPosZ(param.getRow()); // 鐩爣搴撲綅鎺� + command.setDestinationPosX(param.getBay()); // 鐩爣搴撲綅鍒� + command.setDestinationPosY(param.getLev()); // 鐩爣搴撲綅灞� return crnControl(command)?R.ok():R.error(); } @@ -418,12 +416,13 @@ command.setTaskNo((short) 0); // 宸ヤ綔鍙� command.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� command.setTaskMode(CrnTaskModeType.LOC_MOVE); // 浠诲姟妯″紡 - command.setSourcePosX(param.getSourceRow()); // 婧愬簱浣嶆帓 - command.setSourcePosY(param.getSourceBay()); // 婧愬簱浣嶅垪 - command.setSourcePosZ(param.getSourceLev()); // 婧愬簱浣嶅眰 - command.setDestinationPosX(param.getRow()); // 鐩爣搴撲綅鎺� - command.setDestinationPosY(param.getBay()); // 鐩爣搴撲綅鍒� - command.setDestinationPosZ(param.getLev()); // 鐩爣搴撲綅灞� + command.setSourcePosZ(param.getSourceRow()); // 婧愬簱浣嶆帓 + command.setSourcePosX(param.getSourceBay()); // 婧愬簱浣嶅垪 + command.setSourcePosY(param.getSourceLev()); // 婧愬簱浣嶅眰 + command.setDestinationPosZ(param.getRow()); // 鐩爣搴撲綅鎺� + command.setDestinationPosX(param.getBay()); // 鐩爣搴撲綅鍒� + command.setDestinationPosY(param.getLev()); // 鐩爣搴撲綅灞� + command.setCommand((short)1); LocMast sourceLoc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getSourcePosX()) .eq("bay1", command.getSourcePosY()).eq("lev1", command.getSourcePosZ())); LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX()) @@ -478,8 +477,8 @@ command.setSourcePosY((short) 0); // 婧愬簱浣嶅垪 command.setSourcePosZ((short) 0); // 婧愬簱浣嶅眰 command.setDestinationPosX((short) 0); // 鐩爣搴撲綅鎺� - command.setDestinationPosY((short) 34); // 鐩爣搴撲綅鍒� - command.setDestinationPosZ((short) 5); // 鐩爣搴撲綅灞� + command.setDestinationPosY((short) 22); // 鐩爣搴撲綅鍒� + command.setDestinationPosZ((short) 1); // 鐩爣搴撲綅灞� return crnControl(command)?R.ok():R.error(); } @@ -575,7 +574,7 @@ crnCommand.setCommand((short) 0); // 浠诲姟瀹屾垚纭浣� // 寤舵椂鍙戦�� Thread.sleep(1000L); - if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand))) { + if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand), false)) { return R.ok(); } else { throw new CoolException("鍛戒护涓嬪彂澶辫触"); @@ -685,7 +684,7 @@ } // 绌洪棽鍒ゆ柇 // if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { - if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(4, command))) { + if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(4, command), false)) { return true; } else { throw new CoolException("鍛戒护涓嬪彂澶辫触"); @@ -719,11 +718,11 @@ } // 绌洪棽鍒ゆ柇 // if (crnProtocol.getStatusType().equals(com.zy.core.enums.CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { - if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, command))) { - return true; - } else { - throw new CoolException("鍛戒护涓嬪彂澶辫触"); - } + if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, command), false)) { + return true; + } else { + throw new CoolException("鍛戒护涓嬪彂澶辫触"); + } // } else { // throw new CoolException("鍫嗗灈鏈轰笉鍦ㄧ┖闂茬姸鎬�"); // } -- Gitblit v1.9.1