| | |
| | | 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.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() != staProtocol.isFullPlt() ? (staProtocol.isEmptyMk() ? "空" : "满") : "-"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | // vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setLocType1(devp.getDevNo() == 102 ? "高" : "低"); |
| | | vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight()); |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() ? (staProtocol.isLow() ? "低" : "高") : "-"); //高低库位 |
| | | vo.setAllow((staProtocol.getAllowPut() ? "可放" : "不可放") + "/" + (staProtocol.getAllowTake() ? "可取" : "不可取")); |
| | | vo.setBarcode(staProtocol.getBarcode()); |
| | | } |
| | | |
| | | return R.ok().add(list); |
| | |
| | | vo.setLoading(staProtocol.isLoading() ? "Y" : "N"); // 有物 |
| | | vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N"); // 可入 |
| | | vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N"); // 空板信号 |
| | | vo.setEmptyMk(staProtocol.isEmptyMk() != staProtocol.isFullPlt() ? (staProtocol.isEmptyMk() ? "空" : "满") : "-"); // 空板信号 |
| | | vo.setStaNo(staProtocol.getStaNo()); // 目标站 |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高"); //高低库位 |
| | | vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight()); |
| | | vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() ? (staProtocol.isLow() ? "低" : "高") : "-"); //高低库位 |
| | | vo.setAllow((staProtocol.getAllowPut() ? "可放" : "不可放") + "/" + (staProtocol.getAllowTake() ? "可取" : "不可取")); |
| | | vo.setBarcode(staProtocol.getBarcode()); |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | |
| | | @ManagerAuth(memo = "修改站点数据") |
| | | public R siteDetlUpdate(@RequestParam Integer siteId, |
| | | @RequestParam Integer workNo, |
| | | @RequestParam Integer staNo, |
| | | @RequestParam String pakMk) { |
| | | @RequestParam Integer staNo) { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | Map<Integer, StaProtocol> station = stationService.getStationMap(devp.getId()); |
| | | for (Map.Entry<Integer, StaProtocol> entry : station.entrySet()) { |
| | |
| | | if (staNo != null) { |
| | | staProtocol.setStaNo(staNo); |
| | | } |
| | | staProtocol.setStartUpFlag(true); |
| | | redis.push(RedisConveyorConstant.CONVEYOR_TASK_FLAG, staProtocol); |
| | | return R.ok(); |
| | | |
| | |
| | | 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, true, flag)); |
| | | redis.push(RedisConveyorConstant.CONVEYOR_SAFE_FLAG, staProtocol); |
| | | return R.ok(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return R.error("plc已掉线"); |
| | | } |
| | | } |