Merge branch 'refs/heads/feature/DM/nflg-bom-transition' into release
This commit is contained in:
commit
42a98bdd92
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||
|
|
@ -52,11 +53,7 @@ public class BomReportApi extends BaseApi {
|
|||
@ApiOperation("bom-反查")
|
||||
public ResultVO<List<ReverseReportVO>> reverseReport(@Valid @RequestBody ReverseReportQuery query) {
|
||||
|
||||
//原始BOM
|
||||
if (query.getBomType().equals(0)) {
|
||||
VUtils.isTure(StrUtil.isBlank(query.getDrawingNo())).throwMessage("图号不能为空");
|
||||
return ResultVO.success(reverseReportService.queryOriginalBom(query));
|
||||
}
|
||||
VUtils.isTure(!ImmutableList.of(1,2).contains(query.getBomType())).throwMessage("只能查询EBom和PBom");
|
||||
VUtils.isTure(StrUtil.isBlank(query.getMaterialNo())).throwMessage("物料编码不能为空");
|
||||
if(query.getBomType().equals(1)){
|
||||
return ResultVO.success(reverseReportService.queryEBom(query));
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
|
||||
Integer checkIsUserRoot(@Param("materialNo")String materialNo, @Param("jobNo")String jobNo);
|
||||
|
||||
List<ReverseReportVO> eBomReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNos")List<String> materialNos);
|
||||
List<ReverseReportVO> eBomReverseReport(@Param("bomVersionRowId")Long bomVersionRowId,@Param("startDate") String startDate, @Param("endDate")String endDate, @Param("materialNo")String materialNo);
|
||||
Integer getCountForWaitReviewByMaterialNo(@Param("materialNo") String materialNo);
|
||||
|
||||
void updateRootForWaitReview();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ public class BomNewEbomExportToSAP {
|
|||
|
||||
public List<OperationErrorMsgVO> export(Long rootBomRowId) {
|
||||
BomNewEbomParentEntity root = bomNewEbomParentService.getById(rootBomRowId);
|
||||
VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
|
||||
// VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在");
|
||||
if (Objects.isNull(root)) return Collections.emptyList();
|
||||
VUtils.isTure(root.getUserRootIs() != 1).throwMessage("请选择根节点");
|
||||
VUtils.isTure(Objects.equals(root.getSapState(), SapStatusEnum.PUB_RUNNING.getValue()))
|
||||
.throwMessage("正在导入中,请等待操作完成");
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
|||
import com.nflg.product.bomnew.pojo.dto.MaterialUpdateBillDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageItem;
|
||||
import com.nflg.product.bomnew.pojo.query.GenerateVirtualPackageQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.ChildListForGenerateVirtualPackageVO;
|
||||
|
|
@ -48,6 +49,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
private final BomNewEbomChildService ebomChildService = SpringUtil.getBean(BomNewEbomChildService.class);
|
||||
private final MaterialMainClient materialMainClient = SpringUtil.getBean(MaterialMainClient.class);
|
||||
private final MaterialService materialService = SpringUtil.getBean(MaterialService.class);
|
||||
private final MaterialMainService materialMainService = SpringUtil.getBean(MaterialMainService.class);
|
||||
private final PlatformTransactionManager transactionManager = SpringUtil.getBean(PlatformTransactionManager.class);
|
||||
|
||||
private final List<BomNewEbomChildEntity> childrenForAdd = Collections.synchronizedList(new ArrayList<>());
|
||||
|
|
@ -535,12 +537,12 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
child.setMaterialName(child.getDrawingNo());
|
||||
child.setMaterialCategoryCode(type.getMaterialCategoryCode());
|
||||
child.setVirtualPartRootMaterialNo(root.getMaterialNo());
|
||||
BomNewEbomParentEntity p = ebomParentService.lambdaQuery()
|
||||
.eq(BomNewEbomParentEntity::getDrawingNo, drawingNo)
|
||||
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
MaterialMainEntity me = materialMainService.lambdaQuery()
|
||||
.eq(MaterialMainEntity::getDrawingNo, drawingNo)
|
||||
.last(" limit 1")
|
||||
.one();
|
||||
if (Objects.nonNull(p)) {
|
||||
child.setMaterialNo(p.getMaterialNo());
|
||||
if (Objects.nonNull(me)) {
|
||||
child.setMaterialNo(me.getMaterialNo());
|
||||
} else {
|
||||
child.setMaterialNo(getMaterialNoForAdd(child));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2526,8 +2526,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return this.getBaseMapper().getLatestByMaterialNo(materialNos);
|
||||
}
|
||||
|
||||
public void setLastVersionIs0(Set<String> pMaterialNos) {
|
||||
this.lambdaUpdate().in(BomNewEbomParentEntity::getMaterialNo, pMaterialNos)
|
||||
public void setLastVersionIs0(Collection<Long> rowIds) {
|
||||
this.lambdaUpdate().in(BomNewEbomParentEntity::getRowId, rowIds)
|
||||
.set(BomNewEbomParentEntity::getLastVersionIs, 0)
|
||||
.set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
|
||||
.update();
|
||||
|
|
@ -2643,7 +2643,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
* @param exceptRowIds
|
||||
*/
|
||||
private void eBomToFormal(List<Long> exceptRowIds, List<BomNewEbomParentVO> parents){
|
||||
|
||||
List<String> materialNos = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(materialNos)){
|
||||
return;
|
||||
}
|
||||
List<BomNewEbomParentEntity> toParents = this.lambdaQuery().eq(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).notIn(BomNewEbomParentEntity::getRowId, exceptRowIds)
|
||||
.in(BomNewEbomParentEntity::getMaterialNo, materialNos).select(BomNewEbomParentEntity::getRowId).list();
|
||||
if(CollUtil.isNotEmpty(toParents)) {
|
||||
|
|
|
|||
|
|
@ -1237,10 +1237,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
List<Long> oldPBomRowIds = toParents.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
List<Long> toFormalPBomRowIds = new ArrayList<>();
|
||||
toFormalPBomRowIds.addAll(exceptRowIds);
|
||||
toFormalPBomRowIds.addAll(oldPBomRowIds);
|
||||
this.getBaseMapper().insertPBomParentToFormal(toFormalPBomRowIds);
|
||||
this.getBaseMapper().insertPBomChildToFormal(toFormalPBomRowIds);
|
||||
|
||||
this.getBaseMapper().insertPBomParentToFormal(exceptRowIds);
|
||||
this.getBaseMapper().insertPBomChildToFormal(exceptRowIds);
|
||||
|
||||
//转移后删除
|
||||
this.getBaseMapper().delPBom(oldPBomRowIds);
|
||||
|
|
|
|||
|
|
@ -102,22 +102,22 @@ public class EBomImportService {
|
|||
private void save(List<BomNewEbomParentEntity> parents, List<BomNewEbomChildEntity> children) {
|
||||
Set<String> pMaterialNos = parents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
||||
List<BomNewEbomParentEntity> oldParents = bomNewEbomParentService.getLatestByMaterialNo(pMaterialNos);
|
||||
oldParents.forEach(p -> {
|
||||
if (!Objects.equals(p.getStatus(), EBomStatusEnum.PUBLISHED.getValue())) {
|
||||
bomNewEbomParentService.getBaseMapper().deleteById(p.getRowId());
|
||||
bomNewEbomChildService.deleteAllChildren(p.getRowId());
|
||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(p.getCurrentVersion());
|
||||
});
|
||||
p.setLastVersionIs(0);
|
||||
} else {
|
||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion()));
|
||||
});
|
||||
}
|
||||
});
|
||||
//bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
bomNewEbomParentService.updateBatchById(oldParents.stream().filter(f -> f.getLastVersionIs() == 0).collect(Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(oldParents)) {
|
||||
oldParents.forEach(p -> {
|
||||
if (!Objects.equals(p.getStatus(), EBomStatusEnum.PUBLISHED.getValue())) {
|
||||
bomNewEbomParentService.getBaseMapper().deleteById(p.getRowId());
|
||||
bomNewEbomChildService.deleteAllChildren(p.getRowId());
|
||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(p.getCurrentVersion());
|
||||
});
|
||||
} else {
|
||||
parents.stream().filter(it -> StrUtil.equals(it.getMaterialNo(), p.getMaterialNo())).forEach(it -> {
|
||||
it.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(p.getCurrentVersion()));
|
||||
});
|
||||
}
|
||||
});
|
||||
bomNewEbomParentService.setLastVersionIs0(oldParents.stream().map(BomNewEbomParentEntity::getRowId).collect(Collectors.toList()));
|
||||
}
|
||||
bomNewEbomParentService.saveBatch(parents);
|
||||
bomNewEbomChildService.saveBatch(children);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
|
|||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||
detailVO.setBatchNo(ebomParentEntity.getBatchNo());
|
||||
detailVO.setCreatedBy(ebomParentEntity.getCreatedBy());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class EBomFormalDetailTask extends RecursiveTask<List<BomNewEbomParentVO>
|
|||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||
detailVO.setBatchNo(ebomParentEntity.getBatchNo());
|
||||
detailVO.setCreatedBy(ebomParentEntity.getCreatedBy());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ public class EBomToPBomForFormal31 extends EBomToPbomBase {
|
|||
check();
|
||||
//bom 提层
|
||||
liftingLayer();
|
||||
result.forEach(u->u.setLevelNo(""));
|
||||
generateDrawingNo(result, parent.getRowId(), "1");
|
||||
// result.forEach(u->u.setLevelNo(""));
|
||||
// generateDrawingNo(result, parent.getRowId(), "1");
|
||||
splitData();
|
||||
List<String> hasConvert = new ArrayList<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -167,8 +167,8 @@ public abstract class EBomToPbomBase {
|
|||
}
|
||||
//pbom 处于工作表
|
||||
else if (Objects.nonNull(oldParent) && oldParent.getStatus() < EBomStatusEnum.PUBLISHED.getValue()) {
|
||||
if (oldParent.getCreatedBy() == parentVo.getCreatedBy()) {
|
||||
if (ConvertToPBomModelEnum.OVERRIDE.equals(convertMode.getValue())) {
|
||||
if (oldParent.getCreatedBy().equals( parentVo.getCreatedBy())) {
|
||||
if (ConvertToPBomModelEnum.OVERRIDE.equalsValue(convertMode.getValue())) {
|
||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
oldParent.setSourceRowId(parentVo.getRowId());
|
||||
|
|
@ -212,6 +212,7 @@ public abstract class EBomToPbomBase {
|
|||
if (Objects.nonNull(oldParent)) {
|
||||
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||
oldParent.setLastVersionIs(0);
|
||||
this.pBomParentResult.add(oldParent);
|
||||
}
|
||||
this.pBomParentResult.add(pBomParent);
|
||||
return pBomParent;
|
||||
|
|
|
|||
|
|
@ -54,13 +54,20 @@ public class EBomQueryService {
|
|||
*/
|
||||
public List<ReverseReportVO> singleLevelReport(ReverseReportQuery queryParam) {
|
||||
Long bomVersionRowId=0L;
|
||||
if(StrUtil.isNotBlank(queryParam.getBomVersion())){
|
||||
//指定版本
|
||||
if(queryParam.getVersionStrategy().equals(2) && StrUtil.isNotBlank(queryParam.getBomVersion())){
|
||||
BomNewEbomParentFormalEntity one = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.eq(BomNewEbomParentFormalEntity::getCurrentVersion, queryParam.getBomVersion()).one();
|
||||
bomVersionRowId= Objects.nonNull(one)? one.getRowId():0L;
|
||||
}//最新版本
|
||||
else if(queryParam.getVersionStrategy().equals(0)){
|
||||
BomNewEbomParentFormalEntity one = ebomParentFormalService.lambdaQuery().eq(BomNewEbomParentFormalEntity::getMaterialNo, queryParam.getMaterialNo())
|
||||
.last(" order by current_version desc limit 1").one();
|
||||
if(Objects.nonNull(one)){
|
||||
bomVersionRowId=one.getRowId();
|
||||
}
|
||||
}
|
||||
|
||||
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), ImmutableList.of(queryParam.getMaterialNo()));
|
||||
return ebomParentService.getBaseMapper().eBomReverseReport(bomVersionRowId,queryParam.getStartDate(),queryParam.getEndDate(), queryParam.getMaterialNo());
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -356,10 +356,7 @@
|
|||
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
|
||||
and b.convert_to_ebom_time >= #{startDate} and b.expire_end_time <=#{endDate}
|
||||
</if>
|
||||
and a.material_no in
|
||||
<foreach collection="materialNos" item="materialNo" open="(" separator="," close=")">
|
||||
#{materialNo}
|
||||
</foreach>
|
||||
and a.material_no =#{materialNo}
|
||||
</select>
|
||||
|
||||
<select id="getCountForWaitReviewByMaterialNo" resultType="java.lang.Integer">
|
||||
|
|
|
|||
|
|
@ -302,9 +302,9 @@
|
|||
</update>
|
||||
|
||||
<insert id="insertPBomParentToFormal">
|
||||
INSERT INTO `t_bom_new_pbom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`)
|
||||
INSERT INTO `t_bom_new_pbom_parent_formal` (`row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, `dept_row_id`,`level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`,`source`)
|
||||
|
||||
select `row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`
|
||||
select `row_id`, `batch_no`, `drawing_no`, `fac_code`, `material_no`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `current_version`, `num`, `project_type`, `root_is`, `should_bom_exist`, `super_material_status`, `bom_exist`, `last_version_is`, `edit_status`, `status`, `user_root_is`, `virtual_package_is`, `source_row_id`, `devise_user_code`, `devise_name`, `technology_user_code`, `technology_user_name`, `created_by`, `created_time`, `created_job`, `release_time`, `release_user_name`, `last_convert_mbom_user_name`, `last_convert_mbom_time`, `expire_end_time`, `remark`, `dept_name`, dept_row_id,`level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time`, `sap_state`, `sap_time`,`source`
|
||||
from t_bom_new_pbom_parent
|
||||
where row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
|
|
|
|||
Loading…
Reference in New Issue