Merge branch 'refs/heads/feature/DM/nflg-bom' into dev
# Conflicts: # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewOriginalParentMapper.java # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewOriginalParentService.java # nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml # nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewOriginalParentMapper.xml
This commit is contained in:
commit
a655f0e745
|
|
@ -4,12 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
|
||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -53,9 +52,9 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
|
||||
Set<String> getSelfParentMaterialNo(@Param("createdBy") String createdBy ,@Param("list") Set<String> list);
|
||||
|
||||
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList ,@Param("dataType") Integer dataType);
|
||||
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList ,@Param("dataType") Integer dataType , @Param("createdBy") String createdBy);
|
||||
|
||||
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("materialNo") String materialNo,@Param("dataType") Integer dataType );
|
||||
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("bomRowIds") Collection<Long> bomRowIds , @Param("createdBy") String createdBy );
|
||||
|
||||
void updateRootState();
|
||||
|
||||
|
|
@ -73,4 +72,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
void updateRootForWaitReview();
|
||||
|
||||
void resetBomExist(Long rowId);
|
||||
|
||||
Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
|||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -58,9 +59,16 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
|||
* @param InHasConvertBomIs
|
||||
* @return
|
||||
*/
|
||||
List<BomOriginalListVO> getParentForDrawingNoSeach(@Param("drawingNos") Set<String> drawingNos, @Param("state") Integer state);
|
||||
List<BomOriginalListVO> getParentForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos ,@Param("state") Integer state);
|
||||
|
||||
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") Set<String> drawingNos, @Param("state") Integer state);
|
||||
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("bomRowIds") Collection<Long> bomRowIds);
|
||||
|
||||
/**
|
||||
* 获取父级图号
|
||||
* @param drawingNos
|
||||
* @return
|
||||
*/
|
||||
Set<String> getMaterialParent(@Param("drawingNos") Collection<String> drawingNos);
|
||||
|
||||
|
||||
void resetBomExist(Long rowId);
|
||||
|
|
|
|||
|
|
@ -124,12 +124,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return returnResult;
|
||||
}
|
||||
List<String> materialNos = new ArrayList<>();
|
||||
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
|
||||
materialNos.add(materialNo);
|
||||
// List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
|
||||
//获取父级物料
|
||||
Boolean getSelfIs=!userRoleService.technician();
|
||||
List<String> parentMaterialByMaterialNo = getParentMaterial(ImmutableList.of(materialNo),(getSelfIs && query.getDataType().equals(0) ) ).stream().collect(Collectors.toList());
|
||||
// materialNos.add(materialNo);
|
||||
materialNos.addAll(parentMaterialByMaterialNo);
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType());
|
||||
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, materialNo, query.getDataType());
|
||||
List<BomNewEbomParentVO> childs=new ArrayList<>();
|
||||
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType() ,(getSelfIs && query.getDataType().equals(0) )?SessionUtil.getUserCode():null );
|
||||
if(CollUtil.isNotEmpty(parents)) {
|
||||
childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, parents.stream().map(u -> u.getRowId()).collect(Collectors.toSet()), (getSelfIs && query.getDataType().equals(0)) ? SessionUtil.getUserCode() : null);
|
||||
}
|
||||
List<BomNewEbomParentVO> data = new ArrayList<>();
|
||||
data.addAll(parents);
|
||||
data.addAll(childs);
|
||||
|
|
@ -221,6 +227,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父级物料 (包含查询物料本身)
|
||||
*
|
||||
* @param materialNoList
|
||||
* @param bomType
|
||||
* @return
|
||||
*/
|
||||
public List<String> getParentMaterial(List<String> materialNoList, Boolean bomType) {
|
||||
Set<String> result = new HashSet<>();
|
||||
result.addAll(materialNoList);
|
||||
|
||||
Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(materialNoList, bomType ? SessionUtil.getUserCode() : null);
|
||||
|
||||
while (CollUtil.isNotEmpty(useMaterialSku)) {
|
||||
//防止数据错误(循环依赖)-死循环
|
||||
Set<String> difference = Sets.difference(useMaterialSku, result);
|
||||
if (CollUtil.isNotEmpty(difference)) {
|
||||
useMaterialSku = this.getBaseMapper().getMaterialParent(difference, bomType ? SessionUtil.getUserCode() : null);
|
||||
result.addAll(difference);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量获取物料所有父节点
|
||||
|
|
@ -267,6 +299,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
|
||||
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(result.getRecords())) {
|
||||
materialMainService.intiMaterialInfo(result.getRecords());
|
||||
}
|
||||
|
|
@ -302,12 +335,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()) ,BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
if(EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())){
|
||||
list=list.stream().filter(u->EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList());
|
||||
if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) {
|
||||
list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList());
|
||||
}
|
||||
Map<String, BomNewEbomParentEntity> bomListMap= list.parallelStream()
|
||||
Map<String, BomNewEbomParentEntity> bomListMap = list.parallelStream()
|
||||
.collect(Collectors.toMap(
|
||||
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||
Function.identity(),
|
||||
|
|
@ -377,6 +410,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
/**
|
||||
* 生成虚拟包时-获取子级
|
||||
*
|
||||
* @param rowId
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -392,7 +426,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(BomNewEbomParentEntity::getLastVersionIs, 1).list();
|
||||
|
||||
Map<String, BomNewEbomParentEntity> bomListMap= list.parallelStream()
|
||||
Map<String, BomNewEbomParentEntity> bomListMap = list.parallelStream()
|
||||
.collect(Collectors.toMap(
|
||||
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||
Function.identity(),
|
||||
|
|
@ -744,39 +778,43 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
public void generateVirtualPackage(VirtualPackageParamDto paramDto) throws IOException {
|
||||
|
||||
|
||||
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
|
||||
|
||||
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
|
||||
VUtils.isTure(Objects.isNull(root)).throwMessage("Bom不存在");
|
||||
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
|
||||
.throwMessage("异常状态下不允许生成虚拟包");
|
||||
LogRecordContext.putVariable("gvbom", root);
|
||||
//初始化虚拟包-判断枚举(不是手工生成虚拟包的情况)
|
||||
checkAndInitVirtualPackageEnum(paramDto, root);
|
||||
Boolean flag = true;
|
||||
for (Integer f : paramDto.getVirtualPackageValue()) {
|
||||
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
|
||||
VUtils.isTure(Objects.isNull(root)).throwMessage("Bom不存在");
|
||||
|
||||
//初始化虚拟包-判断枚举(不是手工生成虚拟包的情况)
|
||||
checkAndInitVirtualPackageEnum(paramDto, root);
|
||||
|
||||
VUtils.isTure(root.getVirtrualPackageEnum() > 0).throwMessage("已生成过虚拟包,不能2次生成");
|
||||
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
|
||||
.throwMessage("异常状态下不允许生成虚拟包");
|
||||
LogRecordContext.putVariable("gvbom", root);
|
||||
|
||||
// Boolean flag = true;
|
||||
// for (Integer f : paramDto.getVirtualPackageValue()) {
|
||||
// flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
|
||||
// }
|
||||
// VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成");
|
||||
|
||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, root);
|
||||
materialMainService.intiMaterialInfo(ImmutableList.of(parent), BomNewEbomParentVO::getMaterialNo);
|
||||
if (parent.getMaterialCategoryCode().startsWith("30") || ImmutableList.of("200601", "200401").contains(parent.getMaterialCategoryCode())) {
|
||||
VirtualPackageBase generate;
|
||||
if (parent.getMaterialCategoryCode().startsWith("30")) {
|
||||
generate = new VirtualPackageFor31(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
|
||||
} else {
|
||||
generate = new VirtualPackageFor21(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
|
||||
}
|
||||
VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成");
|
||||
|
||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, root);
|
||||
materialMainService.intiMaterialInfo(ImmutableList.of(parent), BomNewEbomParentVO::getMaterialNo);
|
||||
if (parent.getMaterialCategoryCode().startsWith("30") || ImmutableList.of("200601","200401").contains(parent.getMaterialCategoryCode())) {
|
||||
VirtualPackageBase generate;
|
||||
if (parent.getMaterialCategoryCode().startsWith("30")) {
|
||||
generate = new VirtualPackageFor31(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
|
||||
} else {
|
||||
generate = new VirtualPackageFor21(paramDto.getBomRowId(), paramDto.getVirtualPackageValue());
|
||||
}
|
||||
generate.generateVirtualPackage();
|
||||
|
||||
if (CollUtil.isNotEmpty(generate.getParentResult())) {
|
||||
this.saveOrUpdateBatch(generate.getParentResult());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(generate.getChildResult())) {
|
||||
ebomChildService.saveOrUpdateBatch(generate.getChildResult());
|
||||
}
|
||||
generate.generateVirtualPackage();
|
||||
|
||||
if (CollUtil.isNotEmpty(generate.getParentResult())) {
|
||||
this.saveOrUpdateBatch(generate.getParentResult());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(generate.getChildResult())) {
|
||||
ebomChildService.saveOrUpdateBatch(generate.getChildResult());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -935,11 +973,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
|
||||
public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException {
|
||||
List<BomNewEbomParentVO> result=param.getList();
|
||||
if(CollUtil.isEmpty(param.getList())){
|
||||
result=getChild(param.getBomRowId());
|
||||
List<BomNewEbomParentVO> result = param.getList();
|
||||
if (CollUtil.isEmpty(param.getList())) {
|
||||
result = getChild(param.getBomRowId());
|
||||
}
|
||||
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class,result) );
|
||||
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>(Convert.toList(EbomExcelEditVO.class, result));
|
||||
EecExcelUtil.eecExcel("bom列表", listSheet, response);
|
||||
|
||||
}
|
||||
|
|
@ -948,7 +986,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
public void exportBom(List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||
|
||||
List<BomNewEbomParentVO> child = getChildBatch(bomRowIds);
|
||||
final ListSheet<EbomExcelVO> listSheet = new ListSheet<>(Convert.toList(EbomExcelVO.class, child));
|
||||
final ListSheet<EbomExcelVO> listSheet = new ListSheet<>(Convert.toList(EbomExcelVO.class, child));
|
||||
EecExcelUtil.eecExcel("bom列表", listSheet, response);
|
||||
}
|
||||
|
||||
|
|
@ -1024,7 +1062,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
parentVO.setParentRowId(0l);
|
||||
|
||||
//原始bom强制追加
|
||||
if(ObjectUtil.equal(EBomSourceEnum.FROM_BOM.getValue(),parentVO.getSource())){
|
||||
if (ObjectUtil.equal(EBomSourceEnum.FROM_BOM.getValue(), parentVO.getSource())) {
|
||||
dto.setOpType(EBomConstant.EBomExcelImportEnum.IMPORT_TYPE_APPEND.getValue());
|
||||
}
|
||||
|
||||
|
|
@ -1042,10 +1080,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (dto.isDel()) {
|
||||
if ((parentVO.getSource().equals(EBomSourceEnum.FROM_MDM.getValue())
|
||||
|| parentVO.getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))) {
|
||||
// deleteBom(dto.getRowId());
|
||||
// deleteBom(dto.getRowId());
|
||||
//当前bom下列表数据
|
||||
QueryWrapper<BomNewEbomChildEntity > delWrapper=new QueryWrapper<>();
|
||||
delWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId,dto.getRowId());
|
||||
QueryWrapper<BomNewEbomChildEntity> delWrapper = new QueryWrapper<>();
|
||||
delWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId, dto.getRowId());
|
||||
SpringUtil.getBean(BomNewEbomChildService.class).getBaseMapper().delete(delWrapper);
|
||||
|
||||
}
|
||||
|
|
@ -1088,20 +1126,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
List<String> sameList=null;
|
||||
List<String> sameList = null;
|
||||
if (CollectionUtil.isNotEmpty(eBomEdit.childEntities)) {
|
||||
|
||||
QueryWrapper<BomNewEbomChildEntity > queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId,dto.getRowId());
|
||||
List<BomNewEbomChildEntity> oldChildList= SpringUtil.getBean(BomNewEbomChildService.class).list(queryWrapper);
|
||||
QueryWrapper<BomNewEbomChildEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(BomNewEbomChildEntity::getParentRowId, dto.getRowId());
|
||||
List<BomNewEbomChildEntity> oldChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryWrapper);
|
||||
|
||||
ebomChildService.saveOrUpdateBatch(eBomEdit.childEntities);
|
||||
|
||||
if(CollUtil.isNotEmpty(oldChildList)) {
|
||||
if (CollUtil.isNotEmpty(oldChildList)) {
|
||||
//追加里包含相同
|
||||
List<String> appendList = eBomEdit.childEntities.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList());
|
||||
List<String> oldList = oldChildList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList());
|
||||
sameList = appendList.stream()
|
||||
sameList = appendList.stream()
|
||||
.filter(oldList::contains)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
|
@ -1111,10 +1149,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
//不要异步
|
||||
computeLevelNumAndRootState();
|
||||
|
||||
if(CollUtil.isEmpty(sameList)){
|
||||
if (CollUtil.isEmpty(sameList)) {
|
||||
return ResultVO.success();
|
||||
}else{
|
||||
return ResultVO.error(StrUtil.format("导入数据存在重复物料 {}",StrUtil.join(",",sameList)));
|
||||
} else {
|
||||
return ResultVO.error(StrUtil.format("导入数据存在重复物料 {}", StrUtil.join(",", sameList)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1186,9 +1224,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* 退回设计,不用判断角色 工艺岗才能看见已复核数据
|
||||
* 1.已发布不能退
|
||||
* 2.被工艺岗位添加的物料,不可以退回。但是可以被删除(只能是当前工艺岗位的用户创建的物料)
|
||||
*
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
|
||||
|
||||
List<Long> rowIds = dto.getRowIdList();
|
||||
|
|
@ -1227,21 +1264,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
revertList.clear();
|
||||
//忽略叶子节点 和 工艺人员不退回设计 ,只退回设计复核部分
|
||||
revertList.addAll(bomTreeList.stream()
|
||||
.filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId().longValue() > 0 )
|
||||
&& !ObjectUtil.equal(UserJobEnum.ENGINEER.getValue(),u.getCreatedJob())
|
||||
&& ObjectUtil.equal(EBomStatusEnum.CHECKED.getValue(),u.getStatus())
|
||||
.filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId().longValue() > 0)
|
||||
&& !ObjectUtil.equal(UserJobEnum.ENGINEER.getValue(), u.getCreatedJob())
|
||||
&& ObjectUtil.equal(EBomStatusEnum.CHECKED.getValue(), u.getStatus())
|
||||
)
|
||||
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList()));
|
||||
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(revertList)) {
|
||||
//parent表状态
|
||||
UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.lambda()
|
||||
.set(BomNewEbomParentEntity::getRevertTime, LocalDateTime.now())
|
||||
.set(BomNewEbomParentEntity::getRevertUserName, SessionUtil.getUserName())
|
||||
.set(BomNewEbomParentEntity::getRevertDesc,dto.getRevertDesc())
|
||||
.set(BomNewEbomParentEntity::getRevertDesc, dto.getRevertDesc())
|
||||
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue())
|
||||
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
|
||||
.in(BomNewEbomParentEntity::getRowId, revertList);
|
||||
|
|
@ -1253,24 +1289,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
|
||||
.in(BomNewEbomChildEntity::getParentRowId, revertList);
|
||||
|
||||
this.update(updateWrapper );
|
||||
ebomChildService.update(childWrapper) ;
|
||||
this.update(updateWrapper);
|
||||
ebomChildService.update(childWrapper);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//更新-待复核根节点
|
||||
// getBaseMapper().updateRootForWaitReview();
|
||||
// getBaseMapper().updateRootForWaitReview();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设计复核
|
||||
*设计人员只可以复核自己的物料,如果存在引用其他用户创建的物料时,不可以改变被引用物料的审核状态。
|
||||
* 设计人员只可以复核自己的物料,如果存在引用其他用户创建的物料时,不可以改变被引用物料的审核状态。
|
||||
* 异常检查:
|
||||
* 1. 是否存在空物料编号、空数量的数据信息;
|
||||
* 2. 是否存在在主数据平台的物料信息没有的数据;
|
||||
|
|
@ -1279,7 +1313,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* 5. 项目类别是否填写正确(项目类别请参照“项目类别自动赋值”规则);
|
||||
* 6. 是否存在“已冻结/永久禁用”的物料;
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean designReview(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
|
||||
|
||||
List<Long> rowIds = dto.getRowIdList();
|
||||
|
|
@ -1292,11 +1326,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
//检查顶级bom是否是设计自己
|
||||
List<BomNewEbomParentEntity> checkList=bomNewEbomParentEntityList.stream().filter(u->!u.getCreatedBy().equals(SessionUtil.getUserCode())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(checkList)) {
|
||||
String checkListMaterialNo=StrUtil.join(",",checkList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
VUtils.isTure(true).throwMessage(StrUtil.format("{} 该节点不属于你,你无权复核",checkListMaterialNo));
|
||||
}
|
||||
List<BomNewEbomParentEntity> checkList = bomNewEbomParentEntityList.stream().filter(u -> !u.getCreatedBy().equals(SessionUtil.getUserCode())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(checkList)) {
|
||||
String checkListMaterialNo = StrUtil.join(",", checkList.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
VUtils.isTure(true).throwMessage(StrUtil.format("{} 该节点不属于你,你无权复核", checkListMaterialNo));
|
||||
}
|
||||
|
||||
|
||||
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
|
||||
|
|
@ -1346,8 +1380,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
.set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
|
||||
.set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.CHECKED.getValue())
|
||||
.set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
|
||||
.set(BomNewEbomParentEntity::getRootIsForWaitReview,0)
|
||||
.set(BomNewEbomParentEntity::getRevertDesc,"")
|
||||
.set(BomNewEbomParentEntity::getRootIsForWaitReview, 0)
|
||||
.set(BomNewEbomParentEntity::getRevertDesc, "")
|
||||
|
||||
.in(BomNewEbomParentEntity::getRowId, updateReviewIdList);
|
||||
|
||||
|
|
@ -1376,13 +1410,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
|
||||
|
||||
|
||||
|
||||
List<Long> rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList());
|
||||
List<Long> bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
|
||||
// if (CollectionUtil.isNotEmpty(bomRowIdList)) {
|
||||
// UpdateWrapper<BomNewEbomParentEntity> parentUpdate = new UpdateWrapper<>();
|
||||
// parentUpdate.lambda()
|
||||
|
|
@ -1478,7 +1509,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
BomNewEbomChildEntity childEntity = null;
|
||||
|
||||
|
||||
|
|
@ -1493,18 +1523,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
if (childEntity != null) {
|
||||
|
||||
//编辑查询物料id未变化
|
||||
//编辑查询物料id未变化
|
||||
if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo()) || childEntity.getDrawingNo().equals(materialMainEntity.getDrawingNo())) {
|
||||
BeanUtil.copyProperties(childEntity, baseMaterialVO);
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO),EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
return baseMaterialVO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//编辑数据 新增或物料编码已变化
|
||||
BomNewEbomParentEntity bomParent = null;
|
||||
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
|
||||
|
|
@ -1513,7 +1540,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO));
|
||||
|
||||
//继承bom的状态
|
||||
//继承bom的状态
|
||||
if (bomParent != null) {
|
||||
baseMaterialVO.setEditStatus(bomParent.getEditStatus());
|
||||
baseMaterialVO.setStatus(bomParent.getStatus());
|
||||
|
|
@ -1536,12 +1563,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) {
|
||||
baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight()));
|
||||
}
|
||||
if(ObjectUtil.isNull(baseMaterialVO.getNum())){
|
||||
if (ObjectUtil.isNull(baseMaterialVO.getNum())) {
|
||||
baseMaterialVO.setNum(new BigDecimal(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo())
|
||||
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState())
|
||||
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) {
|
||||
|
|
@ -1577,9 +1603,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
QueryWrapper<BomNewEbomParentEntity> queryWrapper=new QueryWrapper<>();
|
||||
QueryWrapper<BomNewEbomParentEntity> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
queryWrapper.lambda() .eq(BomNewEbomParentEntity::getRowId, bomRowId)
|
||||
queryWrapper.lambda().eq(BomNewEbomParentEntity::getRowId, bomRowId)
|
||||
.eq(BomNewEbomParentEntity::getUserRootIs, 1);
|
||||
|
||||
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectOne(queryWrapper);
|
||||
|
|
@ -1605,19 +1631,19 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
|
||||
//取bom信息删除
|
||||
List<Long> parentList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0))
|
||||
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList());
|
||||
List<Long> childList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNull(u.getBomRowId()) || u.getBomRowId().longValue()==0l))
|
||||
List<Long> parentList = eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0))
|
||||
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList());
|
||||
List<Long> childList = eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNull(u.getBomRowId()) || u.getBomRowId().longValue() == 0l))
|
||||
.map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
|
||||
if(CollUtil.isNotEmpty(parentList)) {
|
||||
if (CollUtil.isNotEmpty(parentList)) {
|
||||
this.getBaseMapper().delBatch(parentList);
|
||||
}
|
||||
|
||||
// QueryWrapper<BomNewEbomParentEntity> parentWrapper=new QueryWrapper<>();
|
||||
// parentWrapper.lambda().in(BomNewEbomParentEntity::getRowId,parentList);
|
||||
//
|
||||
if(CollUtil.isNotEmpty(childList)) {
|
||||
if (CollUtil.isNotEmpty(childList)) {
|
||||
QueryWrapper<BomNewEbomChildEntity> childWrapper = new QueryWrapper<>();
|
||||
childWrapper.lambda().in(BomNewEbomChildEntity::getRowId, childList);
|
||||
//
|
||||
|
|
@ -1626,7 +1652,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
VUtils.isTure(true).throwMessage("该bom下没有你删除的数据");
|
||||
}
|
||||
|
||||
|
|
@ -1638,11 +1664,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
|
||||
|
||||
//ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
||||
computeLevelNumAndRootState();
|
||||
computeLevelNumAndRootState();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1678,11 +1703,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
void checkUserRoleAuth(String bomCreatedBy){
|
||||
void checkUserRoleAuth(String bomCreatedBy) {
|
||||
//1.设计岗操作自己数据
|
||||
//2.工艺人员可以修改自己创建的或是已通过“设计复核”的数据,工艺岗能看见设计岗数据必定是已复核或双角色岗(设计+工艺)
|
||||
if(!SpringUtil.getBean(UserRoleService.class).technician()){
|
||||
if(!bomCreatedBy.equals(SessionUtil.getUserCode())){
|
||||
if (!SpringUtil.getBean(UserRoleService.class).technician()) {
|
||||
if (!bomCreatedBy.equals(SessionUtil.getUserCode())) {
|
||||
VUtils.isTure(true).throwMessage("该节点不属于你,你无权操作");
|
||||
}
|
||||
}
|
||||
|
|
@ -1690,9 +1715,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 暂存
|
||||
* <p>
|
||||
|
|
@ -1706,7 +1728,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
checkUserRoleAuth(dto.getParent().getCreatedBy());
|
||||
|
||||
|
||||
|
||||
//暂存数据为空后面不处理
|
||||
if (CollUtil.isEmpty(dto.getDatas())) {
|
||||
return dto.getParent();
|
||||
|
|
@ -1718,11 +1739,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
eBomEdit.handleBom(dto);
|
||||
|
||||
|
||||
|
||||
|
||||
if (eBomEdit.getParentEntity() != null) {
|
||||
|
||||
eBomEdit.nextVersion();
|
||||
eBomEdit.nextVersion();
|
||||
|
||||
this.saveOrUpdate(eBomEdit.getParentEntity());
|
||||
}
|
||||
|
|
@ -1744,8 +1763,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity());
|
||||
retParentVO.setBomRowId(retParentVO.getRowId());
|
||||
|
||||
|
|
@ -1762,7 +1779,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
checkUserRoleAuth(dto.getParent().getCreatedBy());
|
||||
|
||||
|
||||
|
||||
//无提交数据后面不处理
|
||||
if (CollUtil.isEmpty(dto.getDatas())) {
|
||||
return true;
|
||||
|
|
@ -1820,18 +1836,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
/**
|
||||
* 1. 编辑页面的删除只是删除BOM的关联关系;
|
||||
* 2. 删除规则:
|
||||
* 从原始Bom导入的数据,数据没有异常的情况下,用户不可以删除;
|
||||
* 用户可以直接删除,用户单击暂存或是提交时才会保存至数据库。
|
||||
* 从原始Bom导入的数据,数据没有异常的情况下,用户不可以删除;
|
||||
* 用户可以直接删除,用户单击暂存或是提交时才会保存至数据库。
|
||||
*/
|
||||
public void deleteBomChild(List<BomNewEbomParentVO> delList) {
|
||||
if(CollUtil.isEmpty(delList)){
|
||||
if (CollUtil.isEmpty(delList)) {
|
||||
return;
|
||||
}
|
||||
List<Long> rowIds=delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper=new QueryWrapper<>();
|
||||
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId,rowIds);
|
||||
List<Long> rowIds = delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper = new QueryWrapper<>();
|
||||
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId, rowIds);
|
||||
|
||||
List<BomNewEbomChildEntity> delChildList=SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);
|
||||
List<BomNewEbomChildEntity> delChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper);
|
||||
|
||||
List<BomNewEbomChildEntity> delTagList = new ArrayList<>();
|
||||
|
||||
|
|
@ -1840,7 +1856,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
&& Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isNotEmpty(check1List)) {
|
||||
throw new NflgBusinessException(STATE.Error,StrUtil.format("从原始Bom导入的数据,数据没有异常的情况下,{} 不可以删除 ",StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()) )));
|
||||
throw new NflgBusinessException(STATE.Error, StrUtil.format("从原始Bom导入的数据,数据没有异常的情况下,{} 不可以删除 ", StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
|
||||
}
|
||||
|
||||
//检查有bom数据关系是否可以删?
|
||||
|
|
@ -1852,7 +1868,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
// }
|
||||
|
||||
|
||||
|
||||
//原始bom不正常
|
||||
List<BomNewEbomChildEntity> s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
||||
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());
|
||||
|
|
@ -1868,16 +1883,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
// 设计自己删除自己
|
||||
//工艺岗用户1 可以删工艺岗用户2 的数据?
|
||||
if (CollectionUtil.isNotEmpty(s2List)) {
|
||||
for (BomNewEbomChildEntity vo:
|
||||
s2List) {
|
||||
if( userRoleService.technician() ){ //工艺岗可删
|
||||
delTagList.add(vo);
|
||||
}else if ( userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())){ //自己的数据可删
|
||||
delTagList.add(vo);
|
||||
}else{
|
||||
throw new NflgBusinessException(STATE.Error,StrUtil.format("{}数据不是你的,无权删除",vo.getMaterialNo()));
|
||||
for (BomNewEbomChildEntity vo :
|
||||
s2List) {
|
||||
if (userRoleService.technician()) { //工艺岗可删
|
||||
delTagList.add(vo);
|
||||
} else if (userRoleService.designer() && vo.getCreatedBy().equals(SessionUtil.getUserCode())) { //自己的数据可删
|
||||
delTagList.add(vo);
|
||||
} else {
|
||||
throw new NflgBusinessException(STATE.Error, StrUtil.format("{}数据不是你的,无权删除", vo.getMaterialNo()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1892,7 +1907,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
/**
|
||||
* 变更物料
|
||||
* 全量更新目前编辑页面的物料信息,可以理解为同步主数据的物料信息到此处,更新物料的状态,并根据物料的状态更新异常情况。
|
||||
* 全量更新目前编辑页面的物料信息,可以理解为同步主数据的物料信息到此处,更新物料的状态,并根据物料的状态更新异常情况。
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,30 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取父级图号(包含查询的图号)
|
||||
* @param drawingNos
|
||||
* @return
|
||||
*/
|
||||
public List<String> getParentMaterialByDrawingNo(List<String> drawingNos) {
|
||||
Set<String> result = new HashSet<>();
|
||||
result.addAll(drawingNos);
|
||||
|
||||
Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(drawingNos);
|
||||
|
||||
while (CollUtil.isNotEmpty(useMaterialSku)) {
|
||||
//防止数据错误(循环依赖)-死循环
|
||||
Set<String> difference = Sets.difference(useMaterialSku, result);
|
||||
if (CollUtil.isNotEmpty(difference)) {
|
||||
useMaterialSku = this.getBaseMapper().getMaterialParent(difference);
|
||||
result.addAll(difference);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(result);
|
||||
}
|
||||
|
||||
private Page<BomOriginalListVO> handSeachToTree(List<BomOriginalListVO> parents, List<BomOriginalListVO> childs) {
|
||||
Page<BomOriginalListVO> resutlData = new Page<>();
|
||||
Set<String> parentSet = parents.stream().map(u -> u.getDrawingNo()).collect(Collectors.toSet());
|
||||
|
|
@ -157,10 +181,34 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(queryDrawingNos)) {
|
||||
// List<BomNewOriginalParentEntity> materialBoms = this.lambdaQuery().in(BomNewOriginalParentEntity::getDrawingNo, queryDrawingNos).eq(BomNewOriginalParentEntity::getLastVersionIs, 1)
|
||||
// .eq(BomNewOriginalParentEntity::getStatus, OriginalStatusEnum.UN_CONVERT.getValue()).list();
|
||||
// if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
|
||||
// return result;
|
||||
// }
|
||||
List<String> parentDrawingNos = new ArrayList<>(getParentMaterialByDrawingNo(queryDrawingNos));
|
||||
// parentDrawingNos.addAll(queryDrawingNos);
|
||||
Set<String> parentDrawingNos = new HashSet<>(getParentDrawingNoByMaterialNo(queryDrawingNos));
|
||||
parentDrawingNos.addAll(queryDrawingNos);
|
||||
if (CollUtil.isNotEmpty(parentDrawingNos)) {
|
||||
List<BomOriginalListVO> childs=new ArrayList<>();
|
||||
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
|
||||
materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
if(CollUtil.isNotEmpty(parents)) {
|
||||
childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos, parents.stream().map(u -> u.getRowId()).collect(Collectors.toSet()));
|
||||
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> {
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) {
|
||||
f.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
} else {
|
||||
f.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||
}
|
||||
});
|
||||
}
|
||||
// List<BomOriginalListVO> data = new ArrayList<>();
|
||||
// data.addAll(parents);
|
||||
// data.addAll(childs);
|
||||
// materialMainService.intiMaterialInfo(data, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,query.getStatus());
|
||||
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
|
|
|
|||
|
|
@ -170,10 +170,12 @@ public class EBomToPBom {
|
|||
pBomParent.setFacCode(facCode);
|
||||
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
|
||||
pBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||
//pBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||
//版本=EBom版本
|
||||
pBomParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
if(Objects.nonNull(oldParent)){
|
||||
pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
// pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||
oldParent.setLastVersionIs(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
|
||||
BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent );
|
||||
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()&VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!= VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
|
||||
generateVMNoF21(parent.getDrawingNo(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
}
|
||||
else {
|
||||
|
|
@ -58,7 +58,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
}
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()& VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
|
||||
//构建构建发货前装配包
|
||||
if(Objects.isNull(makingPackage)){
|
||||
makingPackage=getParentZhiZuo(parent.getDrawingNo());
|
||||
|
|
|
|||
|
|
@ -98,45 +98,98 @@
|
|||
|
||||
<!--物料编码搜索-父级-->
|
||||
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
SELECT if(status=4 and #{dataType}!=1, 99,status) status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
|
||||
FROM t_bom_new_ebom_parent a where a.last_version_is=1
|
||||
<!-- <if test="dataType!=1 and !hasParentIs" >-->
|
||||
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
|
||||
FROM t_bom_new_ebom_parent a
|
||||
join (select material_no,max(current_version) current_version from t_bom_new_ebom_parent where
|
||||
<if test="dataType==1" >
|
||||
status = 4
|
||||
</if>
|
||||
<if test="dataType==0" >
|
||||
status < 4
|
||||
<if test="createdBy!=null and createdBy!=''">
|
||||
and created_by=#{createdBy}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
and material_no in
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
group by material_no ) b on a.material_no=b.material_no and a.current_version=b.current_version
|
||||
|
||||
</select>
|
||||
|
||||
<!-- <!–物料编码搜索-父级–>-->
|
||||
<!-- <select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
|
||||
<!-- SELECT if(status=4 and #{dataType}!=1, 99,status) status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*-->
|
||||
<!-- FROM t_bom_new_ebom_parent a where a.last_version_is=1-->
|
||||
<!--<!– <if test="dataType!=1 and !hasParentIs" >–>-->
|
||||
<!--<!– and a.status < 4–>-->
|
||||
<!--<!– </if>–>-->
|
||||
<!-- <if test="dataType==1">-->
|
||||
<!-- and a.status = 4-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- and material_no in-->
|
||||
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </select>-->
|
||||
<!--物料编码搜索-子级-->
|
||||
<!-- <select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
|
||||
<!-- select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy-->
|
||||
<!-- ,c.devise_name,c.devise_user_code,c.dept_name ,-->
|
||||
<!-- c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*-->
|
||||
<!-- from t_bom_new_ebom_parent a-->
|
||||
<!-- join t_bom_new_ebom_child b on a.row_id =b.parent_row_id-->
|
||||
<!-- left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1-->
|
||||
<!-- where a.last_version_is=1-->
|
||||
<!-- <if test="dataType!=1">-->
|
||||
<!-- and a.status < 4-->
|
||||
<!-- </if>-->
|
||||
<if test="dataType==1">
|
||||
and a.status = 4
|
||||
</if>
|
||||
<!-- <if test="dataType==1">-->
|
||||
<!-- and a.status = 4-->
|
||||
<!-- </if>-->
|
||||
<!-- and ( b.material_no in-->
|
||||
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- or b.material_no=#{materialNo})-->
|
||||
<!-- </select>-->
|
||||
|
||||
and material_no in
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<!--物料编码搜索-子级-->
|
||||
<select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy
|
||||
,c.devise_name,c.devise_user_code,c.dept_name ,
|
||||
c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*
|
||||
from t_bom_new_ebom_parent a
|
||||
join t_bom_new_ebom_child b on a.row_id =b.parent_row_id
|
||||
left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1
|
||||
where a.last_version_is=1
|
||||
<if test="dataType!=1">
|
||||
and a.status < 4
|
||||
</if>
|
||||
<if test="dataType==1">
|
||||
and a.status = 4
|
||||
</if>
|
||||
and ( b.material_no in
|
||||
select a.status ,a.current_version , a.created_by as bomCreatedBy,
|
||||
a.devise_name ,a.devise_user_code
|
||||
,a.dept_name,a.source,ifnull( a.row_id,0) as bomRowId
|
||||
,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_ebom_child b
|
||||
left join t_bom_new_ebom_parent a on a.material_no=b.material_no and a.row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
where b.parent_row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and b.material_no in
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
or b.material_no=#{materialNo})
|
||||
<if test="createdBy!=null and createdBy!=''">
|
||||
and b.created_by=#{createdBy}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!--BOM-正式工作表-->
|
||||
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
select * , row_id as bomRowId from t_bom_new_ebom_parent where status=4
|
||||
select * , row_id as bomRowId from t_bom_new_ebom_parent a
|
||||
join (select material_no, max(current_version) current_version from t_bom_new_ebom_parent
|
||||
where status=4 <include refid="whr"/>
|
||||
group by material_no) b on a.material_no=b.material_no and a.current_version=b.current_version
|
||||
where a.status=4
|
||||
<include refid="whr"/>
|
||||
</select>
|
||||
|
||||
|
|
@ -222,8 +275,9 @@
|
|||
</update>
|
||||
<!--更新-待复核根节点-->
|
||||
<update id="updateRootForWaitReview">
|
||||
update t_bom_new_ebom_parent set root_is_for_wait_review=0 ;
|
||||
update t_bom_new_ebom_parent a left join (
|
||||
select b.row_id, b.material_no,a.`status` from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status` =2
|
||||
select b.row_id, b.material_no,a.`status` from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status` in(1,3) and last_version_is=1
|
||||
) b on a.material_no=b.material_no
|
||||
set a.root_is_for_wait_review=1
|
||||
where a.`status` in (1,3) and last_version_is=1 and b.row_id is null ;
|
||||
|
|
@ -283,6 +337,18 @@
|
|||
select COUNT(1) from t_bom_new_ebom_child where material_no=#{materialNo} and edit_status=1
|
||||
</select>
|
||||
|
||||
<select id="getMaterialParent" resultType="java.lang.String">
|
||||
select a.material_no from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
|
||||
where a.last_version_is=1
|
||||
<if test="createdBy!=null and createdBy!=''">
|
||||
and a.created_by=#{createdBy}
|
||||
</if>
|
||||
and b.material_no in
|
||||
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="resetBomExist">
|
||||
UPDATE t_bom_new_ebom_parent p
|
||||
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
|
||||
|
|
|
|||
|
|
@ -192,30 +192,62 @@
|
|||
|
||||
<!--物料编码搜索-父级-->
|
||||
<select id="getParentForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
|
||||
SELECT status,row_id as bomRowId, row_id as childBomRowId, a.*
|
||||
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
|
||||
FROM t_bom_new_original_parent a
|
||||
where status=#{state}
|
||||
join (select drawing_no,max(current_version) current_version from t_bom_new_original_parent where status=#{state}
|
||||
and drawing_no in
|
||||
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by row_id desc
|
||||
group by drawing_no ) b on a.drawing_no=b.drawing_no and a.current_version=b.current_version
|
||||
order by created_time desc
|
||||
</select>
|
||||
<!--物料编码搜索-子级-->
|
||||
<select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
|
||||
select IFNULL(IF(a.`status`=1 and c.`status`!=1,3,c.`status`),a.`status`) `status`,c.current_version
|
||||
,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code
|
||||
,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId
|
||||
,IFNULL(c.row_id,"0") as childBomRowId, b.*
|
||||
from t_bom_new_original_parent a
|
||||
join t_bom_new_original_child b on a.row_id =b.parent_row_id
|
||||
left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no
|
||||
where b.`status` = #{state} and b.drawing_no in
|
||||
select a.status ,a.current_version , a.created_by as bomCreatedBy,
|
||||
a.devise_name ,a.devise_user_code
|
||||
,a.dept_name,a.source,ifnull( a.row_id,0) as bomRowId
|
||||
,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_original_child b
|
||||
left join t_bom_new_original_parent a on a.drawing_no=b.drawing_no and a.row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
where b.parent_row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and b.drawing_no in
|
||||
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- <!–物料编码搜索-子级–>-->
|
||||
<!-- <select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">-->
|
||||
<!-- select c.status ,c.current_version , c.created_by as bomCreatedBy-->
|
||||
<!-- ,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code-->
|
||||
<!-- ,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId-->
|
||||
<!-- ,IFNULL(c.row_id,"0") as childBomRowId, b.*-->
|
||||
<!-- from t_bom_new_original_parent a-->
|
||||
<!-- join t_bom_new_original_child b on a.row_id =b.parent_row_id-->
|
||||
<!-- left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no and c.last_version_is=1-->
|
||||
<!-- where a.last_version_is=1 and b.drawing_no in-->
|
||||
<!-- <foreach collection="drawingNos" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item}-->
|
||||
<!-- </foreach>-->
|
||||
|
||||
<!-- </select>-->
|
||||
|
||||
<!--获取父级图号-->
|
||||
<select id="getMaterialParent" resultType="java.lang.String">
|
||||
select a.drawing_no from t_bom_new_original_parent a join t_bom_new_original_child b on a.row_id=b.parent_row_id
|
||||
where a.last_version_is=1
|
||||
and b.drawing_no in
|
||||
<foreach collection="drawingNos" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="resetBomExist">
|
||||
UPDATE t_bom_new_original_parent p
|
||||
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_original_child WHERE parent_row_id = p.row_id), 1, 0))
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package nflg.product.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
//import org.omg.CORBA.PRIVATE_MEMBER;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -11,6 +12,7 @@ import java.util.List;
|
|||
* @Date 2022/7/14 10:38
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LoginUserInfoDTO {
|
||||
|
||||
private Long rowId;
|
||||
|
|
|
|||
Loading…
Reference in New Issue