1、EBOM转PBOM逻辑调整
This commit is contained in:
parent
faf0071638
commit
bc423b6cd6
|
|
@ -18,6 +18,7 @@ import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.service.*;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
|
import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import nflg.product.common.constant.STATE;
|
import nflg.product.common.constant.STATE;
|
||||||
|
|
@ -152,13 +153,9 @@ public class EbomApi extends BaseApi {
|
||||||
public ResultVO<List<OperationErrorMsgVO>> convertToPBom(@RequestBody EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
public ResultVO<List<OperationErrorMsgVO>> convertToPBom(@RequestBody EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
|
||||||
VUtils.isTure(CollUtil.isEmpty(paramDto.getBomRowIds())).throwMessage("请选择要转换的物料");
|
VUtils.isTure(CollUtil.isEmpty(paramDto.getBomRowIds())).throwMessage("请选择要转换的物料");
|
||||||
VUtils.isTure(CollUtil.isEmpty(paramDto.getFacCodes())).throwMessage("请选择要转换的工厂");
|
VUtils.isTure(CollUtil.isEmpty(paramDto.getFacCodes())).throwMessage("请选择要转换的工厂");
|
||||||
|
VUtils.isTure(Objects.isNull(paramDto.getConvertMode())).throwMessage("转换模式不能为空");
|
||||||
bomNewEbomParentService.convertToPBom(paramDto);
|
bomNewEbomParentService.convertToPBom(paramDto);
|
||||||
|
|
||||||
//更新PBomUse 数据
|
|
||||||
// CompletableFuture.runAsync(()->{
|
|
||||||
// bomNewPbomParentService.getBaseMapper().updatePBomMaterialUse();
|
|
||||||
// });
|
|
||||||
|
|
||||||
//导入到sap
|
//导入到sap
|
||||||
List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
|
List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
|
||||||
paramDto.getBomRowIds().forEach(rootRowId -> {
|
paramDto.getBomRowIds().forEach(rootRowId -> {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.nflg.product.bomnew.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ebom转Pbom 转换模式
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum ConvertToPBomModelEnum implements ValueEnum<Integer>{
|
||||||
|
// 转换模式:0-常规 1-覆盖
|
||||||
|
NORMAL(0, "常规"),
|
||||||
|
OVERRIDE(1, "覆盖");
|
||||||
|
|
||||||
|
private final Integer value;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,4 +27,6 @@ public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity>
|
||||||
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
List<ChildMaxExceptionStateVO> getChildMaxExceptionState(@Param("bomRowIds") List<Long> bomRowIds);
|
||||||
|
|
||||||
Integer shouldSetRootIs(String materialNo);
|
Integer shouldSetRootIs(String materialNo);
|
||||||
|
|
||||||
|
void delBomChild(@Param("bomRowIds") List<Long> bomRowIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.nflg.product.bomnew.pojo.dto;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -14,6 +15,10 @@ public class EBomToPBomParamDTO {
|
||||||
@ApiModelProperty("物料bom行ID")
|
@ApiModelProperty("物料bom行ID")
|
||||||
private List<Long> bomRowIds;
|
private List<Long> bomRowIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("转换模式:0-常规 1-覆盖")
|
||||||
|
@NotBlank( message = "转换模式:0-常规 1-覆盖 不能为空")
|
||||||
|
private Integer convertMode;
|
||||||
|
|
||||||
@ApiModelProperty("工厂编码列表")
|
@ApiModelProperty("工厂编码列表")
|
||||||
private List<String> facCodes;
|
private List<String> facCodes;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,12 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
||||||
@ApiModelProperty(value = "导入SAP状态")
|
@ApiModelProperty(value = "导入SAP状态")
|
||||||
private Integer sapState;
|
private Integer sapState;
|
||||||
|
|
||||||
|
@ApiModelProperty("无需转PBom-和正式版BOM一致")
|
||||||
|
private Integer noConvertToPBomIs=0;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否发生了变更 0:不变 1:删除-和正式版一致 2-版本发版变化")
|
||||||
|
private Integer hasChangeState=0;
|
||||||
|
|
||||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
||||||
|
|
@ -842,11 +842,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
//31 码 须有虚拟包
|
//31 码 须有虚拟包
|
||||||
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
|
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
|
||||||
|
|
||||||
// VUtils.isTure(paramDto.getFacCodes().contains("1020") && parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31")))
|
|
||||||
// .throwMessage("31码不能生成仙桃(1020)的pbom");
|
|
||||||
|
|
||||||
// VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
|
|
||||||
// .throwMessage("31码须有虚拟包");
|
|
||||||
parents.forEach(p -> {
|
parents.forEach(p -> {
|
||||||
if (p.getMaterialNo().startsWith("31")) {
|
if (p.getMaterialNo().startsWith("31")) {
|
||||||
List<String> errors = new ArrayList<>();
|
List<String> errors = new ArrayList<>();
|
||||||
|
|
@ -879,7 +874,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
parent.setChildBomRowId(parent.getRowId());
|
parent.setChildBomRowId(parent.getRowId());
|
||||||
parent.setParentRowId(0L);
|
parent.setParentRowId(0L);
|
||||||
bomTree.add(parent);
|
bomTree.add(parent);
|
||||||
EBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomFor31(parent, bomTree, paramDto.getFacCodes(), 0L):new EBomToPBom(parent, bomTree, paramDto.getFacCodes(), 0L);
|
EBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomFor31(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode())):new EBomToPBom(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode()));
|
||||||
eBomToPBom.convert();
|
eBomToPBom.convert();
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
||||||
|
|
@ -889,43 +884,36 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
||||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//删除EBOM中和正式表BOM一致的数据
|
||||||
|
List<BomNewEbomParentVO> delEBomParents = bomTree.stream().filter(u -> u.getHasChangeState().equals(1)).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(delEBomParents)){
|
||||||
|
List<Long> delParentBom = delEBomParents.stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(delParentBom)){
|
||||||
|
this.getBaseMapper().delBatch(delParentBom);
|
||||||
|
ebomChildService.getBaseMapper().delBomChild(delParentBom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//需修改正式版版本的BOM
|
||||||
|
List<BomNewEbomParentVO> upVersionEBomParents = bomTree.stream().filter(u -> u.getHasChangeState().equals(2)).collect(Collectors.toList());
|
||||||
|
if(CollUtil.isNotEmpty(upVersionEBomParents)){
|
||||||
|
List<BomNewEbomParentEntity> upVersionList=new ArrayList<>();
|
||||||
|
for (BomNewEbomParentVO upVersionEBomParent : upVersionEBomParents) {
|
||||||
|
BomNewEbomParentEntity upVersion = new BomNewEbomParentEntity();
|
||||||
|
upVersion.setRowId(upVersionEBomParent.getBomRowId());
|
||||||
|
upVersion.setCurrentVersion(upVersionEBomParent.getCurrentVersion());
|
||||||
|
upVersionList.add(upVersion);
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(upVersionList)){
|
||||||
|
this.saveOrUpdateBatch(upVersionList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//标记PBom未发布跟节点
|
//标记PBom未发布跟节点
|
||||||
Set<String> materialNos = bomTree.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
Set<String> materialNos = bomTree.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||||
if(CollUtil.isNotEmpty(materialNos)){
|
if(CollUtil.isNotEmpty(materialNos)){
|
||||||
pBomParentService.getBaseMapper().updateWaitPublicRootState(materialNos);
|
pBomParentService.getBaseMapper().updateWaitPublicRootState(materialNos);
|
||||||
}
|
}
|
||||||
//标记跟节点
|
|
||||||
// upRootMark(parent);
|
|
||||||
// if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
|
||||||
// //先删除
|
|
||||||
// Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
|
||||||
// for (String s : delSet) {
|
|
||||||
// String[] split = StrUtil.split(s, "-");
|
|
||||||
// virtualPackageCompositionService.getBaseMapper().delByVnoAndParentNo(split[0], split[1]);
|
|
||||||
// }
|
|
||||||
// virtualPackageCompositionService.saveOrUpdateBatch(eBomToPBom.getVirtualPackageCompositionResult());
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// //记录变更影响
|
|
||||||
// if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
|
||||||
//
|
|
||||||
// List<String> vNos = eBomToPBom.getUpgradeChangeResult().stream().map(u -> StrUtil.join(u.getMaterialNo(), u.getRelMaterialNo())).collect(Collectors.toList());
|
|
||||||
// if (CollUtil.isNotEmpty(vNos)) {
|
|
||||||
// upgradeChangeService.getBaseMapper().delByVNo(vNos);
|
|
||||||
// }
|
|
||||||
// upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
|
||||||
// }
|
|
||||||
// if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeDetailResult())) {
|
|
||||||
//
|
|
||||||
// //先删除
|
|
||||||
// Set<String> delSet = eBomToPBom.getUpgradeChangeDetailResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
|
||||||
// for (String s : delSet) {
|
|
||||||
// String[] split = StrUtil.split(s, "-");
|
|
||||||
// updateDetailService.getBaseMapper().delByVnoAndParentNo(split[0], split[1]);
|
|
||||||
// }
|
|
||||||
// updateDetailService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeDetailResult());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ package com.nflg.product.bomnew.service.domain.EBom;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.enums.BooleanEnum;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.nflg.product.bomnew.constant.ConvertToPBomModelEnum;
|
||||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||||
|
|
@ -14,6 +16,7 @@ import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,11 +28,13 @@ public class EBomToPBom extends EBomToPbomBase {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId, ConvertToPBomModelEnum convertModelEnum) {
|
||||||
this.parent = inParent;
|
this.parent = inParent;
|
||||||
this.allBomDetail = inAllBomDetail;
|
this.allBomDetail = inAllBomDetail;
|
||||||
this.facCodes = inFacCodes;
|
this.facCodes = inFacCodes;
|
||||||
|
this.convertMode=convertModelEnum;
|
||||||
generateDrawingNo(allBomDetail, parentRowId, "");
|
generateDrawingNo(allBomDetail, parentRowId, "");
|
||||||
|
initEBomVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -54,9 +59,14 @@ public class EBomToPBom extends EBomToPbomBase {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hasConvert.add(hasConvertKey);
|
hasConvert.add(hasConvertKey);
|
||||||
|
|
||||||
|
//无需转换bom
|
||||||
|
if(BooleanEnum.TRUE.equals(vo.getNoConvertToPBomIs()) ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//构建变更明细
|
//构建变更明细
|
||||||
buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||||
buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||||
|
|
||||||
//子级
|
//子级
|
||||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).distinct().collect(Collectors.toList());
|
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).distinct().collect(Collectors.toList());
|
||||||
|
|
@ -65,7 +75,10 @@ public class EBomToPBom extends EBomToPbomBase {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode,parentList);
|
||||||
|
if(Objects.isNull(parentEnt)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//子级
|
//子级
|
||||||
if (CollUtil.isNotEmpty(child)) {
|
if (CollUtil.isNotEmpty(child)) {
|
||||||
//合并子级
|
//合并子级
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.enums.BooleanEnum;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.nflg.product.bomnew.constant.ConvertToPBomModelEnum;
|
||||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||||
|
|
@ -14,10 +16,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
|
|
||||||
|
|
@ -32,11 +31,14 @@ public class EBomToPBomFor31 extends EBomToPbomBase {
|
||||||
private Map<String,List<BomNewEbomParentVO>> facBomDataMp=new HashMap<>();
|
private Map<String,List<BomNewEbomParentVO>> facBomDataMp=new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public EBomToPBomFor31(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
public EBomToPBomFor31(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId, ConvertToPBomModelEnum convertModelEnum) {
|
||||||
this.parent = inParent;
|
this.parent = inParent;
|
||||||
this.allBomDetail = inAllBomDetail;
|
this.allBomDetail = inAllBomDetail;
|
||||||
this.facCodes = inFacCodes;
|
this.facCodes = inFacCodes;
|
||||||
|
this.convertMode=convertModelEnum;
|
||||||
generateDrawingNo(allBomDetail, parentRowId, "");
|
generateDrawingNo(allBomDetail, parentRowId, "");
|
||||||
|
//初始化Ebom版本
|
||||||
|
initEBomVersion();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,13 +89,19 @@ public class EBomToPBomFor31 extends EBomToPbomBase {
|
||||||
List<String> hasConvert = new ArrayList<>();
|
List<String> hasConvert = new ArrayList<>();
|
||||||
|
|
||||||
for (String facCode : facCodes) {
|
for (String facCode : facCodes) {
|
||||||
List<BomNewEbomParentVO> parentList = ListCommonUtil.toDistinct(facBomDataMp.get(facCode).stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()), BomNewEbomParentVO::getBomRowId);
|
List<BomNewEbomParentVO> parentList = ListCommonUtil.toDistinct(facBomDataMp.get(facCode).stream().filter(u -> u.getBomRowId() > 0)
|
||||||
|
.sorted(Comparator.comparing(BomNewEbomParentVO::getLevelNumber))
|
||||||
|
.collect(Collectors.toList()), BomNewEbomParentVO::getBomRowId);
|
||||||
for (BomNewEbomParentVO vo : parentList) {
|
for (BomNewEbomParentVO vo : parentList) {
|
||||||
String hasConvertKey = StrUtil.join("-", facCode, vo.getBomRowId());
|
String hasConvertKey = StrUtil.join("-", facCode, vo.getBomRowId());
|
||||||
if (hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus())) {
|
if (hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hasConvert.add(hasConvertKey);
|
hasConvert.add(hasConvertKey);
|
||||||
|
//无需转换bom
|
||||||
|
if(BooleanEnum.TRUE.equals(vo.getNoConvertToPBomIs()) ){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//构建变更明细
|
//构建变更明细
|
||||||
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||||
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
// buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||||
|
|
@ -104,8 +112,10 @@ public class EBomToPBomFor31 extends EBomToPbomBase {
|
||||||
if( compareContentIsSame(vo, mergeChild, facCode)){
|
if( compareContentIsSame(vo, mergeChild, facCode)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode,parentList);
|
||||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
if(Objects.isNull(parentEnt)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
//子级
|
//子级
|
||||||
if (CollUtil.isNotEmpty(child)) {
|
if (CollUtil.isNotEmpty(child)) {
|
||||||
//合并子级
|
//合并子级
|
||||||
|
|
@ -118,8 +128,6 @@ public class EBomToPBomFor31 extends EBomToPbomBase {
|
||||||
childEnt.setIdentityNo(StrUtil.join("-", parentEnt.getMaterialNo(), eb.getMaterialNo()));
|
childEnt.setIdentityNo(StrUtil.join("-", parentEnt.getMaterialNo(), eb.getMaterialNo()));
|
||||||
this.pBomChildResult.add(childEnt);
|
this.pBomChildResult.add(childEnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.alibaba.excel.enums.BooleanEnum;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
@ -13,14 +14,14 @@ import com.nflg.product.bomnew.constant.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.*;
|
import com.nflg.product.bomnew.pojo.entity.*;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.service.BomNewPbomChildService;
|
|
||||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
|
||||||
import com.nflg.product.bomnew.util.BomLevelUtil;
|
import com.nflg.product.bomnew.util.BomLevelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import com.nflg.product.bomnew.util.VersionUtil;
|
import com.nflg.product.bomnew.util.VersionUtil;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -30,6 +31,9 @@ public abstract class EBomToPbomBase {
|
||||||
|
|
||||||
protected BomNewEbomParentVO parent;
|
protected BomNewEbomParentVO parent;
|
||||||
|
|
||||||
|
@ApiModelProperty("转换模式:0-常规 1-覆盖")
|
||||||
|
protected ConvertToPBomModelEnum convertMode;
|
||||||
|
|
||||||
//工厂编码列表
|
//工厂编码列表
|
||||||
protected List<String> facCodes;
|
protected List<String> facCodes;
|
||||||
|
|
||||||
|
|
@ -142,19 +146,41 @@ public abstract class EBomToPbomBase {
|
||||||
* @param parentVo
|
* @param parentVo
|
||||||
* @return Pair<Integer, BomNewPbomParentEntity> key, 0-旧 1-新 value:pBomParent
|
* @return Pair<Integer, BomNewPbomParentEntity> key, 0-旧 1-新 value:pBomParent
|
||||||
*/
|
*/
|
||||||
protected BomNewPbomParentEntity buildPBomParent(BomNewEbomParentVO parentVo, String facCode) {
|
protected BomNewPbomParentEntity buildPBomParent(BomNewEbomParentVO parentVo, String facCode, List<BomNewEbomParentVO> parentList) {
|
||||||
BomNewPbomParentEntity oldParent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
BomNewPbomParentEntity oldParent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||||
|
|
||||||
// this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
|
||||||
|
if(Objects.isNull(oldParent)){
|
||||||
|
buildParentEntity(parentVo,facCode,oldParent,parentVo.getCurrentVersion());
|
||||||
|
}
|
||||||
|
//pbom 处于工作表
|
||||||
if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
||||||
|
if (oldParent.getCreatedBy() == parentVo.getCreatedBy()) {
|
||||||
|
if (ConvertToPBomModelEnum.OVERRIDE.equals(convertMode.getValue())) {
|
||||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||||
oldParent.setSourceRowId(parentVo.getRowId());
|
oldParent.setSourceRowId(parentVo.getRowId());
|
||||||
this.pBomParentResult.add(oldParent);
|
this.pBomParentResult.add(oldParent);
|
||||||
return oldParent;
|
return oldParent;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// 降parentVo 及其子节点标记为不转换
|
||||||
|
markNoConvert(parentVo, parentList);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
} else { //pbom-处于正式表
|
||||||
|
String bomVersion= VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>=0?parentVo.getCurrentVersion():VersionUtil.getNextVersion(oldParent.getCurrentVersion());
|
||||||
|
return buildParentEntity(parentVo, facCode, oldParent,bomVersion));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private BomNewPbomParentEntity buildParentEntity(BomNewEbomParentVO parentVo, String facCode,BomNewPbomParentEntity oldParent,String bomVersion){
|
||||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||||
BeanUtil.copyProperties(parentVo, pBomParent, "sourceRowId");
|
BeanUtil.copyProperties(parentVo, pBomParent, "sourceRowId");
|
||||||
pBomParent.setSourceRowId(parentVo.getBomRowId());
|
pBomParent.setSourceRowId(parentVo.getBomRowId());
|
||||||
|
|
@ -164,12 +190,10 @@ public abstract class EBomToPbomBase {
|
||||||
pBomParent.setFacCode(facCode);
|
pBomParent.setFacCode(facCode);
|
||||||
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||||
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
|
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
|
||||||
//pBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
|
||||||
//版本=EBom版本
|
//版本=EBom版本
|
||||||
pBomParent.setCurrentVersion(parentVo.getCurrentVersion());
|
pBomParent.setCurrentVersion(bomVersion);
|
||||||
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||||
if (Objects.nonNull(oldParent)) {
|
if (Objects.nonNull(oldParent)) {
|
||||||
// pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
|
||||||
oldParent.setExpireEndTime(LocalDateTime.now());
|
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||||
oldParent.setLastVersionIs(0);
|
oldParent.setLastVersionIs(0);
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +201,11 @@ public abstract class EBomToPbomBase {
|
||||||
return pBomParent;
|
return pBomParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void markNoConvert(BomNewEbomParentVO parentVo, List<BomNewEbomParentVO> parentList) {
|
||||||
|
List<BomNewEbomParentVO> subVos = parentList.stream().filter(u -> u.getLevelNumber().compareTo(parentVo.getLevelNumber()) >= 0 && u.getLevelNumber().compareTo(NumberUtil.add(parentVo.getLevelNumber(), BigDecimal.valueOf(0.01))) < 0).collect(Collectors.toList());
|
||||||
|
for (BomNewEbomParentVO vo : subVos) {
|
||||||
|
vo.setNoConvertToPBomIs(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -426,4 +454,80 @@ public abstract class EBomToPbomBase {
|
||||||
}
|
}
|
||||||
return new BigDecimal(reuslt);
|
return new BigDecimal(reuslt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BOM是否一致(物料编码+数量+项目类别)
|
||||||
|
*
|
||||||
|
* @param oldChildList
|
||||||
|
* @param newChildList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isSameEBomV2(List<BomNewEbomChildEntity> oldChildList, List<BomNewEbomParentVO> newChildList) {
|
||||||
|
if (oldChildList.size() != newChildList.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Map<String, List<BomNewEbomChildEntity>> oldChildMap = oldChildList.stream().collect(Collectors.groupingBy(u -> StrUtil.join("", u.getMaterialNo(), u.getProjectType(), u.getNum())));
|
||||||
|
for (BomNewEbomParentVO newChild : newChildList) {
|
||||||
|
String key = StrUtil.join("", newChild.getMaterialNo(), newChild.getProjectType(), newChild.getNum());
|
||||||
|
if (!oldChildMap.containsKey(key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BOM是否一致(物料编码+数量)
|
||||||
|
*
|
||||||
|
* @param oldChildList
|
||||||
|
* @param newChildList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isSameEBomV2FormMaterialNoAndNum(List<BomNewEbomChildEntity> oldChildList, List<BomNewEbomParentVO> newChildList) {
|
||||||
|
if (oldChildList.size() != newChildList.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Map<String, List<BomNewEbomChildEntity>> oldChildMap = oldChildList.stream().collect(Collectors.groupingBy(u -> StrUtil.join("", u.getMaterialNo(), u.getNum())));
|
||||||
|
for (BomNewEbomParentVO newChild : newChildList) {
|
||||||
|
String key = StrUtil.join("", newChild.getMaterialNo(), newChild.getNum());
|
||||||
|
if (!oldChildMap.containsKey(key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换前生产EBom 版本号
|
||||||
|
*/
|
||||||
|
public void initEBomVersion() {
|
||||||
|
List<BomNewEbomParentVO> parentBoms = allBomDetail.stream().filter(u -> u.getChildBomRowId() > 0).collect(Collectors.toList());
|
||||||
|
for (BomNewEbomParentVO parentBom : parentBoms) {
|
||||||
|
if (!EBomStatusEnum.PUBLISHED.equalsValue(parentBom.getStatus())) {
|
||||||
|
//获取正式版
|
||||||
|
BomNewEbomParentEntity oldEBom = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentBom.getMaterialNo())
|
||||||
|
.eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||||
|
.last(" order by current_version desc limit 1").one();
|
||||||
|
if (Objects.nonNull(oldEBom)) {
|
||||||
|
List<BomNewEbomChildEntity> oldParentChild = SpringUtil.getBean(BomNewEbomChildService.class).lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, oldEBom.getRowId()).list();
|
||||||
|
|
||||||
|
List<BomNewEbomParentVO> newParentChild = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parentBom.getBomRowId())).collect(Collectors.toList());
|
||||||
|
//一样则无需转换
|
||||||
|
if (isSameEBomV2(oldParentChild, newParentChild)) {
|
||||||
|
parentBom.setNoConvertToPBomIs(1);
|
||||||
|
parentBom.setHasChangeState(1);
|
||||||
|
//只变化项目类别-则使用小版本
|
||||||
|
} else if (isSameEBomV2FormMaterialNoAndNum(oldParentChild, newParentChild)) {
|
||||||
|
parentBom.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(oldEBom.getCurrentVersion()));
|
||||||
|
parentBom.setHasChangeState(2);
|
||||||
|
} else {
|
||||||
|
parentBom.setCurrentVersion(VersionUtil.getNextVersion(oldEBom.getCurrentVersion()));
|
||||||
|
parentBom.setHasChangeState(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
BomNewEbomParentEntity oldEBom = ebomParentService.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).last(" order by current_version desc limit 1").one();
|
||||||
//无Ebom时
|
//无Ebom时
|
||||||
if (Objects.isNull(oldEBom)) {
|
if (Objects.isNull(oldEBom)) {
|
||||||
Long parentRowId = buildEBomParent(parentEnt, "V00");
|
Long parentRowId = buildEBomParent(parentEnt, VersionUtil.getNextVersion(""));
|
||||||
parentEnt.setEBomRowId(parentRowId);
|
parentEnt.setEBomRowId(parentRowId);
|
||||||
handlerChild(parentEnt, parentChild);
|
handlerChild(parentEnt, parentChild);
|
||||||
return;
|
return;
|
||||||
|
|
@ -246,13 +246,13 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
|
||||||
List<BomNewEbomChildEntity> oldParenChild = SpringUtil.getBean(BomNewEbomChildMapper.class).getChildByMaterialNo(parentEntity.getMaterialNo());
|
List<BomNewEbomChildEntity> oldParenChild = SpringUtil.getBean(BomNewEbomChildMapper.class).getChildByMaterialNo(parentEntity.getMaterialNo());
|
||||||
//不存在EBom 时
|
//不存在EBom 时
|
||||||
if (Objects.isNull(oldEBom)) {
|
if (Objects.isNull(oldEBom)) {
|
||||||
buildCommonMaterialChildBom(childVo, materialBaseInfo, "V00");
|
buildCommonMaterialChildBom(childVo, materialBaseInfo, VersionUtil.getNextVersion(""));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!EBomStatusEnum.PUBLISHED.equalsValue(oldEBom.getStatus())) {
|
if (!EBomStatusEnum.PUBLISHED.equalsValue(oldEBom.getStatus())) {
|
||||||
BomNewEbomChildEntity newChild = buildCommonEbomChildEntity(materialBaseInfo, parentEntity);
|
BomNewEbomChildEntity newChild = buildCommonEbomChildEntity(materialBaseInfo, parentEntity);
|
||||||
//结构是否相同 且为同一个人
|
//结构是否相同 且为同一个人
|
||||||
if (!isSameEBom(oldParenChild, ImmutableList.of(newChild)) && oldEBom.getCreatedBy().equals(parentEntity.getCreatedBy())) {
|
if ( oldEBom.getCreatedBy().equals(parentEntity.getCreatedBy())) {
|
||||||
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
ebomParentService.getBaseMapper().deleteById(oldEBom.getRowId());
|
||||||
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
ebomChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldEBom.getRowId()));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import static org.apache.naming.SelectorContext.prefix;
|
||||||
*/
|
*/
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
static final String versionPrefix = "A";
|
public static final String versionPrefix = "A";
|
||||||
|
|
||||||
static final String mBomVersionPrefix = "B";
|
static final String mBomVersionPrefix = "B";
|
||||||
|
|
||||||
|
|
@ -92,12 +92,34 @@ public class VersionUtil {
|
||||||
* @param version2
|
* @param version2
|
||||||
* @return version1>version2 返回>0,version1<version2返回 <0,version1=version2返回0
|
* @return version1>version2 返回>0,version1<version2返回 <0,version1=version2返回0
|
||||||
*/
|
*/
|
||||||
public static int compare(String version1, String version2) {
|
|
||||||
version1=StrUtil.replace(version1,versionPrefix,"");
|
|
||||||
version1=StrUtil.replace(version2,versionPrefix,"");
|
|
||||||
Version v1 = Version.parse(version1);
|
public static int compare(String s1, String s2) {
|
||||||
Version v2 = Version.parse(version2);
|
// 分割字符串为字母部分和数字部分
|
||||||
return v1.compareTo(v2);
|
String[] split1 = s1.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
|
||||||
|
String[] split2 = s2.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
|
||||||
|
|
||||||
|
// 遍历每个部分进行比较
|
||||||
|
for (int i = 0; i < Math.min(split1.length, split2.length); i++) {
|
||||||
|
if (split1[i].matches("\\d+\\.\\d+") && split2[i].matches("\\d+\\.\\d+")) {
|
||||||
|
// 如果都是小数,则转为浮点数比较
|
||||||
|
double num1 = Double.parseDouble(split1[i]);
|
||||||
|
double num2 = Double.parseDouble(split2[i]);
|
||||||
|
if (num1 != num2) {
|
||||||
|
return Double.compare(num1, num2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 否则按字符串比较
|
||||||
|
int result = split1[i].compareTo(split2[i]);
|
||||||
|
if (result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 长度不同的情况下,长度较长的字符串视为较大
|
||||||
|
return Integer.compare(split1.length, split2.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,4 +94,11 @@
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END AS result;
|
END AS result;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<delete id="delBomChild">
|
||||||
|
delete from t_bom_new_ebom_child where parent_row_id in
|
||||||
|
<foreach collection="bomRowIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue