| | |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>()); |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(wrapper); |
| | | |
| | | List<BasCrnp> baseList = new ArrayList<>(); |
| | | List<BasCrnp> extraList = new ArrayList<>(); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | if (excludeCrnList.contains(basCrnp.getCrnNo())) { |
| | | extraList.add(basCrnp); |
| | | }else { |
| | | baseList.add(basCrnp); |
| | | } |
| | | } |
| | | baseList.addAll(extraList); |
| | | |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Integer crnNo = wrkMast.getCrnNo(); |
| | | map.put(crnNo, map.getOrDefault(crnNo, 0) + 1); |
| | | } |
| | | |
| | | List<BasCrnp> enabledCrnps = new ArrayList<>(); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | for (BasCrnp basCrnp : baseList) { |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, basCrnp.getCrnNo()); |
| | | if (crnThread == null) { |
| | | continue; |
| | |
| | | // 检查是否超过最大入库任务数 |
| | | if (maxInTaskControl && inWrkMasts.size() >= basCrnp.getMaxInTask()) { |
| | | News.info("堆垛机:{} 已达最大入库任务数,当前任务数:{}", basCrnp.getCrnNo(), inWrkMasts.size()); |
| | | continue; |
| | | } |
| | | if (excludeCrnList.contains(basCrnp.getCrnNo())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>()); |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(wrapper); |
| | | |
| | | List<BasDualCrnp> baseList = new ArrayList<>(); |
| | | List<BasDualCrnp> extraList = new ArrayList<>(); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | if (excludeCrnList.contains(basDualCrnp.getCrnNo())) { |
| | | extraList.add(basDualCrnp); |
| | | }else { |
| | | baseList.add(basDualCrnp); |
| | | } |
| | | } |
| | | baseList.addAll(extraList); |
| | | |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Integer dualCrnNo = wrkMast.getDualCrnNo(); |
| | | map.put(dualCrnNo, map.getOrDefault(dualCrnNo, 0) + 1); |
| | | } |
| | | |
| | | List<BasDualCrnp> enabledCrnps = new ArrayList<>(); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | for (BasDualCrnp basDualCrnp : baseList) { |
| | | DualCrnThread dualCrnThread = (DualCrnThread) SlaveConnection.get(SlaveType.DualCrn, basDualCrnp.getCrnNo()); |
| | | if (dualCrnThread == null) { |
| | | continue; |
| | |
| | | ); |
| | | // 检查是否超过最大入库任务数 |
| | | if (maxInTaskControl && inWrkMasts.size() >= basDualCrnp.getMaxInTask()) { |
| | | News.info("堆垛机:{} 已达最大入库任务数,当前任务数:{}", basDualCrnp.getCrnNo(), inWrkMasts.size()); |
| | | continue; |
| | | } |
| | | if (excludeCrnList.contains(basDualCrnp.getCrnNo())) { |
| | | News.info("双工位堆垛机:{} 已达最大入库任务数,当前任务数:{}", basDualCrnp.getCrnNo(), inWrkMasts.size()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | return rowList; |
| | | } |
| | | |
| | | BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | if (basDualCrnpService == null) { |
| | | return rowList; |
| | | } |
| | | |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | String deepRowsStr = basCrnp.getDeepRows(); |
| | | if(!Cools.isEmpty(deepRowsStr)){ |
| | | List<Integer> rows = JSON.parseArray(deepRowsStr, Integer.class); |
| | | rowList.addAll(rows); |
| | | } |
| | | } |
| | | |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<BasDualCrnp>()); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | String deepRowsStr = basDualCrnp.getDeepRows(); |
| | | if(!Cools.isEmpty(deepRowsStr)){ |
| | | List<Integer> rows = JSON.parseArray(deepRowsStr, Integer.class); |
| | | rowList.addAll(rows); |
| | |
| | | |
| | | //获取浅库位排号 |
| | | public static Integer getShallowRowByDeepRow(Integer deepRow) { |
| | | SlaveType slaveType = checkRowDeviceType(deepRow); |
| | | if (slaveType == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (slaveType.equals(SlaveType.Crn)) { |
| | | return getShallowRowByCrnDeepRow(deepRow); |
| | | } else if (slaveType.equals(SlaveType.DualCrn)) { |
| | | return getShallowRowByDualCrnDeepRow(deepRow); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | //获取堆垛机浅库位排号 |
| | | public static Integer getShallowRowByCrnDeepRow(Integer deepRow) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return null; |
| | |
| | | } |
| | | } |
| | | |
| | | if (controlRowList == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (Integer row : controlRowList) { |
| | | if (deepRow.equals(row)) { |
| | | continue; |
| | | } |
| | | |
| | | return row; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //获取双工位堆垛机浅库位排号 |
| | | public static Integer getShallowRowByDualCrnDeepRow(Integer deepRow) { |
| | | BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | if (basDualCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> deepRowList = getDeepRowList(); |
| | | if (!deepRowList.contains(deepRow)) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> controlRowList = null; |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | List<List<Integer>> rowList = basDualCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | if (rows.contains(deepRow)) { |
| | | controlRowList = rows; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (controlRowList != null) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (controlRowList == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (Integer row : controlRowList) { |
| | | if (deepRow.equals(row)) { |
| | | continue; |
| | |
| | | |
| | | //获取深库位排号 |
| | | public static Integer getDeepRowByShallowRow(Integer shallowRow) { |
| | | SlaveType slaveType = checkRowDeviceType(shallowRow); |
| | | |
| | | if (slaveType.equals(SlaveType.Crn)) { |
| | | return getDeepRowByCrnShallowRow(shallowRow); |
| | | } else if (slaveType.equals(SlaveType.DualCrn)) { |
| | | return getDeepRowByDualCrnShallowRow(shallowRow); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | //获取堆垛机深库位排号 |
| | | public static Integer getDeepRowByCrnShallowRow(Integer shallowRow) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return null; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //获取双工位堆垛机深库位排号 |
| | | public static Integer getDeepRowByDualCrnShallowRow(Integer shallowRow) { |
| | | BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | if (basDualCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> controlRowList = null; |
| | | List<Integer> deepRowList = null; |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | List<List<Integer>> rowList = basDualCrnp.getControlRows$(); |
| | | for (List<Integer> rows : rowList) { |
| | | if (rows.contains(shallowRow)) { |
| | | controlRowList = rows; |
| | | deepRowList = JSON.parseArray(basDualCrnp.getDeepRows(), Integer.class); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (controlRowList != null) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (deepRowList == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (Integer row : controlRowList) { |
| | | if (!deepRowList.contains(row)) { |
| | | continue; |
| | | } |
| | | |
| | | return row; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | //检测排号设备类型 |
| | | public static SlaveType checkRowDeviceType(Integer row) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | if (basCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class); |
| | | if (basDualCrnpService == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasCrnp basCrnp : basCrnps) { |
| | | List<List<Integer>> controlRows = basCrnp.getControlRows$(); |
| | | for (List<Integer> list : controlRows) { |
| | | if (list.contains(row)) { |
| | | return SlaveType.Crn; |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>()); |
| | | for (BasDualCrnp basDualCrnp : basDualCrnps) { |
| | | List<List<Integer>> controlRows = basDualCrnp.getControlRows$(); |
| | | for (List<Integer> list : controlRows) { |
| | | if (list.contains(row)) { |
| | | return SlaveType.DualCrn; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |