Commit 28ae94f0a36922d9768c0d6ea890c187bcd6e742
1 parent
0f1a3383
fix: 1、获取所有库位时,去除limit 20。
2、设置每一条相邻临时托盘类型都必须为0,否则报错。 3、8行库位设置邻临时托盘类型到第9行问题,偶数行6和8应该往上设置的,已修正。
Showing
2 changed files
with
27 additions
and
15 deletions
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
@@ -80,13 +80,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -80,13 +80,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
80 | .eq(Location::getRoadway, DYNAMIC_ROADWAY) | 80 | .eq(Location::getRoadway, DYNAMIC_ROADWAY) |
81 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) | 81 | .eq(Location::getStatus, STATUS_LOCATION_EMPTY) |
82 | .eq(Location::getHigh, high) | 82 | .eq(Location::getHigh, high) |
83 | - .eq(Location::getContainerCode, "") | 83 | + .eq(Location::getContainerCode, EMPTY_STRING) |
84 | .ne(Location::getIColumn, "26")//26列机器臂夹不到,只有大托盘的右侧可以刚好放到 | 84 | .ne(Location::getIColumn, "26")//26列机器臂夹不到,只有大托盘的右侧可以刚好放到 |
85 | .orderByAsc(Location::getILayer) | 85 | .orderByAsc(Location::getILayer) |
86 | .orderByDesc(Location::getRowFlag) | 86 | .orderByDesc(Location::getRowFlag) |
87 | .orderByAsc(Location::getIColumn) | 87 | .orderByAsc(Location::getIColumn) |
88 | - .orderByAsc(Location::getIRow) | ||
89 | - .last(" limit 20"); | 88 | + .orderByAsc(Location::getIRow); |
90 | List<Location> list = locationService.list(wrapper); | 89 | List<Location> list = locationService.list(wrapper); |
91 | if (list.size() <= reserveNumber) { | 90 | if (list.size() <= reserveNumber) { |
92 | return "可能是库位不够用了,请检查预留库位数"; | 91 | return "可能是库位不够用了,请检查预留库位数"; |
@@ -95,13 +94,14 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -95,13 +94,14 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
95 | //大托盘占两个库位 | 94 | //大托盘占两个库位 |
96 | if (containerType.equals(CONTAINER_TYPE_X) || containerType.equals(CONTAINER_TYPE_W)) { | 95 | if (containerType.equals(CONTAINER_TYPE_X) || containerType.equals(CONTAINER_TYPE_W)) { |
97 | for (Location location : list) { | 96 | for (Location location : list) { |
98 | - if (location.getIColumn() % 2 != 0 && location.getTemporaryType().startsWith(SMALL_CONTAINER_TYPE)) { | 97 | + //大托盘只放奇数列,且右侧有空库位,且当前库位类型不是小托盘 |
98 | + if (location.getIColumn() % 2 != 0 && !location.getTemporaryType().startsWith(SMALL_CONTAINER_TYPE)) { | ||
99 | Location rightLocation = locationService.getRightEmptyLocation(location); | 99 | Location rightLocation = locationService.getRightEmptyLocation(location); |
100 | if (rightLocation != null) { | 100 | if (rightLocation != null) { |
101 | //禁用库位 | 101 | //禁用库位 |
102 | int updateCount = locationService.updateStatusNew(rightLocation.getCode(), DEFAULT_WAREHOUSE, STATUS_LOCATION_DISABLE, STATUS_LOCATION_EMPTY); | 102 | int updateCount = locationService.updateStatusNew(rightLocation.getCode(), DEFAULT_WAREHOUSE, STATUS_LOCATION_DISABLE, STATUS_LOCATION_EMPTY); |
103 | if (updateCount != 1) { | 103 | if (updateCount != 1) { |
104 | - throw new ServiceException("禁用库位失败"); | 104 | + throw new ServiceException("分配库位时,禁用库位失败"); |
105 | } | 105 | } |
106 | if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) { | 106 | if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) { |
107 | //设置相邻临时库位类型 | 107 | //设置相邻临时库位类型 |
@@ -113,7 +113,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -113,7 +113,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
113 | } | 113 | } |
114 | return null; | 114 | return null; |
115 | } else { | 115 | } else { |
116 | - //分配小托盘库位 | 116 | + //分配小托盘库位,将大托盘库位过滤掉 |
117 | //小托盘不分配25列,最好让大托盘放在25列 | 117 | //小托盘不分配25列,最好让大托盘放在25列 |
118 | list = list.stream().filter(location -> location.getIColumn() != 25 | 118 | list = list.stream().filter(location -> location.getIColumn() != 25 |
119 | && !String.valueOf(location.getTemporaryType()).startsWith(BIG_CONTAINER_TYPE)).collect(Collectors.toList()); | 119 | && !String.valueOf(location.getTemporaryType()).startsWith(BIG_CONTAINER_TYPE)).collect(Collectors.toList()); |
@@ -132,19 +132,26 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -132,19 +132,26 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
132 | //设置相邻临时库位类型 | 132 | //设置相邻临时库位类型 |
133 | @Override | 133 | @Override |
134 | @Transactional(rollbackFor = Exception.class) | 134 | @Transactional(rollbackFor = Exception.class) |
135 | - void setTemporaryLocationType(Location location, boolean isBigContainer) { | 135 | + public void setTemporaryLocationType(Location location, boolean isBigContainer) { |
136 | List<Location> setTemporaryTypeList = new ArrayList<>(); | 136 | List<Location> setTemporaryTypeList = new ArrayList<>(); |
137 | String prefix = isBigContainer ? BIG_CONTAINER_TYPE : SMALL_CONTAINER_TYPE; | 137 | String prefix = isBigContainer ? BIG_CONTAINER_TYPE : SMALL_CONTAINER_TYPE; |
138 | 138 | ||
139 | setTemporaryTypeList.add(location); | 139 | setTemporaryTypeList.add(location); |
140 | - setTemporaryTypeList.add(getLocationByOffset(location, 0, 1)); | ||
141 | - setTemporaryTypeList.add(getLocationByOffset(location, 1, 1)); | ||
142 | - setTemporaryTypeList.add(getLocationByOffset(location, 1, 0)); | ||
143 | - | 140 | + if (location.getIRow() % 2 == 0) { |
141 | + //6、8行,因为是优先分配深库位,所以其实6和7行两个浅库位是进不来 | ||
142 | + setTemporaryTypeList.add(getLocationByOffset(location, 0, -1)); | ||
143 | + setTemporaryTypeList.add(getLocationByOffset(location, 1, -1)); | ||
144 | + setTemporaryTypeList.add(getLocationByOffset(location, 1, 0)); | ||
145 | + } else { | ||
146 | + //5、7行 | ||
147 | + setTemporaryTypeList.add(getLocationByOffset(location, 0, 1)); | ||
148 | + setTemporaryTypeList.add(getLocationByOffset(location, 1, 1)); | ||
149 | + setTemporaryTypeList.add(getLocationByOffset(location, 1, 0)); | ||
150 | + } | ||
144 | for (Location temporaryLocation : setTemporaryTypeList) { | 151 | for (Location temporaryLocation : setTemporaryTypeList) { |
145 | if (temporaryLocation != null) { | 152 | if (temporaryLocation != null) { |
146 | temporaryLocation.setTemporaryType(prefix + "-" + location.getCode() + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss"))); | 153 | temporaryLocation.setTemporaryType(prefix + "-" + location.getCode() + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss"))); |
147 | - if (locationService.updateById(temporaryLocation)) { | 154 | + if (!locationService.updateById(temporaryLocation)) { |
148 | throw new ServiceException("设置临时库位类型失败"); | 155 | throw new ServiceException("设置临时库位类型失败"); |
149 | } | 156 | } |
150 | } | 157 | } |
@@ -156,8 +163,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -156,8 +163,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
156 | wrapper | 163 | wrapper |
157 | .eq(Location::getILayer, baseLocation.getILayer()) | 164 | .eq(Location::getILayer, baseLocation.getILayer()) |
158 | .eq(Location::getIColumn, baseLocation.getIColumn() + columnOffset) | 165 | .eq(Location::getIColumn, baseLocation.getIColumn() + columnOffset) |
159 | - .eq(Location::getIRow, baseLocation.getIRow() + rowOffset); | ||
160 | - return locationService.getOne(wrapper); | 166 | + .eq(Location::getIRow, baseLocation.getIRow() + rowOffset) |
167 | + .eq(Location::getTemporaryType, UNDEFINED_CONTAINER_TYPE); | ||
168 | + Location location = locationService.getOne(wrapper); | ||
169 | + if (location == null) { | ||
170 | + throw new ServiceException("设置临时库位类型失败,该库位托盘类型不为0:" + baseLocation.getCode()); | ||
171 | + } | ||
172 | + return location; | ||
161 | } | 173 | } |
162 | 174 | ||
163 | 175 |
src/main/java/com/huaheng/common/constant/QuantityConstant.java
@@ -551,7 +551,7 @@ public class QuantityConstant { | @@ -551,7 +551,7 @@ public class QuantityConstant { | ||
551 | */ | 551 | */ |
552 | public static final String CONTAINER_TYPE_X = "X"; | 552 | public static final String CONTAINER_TYPE_X = "X"; |
553 | public static final String CONTAINER_TYPE_W = "W"; | 553 | public static final String CONTAINER_TYPE_W = "W"; |
554 | - //一厂二期5号巷道为动态分配大小托盘 | 554 | + //todo 一厂二期5号巷道为动态分配大小托盘,二厂也有,到时候需要修改代码 |
555 | public static final String DYNAMIC_ROADWAY = "5"; | 555 | public static final String DYNAMIC_ROADWAY = "5"; |
556 | 556 | ||
557 | /** | 557 | /** |