From 4a69ae2d2a949b0028634578a2561bf580b06357 Mon Sep 17 00:00:00 2001 From: caoyizhong <1270296080@qq.com> Date: Mon, 25 Sep 2023 10:23:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=87=E8=B4=A7=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E8=A7=92=E8=89=B2=E4=B8=8D=E8=83=BD=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blade-service/logpm-distribution/pom.xml | 8 +++-- .../DistributionStockupAppController.java | 34 ++++++++++++------- .../DistributionStockupController.java | 15 +++----- .../service/IDistributionStockupService.java | 6 ++++ .../impl/DistributionStockupServiceImpl.java | 28 +++++++++++++++ 5 files changed, 66 insertions(+), 25 deletions(-) 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(); + } + + } + }