diff --git a/blade-service/logpm-distribution/pom.xml b/blade-service/logpm-distribution/pom.xml index fddde99cb..983c33a07 100644 --- a/blade-service/logpm-distribution/pom.xml +++ b/blade-service/logpm-distribution/pom.xml @@ -104,8 +104,12 @@ logpm-old-project-api ${bladex.project.version} - - + + org.springblade + blade-system-api + 3.1.0.RELEASE + compile + diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java index ef88e4b45..061440c0d 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionStockupAppController.java @@ -384,14 +384,14 @@ public class DistributionStockupAppController extends BladeController { return R.fail(3002, "备货库存品ID不能为空"); } List list = distributionStockupService.getLocationSelection(stockupDTO); - if(!list.isEmpty()){ + if(!list.isEmpty() && ObjectUtils.isNotNull(list.get(0))){ return R.data(list); } List listMarket = distributionStockupService.getLocationMarketSelection(stockupDTO); - if(!listMarket.isEmpty()){ + if(!listMarket.isEmpty() && ObjectUtils.isNotNull(listMarket.size())){ return R.data(listMarket); } - return R.data(null); + return R.fail(3002,"当前物料未上架,请上架后在继续备货操作!!!"); } @@ -594,7 +594,17 @@ public class DistributionStockupAppController extends BladeController { log.warn("##################allocationId: 货位ID为空!"); return R.fail("货位ID不能为空"); } - + //判断是否可以继续备货 + DistributionStockListEntity byId = iDistributionStockListService.getById(stockListId); + WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); + warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); + warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); + warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); + warehouseUpdownGoodsEntity.setAssociationType("4"); + WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); + if(ObjectUtils.isNull(locationInformation)){ + return Resp.scanFail("当前货位的本物料已为0,请更换货位继续!!", "当前货位的本物料已为0,请更换货位继续!!"); + } Integer i = distributionStockupService.selectPackagePrint(stockupDTO); switch (i) { case 1: @@ -617,16 +627,16 @@ public class DistributionStockupAppController extends BladeController { entity.setReservationId(reservationId); entity.setStockListId(stockListId); //添加物料信息 - DistributionStockListEntity byId = iDistributionStockListService.getById(stockListId); +// DistributionStockListEntity byId = iDistributionStockListService.getById(stockListId); if(ObjectUtils.isNotNull(byId.getMarketId())){ entity.setMarketId(byId.getMarketId()); entity.setMaterialId(byId.getMaterialId()); - WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); - warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); - warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); - warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); - warehouseUpdownGoodsEntity.setAssociationType("4"); - WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); +// WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = new WarehouseUpdownGoodsEntity(); +// warehouseUpdownGoodsEntity.setAllocationId(stockupDTO.getAllocationId()); +// warehouseUpdownGoodsEntity.setIncomingBatch(byId.getIncomingBatch()); +// warehouseUpdownGoodsEntity.setMarketId(byId.getMarketId()); +// warehouseUpdownGoodsEntity.setAssociationType("4"); +// WarehouseUpdownGoodsEntity locationInformation = warehouseUpdownGoodsClient.getLocationStockListInformation(warehouseUpdownGoodsEntity); if(!ObjectUtils.isNull(locationInformation)){ entity.setAllocationTitle(locationInformation.getPositionCode()); entity.setAllocationId(stockupDTO.getAllocationId()); @@ -645,7 +655,7 @@ public class DistributionStockupAppController extends BladeController { return R.fail(3002,"本货位的物料已为0,请更换货位继续!!"); } }else{ - return R.fail(3002,"物料信息查询失败,请联系TJJ!!"); + return Resp.scanFail("物料信息查询失败,请联系TJJ!!", "物料信息查询失败,请联系TJJ!!"); } entity.setConditions("0"); entity.setType(2); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java index 8ddc01cdf..b38bfd06b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockupController.java @@ -43,6 +43,7 @@ import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.entity.User; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -171,19 +172,11 @@ public class DistributionStockupController extends BladeController { @GetMapping("/listUser") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入distributionStockup") - public R listUser() { + public R> listUser() { //获取当前登录用户 BladeUser user = AuthUtil.getUser(); - BladeUser u = new BladeUser(); - BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); - if(ObjectUtil.isNotEmpty(myCurrentWarehouse)){ - - } - u.setDeptId(user.getDeptId()); - u.setTenantId(user.getTenantId()); - u.setUserId(user.getUserId()); - u.setUserName(user.getUserName()); - return R.data(u); + List cc = distributionStockupService.getRoleList(user.getDeptId(), user.getTenantId(), "叉车"); + return R.data(cc); } /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java index bd313ce3d..2a42ddfa7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockupService.java @@ -24,6 +24,7 @@ import com.logpm.distribution.excel.DistributionStockupExcel; import com.logpm.distribution.vo.*; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; +import org.springblade.system.entity.User; import java.util.List; import java.util.Map; @@ -194,4 +195,9 @@ public interface IDistributionStockupService extends BaseService getLocationMarketSelection(StockupDTO stockupDTO); + + /** + * @return + */ + List getRoleList(String deptId, String tenantId, String roleNames); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java index a28bec855..9c5f9d0b9 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java @@ -55,6 +55,9 @@ import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.cache.DictBizCache; +import org.springblade.system.entity.User; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.feign.IUserSearchClient; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -85,6 +88,12 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl getRoleList(String deptId, String tenantId, String roleNames) { + R roleIds = sysClient.getRoleIds(tenantId, roleNames); + R> listR = userSearchClient.listByRole(roleIds.getData()); + BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); + if(ObjectUtils.isNotNull(myCurrentWarehouse)){ + List collect = listR.getData().stream().filter(i -> + ObjectUtils.isNotNull(i.getDeptId()) ? i.getDeptId().equals(myCurrentWarehouse.getDepartment().toString()) : false + ).collect(Collectors.toList()); + return collect; + }else{ + return listR.getData(); + } + + } + } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java index ef75ab83f..ee1edb535 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseUpdownTypeApiController.java @@ -908,6 +908,39 @@ public class WarehouseUpdownTypeApiController { } } + @ResponseBody + @PostMapping("/moveAllocationScanSourceAllocation") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "移库扫描来源库位", notes = "传入trayTypeDTO") + public R moveAllocationScanSourceAllocation(@RequestBody UpdownTypeDTO updownTypeDTO) { + String method = "###########moveAllocationScanSourceAllocation: "; + log.info(method + "移库扫描来源库位 updownTypeDTO={}", updownTypeDTO); + Long allocationId = updownTypeDTO.getAllocationId();//目标库位码 + + try{ + + BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); + if(Objects.isNull(myCurrentWarehouse)){ + log.warn(method+"仓库信息不能为空"); + return R.fail(403,"仓库信息不能为空"); + } + + if(Objects.isNull(allocationId)){ + log.warn(method+"库位码不能为空 allocationId={}",allocationId); + return R.fail(403,"库位码不能为空"); + } + //查询该库位的货物信息 + UpShelfAllocationVO upShelfAllocationVO = warehouseUpdownTypeService.moveAllocationScanSourceAllocation(allocationId,myCurrentWarehouse.getId()); + return R.data(upShelfAllocationVO); + }catch (CustomerException e){ + log.warn(e.message); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常,联系管理员",e); + return R.fail(500,"系统异常,联系管理员"); + } + } + @ResponseBody @PostMapping("/moveAllocationByAllocation") diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java index 6479673b5..1b99ffe7b 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java @@ -64,4 +64,6 @@ public interface IWarehouseUpdownTypeService extends BaseService queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("allocation_id",allocationId); + List list = warehouseUpdownGoodsService.list(queryWrapper); + if(list.isEmpty()){ + log.warn("#################upShelfScanAllocation: 库位暂无货物绑定 allocationId={}",allocationId); + throw new CustomerException(403,"库位暂无货物绑定"); + } + + + String warehouseName = basicdataWarehouseEntity.getName();//仓库名称 + + UpShelfAllocationVO upShelfAllocationVO = new UpShelfAllocationVO(); + upShelfAllocationVO.setWarehouseId(warehouseId); + upShelfAllocationVO.setWarehouseName(warehouseName); + upShelfAllocationVO.setAreaId(goodsAreaId); + upShelfAllocationVO.setAreaTitle(goodsAreaName); + upShelfAllocationVO.setShelfId(goodsShelfId); + upShelfAllocationVO.setShelfTitle(goodsShelfName); + upShelfAllocationVO.setAllocationId(allocationId); + upShelfAllocationVO.setAllocationTitle(goodsAllocationName); + //就去查对应的库位绑定数据 + QueryWrapper updownTypeEntityQueryWrapper = new QueryWrapper<>(); + updownTypeEntityQueryWrapper.eq("area_id",goodsAreaId) + .eq("shelf_id",goodsShelfId) + .eq("allocation_id",allocationId) + .eq("is_deleted",0); + WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectOne(updownTypeEntityQueryWrapper); + if(Objects.isNull(updownTypeEntity)){ + log.warn("#############upShelfScanAllocation: 库位暂无数据 allocationId={}",allocationId); + return upShelfAllocationVO; + } + upShelfAllocationVO.setTotalNum(updownTypeEntity.getTotalNum()); + upShelfAllocationVO.setOrderTotalnum(updownTypeEntity.getOrderTotalNum()); + upShelfAllocationVO.setStockNum(updownTypeEntity.getStockNum()); + upShelfAllocationVO.setStockTotalNum(updownTypeEntity.getStockTotalNum()); + Long updownTypeId = updownTypeEntity.getId();//库位打包货物方式id + //同一个货位上能存所有类型的货物,所以要分三类来查 association_type 1订单号(零担) 3包件码(订单号) 4库存品 + List packageList = warehouseUpdownGoodsService.findPackageByUpdownTypeId(updownTypeId); + List zeroList = warehouseUpdownGoodsService.findZeroByUpdownTypeId(updownTypeId); + Integer orderNum = packageList.size() + zeroList.size(); + upShelfAllocationVO.setOrderNum(orderNum); + List stockList = warehouseUpdownGoodsService.findStockByUpdownTypeId(updownTypeId); + upShelfAllocationVO.getList().addAll(packageList); + upShelfAllocationVO.getList().addAll(zeroList); + upShelfAllocationVO.getList().addAll(stockList); + + //查询货位上是否有托盘 + BasicdataTrayEntity basicdataTrayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); + if(!Objects.isNull(basicdataTrayEntity)){ + //有托盘就查询托盘上的数据 + Long trayId = basicdataTrayEntity.getId(); + String trayCode = basicdataTrayEntity.getPalletCode(); + upShelfAllocationVO.setTrayId(trayId); + upShelfAllocationVO.setTrayCode(trayCode); + QueryWrapper trayTypeEntityQueryWrapper = new QueryWrapper<>(); + trayTypeEntityQueryWrapper.eq("tray_id",trayId) + .eq("is_deleted",0); + WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService.getOne(trayTypeEntityQueryWrapper); + if(Objects.isNull(trayTypeEntity)){ + log.warn("#############upShelfScanAllocation: 托盘未找到打托数据 trayId={}",trayId); + throw new CustomerException(403,"托盘未找到打托数据"); + } + String type = trayTypeEntity.getType();//打托分类 + upShelfAllocationVO.setTotalNum(trayTypeEntity.getTotalNum()); + upShelfAllocationVO.setOrderTotalnum(trayTypeEntity.getOrderTotalNum()); + upShelfAllocationVO.setStockNum(trayTypeEntity.getStockNum()); + upShelfAllocationVO.setStockTotalNum(trayTypeEntity.getStockTotalNum()); + if("1".equals(type) || "2".equals(type)){ + upShelfAllocationVO.setTrayNum(trayTypeEntity.getTotalNum()); + }else if("3".equals(type) || "4".equals(type)){ + upShelfAllocationVO.setTrayNum(trayTypeEntity.getStockNum()); + } + } + + return upShelfAllocationVO; + } + private void changeUpdownGoodsToNewAllocation(List list, Long allocationId,WarehouseUpdownTypeEntity updownTypeEntity) { BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId); if(Objects.isNull(goodsAllocationEntity)){