| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import com.google.common.collect.Lists; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.constant.CraftConstant; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.qianwen.core.mp.service.impl.BladeServiceImpl; |
| | | import com.qianwen.core.tool.support.Kv; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.RandomType; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.common.constant.CraftConstant; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.cps.convert.CraftRoutingConvert; |
| | | import com.qianwen.smartman.modules.cps.convert.ProductConvert; |
| | | import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessConvert; |
| | |
| | | import com.qianwen.smartman.modules.cps.vo.VersionProcessAddVO; |
| | | import com.qianwen.smartman.modules.system.service.IBasCoderuleService; |
| | | import com.qianwen.smartman.modules.tpm.enums.MetaTypeEnum; |
| | | 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/CraftRoutingServiceImpl.class */ |
| | | public class CraftRoutingServiceImpl extends BladeServiceImpl<CraftRoutingMapper, CraftRouting> implements ICraftRoutingService { |
| | | private static final Logger log = LoggerFactory.getLogger(CraftRoutingServiceImpl.class); |
| | | private final IProductionCraftVersionService craftVersionService; |
| | |
| | | private final IProductionCraftProcessFileService processFileService; |
| | | private final IBasCoderuleService basCodeRuleService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1416707747: |
| | | if (implMethodName.equals("getVersionId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1291082392: |
| | | if (implMethodName.equals("getVersionProcessId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -1061435468: |
| | | if (implMethodName.equals("getProductId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1330288580: |
| | | if (implMethodName.equals("getGroupId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 2061868837: |
| | | if (implMethodName.equals("getCraftId")) { |
| | | z = false; |
| | | 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/ProductionCraftVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getCraftId(); |
| | | }; |
| | | } |
| | | 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/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getCraftId(); |
| | | }; |
| | | } |
| | | 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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionId(); |
| | | }; |
| | | } |
| | | 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/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionId(); |
| | | }; |
| | | } |
| | | 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/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionId(); |
| | | }; |
| | | } |
| | | 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/ProductionCraftProcessRelatedFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }; |
| | | } |
| | | 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/ProductionCraftProcessRelatedTool") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }; |
| | | } |
| | | 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/ProductionCraftProcessFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && 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(); |
| | | }; |
| | | } |
| | | break; |
| | | case RegionCache.VILLAGE_LEVEL /* 5 */: |
| | | 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/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getGroupId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | 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/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public CraftRoutingServiceImpl(final IProductionCraftVersionService craftVersionService, final ICraftVersionLineService versionLineService, final IProductService productService, final IProductionCraftProcessService craftProcessService, final IProductionCraftProcessRelatedFixtureService relatedFixtureService, final IProductionCraftProcessRelatedToolService relatedToolService, final IProductionCraftProcessFileService processFileService, final IBasCoderuleService basCodeRuleService) { |
| | | this.craftVersionService = craftVersionService; |
| | |
| | | this.basCodeRuleService = basCodeRuleService; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public CraftRoutingVO saveRouting(CraftRoutingAddVO vo) { |
| | | CraftRouting craftRouting = saveCraftRouting(vo); |
| | | return CraftRoutingConvert.INSTANCE.convert(craftRouting); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public List<CraftRoutingVO> listCraftRouting(SearchVO vo) { |
| | | Wrapper<CraftRouting> wrapper = getWrapper(vo); |
| | | return this.baseMapper.listCraftRouting(Func.isBlank(wrapper.getSqlSegment()) ? null : wrapper); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public CraftRoutingDetailVO detailCraft(Long id) { |
| | | CraftRoutingDetailVO vo = new CraftRoutingDetailVO(); |
| | | setProduce(vo, id); |
| | |
| | | return vo; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean deleteCraft(Long id) { |
| | | boolean flag = removeById(id); |
| | | |
| | | // .select(new SFunction[] { ProductionCraftVersion::getId }) |
| | | |
| | | List<Long> versionIds = this.craftVersionService.listObjs(Wrappers.<ProductionCraftVersion>lambdaQuery() |
| | | .select(ProductionCraftVersion::getId) |
| | | .eq(ProductionCraftVersion::getCraftId, id), c -> Long.valueOf((c instanceof BigDecimal) ? ((BigDecimal)c).longValue() : ((Long)c).longValue())); |
| | | /* |
| | | List<Long> versionIds = this.craftVersionService.listObjs((Wrapper) Wrappers.lambdaQuery(ProductionCraftVersion.class).select(new SFunction[]{(v0) -> { |
| | | return v0.getId(); |
| | | }}).eq((v0) -> { |
| | | return v0.getCraftId(); |
| | | }, id), c -> { |
| | | return Long.valueOf(c instanceof BigDecimal ? ((BigDecimal) c).longValue() : ((Long) c).longValue()); |
| | | }); |
| | | });*/ |
| | | if (Func.isNotEmpty(versionIds)) { |
| | | flag = flag && this.craftVersionService.removeVersion(versionIds).booleanValue(); |
| | | } |
| | | return Boolean.valueOf(flag && this.versionLineService.remove((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getCraftId(); |
| | | }, id))); |
| | | return Boolean.valueOf(flag && this.versionLineService.remove(Wrappers.<CraftVersionLine>lambdaQuery().eq(CraftVersionLine::getCraftId, id))); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public Boolean updateCraft(CraftRoutingUpdateVO vo) { |
| | | validNameExist(vo.getId(), vo.getName()); |
| | | CraftRouting routing = CraftRoutingConvert.INSTANCE.convert(vo); |
| | | return Boolean.valueOf(updateById(routing)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean copyCraftVersion(ProductionCraftVersionCopyVO vo) { |
| | | Integer type = vo.getType(); |
| | | if (CraftConstant.COPY_TYPE_PRODUCT.equals(type)) { |
| | | CraftRouting routing = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { |
| | | return v0.getProductId(); |
| | | }, vo.getProductId())); |
| | | CraftRouting routing = getOne(Wrappers.lambdaQuery(CraftRouting.class).eq(CraftRouting::getProductId, vo.getProductId())); |
| | | if (Func.isNull(routing)) { |
| | | return Boolean.valueOf(copyProductNewCraft(vo)); |
| | | } |
| | |
| | | return Boolean.valueOf(copyCraftNewVersion(vo, vo.getCraftId())); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public List<ProductionCraftVersionVO> listFixedVersionByProduction(Long productionId) { |
| | | CraftRouting craft = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { |
| | | return v0.getProductId(); |
| | | }, productionId)); |
| | | CraftRouting craft = getOne(Wrappers.lambdaQuery(CraftRouting.class).eq(CraftRouting::getProductId, productionId)); |
| | | if (Func.isNull(craft)) { |
| | | return Lists.newArrayList(); |
| | | } |
| | | return this.craftVersionService.listFixed(craft.getId()); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public CraftRoutingDetailVO getCraftByProduction(Long production) { |
| | | CraftRouting craft = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { |
| | | return v0.getProductId(); |
| | | }, production)); |
| | | CraftRouting craft = getOne(Wrappers.lambdaQuery(CraftRouting.class).eq(CraftRouting::getProductId, production)); |
| | | if (Func.isNull(craft)) { |
| | | return null; |
| | | } |
| | | return detailCraft(craft.getId()); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public List<CraftRoutingVO> listNotBandCraft() { |
| | | return CraftRoutingConvert.INSTANCE.convert(list((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).isNull((v0) -> { |
| | | return v0.getProductId(); |
| | | }))); |
| | | return CraftRoutingConvert.INSTANCE.convert(list(Wrappers.lambdaQuery(CraftRouting.class).isNull(CraftRouting::getProductId))); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public Boolean craftBindProduction(Long productionId, Long craftId) { |
| | | return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate(CraftRouting.class).set((v0) -> { |
| | | return v0.getProductId(); |
| | | }, productionId)).eq((v0) -> { |
| | | return v0.getId(); |
| | | }, craftId))); |
| | | return update(Wrappers.lambdaUpdate(CraftRouting.class).set(CraftRouting::getProductId, productionId).eq(CraftRouting::getId, craftId)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public Boolean craftUnbindProduction(Long craftId) { |
| | | return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate(CraftRouting.class).set((v0) -> { |
| | | return v0.getProductId(); |
| | | }, (Object) null)).eq((v0) -> { |
| | | return v0.getId(); |
| | | }, craftId))); |
| | | return update(Wrappers.lambdaUpdate(CraftRouting.class).set(CraftRouting::getProductId, null).eq(CraftRouting::getId, craftId)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.ICraftRoutingService |
| | | @Override |
| | | public List<ProductVO> notBandProduct(Long craftId) { |
| | | List<Product> products = this.productService.notBandProduct(craftId); |
| | | return ProductConvert.INSTANCE.convert(products); |
| | |
| | | newVersion.setDescription(version.getDescription()); |
| | | newVersion.setGroupIds(getGroupIds(versionId)); |
| | | ProductionCraftVersionVO craftVersion = this.craftVersionService.saveCraftVersion(craftId, newVersion); |
| | | List<ProductionCraftProcess> processList = this.craftProcessService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { |
| | | List<ProductionCraftProcess> processList = this.craftProcessService.list(Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { |
| | | return v0.getVersionId(); |
| | | }, version.getId())); |
| | | ProcessParallelSaveVO saveVO = copyProductNewCraftProcess(craftVersion.getId(), processList); |
| | |
| | | newVersion.setDescription(version.getDescription()); |
| | | newVersion.setGroupIds(getGroupIds(versionId)); |
| | | ProductionCraftVersionVO craftVersion = this.craftVersionService.saveCraftVersion(craftRouting.getId(), newVersion); |
| | | List<ProductionCraftProcess> processList = this.craftProcessService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { |
| | | List<ProductionCraftProcess> processList = this.craftProcessService.list(Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { |
| | | return v0.getVersionId(); |
| | | }, version.getId())); |
| | | ProcessParallelSaveVO saveVO = copyProductNewCraftProcess(craftVersion.getId(), processList); |
| | |
| | | private ProcessParallelSaveVO copyProductNewCraftProcess(Long versionId, List<ProductionCraftProcess> processList) { |
| | | ProcessParallelSaveVO vo = new ProcessParallelSaveVO(); |
| | | if (Func.isNotEmpty(processList)) { |
| | | List<Long> processIds = (List) processList.stream().map((v0) -> { |
| | | List<Long> processIds = processList.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | Map<Long, List<ProductionCraftProcessRelatedFixture>> processFixtureMap = (Map) this.relatedFixtureService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).in((v0) -> { |
| | | Map<Long, List<ProductionCraftProcessRelatedFixture>> processFixtureMap = this.relatedFixtureService.list( Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).in((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | })); |
| | | Map<Long, List<ProductionCraftProcessRelatedTool>> processToolMap = (Map) this.relatedToolService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedTool.class).in((v0) -> { |
| | | Map<Long, List<ProductionCraftProcessRelatedTool>> processToolMap = this.relatedToolService.list(Wrappers.lambdaQuery(ProductionCraftProcessRelatedTool.class).in((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | })); |
| | | Map<Long, List<ProductionCraftProcessFile>> processFileMap = (Map) this.processFileService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessFile.class).in((v0) -> { |
| | | Map<Long, List<ProductionCraftProcessFile>> processFileMap = this.processFileService.list(Wrappers.lambdaQuery(ProductionCraftProcessFile.class).in((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { |
| | | return v0.getVersionProcessId(); |
| | | })); |
| | | List<VersionProcessAddVO> collect = (List) processList.stream().filter(c -> { |
| | | List<VersionProcessAddVO> collect = processList.stream().filter(c -> { |
| | | return Func.isNull(c.getMainSequenceId()) && Func.notNull(c.getProcessId()); |
| | | }).map(process -> { |
| | | return getVersionProcessAddVO(processFixtureMap, processToolMap, processFileMap, process); |
| | | }).collect(Collectors.toList()); |
| | | List<ProductionCraftProcess> list = (List) processList.stream().filter(c2 -> { |
| | | List<ProductionCraftProcess> list = processList.stream().filter(c2 -> { |
| | | return Func.notNull(c2.getMainSequenceId()) || Func.isNull(c2.getProcessId()); |
| | | }).collect(Collectors.toList()); |
| | | List<ParallelProVO> parallelProcessList = Lists.newArrayList(); |
| | |
| | | proVO.setXCoordinate(l12.getXCoordinate()); |
| | | proVO.setYCoordinate(l12.getYCoordinate()); |
| | | proVO.setHeight(l12.getHeight()); |
| | | List<VersionProcessAddVO> vos = (List) list.stream().filter(l2 -> { |
| | | List<VersionProcessAddVO> vos = list.stream().filter(l2 -> { |
| | | return l12.getId().equals(l2.getMainSequenceId()); |
| | | }).map(process2 -> { |
| | | return getVersionProcessAddVO(processFixtureMap, processToolMap, processFileMap, process2); |
| | |
| | | VersionProcessAddVO processAddVO = ProductionCraftProcessConvert.INSTANCE.convertAdd(process); |
| | | List<ProductionCraftProcessRelatedFixture> fixtures = processFixtureMap.get(process.getId()); |
| | | if (Func.isNotEmpty(fixtures)) { |
| | | List<ProductionCraftProcessRelatedFixtureVO> fixtureAddList = (List) fixtures.stream().map(c -> { |
| | | List<ProductionCraftProcessRelatedFixtureVO> fixtureAddList = fixtures.stream().map(c -> { |
| | | return new ProductionCraftProcessRelatedFixtureVO().setFixtureId(c.getFixtureId()).setVersionProcessId(c.getVersionProcessId()).setFixtureCode(c.getFixtureCode()).setFixtureName(c.getFixtureName()).setFixtureGroupName(c.getFixtureGroupName()); |
| | | }).collect(Collectors.toList()); |
| | | processAddVO.setFixtures(fixtureAddList); |
| | | } |
| | | List<ProductionCraftProcessFile> files = processFileMap.get(process.getId()); |
| | | if (Func.isNotEmpty(files)) { |
| | | List<ProductionCraftProcessFileVO> fileAddList = (List) files.stream().map(c2 -> { |
| | | List<ProductionCraftProcessFileVO> fileAddList = files.stream().map(c2 -> { |
| | | return new ProductionCraftProcessFileVO().setFileName(c2.getFileName()).setObjectKey(c2.getObjectKey()).setContentType(c2.getContentType()).setLink(c2.getLink()).setFileSize(c2.getFileSize()).setUploadTime(c2.getUploadTime()).setVersionProcessId(c2.getVersionProcessId()); |
| | | }).collect(Collectors.toList()); |
| | | processAddVO.setFiles(fileAddList); |
| | | } |
| | | List<ProductionCraftProcessRelatedTool> tools = processToolMap.get(process.getId()); |
| | | if (Func.isNotEmpty(tools)) { |
| | | List<ProductionCraftProcessRelatedToolVO> toolAddList = (List) tools.stream().map(c3 -> { |
| | | List<ProductionCraftProcessRelatedToolVO> toolAddList = tools.stream().map(c3 -> { |
| | | return new ProductionCraftProcessRelatedToolVO().setToolId(c3.getToolId()).setVersionProcessId(c3.getVersionProcessId()).setToolCode(c3.getToolCode()).setToolCategoryName(c3.getToolCategoryName()).setToolModelName(c3.getToolModelName()); |
| | | }).collect(Collectors.toList()); |
| | | processAddVO.setTools(toolAddList); |
| | |
| | | } |
| | | |
| | | private List<Long> getGroupIds(Long versionId) { |
| | | return this.versionLineService.listObjs((Wrapper) Wrappers.lambdaQuery(CraftVersionLine.class).select(new SFunction[]{(v0) -> { |
| | | return this.versionLineService.listObjs(Wrappers.lambdaQuery(CraftVersionLine.class).select(CraftVersionLine::getGroupId ) |
| | | .eq(CraftVersionLine::getVersionId, versionId), c -> (c instanceof BigDecimal) ? Long.valueOf(((BigDecimal)c).longValue()) : (Long)c); |
| | | /* |
| | | return this.versionLineService.listObjs( Wrappers.lambdaQuery(CraftVersionLine.class).select(new SFunction[]{(v0) -> { |
| | | return v0.getGroupId(); |
| | | }}).eq((v0) -> { |
| | | return v0.getVersionId(); |
| | |
| | | return Long.valueOf(((BigDecimal) c).longValue()); |
| | | } |
| | | return (Long) c; |
| | | }); |
| | | });*/ |
| | | } |
| | | |
| | | private void setProduce(CraftRoutingDetailVO vo, Long id) { |
| | |
| | | |
| | | private QueryWrapper<CraftRouting> getWrapper(SearchVO vo) { |
| | | List<SearchVO.KV> param = vo.getParams(); |
| | | Map<String, String> params = (Map) param.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, String> params = param.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getKey(); |
| | | }, (v0) -> { |
| | | return v0.getValue(); |
| | | })); |
| | | Kv exclude = Kv.create().set("Blade-Auth", "Blade-Auth").set("current", "current").set("size", "size").set("ascs", "ascs").set("descs", "descs"); |
| | | exclude.forEach(k, v -> { |
| | | exclude.forEach((k, v) -> { |
| | | String str = (String) params.remove(k); |
| | | }); |
| | | QueryWrapper<CraftRouting> wrapper = new QueryWrapper<>(); |
| | | if (Func.isNotEmpty(params)) { |
| | | params.forEach(k2, v2 -> { |
| | | params.forEach((k2, v2) -> { |
| | | if (k2.endsWith(CraftConstant.LIKE)) { |
| | | wrapper.likeRight("bcr." + getColumn(k2, CraftConstant.LIKE), v2); |
| | | } else if (k2.endsWith(CraftConstant.ASC)) { |
| | |
| | | } |
| | | |
| | | private void validNameExist(Long id, String name) { |
| | | long count = count((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).ne(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, id).eq((v0) -> { |
| | | return v0.getName(); |
| | | }, name)); |
| | | long count = count(Wrappers.lambdaQuery(CraftRouting.class).ne(Func.isNotEmpty(id), CraftRouting::getId, id).eq(CraftRouting::getName, name)); |
| | | ThrowFun.isTrue(count > 0).throwMessage(MessageUtils.message("cps.craft.name.exist", new Object[0])); |
| | | } |
| | | } |