Merge branch 'refs/heads/feature/DM/nflg-bom' into dev
This commit is contained in:
commit
15845a21f1
|
|
@ -9,7 +9,10 @@ import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* t_bom_new_pbom_parent 表数据库访问层
|
* t_bom_new_pbom_parent 表数据库访问层
|
||||||
|
|
@ -53,4 +56,8 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
||||||
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
|
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
|
||||||
|
|
||||||
void resetBomExist(Long rowId);
|
void resetBomExist(Long rowId);
|
||||||
|
|
||||||
|
void updateWaitPublicRootState(@Param("materialNoList") Collection<String> materialNoList);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,7 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import com.nflg.product.bomnew.constant.*;
|
import com.nflg.product.bomnew.constant.*;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.*;
|
import com.nflg.product.bomnew.pojo.dto.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
import com.nflg.product.bomnew.pojo.entity.*;
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||||
import com.nflg.product.bomnew.pojo.vo.*;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
|
|
@ -47,6 +44,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Struct;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
@ -836,6 +834,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
|
|
||||||
VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
|
VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
|
||||||
.throwMessage("31码须有虚拟包");
|
.throwMessage("31码须有虚拟包");
|
||||||
|
//检查该版本是否已转换过该工厂的Pbom
|
||||||
|
for (BomNewEbomParentEntity parent : parents){
|
||||||
|
List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion())
|
||||||
|
.select(BomNewPbomParentEntity::getFacCode).list();
|
||||||
|
if(CollUtil.isNotEmpty(list)){
|
||||||
|
Set<String> dbExistsFac = list.stream().map(u -> u.getFacCode()).collect(Collectors.toSet());
|
||||||
|
Set<String> checkResultFac = Sets.intersection(dbExistsFac, new HashSet<>(paramDto.getFacCodes()));
|
||||||
|
VUtils.isTure(CollUtil.isNotEmpty(checkResultFac)).throwMessage("物料:"+parent.getMaterialNo()+"已经转换过"+ StrUtil.join(",", checkResultFac)+"工厂");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (Long bomRowId : paramDto.getBomRowIds()) {
|
for (Long bomRowId : paramDto.getBomRowIds()) {
|
||||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||||
|
|
@ -857,6 +865,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
||||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||||
}
|
}
|
||||||
|
//标记PBom未发布跟节点
|
||||||
|
Set<String> materialNos = bomTree.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||||
|
if(CollUtil.isNotEmpty(materialNos)){
|
||||||
|
pBomParentService.getBaseMapper().updateWaitPublicRootState(materialNos);
|
||||||
|
}
|
||||||
//标记跟节点
|
//标记跟节点
|
||||||
upRootMark(parent);
|
upRootMark(parent);
|
||||||
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
|
||||||
detailVO.setDeviseName(ebomParentEntity.getDeviseName());
|
detailVO.setDeviseName(ebomParentEntity.getDeviseName());
|
||||||
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
detailVO.setBomExist(ebomParentEntity.getBomExist());
|
||||||
detailVO.setStatus(ebomParentEntity.getStatus());
|
detailVO.setStatus(ebomParentEntity.getStatus());
|
||||||
|
detailVO.setBatchNo(ebomParentEntity.getBatchNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class EBomToPBom {
|
||||||
//buildPBomParent(parent, facCode);
|
//buildPBomParent(parent, facCode);
|
||||||
for (BomNewEbomParentVO vo : parentList) {
|
for (BomNewEbomParentVO vo : parentList) {
|
||||||
String hasConvertKey=StrUtil.join("-",facCode,vo.getBomRowId());
|
String hasConvertKey=StrUtil.join("-",facCode,vo.getBomRowId());
|
||||||
if(hasConvert.contains(hasConvertKey)){
|
if(hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus()) ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hasConvert.add(hasConvertKey);
|
hasConvert.add(hasConvertKey);
|
||||||
|
|
@ -164,6 +164,7 @@ public class EBomToPBom {
|
||||||
} else {
|
} else {
|
||||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||||
BeanUtil.copyProperties(parentVo, pBomParent);
|
BeanUtil.copyProperties(parentVo, pBomParent);
|
||||||
|
pBomParent.setSourceRowId(parentVo.getBomRowId());
|
||||||
pBomParent.setRowId(IdWorker.getId());
|
pBomParent.setRowId(IdWorker.getId());
|
||||||
pBomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
pBomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
|
||||||
pBomParent.setLastVersionIs(1);
|
pBomParent.setLastVersionIs(1);
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,12 @@ public class PBomUpgrade {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
|
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
|
||||||
|
//判断有无未发布版本-有则直接跳过
|
||||||
|
List<BomNewPbomParentEntity> waitPublishBomList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parentVO.getMaterialNo())
|
||||||
|
.eq(BomNewPbomParentEntity::getStatus, PBomStatusEnum.WAIT_PUBLISH.getValue()).list();
|
||||||
|
if(CollUtil.isNotEmpty(waitPublishBomList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
BomNewPbomParentEntity pbomParent = new BomNewPbomParentEntity();
|
BomNewPbomParentEntity pbomParent = new BomNewPbomParentEntity();
|
||||||
BeanUtil.copyProperties(parentVO, pbomParent);
|
BeanUtil.copyProperties(parentVO, pbomParent);
|
||||||
pbomParent.setRowId(IdWorker.getId());
|
pbomParent.setRowId(IdWorker.getId());
|
||||||
|
|
|
||||||
|
|
@ -309,13 +309,13 @@
|
||||||
|
|
||||||
<!--检查是否已发布数据的跟节点-->
|
<!--检查是否已发布数据的跟节点-->
|
||||||
<select id="checkIsRoot" resultType="java.lang.Integer">
|
<select id="checkIsRoot" resultType="java.lang.Integer">
|
||||||
select COUNT(1) 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`=4 and a.last_version_is=1
|
select COUNT(1) 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`=4
|
||||||
and b.material_no=#{materialNo}
|
and b.material_no=#{materialNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--检查是否已发布数据的用户跟节点-->
|
<!--检查是否已发布数据的用户跟节点-->
|
||||||
<select id="checkIsUserRoot" resultType="java.lang.Integer">
|
<select id="checkIsUserRoot" resultType="java.lang.Integer">
|
||||||
select COUNT(1) 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`=4 and a.last_version_is=1
|
select COUNT(1) 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`=4
|
||||||
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@
|
||||||
<!--获取工作列表-->
|
<!--获取工作列表-->
|
||||||
<select id="workDetailsListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
<select id="workDetailsListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||||
select * , row_id as bomRowId
|
select * , row_id as bomRowId
|
||||||
from t_bom_new_pbom_parent where root_is=1 and status < 4
|
from t_bom_new_pbom_parent where (root_is=1 or root_state=1 ) and status < 4
|
||||||
<if test="userFac!=null and userFac!=''">
|
<if test="userFac!=null and userFac!=''">
|
||||||
and fac_code=#{userFac}
|
and fac_code=#{userFac}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -99,7 +99,18 @@
|
||||||
<!--获取已发布列表-->
|
<!--获取已发布列表-->
|
||||||
<select id="releaseListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
<select id="releaseListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||||
select * , row_id as bomRowId
|
select * , row_id as bomRowId
|
||||||
from t_bom_new_pbom_parent where status >= 4 and last_version_is=1
|
from t_bom_new_pbom_parent a join
|
||||||
|
(select material_no, max(current_version) current_version from t_bom_new_pbom_parent where status >= 4
|
||||||
|
<if test="query.materialNo!= null and query.materialNo!=''">
|
||||||
|
and material_no = #{query.materialNo}
|
||||||
|
</if>
|
||||||
|
<if test="query.drawingNo!= null and query.drawingNo!=''">
|
||||||
|
and drawing_no = #{query.drawingNo}
|
||||||
|
</if>
|
||||||
|
group by material_no
|
||||||
|
) b
|
||||||
|
on a.material_no=b.material_no and a.current_version=b.current_version
|
||||||
|
where status >= 4
|
||||||
<if test=" (query.materialNo== null || query.materialNo=='' ) and (query.drawingNo== null || query.drawingNo=='')">
|
<if test=" (query.materialNo== null || query.materialNo=='' ) and (query.drawingNo== null || query.drawingNo=='')">
|
||||||
and root_is=1
|
and root_is=1
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -231,4 +242,23 @@
|
||||||
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_pbom_child WHERE parent_row_id = p.row_id), 1, 0))
|
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};
|
WHERE p.row_id = #{rowId};
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<sql id="upRootStateWhr">
|
||||||
|
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</sql>
|
||||||
|
<!--更新待发布根节点状态-->
|
||||||
|
<update id="updateWaitPublicRootState">
|
||||||
|
update t_bom_new_pbom_parent a left join (
|
||||||
|
select b.material_no , a.fac_code from t_bom_new_pbom_parent a join t_bom_new_pbom_child b on a.row_id=b.parent_row_id and a.`status` < 4 and a.last_version_is=1
|
||||||
|
and b.material_no in <include refid="upRootStateWhr"/>
|
||||||
|
) b on a.material_no=b.material_no and a.fac_code =b.fac_code
|
||||||
|
set a.root_state=1
|
||||||
|
where a.`status` < 4 and last_version_is=1 and b.material_no is null
|
||||||
|
and a.material_no in <include refid="upRootStateWhr"/>
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue