Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
This commit is contained in:
commit
9879005e2c
|
|
@ -85,13 +85,13 @@ public class EbomApi extends BaseApi {
|
|||
}
|
||||
|
||||
@PostMapping("changeImpact")
|
||||
@ApiOperation("Ebom-变更影响")
|
||||
@ApiOperation("变更影响-列表")
|
||||
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
||||
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
|
||||
}
|
||||
|
||||
@PostMapping("delChangeImpact")
|
||||
@ApiOperation("Ebom-删除变更影响")
|
||||
@ApiOperation("变更影响-删除")
|
||||
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
|
||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
|
||||
upgradeChangeService.delChangeImpact(rowIds);
|
||||
|
|
@ -99,7 +99,7 @@ public class EbomApi extends BaseApi {
|
|||
}
|
||||
|
||||
@PostMapping("updateChangeImpactVersion")
|
||||
@ApiOperation("Ebom-更新版本")
|
||||
@ApiOperation("变更影响-更新版本")
|
||||
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
|
||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
|
||||
upgradeChangeService.updateChangeImpactVersion(rowIds);
|
||||
|
|
@ -359,13 +359,13 @@ public class EbomApi extends BaseApi {
|
|||
|
||||
|
||||
|
||||
@GetMapping("getrel")
|
||||
@ApiOperation("模糊匹配物料")
|
||||
public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
|
||||
MaterialMateCache mateCache = new MaterialMateCache();
|
||||
MaterialMateVO materialMate = mateCache.findMaterialByNameOrmaterialTexture(materialName,materialTexture);
|
||||
return ResultVO.success(materialMate) ;
|
||||
}
|
||||
// @GetMapping("getrel")
|
||||
// @ApiOperation("模糊匹配物料")
|
||||
// public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
|
||||
// MaterialMateCache mateCache = new MaterialMateCache();
|
||||
// MaterialMateVO materialMate = mateCache.findMaterialByNameOrmaterialTexture(materialName,materialTexture);
|
||||
// return ResultVO.success(materialMate) ;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.product.bomnew.mapper.master;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_update_detail 表数据库访问层
|
||||
* 变更影响-变更具体明细(用于变更确认)
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-01-12 14:27:20
|
||||
*/
|
||||
public interface BomNewEbomUpdateDetailMapper extends BaseMapper<BomNewEbomUpdateDetailEntity> {
|
||||
|
||||
void delByVnoAndParentNo(@Param("virtualPackageMaterialNo")String virtualPackageMaterialNo, @Param("parentMaterialNo")String parentMaterialNo);
|
||||
}
|
||||
|
|
@ -2,6 +2,9 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_upgrade_change 表数据库访问层
|
||||
|
|
@ -11,4 +14,6 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
|||
* @since 2023-12-22 13:44:47
|
||||
*/
|
||||
public interface BomNewEbomUpgradeChangeMapper extends BaseMapper<BomNewEbomUpgradeChangeEntity> {
|
||||
|
||||
void delByVNo(@Param("vNoList")List<String> vNoList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.mapper.master;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_virtual_package_composition 表数据库访问层
|
||||
|
|
@ -11,4 +12,6 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEn
|
|||
* @since 2023-12-22 13:44:10
|
||||
*/
|
||||
public interface BomNewEbomVirtualPackageCompositionMapper extends BaseMapper<BomNewEbomVirtualPackageCompositionEntity> {
|
||||
|
||||
void delByVnoAndParentNo(@Param("virtualPackageMaterialNo")String virtualPackageMaterialNo, @Param("parentMaterialNo")String parentMaterialNo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
package com.nflg.product.bomnew.pojo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_update_detail
|
||||
* 变更影响-变更具体明细(用于变更确认)
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-01-12 15:05:47
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-entity-BomNewEbomUpdateDetailEntity")
|
||||
@TableName(value = "t_bom_new_ebom_update_detail")
|
||||
public class BomNewEbomUpdateDetailEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 行ID
|
||||
*/
|
||||
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "行ID")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 影响到的物料编码(虚拟件编码)
|
||||
*/
|
||||
@TableField(value = "virtual_package_material_no")
|
||||
@ApiModelProperty(value = "影响到的物料编码(虚拟件编码)")
|
||||
private String virtualPackageMaterialNo;
|
||||
|
||||
/**
|
||||
* 影响行父级物料编码
|
||||
*/
|
||||
@TableField(value = "parent_material_no")
|
||||
@ApiModelProperty(value = "影响行父级物料编码")
|
||||
private String parentMaterialNo;
|
||||
|
||||
/**
|
||||
* 影响行父级版本号
|
||||
*/
|
||||
@TableField(value = "current_version")
|
||||
@ApiModelProperty(value = "影响行父级版本号")
|
||||
private String currentVersion;
|
||||
|
||||
/**
|
||||
* 影响行物料编码
|
||||
*/
|
||||
@TableField(value = "child_material_no")
|
||||
@ApiModelProperty(value = "影响行物料编码")
|
||||
private String childMaterialNo;
|
||||
|
||||
/**
|
||||
* 影响行数量
|
||||
*/
|
||||
@TableField(value = "num")
|
||||
@ApiModelProperty(value = "影响行数量")
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 项目类别
|
||||
*/
|
||||
@TableField(value = "project_type")
|
||||
@ApiModelProperty(value = "项目类别")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 来源行ID
|
||||
*/
|
||||
@TableField(value = "ebom_source_row_id")
|
||||
@ApiModelProperty(value = "项目类别")
|
||||
private Long ebomSourceRowId;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "updated_time")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
private static final long serialVersionUID = 591631695584079922L;
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +1,24 @@
|
|||
package com.nflg.product.bomnew.pojo.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_virtual_package_composition
|
||||
*
|
||||
* 虚拟包-提层项组成
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 13:44:10
|
||||
* @since 2024-01-12 15:05:49
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
|
|
@ -45,13 +47,6 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
|||
@ApiModelProperty(value = "父级物料编码")
|
||||
private String parentMaterialNo;
|
||||
|
||||
/**
|
||||
* 标识全路径
|
||||
*/
|
||||
@TableField(value = "parent_full_path_material_no")
|
||||
@ApiModelProperty(value = "标识全路径")
|
||||
private String parentFullPathMaterialNo;
|
||||
|
||||
/**
|
||||
* 子级物料编码
|
||||
*/
|
||||
|
|
@ -60,11 +55,11 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
|||
private String childMaterialNo;
|
||||
|
||||
/**
|
||||
* 子级物料数量
|
||||
* 全路径数量,从上到下。逗号隔开(不含本物料)
|
||||
*/
|
||||
@TableField(value = "child_num")
|
||||
@ApiModelProperty(value = "子级物料数量")
|
||||
private BigDecimal childNum;
|
||||
@TableField(value = "parent_full_path_num")
|
||||
@ApiModelProperty(value = "全路径数量,从上到下。逗号隔开(不含本物料)")
|
||||
private String parentFullPathNum;
|
||||
|
||||
/**
|
||||
* 单重
|
||||
|
|
@ -87,6 +82,13 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
|||
@ApiModelProperty(value = "数量")
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 子级物料项目类别
|
||||
*/
|
||||
@TableField(value = "project_type")
|
||||
@ApiModelProperty(value = "子级物料项目类别")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
|
@ -94,6 +96,6 @@ public class BomNewEbomVirtualPackageCompositionEntity implements Serializable {
|
|||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
private static final long serialVersionUID = -45385735428516334L;
|
||||
private static final long serialVersionUID = -50661114691989818L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,6 +269,11 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("虚拟件类型 0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
|
||||
private Integer virtualPartType;
|
||||
|
||||
@ApiModelProperty("层级数字")
|
||||
private BigDecimal levelNumber;
|
||||
|
||||
private String levelNo;
|
||||
|
||||
@ApiModelProperty("子级")
|
||||
List<BomNewPbomParentVO> childNodes;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
|
|
@ -97,6 +98,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
@Resource
|
||||
private BomNewEbomUpgradeChangeService upgradeChangeService;
|
||||
|
||||
@Resource
|
||||
private BomNewEbomUpdateDetailService updateDetailService;
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
|
|
@ -626,11 +630,35 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
||||
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());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
||||
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
||||
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());
|
||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_update_detail 表服务实现类
|
||||
* 变更影响-变更具体明细(用于变更确认)
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-01-12 14:27:20
|
||||
*/
|
||||
@Service
|
||||
public class BomNewEbomUpdateDetailService extends ServiceImpl<BomNewEbomUpdateDetailMapper, BomNewEbomUpdateDetailEntity> {
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,32 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.UpdateImpact;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import nonapi.io.github.classgraph.json.Id;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -19,6 +40,20 @@ import java.util.List;
|
|||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
BomNewEbomUpdateDetailService updateDetailService;
|
||||
|
||||
@Resource
|
||||
BomNewEbomVirtualPackageCompositionService virtualPackageCompositionService;
|
||||
|
||||
@Resource
|
||||
BomNewPbomParentService pbomParentService;
|
||||
|
||||
@Resource
|
||||
BomNewPbomChildService pbomChildService;
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
@ -29,14 +64,39 @@ public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgrad
|
|||
/**
|
||||
* 更新版本
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateChangeImpactVersion(List<Long> rowIds){
|
||||
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
||||
//
|
||||
for ( BomNewEbomUpgradeChangeEntity ent:upList) {
|
||||
UpdateImpact updateImpact=new UpdateImpact(ent);
|
||||
updateImpact.handlerImpact();
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(updateImpact.getVirtualPBomParent())){
|
||||
pbomParentService.saveOrUpdateBatch(updateImpact.getVirtualPBomParent());
|
||||
}
|
||||
if(CollUtil.isNotEmpty(updateImpact.getVirtualPBomChildren())){
|
||||
pbomChildService.saveOrUpdateBatch(updateImpact.getVirtualPBomChildren());
|
||||
}
|
||||
if(CollUtil.isNotEmpty(updateImpact.getCompositionResult())){
|
||||
//先删除-后保存
|
||||
virtualPackageCompositionService.getBaseMapper().deleteByMap(ImmutableMap.of("virtual_package_material_no",ent.getMaterialNo(),"parent_material_no",ent.getRelMaterialNo()));
|
||||
virtualPackageCompositionService.saveOrUpdateBatch(updateImpact.getCompositionResult());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomVirtualPackageCompositionMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_virtual_package_composition 表服务实现类
|
||||
*
|
||||
* 虚拟包-提层项组成
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 13:44:10
|
||||
* @since 2024-01-12 10:28:36
|
||||
*/
|
||||
@Service
|
||||
public class BomNewEbomVirtualPackageCompositionService extends ServiceImpl<BomNewEbomVirtualPackageCompositionMapper, BomNewEbomVirtualPackageCompositionEntity> {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
|||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.domain.PBom.*;
|
||||
import com.nflg.product.bomnew.util.*;
|
||||
import com.nflg.product.bomnew.util.sap.LevelNumUtil;
|
||||
import io.swagger.models.auth.In;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -36,6 +38,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
|
@ -481,7 +484,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
* @throws ExecutionException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum) throws ExecutionException, InterruptedException {
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum ) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum);
|
||||
|
|
@ -492,6 +495,34 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum ,Boolean generateDrawingNumberFalg) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum);
|
||||
ForkJoinTask<List<BomNewPbomParentVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomNewPbomParentVO> result = submit.join();
|
||||
|
||||
if(generateDrawingNumberFalg){
|
||||
generateDrawingNo(result,rowId,"");
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
public void generateDrawingNo(List<BomNewPbomParentVO> saveBomDetailParamDTO, Long bomRowID, String parentDrawingNo) {
|
||||
List<BomNewPbomParentVO> firstLevelBoms = saveBomDetailParamDTO.stream().filter(u -> u.getParentRowId().equals(bomRowID)).collect(Collectors.toList());
|
||||
parentDrawingNo = StrUtil.isNotBlank(parentDrawingNo) ? parentDrawingNo : "";
|
||||
Integer gNo = 1;
|
||||
for (BomNewPbomParentVO firstLevelBom : firstLevelBoms) {
|
||||
String levelKey = StrUtil.isNotBlank(parentDrawingNo) ? StrUtil.join("-", parentDrawingNo, gNo.toString()) : gNo.toString();
|
||||
firstLevelBom.setLevelNumber(LevelNumUtil.levelToNum(levelKey));
|
||||
firstLevelBom.setLevelNo(levelKey);
|
||||
gNo++;
|
||||
generateDrawingNo(saveBomDetailParamDTO, firstLevelBom.getBomRowId(), firstLevelBom.getLevelNo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<BomNewPbomParentVO> getAllBomTree(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(bomRowId, 0);
|
||||
|
||||
|
|
@ -523,7 +554,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
VUtils.isTure(StrUtil.isBlank(params.getRuleGroupCode())).throwMessage("规则编码不能为空");
|
||||
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 1);
|
||||
List<BomNewPbomParentVO> childrenVO = getAllBom(params.getBomRowId(), 0);
|
||||
materialMainService.intiMaterialInfo(childrenVO, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
List<BomFactorySplitRuleEntity> relList = bomFactorySplitRuleService.lambdaQuery().eq(BomFactorySplitRuleEntity::getRuleGroupCode, params.getRuleGroupCode()).list();
|
||||
StringBuilder relPattern = new StringBuilder();
|
||||
|
|
@ -570,6 +601,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(child.getProjectType().equals("Q")){
|
||||
intiQFac(child,childrenVO);
|
||||
}else {
|
||||
intiNotQFac(child,childrenVO);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
pbomChildService.saveOrUpdateBatch(result);
|
||||
|
|
@ -578,13 +615,54 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
//处理Q下子级分工厂
|
||||
// private void intiQFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child){
|
||||
//
|
||||
// String zero ="1"+ StrUtil.padAfter("0", parentVO.getLevelNum().toString().split(".")[1].length(), "0");
|
||||
//
|
||||
// int i = parentVO.getlev() + (1 / NumberUtil.parseInt(zero));
|
||||
// child.stream().filter(u->u.getLevelNum()>parentVO.getLevelNum() && )
|
||||
// }
|
||||
private void intiQFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child){
|
||||
|
||||
|
||||
setSubNodeFac(parentVO, child,parentVO.getProductionFactoryCode() );
|
||||
|
||||
}
|
||||
//非Q
|
||||
private void intiNotQFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child){
|
||||
|
||||
//当为1020时 ,子级为1020
|
||||
if(parentVO.getProductionFactoryCode().equals(EBomConstant.XIAN_TAO_FACTORY_CODE_1020)){
|
||||
|
||||
setSubNodeFac(parentVO,child, EBomConstant.XIAN_TAO_FACTORY_CODE_1020);
|
||||
}
|
||||
if(parentVO.getProductionFactoryCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)){
|
||||
//父级
|
||||
setParentFac(parentVO,child,EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||
//子级
|
||||
setSubNodeFac(parentVO,child, EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setParentFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child , String facCode){
|
||||
List<String> parentByLevel = BomLevelUtil.getParentByLevel(parentVO.getLevelNo());
|
||||
for ( String level: parentByLevel) {
|
||||
List<BomNewPbomParentVO> parents = child.stream().filter(u -> u.getLevelNo().equals(level) && u.getVirtualPartIs().equals(0)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(parents)){
|
||||
parents.get(0).setProductionFactoryCode(facCode);
|
||||
parents.get(0).setProductionFactoryCodeInputType(ProductionFactoryCodeInputTypeEnum.RULE_MATCH.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setSubNodeFac(BomNewPbomParentVO parentVO, List<BomNewPbomParentVO> child , String facCode){
|
||||
String zero ="1"+ StrUtil.padAfter("0", parentVO.getLevelNum().toString().split(".")[1].length(), "0");
|
||||
BigDecimal bNodeLevel = NumberUtil.add(parentVO.getLevelNumber(), new BigDecimal(1).divide(NumberUtil.div ( new BigDecimal(1) , new BigDecimal(zero))) );
|
||||
List<BomNewPbomParentVO> subNodes = child.stream().filter(u -> u.getLevelNumber().compareTo(parentVO.getLevelNumber()) > 0 && u.getLevelNumber().compareTo(bNodeLevel) < 0).collect(Collectors.toList());
|
||||
for (BomNewPbomParentVO node : subNodes) {
|
||||
node.setProductionFactoryCode(facCode);
|
||||
node.setProductionFactoryCodeInputType(ProductionFactoryCodeInputTypeEnum.RULE_MATCH.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void reConvertToMBom(Long bomRowId, List<Long> backRowId) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
|||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.BomLevelUtil;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.TreeUtils;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
|
|
@ -115,10 +116,7 @@ public class CheckEBomException {
|
|||
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(vo.getMaterialState())
|
||||
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
|
||||
} else if (StrUtil.isBlank(vo.getMaterialNo())
|
||||
|| Objects.isNull(vo.getNum())
|
||||
|| (Objects.nonNull(vo.getNum())
|
||||
&& BigDecimal.ZERO.compareTo(vo.getNum()) >= 0)) {
|
||||
} else if (StrUtil.isBlank(vo.getMaterialNo()) || Objects.isNull(vo.getNum()) || BigDecimal.ZERO.compareTo(vo.getNum()) >= 0) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
|
||||
} else if (StrUtil.isNotBlank(vo.getMaterialNo()) && Objects.isNull(vo.getMaterialState())) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());
|
||||
|
|
@ -143,15 +141,7 @@ public class CheckEBomException {
|
|||
List<BomNewEbomParentVO> parents = allBomDetail.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||
for (BomNewEbomParentVO parent : parents) {
|
||||
List<BomNewEbomParentVO> child = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||
// if(CollUtil.isNotEmpty(child)){
|
||||
// child.forEach(u->{
|
||||
// CheckEBomExceptionDTO ent=new CheckEBomExceptionDTO();
|
||||
// ent.setRowId(u.getRowId());
|
||||
// ent.setParentMaterialNo(parent.getMaterialNo());
|
||||
// ent.setChildMaterialNo(u.getMaterialNo());
|
||||
// checkEBomExceptionDTOS.add(ent);
|
||||
// });
|
||||
// }
|
||||
|
||||
//是否存在重复物料
|
||||
List<BomNewEbomParentVO> hasMaterialNoList = child.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
Map<String, List<BomNewEbomParentVO>> childMaterialMap = ListCommonUtil.listGroupMap(hasMaterialNoList, BomNewEbomParentVO::getMaterialNo);
|
||||
|
|
@ -193,12 +183,12 @@ public class CheckEBomException {
|
|||
*/
|
||||
public void initExceptionYellowWarn(List<BomNewEbomParentVO> list) {
|
||||
List<BomNewEbomParentVO> exceptionList = allBomDetail.stream().filter(u -> u.getExceptionStatus() > EBomExceptionStatusEnum.OK.getValue()).collect(Collectors.toList());
|
||||
// List<String> exceptionMaterialNos = exceptionList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isEmpty(exceptionList)) {
|
||||
return;
|
||||
}
|
||||
for (BomNewEbomParentVO exItem : exceptionList) {
|
||||
List<String> parentByLevel = getParentByLevel(exItem.getLevelNo());
|
||||
List<String> parentByLevel = BomLevelUtil.getParentByLevel(exItem.getLevelNo());
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> u.getBomRowId() > 0 && parentByLevel.contains(u.getLevelNo()) && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
for (BomNewEbomParentVO k :warnList) {
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
|
|
@ -211,16 +201,7 @@ public class CheckEBomException {
|
|||
|
||||
}
|
||||
|
||||
private List<String> getParentByLevel(String levelNo){
|
||||
List<String> result=new ArrayList<>();
|
||||
String[] parts = levelNo.split("-");
|
||||
|
||||
for (int i=parts.length;i>1;i--) {
|
||||
result.add( String.join("-", Arrays.copyOfRange(parts, 0, i-1)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查循环依赖
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
|
|||
import com.nflg.product.bomnew.constant.EBomExceptionStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomVirtualPackageCompositionEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
|
||||
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.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
|
|
@ -61,13 +59,10 @@ public class EBomToPBom {
|
|||
@Getter
|
||||
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||
|
||||
// @Getter
|
||||
// private List<Long> hasConvertEBomRowIds=new ArrayList<>();
|
||||
@Getter
|
||||
private List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult=new ArrayList<>();
|
||||
|
||||
|
||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
||||
|
||||
private Set<String> upChangeMaterialSet = new HashSet<>();
|
||||
private Set<String> hasBuildVNo = Sets.newHashSet();
|
||||
|
||||
|
||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
||||
|
|
@ -82,6 +77,7 @@ public class EBomToPBom {
|
|||
* 31項体层
|
||||
*/
|
||||
public void convert() {
|
||||
|
||||
//效验数据是否OK
|
||||
check();
|
||||
//bom 提层
|
||||
|
|
@ -91,6 +87,10 @@ public class EBomToPBom {
|
|||
for (String facCode : facCodes) {
|
||||
//buildPBomParent(parent, facCode);
|
||||
for (BomNewEbomParentVO vo : parentList) {
|
||||
//构建变更明细
|
||||
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
|
||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||
//子级
|
||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).collect(Collectors.toList());
|
||||
|
|
@ -190,9 +190,11 @@ public class EBomToPBom {
|
|||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
// buildUpgradeChange(vo);
|
||||
}
|
||||
//当没找到直发包时,丢弃
|
||||
// else {
|
||||
// // buildUpgradeChange(vo);
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
||||
|
|
@ -203,44 +205,72 @@ public class EBomToPBom {
|
|||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
// buildUpgradeChange(vo);
|
||||
}
|
||||
// else { //当没找到直发包时,丢弃
|
||||
// // buildUpgradeChange(vo);
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
result.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
//变更记录
|
||||
private void buildUpgradeChange(BomNewEbomParentVO vo) {
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, voParent.get(0).getMaterialNo()).list();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
if (upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<BomNewEbomVirtualPackageCompositionEntity>> vMaterialMap = ListCommonUtil.listGroupMap(list, BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo);
|
||||
Set<String> oldMaterialNoAndNumSet = new HashSet<>();
|
||||
for (String key : vMaterialMap.keySet()) {
|
||||
oldMaterialNoAndNumSet = vMaterialMap.get(key).stream().map(u -> StrUtil.join("-", u.getChildMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
//变更记录(明细)
|
||||
private void buildUpgradeChangeDetail(BomNewEbomParentVO parent,VirtualPackageTypeEnum packageTypeEnum) {
|
||||
|
||||
}
|
||||
Set<String> newSet = allBomDetail.stream().filter(u -> u.getParentRowId().equals(vo.getParentRowId()) && Objects.nonNull(u.getProjectType()) && vo.getProjectType().equals(u.getProjectType())).map(u -> StrUtil.join("-", u.getMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, parent.getMaterialNo())
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getProjectType, packageTypeEnum.getProductTypeKey()).list();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//老的虚拟包组成
|
||||
Set<String> oldMaterialNoAndNumSet = list.stream().filter(u-> u.getParentMaterialNo().equals(parent.getMaterialNo())).map(u->StrUtil.join("-", u.getChildMaterialNo(),u.getNum())).collect(Collectors.toSet());
|
||||
|
||||
List<BomNewEbomParentVO> parentChildren = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||
//物料编码 +数量
|
||||
Set<String> newSet = parentChildren.stream().filter(u -> Objects.nonNull(u.getProjectType()) && VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey().equals(u.getProjectType())).map(u -> StrUtil.join("-", u.getMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
//bom 发生了改变-影响了虚拟包
|
||||
if (CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet, newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet, oldMaterialNoAndNumSet))) {
|
||||
upChangeMaterialSet.add(parent.getMaterialNo());
|
||||
buildUpgradeChange(list, voParent.get(0));
|
||||
|
||||
List<String> vmaterialNoList = list.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
//记录变更明细行
|
||||
buildChangeDetailD0(vmaterialNoList,parent, parentChildren);
|
||||
//变更
|
||||
buildUpgradeChange(list, parent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buildChangeDetailD0( List<String> vmaterialNoList, BomNewEbomParentVO parent, List<BomNewEbomParentVO> parentChildren){
|
||||
for (BomNewEbomParentVO vo : parentChildren) {
|
||||
for (String vNo:vmaterialNoList) {
|
||||
BomNewEbomUpdateDetailEntity changeDetailEnt=new BomNewEbomUpdateDetailEntity();
|
||||
changeDetailEnt.setRowId(IdWorker.getId());
|
||||
changeDetailEnt.setVirtualPackageMaterialNo(vNo);
|
||||
changeDetailEnt.setParentMaterialNo(parent.getMaterialNo());
|
||||
changeDetailEnt.setCurrentVersion(parent.getCurrentVersion());
|
||||
changeDetailEnt.setChildMaterialNo(vo.getMaterialNo());
|
||||
changeDetailEnt.setNum(vo.getNum());
|
||||
changeDetailEnt.setProjectType(vo.getProjectType());
|
||||
changeDetailEnt.setUpdatedTime(LocalDateTime.now());
|
||||
changeDetailEnt.setEbomSourceRowId(vo.getRowId());
|
||||
this.upgradeChangeDetailResult.add(changeDetailEnt);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
||||
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
for (String vmaterialNo : vmaterialNoList) {
|
||||
String key = StrUtil.join("-", vmaterialNo, parent.getMaterialNo());
|
||||
if(hasBuildVNo.contains(key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||
changeEntity.setRowId(IdWorker.getId());
|
||||
changeEntity.setMaterialNo(vmaterialNo);
|
||||
|
|
@ -252,6 +282,8 @@ public class EBomToPBom {
|
|||
changeEntity.setRelMaterialDesc(parent.getMaterialDesc());
|
||||
changeEntity.setStatus(0);
|
||||
upgradeChangeResult.add(changeEntity);
|
||||
|
||||
hasBuildVNo.add( key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -265,54 +297,37 @@ public class EBomToPBom {
|
|||
*/
|
||||
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||
BigDecimal sum = vo.getNum();
|
||||
String parentLevelNo = vo.getLevelNo().substring(0, vo.getLevelNo().length() - 2);
|
||||
List<String> parentFullPathMaterialNoList = new ArrayList<>();
|
||||
String parentLevelNo = BomLevelUtil.getParentLevelNo(vo.getLevelNo());
|
||||
List<BigDecimal> parentFullPathNum = new ArrayList<>();
|
||||
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
||||
String pNo = parentLevelNo;
|
||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo) && !u.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
||||
!u.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !u.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
||||
.collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parentList)) {
|
||||
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
||||
parentFullPathMaterialNoList.add(parentList.get(0).getMaterialNo());
|
||||
parentFullPathNum.add(parentList.get(0).getNum());
|
||||
} else {
|
||||
parentFullPathMaterialNoList.add(vo.getMaterialNo());
|
||||
parentFullPathNum.add(parentList.get(0).getNum());
|
||||
}
|
||||
parentLevelNo = parentLevelNo.substring(0, parentLevelNo.length() - 2);
|
||||
parentLevelNo = BomLevelUtil.getParentLevelNo(parentLevelNo);
|
||||
|
||||
}
|
||||
vo.setNum(sum);
|
||||
//构建虚拟包组成
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathMaterialNoList);
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathNum);
|
||||
|
||||
}
|
||||
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList) {
|
||||
Collections.reverse(parentFullPathMaterialNoList);
|
||||
String fullPath = StrUtil.join("-", parentFullPathMaterialNoList);
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo, fullPath)
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, lastVirtualPackage.getMaterialNo()).list();
|
||||
//删除旧的
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<Long> delRowIds = list.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).getBaseMapper().deleteBatchIds(delRowIds);
|
||||
}
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<BigDecimal> parentFullPathNum) {
|
||||
|
||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
||||
packageCompositionEntity.setRowId(IdWorker.getId());
|
||||
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
if (voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
||||
!voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) {
|
||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||
} else {
|
||||
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
|
||||
}
|
||||
|
||||
packageCompositionEntity.setParentFullPathMaterialNo(fullPath);
|
||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||
packageCompositionEntity.setChildMaterialNo(vo.getMaterialNo());
|
||||
packageCompositionEntity.setChildNum(vo.getNum());
|
||||
packageCompositionEntity.setParentFullPathNum(StrUtil.join(",",parentFullPathNum));
|
||||
packageCompositionEntity.setProjectType(vo.getProjectType());
|
||||
packageCompositionEntity.setUnitWeight(vo.getUnitWeight());
|
||||
packageCompositionEntity.setTotalWeight(vo.getTotalWeight());
|
||||
packageCompositionEntity.setUpdatedTime(LocalDateTime.now());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.PBomStatusEnum;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import lombok.Getter;
|
||||
import org.bouncycastle.asn1.x509.IetfAttrSyntax;
|
||||
import org.bouncycastle.cms.PasswordRecipient;
|
||||
import org.omg.CORBA.PRIVATE_MEMBER;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 变更影响
|
||||
*/
|
||||
public class UpdateImpact {
|
||||
|
||||
private BomNewEbomUpgradeChangeEntity changeEntity;
|
||||
|
||||
@Getter
|
||||
private List<BomNewPbomParentEntity> virtualPBomParent = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<BomNewPbomChildEntity> virtualPBomChildren = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<BomNewEbomVirtualPackageCompositionEntity> compositionResult = new ArrayList<>();
|
||||
|
||||
|
||||
public UpdateImpact(BomNewEbomUpgradeChangeEntity inChangeEntity) {
|
||||
changeEntity = inChangeEntity;
|
||||
getVirtualPackageVersion(inChangeEntity.getMaterialNo());
|
||||
}
|
||||
|
||||
|
||||
public void handlerImpact() {
|
||||
//新的提层明细
|
||||
List<BomNewEbomUpdateDetailEntity> newVirtualDetail = SpringUtil.getBean(BomNewEbomUpdateDetailService.class).lambdaQuery()
|
||||
.eq(BomNewEbomUpdateDetailEntity::getVirtualPackageMaterialNo, changeEntity.getMaterialNo())
|
||||
.eq(BomNewEbomUpdateDetailEntity::getParentMaterialNo, changeEntity.getRelMaterialNo())
|
||||
.list();
|
||||
//旧的体层明细
|
||||
compositionResult = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, changeEntity.getMaterialNo())
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, changeEntity.getRelMaterialNo())
|
||||
.list();
|
||||
|
||||
List<String> parentFullPathNum = Arrays.asList(StrUtil.split(compositionResult.get(0).getParentFullPathNum(), ","));
|
||||
|
||||
for (BomNewEbomUpdateDetailEntity newItem : newVirtualDetail) {
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> oldItem = compositionResult.stream().filter(u -> u.getChildMaterialNo().equals(newItem.getChildMaterialNo())).collect(Collectors.toList());
|
||||
|
||||
//旧的没有则新增子级
|
||||
if (CollUtil.isEmpty(oldItem)) {
|
||||
handlerAdd(newItem, parentFullPathNum);
|
||||
//更新虚拟包组成
|
||||
buildComposetion(oldItem.get(0), newItem);
|
||||
}
|
||||
//数量变更
|
||||
else if (CollUtil.isNotEmpty(oldItem) && !oldItem.get(0).getNum().equals(newItem.getNum())) {
|
||||
handlerUp(newItem, parentFullPathNum,NumberUtil.sub(newItem.getNum(),oldItem.get(0).getNum()));
|
||||
|
||||
//更新虚拟包组成
|
||||
oldItem.get(0).setNum(newItem.getNum());
|
||||
}
|
||||
|
||||
}
|
||||
//旧的有 新的无 则删除
|
||||
Set<String> newMaterialNos = newVirtualDetail.stream().map(u -> u.getChildMaterialNo()).collect(Collectors.toSet());
|
||||
Set<String> oldMaterialNos = compositionResult.stream().map(u -> u.getChildMaterialNo()).collect(Collectors.toSet());
|
||||
Set<String> difference = Sets.difference(oldMaterialNos, newMaterialNos);
|
||||
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> delNodes = compositionResult.stream().filter(u -> difference.contains(u.getChildMaterialNo())).collect(Collectors.toList());
|
||||
for (BomNewEbomVirtualPackageCompositionEntity delItem : delNodes) {
|
||||
//刪除
|
||||
handlerDel(delItem, parentFullPathNum);
|
||||
//更新虚拟包组成
|
||||
compositionResult.remove(delItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildComposetion(BomNewEbomVirtualPackageCompositionEntity oldVirtualDetail, BomNewEbomUpdateDetailEntity newItem){
|
||||
BomNewEbomVirtualPackageCompositionEntity nEnt = new BomNewEbomVirtualPackageCompositionEntity();
|
||||
|
||||
BeanUtil.copyProperties(oldVirtualDetail, nEnt);
|
||||
nEnt.setRowId(IdWorker.getId());
|
||||
nEnt.setChildMaterialNo(newItem.getChildMaterialNo());
|
||||
nEnt.setNum(newItem.getNum());
|
||||
nEnt.setProjectType(newItem.getProjectType());
|
||||
nEnt.setUpdatedTime(LocalDateTime.now());
|
||||
|
||||
this.compositionResult.add(nEnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Pbom
|
||||
*
|
||||
* @param parentFullPathNum
|
||||
* @param
|
||||
*/
|
||||
private void handlerAdd(BomNewEbomUpdateDetailEntity newItem, List<String> parentFullPathNum) {
|
||||
List<BomNewPbomChildEntity> childNodes = this.virtualPBomChildren.stream().filter(u -> u.getMaterialNo().equals(newItem.getChildMaterialNo())).collect(Collectors.toList());
|
||||
|
||||
|
||||
BigDecimal mulValue = new BigDecimal(1);
|
||||
if (CollUtil.isNotEmpty(parentFullPathNum)) {
|
||||
List<BigDecimal> relFullPatnNum = Convert.toList(BigDecimal.class, parentFullPathNum);
|
||||
mulValue = relFullPatnNum.stream().reduce(BigDecimal.ONE, BigDecimal::multiply);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(childNodes)) {
|
||||
for (BomNewPbomChildEntity child : childNodes) {
|
||||
child.setNum(NumberUtil.mul(child.getNum(), mulValue));
|
||||
}
|
||||
} else {
|
||||
for (BomNewPbomParentEntity vParent : this.virtualPBomParent) {
|
||||
BomNewPbomChildEntity vChild = new BomNewPbomChildEntity();
|
||||
|
||||
BomNewEbomChildEntity sourceEnd = SpringUtil.getBean(BomNewEbomChildService.class).getById(newItem.getEbomSourceRowId());
|
||||
BeanUtil.copyProperties(sourceEnd, vChild);
|
||||
vChild.setRowId(IdWorker.getId());
|
||||
vChild.setParentRowId(vParent.getRowId());
|
||||
vChild.setFacCode(vParent.getFacCode());
|
||||
vChild.setOrderNumber(StrUtil.padPre(String.valueOf(this.virtualPBomChildren.size()), 3, "0"));
|
||||
vChild.setCreatedBy(SessionUtil.getUserCode());
|
||||
vChild.setCreatedTime(LocalDateTime.now());
|
||||
vChild.setModifyTime(LocalDateTime.now());
|
||||
this.virtualPBomChildren.add(vChild);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handlerUp(BomNewEbomUpdateDetailEntity newItem, List<String> parentFullPathNum,BigDecimal diffNum) {
|
||||
|
||||
List<BomNewPbomChildEntity> childNodes = this.virtualPBomChildren.stream().filter(u -> u.getMaterialNo().equals(newItem.getChildMaterialNo())).collect(Collectors.toList());
|
||||
BigDecimal mulValue = new BigDecimal(1);
|
||||
if (CollUtil.isNotEmpty(parentFullPathNum)) {
|
||||
List<BigDecimal> relFullPatnNum = Convert.toList(BigDecimal.class, parentFullPathNum);
|
||||
mulValue = relFullPatnNum.stream().reduce(BigDecimal.ONE, BigDecimal::multiply);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(childNodes)) {
|
||||
for (BomNewPbomChildEntity child : childNodes) {
|
||||
child.setNum(NumberUtil.add(child.getNum(),NumberUtil.mul(diffNum,mulValue)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handlerDel(BomNewEbomVirtualPackageCompositionEntity delItem, List<String> parentFullPathNum) {
|
||||
|
||||
List<BomNewPbomChildEntity> childNodes = this.virtualPBomChildren.stream().filter(u -> u.getMaterialNo().equals(delItem.getChildMaterialNo())).collect(Collectors.toList());
|
||||
BigDecimal mulValue = new BigDecimal(1);
|
||||
if (CollUtil.isNotEmpty(parentFullPathNum)) {
|
||||
List<BigDecimal> relFullPatnNum = Convert.toList(BigDecimal.class, parentFullPathNum);
|
||||
mulValue = relFullPatnNum.stream().reduce(BigDecimal.ONE, BigDecimal::multiply);
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(childNodes)) {
|
||||
for (BomNewPbomChildEntity child : childNodes) {
|
||||
if(child.getNum().equals(NumberUtil.mul(delItem.getNum(),mulValue))){
|
||||
this.virtualPBomChildren.remove(child);
|
||||
}
|
||||
else {
|
||||
child.setNum(NumberUtil.sub(child.getNum(), NumberUtil.mul(delItem.getNum(), mulValue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getVirtualPackageVersion(String virtualPackageMaterialNo) {
|
||||
List<BomNewPbomParentEntity> pBoms = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, virtualPackageMaterialNo)
|
||||
.eq(BomNewPbomParentEntity::getLastVersionIs, 1).list();
|
||||
VUtils.isTure(CollUtil.isEmpty(pBoms)).throwMessage("未找到该虚拟包的Pbom版本");
|
||||
|
||||
//已发布则升级
|
||||
for (BomNewPbomParentEntity pBom : pBoms) {
|
||||
List<BomNewPbomChildEntity> childs = SpringUtil.getBean(BomNewPbomChildService.class).lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId, pBom.getRowId()).list();
|
||||
if (pBom.getStatus() > (PBomStatusEnum.PUBLISH.getValue())) {
|
||||
BomNewPbomParentEntity newVirParent = new BomNewPbomParentEntity();
|
||||
BeanUtil.copyProperties(pBom, newVirParent);
|
||||
newVirParent.setRowId(IdWorker.getId());
|
||||
newVirParent.setCurrentVersion(VersionUtil.getNextVersion(pBom.getCurrentVersion()));
|
||||
newVirParent.setLastVersionIs(1);
|
||||
childs.forEach(u -> {
|
||||
u.setRowId(IdWorker.getId());
|
||||
u.setParentRowId(newVirParent.getRowId());
|
||||
});
|
||||
virtualPBomParent.add(newVirParent);
|
||||
virtualPBomChildren.addAll(childs);
|
||||
pBom.setLastVersionIs(0);
|
||||
|
||||
} else {
|
||||
virtualPBomParent.add(pBom);
|
||||
virtualPBomChildren.addAll(childs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ public class ConvertToMBom {
|
|||
* 转换MBom
|
||||
*/
|
||||
public void convertToMBom() {
|
||||
handler1010();
|
||||
//handler1010();
|
||||
handler1020();
|
||||
|
||||
buildMBom(EBomConstant.MAIN_FACTORY_CODE_1010);
|
||||
|
|
@ -102,7 +102,10 @@ public class ConvertToMBom {
|
|||
mBomParent.setLastVersionIs(1);
|
||||
this.mBomParentResult.add(mBomParent);
|
||||
|
||||
buildChild(EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChildTreeList_1010 : allChildTreeList_1020, mBomParent.getRowId());
|
||||
|
||||
//1010 不做处理
|
||||
// buildChild(EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChildTreeList_1010 : allChildTreeList_1020, mBomParent.getRowId());
|
||||
buildChild(EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChild_1010 : allChildTreeList_1020, mBomParent.getRowId());
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.nflg.product.bomnew.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BomLevelUtil {
|
||||
|
||||
public static List<String> getParentByLevel(String levelNo){
|
||||
List<String> result=new ArrayList<>();
|
||||
String[] parts = levelNo.split("-");
|
||||
|
||||
for (int i=parts.length;i>1;i--) {
|
||||
result.add( String.join("-", Arrays.copyOfRange(parts, 0, i-1)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getParentLevelNo(String levelNo){
|
||||
List<String> result=new ArrayList<>();
|
||||
String[] parts = levelNo.split("-");
|
||||
return String.join("-", Arrays.copyOfRange(parts, 0, levelNo.length()-1));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewEbomUpdateDetailMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewEbomUpdateDetailEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table t_bom_new_ebom_update_detail -->
|
||||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||
<result column="virtual_package_material_no" property="virtualPackageMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="current_version" property="currentVersion" jdbcType="VARCHAR"/>
|
||||
<result column="child_material_no" property="childMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
|
||||
<result column="ebom_source_row_id" property="ebomSourceRowId" jdbcType="BIGINT" />
|
||||
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, virtual_package_material_no, parent_material_no, current_version, child_material_no, num,ebom_source_row_id, updated_time </sql>
|
||||
|
||||
|
||||
<delete id="delByVnoAndParentNo">
|
||||
delete from t_bom_new_ebom_update_detail
|
||||
where virtual_package_material_no=#{virtualPackageMaterialNo}
|
||||
and parent_material_no=#{parentMaterialNo}}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -23,4 +23,11 @@
|
|||
row_id, material_no, version_old, version_new, material_name, drawing_no, devise_name, dept_name,
|
||||
rel_material_no, rel_material_desc, status, updated_time
|
||||
</sql>
|
||||
|
||||
<delete id="delByVNo">
|
||||
delete from t_bom_new_ebom_upgrade_change where status=0 and concat(material_no, rel_material_no) in
|
||||
<foreach collection="vNoList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -7,18 +7,24 @@
|
|||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||
<result column="virtual_package_material_no" property="virtualPackageMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="parent_full_path_material_no" property="parentFullPathMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="child_material_no" property="childMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="child_num" property="childNum" jdbcType="DECIMAL"/>
|
||||
<result column="parent_full_path_num" property="parentFullPathNum" jdbcType="VARCHAR"/>
|
||||
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
|
||||
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
|
||||
<result column="num" property="num" jdbcType="DECIMAL"/>
|
||||
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
|
||||
<result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, virtual_package_material_no, parent_material_no, parent_full_path_material_no, child_material_no,
|
||||
child_num, unit_weight, total_weight, num, updated_time
|
||||
row_id, virtual_package_material_no, parent_material_no, child_material_no, parent_full_path_num,
|
||||
unit_weight, total_weight, num, updated_time
|
||||
</sql>
|
||||
|
||||
<delete id="delByVnoAndParentNo">
|
||||
delete from t_bom_new_ebom_virtual_package_composition
|
||||
where virtual_package_material_no=#{virtualPackageMaterialNo}
|
||||
and parent_material_no=#{parentMaterialNo}}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@
|
|||
and drawing_no = #{query.drawingNo}
|
||||
</if>
|
||||
<if test="query.startDate!= null and query.endDate!=null">
|
||||
and created_time between #{query.startDate} and #{query.endDate}
|
||||
and created_time between #{query.startDate} and DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
select * , row_id as bomRowId
|
||||
from t_bom_new_pbom_parent where status >= 4
|
||||
<if test="query.startDate== null">
|
||||
and release_time > DATE_SUB(release_time, INTERVAL 3 DAY)
|
||||
and release_time > DATE_SUB(release_time, INTERVAL 4 DAY)
|
||||
</if>
|
||||
<if test="query.facCode!= null and query.facCode!=''">
|
||||
and fac_code = #{query.facCode}
|
||||
|
|
|
|||
Loading…
Reference in New Issue