| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsArea; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsAreaLocation; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.tool.node.ForestNodeMerger; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsArea; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsAreaLocation; |
| | | import com.qianwen.smartman.modules.cps.convert.WarehouseAreaConvert; |
| | | import com.qianwen.smartman.modules.cps.entity.WarehouseArea; |
| | | import com.qianwen.smartman.modules.cps.entity.WarehouseStation; |
| | |
| | | import com.qianwen.smartman.modules.cps.vo.WarehouseAreaUpdateVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WarehouseAreaVO; |
| | | import com.qianwen.smartman.modules.fms.entity.FmsRealTimeTray; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/WarehouseAreaServiceImpl.class */ |
| | | public class WarehouseAreaServiceImpl extends BaseServiceImpl<WarehouseAreaMapper, WarehouseArea> implements IWarehouseAreaService { |
| | | private final IWarehouseStationService iWarehouseStationService; |
| | | private final ITrayStorageService trayStorageService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 286461310: |
| | | if (implMethodName.equals("getAreaId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | switch (z) { |
| | | case false: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WarehouseArea") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getName(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getId(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WarehouseArea") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | break; |
| | | case true: |
| | | if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/WarehouseStation") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getAreaId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public WarehouseAreaServiceImpl(final IWarehouseStationService iWarehouseStationService, final ITrayStorageService trayStorageService) { |
| | | this.iWarehouseStationService = iWarehouseStationService; |
| | |
| | | if (Func.isNotEmpty(warehouseAreaSubmitVO.getCode()) && warehouseAreaSubmitVO.getCode().length() > 24) { |
| | | throw new ServiceException(MessageUtils.message("cps.warehouse.area.code.length.too.long", new Object[0])); |
| | | } |
| | | Long count = Long.valueOf(count(Wrappers.<WarehouseArea>lambdaQuery() |
| | | .ne(Func.isNotEmpty(warehouseAreaSubmitVO.getId()), WarehouseArea::getId, warehouseAreaSubmitVO.getId()) |
| | | .eq(WarehouseArea::getCode, warehouseAreaSubmitVO.getCode()))); |
| | | /* |
| | | Long count = Long.valueOf(count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(warehouseAreaSubmitVO.getId()), (v0) -> { |
| | | return v0.getId(); |
| | | }, warehouseAreaSubmitVO.getId()).eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, warehouseAreaSubmitVO.getCode()))); |
| | | }, warehouseAreaSubmitVO.getCode())));*/ |
| | | |
| | | if (count.longValue() > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.warehouse.area.code.already.exists", new Object[0])); |
| | | } |
| | | if (Func.isNotEmpty(warehouseAreaSubmitVO.getName()) && warehouseAreaSubmitVO.getName().length() > 32) { |
| | | throw new ServiceException(MessageUtils.message("cps.warehouse.area.name.length.too.long", new Object[0])); |
| | | } |
| | | Long countName = Long.valueOf(count(Wrappers.<WarehouseArea>lambdaQuery() |
| | | .ne(Func.isNotEmpty(warehouseAreaSubmitVO.getId()), WarehouseArea::getId, warehouseAreaSubmitVO.getId()) |
| | | .eq(WarehouseArea::getName, warehouseAreaSubmitVO.getName()))); |
| | | /* |
| | | Long countName = Long.valueOf(count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(warehouseAreaSubmitVO.getId()), (v0) -> { |
| | | return v0.getId(); |
| | | }, warehouseAreaSubmitVO.getId()).eq((v0) -> { |
| | | return v0.getName(); |
| | | }, warehouseAreaSubmitVO.getName()))); |
| | | }, warehouseAreaSubmitVO.getName())));*/ |
| | | if (countName.longValue() > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.warehouse.area.name.already.exists", new Object[0])); |
| | | } |
| | |
| | | @Override // org.springblade.modules.cps.service.IWarehouseAreaService |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean removeWithRelation(List<Long> ids) { |
| | | List<WarehouseStation> stationList = this.iWarehouseStationService.list(Wrappers.<WarehouseStation>lambdaQuery().select(WarehouseStation::getId) |
| | | .in(WarehouseStation::getAreaId, ids)); |
| | | /* |
| | | List<WarehouseStation> stationList = this.iWarehouseStationService.list((Wrapper) Wrappers.lambdaQuery().select(new SFunction[]{(v0) -> { |
| | | return v0.getId(); |
| | | }}).in((v0) -> { |
| | | return v0.getAreaId(); |
| | | }, ids)); |
| | | }, ids));*/ |
| | | if (Func.isNotEmpty(stationList)) { |
| | | throw new ServiceException(MessageUtils.message("cps.warehouse.area.cannot.delete", new Object[0])); |
| | | } |
| | |
| | | public List<WarehouseAreaStationVO> areaStationTree() { |
| | | List<WarehouseAreaStationVO> stationList = ((WarehouseAreaMapper) this.baseMapper).stationList(); |
| | | List<WarehouseArea> areaList = list(); |
| | | List<WarehouseAreaStationVO> areas = (List) areaList.stream().map(c -> { |
| | | List<WarehouseAreaStationVO> areas = areaList.stream().map(c -> { |
| | | WarehouseAreaStationVO vo = new WarehouseAreaStationVO(); |
| | | vo.setId(c.getId()); |
| | | vo.setCode(c.getCode()); |
| | |
| | | List<WarehouseArea> areaList = list(Lambda.in(Func.isNotEmpty(filterAreaId), (v0) -> { |
| | | return v0.getId(); |
| | | }, filterAreaId)); |
| | | List<FmsArea> fmsAreaList = (List) areaList.stream().map(area -> { |
| | | List<FmsArea> fmsAreaList = areaList.stream().map(area -> { |
| | | FmsArea fmsArea = new FmsArea(); |
| | | fmsArea.setId(area.getId() + ""); |
| | | fmsArea.setName(area.getName()); |
| | | fmsArea.setCode(area.getCode()); |
| | | fmsArea.setLocationList((List) stationList.stream().filter(station -> { |
| | | fmsArea.setLocationList(stationList.stream().filter(station -> { |
| | | return area.getId().equals(station.getParentId()); |
| | | }).map(station2 -> { |
| | | FmsAreaLocation fmsAreaStation = new FmsAreaLocation(); |
| | |
| | | @Override // org.springblade.modules.cps.service.IWarehouseAreaService |
| | | public List<FmsArea> assembleAreaData(List<String> filterAreaIds, Map<String, FmsRealTimeTray> realTimeTrayMap) { |
| | | List<WarehouseAreaStationVO> stationList = ((WarehouseAreaMapper) this.baseMapper).stationList(); |
| | | List<WarehouseArea> list = list(Wrappers.<WarehouseArea>lambdaQuery().in(WarehouseArea::getId, filterAreaIds)); |
| | | /* |
| | | List<WarehouseArea> list = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, filterAreaIds)); |
| | | return (List) list.stream().map(area -> { |
| | | }, filterAreaIds));*/ |
| | | return list.stream().map(area -> { |
| | | FmsArea fmsArea = new FmsArea(); |
| | | fmsArea.setId(String.valueOf(area.getId())); |
| | | fmsArea.setName(area.getName()); |
| | |
| | | List<FmsAreaLocation> locationList = new ArrayList<>(); |
| | | stationList.forEach(station -> { |
| | | if (area.getId().equals(station.getParentId())) { |
| | | List<String> trayCodes = (List) this.trayStorageService.listTray(station.getId()).stream().map((v0) -> { |
| | | List<String> trayCodes = this.trayStorageService.listTray(station.getId()).stream().map((v0) -> { |
| | | return v0.getTrayCode(); |
| | | }).collect(Collectors.toList()); |
| | | for (String trayCode : trayCodes) { |