Commit a6482cd902dd8ab6afed620eeb59d3df99bb0b30
1 parent
695e9b54
完成pda出库组盘选站台功能
Showing
1 changed file
with
89 additions
and
1 deletions
src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java
... | ... | @@ -6,6 +6,7 @@ import com.huaheng.api.general.domain.ReceiptDomain; |
6 | 6 | import com.huaheng.api.general.domain.ShipmentDomain; |
7 | 7 | import com.huaheng.common.constant.QuantityConstant; |
8 | 8 | import com.huaheng.common.exception.BusinessException; |
9 | +import com.huaheng.common.exception.service.ServiceException; | |
9 | 10 | import com.huaheng.common.utils.StringUtils; |
10 | 11 | import com.huaheng.common.utils.security.ShiroUtils; |
11 | 12 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
... | ... | @@ -16,6 +17,10 @@ import com.huaheng.mobile.invenory.TaskIds; |
16 | 17 | import com.huaheng.mobile.receipt.ReceiptBill; |
17 | 18 | import com.huaheng.pc.config.company.domain.Company; |
18 | 19 | import com.huaheng.pc.config.company.service.CompanyService; |
20 | +import com.huaheng.pc.config.container.domain.Container; | |
21 | +import com.huaheng.pc.config.container.service.ContainerService; | |
22 | +import com.huaheng.pc.config.location.domain.Location; | |
23 | +import com.huaheng.pc.config.location.service.LocationService; | |
19 | 24 | import com.huaheng.pc.config.material.domain.Material; |
20 | 25 | import com.huaheng.pc.config.material.service.MaterialService; |
21 | 26 | import com.huaheng.pc.config.receiptType.domain.ReceiptType; |
... | ... | @@ -80,6 +85,11 @@ public class MobileShipmentController extends BaseController { |
80 | 85 | @Resource |
81 | 86 | private StationService stationService; |
82 | 87 | |
88 | + @Resource | |
89 | + private ContainerService containerService; | |
90 | + | |
91 | + @Resource | |
92 | + private LocationService locationService; | |
83 | 93 | /** |
84 | 94 | * 自动组盘 |
85 | 95 | * @param |
... | ... | @@ -319,6 +329,63 @@ public class MobileShipmentController extends BaseController { |
319 | 329 | return AjaxResult.success(shipmentTypes); |
320 | 330 | } |
321 | 331 | |
332 | + @PostMapping("/getStationByCombinId") | |
333 | + @ApiOperation("移动端根据组盘头id查询可用站台") | |
334 | + @Log(title = "移动端根据组盘头id查询可用站台", action = BusinessType.OTHER) | |
335 | + public AjaxResult getStationByCombinId(Integer id){ | |
336 | + ShipmentContainerHeader header = shipmentContainerHeaderService.getById(id); | |
337 | + | |
338 | + int taskType = header.getTaskType().intValue(); | |
339 | + int stationType = -1; | |
340 | + if(taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT || | |
341 | + taskType == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT) { | |
342 | + stationType = QuantityConstant.STATION_OUT; | |
343 | + } else if(taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT || | |
344 | + taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT || | |
345 | + taskType == QuantityConstant.TASK_TYPE_VIEW || | |
346 | + taskType == QuantityConstant.TASK_TYPE_CYCLECOUNT) { | |
347 | + stationType = QuantityConstant.STATION_PICK; | |
348 | + } else { | |
349 | + throw new ServiceException("任务类型不需要选站台"); | |
350 | + } | |
351 | + | |
352 | + List<Station> stationList = getStationListByContainerAndType(header.getContainerCode(), stationType); | |
353 | + return AjaxResult.success(stationList); | |
354 | + } | |
355 | + | |
356 | + /** | |
357 | + * 从StationController.getStationFromType移植过来 | |
358 | + * @param containerCode | |
359 | + * @param type | |
360 | + * @return | |
361 | + */ | |
362 | + private List<Station> getStationListByContainerAndType(String containerCode, int type){ | |
363 | + Container container = containerService.getContainerByCode(containerCode); | |
364 | + | |
365 | + String locationCode = container.getLocationCode(); | |
366 | + if(StringUtils.isEmpty(locationCode)) { | |
367 | + return null; | |
368 | + } | |
369 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
370 | + locationLambdaQueryWrapper.eq(Location::getCode, locationCode) | |
371 | + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
372 | + Location location1 = locationService.getOne(locationLambdaQueryWrapper); | |
373 | + if(location1 == null) { | |
374 | + return null; | |
375 | + } | |
376 | + | |
377 | + LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery(); | |
378 | + if(type == QuantityConstant.STATION_PICK_AND_OUT) { | |
379 | + queryWrapper.in(Station::getType, | |
380 | + QuantityConstant.STATION_OUT, QuantityConstant.STATION_PICK); | |
381 | + } else { | |
382 | + queryWrapper.eq(Station::getType, type); | |
383 | + } | |
384 | + queryWrapper.eq(Station::getArea, location1.getArea()); | |
385 | + List<Station> stationList = stationService.list(queryWrapper); | |
386 | + | |
387 | + return stationList; | |
388 | + } | |
322 | 389 | |
323 | 390 | @PostMapping("/createShipmentCode") |
324 | 391 | @ApiOperation("移动端创建出库单号") |
... | ... | @@ -393,4 +460,25 @@ public class MobileShipmentController extends BaseController { |
393 | 460 | return mShipmentDetailIds; |
394 | 461 | } |
395 | 462 | |
396 | -} | |
463 | + @Log(title = "移动端设置站台", operating = "设置站台", action = BusinessType.GRANT) | |
464 | + @PostMapping("/setStation") | |
465 | + @ResponseBody | |
466 | + public AjaxResult setStation (String id, String station){ | |
467 | + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
468 | + shipmentContainerHeaderLambdaQueryWrapper.eq(ShipmentContainerHeader::getId, id); | |
469 | + ShipmentContainerHeader shipmentContainerHeader1 = shipmentContainerHeaderService.getOne(shipmentContainerHeaderLambdaQueryWrapper); | |
470 | + shipmentContainerHeader1.setPort(station); | |
471 | + shipmentContainerHeaderService.update(shipmentContainerHeader1, shipmentContainerHeaderLambdaQueryWrapper); | |
472 | + return AjaxResult.success(); | |
473 | + } | |
474 | + | |
475 | + @Log(title = "移动端根据id_list取组盘头", operating = "移动端根据id_list取组盘头", action = BusinessType.GRANT) | |
476 | + @PostMapping("/getShipmentInfoByIdList") | |
477 | + @ResponseBody | |
478 | + public AjaxResult<List<ShipmentContainerHeader>> getShipmentInfoByIdList(String[] id_list){ | |
479 | + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
480 | + shipmentContainerHeaderLambdaQueryWrapper.in(ShipmentContainerHeader::getId, id_list); | |
481 | + List<ShipmentContainerHeader> list = shipmentContainerHeaderService.list(shipmentContainerHeaderLambdaQueryWrapper); | |
482 | + return AjaxResult.success(list); | |
483 | + } | |
484 | +} | |
397 | 485 | \ No newline at end of file |
... | ... |