| | |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.conveyor.controller.vo.SiteTableVo; |
| | | import com.zy.acs.conveyor.core.constant.RedisConveyorConstant; |
| | | import com.zy.acs.conveyor.core.model.SafeSignal; |
| | | import com.zy.acs.conveyor.core.model.StaProtocol; |
| | | import com.zy.acs.conveyor.core.properties.DevpSlave; |
| | | import com.zy.acs.conveyor.core.properties.OutputQueue; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 输送设备接口 |
| | |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight()); |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() ? (staProtocol.isLow() ? "低" : "高") : "-"); //高低库位 |
| | | |
| | | vo.setAllow((staProtocol.getAllowPut() ? "可放" : "不可放") + "/" + (staProtocol.getAllowTake() ? "可取" : "不可取")); |
| | | } |
| | | |
| | | return R.ok().add(list); |
| | |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight()); |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() ? (staProtocol.isLow() ? "低" : "高") : "-"); //高低库位 |
| | | vo.setAllow((staProtocol.getAllowPut() ? "可放" : "不可放") + "/" + (staProtocol.getAllowTake() ? "可取" : "不可取")); |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | |
| | | return R.error("plc已掉线"); |
| | | } |
| | | |
| | | @PostMapping("/detl/safe") |
| | | @ManagerAuth(memo = "补充安全信号") |
| | | public R safe(@RequestParam Integer siteId) { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | Map<Integer, StaProtocol> station = stationService.getStationMap(devp.getId()); |
| | | for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | | if (siteId.equals(entry.getKey())) { |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | boolean flag = true; |
| | | List<DevpSlave.Sta> putSta = devp.getPutSta(); |
| | | List<DevpSlave.Sta> takeSta = devp.getTakeSta(); |
| | | Optional<DevpSlave.Sta> first = takeSta.stream().filter(sta -> sta.getStaNo().equals(siteId)).findFirst(); |
| | | int i = -1; |
| | | if (first.isPresent()) { |
| | | i = takeSta.indexOf(first.get()); |
| | | if (i != -1) { |
| | | flag = false; |
| | | } |
| | | } |
| | | if (i == -1) { |
| | | first = putSta.stream().filter(sta -> sta.getStaNo().equals(siteId)).findFirst(); |
| | | if (first.isPresent()) { |
| | | i = putSta.indexOf(first.get()); |
| | | flag = true; |
| | | } |
| | | } |
| | | if (i == -1) { |
| | | return R.error("此站点无需安全信号"); |
| | | } |
| | | staProtocol.setSafeSignal(new SafeSignal(i, (short) 0, flag)); |
| | | redis.push(RedisConveyorConstant.CONVEYOR_SAFE_FLAG, staProtocol); |
| | | return R.ok(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return R.error("plc已掉线"); |
| | | } |
| | | } |