项目类型

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

View File

@ -60,6 +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.setSourceRowId(ebomParentEntity.getSourceRowId());
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion()); detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
} }
} }