fix: 一些细节优化
1.删除接口和保存数据接口重新计算是否有bom; 2.getChild接口currentVersion和bomRowId逻辑调整
This commit is contained in:
parent
743191a5be
commit
ee8ee6b486
|
|
@ -4,8 +4,10 @@ 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.query.OriginalBomQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
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 org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -69,4 +71,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
Integer getCountForWaitReviewByMaterialNo(@Param("materialNo") String materialNo);
|
||||
|
||||
void updateRootForWaitReview();
|
||||
|
||||
void resetBomExist(Long rowId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
|||
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("state") Integer state);
|
||||
|
||||
|
||||
|
||||
void resetBomExist(Long rowId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,4 +51,6 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
Integer checkIsUserRoot(@Param("materialNo") String materialNo, @Param("jobNo") String jobNo);
|
||||
|
||||
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
|
||||
|
||||
void resetBomExist(Long rowId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,14 +318,19 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (bomListMap.containsKey(child.getMaterialNo())) {
|
||||
BomNewEbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
|
||||
|
||||
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
if (parentEntity.getShouldBomExist() == 1 && parentEntity.getBomExist() == 0) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
} else {
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
}
|
||||
child.setStatus(parentEntity.getStatus());
|
||||
child.setDeviseName(parentEntity.getDeviseName());
|
||||
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
|
||||
|
||||
child.setCreatedTime(parentEntity.getCreatedTime());
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
if (parentEntity.getBomExist() == 1) {
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
}
|
||||
child.setLevelNum(parentEntity.getLevelNum());
|
||||
child.setDeptName(parentEntity.getDeptName());
|
||||
// child.setSource(parentEntity.getSource());
|
||||
|
|
@ -357,11 +362,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
child.setSuperMaterialStatus(parent.getSuperMaterialStatus());
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
child.setStatus(parent.getStatus());
|
||||
// child.setEditStatus(OriginalEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
} else {
|
||||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1726,7 +1729,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (eBomEdit.isRootForWaitReview()) {
|
||||
this.getBaseMapper().updateRootForWaitReview();
|
||||
}
|
||||
|
||||
resetBomExist(dto.getParent().getRowId());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
@ -1941,5 +1944,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
LogRecordContext.putVariable("bom", ent);
|
||||
}
|
||||
|
||||
|
||||
private void resetBomExist(Long rowId) {
|
||||
this.getBaseMapper().resetBomExist(rowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,18 +206,19 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
List<BomOriginalListVO> saveEnts = bom.getBomList().stream().filter(u -> u.getDelIs().equals(0)).collect(Collectors.toList());
|
||||
List<BomNewOriginalChildEntity> childEntities = Convert.toList(BomNewOriginalChildEntity.class, saveEnts);
|
||||
// originalChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id",bom.getParentRowId()));
|
||||
childEntities.forEach(u -> {
|
||||
u.setParentRowId(bom.getParentRowId());
|
||||
if (submitIs) {
|
||||
u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
if (CollUtil.isNotEmpty(childEntities)) {
|
||||
childEntities.forEach(u -> {
|
||||
u.setParentRowId(bom.getParentRowId());
|
||||
if (submitIs) {
|
||||
u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||
}
|
||||
});
|
||||
//删除行
|
||||
List<Long> delRowIds = bom.getBomList().stream().map(BomOriginalListVO::getRowId).filter(rowId -> rowId > 0).collect(Collectors.toList());
|
||||
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
|
||||
originalChildService.saveOrUpdateBatch(childEntities);
|
||||
resetBomExist(bom.getParentRowId());
|
||||
}
|
||||
return true;
|
||||
|
||||
|
|
@ -268,13 +269,19 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
for (BomOriginalListVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getDrawingNo())) {
|
||||
BomNewOriginalParentEntity parentEntity = bomListMap.get(child.getDrawingNo());
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
if (parentEntity.getShouldBomExist() == 1 && parentEntity.getBomExist() == 0) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
} else {
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
}
|
||||
child.setStatus(parentEntity.getStatus());
|
||||
child.setDeviseName(parentEntity.getDeviseName());
|
||||
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
|
||||
// child.setCreatedBy(parentEntity.getCreatedBy());
|
||||
// child.setCreatedTime(parentEntity.getCreatedTime());
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
if (parentEntity.getBomExist() == 1) {
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
}
|
||||
child.setLevelNum(parentEntity.getLevelNum());
|
||||
child.setDeptName(parentEntity.getDeptName());
|
||||
child.setSource(parentEntity.getSource());
|
||||
|
|
@ -298,17 +305,11 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
child.setBomRowId(0L);
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
//child.setStatus(OriginalStatusEnum.UN_CONVERT.getValue());
|
||||
// child.setEditStatus(OriginalEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
} else {
|
||||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -356,11 +357,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
BomNewOriginalParentEntity parentEntity = this.getBaseMapper().selectById(rowId);
|
||||
OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail);
|
||||
ForkJoinTask<List<BomOriginalListVO>> submit = bomDetailPool.submit(detailTask);
|
||||
|
||||
List<BomOriginalListVO> result = submit.get();
|
||||
|
||||
return result;
|
||||
|
||||
return submit.get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -724,5 +721,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
excelContextTL.remove();
|
||||
}
|
||||
|
||||
|
||||
private void resetBomExist(Long rowId) {
|
||||
this.getBaseMapper().resetBomExist(rowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getChild(Long rowId) {
|
||||
VUtils.isTure(rowId == 0).throwMessage("参数不正确");
|
||||
return getChild(this.getById(rowId));
|
||||
}
|
||||
public List<BomNewPbomParentVO> getChild(BomNewPbomParentEntity parent) {
|
||||
|
|
@ -269,14 +270,20 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
for (BomNewPbomParentVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getMaterialNo())) {
|
||||
BomNewPbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
if (parentEntity.getShouldBomExist() == 1 && parentEntity.getBomExist() == 0) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
} else {
|
||||
child.setCurrentVersion(parentEntity.getCurrentVersion());
|
||||
}
|
||||
child.setStatus(parentEntity.getStatus());
|
||||
child.setEditStatus(parentEntity.getEditStatus());
|
||||
child.setDeviseName(parentEntity.getDeviseName());
|
||||
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
|
||||
|
||||
child.setCreatedTime(parentEntity.getCreatedTime());
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
if (parentEntity.getBomExist() == 1) {
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
}
|
||||
child.setLevelNum(parentEntity.getLevelNum());
|
||||
child.setDeptName(parentEntity.getDeptName());
|
||||
child.setChangeDesc(parentEntity.getChangeDesc());
|
||||
|
|
@ -290,9 +297,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
if (parent.getStatus() < PBomStatusEnum.PUBLISH.getValue() && parentEntity.getStatus().equals(PBomStatusEnum.PUBLISH.getValue())) {
|
||||
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
|
||||
}
|
||||
|
||||
} else { //无BOM-版本时 确定版本号
|
||||
|
||||
//child.setSource(Objects.nonNull(parent) ? parent.getSource() : EBomSourceEnum.FROM_BOM.getValue());
|
||||
child.setDeviseUserCode(parent.getDeviseUserCode());
|
||||
child.setDeviseName(parent.getDeviseName());
|
||||
|
|
@ -304,11 +309,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
child.setTechnologyUserName(parent.getTechnologyUserName());
|
||||
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
|
||||
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
|
||||
child.setStatus(parent.getStatus());
|
||||
|
||||
} else {
|
||||
child.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -328,16 +331,20 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId());
|
||||
VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误,该BOM不存在");
|
||||
LogRecordContext.putVariable("bom",parent);
|
||||
parent.setEditStatus(editStatus.getValue());
|
||||
parent.setModifyTime(LocalDateTime.now());
|
||||
this.updateById(parent);
|
||||
|
||||
if (CollUtil.isNotEmpty(paramDTO.getChildList())) {
|
||||
List<BomNewPbomChildEntity> childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList());
|
||||
childList.forEach(u -> u.setParentRowId(paramDTO.getBomRowId()));
|
||||
pbomChildService.saveOrUpdateBatch(childList);
|
||||
parent.setBomExist(1);
|
||||
} else {
|
||||
parent.setBomExist(0);
|
||||
}
|
||||
|
||||
parent.setEditStatus(editStatus.getValue());
|
||||
parent.setModifyTime(LocalDateTime.now());
|
||||
this.updateById(parent);
|
||||
|
||||
if (editStatus == PBomEditStatusEnum.HANDLER_TEMP) {
|
||||
return getChild(parent);
|
||||
} else {
|
||||
|
|
@ -406,16 +413,17 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
// 机加工件 的子级可直接删除
|
||||
if (parentVO.getMaterialCategoryCode().startsWith("200301")) {
|
||||
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
|
||||
resetBomExist(parent.getRowId());
|
||||
return hasTechnologypackage;
|
||||
}
|
||||
//删除辅助物料
|
||||
List<BomNewPbomParentVO> noDelList = childListVO.stream()
|
||||
.filter(u -> !u.getMaterialCategoryCode().startsWith("1003") && !u.getMaterialCategoryCode().startsWith("1020") && !u.getMaterialCategoryCode().startsWith("1021"))
|
||||
.collect(Collectors.toList());
|
||||
noDelList.removeAll(technologypackages);
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noDelList)).throwMessage("非机加工件的子级只能删除辅助物料");
|
||||
|
||||
pbomChildService.getBaseMapper().delByRowId(paramDTO.getRowIdList());
|
||||
resetBomExist(parent.getRowId());
|
||||
return hasTechnologypackage;
|
||||
}
|
||||
|
||||
|
|
@ -1036,4 +1044,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
private void resetBomExist(Long rowId) {
|
||||
this.getBaseMapper().resetBomExist(rowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,4 +282,10 @@
|
|||
<select id="getCountForWaitReviewByMaterialNo" resultType="java.lang.Integer">
|
||||
select COUNT(1) from t_bom_new_ebom_child where material_no=#{materialNo} and edit_status=1
|
||||
</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))
|
||||
WHERE p.row_id = #{rowId};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -226,6 +226,11 @@
|
|||
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
|
||||
#{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))
|
||||
WHERE p.row_id = #{rowId};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -222,4 +222,10 @@
|
|||
</foreach>
|
||||
order by created_time desc
|
||||
</select>
|
||||
|
||||
<select id="resetBomExist">
|
||||
UPDATE t_bom_new_pbom_parent p
|
||||
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_pbom_child WHERE parent_row_id = p.row_id), 1, 0))
|
||||
WHERE p.row_id = #{rowId};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue