项目类型

This commit is contained in:
jing's 2023-12-26 23:32:20 +08:00
parent 45df2e2b14
commit 5f8dcf5907
3 changed files with 61 additions and 58 deletions

View File

@ -1,11 +1,9 @@
package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.bomnew.constant.EBomSourceEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ -13,10 +11,16 @@ import java.util.List;
public class BomNewEbomProjectTypeDTO {
@ApiModelProperty("行rowId")
private List<Long> rowIdList;
private List<BomNewEbomChangeProjectType> rowIdList;
@ApiModelProperty("项目类型")
private String projectType;
@Data
public static class BomNewEbomChangeProjectType{
@ApiModelProperty("行rowId")
private Long rowId;
@ApiModelProperty("bomRowId")
private Long bomRowId;
}
}

View File

@ -14,6 +14,8 @@ import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -116,16 +118,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(parentMaterialByMaterialNo);
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(parentMaterialByMaterialNo, materialNo);
List<BomNewEbomParentVO> data=new ArrayList<>();
List<BomNewEbomParentVO> data = new ArrayList<>();
data.addAll(parents);
data.addAll(childs);
materialMainService.intiMaterialInfo(data , "material","materialTexture","projectType");
materialMainService.intiMaterialInfo(data, "material", "materialTexture", "projectType");
returnResult = handSeachToTree(parents, childs);
}
}
} else {
Page<BomNewEbomParentVO> result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode());
materialMainService.intiMaterialInfo(result.getRecords() , "material","materialTexture","projectType");
materialMainService.intiMaterialInfo(result.getRecords(), "material", "materialTexture", "projectType");
returnResult = result;
}
return returnResult;
@ -230,7 +232,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId);
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
//排除项目类别的赋值
materialMainService.intiMaterialInfo(parentChild , "material","materialTexture","projectType");
materialMainService.intiMaterialInfo(parentChild, "material", "materialTexture", "projectType");
if (CollUtil.isNotEmpty(parentChild)) {
List<String> materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
@ -251,7 +253,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName());
child.setSource(parentEntity.getSource());
child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist());
@ -282,11 +284,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public List<BomNewEbomParentVO> getChildBatch(List<Long> rowIds) {
List<BomNewEbomParentVO> result = new ArrayList<>();
for (Long bomRowId : rowIds) {
@ -296,12 +293,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 获取整个BOM树
*
@ -620,8 +611,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
@Transactional(rollbackFor = Exception.class)
public void createBomImport(BomNewEbomImportDTO dto, InputStream inputStream) throws IOException, ExecutionException, InterruptedException {
if(dto.getParent()==null){
VUtils.isTure(true).throwMessage( "没选择父级不能导入");
if (dto.getParent() == null) {
VUtils.isTure(true).throwMessage("没选择父级不能导入");
}
List<BomNewEBomImportExcelDTO> result = EecExcelUtil.getExcelContext(inputStream, BomNewEBomImportExcelDTO.class);
@ -637,7 +628,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
materialMainService.intiMaterialInfo(datas, BomNewEbomParentVO::getMaterialNo);
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_EXCE.getValue());
BomNewEBomParentEditDTO bomNewEBomParentEditDTO = new BomNewEBomParentEditDTO();
@ -646,8 +636,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
eBomEdit.temporary(bomNewEBomParentEditDTO);
if(dto.getParent().getBomRowId()>0 && (dto.getParent().getSource().equals(EBomSourceEnum.FROM_MDM.getValue())
|| dto.getParent().getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))){
if (dto.getParent().getBomRowId() > 0 && (dto.getParent().getSource().equals(EBomSourceEnum.FROM_MDM.getValue())
|| dto.getParent().getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))) {
deleteBom(dto.getParent().getBomRowId());
@ -662,7 +652,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
}
@ -852,7 +842,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
for (Long bomRowId :
rowIds) {
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()) );
System.out.println(JSON.toJSONString(checkEBomException.getAllBomDetail()));
checkEBomException.initException();
//错误状态包含在checkStatus内有异常抛出
checkEBomException.checkContainExcept(checkStatus);
@ -890,18 +880,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
List<BomNewEbomChildEntity> childEntity = new ArrayList<>();
dto.getRowIdList().forEach(rowid -> {
BomNewEbomChildEntity entity = new BomNewEbomChildEntity();
entity.setRowId(rowid);
entity.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
entity.setProjectType(dto.getProjectType());
entity.setModifyTime(LocalDateTime.now());
});
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()
.set(BomNewEbomParentEntity::getProjectType, dto.getProjectType())
.set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomParentEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue())
.in(BomNewEbomParentEntity::getRowId, bomRowIdList);
this.update(parentUpdate);
}
if (CollectionUtil.isNotEmpty(rowIdList)) {
UpdateWrapper<BomNewEbomChildEntity> childUpdate = new UpdateWrapper<>();
childUpdate.lambda()
.set(BomNewEbomChildEntity::getProjectType, dto.getProjectType())
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue())
.in(BomNewEbomChildEntity::getRowId, rowIdList);
SpringUtil.getBean(BomNewEbomChildService.class).update(childUpdate);
}
SpringUtil.getBean(BomNewEbomChildService.class).updateBatchById(childEntity);
return true;
}
public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
@ -910,7 +914,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
parentVO.setBomRowId(parentVO.getRowId());
parentVO.setParentRowId(0l);
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
// List<BomNewEbomParentVO> parentList = new ArrayList<>();
@ -987,24 +991,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
VUtils.isTure(!parentEntity.getCreatedBy().equals(SessionUtil.getUserCode())).throwMessage("该节点不属于你,你无权删除");
}
EBomDel eBomDel=new EBomDel(bomRowId);
EBomDel eBomDel = new EBomDel(bomRowId);
eBomDel.classifyBom();
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
this.getBaseMapper().delBatch(eBomDel.getDelEBom().stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()));
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
this.getBaseMapper().delBatch(eBomDel.getDelEBom().stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()));
}
//恢复原始bom状态
if (CollectionUtil.isNotEmpty(eBomDel.getRevertOBom())) {
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
}
@ -1037,7 +1039,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
deleteBomChild(dto.getDelDatas());
}
}
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
return true;
@ -1051,7 +1053,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean submit(BomNewEBomParentEditDTO dto) throws ExecutionException, InterruptedException {
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
dto.setOpType(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
eBomEdit.submit(dto);
List<Integer> checkStatus = CollectionUtil.toList(new Integer[]{
@ -1107,7 +1109,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
*/
private void deleteBomChild(List<BomNewEbomParentVO> delList) {
if(CollectionUtil.isEmpty(delList)){
if (CollectionUtil.isEmpty(delList)) {
return;
}
List<BomNewEbomParentVO> delTagList = new ArrayList<>();
@ -1131,7 +1133,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(rowIdList)) {
ebomChildService.removeByIds(rowIdList);
}
}
@ -1142,23 +1143,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 变更物料
*/
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto){
public List<BomNewEbomParentVO> changeMaterial(BomNewEBomChangeDTO dto) {
List<BomNewEbomParentVO> parentChild=dto.getDatas();
List<BomNewEbomParentVO> parentChild = dto.getDatas();
materialMainService.intiMaterialInfo(parentChild );
materialMainService.intiMaterialInfo(parentChild);
List<BomNewEbomParentVO> checkBom=new ArrayList<>();
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
checkBom.add(dto.getParent());
checkBom.addAll(dto.getDatas());
CheckEBomException checkEBomException=new CheckEBomException(checkBom);
CheckEBomException checkEBomException = new CheckEBomException(checkBom);
checkEBomException.checkException();
return dto.getDatas();
}
}

View File

@ -60,6 +60,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
detailVO.setChildBomRowId(ebomParentEntity.getRowId());
detailVO.setBomRowId(ebomParentEntity.getRowId());
detailVO.setSourceRowId(ebomParentEntity.getSourceRowId());
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
}
}