Commit 07aadff8fb2c76fb5fd03061a2740841aa5c190f
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
Showing
7 changed files
with
417 additions
and
307 deletions
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
@@ -45,327 +45,328 @@ import java.util.stream.Collectors; | @@ -45,327 +45,328 @@ import java.util.stream.Collectors; | ||
45 | @RequestMapping("/config/location") | 45 | @RequestMapping("/config/location") |
46 | public class LocationController extends BaseController { | 46 | public class LocationController extends BaseController { |
47 | 47 | ||
48 | - private String prefix = "config/location"; | ||
49 | - | ||
50 | - @Resource | ||
51 | - private ContainerService containerService; | ||
52 | - @Resource | ||
53 | - private LocationService locationService; | ||
54 | - @Resource | ||
55 | - private InventoryDetailService inventoryDetailService; | ||
56 | - @Resource | ||
57 | - private MaterialService materialService; | ||
58 | - @Resource | ||
59 | - private DataSource dataSource; | ||
60 | - @Resource | ||
61 | - private Print print; | ||
62 | - | ||
63 | - @RequiresPermissions("config:location:view") | ||
64 | - @GetMapping() | ||
65 | - public String location() { | ||
66 | - return prefix + "/location"; | 48 | + private String prefix = "config/location"; |
49 | + | ||
50 | + @Resource | ||
51 | + private ContainerService containerService; | ||
52 | + @Resource | ||
53 | + private LocationService locationService; | ||
54 | + @Resource | ||
55 | + private InventoryDetailService inventoryDetailService; | ||
56 | + @Resource | ||
57 | + private MaterialService materialService; | ||
58 | + @Resource | ||
59 | + private DataSource dataSource; | ||
60 | + @Resource | ||
61 | + private Print print; | ||
62 | + | ||
63 | + @RequiresPermissions("config:location:view") | ||
64 | + @GetMapping() | ||
65 | + public String location () { | ||
66 | + return prefix + "/location"; | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 查询库位列表 | ||
71 | + */ | ||
72 | + @ApiOperation(value = "查看库位列表", | ||
73 | + notes = "根据行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码、创建时间获取库位的详细信息", | ||
74 | + httpMethod = "POST") | ||
75 | + @RequiresPermissions("config:location:list") | ||
76 | + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
77 | + @PostMapping("/list") | ||
78 | + @ResponseBody | ||
79 | + public TableDataInfo list ( | ||
80 | + @ApiParam(name = "location", value = "行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码") Location location, | ||
81 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | ||
82 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | ||
83 | + LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
84 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | ||
85 | + Integer pageNum = pageDomain.getPageNum(); | ||
86 | + Integer pageSize = pageDomain.getPageSize(); | ||
87 | + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Location::getCreated, createdBegin) | ||
88 | + .lt(StringUtils.isNotEmpty(createdEnd), Location::getCreated, createdEnd) | ||
89 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
90 | + .eq(StringUtils.isNotEmpty(location.getCode()), Location::getCode, location.getCode()) | ||
91 | + .eq(StringUtils.isNotEmpty(location.getName()), Location::getName, location.getName()) | ||
92 | + .eq(StringUtils.isNotEmpty(location.getContainerCode()), Location::getContainerCode, location.getContainerCode()) | ||
93 | + .eq(StringUtils.isNotNull(location.getSystemCreated()), Location::getStatus, location.getStatus()) | ||
94 | + .eq(StringUtils.isNotEmpty(location.getZoneCode()), Location::getZoneCode, location.getZoneCode()) | ||
95 | + .eq(StringUtils.isNotNull(location.getIRow()), Location::getIRow, location.getIRow()) | ||
96 | + .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn()) | ||
97 | + .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid()) | ||
98 | + .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer()) | ||
99 | + .eq(StringUtils.isNotEmpty(location.getStatus()), Location::getStatus, location.getStatus()) | ||
100 | + .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType()) | ||
101 | + .eq(Location::getDeleted, false) | ||
102 | + .orderByDesc(Location::getId); | ||
103 | + | ||
104 | + if(StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | ||
105 | + /*使用分页查询*/ | ||
106 | + Page<Location> page = new Page<>(pageNum, pageSize); | ||
107 | + IPage<Location> iPage = locationService.page(page, lambdaQueryWrapper); | ||
108 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | ||
109 | + } else { | ||
110 | + List<Location> list = locationService.list(lambdaQueryWrapper); | ||
111 | + return getDataTable(list); | ||
67 | } | 112 | } |
68 | - | ||
69 | - /** | ||
70 | - * 查询库位列表 | ||
71 | - */ | ||
72 | - @ApiOperation(value = "查看库位列表", | ||
73 | - notes = "根据行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码、创建时间获取库位的详细信息", | ||
74 | - httpMethod = "POST") | ||
75 | - @RequiresPermissions("config:location:list") | ||
76 | - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
77 | - @PostMapping("/list") | ||
78 | - @ResponseBody | ||
79 | - public TableDataInfo list( | ||
80 | - @ApiParam(name = "location", value = "行、列、层、格、库位类型、库区、库位状态、容器编码、库位名称、库位编码") Location location, | ||
81 | - @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | ||
82 | - @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | ||
83 | - LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
84 | - PageDomain pageDomain = TableSupport.buildPageRequest(); | ||
85 | - Integer pageNum = pageDomain.getPageNum(); | ||
86 | - Integer pageSize = pageDomain.getPageSize(); | ||
87 | - lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Location::getCreated, createdBegin) | ||
88 | - .lt(StringUtils.isNotEmpty(createdEnd), Location::getCreated, createdEnd) | ||
89 | - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
90 | - .eq(StringUtils.isNotEmpty(location.getCode()), Location::getCode, location.getCode()) | ||
91 | - .eq(StringUtils.isNotEmpty(location.getName()), Location::getName, location.getName()) | ||
92 | - .eq(StringUtils.isNotEmpty(location.getContainerCode()), Location::getContainerCode, location.getContainerCode()) | ||
93 | - .eq(StringUtils.isNotNull(location.getSystemCreated()), Location::getStatus, location.getStatus()) | ||
94 | - .eq(StringUtils.isNotEmpty(location.getZoneCode()), Location::getZoneCode, location.getZoneCode()) | ||
95 | - .eq(StringUtils.isNotNull(location.getIRow()), Location::getIRow, location.getIRow()) | ||
96 | - .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn()) | ||
97 | - .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid()) | ||
98 | - .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer()) | ||
99 | - .eq(StringUtils.isNotEmpty(location.getStatus()), Location::getStatus, location.getStatus()) | ||
100 | - .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType()) | ||
101 | - .eq(Location::getDeleted, false); | ||
102 | - | ||
103 | - if (StringUtils.isNotEmpty(location.getUserDef2())) { | ||
104 | - if ("有容器".equals(location.getUserDef2())) { | ||
105 | - lambdaQueryWrapper.apply("containerCode!='' and containerCode IS NOT null"); | ||
106 | - } else { | ||
107 | - lambdaQueryWrapper.apply("code in ( select CODE from location where containerCode='' or containerCode IS null) "); | ||
108 | - } | ||
109 | - lambdaQueryWrapper.orderByDesc(Location::getId); | ||
110 | - } | ||
111 | - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { | ||
112 | - /*使用分页查询*/ | ||
113 | - Page<Location> page = new Page<>(pageNum, pageSize); | ||
114 | - IPage<Location> iPage = locationService.page(page, lambdaQueryWrapper); | ||
115 | - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | ||
116 | - } else { | ||
117 | - List<Location> list = locationService.list(lambdaQueryWrapper); | ||
118 | - return getDataTable(list); | ||
119 | - } | ||
120 | - } | ||
121 | - | ||
122 | - /** | ||
123 | - * 查询库位列表 | ||
124 | - */ | ||
125 | - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
126 | - @PostMapping("/getAllLocation") | ||
127 | - @ResponseBody | ||
128 | - public AjaxResult getAllLocation(String type) { | ||
129 | - if (StringUtils.isEmpty(type)) { | ||
130 | - return AjaxResult.error("type不能为空"); | ||
131 | - } | ||
132 | - | ||
133 | - return AjaxResult.success(locationService.getAllLocation(type)); | 113 | + } |
114 | + | ||
115 | + /** | ||
116 | + * 查询库位列表 | ||
117 | + */ | ||
118 | + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
119 | + @PostMapping("/getAllLocation") | ||
120 | + @ResponseBody | ||
121 | + public AjaxResult getAllLocation (String type) { | ||
122 | + if(StringUtils.isEmpty(type)) { | ||
123 | + return AjaxResult.error("type不能为空"); | ||
134 | } | 124 | } |
135 | 125 | ||
136 | - | ||
137 | - /** | ||
138 | - * 新增库位 | ||
139 | - */ | ||
140 | - @GetMapping("/add") | ||
141 | - public String add() { | ||
142 | - return prefix + "/add"; | ||
143 | - } | ||
144 | - | ||
145 | - /** | ||
146 | - * 新增保存库位 | ||
147 | - */ | ||
148 | - @ApiOperation(value = "新增库位", notes = "新增单个库位", httpMethod = "POST") | ||
149 | - @RequiresPermissions("config:location:add") | ||
150 | - @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT) | ||
151 | - @PostMapping("/add") | ||
152 | - @ResponseBody | ||
153 | - public AjaxResult addSave(Location location) { | ||
154 | - AjaxResult result = locationService.addsave(location); | ||
155 | - return result; | ||
156 | - } | ||
157 | - | ||
158 | - | ||
159 | - /** | ||
160 | - * 批量新增库位 | ||
161 | - */ | ||
162 | - | ||
163 | - @GetMapping("/addBatch") | ||
164 | - public String addBatch() { | ||
165 | - return prefix + "/addBatch"; | 126 | + return AjaxResult.success(locationService.getAllLocation(type)); |
127 | + } | ||
128 | + | ||
129 | + | ||
130 | + /** | ||
131 | + * 新增库位 | ||
132 | + */ | ||
133 | + @GetMapping("/add") | ||
134 | + public String add () { | ||
135 | + return prefix + "/add"; | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * 新增保存库位 | ||
140 | + */ | ||
141 | + @ApiOperation(value = "新增库位", notes = "新增单个库位", httpMethod = "POST") | ||
142 | + @RequiresPermissions("config:location:add") | ||
143 | + @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT) | ||
144 | + @PostMapping("/add") | ||
145 | + @ResponseBody | ||
146 | + public AjaxResult addSave (Location location) { | ||
147 | + AjaxResult result = locationService.addsave(location); | ||
148 | + return result; | ||
149 | + } | ||
150 | + | ||
151 | + | ||
152 | + /** | ||
153 | + * 批量新增库位 | ||
154 | + */ | ||
155 | + | ||
156 | + @GetMapping("/addBatch") | ||
157 | + public String addBatch () { | ||
158 | + return prefix + "/addBatch"; | ||
159 | + } | ||
160 | + | ||
161 | + | ||
162 | + /** | ||
163 | + * 批量新增保存库位 | ||
164 | + */ | ||
165 | + @RequiresPermissions("config:location:add") | ||
166 | + @ApiOperation(value = "新增库位", notes = "批量新增库位", httpMethod = "POST") | ||
167 | + @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT) | ||
168 | + @PostMapping("/addBatchSave") | ||
169 | + @ResponseBody | ||
170 | + public AjaxResult addBatchSave (String prefix, String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer, | ||
171 | + String firstGrid, String lastGrid, String roadway, String status, String zoneCode, String locationType, String high) { | ||
172 | + | ||
173 | + return toAjax(locationService.addBatchSave(prefix, Integer.parseInt(firstRow), Integer.parseInt(lastRow), | ||
174 | + Integer.parseInt(firstColumn), Integer.parseInt(lastColumn), Integer.parseInt(firstLayer), Integer.parseInt(lastLayer), | ||
175 | + Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadway, status, zoneCode, locationType, high)); | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * 修改库位 | ||
180 | + */ | ||
181 | + @GetMapping("/edit/{id}") | ||
182 | + public String edit (@PathVariable("id") Integer id, ModelMap mmap) { | ||
183 | + Location location = locationService.getById(id); | ||
184 | + mmap.put("location", location); | ||
185 | + return prefix + "/edit"; | ||
186 | + } | ||
187 | + | ||
188 | + /** | ||
189 | + * 修改物料 | ||
190 | + */ | ||
191 | + @GetMapping("/editBatch/{ids}") | ||
192 | + public String editBatch (@PathVariable("ids") String ids, ModelMap mmap) { | ||
193 | + mmap.put("ids", ids); | ||
194 | + return prefix + "/editBatch"; | ||
195 | + } | ||
196 | + | ||
197 | + /** | ||
198 | + * 修改保存库位 | ||
199 | + */ | ||
200 | + @RequiresPermissions("config:location:edit") | ||
201 | + @ApiOperation(value = "修改库位", notes = "批量修改库位", httpMethod = "POST") | ||
202 | + @Log(title = "配置-库存资料-库位管理", operating = "修改库位", action = BusinessType.UPDATE) | ||
203 | + @PostMapping("/edit") | ||
204 | + @ResponseBody | ||
205 | + public AjaxResult editSave (Location location) { | ||
206 | + String containerCode = location.getContainerCode(); | ||
207 | + if (StringUtils.isNotEmpty(containerCode)) { | ||
208 | + Container container = containerService.getContainerByCode(containerCode); | ||
209 | + if (container == null) { | ||
210 | + return AjaxResult.error("容器编码输入错误"); | ||
211 | + } | ||
166 | } | 212 | } |
167 | - | ||
168 | - | ||
169 | - /** | ||
170 | - * 批量新增保存库位 | ||
171 | - */ | ||
172 | - @RequiresPermissions("config:location:add") | ||
173 | - @ApiOperation(value = "新增库位", notes = "批量新增库位", httpMethod = "POST") | ||
174 | - @Log(title = "配置-库存资料-库位管理", operating = "新增库位", action = BusinessType.INSERT) | ||
175 | - @PostMapping("/addBatchSave") | ||
176 | - @ResponseBody | ||
177 | - public AjaxResult addBatchSave(String prefix, String firstRow, String lastRow, String firstColumn, String lastColumn, String firstLayer, String lastLayer, | ||
178 | - String firstGrid, String lastGrid, String roadway, String status, String zoneCode, String locationType, String high) { | ||
179 | - | ||
180 | - return toAjax(locationService.addBatchSave(prefix, Integer.parseInt(firstRow), Integer.parseInt(lastRow), | ||
181 | - Integer.parseInt(firstColumn), Integer.parseInt(lastColumn), Integer.parseInt(firstLayer), Integer.parseInt(lastLayer), | ||
182 | - Integer.parseInt(firstGrid), Integer.parseInt(lastGrid), roadway, status, zoneCode, locationType, high)); | 213 | + location.setLastUpdatedBy(ShiroUtils.getName()); |
214 | + return toAjax(locationService.updateById(location)); | ||
215 | + } | ||
216 | + | ||
217 | + /** | ||
218 | + * 修改保存物料 | ||
219 | + */ | ||
220 | + @ApiOperation(value = "批量修改库位", notes = "批量修改库位", httpMethod = "POST") | ||
221 | + @RequiresPermissions("config:location:edit") | ||
222 | + @Log(title = "通用-库位管理", operating = "批量修改库位", action = BusinessType.UPDATE) | ||
223 | + @PostMapping("/editBatchSave") | ||
224 | + @ResponseBody | ||
225 | + public AjaxResult editBatchSave (String ids, String materialAreaCode, Integer high, String status) { | ||
226 | + String[] idArray = Convert.toStrArray(ids); | ||
227 | + LambdaUpdateWrapper<Location> wrapper = Wrappers.lambdaUpdate(); | ||
228 | + wrapper.in(Location::getId, idArray) | ||
229 | + .set(Location::getMaterialAreaCode, materialAreaCode) | ||
230 | + .set(Location::getHigh, high) | ||
231 | + .set(Location::getStatus, status); | ||
232 | + return toAjax(locationService.update(wrapper)); | ||
233 | + } | ||
234 | + | ||
235 | + /** | ||
236 | + * 删除库位 | ||
237 | + */ | ||
238 | + @RequiresPermissions("config:location:remove") | ||
239 | + @Log(title = "配置库存资料-库位管理", operating = "删除库位", action = BusinessType.DELETE) | ||
240 | + @ApiOperation(value = "删除库位", notes = "批量删除库位", httpMethod = "POST") | ||
241 | + @PostMapping("/remove") | ||
242 | + @ResponseBody | ||
243 | + public AjaxResult remove (String ids) { | ||
244 | + if(StringUtils.isEmpty(ids)) { | ||
245 | + return AjaxResult.error("id不能为空"); | ||
183 | } | 246 | } |
184 | - | ||
185 | - /** | ||
186 | - * 修改库位 | ||
187 | - */ | ||
188 | - @GetMapping("/edit/{id}") | ||
189 | - public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | ||
190 | - Location location = locationService.getById(id); | ||
191 | - mmap.put("location", location); | ||
192 | - return prefix + "/edit"; | 247 | + for (Integer id : Convert.toIntArray(ids)) { |
248 | + Location location = locationService.getById(id); | ||
249 | + if(StringUtils.isEmpty(location.getContainerCode())) { | ||
250 | + locationService.removeById(locationService.getById(id)); | ||
251 | + } else { | ||
252 | + return AjaxResult.error("库位(" + location.getCode() + ")不是空,或者有容器,不能删除成功!"); | ||
253 | + } | ||
193 | } | 254 | } |
194 | - | ||
195 | - /** | ||
196 | - * 修改物料 | ||
197 | - */ | ||
198 | - @GetMapping("/editBatch/{ids}") | ||
199 | - public String editBatch(@PathVariable("ids") String ids, ModelMap mmap) { | ||
200 | - mmap.put("ids", ids); | ||
201 | - return prefix + "/editBatch"; | 255 | + return AjaxResult.success("删除成功!"); |
256 | + } | ||
257 | + | ||
258 | + /** | ||
259 | + * 查询库位列表 | ||
260 | + */ | ||
261 | + @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
262 | + @PostMapping("/getLocationInfo") | ||
263 | + @ResponseBody | ||
264 | + public AjaxResult getLocationInfo (String type, String row, String line, String layer, String grid) { | ||
265 | + if(StringUtils.isEmpty(type)) { | ||
266 | + return AjaxResult.error("type不能为空"); | ||
202 | } | 267 | } |
203 | 268 | ||
204 | - /** | ||
205 | - * 修改保存库位 | ||
206 | - */ | ||
207 | - @RequiresPermissions("config:location:edit") | ||
208 | - @ApiOperation(value = "修改库位", notes = "批量修改库位", httpMethod = "POST") | ||
209 | - @Log(title = "配置-库存资料-库位管理", operating = "修改库位", action = BusinessType.UPDATE) | ||
210 | - @PostMapping("/edit") | ||
211 | - @ResponseBody | ||
212 | - public AjaxResult editSave(Location location) { | ||
213 | - String containerCode = location.getContainerCode(); | ||
214 | - if (StringUtils.isNotEmpty(containerCode)) { | ||
215 | - Container container = containerService.getContainerByCode(containerCode); | ||
216 | - if (container == null) { | ||
217 | - return AjaxResult.error("容器编码输入错误"); | ||
218 | - } | 269 | + /* 查询库位信息*/ |
270 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
271 | + locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row) | ||
272 | + .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line) | ||
273 | + .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer) | ||
274 | + .eq(Location::getIGrid, 1) // | ||
275 | + .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type) | ||
276 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
277 | + .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type); | ||
278 | + List<Location> locations = locationService.list(locationLambdaQueryWrapper); | ||
279 | + List<Location> locationList = new ArrayList<>(); | ||
280 | + | ||
281 | + /* 查询库存明细*/ | ||
282 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery(); | ||
283 | + inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
284 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda); | ||
285 | + | ||
286 | + for (Location location1 : locations) { | ||
287 | + InventoryDetail inventoryDetail = null; | ||
288 | + String materialName = null; | ||
289 | + for (InventoryDetail inventoryDetail2 : inventoryDetailList) { | ||
290 | + if(location1.getCode().equals(inventoryDetail2.getLocationCode())) { | ||
291 | + inventoryDetail = inventoryDetail2; | ||
219 | } | 292 | } |
220 | - location.setLastUpdatedBy(ShiroUtils.getName()); | ||
221 | - return toAjax(locationService.updateById(location)); | ||
222 | - } | ||
223 | - | ||
224 | - /** | ||
225 | - * 修改保存物料 | ||
226 | - */ | ||
227 | - @ApiOperation(value = "批量修改库位", notes = "批量修改库位", httpMethod = "POST") | ||
228 | - @RequiresPermissions("config:location:edit") | ||
229 | - @Log(title = "通用-库位管理", operating = "批量修改库位", action = BusinessType.UPDATE) | ||
230 | - @PostMapping("/editBatchSave") | ||
231 | - @ResponseBody | ||
232 | - public AjaxResult editBatchSave(String ids, String materialAreaCode, Integer high, String status) { | ||
233 | - String[] idArray = Convert.toStrArray(ids); | ||
234 | - LambdaUpdateWrapper<Location> wrapper = Wrappers.lambdaUpdate(); | ||
235 | - wrapper.in(Location::getId, idArray) | ||
236 | - .set(Location::getMaterialAreaCode, materialAreaCode) | ||
237 | - .set(Location::getHigh, high) | ||
238 | - .set(Location::getStatus, status); | ||
239 | - return toAjax(locationService.update(wrapper)); | ||
240 | - } | ||
241 | - | ||
242 | - /** | ||
243 | - * 删除库位 | ||
244 | - */ | ||
245 | - @RequiresPermissions("config:location:remove") | ||
246 | - @Log(title = "配置库存资料-库位管理", operating = "删除库位", action = BusinessType.DELETE) | ||
247 | - @ApiOperation(value = "删除库位", notes = "批量删除库位", httpMethod = "POST") | ||
248 | - @PostMapping("/remove") | ||
249 | - @ResponseBody | ||
250 | - public AjaxResult remove(String ids) { | ||
251 | - if (StringUtils.isEmpty(ids)) { | ||
252 | - return AjaxResult.error("id不能为空"); | 293 | + } |
294 | + List<InventoryDetail> inventoryDetails = inventoryDetailList.stream().filter(inventoryDetail1 -> | ||
295 | + inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList()); | ||
296 | + | ||
297 | + int userDef3 = 0; | ||
298 | + String status = location1.getStatus(); | ||
299 | + String containerCode = location1.getContainerCode(); | ||
300 | + List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList()); | ||
301 | + List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList()); | ||
302 | + List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList()); | ||
303 | + List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList()); | ||
304 | + if(QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) { | ||
305 | + if(StringUtils.isEmpty(containerCode)) { | ||
306 | + userDef3 = LocationStatus.IDLE_EMPTY_LOCATION; | ||
307 | + } else { | ||
308 | + if(inventoryDetail == null) { | ||
309 | + userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER; | ||
310 | + } else { | ||
311 | + location1.setMaterialName(materialNameList); | ||
312 | + location1.setMaterialCode(materialCodeList); | ||
313 | + location1.setBatch(batchList); | ||
314 | + location1.setQty(qtyList); | ||
315 | + userDef3 = LocationStatus.IDLE_FULL_CONTAINER; | ||
316 | + } | ||
253 | } | 317 | } |
254 | - for (Integer id : Convert.toIntArray(ids)) { | ||
255 | - Location location = locationService.getById(id); | ||
256 | - if (StringUtils.isEmpty(location.getContainerCode())) { | ||
257 | - locationService.removeById(locationService.getById(id)); | ||
258 | - } else { | ||
259 | - return AjaxResult.error("库位(" + location.getCode() + ")不是空,或者有容器,不能删除成功!"); | ||
260 | - } | 318 | + } else if(QuantityConstant.STATUS_LOCATION_LOCK.equals(status)) { |
319 | + if(StringUtils.isEmpty(containerCode)) { | ||
320 | + userDef3 = LocationStatus.LOCK_EMPTY_LOCATION; | ||
321 | + } else { | ||
322 | + if(inventoryDetail == null) { | ||
323 | + userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER; | ||
324 | + } else { | ||
325 | + location1.setMaterialName(materialNameList); | ||
326 | + location1.setMaterialCode(materialCodeList); | ||
327 | + location1.setBatch(batchList); | ||
328 | + location1.setQty(qtyList); | ||
329 | + userDef3 = LocationStatus.LOCK_FULL_CONTAINER; | ||
330 | + } | ||
261 | } | 331 | } |
262 | - return AjaxResult.success("删除成功!"); | ||
263 | - } | 332 | + } |
264 | 333 | ||
265 | - /** | ||
266 | - * 查询库位列表 | ||
267 | - */ | ||
268 | - @Log(title = "配置-库存资料-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) | ||
269 | - @PostMapping("/getLocationInfo") | ||
270 | - @ResponseBody | ||
271 | - public AjaxResult getLocationInfo(String type, String row, String line, String layer, String grid) { | ||
272 | - if (StringUtils.isEmpty(type)) { | ||
273 | - return AjaxResult.error("type不能为空"); | 334 | + if(location1.getDeleted()) { |
335 | + if(StringUtils.isEmpty(containerCode)) { | ||
336 | + userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION; | ||
337 | + } else { | ||
338 | + if(inventoryDetail == null) { | ||
339 | + userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER; | ||
340 | + } else { | ||
341 | + location1.setMaterialName(materialNameList); | ||
342 | + location1.setMaterialCode(materialCodeList); | ||
343 | + location1.setBatch(batchList); | ||
344 | + location1.setQty(qtyList); | ||
345 | + userDef3 = LocationStatus.DISABLE_FULL_CONTAINER; | ||
346 | + } | ||
274 | } | 347 | } |
348 | + } | ||
275 | 349 | ||
276 | - /* 查询库位信息*/ | ||
277 | - LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
278 | - locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row) | ||
279 | - .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line) | ||
280 | - .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer) | ||
281 | - .eq(Location::getIGrid, 1) // | ||
282 | - .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type) | ||
283 | - .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) | ||
284 | - .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type); | ||
285 | - List<Location> locations = locationService.list(locationLambdaQueryWrapper); | ||
286 | - List<Location> locationList = new ArrayList<>(); | ||
287 | - | ||
288 | - /* 查询库存明细*/ | ||
289 | - LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery(); | ||
290 | - inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); | ||
291 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda); | ||
292 | - | ||
293 | - for (Location location1 : locations) { | ||
294 | - InventoryDetail inventoryDetail = null; | ||
295 | - String materialName = null; | ||
296 | - for (InventoryDetail inventoryDetail2 : inventoryDetailList) { | ||
297 | - if (location1.getCode().equals(inventoryDetail2.getLocationCode())) { | ||
298 | - inventoryDetail = inventoryDetail2; | ||
299 | - } | ||
300 | - } | ||
301 | - List<InventoryDetail> inventoryDetails = inventoryDetailList.stream().filter(inventoryDetail1 -> | ||
302 | - inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList()); | ||
303 | - | ||
304 | - int userDef3 = 0; | ||
305 | - String status = location1.getStatus(); | ||
306 | - String containerCode = location1.getContainerCode(); | ||
307 | - List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList()); | ||
308 | - List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList()); | ||
309 | - List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList()); | ||
310 | - List<BigDecimal> qtyList = inventoryDetails.stream().map(InventoryDetail::getQty).collect(Collectors.toList()); | ||
311 | - if (QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) { | ||
312 | - if (StringUtils.isEmpty(containerCode)) { | ||
313 | - userDef3 = LocationStatus.IDLE_EMPTY_LOCATION; | ||
314 | - } else { | ||
315 | - if (inventoryDetail == null) { | ||
316 | - userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER; | ||
317 | - } else { | ||
318 | - location1.setMaterialName(materialNameList); | ||
319 | - location1.setMaterialCode(materialCodeList); | ||
320 | - location1.setBatch(batchList); | ||
321 | - location1.setQty(qtyList); | ||
322 | - userDef3 = LocationStatus.IDLE_FULL_CONTAINER; | ||
323 | - } | ||
324 | - } | ||
325 | - } else if (QuantityConstant.STATUS_LOCATION_LOCK.equals(status)) { | ||
326 | - if (StringUtils.isEmpty(containerCode)) { | ||
327 | - userDef3 = LocationStatus.LOCK_EMPTY_LOCATION; | ||
328 | - } else { | ||
329 | - if (inventoryDetail == null) { | ||
330 | - userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER; | ||
331 | - } else { | ||
332 | - location1.setMaterialName(materialNameList); | ||
333 | - location1.setMaterialCode(materialCodeList); | ||
334 | - location1.setBatch(batchList); | ||
335 | - location1.setQty(qtyList); | ||
336 | - userDef3 = LocationStatus.LOCK_FULL_CONTAINER; | ||
337 | - } | ||
338 | - } | ||
339 | - } | ||
340 | - | ||
341 | - if (location1.getDeleted()) { | ||
342 | - if (StringUtils.isEmpty(containerCode)) { | ||
343 | - userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION; | ||
344 | - } else { | ||
345 | - if (inventoryDetail == null) { | ||
346 | - userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER; | ||
347 | - } else { | ||
348 | - location1.setMaterialName(materialNameList); | ||
349 | - location1.setMaterialCode(materialCodeList); | ||
350 | - location1.setBatch(batchList); | ||
351 | - location1.setQty(qtyList); | ||
352 | - userDef3 = LocationStatus.DISABLE_FULL_CONTAINER; | ||
353 | - } | ||
354 | - } | ||
355 | - } | ||
356 | - | ||
357 | - location1.setUserDef3(String.valueOf(userDef3)); | ||
358 | - locationList.add(location1); | ||
359 | - } | ||
360 | - return AjaxResult.success(locations); | 350 | + location1.setUserDef3(String.valueOf(userDef3)); |
351 | + locationList.add(location1); | ||
361 | } | 352 | } |
353 | + return AjaxResult.success(locations); | ||
354 | + } | ||
355 | + | ||
362 | 356 | ||
357 | + @Log(title = "配置-库存资料-库位条码", operating = "库位条码打印", action = BusinessType.OTHER) | ||
358 | + // @ResponseBody // 错误1ajax是json数据而没有添加该注解返回值不为json所以不能够返回common.ajaxSetup.textStatus= "parsererror"报错 | ||
359 | + @GetMapping("/print/{ids}") | ||
360 | + public void print (@PathVariable("ids") Integer[] ids, ModelMap mmap) // arg1:物料id arg2:会话对象不需要直接返回 | ||
361 | + { | ||
362 | + print.jasperPrint(ids, prefix);// 不用返回json打印 | ||
363 | + } | ||
363 | 364 | ||
364 | - @Log(title = "配置-库存资料-库位条码", operating = "库位条码打印", action = BusinessType.OTHER) | ||
365 | - // @ResponseBody // 错误1ajax是json数据而没有添加该注解返回值不为json所以不能够返回common.ajaxSetup.textStatus= "parsererror"报错 | ||
366 | - @GetMapping("/print/{ids}") | ||
367 | - public void print(@PathVariable("ids") Integer[] ids, ModelMap mmap) // arg1:物料id arg2:会话对象不需要直接返回 | ||
368 | - { | ||
369 | - print.jasperPrint(ids, prefix);// 不用返回json打印 | 365 | + |
366 | + @Log(title = "监控-库位空闲监控-库位管理", operating = "查看库位空闲结果", action = BusinessType.GRANT) | ||
367 | + @PostMapping("/getIdleLocation") | ||
368 | + @ResponseBody | ||
369 | + public AjaxResult<?> getIdleLocation() { | ||
370 | + return AjaxResult.success(locationService.getIdleLocation()); | ||
370 | } | 371 | } |
371 | } | 372 | } |
src/main/java/com/huaheng/pc/config/location/domain/bo/LocationIdleBO.java
0 → 100644
1 | +package com.huaheng.pc.config.location.domain.bo; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import lombok.Builder; | ||
5 | +import lombok.Data; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author puff | ||
11 | + * @date 2023-06-21 | ||
12 | + */ | ||
13 | +@Data | ||
14 | +@Builder | ||
15 | +public class LocationIdleBO implements Serializable { | ||
16 | + | ||
17 | + @ApiModelProperty(value = "层级") | ||
18 | + private String ilayer; | ||
19 | + @ApiModelProperty(value = "巷道") | ||
20 | + private String roadway; | ||
21 | + @ApiModelProperty(value = "行数") | ||
22 | + private Integer irow; | ||
23 | + @ApiModelProperty(value = "空闲数") | ||
24 | + private Integer idleCount; | ||
25 | +} |
src/main/java/com/huaheng/pc/config/location/domain/vo/LocationIdleVO.java
0 → 100644
1 | +package com.huaheng.pc.config.location.domain.vo; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import lombok.Builder; | ||
5 | +import lombok.Data; | ||
6 | + | ||
7 | +import java.io.Serializable; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author puff | ||
11 | + * @date 2023-06-21 | ||
12 | + */ | ||
13 | +@Data | ||
14 | +public class LocationIdleVO implements Serializable { | ||
15 | + | ||
16 | + @ApiModelProperty(value = "巷道") | ||
17 | + private String roadway; | ||
18 | + @ApiModelProperty(value = "行数") | ||
19 | + private Integer irow; | ||
20 | + @ApiModelProperty(value = "空闲数") | ||
21 | + private Integer idleCount; | ||
22 | +} |
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
@@ -2,6 +2,7 @@ package com.huaheng.pc.config.location.mapper; | @@ -2,6 +2,7 @@ package com.huaheng.pc.config.location.mapper; | ||
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | import com.huaheng.pc.config.location.domain.Location; | 4 | import com.huaheng.pc.config.location.domain.Location; |
5 | +import com.huaheng.pc.config.location.domain.bo.LocationIdleBO; | ||
5 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
6 | 7 | ||
7 | import java.util.LinkedHashMap; | 8 | import java.util.LinkedHashMap; |
@@ -33,4 +34,6 @@ public interface LocationMapper extends BaseMapper<Location> { | @@ -33,4 +34,6 @@ public interface LocationMapper extends BaseMapper<Location> { | ||
33 | int getLastRowOfZone(@Param("warehouseCode") String warehouseCode, @Param("locationType") String locationType); | 34 | int getLastRowOfZone(@Param("warehouseCode") String warehouseCode, @Param("locationType") String locationType); |
34 | 35 | ||
35 | int updateStatusNew(@Param("code") String code, @Param("warehouseCode") String warehouseCode,@Param("status") String status, @Param("oldStatus") String oldStatus); | 36 | int updateStatusNew(@Param("code") String code, @Param("warehouseCode") String warehouseCode,@Param("status") String status, @Param("oldStatus") String oldStatus); |
37 | + | ||
38 | + List<LocationIdleBO> getIdleLocation(); | ||
36 | } | 39 | } |
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
@@ -4,6 +4,7 @@ import com.huaheng.framework.web.domain.AjaxResult; | @@ -4,6 +4,7 @@ import com.huaheng.framework.web.domain.AjaxResult; | ||
4 | import com.huaheng.pc.config.location.domain.Location; | 4 | import com.huaheng.pc.config.location.domain.Location; |
5 | import com.baomidou.mybatisplus.extension.service.IService; | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
6 | import com.huaheng.pc.config.location.domain.LocationInfo; | 6 | import com.huaheng.pc.config.location.domain.LocationInfo; |
7 | +import com.huaheng.pc.config.location.domain.vo.LocationIdleVO; | ||
7 | 8 | ||
8 | import java.util.LinkedHashMap; | 9 | import java.util.LinkedHashMap; |
9 | import java.util.List; | 10 | import java.util.List; |
@@ -118,4 +119,11 @@ public interface LocationService extends IService<Location>{ | @@ -118,4 +119,11 @@ public interface LocationService extends IService<Location>{ | ||
118 | void upstatus(String code); | 119 | void upstatus(String code); |
119 | 120 | ||
120 | int updateStatusNew(String locationCode, String warehouseCode, String status, String oldStatus); | 121 | int updateStatusNew(String locationCode, String warehouseCode, String status, String oldStatus); |
122 | + | ||
123 | + /** | ||
124 | + * 查询空闲库位数量 | ||
125 | + * @return | ||
126 | + */ | ||
127 | + List<LocationIdleVO> getIdleLocation(); | ||
128 | + | ||
121 | } | 129 | } |
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
@@ -12,17 +12,21 @@ import com.huaheng.common.utils.security.ShiroUtils; | @@ -12,17 +12,21 @@ import com.huaheng.common.utils.security.ShiroUtils; | ||
12 | import com.huaheng.framework.web.domain.AjaxResult; | 12 | import com.huaheng.framework.web.domain.AjaxResult; |
13 | import com.huaheng.pc.config.location.domain.Location; | 13 | import com.huaheng.pc.config.location.domain.Location; |
14 | import com.huaheng.pc.config.location.domain.LocationInfo; | 14 | import com.huaheng.pc.config.location.domain.LocationInfo; |
15 | +import com.huaheng.pc.config.location.domain.bo.LocationIdleBO; | ||
16 | +import com.huaheng.pc.config.location.domain.vo.LocationIdleVO; | ||
15 | import com.huaheng.pc.config.location.mapper.LocationMapper; | 17 | import com.huaheng.pc.config.location.mapper.LocationMapper; |
16 | import com.huaheng.pc.config.locationType.domain.LocationType; | 18 | import com.huaheng.pc.config.locationType.domain.LocationType; |
17 | import com.huaheng.pc.config.locationType.service.LocationTypeService; | 19 | import com.huaheng.pc.config.locationType.service.LocationTypeService; |
18 | import com.huaheng.pc.config.zone.domain.Zone; | 20 | import com.huaheng.pc.config.zone.domain.Zone; |
19 | import com.huaheng.pc.config.zone.service.ZoneService; | 21 | import com.huaheng.pc.config.zone.service.ZoneService; |
20 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; | 22 | import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; |
23 | +import io.swagger.models.auth.In; | ||
21 | import org.springframework.stereotype.Service; | 24 | import org.springframework.stereotype.Service; |
22 | 25 | ||
23 | import javax.annotation.Resource; | 26 | import javax.annotation.Resource; |
24 | import java.text.MessageFormat; | 27 | import java.text.MessageFormat; |
25 | import java.util.*; | 28 | import java.util.*; |
29 | +import java.util.stream.Collectors; | ||
26 | 30 | ||
27 | @Service("LocationService") | 31 | @Service("LocationService") |
28 | public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService { | 32 | public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService { |
@@ -361,7 +365,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -361,7 +365,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
361 | } | 365 | } |
362 | 366 | ||
363 | @Override | 367 | @Override |
364 | - public void updateContainerCodeAndStatus(String locationCode, String containerCode, | 368 | + public void updateContainerCodeAndStatus(String locationCode, String containerCode, |
365 | String status, String warehouseCode) { | 369 | String status, String warehouseCode) { |
366 | if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) { | 370 | if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) { |
367 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); | 371 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); |
@@ -371,7 +375,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -371,7 +375,10 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
371 | .eq(Location::getCode, locationCode); | 375 | .eq(Location::getCode, locationCode); |
372 | this.update(updateWrapper); | 376 | this.update(updateWrapper); |
373 | } | 377 | } |
374 | - } public LocationInfo getAllLocation(String type) { | 378 | + } |
379 | + | ||
380 | + @Override | ||
381 | + public LocationInfo getAllLocation(String type) { | ||
375 | if (StringUtils.isNotEmpty(type)) { | 382 | if (StringUtils.isNotEmpty(type)) { |
376 | Location location = locationMapper.getAllLocation(ShiroUtils.getWarehouseCode(), type); | 383 | Location location = locationMapper.getAllLocation(ShiroUtils.getWarehouseCode(), type); |
377 | LocationInfo locationInfo = new LocationInfo(); | 384 | LocationInfo locationInfo = new LocationInfo(); |
@@ -667,4 +674,26 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -667,4 +674,26 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
667 | } | 674 | } |
668 | return 0; | 675 | return 0; |
669 | } | 676 | } |
677 | + | ||
678 | + @Override | ||
679 | + public List<LocationIdleVO> getIdleLocation() { | ||
680 | + List<LocationIdleBO> idleBOList = locationMapper.getIdleLocation(); | ||
681 | + return idleBOList.stream() | ||
682 | + .collect(Collectors.groupingBy(LocationIdleBO::getRoadway)) // 以巷道分组 | ||
683 | + .entrySet().stream() | ||
684 | + .flatMap(entry -> entry.getValue().stream() | ||
685 | + .collect(Collectors.groupingBy(LocationIdleBO::getIrow)) // 获取当前巷道分组下的行级别数据 | ||
686 | + .entrySet().stream() | ||
687 | + .map(rowEntry -> { | ||
688 | + Integer idleCount = rowEntry.getValue().stream() | ||
689 | + .mapToInt(LocationIdleBO::getIdleCount) | ||
690 | + .sum(); // 计算空闲库位数量 | ||
691 | + LocationIdleVO idleInfo = new LocationIdleVO(); | ||
692 | + idleInfo.setRoadway(entry.getKey()); | ||
693 | + idleInfo.setIrow(rowEntry.getKey()); | ||
694 | + idleInfo.setIdleCount(idleCount); | ||
695 | + return idleInfo; | ||
696 | + })) | ||
697 | + .collect(Collectors.toList()); | ||
698 | + } | ||
670 | } | 699 | } |
src/main/resources/mybatis/config/LocationMapper.xml
@@ -32,6 +32,14 @@ | @@ -32,6 +32,14 @@ | ||
32 | <result column="systemCreated" jdbcType="INTEGER" property="systemCreated" /> | 32 | <result column="systemCreated" jdbcType="INTEGER" property="systemCreated" /> |
33 | <result column="deleted" jdbcType="BIT" property="deleted" /> | 33 | <result column="deleted" jdbcType="BIT" property="deleted" /> |
34 | </resultMap> | 34 | </resultMap> |
35 | + | ||
36 | + <resultMap id="BaseResultLocationIdleBOMap" type="com.huaheng.pc.config.location.domain.bo.LocationIdleBO"> | ||
37 | + <result column="ilayer" jdbcType="VARCHAR" property="ilayer" /> | ||
38 | + <result column="roadway" jdbcType="VARCHAR" property="roadway" /> | ||
39 | + <result column="irow" jdbcType="INTEGER" property="irow" /> | ||
40 | + <result column="count" jdbcType="INTEGER" property="idleCount" /> | ||
41 | + </resultMap> | ||
42 | + | ||
35 | <sql id="Base_Column_List"> | 43 | <sql id="Base_Column_List"> |
36 | <!--@mbg.generated--> | 44 | <!--@mbg.generated--> |
37 | id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, | 45 | id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, |
@@ -47,6 +55,20 @@ | @@ -47,6 +55,20 @@ | ||
47 | select code from location where #{locatingRule} | 55 | select code from location where #{locatingRule} |
48 | </select> | 56 | </select> |
49 | 57 | ||
58 | + <select id="getIdleLocation" resultMap="BaseResultLocationIdleBOMap"> | ||
59 | + select ilayer ,roadway, irow, COUNT(*) AS idleCount | ||
60 | + FROM location | ||
61 | + WHERE area = '1' -- 区域 | ||
62 | + AND warehouseCode = 'CS0001' -- 仓库 | ||
63 | + AND roadway IN ('1', '2', '3', '4') -- 巷道 | ||
64 | + AND status = 'empty' -- 状态:锁定、禁用,空闲 | ||
65 | + AND high IN (0, 1) -- 0 是低库位,1 是高库位 | ||
66 | + AND locationType IN ('L') -- 货位类型 | ||
67 | + AND containerCode = '' -- 容器编码 | ||
68 | + GROUP BY ilayer, irow | ||
69 | + ORDER BY ilayer, irow; | ||
70 | + </select> | ||
71 | + | ||
50 | <insert id="addList" parameterType="com.huaheng.pc.config.location.domain.Location" keyProperty="id" useGeneratedKeys="true" > | 72 | <insert id="addList" parameterType="com.huaheng.pc.config.location.domain.Location" keyProperty="id" useGeneratedKeys="true" > |
51 | INSERT INTO location( | 73 | INSERT INTO location( |
52 | code, | 74 | code, |