1.ebom-列表

This commit is contained in:
大米 2023-12-17 15:23:25 +08:00
parent 5cc3e2d6e2
commit 915c983e0e
20 changed files with 529 additions and 125 deletions

View File

@ -21,6 +21,7 @@ import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.TreeNode;
import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -61,10 +62,22 @@ public class EbomApi extends BaseApi {
private MaterialMainService materialMainService;
@PostMapping("bomPage")
@ApiOperation("Ebom-列表")
public ResultVO<Page<BomNewEbomParentVO>> bomPage(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.getListPage(query));
@PostMapping("workDetailsListByPage")
@ApiOperation("Ebom-工作明细列表")
public ResultVO<Page<TreeNode<BomNewEbomParentVO>>> workDetailsListByPage(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.workDetailsListByPage(query));
}
@PostMapping("formalWorksheet")
@ApiOperation("Ebom-正式工作表")
public ResultVO<Page<BomNewEbomParentVO>> formalWorksheet(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.formalWorksheet(query));
}
@PostMapping("changeImpact")
@ApiOperation("Ebom-变更影响")
public ResultVO<Page<BomNewEbomParentVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.formalWorksheet(query));
}
@GetMapping("getChild")

View File

@ -0,0 +1,13 @@
package com.nflg.product.bomnew.constant;
/**
* @author 大米
* @date 2023/11/11 20:09
*/
public class EBomConstant {
//设计人员
public static final String DESIGNER = "设计人员";
//工艺人员
public static final String TECHNICIAN = "工艺人员";
}

View File

