| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.google.common.collect.Sets; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | import java.util.Set; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.constant.ToolingConstant; |
| | | import com.qianwen.smartman.common.enums.CommonGroupTypeEnum; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsArea; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.google.common.collect.Sets; |
| | | import com.qianwen.core.excel.util.ExcelUtil; |
| | | import com.qianwen.core.mp.service.impl.BladeServiceImpl; |
| | | import com.qianwen.core.oss.model.BladeFile; |
| | | import com.qianwen.core.secure.utils.AuthUtil; |
| | | import com.qianwen.core.tool.support.Kv; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.constant.ToolingConstant; |
| | | import com.qianwen.smartman.common.enums.CommonGroupTypeEnum; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.websocket.entity.FmsArea; |
| | | import com.qianwen.smartman.modules.cps.convert.TrayStorageConvert; |
| | | import com.qianwen.smartman.modules.cps.dto.RemoveIdsDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.CommonGroupOfItem; |
| | |
| | | import com.qianwen.smartman.modules.fms.enums.PositionTypeEnum; |
| | | import com.qianwen.smartman.modules.fms.service.IFmsRealTimeTrayService; |
| | | import com.qianwen.smartman.modules.resource.builder.oss.OssBuilder; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/TrayStorageServiceImpl.class */ |
| | |
| | | private IFmsRealTimeTrayService fmsRealTimeTrayService; |
| | | @Autowired |
| | | private ICommonGroupOfItemService itemService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -927447111: |
| | | if (implMethodName.equals("getTrayCode")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1929248666: |
| | | if (implMethodName.equals("getWarehouseCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1956157548: |
| | | if (implMethodName.equals("getInUse")) { |
| | | 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/fms/entity/FmsRealTimeTray") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTrayCode(); |
| | | }; |
| | | } |
| | | 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/Tray") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getInUse(); |
| | | }; |
| | | } |
| | | 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/Tray") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getInUse(); |
| | | }; |
| | | } |
| | | 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/String;")) { |
| | | return (v0) -> { |
| | | return v0.getWarehouseCode(); |
| | | }; |
| | | } |
| | | 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(); |
| | | }; |
| | | } |
| | | 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(); |
| | | }; |
| | | } |
| | | 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/Tray") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | |
| | | @Override // org.springblade.modules.cps.service.ITrayStorageService |
| | | public List<WareTrayStorageVO> listTray(Long id) { |
| | | return this.baseMapper.listTray(id); |
| | |
| | | public List<TrayStorageVO> addTrayStorage(TrayStorageAddVO vo) { |
| | | List<Long> trayIds = vo.getTrayIds(); |
| | | Long warehouseStationId = vo.getWarehouseStationId(); |
| | | List<TrayStorage> storages = (List) trayIds.stream().map(c -> { |
| | | |
| | | |
| | | List<TrayStorage> storages = trayIds.stream().map(c -> { |
| | | return new TrayStorage().setTrayId(c).setWarehouseStationId(warehouseStationId); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | saveBatch(storages); |
| | | this.trayService.update(Wrappers.<Tray>lambdaUpdate() |
| | | .set(Tray::getInUse, ToolingConstant.TOOLING_IN_USE) |
| | | .in(Tray::getId, trayIds)); |
| | | /* |
| | | this.trayService.update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getInUse(); |
| | | }, ToolingConstant.TOOLING_IN_USE)).in((v0) -> { |
| | | return v0.getId(); |
| | | }, trayIds)); |
| | | }, trayIds));*/ |
| | | saveFmsRealTimeTray(storages); |
| | | return TrayStorageConvert.INSTANCE.convert(storages); |
| | | } |
| | |
| | | trayIds.add(trayStorage.getTrayId()); |
| | | warehouseStationIds.add(trayStorage.getWarehouseStationId()); |
| | | }); |
| | | Map<Long, String> trayMap = (Map) this.trayService.listByIds(trayIds).stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, String> trayMap = this.trayService.listByIds(trayIds).stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, (v0) -> { |
| | | return v0.getCode(); |
| | | })); |
| | | Map<Long, String> warehouseStationMap = (Map) this.warehouseStationService.getWarehouseStationList(warehouseStationIds).stream().collect(Collectors.toMap((v0) -> { |
| | | Map<Long, String> warehouseStationMap = this.warehouseStationService.getWarehouseStationList(warehouseStationIds).stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getId(); |
| | | }, (v0) -> { |
| | | return v0.getWarehouseAreaCode(); |
| | |
| | | int count = this.trayService.removeFaceFixture(trayIds); |
| | | ThrowFun.isTrue(count > 0).throwMessage(MessageUtils.message("cps.tray.face.banding.fixture", new Object[0])); |
| | | boolean remove = removeByIds(idList); |
| | | boolean update = this.trayService.update(Wrappers.<Tray>lambdaUpdate() |
| | | .set(Tray::getInUse, ToolingConstant.TOOLING_NOT_USE) |
| | | .in(Tray::getId, trayIds)); |
| | | /* |
| | | boolean update = this.trayService.update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getInUse(); |
| | | }, ToolingConstant.TOOLING_NOT_USE)).in((v0) -> { |
| | | return v0.getId(); |
| | | }, trayIds)); |
| | | }, trayIds));*/ |
| | | Boolean fmsRealTimeTrayFlag = removeFmsRealTimeTray(trayIds); |
| | | return Boolean.valueOf(remove && update && fmsRealTimeTrayFlag.booleanValue()); |
| | | } |
| | | |
| | | private Boolean removeFmsRealTimeTray(List<Long> trayIds) { |
| | | List<Tray> trays = this.trayService.listByIds(trayIds); |
| | | List<String> trayCodes = (List) trays.stream().map((v0) -> { |
| | | List<String> trayCodes = trays.stream().map((v0) -> { |
| | | return v0.getCode(); |
| | | }).collect(Collectors.toList()); |
| | | return Boolean.valueOf(this.fmsRealTimeTrayService.remove(Wrappers.<FmsRealTimeTray>lambdaQuery() |
| | | .in(FmsRealTimeTray::getTrayCode, trayCodes))); |
| | | /* |
| | | return Boolean.valueOf(this.fmsRealTimeTrayService.remove((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getTrayCode(); |
| | | }, trayCodes))); |
| | | }, trayCodes)));*/ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ITrayStorageService |
| | |
| | | if (Func.isNotEmpty(failExcel)) { |
| | | return exportFailFile(failExcel); |
| | | } |
| | | Map<String, WarehouseArea> needSaveAreaMap = (Map) needSaveArea.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WarehouseArea> needSaveAreaMap = needSaveArea.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, Function.identity(), v1, v2 -> { |
| | | }, Function.identity(), (v1, v2) -> { |
| | | return v1; |
| | | })); |
| | | Map<String, WarehouseStation> needSaveStationMap = (Map) needSaveStation.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WarehouseStation> needSaveStationMap = needSaveStation.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getWarehouseCode(); |
| | | }, Function.identity(), v12, v22 -> { |
| | | }, Function.identity(), (v12, v22) -> { |
| | | return v12; |
| | | })); |
| | | if (Func.isNotEmpty(needSaveArea)) { |
| | |
| | | } |
| | | if (Func.isNotEmpty(needSaveTray)) { |
| | | this.trayService.saveBatch(needSaveTray); |
| | | List<CommonGroupOfItem> items = (List) needSaveTray.stream().map(tray -> { |
| | | List<CommonGroupOfItem> items = needSaveTray.stream().map(tray -> { |
| | | return CommonGroupOfItem.builder().groupId(105L).itemId(tray.getId()).groupType(CommonGroupTypeEnum.TRAY.getName()).groupCategory(CommonGroupConstant.DEFAULT_CATEGORY).build(); |
| | | }).collect(Collectors.toList()); |
| | | this.itemService.saveBatch(items); |
| | | trayMap.putAll((Map) needSaveTray.stream().collect(Collectors.toMap((v0) -> { |
| | | trayMap.putAll(needSaveTray.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, v -> { |
| | | return v; |
| | |
| | | trayStorageList.add(trayStorage); |
| | | }); |
| | | List<TrayStorage> trayStorages = list(); |
| | | Map<String, TrayStorage> trayFixtureMap = (Map) trayStorages.stream().collect(Collectors.toMap(k -> { |
| | | Map<String, TrayStorage> trayFixtureMap = trayStorages.stream().collect(Collectors.toMap(k -> { |
| | | return StringUtils.getKey(k.getTrayId(), k.getWarehouseStationId()); |
| | | }, v -> { |
| | | return v; |
| | | })); |
| | | List<TrayStorage> collect = (List) trayStorageList.stream().distinct().filter(c -> { |
| | | List<TrayStorage> collect = trayStorageList.stream().distinct().filter(c -> { |
| | | return !trayFixtureMap.containsKey(StringUtils.getKey(c.getTrayId(), c.getWarehouseStationId())); |
| | | }).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(collect)) { |
| | |
| | | } |
| | | |
| | | private void getTrayStorage(List<TrayStorageImport> rawData, Map<String, WarehouseArea> areaMap, Map<String, WarehouseStation> warehouseStationMap, Map<String, Tray> trayMap) { |
| | | Wrapper lambdaQuery = Wrappers.lambdaQuery(); |
| | | Wrapper lambdaQuery2 = Wrappers.lambdaQuery(); |
| | | Wrapper lambdaQuery3 = Wrappers.lambdaQuery(); |
| | | //Wrapper lambdaQuery = Wrappers.lambdaQuery(); |
| | | //Wrapper lambdaQuery2 = Wrappers.lambdaQuery(); |
| | | //Wrapper lambdaQuery3 = Wrappers.lambdaQuery(); |
| | | |
| | | LambdaQueryWrapper<WarehouseArea> areaQuery = Wrappers.lambdaQuery(); |
| | | LambdaQueryWrapper<WarehouseStation> staQuery = Wrappers.lambdaQuery(); |
| | | LambdaQueryWrapper<Tray> trayQuery = Wrappers.lambdaQuery(); |
| | | |
| | | boolean flag1 = false; |
| | | boolean flag2 = false; |
| | | boolean flag3 = false; |
| | | for (TrayStorageImport data : rawData) { |
| | | if (requiredArea(data)) { |
| | | if (flag1) { |
| | | lambdaQuery.or(); |
| | | areaQuery.or(); |
| | | } |
| | | flag1 = true; |
| | | lambdaQuery.eq((v0) -> { |
| | | areaQuery.eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, data.getAreaCode()); |
| | | } |
| | | if (requiredLocation(data)) { |
| | | if (flag2) { |
| | | lambdaQuery2.or(); |
| | | staQuery.or(); |
| | | } |
| | | flag2 = true; |
| | | lambdaQuery2.eq((v0) -> { |
| | | staQuery.eq((v0) -> { |
| | | return v0.getWarehouseCode(); |
| | | }, data.getLocationCode()); |
| | | } |
| | | if (requiredTray(data)) { |
| | | if (flag3) { |
| | | lambdaQuery3.or(); |
| | | trayQuery.or(); |
| | | } |
| | | flag3 = true; |
| | | lambdaQuery3.eq((v0) -> { |
| | | trayQuery.eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, data.getTrayCode()); |
| | | } |
| | | } |
| | | String sqlSegment1 = lambdaQuery.getSqlSegment(); |
| | | String sqlSegment1 = areaQuery.getSqlSegment(); |
| | | if (Func.isNotEmpty(sqlSegment1)) { |
| | | List<WarehouseArea> areaList = this.warehouseAreaService.list(lambdaQuery); |
| | | List<WarehouseArea> areaList = this.warehouseAreaService.list(areaQuery); |
| | | if (Func.isNotEmpty(areaList)) { |
| | | Map<String, WarehouseArea> map = (Map) areaList.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WarehouseArea> map = areaList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, v -> { |
| | | return v; |
| | |
| | | areaMap.putAll(map); |
| | | } |
| | | } |
| | | String sqlSegment2 = lambdaQuery2.getSqlSegment(); |
| | | String sqlSegment2 = staQuery.getSqlSegment(); |
| | | if (Func.isNotEmpty(sqlSegment2)) { |
| | | List<WarehouseStation> warehouseStations = this.warehouseStationService.list(lambdaQuery2); |
| | | List<WarehouseStation> warehouseStations = this.warehouseStationService.list(staQuery); |
| | | if (Func.isNotEmpty(warehouseStations)) { |
| | | Map<String, WarehouseStation> map1 = (Map) warehouseStations.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, WarehouseStation> map1 =warehouseStations.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getWarehouseCode(); |
| | | }, v2 -> { |
| | | return v2; |
| | |
| | | warehouseStationMap.putAll(map1); |
| | | } |
| | | } |
| | | String sqlSegment3 = lambdaQuery3.getSqlSegment(); |
| | | String sqlSegment3 = trayQuery.getSqlSegment(); |
| | | if (Func.isNotEmpty(sqlSegment3)) { |
| | | List<Tray> trays = this.trayService.list(lambdaQuery3); |
| | | List<Tray> trays = this.trayService.list(trayQuery); |
| | | if (Func.isNotEmpty(trays)) { |
| | | Map<String, Tray> map2 = (Map) trays.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, Tray> map2 = trays.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, v3 -> { |
| | | return v3; |