From 632c1351c9f0ba96d1f43e46aed2bcbd4a50e7d6 Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期一, 21 十月 2024 14:13:36 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/controller/RgvController.java | 60 ++++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/RgvController.java b/src/main/java/com/zy/asrs/controller/RgvController.java index 8e7c781..033d277 100644 --- a/src/main/java/com/zy/asrs/controller/RgvController.java +++ b/src/main/java/com/zy/asrs/controller/RgvController.java @@ -2,15 +2,18 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.ManagerAuth; +import com.core.common.Cools; import com.core.common.R; import com.core.exception.CoolException; import com.zy.asrs.domain.enums.RgvStatusType; import com.zy.asrs.domain.param.EnergyGatheringRingParam; import com.zy.asrs.domain.param.RgvOperatorParam; +import com.zy.asrs.domain.param.RgvWrkMastParam; import com.zy.asrs.domain.param.RingThroughParam; import com.zy.asrs.domain.vo.*; import com.zy.asrs.entity.*; import com.zy.asrs.mapper.BasRgvErrMapper; +import com.zy.asrs.service.BasDevpPositionService; import com.zy.asrs.service.BasRgvService; import com.zy.asrs.service.WrkMastService; import com.zy.asrs.service.impl.MainServiceImpl; @@ -61,6 +64,8 @@ private BasRgvService basRgvService; @Autowired private MainServiceImpl mainService; + @Autowired + private BasDevpPositionService basDevpPositionService; @PostMapping("/table/rgv/state") @ManagerAuth(memo = "RGV淇℃伅琛�") @@ -343,7 +348,7 @@ ringThroughParam.setIndex(rgv.getId()); // ringThroughParam.setIndex(i); // double[] doubles = Utils.RingThroughXY2(1737000.0, NumUtils.GetRandomIntInRange(183)); - double[] doubles = Utils.RingThroughXY2(1737000.0, rgvProtocol.RgvPos.doubleValue()); + double[] doubles = Utils.RingThroughXYRgv(1737000.0, 1737000.0-rgvProtocol.RgvPos.doubleValue()); // double[] doubles = Utils.RingThroughXY2(183.0, 100*i ); ringThroughParam.setValueX(doubles[0]-2.94); @@ -359,24 +364,13 @@ // @ManagerAuth(memo = "绔欑偣淇℃伅") public R ringThroughDev(){ List<RingThroughParam> result = new ArrayList<>(); -// for (RgvSlave rgv : slaveProperties.getRgv()) { - for (int i = 1;i<10;i++) { -// // 鑾峰彇RGV淇℃伅 -// RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgv.getId()); -// if (rgvThread == null) { -// continue; -// } -// RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); -// if (rgvProtocol == null) { -// continue; -// } + List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<>()); + for (BasDevpPosition basDevpPosition : basDevpPositions){ RingThroughParam ringThroughParam = new RingThroughParam(); - -// ringThroughParam.setIndex(rgv.getId()); - ringThroughParam.setIndex(i); - double[] doubles = Utils.RingThroughXY2(183.0, 100*i ); - ringThroughParam.setValueX(doubles[0]+2.94); - ringThroughParam.setValueY(doubles[1]+2.94); + ringThroughParam.setIndex(basDevpPosition.getDevNo()); + double[] doubles = Utils.RingThroughXYSta(1737000.0, 1737000.0-basDevpPosition.getPlcPosition()); + ringThroughParam.setValueX(doubles[0]>50? doubles[0]+6:doubles[0]-1); + ringThroughParam.setValueY(doubles[1]>50? doubles[1]+6:doubles[1]-1); result.add(ringThroughParam); } return R.ok().add(result); @@ -388,6 +382,9 @@ List<EnergyGatheringRingParam> result = new ArrayList<>(); try{ for (DevpSlave devp : slaveProperties.getDevp()) { + if (devp.getId()!=1){ + break; + } SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); if (devpThread.isResult()){ if (true){ @@ -418,4 +415,31 @@ return R.ok().add(result); } + @PostMapping("/ring/through/task/wrk/mast/position/data") +// @ManagerAuth(memo = "绔欑偣淇℃伅") + public R ringThroughTaskWrkMast(){ + List<RgvWrkMastParam> result = new ArrayList<>(); + List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>()); + for (WrkMast wrkMast : wrkMasts){ + RgvWrkMastParam rgvWrkMastParam = new RgvWrkMastParam(wrkMast); + if (Cools.isEmpty(rgvWrkMastParam.getRgvNo())){ + rgvWrkMastParam.setRgvSts("鏈粦瀹�"); + } else { + RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvWrkMastParam.getRgvNo()); + if (rgvThread == null) { + rgvWrkMastParam.setRgvSts("鏈煡"); + } else { + RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); + if (rgvProtocol == null) { + rgvWrkMastParam.setRgvSts("鏈煡"); + } else { + rgvWrkMastParam.setRgvSts(rgvProtocol.statusType.desc); + } + } + } + result.add(rgvWrkMastParam); + } + return R.ok().add(result); + } + } \ No newline at end of file -- Gitblit v1.9.1