@ -11,7 +11,11 @@ public enum EBomStatusEnum implements ValueEnum<Integer> {
WAIT_CHECK(1,"待复核"),
CHECKED(2,"已复核"),
RETURNED(3,"已退回"),
PUBLISHED(4,"定版已发布PBOM");
PUBLISHED(4,"定版已发布PBOM"),
BORROWED_PARTS(99, "借用件"),
//非自己创建的
REFERENCE(100, "引用件");
private final Integer value;

View File

@ -14,8 +14,10 @@ public enum OriginalStatusEnum implements ValueEnum<Integer> {
OVER_CONVERT(2, "已转换"),
//已发布的
BORROWED_PARTS(3, "借用件"),
//非自己创建的
REFERENCE(4, "引用件");

View File

@ -0,0 +1,19 @@
package com.nflg.product.bomnew.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum UserJobEnum implements ValueEnum<Integer> {
// 0-设计人员 1-工艺人员 2-其他
DESIGNER(0 ,"设计人员"),
ENGINEER(1,"工艺人员"),
OTHER(2,"其他");
private final Integer value;
private final String description;
}

View File

@ -16,4 +16,9 @@ import java.util.List;
public interface BomNewEbomChildMapper extends BaseMapper<BomNewEbomChildEntity> {
List<BomNewEbomChildEntity> getChildByMaterialNo(@Param("materialNo") String materialNo);
/**
* 全量更新-EBOM物料use
*/
void updateEBomMaterialUse();
}

View File

@ -0,0 +1,14 @@
package com.nflg.product.bomnew.mapper.master;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
/**
* t_bom_new_ebom_material_use 表数据库访问层
*
*
* @author makejava
* @since 2023-12-17 11:27:05
*/
public interface BomNewEbomMaterialUseMapper extends BaseMapper<BomNewEbomMaterialUseEntity> {
}

View File

@ -11,6 +11,7 @@ import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* t_bom_new_ebom_parent 表数据库访问层
@ -27,8 +28,16 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
* @param query
* @return
*/
Page<BomNewEbomParentVO> getEBomListPage(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
Page<BomNewEbomParentVO> getEBomListPage(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query ,@Param("job") Integer job, @Param("createdBy") String createdBy);
/**
* 正式工作表
* @param page
* @param query
* @return
*/
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
/**
* 获取子级
* @param rowId
@ -39,4 +48,10 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
List<BomNewEbomParentVO> getParentChildBatch(@Param("rowIds") List<Long> rowIds);
MaterialHistoryProjectTypeVO getMaterialHistoryProjectType(@Param("materialNo")String materialNo);
Set<String> getSelfParentMaterialNo(@Param("createdBy") String createdBy ,@Param("list") Set<String> list);
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList);
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList);
}

View File

@ -33,6 +33,8 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
List<BaseMaterialVO> getMaterialByAnyNo(@Param("drawingNos") List<String> drawingNos);
List<String> getUserPost(@Param("userRowId") Long userRowId);
}

View File

@ -0,0 +1,48 @@
package com.nflg.product.bomnew.pojo.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.time.LocalDate;
/**
* t_bom_new_ebom_material_use
*
*
* @author makejava
* @since 2023-12-17 11:27:05
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-entity-BomNewEbomMaterialUseEntity")
@TableName(value = "t_bom_new_ebom_material_use")
public class BomNewEbomMaterialUseEntity implements Serializable {
/**
* 主键-雪花
*/
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键-雪花")
private Long rowId;
/**
* 物料编码
*/
@TableField(value = "material_no")
@ApiModelProperty(value = "物料编码")
private String materialNo;
/**
* 父级物料编码多个用逗号隔开
*/
@TableField(value = "parent_material_no")
@ApiModelProperty(value = "父级物料编码,多个用逗号隔开")
private String parentMaterialNo;
private static final long serialVersionUID = 344881455840528407L;
}

View File

@ -47,9 +47,10 @@ public class BomNewEbomParentQuery extends BasePageQuery implements Serializabl
@ApiModelProperty(value = "结束时间")
private String endDate;
@ApiModelProperty("数据类型 0-EBOM工作列表数据 1-EBOM的变更页面数据 ")
@ApiModelProperty("数据类型 0-EBOM工作列表数据 1-EBOM正式工作表明细 2-变更影响")
private Integer dataType=0;

View File

@ -52,4 +52,7 @@ public class BaseMaterialVO {
@ApiModelProperty("材质")
private String materialTexture;
@ApiModelProperty("物料大类别")
private String relCategoryCode;
}

View File

@ -0,0 +1,19 @@
package com.nflg.product.bomnew.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.bomnew.mapper.master.BomNewEbomMaterialUseMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
import org.springframework.stereotype.Service;
/**
* t_bom_new_ebom_material_use 表服务实现类
*
*
* @author makejava
* @since 2023-12-17 11:27:05
*/
@Service
public class BomNewEbomMaterialUseService extends ServiceImpl<BomNewEbomMaterialUseMapper, BomNewEbomMaterialUseEntity> {
}

View File

@ -18,9 +18,7 @@ import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
import com.nflg.product.bomnew.pojo.dto.BomNewEBomCreateDTO;
import com.nflg.product.bomnew.pojo.dto.VirtualPackageParamDto;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
@ -32,10 +30,7 @@ import com.nflg.product.bomnew.service.domain.EBom.EbomInitProjectType;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
import com.nflg.product.bomnew.service.domain.OriginalBom.OriginalBomDetailTask;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.*;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
import org.apache.ibatis.annotations.Param;
@ -77,20 +72,133 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
@Qualifier(value = "getBomDetailPool")
private ForkJoinPool bomDetailPool;
@Resource
private UserRoleService userRoleService;
@Resource
private BomNewEbomMaterialUseService bomNewEbomMaterialUseService;
/**
* 获取列表
*
* @param query
* @return
*/
public Page<BomNewEbomParentVO> getListPage(BomNewEbomParentQuery query) {
Page<BomNewEbomParentVO> result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query);
public Page<TreeNode<BomNewEbomParentVO>> workDetailsListByPage(BomNewEbomParentQuery query) {
Page<TreeNode<BomNewEbomParentVO>> returnResult = new Page<>();
//物料编码搜索或图号搜索
if(StrUtil.isNotBlank(query.getMaterialNo()) || StrUtil.isNotBlank(query.getDrawingNo())) {
String materialNo=query.getMaterialNo();
if(StrUtil.isBlank(materialNo)){
List<MaterialMainEntity> materialList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
if(CollUtil.isNotEmpty(materialList)){
materialNo=materialList.get(0).getMaterialNo();
}
}
if(StrUtil.isNotBlank(materialNo)){
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician());
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(parentMaterialByMaterialNo);
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(parentMaterialByMaterialNo);
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());
Page<TreeNode<BomNewEbomParentVO>> resutlData = new Page<>();
BeanUtil.copyProperties(result, resutlData);
resutlData.setRecords(handNodeToTree(result.getRecords()));
returnResult= resutlData;
}
return returnResult;
}
private Page<TreeNode<BomNewEbomParentVO>> handSeachToTree(List<BomNewEbomParentVO> parents, List<BomNewEbomParentVO> childs){
Page<TreeNode<BomNewEbomParentVO>> resutlData = new Page<>();
Set<String> parentSet = parents.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
Set<String> childSet = childs.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
Set<String> difference = Sets.difference(parentSet, childSet);
List<BomNewEbomParentVO> resultParents = parents.stream().filter(u -> difference.contains(u.getMaterialNo())).collect(Collectors.toList());
resutlData.setTotal(difference.size());
resutlData.setSize(difference.size());
resutlData.setPages(1);
resutlData.setCurrent(1L);
List<BomNewEbomParentVO> all=new ArrayList<>();
all.addAll(parents);
all.addAll(childs);
List<TreeNode<BomNewEbomParentVO>> result=new ArrayList<>();
for (BomNewEbomParentVO vo : resultParents) {
result.addAll( TreeUtils.toTree(vo.getRowId(), all, BomNewEbomParentVO::getParentRowId, BomNewEbomParentVO::getBomRowId));
}
resutlData.setRecords(result);
return resutlData;
}
private List<TreeNode<BomNewEbomParentVO>> handNodeToTree(List<BomNewEbomParentVO> list){
List<TreeNode<BomNewEbomParentVO>> result=new ArrayList<>();
for (BomNewEbomParentVO vo : list) {
TreeNode<BomNewEbomParentVO> treeData= new TreeNode<>();
treeData.setData(vo);
result.add(treeData);
}
return result;
}
/**
* 获取物料所有父节点
* @param materialNo
* @return
*/
private List<String> getParentMaterialByMaterialNo(String materialNo , Boolean selfIs) {
BomNewEbomMaterialUseEntity materialBom = bomNewEbomMaterialUseService.lambdaQuery().eq(BomNewEbomMaterialUseEntity::getMaterialNo, materialNo).one();
List<String> result = new ArrayList<>();
if (Objects.nonNull(materialBom) && StrUtil.isNotBlank(materialBom.getParentMaterialNo())) {
Set<String> relSkuNo = Sets.newHashSet(StrUtil.split(materialBom.getParentMaterialNo(), ","));
if(selfIs && CollUtil.isNotEmpty(relSkuNo)){
relSkuNo=getSelfMaterialNo(relSkuNo);
}
while (CollUtil.isNotEmpty(relSkuNo)) {
result.addAll(relSkuNo);
List<BomNewEbomMaterialUseEntity> relSkuList = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, relSkuNo).list();
relSkuNo.clear();
Set<String> finalRelSkuNo = relSkuNo;
relSkuList.forEach(k -> {
if (StrUtil.isNotBlank(k.getParentMaterialNo())) {
finalRelSkuNo.addAll(Sets.newHashSet(StrUtil.split(k.getParentMaterialNo(), ",")) );
}
});
relSkuNo=finalRelSkuNo;
if(CollUtil.isNotEmpty(relSkuNo) && selfIs){
relSkuNo=getSelfMaterialNo(relSkuNo);
}
}
}
return result;
}
private Set<String> getSelfMaterialNo(Set<String> relSkuNo){
Set<String> selfParentMaterialNo = this.getBaseMapper().getSelfParentMaterialNo(SessionUtil.getUserCode(), relSkuNo);
return selfParentMaterialNo;
}
/**
* 正式工作表
* @param query
* @return
*/
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query);
materialMainService.intiMaterialInfo(result.getRecords());
return result;
}
/**
* 获取子级
*
@ -113,12 +221,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
child.setCreatedBy(parentEntity.getCreatedBy());
//child.setCreatedBy(parentEntity.getCreatedBy());
child.setCreatedTime(parentEntity.getCreatedTime());
child.setBomRowId(parentEntity.getRowId());
child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName());
child.setSource(parentEntity.getSource());
if(parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())){
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
}
} else { //无BOM-版本时 确定版本号

View File

@ -0,0 +1,54 @@
package com.nflg.product.bomnew.service;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.EBomConstant;
import com.nflg.product.bomnew.constant.UserJobEnum;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@Service
public class UserRoleService {
@Resource
MaterialMainService materialMainService;
public List<String> getUserPost(){
return materialMainService.getBaseMapper().getUserPost(SessionUtil.getRowId());
}
/**
* 是否设计人员
* @return
*/
public Boolean designer(){
return getUserPost().contains(EBomConstant.DESIGNER);
}
/**
* 是否工艺
* @return
*/
public Boolean technician(){
return getUserPost().contains(EBomConstant.TECHNICIAN);
}
/**
* 获取用户岗位
* @return
*/
public Integer getUserJob(){
return 1;
// return technician()? UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue();
}
}

