From bb87914b329dbaf4e93850fe9c26c075708f13ef Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期四, 24 四月 2025 16:22:13 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/controller/CrnController.java | 161 ++++++++++++++++++++++++++++------------------------- 1 files changed, 85 insertions(+), 76 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/CrnController.java b/src/main/java/com/zy/asrs/controller/CrnController.java index 96bca08..3046c66 100644 --- a/src/main/java/com/zy/asrs/controller/CrnController.java +++ b/src/main/java/com/zy/asrs/controller/CrnController.java @@ -130,7 +130,7 @@ vo.setForkOffset(crnProtocol.getForkPosType().desc); // 璐у弶浣嶇疆 vo.setLiftPos(crnProtocol.getLiftPosType().desc); vo.setWalkPos(crnProtocol.getWalkPos()==1?"涓嶅湪瀹氫綅":"鍦ㄥ畾浣�"); - vo.setWarnCode(String.valueOf(crnProtocol.getAlarm1())); + vo.setWarnCode(String.valueOf(crnProtocol.getAlarm())); if (crnProtocol.getAlarm() > 0) { BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); vo.setAlarm(crnError==null?"鏈煡寮傚父":crnError.getErrName()); @@ -165,9 +165,9 @@ vo.setForkOffset(crnProtocol.getForkPosType().desc); // 璐у弶浣嶇疆 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()); + vo.setWarnCode(String.valueOf(crnProtocol.getAlarm())); + if (crnProtocol.getAlarm() > 0) { + BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); vo.setAlarm(crnError==null?"鏈煡寮傚父":crnError.getErrName()); } return R.ok().add(vo); @@ -288,7 +288,11 @@ vo.setLocNo(wrkMast.getLocNo()); // 鐩爣搴撲綅 } } else { - vo.setDeviceStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 妯″紡鐘舵�� + if (Cools.isEmpty(crnProtocol.modeType)){ + vo.setDeviceStatus(CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 妯″紡鐘舵�� + } else { + vo.setDeviceStatus(crnProtocol.modeType.equals(CrnModeType.AUTO)? CrnStatusType.MACHINE_AUTO.getDesc(): CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 妯″紡鐘舵�� + } } vo.setXspeed(crnProtocol.getXSpeed()); // 璧拌閫熷害锛坢/min) vo.setYspeed(crnProtocol.getYSpeed()); // 鍗囬檷閫熷害锛坢/min) @@ -297,8 +301,11 @@ vo.setYdistance(crnProtocol.getYDistance()); // 鍗囬檷璺濈(Km) vo.setXduration(crnProtocol.getXDuration()); // 璧拌鏃堕暱(H) vo.setYduration(crnProtocol.getYDuration()); // 鍗囬檷鏃堕暱(H) - - vo.setStatusType(crnProtocol.modeType.desc); // 妯″紡鐘舵�� + if (Cools.isEmpty(crnProtocol.modeType)){ + vo.setStatusType(CrnStatusType.MACHINE_UN_AUTO.getDesc()); // 妯″紡鐘舵�� + } else { + vo.setStatusType(crnProtocol.modeType.desc); // 妯″紡鐘舵�� + } vo.setWrkStatus(crnProtocol.getStatusType().id); // 浠诲姟鐘舵�� vo.setLoading((crnProtocol.getLoaded() != null && crnProtocol.getLoaded() == 1) ? "鏈夌墿" : "鏃犵墿"); // 鏈夌墿 vo.setBay(crnProtocol.getBay()); // 鍒� @@ -307,9 +314,9 @@ vo.setForkOffset(crnProtocol.getForkPosType().desc); // 璐у弶浣嶇疆 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()); + vo.setWarnCode(String.valueOf(crnProtocol.getAlarm())); + if (crnProtocol.getAlarm() > 0) { + BasCrnError crnError = basCrnErrorMapper.selectById(crnProtocol.getAlarm()); vo.setAlarm(crnError==null?"鏈煡寮傚父":crnError.getErrName()); } vo.setInEnable(basCrnp.getInEnable()); @@ -376,21 +383,21 @@ @ManagerAuth(memo = "鍏ュ簱") @PostMapping("/crn/operator/put") public R crnPut(CrnOperatorParam param){ - // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// // 绯荤粺杩愯鐘舵�佸垽鏂� +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� command.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� command.setTaskMode(CrnTaskModeType.PAKIN); // 浠诲姟妯″紡 - 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.setSourcePosX(param.getSourceRow()); // 婧愬簱浣嶆帓 + command.setSourcePosY(param.getSourceBay()); // 婧愬簱浣嶅垪 + command.setSourcePosZ(param.getSourceLev()); // 婧愬簱浣嶅眰 + command.setDestinationPosX(param.getRow()); // 鐩爣搴撲綅鎺� + command.setDestinationPosY(param.getBay()); // 鐩爣搴撲綅鍒� + command.setDestinationPosZ(param.getLev()); // 鐩爣搴撲綅灞� command.setCommand((short)1); return crnControl(command)?R.ok():R.error(); } @@ -399,20 +406,21 @@ @PostMapping("/crn/operator/take") public R crnTake(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� command.setAckFinish((short) 0); // 浠诲姟瀹屾垚纭浣� - command.setTaskMode(CrnTaskModeType.PAKOUT); // 浠诲姟妯″紡 - 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.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.setCommand((short)1); return crnControl(command)?R.ok():R.error(); } @@ -420,9 +428,9 @@ @PostMapping("/crn/operator/stockMove") public R crnStockMove(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� @@ -447,9 +455,9 @@ @PostMapping("/crn/operator/siteMove") public R crnSiteMove(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� @@ -468,9 +476,9 @@ @PostMapping("/crn/operator/bacOrigin") public R crnBacOrigin(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� @@ -489,9 +497,9 @@ @PostMapping("/crn/operator/reverseOrigin") public R reverseOrigin(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� @@ -528,9 +536,9 @@ @PostMapping("/crn/operator/taskComplete") public R crnTaskComplete(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� command.setTaskNo((short) 0); // 宸ヤ綔鍙� @@ -542,6 +550,7 @@ command.setDestinationPosX((short) 0); // 鐩爣搴撲綅鎺� command.setDestinationPosY((short) 0); // 鐩爣搴撲綅鍒� command.setDestinationPosZ((short) 0); // 鐩爣搴撲綅灞� + command.setCommand((short)0); return crnControl(command)?R.ok():R.error(); } @@ -561,9 +570,9 @@ @PostMapping("/crn/operator/clearCommand") public R crnClearCommand(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } if (param.getCrnNo() == null) { throw new CoolException("璇烽�夋嫨鍫嗗灈鏈�"); } @@ -585,9 +594,9 @@ @PostMapping("/crn/operator/handleReset") public R handleReset(CrnOperatorParam param) throws Exception { // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } if (param.getCrnNo() == null) { throw new CoolException("璇烽�夋嫨鍫嗗灈鏈�"); } @@ -610,7 +619,7 @@ crnCommand.setCommand((short) 0); // 浠诲姟瀹屾垚纭浣� // 寤舵椂鍙戦�� Thread.sleep(1000L); - if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand), false)) { + if (CommandUtils.offer(SlaveType.Crn, crn.getId(), new Task(5, crnCommand), false)) { return R.ok(); } else { throw new CoolException("鍛戒护涓嬪彂澶辫触"); @@ -627,9 +636,9 @@ @PostMapping("/crn/operator/auto") public R crnAuto(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -642,9 +651,9 @@ @PostMapping("/crn/operator/semiAutomatic") public R crnsemiAutomatic(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -657,9 +666,9 @@ @PostMapping("/crn/operator/hand") public R onlineWrk1(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -672,9 +681,9 @@ @PostMapping("/crn/operator/onlineWrk1") public R onlineWrk2(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -687,9 +696,9 @@ @PostMapping("/crn/operator/onlineWrk2") public R onlineWrk3(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -702,9 +711,9 @@ @PostMapping("/crn/operator/onlineWrk3") public R onlineWrk4(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -717,9 +726,9 @@ @PostMapping("/crn/operator/onlineWrk4") public R crnHand(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� @@ -733,9 +742,9 @@ @PostMapping("/crn/operator/reset") public R crnReset(CrnOperatorParam param){ // 绯荤粺杩愯鐘舵�佸垽鏂� - if (SystemProperties.WCS_RUNNING_STATUS.get()) { - return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); - } +// if (SystemProperties.WCS_RUNNING_STATUS.get()) { +// return R.error("wcs绯荤粺鐘舵�佷负寮�鍚�"); +// } short[] array = new short[9]; CrnCommand command = new CrnCommand(); command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙� -- Gitblit v1.9.1