Commit ff3c46e1de27d772aeb1d7b42e57ea0d0ae69789
1 parent
f4eb9a54
批量添加库位,更新内外侧标志
Showing
2 changed files
with
33 additions
and
0 deletions
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
... | ... | @@ -19,6 +19,8 @@ public interface LocationMapper extends BaseMapper<Location> { |
19 | 19 | |
20 | 20 | int addList(@Param("locations") List<Location> locations); |
21 | 21 | |
22 | + int updateList(@Param("locations") List<Location> locations); | |
23 | + | |
22 | 24 | Location getAllLocation(@Param("warehouseCode") String warehouseCode, @Param("type") String type); |
23 | 25 | |
24 | 26 | //库位利用率 |
... | ... |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... | ... | @@ -160,6 +160,37 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
160 | 160 | }else { |
161 | 161 | locationMapper.addList(locations); |
162 | 162 | } |
163 | + | |
164 | + List<Integer> integerList = new ArrayList<>(); | |
165 | + for(Location location2 : locations) { | |
166 | + if(integerList.size() == 0) { | |
167 | + integerList.add(location2.getIRow()); | |
168 | + } else { | |
169 | + for(int i = 0; i< integerList.size(); i++) { | |
170 | + if(integerList.get(i).intValue() == location2.getIRow().intValue()) { | |
171 | + break; | |
172 | + } else { | |
173 | + if(i == (integerList.size() - 1)) { | |
174 | + integerList.add(location2.getIRow()); | |
175 | + } | |
176 | + } | |
177 | + } | |
178 | + } | |
179 | + } | |
180 | + if(integerList.size() == 4) { | |
181 | + for (Location location3 : locations) { | |
182 | + for (int i = 0; i < integerList.size(); i++) { | |
183 | + if (location3.getIRow().intValue() == integerList.get(i).intValue()) { | |
184 | + if (i == 0 || i == (integerList.size() - 1)) { | |
185 | + location3.setRowFlag(1); | |
186 | + } else { | |
187 | + location3.setRowFlag(0); | |
188 | + } | |
189 | + } | |
190 | + } | |
191 | + } | |
192 | + locationMapper.updateList(locations); | |
193 | + } | |
163 | 194 | return true; |
164 | 195 | } |
165 | 196 | |
... | ... |