View File

@ -10,10 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.EBomSourceEnum;
import com.nflg.product.bomnew.constant.OriginalConstant;
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.mapper.master.BomNewEbomChildMapper;
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
@ -25,6 +22,7 @@ import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
import com.nflg.product.bomnew.service.BomNewEbomParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.UserRoleService;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
@ -92,7 +90,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
}
//子节点
List<BomOriginalListVO> parentChild = bomDetail.stream().filter(u -> Objects.nonNull(u.getParentRowId()) && u.getParentRowId().equals(parentEnt.getBomRowId())).collect(Collectors.toList());
//List<BomOriginalListVO> parentChildNoMaterilaNoList = parentChild.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
List<BomOriginalListVO> parentChildNoMaterilaNoList = parentChild.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
//无编码
if (StrUtil.isBlank(parentEnt.getMaterialNo())) {
@ -101,7 +99,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
if(StrUtil.isNotBlank(parentEnt.getDrawingNo())) {
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(ImmutableList.of(parentEnt), BomOriginalListVO::getDrawingNo, BomOriginalListVO::setMaterialNo, BomOriginalListVO::setMaterialName);
//子级初始化物料编码
// SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(parentChildNoMaterilaNoList, BomOriginalListVO::getDrawingNo, BomOriginalListVO::setMaterialNo, BomOriginalListVO::setMaterialName);
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(parentChildNoMaterilaNoList, BomOriginalListVO::getDrawingNo, BomOriginalListVO::setMaterialNo, BomOriginalListVO::setMaterialName);
}
//合并相同编码的物料
List<BomOriginalListVO> mergeResult = mergeBOM(parentChild);
@ -233,6 +231,9 @@ public class OriginalBomToEBomConvert extends BaseConvert {
eBomParent.setLastVersionIs(1);
eBomParent.setModifyTime(LocalDateTime.now());
eBomParent.setBomExist(parentEnt.getBomRowId()>0?1:0);
//工艺岗直接到已复核
eBomParent.setStatus(SpringUtil.getBean(UserRoleService.class).technician()? EBomStatusEnum.CHECKED.getValue():EBomStatusEnum.WAIT_CHECK.getValue());
eBomParent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician()?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
if (Objects.nonNull(ebom)) {
ebom.setLastVersionIs(0);
this.eBomParentResult.add(ebom);

View File

@ -47,4 +47,15 @@
join t_bom_new_ebom_child b on a.row_id = b.parent_row_id and a.material_no = #{materialNo}
and a.last_version_is = 1
</select>
<update id="updateEBomMaterialUse">
SET @@global.group_concat_max_len=804800;
delete from t_bom_new_ebom_material_use;
INSERT INTO `t_bom_new_ebom_material_use` (`row_id`, `material_no`, `parent_material_no`)
select min(b.row_id) rowId, b.material_no, GROUP_CONCAt( distinct a.material_no) as value_list
from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.last_version_is=1
group by b.material_no ;
</update>
</mapper>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewEbomMaterialUseMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_ebom_material_use -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="parent_material_no" property="parentMaterialNo" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, material_no, parent_material_no </sql>
</mapper>

View File

@ -1,112 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper">
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity">
<!--@mbg.generated-->
<!--@Table t_bom_new_ebom_parent -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="batch_no" property="batchNo" jdbcType="VARCHAR"/>
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="current_version" property="currentVersion" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="source" property="source" jdbcType="INTEGER"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
<result column="project_type_input_type" property="projectTypeInputType" jdbcType="INTEGER"/>
<result column="root_is" property="rootIs" jdbcType="INTEGER"/>
<result column="virtrual_package_enum" property="virtrualPackageEnum" />
<result column="should_bom_exist" property="shouldBomExist" jdbcType="INTEGER"/>
<result column="super_material_status" property="superMaterialStatus" jdbcType="INTEGER"/>
<result column="bom_exist" property="bomExist" jdbcType="INTEGER"/>
<result column="last_version_is" property="lastVersionIs" jdbcType="INTEGER"/>
<result column="edit_status" property="editStatus" jdbcType="INTEGER"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="user_root_is" property="userRootIs" jdbcType="INTEGER"/>
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
<result column="virtual_package_is" property="virtualPackageIs" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/>
<result column="devise_name" property="deviseName" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="created_job" property="createdJob" jdbcType="INTEGER"/>
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP"/>
<result column="audit_user_name" property="auditUserName" jdbcType="VARCHAR"/>
<result column="release_time" property="releaseTime" jdbcType="TIMESTAMP"/>
<result column="release_user_name" property="releaseUserName" jdbcType="VARCHAR"/>
<result column="revert_time" property="revertTime" jdbcType="TIMESTAMP"/>
<result column="revert_user_name" property="revertUserName" jdbcType="VARCHAR"/>
<result column="expire_end_time" property="expireEndTime" jdbcType="TIMESTAMP"/>
<result column="convert_to_ebom_time" property="convertToEbomTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
<result column="level_num" property="levelNum" jdbcType="INTEGER"/>
<result column="change_desc" property="changeDesc" jdbcType="VARCHAR"/>
<result column="notice_nums" property="noticeNums" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
</resultMap>
<!--@mbg.generated-->
<!--@Table t_bom_new_ebom_parent -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="batch_no" property="batchNo" jdbcType="VARCHAR"/>
<result column="drawing_no" property="drawingNo" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
<result column="order_number" property="orderNumber" jdbcType="VARCHAR"/>
<result column="material_name" property="materialName" jdbcType="VARCHAR"/>
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="current_version" property="currentVersion" jdbcType="VARCHAR"/>
<result column="num" property="num" jdbcType="DECIMAL"/>
<result column="source" property="source" jdbcType="INTEGER"/>
<result column="project_type" property="projectType" jdbcType="VARCHAR"/>
<result column="project_type_input_type" property="projectTypeInputType" jdbcType="INTEGER"/>
<result column="root_is" property="rootIs" jdbcType="INTEGER"/>
<result column="virtrual_package_enum" property="virtrualPackageEnum"/>
<result column="should_bom_exist" property="shouldBomExist" jdbcType="INTEGER"/>
<result column="super_material_status" property="superMaterialStatus" jdbcType="INTEGER"/>
<result column="bom_exist" property="bomExist" jdbcType="INTEGER"/>
<result column="last_version_is" property="lastVersionIs" jdbcType="INTEGER"/>
<result column="edit_status" property="editStatus" jdbcType="INTEGER"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="user_root_is" property="userRootIs" jdbcType="INTEGER"/>
<result column="exception_status" property="exceptionStatus" jdbcType="INTEGER"/>
<result column="virtual_package_is" property="virtualPackageIs" jdbcType="INTEGER"/>
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/>
<result column="devise_user_code" property="deviseUserCode" jdbcType="VARCHAR"/>
<result column="devise_name" property="deviseName" jdbcType="VARCHAR"/>
<result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="created_job" property="createdJob" jdbcType="INTEGER"/>
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP"/>
<result column="audit_user_name" property="auditUserName" jdbcType="VARCHAR"/>
<result column="release_time" property="releaseTime" jdbcType="TIMESTAMP"/>
<result column="release_user_name" property="releaseUserName" jdbcType="VARCHAR"/>
<result column="revert_time" property="revertTime" jdbcType="TIMESTAMP"/>
<result column="revert_user_name" property="revertUserName" jdbcType="VARCHAR"/>
<result column="expire_end_time" property="expireEndTime" jdbcType="TIMESTAMP"/>
<result column="convert_to_ebom_time" property="convertToEbomTime" jdbcType="TIMESTAMP"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="dept_name" property="deptName" jdbcType="VARCHAR"/>
<result column="level_num" property="levelNum" jdbcType="INTEGER"/>
<result column="change_desc" property="changeDesc" jdbcType="VARCHAR"/>
<result column="notice_nums" property="noticeNums" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, batch_no, drawing_no, material_no, order_number, material_name, material_desc, material_texture, material_unit, unit_weight, total_weight, current_version, num, source, project_type, project_type_input_type, root_is,virtrual_package_enum, should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status, status, user_root_is, exception_status,virtual_package_is, source_row_id, devise_user_code, devise_name, created_by, created_time, created_job, audit_time, audit_user_name, release_time, release_user_name, revert_time, revert_user_name, expire_end_time, convert_to_ebom_time, remark, dept_name, level_num, change_desc, notice_nums, modify_time </sql>
row_id, batch_no, drawing_no, material_no, order_number, material_name, material_desc, material_texture,
material_unit, unit_weight, total_weight, current_version, num, source, project_type, project_type_input_type,
root_is,virtrual_package_enum, should_bom_exist, super_material_status, bom_exist, last_version_is, edit_status,
status, user_root_is, exception_status,virtual_package_is, source_row_id, devise_user_code, devise_name,
created_by, created_time, created_job, audit_time, audit_user_name, release_time, release_user_name,
revert_time, revert_user_name, expire_end_time, convert_to_ebom_time, remark, dept_name, level_num, change_desc,
notice_nums, modify_time
</sql>
<sql id="whr">
<if test="query.drawingNo!=null and query.drawingNo!=''">
and drawing_no=#{query.drawingNo}
</if>
<if test="query.materialNo!=null and query.materialNo!=''">
and material_no=#{query.materialNo}
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
and devise_name=#{query.deviseName}
</if>
<if test="query.startDate!=null and query.startDate!=''">
and created_time between #{query.startDate} and #{query.endDate}
</if>
<if test="query.dataType==0">
and status=1 or status=3
</if>
<if test="query.dataType==1">
and status=2 or status=4
</if>
</sql>
<sql id="whr">
<if test="query.drawingNo!=null and query.drawingNo!=''">
and drawing_no=#{query.drawingNo}
</if>
<if test="query.materialNo!=null and query.materialNo!=''">
and material_no=#{query.materialNo}
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
and devise_name=#{query.deviseName}
</if>
<if test="query.startDate!=null and query.startDate!=''">
and created_time between #{query.startDate} and #{query.endDate}
</if>
</sql>
<select id="getEBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select * from t_bom_new_ebom_parent where true
<include refid="whr"/>
</select>
<!--Ebom工作列表-->
<select id="getEBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
<if test="job==0">
select * from t_bom_new_ebom_parent where status=1 and created_by=#{createdBy} and user_root_is=1 and
(status=1 or status=3)
<include refid="whr"/>
</if>
<if test="job==1">
select * from t_bom_new_ebom_parent where status=2 and user_root_is=1 and ( status=2 or status=4 )
<include refid="whr"/>
</if>
</select>
<!--获取子级-->
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select *
from t_bom_new_ebom_child
where parent_row_id = #{rowId}
order by order_number
</select>
<select id="getParentChildBatch" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select *
from t_bom_new_original_child
where parent_row_id in
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
#{rowId}
</foreach>
</select>
<!--统计物料历史项目类别-->
<select id="getMaterialHistoryProjectType" resultType="com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO">
select b.project_type, COUNT(1) projectCount from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.last_version_is=1
where b.material_no=#{materialNo} group by b.project_type order by projectCount limit 1
</select>
<!--物料编码搜索-父级-->
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_ebom_parent a where a.last_version_is=1 and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!--物料编码搜索-子级-->
<select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select if(c.status=4,99,c.status) as status ,c.current_version c.created_by as bomCreatedBy ,c.devise_name,c.devise_user_code,c.dept_name ,
c.source, c.row_id as bomRowId, c.row_id as childBomRowId, b.*
from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id =b.parent_row_id
left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1
where a.last_version_is=1 and a.material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!--BOM-正式工作表-->
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select row_id as bomRowId, * from t_bom_new_ebom_parent where 1=1
<include refid="whr"/>
</select>
<!--获取子级-->
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select *
from t_bom_new_ebom_child
where parent_row_id = #{rowId}
order by order_number
</select>
<select id="getParentChildBatch" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select *
from t_bom_new_original_child
where parent_row_id in
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
#{rowId}
</foreach>
</select>
<!--统计物料历史项目类别-->
<select id="getMaterialHistoryProjectType"
resultType="com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO">
select b.project_type, COUNT(1) projectCount
from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id = b.parent_row_id and a.last_version_is = 1
where b.material_no = #{materialNo}
group by b.project_type
order by projectCount limit 1
</select>
<select id="getSelfParentMaterialNo" resultType="java.lang.String">
select material_no from t_bom_new_ebom_parent where last_version_is=1 and created_by=#{createdBy} material_no in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@ -70,9 +70,9 @@
<select id="getMaterialBaseInfo" resultType="com.nflg.product.bomnew.pojo.vo.BaseMaterialVO">
select row_id as materialRowId, material_no, material_name, material_desc, procure_type, project_type, material_state,drawing_no,material_category_code ,material_get_type,drawing_no
,material_texture as material ,material_texture
from t_material_main
select a.row_id as materialRowId, material_no, material_name, material_desc, procure_type, project_type, material_state,drawing_no,a.material_category_code ,material_get_type,drawing_no
,material_texture as material ,material_texture , b.rel_category_code
from t_material_main a join t_material_category b on a.material_category_code=b.category_code
where material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
#{item}
@ -116,4 +116,10 @@
#{item}
</foreach>
</select>
<!--获取用户角色-->
<select id="getUserPost" resultType="java.lang.String">
SELECT distinct b.post_name from t_authority_role_user a
join t_authority_role_post b on a.role_row_id=b.role_row_id where a.user_row_id=#{userRowId}
</select>
</mapper>