From a6482cd902dd8ab6afed620eeb59d3df99bb0b30 Mon Sep 17 00:00:00 2001 From: zhoufeng <27208084@qq.com> Date: Fri, 24 Sep 2021 16:43:24 +0800 Subject: [PATCH] 完成pda出库组盘选站台功能 --- src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java b/src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java index 9d67210..cbbe385 100644 --- a/src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java +++ b/src/main/java/com/huaheng/mobile/shipment/MobileShipmentController.java @@ -6,6 +6,7 @@ import com.huaheng.api.general.domain.ReceiptDomain; import com.huaheng.api.general.domain.ShipmentDomain; import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.BusinessException; +import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.aspectj.lang.annotation.Log; @@ -16,6 +17,10 @@ import com.huaheng.mobile.invenory.TaskIds; import com.huaheng.mobile.receipt.ReceiptBill; import com.huaheng.pc.config.company.domain.Company; import com.huaheng.pc.config.company.service.CompanyService; +import com.huaheng.pc.config.container.domain.Container; +import com.huaheng.pc.config.container.service.ContainerService; +import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.service.LocationService; import com.huaheng.pc.config.material.domain.Material; import com.huaheng.pc.config.material.service.MaterialService; import com.huaheng.pc.config.receiptType.domain.ReceiptType; @@ -80,6 +85,11 @@ public class MobileShipmentController extends BaseController { @Resource private StationService stationService; + @Resource + private ContainerService containerService; + + @Resource + private LocationService locationService; /** * 自动组盘 * @param @@ -319,6 +329,63 @@ public class MobileShipmentController extends BaseController { return AjaxResult.success(shipmentTypes); } + @PostMapping("/getStationByCombinId") + @ApiOperation("移动端根据组盘头id查询可用站台") + @Log(title = "移动端根据组盘头id查询可用站台", action = BusinessType.OTHER) + public AjaxResult getStationByCombinId(Integer id){ + ShipmentContainerHeader header = shipmentContainerHeaderService.getById(id); + + int taskType = header.getTaskType().intValue(); + int stationType = -1; + if(taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT || + taskType == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT) { + stationType = QuantityConstant.STATION_OUT; + } else if(taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT || + taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT || + taskType == QuantityConstant.TASK_TYPE_VIEW || + taskType == QuantityConstant.TASK_TYPE_CYCLECOUNT) { + stationType = QuantityConstant.STATION_PICK; + } else { + throw new ServiceException("任务类型不需要选站台"); + } + + List<Station> stationList = getStationListByContainerAndType(header.getContainerCode(), stationType); + return AjaxResult.success(stationList); + } + + /** + * 从StationController.getStationFromType移植过来 + * @param containerCode + * @param type + * @return + */ + private List<Station> getStationListByContainerAndType(String containerCode, int type){ + Container container = containerService.getContainerByCode(containerCode); + + String locationCode = container.getLocationCode(); + if(StringUtils.isEmpty(locationCode)) { + return null; + } + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(Location::getCode, locationCode) + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); + Location location1 = locationService.getOne(locationLambdaQueryWrapper); + if(location1 == null) { + return null; + } + + LambdaQueryWrapper<Station> queryWrapper = Wrappers.lambdaQuery(); + if(type == QuantityConstant.STATION_PICK_AND_OUT) { + queryWrapper.in(Station::getType, + QuantityConstant.STATION_OUT, QuantityConstant.STATION_PICK); + } else { + queryWrapper.eq(Station::getType, type); + } + queryWrapper.eq(Station::getArea, location1.getArea()); + List<Station> stationList = stationService.list(queryWrapper); + + return stationList; + } @PostMapping("/createShipmentCode") @ApiOperation("移动端创建出库单号") @@ -393,4 +460,25 @@ public class MobileShipmentController extends BaseController { return mShipmentDetailIds; } -} + @Log(title = "移动端设置站台", operating = "设置站台", action = BusinessType.GRANT) + @PostMapping("/setStation") + @ResponseBody + public AjaxResult setStation (String id, String station){ + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentContainerHeaderLambdaQueryWrapper.eq(ShipmentContainerHeader::getId, id); + ShipmentContainerHeader shipmentContainerHeader1 = shipmentContainerHeaderService.getOne(shipmentContainerHeaderLambdaQueryWrapper); + shipmentContainerHeader1.setPort(station); + shipmentContainerHeaderService.update(shipmentContainerHeader1, shipmentContainerHeaderLambdaQueryWrapper); + return AjaxResult.success(); + } + + @Log(title = "移动端根据id_list取组盘头", operating = "移动端根据id_list取组盘头", action = BusinessType.GRANT) + @PostMapping("/getShipmentInfoByIdList") + @ResponseBody + public AjaxResult<List<ShipmentContainerHeader>> getShipmentInfoByIdList(String[] id_list){ + LambdaQueryWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentContainerHeaderLambdaQueryWrapper.in(ShipmentContainerHeader::getId, id_list); + List<ShipmentContainerHeader> list = shipmentContainerHeaderService.list(shipmentContainerHeaderLambdaQueryWrapper); + return AjaxResult.success(list); + } +} \ No newline at end of file -- libgit2 0.22.2