1.转PBOM
This commit is contained in:
parent
de3320b4f1
commit
47aa23a108
|
|
@ -14,10 +14,7 @@ import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.*;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
import com.nflg.product.bomnew.service.*;
|
||||||
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
|
|
||||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
|
||||||
import com.nflg.product.bomnew.service.UserRoleService;
|
|
||||||
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
|
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
|
||||||
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
|
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
|
|
@ -66,6 +63,9 @@ public class EbomApi extends BaseApi {
|
||||||
@Resource
|
@Resource
|
||||||
private UserRoleService userRoleService;
|
private UserRoleService userRoleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BomNewEbomUpgradeChangeService upgradeChangeService;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("workDetailsListByPage")
|
@PostMapping("workDetailsListByPage")
|
||||||
@ApiOperation("Ebom-工作明细列表")
|
@ApiOperation("Ebom-工作明细列表")
|
||||||
|
|
@ -81,10 +81,28 @@ public class EbomApi extends BaseApi {
|
||||||
|
|
||||||
@PostMapping("changeImpact")
|
@PostMapping("changeImpact")
|
||||||
@ApiOperation("Ebom-变更影响")
|
@ApiOperation("Ebom-变更影响")
|
||||||
public ResultVO<Page<BomNewEbomParentVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
||||||
return ResultVO.success(bomNewEbomParentService.formalWorksheet(query));
|
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("delChangeImpact")
|
||||||
|
@ApiOperation("Ebom-删除变更影响")
|
||||||
|
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
|
||||||
|
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
|
||||||
|
upgradeChangeService.delChangeImpact(rowIds);
|
||||||
|
return ResultVO.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("updateChangeImpactVersion")
|
||||||
|
@ApiOperation("Ebom-更新版本")
|
||||||
|
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
|
||||||
|
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
|
||||||
|
upgradeChangeService.updateChangeImpactVersion(rowIds);
|
||||||
|
return ResultVO.success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("getChild")
|
@GetMapping("getChild")
|
||||||
@ApiOperation("获取子级")
|
@ApiOperation("获取子级")
|
||||||
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {
|
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||||
|
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -38,6 +39,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
|
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
|
||||||
|
|
||||||
|
Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(Page<BomNewEbomUpgradeChangeVO> page, @Param("query") BomNewEbomParentQuery query);
|
||||||
/**
|
/**
|
||||||
* 获取子级
|
* 获取子级
|
||||||
* @param rowId
|
* @param rowId
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* t_bom_new_ebom_upgrade_change
|
||||||
|
* ebom-变更影响
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2023-12-23 16:10:19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewEbomUpgradeChangeEntityVO")
|
||||||
|
public class BomNewEbomUpgradeChangeVO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键-行ID
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "主键-行ID")
|
||||||
|
private Long rowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 受影响的物料编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "受影响的物料编码")
|
||||||
|
private String materialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修订版(旧)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "修订版(旧)")
|
||||||
|
private String versionOld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修订版(新)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "修订版(新)")
|
||||||
|
private String versionNew;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "图号")
|
||||||
|
private String drawingNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计人员
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "设计人员")
|
||||||
|
private String deviseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计人员部门
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "设计人员部门")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联物料编码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "关联物料编码")
|
||||||
|
private String relMaterialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联物料描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "关联物料描述")
|
||||||
|
private String relMaterialDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:0-未升级处理 1-已升级处理
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "状态:0-未升级处理 1-已升级处理")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private LocalDateTime updatedTime;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -200,6 +200,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取变更影响
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(BomNewEbomParentQuery query) {
|
||||||
|
Page<BomNewEbomUpgradeChangeVO> result = this.getBaseMapper().getUpgradeChangeList(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子级
|
* 获取子级
|
||||||
*
|
*
|
||||||
|
|
@ -247,6 +261,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//初始化错误
|
||||||
|
initBomException(parentChild);
|
||||||
return parentChild;
|
return parentChild;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -436,9 +452,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||||
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
|
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
|
||||||
|
parent.setBomRowId(parent.getRowId());
|
||||||
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes());
|
parent.setChildBomRowId(parent.getRowId());
|
||||||
|
parent.setParentRowId(0L);
|
||||||
|
bomTree.add(parent);
|
||||||
|
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes(),0L);
|
||||||
eBomToPBom.convert();
|
eBomToPBom.convert();
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
||||||
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
|
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_ebom_upgrade_change 表服务实现类
|
* t_bom_new_ebom_upgrade_change 表服务实现类
|
||||||
|
|
@ -16,4 +18,25 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
public void delChangeImpact(List<Long> rowIds){
|
||||||
|
this.getBaseMapper().deleteBatchIds(rowIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新版本
|
||||||
|
*/
|
||||||
|
public void updateChangeImpactVersion(List<Long> rowIds){
|
||||||
|
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
|
||||||
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
|
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
|
||||||
detailVO.setChildBomRowId(ebomParentEntity.getRowId());
|
detailVO.setChildBomRowId(ebomParentEntity.getRowId());
|
||||||
detailVO.setBomRowId(ebomParentEntity.getRowId());
|
detailVO.setBomRowId(ebomParentEntity.getRowId());
|
||||||
|
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||||
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 lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bouncycastle.crypto.engines.EthereumIESEngine;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -61,14 +62,14 @@ public class EBomToPBom {
|
||||||
|
|
||||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
||||||
|
|
||||||
private Set<String> upChangeMaterialSet=new HashSet<>();
|
private Set<String> upChangeMaterialSet = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes) {
|
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
||||||
this.parent = inParent;
|
this.parent = inParent;
|
||||||
this.allBomDetail = inAllBomDetail;
|
this.allBomDetail = inAllBomDetail;
|
||||||
this.facCodes = inFacCodes;
|
this.facCodes = inFacCodes;
|
||||||
generateDrawingNo(allBomDetail, inParent.getRowId(), "");
|
generateDrawingNo(allBomDetail, parentRowId, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -83,6 +84,7 @@ public class EBomToPBom {
|
||||||
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||||
|
|
||||||
for (String facCode : facCodes) {
|
for (String facCode : facCodes) {
|
||||||
|
//buildPBomParent(parent, facCode);
|
||||||
for (BomNewEbomParentVO vo : parentList) {
|
for (BomNewEbomParentVO vo : parentList) {
|
||||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||||
//子级
|
//子级
|
||||||
|
|
@ -94,6 +96,7 @@ public class EBomToPBom {
|
||||||
childEnt.setRowId(IdWorker.getId());
|
childEnt.setRowId(IdWorker.getId());
|
||||||
childEnt.setParentRowId(parentEnt.getRowId());
|
childEnt.setParentRowId(parentEnt.getRowId());
|
||||||
childEnt.setFacCode(facCode);
|
childEnt.setFacCode(facCode);
|
||||||
|
childEnt.setIdentityNo(StrUtil.join("-", parentEnt.getMaterialNo(), eb.getMaterialNo()));
|
||||||
this.pBomChildResult.add(childEnt);
|
this.pBomChildResult.add(childEnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +131,7 @@ public class EBomToPBom {
|
||||||
return oldParent;
|
return oldParent;
|
||||||
} else {
|
} else {
|
||||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||||
BeanUtil.copyProperties( parentVo,pBomParent);
|
BeanUtil.copyProperties(parentVo, pBomParent);
|
||||||
pBomParent.setRowId(IdWorker.getId());
|
pBomParent.setRowId(IdWorker.getId());
|
||||||
pBomParent.setLastVersionIs(1);
|
pBomParent.setLastVersionIs(1);
|
||||||
pBomParent.setFacCode(facCode);
|
pBomParent.setFacCode(facCode);
|
||||||
|
|
@ -155,8 +158,7 @@ public class EBomToPBom {
|
||||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
}
|
} else { //当没找到直发包时,记录到变更影响
|
||||||
else { //当没找到直发包时,记录到变更影响
|
|
||||||
buildUpgradeChange(vo);
|
buildUpgradeChange(vo);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -169,8 +171,7 @@ public class EBomToPBom {
|
||||||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
}
|
} else { //当没找到直发包时,记录到变更影响
|
||||||
else { //当没找到直发包时,记录到变更影响
|
|
||||||
buildUpgradeChange(vo);
|
buildUpgradeChange(vo);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -180,35 +181,35 @@ public class EBomToPBom {
|
||||||
}
|
}
|
||||||
|
|
||||||
//变更记录
|
//变更记录
|
||||||
private void buildUpgradeChange(BomNewEbomParentVO vo){
|
private void buildUpgradeChange(BomNewEbomParentVO vo) {
|
||||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||||
VUtils.isTure(CollUtil.isNotEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
VUtils.isTure(CollUtil.isNotEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, voParent.get(0).getMaterialNo()).list();
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, voParent.get(0).getMaterialNo()).list();
|
||||||
if(CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
if(upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())){
|
if (upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, List<BomNewEbomVirtualPackageCompositionEntity>> vMaterialMap = ListCommonUtil.listGroupMap(list, BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo);
|
Map<String, List<BomNewEbomVirtualPackageCompositionEntity>> vMaterialMap = ListCommonUtil.listGroupMap(list, BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo);
|
||||||
Set<String> oldMaterialNoAndNumSet=new HashSet<>();
|
Set<String> oldMaterialNoAndNumSet = new HashSet<>();
|
||||||
for (String key: vMaterialMap.keySet()) {
|
for (String key : vMaterialMap.keySet()) {
|
||||||
oldMaterialNoAndNumSet=vMaterialMap.get(key).stream().map(u->StrUtil.join("-", u.getChildMaterialNo(),u.getNum())).collect(Collectors.toSet());
|
oldMaterialNoAndNumSet = vMaterialMap.get(key).stream().map(u -> StrUtil.join("-", u.getChildMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||||
|
|
||||||
}
|
}
|
||||||
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());
|
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());
|
||||||
//bom 发生了改变-影响了虚拟包
|
//bom 发生了改变-影响了虚拟包
|
||||||
if( CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet,newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet,oldMaterialNoAndNumSet)) ){
|
if (CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet, newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet, oldMaterialNoAndNumSet))) {
|
||||||
upChangeMaterialSet.add(parent.getMaterialNo());
|
upChangeMaterialSet.add(parent.getMaterialNo());
|
||||||
buildUpgradeChange(list, voParent.get(0));
|
buildUpgradeChange(list, voParent.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList,BomNewEbomParentVO parent){
|
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
||||||
List<String> vmaterialNoList= changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||||
for (String vmaterialNo: vmaterialNoList) {
|
for (String vmaterialNo : vmaterialNoList) {
|
||||||
BomNewEbomUpgradeChangeEntity changeEntity=new BomNewEbomUpgradeChangeEntity();
|
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||||
changeEntity.setRowId(IdWorker.getId());
|
changeEntity.setRowId(IdWorker.getId());
|
||||||
changeEntity.setMaterialNo(vmaterialNo);
|
changeEntity.setMaterialNo(vmaterialNo);
|
||||||
changeEntity.setVersionOld(parent.getCurrentVersion());
|
changeEntity.setVersionOld(parent.getCurrentVersion());
|
||||||
|
|
@ -224,7 +225,6 @@ public class EBomToPBom {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提层汇总数量
|
* 提层汇总数量
|
||||||
*
|
*
|
||||||
|
|
@ -234,16 +234,16 @@ public class EBomToPBom {
|
||||||
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||||
BigDecimal sum = vo.getNum();
|
BigDecimal sum = vo.getNum();
|
||||||
String parentLevelNo = vo.getLevelNo().substring(0, vo.getLevelNo().length() - 2);
|
String parentLevelNo = vo.getLevelNo().substring(0, vo.getLevelNo().length() - 2);
|
||||||
List<String> parentFullPathMaterialNoList=new ArrayList<>();
|
List<String> parentFullPathMaterialNoList = new ArrayList<>();
|
||||||
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
||||||
String pNo=parentLevelNo;
|
String pNo = parentLevelNo;
|
||||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo) && !u.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
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()))
|
!u.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !u.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(parentList)) {
|
if (CollUtil.isNotEmpty(parentList)) {
|
||||||
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
||||||
parentFullPathMaterialNoList.add(parentList.get(0).getMaterialNo());
|
parentFullPathMaterialNoList.add(parentList.get(0).getMaterialNo());
|
||||||
}else {
|
} else {
|
||||||
parentFullPathMaterialNoList.add(vo.getMaterialNo());
|
parentFullPathMaterialNoList.add(vo.getMaterialNo());
|
||||||
}
|
}
|
||||||
parentLevelNo = parentLevelNo.substring(0, parentLevelNo.length() - 2);
|
parentLevelNo = parentLevelNo.substring(0, parentLevelNo.length() - 2);
|
||||||
|
|
@ -251,32 +251,30 @@ public class EBomToPBom {
|
||||||
}
|
}
|
||||||
vo.setNum(sum);
|
vo.setNum(sum);
|
||||||
//构建虚拟包组成
|
//构建虚拟包组成
|
||||||
buildVirtualPackageComposition(lastVirtualPackage, vo,parentFullPathMaterialNoList);
|
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathMaterialNoList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage,BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList){
|
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList) {
|
||||||
Collections.reverse(parentFullPathMaterialNoList);
|
Collections.reverse(parentFullPathMaterialNoList);
|
||||||
String fullPath= StrUtil.join("-", parentFullPathMaterialNoList);
|
String fullPath = StrUtil.join("-", parentFullPathMaterialNoList);
|
||||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo, fullPath)
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo, fullPath)
|
||||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, lastVirtualPackage.getMaterialNo()).list();
|
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, lastVirtualPackage.getMaterialNo()).list();
|
||||||
//删除旧的
|
//删除旧的
|
||||||
if(CollUtil.isNotEmpty(list)){
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
List<Long> delRowIds = list.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
List<Long> delRowIds = list.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||||
SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).getBaseMapper().deleteBatchIds(delRowIds);
|
SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).getBaseMapper().deleteBatchIds(delRowIds);
|
||||||
}
|
}
|
||||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity=new BomNewEbomVirtualPackageCompositionEntity();
|
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
||||||
packageCompositionEntity.setRowId(IdWorker.getId());
|
packageCompositionEntity.setRowId(IdWorker.getId());
|
||||||
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
||||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId()) ).collect(Collectors.toList());
|
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||||
if(voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
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()))
|
!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());
|
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
|
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.nflg.product.bomnew.service.domain.EBom;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新-变更影响版本
|
||||||
|
*/
|
||||||
|
public class UpdateChangeVersion {
|
||||||
|
|
||||||
|
@ApiModelProperty("变更行ID")
|
||||||
|
private Long upChangeRowId;
|
||||||
|
|
||||||
|
|
||||||
|
public UpdateChangeVersion (Long inUpChangeRowId){
|
||||||
|
this.upChangeRowId=inUpChangeRowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -123,6 +123,27 @@
|
||||||
<include refid="whr"/>
|
<include refid="whr"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<sql id="getUpgradeChangeListWhr">
|
||||||
|
<if test="query.drawingNo!=null and query.drawingNo!=''">
|
||||||
|
and drawing_no=#{query.drawingNo}
|
||||||
|
</if>
|
||||||
|
<if test="query.materialNo!=null and query.materialNo!=''">
|
||||||
|
and material_no=#{query.materialNo}
|
||||||
|
</if>
|
||||||
|
<if test="query.deviseName!=null and query.deviseName!=''">
|
||||||
|
and devise_name=#{query.deviseName}
|
||||||
|
</if>
|
||||||
|
<if test="query.startDate!=null and query.startDate!=''">
|
||||||
|
and updated_time between #{query.startDate} and #{query.endDate}
|
||||||
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--BOM-变更影响-->
|
||||||
|
<select id="getUpgradeChangeList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO">
|
||||||
|
select * from t_bom_new_ebom_upgrade_change where status=0
|
||||||
|
<include refid="getUpgradeChangeListWhr"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--获取子级-->
|
<!--获取子级-->
|
||||||
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||||
select *
|
select *
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue