Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom

This commit is contained in:
jing's 2024-03-09 14:14:57 +08:00
commit dd0cda516e
29 changed files with 506 additions and 118 deletions

View File

@ -7,6 +7,7 @@ import com.nflg.product.material.pojo.dto.MaterialPurchseExcelDTO;
import com.nflg.product.material.pojo.dto.IniFileDTO;
import com.nflg.product.material.pojo.dto.MaterialMainAddAttrParamDTO;
import com.nflg.product.material.pojo.dto.UpOaProcessStateMaterialDTO;
import com.nflg.product.material.pojo.entity.LanguageTranslationEntity;
import com.nflg.product.material.pojo.entity.MaterialMainEntity;
import com.nflg.product.material.pojo.query.MaterialMainQuery;
import com.nflg.product.material.pojo.vo.CategoryQueryVO;
@ -75,4 +76,6 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
MaterialMainEntity selectByMaterialNoAndRelCategoryCode(@Param("materialNo") String materialNo, @Param("list") List<String> list);
void updateBatch(@Param("result") List<MaterialMainEntity> result);
List<LanguageTranslationEntity> getKeyLanguage(@Param("languageCode")String languageCode);
}

View File

@ -0,0 +1,55 @@
package com.nflg.product.material.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_language_translation
* 多语言
*
* @author makejava
* @since 2024-03-07 18:16:17
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-material-pojo-translation-entity-LanguageTranslationEntity")
@TableName(value = "t_language_translation")
public class LanguageTranslationEntity implements Serializable {
/**
* 主键行ID
*/
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键行ID")
private Long rowId;
/**
* 关键子字段名等
*/
@TableField(value = "key_name")
@ApiModelProperty(value = "关键子,字段名等")
private String keyName;
/**
* 语言编码
*/
@TableField(value = "language_code")
@ApiModelProperty(value = "语言编码")
private String languageCode;
/**
* 译文
*/
@TableField(value = "translation_text")
@ApiModelProperty(value = "译文")
private String translationText;
private static final long serialVersionUID = 233678426416904026L;
}

View File

@ -394,10 +394,18 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
*
* @return
*/
private List<MaterialTbHeaderVO> getTbHeader(MaterialCategoryEntity categoryEntity, Integer materialClass, List<MaterialCategoryEntity> childList) {
private List<MaterialTbHeaderVO> getTbHeader(MaterialCategoryEntity categoryEntity, Integer
materialClass, List<MaterialCategoryEntity> childList) {
long Date10 = new Date().getTime();
log.info("[计算耗时][getTbHeader]================================" + Date10 );
//多语言(没有则获取中午)
List<LanguageTranslationEntity> keyLanguage = this.getBaseMapper().getKeyLanguage(SessionUtil.getLanguage());
if(CollUtil.isNotEmpty(keyLanguage)){
}
LinkedList thHeaderList = new LinkedList();
String categoryCode = null;

View File

@ -0,0 +1,34 @@
package com.nflg.product.material.util;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.material.pojo.entity.LanguageTranslationEntity;
import com.nflg.product.material.service.MaterialMainService;
import nflg.product.common.dto.LoginUserInfoDTO;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
public class LanguageUtil {
private final String zhLanguage="zh-cn";
private Map<String, LanguageTranslationEntity> translationMap;
public LanguageUtil() {
List<LanguageTranslationEntity> keyLanguage = SpringUtil.getBean(MaterialMainService.class).getBaseMapper().getKeyLanguage(SessionUtil.getLanguage());
if(CollUtil.isEmpty(keyLanguage)){
keyLanguage = SpringUtil.getBean(MaterialMainService.class).getBaseMapper().getKeyLanguage(zhLanguage);
}
translationMap=ListCommonUtil.listToMap(keyLanguage,LanguageTranslationEntity::getKeyName);
}
public String getTranslationTextByKeyName(String keyName){
return translationMap.containsKey(keyName)? translationMap.get(keyName).getTranslationText():"";
}
}

View File

@ -520,4 +520,8 @@
WHERE material_no = #{item.materialNo}
</foreach>
</update>
<select id="getKeyLanguage" resultType="com.nflg.product.material.pojo.entity.LanguageTranslationEntity">
select * from t_language_translation where language_code=#{languageCode}
</select>
</mapper>

View File

@ -21,7 +21,7 @@ import java.util.TimeZone;
@EnableDiscoveryClient
@EnableScheduling
@EnableFeignClients
@EnableLogRecord(tenant = "com.nflg")
@EnableLogRecord(tenant = "BOM")
public class BomnewApplication {
public static void main(String[] args) {

View File

@ -0,0 +1,50 @@
package com.nflg.product.bomnew.api.user;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.pojo.entity.BomNewLogEntity;
import com.nflg.product.bomnew.pojo.query.BomNewLogQuery;
import com.nflg.product.bomnew.service.BomNewLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* t_bom_new_log 表控制层
*
*
* @author makejava
* @since 2024-03-06 08:30:00
*/
@Api(tags = "日志")
@RestController
@RequestMapping("bomNewLogEntity")
public class BomNewLogApi extends BaseApi {
/**
* 服务对象
*/
@Resource
private BomNewLogService bomNewLogService;
/**
* 分页查询所有数据
*
* @param query Query 查询实体
* @return 所有数据
*/
@PostMapping("getListByPage")
@ApiOperation("auto-获取日志")
public ResultVO<IPage<BomNewLogEntity>> selectBomNewLogEntityPageByCondition(@RequestBody BomNewLogQuery query) {
return ResultVO.success(bomNewLogService.getListByPage(query));
}
}

View File

@ -199,7 +199,7 @@ public class PBomApi extends BaseApi {
@PostMapping("getAllocationFactoryBom")
@ApiOperation("分工厂-获取BOM树")
public ResultVO<List<BomNewPbomParentVO> > getAllocationFactoryBom(@Valid @RequestBody AllocationFactoryBomQuery param ) throws ExecutionException, InterruptedException {
return ResultVO.success(bomNewPbomParentService.getAllocationFactoryBom(param));
return ResultVO.success(bomNewPbomParentService.getAllocationFactoryBomTree(param));
}

View File

@ -13,7 +13,7 @@ public enum VirtualPackageTypeEnum implements ValueEnum<Integer>{
DELIVERY_PACKAGE(1,"发货包","发货" ,"201101", ""),
MAKING_PACKAGE(2,"制作包","制作","201101",""),
DIRECT_DELIVERY_PACKAGE(4,"直发包","直发","201101","F"),
PRE_ASSEMBLY_PACKAGE(8,"发货前装配包","发货前装配","201201","Z");
PRE_ASSEMBLY_PACKAGE(8,"发货前装配包","发货前装配","200601","Z");
private final Integer value;
private final String description;

View File

@ -63,4 +63,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
void delBatch(@Param("rowIds") List<Long> rowIds);
void updateStateBatchByRowIds(@Param("status") Integer status, @Param("list") List<Long> list );
Integer checkIsRoot(@Param("materialNo") String materialNo);
Integer checkIsUserRoot(@Param("materialNo")String materialNo, @Param("jobNo")String jobNo);
}

View File

@ -1,8 +1,10 @@
package com.nflg.product.bomnew.mapper.master;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.product.bomnew.pojo.entity.BomNewLogEntity;
import com.nflg.product.bomnew.pojo.query.BomNewLogQuery;
import org.apache.ibatis.annotations.Param;
/**
* t_bom_new_log 表数据库访问层
@ -12,4 +14,6 @@ import com.nflg.product.bomnew.pojo.entity.BomNewLogEntity;
* @since 2024-03-01 17:10:57
*/
public interface BomNewLogMapper extends BaseMapper<BomNewLogEntity> {
Page<BomNewLogEntity> getListByPage(Page<BomNewLogQuery> page , @Param("query") BomNewLogQuery query);
}

View File

@ -48,6 +48,11 @@ public interface BomNewMbomParentMapper extends BaseMapper<BomNewMbomParentEntit
BomNewMbomMiddleVO getParentById(@Param("rowId") Long rowId );
/**
* 将MBOM迁移到历史表
*/
void insertMBomIntoHistory(@Param("rowId") Long rowId);
}

View File

@ -45,4 +45,8 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
List<BomNewPbomParentVO> getChildForMaterialNoSeach(@Param("userFac") String userFac,@Param("materialNoList") List<String> materialNoList,@Param("materialNo")String materialNo);
Integer checkIsRoot(@Param("materialNo")String materialNo);
Integer checkIsUserRoot(@Param("materialNo") String materialNo, @Param("jobNo") String jobNo);
}

View File

@ -15,7 +15,7 @@ import java.time.LocalDate;
*
*
* @author makejava
* @since 2024-03-01 17:10:57
* @since 2024-03-06 08:31:13
*/
@Data
@Accessors(chain = true)
@ -31,10 +31,17 @@ public class BomNewLogEntity implements Serializable {
private Long rowId;
/**
* 操作行ID
* 模块名称
*/
@TableField(value = "model_name")
@ApiModelProperty(value = "模块名称")
private String modelName;
/**
* 操作行标识-对应bizNo
*/
@TableField(value = "op_biz_no")
@ApiModelProperty(value = "操作行标识")
@ApiModelProperty(value = "操作行标识-对应bizNo")
private String opBizNo;
/**
@ -78,14 +85,14 @@ public class BomNewLogEntity implements Serializable {
@TableField(value = "op_time")
@ApiModelProperty(value = "操作时间")
private LocalDateTime opTime;
/**
* 部门名称
*/
@TableField(value = "dpt_name")
@ApiModelProperty(value = "部门名称")
private String dptName;
@TableField(value = "dpt_name")
@ApiModelProperty(value = "部门名称")
private String dptName;
private static final long serialVersionUID = -52831510327211450L;
private static final long serialVersionUID = -56481813751074622L;
}

View File

@ -0,0 +1,61 @@
package com.nflg.product.bomnew.pojo.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* t_bom_new_log
*
*
* @author makejava
* @since 2024-03-06 08:30:05
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-query-BomNewLogEntityQuery")
public class BomNewLogQuery implements Serializable {
/**
* 模块名称
*/
@ApiModelProperty(value = "模块名称")
private String modelName;
@ApiModelProperty(value = "操作动作")
private String opAction;
@ApiModelProperty(value = "操作人名称")
private String opUserName;
@ApiModelProperty(value = "操作人工号")
private String opUserJobNo;
@ApiModelProperty(value = "操作时间开始时间")
private String startDate;
/**
* 结束操作时间
*/
@ApiModelProperty(value = "操作时间结束时间")
private LocalDateTime endDate;
/**
* 设置每页显示条数
*/
@ApiModelProperty(value = "设置每页显示条数")
private Long pageSize = 20L;
/**
* 当前页
*/
@ApiModelProperty(value = "当前页")
private Long page = 1L;
private static final long serialVersionUID = 1L;
}

View File

@ -132,7 +132,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
data.addAll(childs);
materialMainService.intiMaterialInfo(data, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
for (BomNewEbomParentVO vi : childs) {
if (StrUtil.isBlank(vi.getCurrentVersion()) && MaterialshouldBomExistUtil.checkShouldBomExist(vi)) {
if (StrUtil.isBlank(vi.getCurrentVersion()) && MaterialshouldBomExistUtil.checkShouldBomExist(vi)) {
vi.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
}
}
@ -429,7 +429,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
for (Long bomRowId : bomRowIds) {
List<BomNewEbomParentVO> data = getBomTree(bomRowId);
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
LogRecordContext.putVariable("bom",parent);
LogRecordContext.putVariable("bom", parent);
//初始化物料信息
materialMainService.intiMaterialInfo(data);
productTypeInitDo(parent, data);
@ -613,7 +613,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentVO> list = getChild(root.getRowId());
List<BomNewEbomParentVO> makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(makeList)) {
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
List<BomNewEbomChildEntity> preList = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, makeList.get(0).getBomRowId())
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()).list();
if (CollUtil.isNotEmpty(preList)) {
@ -636,14 +636,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* @param paramDto
*/
@Transactional(rollbackFor = Exception.class)
public void generateVirtualPackage(VirtualPackageParamDto paramDto) {
public void generateVirtualPackage(VirtualPackageParamDto paramDto) {
try {
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
LogRecordContext.putVariable("bom",root);
LogRecordContext.putVariable("bom", root);
//初始化虚拟包-判断枚举不是手工生成虚拟包的情况
checkAndInitVirtualPackageEnum(paramDto,root);
checkAndInitVirtualPackageEnum(paramDto, root);
Boolean flag = true;
for (Integer f : paramDto.getVirtualPackageValue()) {
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
@ -704,6 +704,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
}
//标记跟节点
upRootMark(parent);
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
//先删除
Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
@ -738,14 +740,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
}
//子级记录-bom版本
List<BomNewEbomChildEntity> bomChildren=new ArrayList<>();
bomTree.forEach(k->{
BomNewEbomChildEntity entChild=new BomNewEbomChildEntity();
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
bomTree.forEach(k -> {
BomNewEbomChildEntity entChild = new BomNewEbomChildEntity();
entChild.setRowId(k.getRowId());
entChild.setBomVersionRowId(k.getBomRowId());
bomChildren.add(entChild);
});
if(CollUtil.isNotEmpty(bomChildren)) {
if (CollUtil.isNotEmpty(bomChildren)) {
ebomChildService.updateBatchById(bomChildren);
}
@ -754,6 +756,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
}
private void upRootMark(BomNewEbomParentVO parent){
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
Integer userRootIs=this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(),parent.getCreatedBy());
BomNewEbomParentEntity ebomParent=new BomNewEbomParentEntity();
ebomParent.setRowId(parent.getRowId());
ebomParent.setRootIs(rootIs>0?0:1);
ebomParent.setUserRootIs(userRootIs>0?0:1);
this.updateById(ebomParent);
}
/**
* 发起变更
*
@ -764,36 +778,42 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, paramDTO.getBomRowIds()).list();
List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList());
VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更");
//检查是否存在发布前的版本有则不能发起变更
List<String> materialNos = list.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
Set<String> existMaterialNos = existEnt.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
VUtils.isTure(CollUtil.isNotEmpty(existMaterialNos)).throwMessage(StrUtil.join(",", existMaterialNos, "存在发布前版本。"));
List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
List<BomNewEbomChildEntity> childResult = new ArrayList<>();
for (Long bomRowId : paramDTO.getBomRowIds()) {
BomNewEbomParentEntity parent = this.getById(bomRowId);
LogRecordContext.putVariable("bom",parent);
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
//含发布前版本则无需升级
if (CollUtil.isEmpty(existEnt)) {
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
BeanUtil.copyProperties(parent, newParent);
newParent.setRowId(IdWorker.getId());
newParent.setLastVersionIs(1);
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
newParent.setChangeDesc(paramDTO.getChangeDesc());
newParent.setNoticeNums(paramDTO.getNoticeNums());
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
parent.setLastVersionIs(0);
parentResult.add(newParent);
parentResult.add(parent);
for (BomNewEbomChildEntity childEnt : child) {
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
BeanUtil.copyProperties(childEnt, newChild);
newChild.setRowId(IdWorker.getId());
newChild.setParentRowId(newParent.getRowId());
childResult.add(newChild);
}
LogRecordContext.putVariable("bom", parent);
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
BeanUtil.copyProperties(parent, newParent);
newParent.setRowId(IdWorker.getId());
newParent.setLastVersionIs(1);
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
newParent.setChangeDesc(paramDTO.getChangeDesc());
newParent.setNoticeNums(paramDTO.getNoticeNums());
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
newParent.setRootIs(1);
newParent.setUserRootIs(1);
parent.setLastVersionIs(0);
parentResult.add(newParent);
parentResult.add(parent);
for (BomNewEbomChildEntity childEnt : child) {
BomNewEbomChildEntity newChild = new BomNewEbomChildEntity();
BeanUtil.copyProperties(childEnt, newChild);
newChild.setRowId(IdWorker.getId());
newChild.setParentRowId(newParent.getRowId());
childResult.add(newChild);
}
}
if (CollUtil.isNotEmpty(parentResult)) {
@ -1047,7 +1067,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
VUtils.isTure(true).throwMessage("下级BOM无法进行退回");
}
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
LogRecordContext.putVariable("log",materialNoAndVersion);
LogRecordContext.putVariable("log", materialNoAndVersion);
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
@ -1154,7 +1174,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
VUtils.isTure(true).throwMessage("下级BOM无法进行复核");
}
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
LogRecordContext.putVariable("log",materialNoAndVersion);
LogRecordContext.putVariable("log", materialNoAndVersion);
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
VUtils.isTure(true).throwMessage("数据中包含有下级BOM无法进行复核");
@ -1274,7 +1294,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
parentVO.setBomRowId(parentVO.getRowId());
parentVO.setParentRowId(0l);
parentVO.setProjectType(projectType);
@ -1282,8 +1301,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
@ -1405,7 +1422,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(bomRowId);
LogRecordContext.putVariable("bom",parentEntity);
LogRecordContext.putVariable("bom", parentEntity);
VUtils.isTure(Objects.isNull(parentEntity)).throwMessage("该节点不存在,请检查参数是否正确");
@ -1441,28 +1458,29 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 2. 只有含有BOM的物料才可以打超级物料的标签如果不存在下级BOM时不可以打标
* 3. 需求编辑页面需要添加一个是否为超级物料的选项属于一个打标签的功能
* 2. 只有含有BOM的物料才可以打超级物料的标签如果不存在下级BOM时不可以打标
* 3. 需求编辑页面需要添加一个是否为超级物料的选项属于一个打标签的功能
*
* @param datas
*/
private void superMaterialStatus( List<BomNewEbomParentVO> datas){
private void superMaterialStatus(List<BomNewEbomParentVO> datas) {
List<BomNewEbomParentVO> superTagList=datas.stream().filter(item-> item.getSuperMaterialStatus()!=null
// && item.getSuperMaterialStatus().equals(EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())
&& item.getBomRowId()!=null && item.getBomRowId().longValue()>0
List<BomNewEbomParentVO> superTagList = datas.stream().filter(item -> item.getSuperMaterialStatus() != null
// && item.getSuperMaterialStatus().equals(EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())
&& item.getBomRowId() != null && item.getBomRowId().longValue() > 0
).collect(Collectors.toList());
List<BomNewEbomParentEntity> updateList=new ArrayList<>();
for (BomNewEbomParentVO vo:superTagList){
BomNewEbomParentEntity entity=new BomNewEbomParentEntity();
List<BomNewEbomParentEntity> updateList = new ArrayList<>();
for (BomNewEbomParentVO vo : superTagList) {
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
entity.setRowId(vo.getBomRowId());
entity.setSuperMaterialStatus(vo.getSuperMaterialStatus());
updateList.add(entity);
}
if(CollectionUtil.isNotEmpty(updateList)){
this.updateBatchById(updateList);
}
if (CollectionUtil.isNotEmpty(updateList)) {
this.updateBatchById(updateList);
}
}
@ -1748,11 +1766,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void createOrder(){
BomNewEbomParentEntity ent=new BomNewEbomParentEntity();
public void createOrder() {
BomNewEbomParentEntity ent = new BomNewEbomParentEntity();
ent.setDrawingNo("testDrawingNo");
ent.setCurrentVersion("V001");
LogRecordContext.putVariable("bom",ent);
LogRecordContext.putVariable("bom", ent);
}

View File

@ -1,8 +1,12 @@
package com.nflg.product.bomnew.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.bomnew.mapper.master.BomNewLogMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewLogEntity;
import com.nflg.product.bomnew.pojo.query.BomNewLogQuery;
import org.springframework.stereotype.Service;
@ -11,9 +15,14 @@ import org.springframework.stereotype.Service;
*
*
* @author makejava
* @since 2024-03-01 17:10:57
* @since 2024-03-06 08:30:03
*/
@Service
public class BomNewLogService extends ServiceImpl<BomNewLogMapper, BomNewLogEntity> {
public IPage<BomNewLogEntity> getListByPage(BomNewLogQuery query){
Page<BomNewLogQuery> page=new Page<>(query.getPage(),query.getPageSize());
return this.getBaseMapper().getListByPage(page,query);
}
}

View File

@ -592,12 +592,19 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
return CTreePBomUtils.toTree(bomRowId, allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
}
public List<BomNewPbomParentVO> getAllocationFactoryBom(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 1);
public List<BomNewPbomParentVO> getAllocationFactoryBomTree(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 0);
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return CTreePBomUtils.toTree(param.getBomRowId(), allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
}
public List<BomNewPbomParentVO> getAllocationFactoryBom(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 1);
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return allBom;
}
@Transactional(rollbackFor = Exception.class)
public Boolean saveAllocationFactory(List<SaveAllocationFactoryDTO> params) {
@ -616,17 +623,21 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
public Boolean saveAllocationFactoryNew(AllocationFactoryParam params) {
VUtils.isTure(CollUtil.isEmpty(params.getData())).throwMessage("分配工厂数据为空");
//按分配的工厂分组
if(BooleanEnum.TRUE.equals(params.getSetSubNode()) ){
if( params.getSetSubNode().equals(0) ){
return saveAllocationFactory(params.getData());
}else {
params.getData().forEach(k->{
try {
List<BomNewPbomParentVO> allBom = this.getAllBomTree(k.getBomRowId());
List<Long> rowIds = allBom.stream().map(u -> u.getRowId()).collect(Collectors.toList());
AllocationFactoryBomQuery query=new AllocationFactoryBomQuery();
query.setBomRowId(k.getBomRowId());
List<BomNewPbomParentVO> allBom = this.getAllocationFactoryBom(query);
List<Long> rowIds =new ArrayList<>();
rowIds.add(k.getRowId());
rowIds.addAll(allBom.stream().map(u -> u.getRowId()).collect(Collectors.toList()));
if(CollUtil.isNotEmpty(rowIds)) {
pbomChildService.getBaseMapper().setProductionFactoryCode(k.getProductionFactoryCode(), rowIds);
}
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
@ -885,6 +896,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
//检查物料是否被冻结
materialMainService.checkMaterialFreeze(allBom);
//更新root标志
upRootMark(parent);
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
Integer state = (parent.getMaterialNo().startsWith("31") && parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)) ? PBomStatusEnum.WAIT_FACTORY.getValue() : PBomStatusEnum.PUBLISH.getValue();
@ -913,6 +926,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
private void upRootMark(BomNewPbomParentEntity parent){
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
Integer userRootIs=this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(),parent.getCreatedBy());
parent.setRootIs(rootIs>0?0:1);
parent.setUserRootIs(userRootIs>0?0:1);
this.updateById(parent);
}
private void importSap(BomNewPbomParentEntity parent, List<BomNewPbomParentVO> children) {

View File

@ -80,11 +80,11 @@ public abstract class VirtualPackageBase {
* @param virtualPackageTypeEnums
* @return
*/
protected void generateVMNoF21(String materialDesc, List<BomNewEbomParentVO> child,VirtualPackageTypeEnum ... virtualPackageTypeEnums){
protected void generateVMNoF21(String parentDrawingNo, List<BomNewEbomParentVO> child,VirtualPackageTypeEnum ... virtualPackageTypeEnums){
List<AddVirtrualMaterialDTO> params=new ArrayList<>();
for ( BomNewEbomParentVO ch: child ) {
for (VirtualPackageTypeEnum vpy : virtualPackageTypeEnums) {
String vDrawingNo = String.join("","(",materialDesc,")","(",vpy.getConMaterialName(),")" );
String vDrawingNo = String.join("",parentDrawingNo,".FHQ","(",ch.getMaterialName(),")","(",vpy.getConMaterialName(),")");
params.add(buildAddMaterialParamDo(StrUtil.join("",ch.getRowId().toString(), vpy.getConMaterialName()), vDrawingNo, vDrawingNo, vpy));
}
}

View File

@ -1,16 +1,11 @@
package com.nflg.product.bomnew.service.domain.EBom;
import cn.hutool.core.convert.Convert;
import cn.hutool.extra.spring.SpringUtil;
import com.google.common.collect.ImmutableList;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.service.BomNewEbomParentService;
import nflg.product.common.constant.STATE;
import java.io.IOException;
import java.util.List;
@ -45,10 +40,10 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent );
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
generateVMNoF21(parent.getMaterialDesc(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
generateVMNoF21(parent.getDrawingNo(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
}
else {
generateVMNoF21(parent.getMaterialDesc(),ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
generateVMNoF21(parent.getDrawingNo(),ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
}

View File

@ -77,21 +77,26 @@ public class ConvertToMBomBase {
protected BomNewMbomParentEntity buildMBomParent(String facCode) {
BomNewMbomParentEntity mBomParent = new BomNewMbomParentEntity();
BeanUtil.copyProperties(parent, mBomParent);
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo())
.eq(BomNewMbomParentEntity::getLastVersionIs, 1).eq(BomNewMbomParentEntity::getFacCode, facCode).one();
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewMbomParentEntity::getFacCode, facCode)
.last(" order by current_version desc limit 1").one();
if (Objects.nonNull(oldParent)) {
if (MBomConstantEnum.MBomStatusEnum.PUB_SAP.equalsValue(oldParent.getStatus())) {
//将数据迁移到历史表
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().insertMBomIntoHistory(oldParent.getRowId());
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
oldParent.setLastVersionIs(0);
this.mBomParentResult.add(oldParent);
mBomParent.setCurrentVersion(VersionUtil.getMBomNextVersion(oldParent.getCurrentVersion()));
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().deleteByMap(ImmutableMap.of("bom_row_id", oldParent.getRowId()));
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().deleteById(oldParent.getRowId());
// oldParent.setLastVersionIs(0);
// this.mBomParentResult.add(oldParent);
} else {
SpringUtil.getBean(BomNewMbomDetailService.class).getBaseMapper().deleteByMap(ImmutableMap.of("bom_row_id", oldParent.getRowId()));
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().deleteById(oldParent.getRowId());
mBomParent.setCurrentVersion(oldParent.getCurrentVersion());
}
} else {
mBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
mBomParent.setCurrentVersion(VersionUtil.getMBomNextVersion(""));
}
mBomParent.setRowId(IdWorker.getId());
mBomParent.setFacCode(facCode);

View File

@ -1,13 +1,17 @@
package com.nflg.product.bomnew.service.domain.PBom;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.PBomStatusEnum;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.service.BomNewPbomParentService;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
import lombok.Getter;
@ -15,12 +19,14 @@ import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import com.nflg.product.bomnew.util.ListCommonUtil;
/**
* 升级变更
*/
public class PBomUpgrade {
private BomNewPbomParentEntity root;
private BomNewPbomParentEntity root;
private List<BomNewPbomParentVO> allBom;
@ -31,44 +37,66 @@ public class PBomUpgrade {
private List<BomNewPbomChildEntity> childResult;
public PBomUpgrade (BomNewPbomParentEntity root,List<BomNewPbomParentVO> allBom) {
public PBomUpgrade(BomNewPbomParentEntity root, List<BomNewPbomParentVO> allBom) {
this.root = root;
this.allBom = allBom;
BomNewPbomParentVO rootVo = Convert.convert(BomNewPbomParentVO.class, root);
rootVo.setBomRowId(rootVo.getRowId());
allBom.add(rootVo);
//allBom.add(rootVo);
}
public void upgrade(){
public void upgrade() {
//
for (BomNewPbomParentVO parentEnt :allBom) {
if( parentEnt.getStatus()>=PBomStatusEnum.PUBLISH.getValue()) {
buildParent(parentEnt);
}
check();
//处理根节点
BomNewPbomParentVO rootVo = Convert.convert(BomNewPbomParentVO.class, root);
rootVo.setBomRowId(rootVo.getRowId());
buildParent(rootVo,true);
List<BomNewPbomParentVO> parents = allBom.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
List<BomNewPbomParentVO> distinctParents = ListCommonUtil.toDistinct(parents, BomNewPbomParentVO::getBomRowId);
for (BomNewPbomParentVO parentEnt : distinctParents) {
if (parentEnt.getStatus() >= PBomStatusEnum.PUBLISH.getValue()) {
buildParent(parentEnt,false);
}
}
}
private void buildParent(BomNewPbomParentVO parentVO){
BomNewPbomParentEntity pbomParent=new BomNewPbomParentEntity();
BeanUtil.copyProperties(parentVO,pbomParent);
/**
* 父表-不能有待发布的Pbom
*/
private void check() {
List<BomNewPbomParentEntity> waitPublishList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, root.getMaterialNo())
.eq(BomNewPbomParentEntity::getFacCode, root.getMaterialNo())
.lt(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue()).list();
VUtils.isTure(CollUtil.isNotEmpty(waitPublishList)).throwMessage(root.getMaterialNo() + "存在待发布的版本,无法升级");
}
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
BomNewPbomParentEntity pbomParent = new BomNewPbomParentEntity();
BeanUtil.copyProperties(parentVO, pbomParent);
pbomParent.setRowId(IdWorker.getId());
pbomParent.setCreatedTime(LocalDateTime.now());
pbomParent.setCreatedBy(SessionUtil.getRealName());
pbomParent.setModifyTime(LocalDateTime.now());
pbomParent.setStatus(PBomStatusEnum.WAIT_PUBLISH.getValue());
pbomParent.setCurrentVersion(VersionUtil.getNextVersion(parentVO.getCurrentVersion()));
if (rootIs) {
pbomParent.setRootIs(1);
pbomParent.setUserRootIs(1);
}
this.parentResult.add(pbomParent);
buildChild(parentVO,pbomParent);
buildChild(parentVO, pbomParent);
}
private void buildChild(BomNewPbomParentVO oldParent, BomNewPbomParentEntity newParent){
private void buildChild(BomNewPbomParentVO oldParent, BomNewPbomParentEntity newParent) {
List<BomNewPbomParentVO> chilren = allBom.stream().filter(u -> u.getParentRowId().equals(oldParent.getBomRowId())).collect(Collectors.toList());
for (BomNewPbomParentVO childVO : chilren) {
BomNewPbomChildEntity child=new BomNewPbomChildEntity();
BeanUtil.copyProperties(childVO,child);
BomNewPbomChildEntity child = new BomNewPbomChildEntity();
BeanUtil.copyProperties(childVO, child);
child.setRowId(IdWorker.getId());
child.setParentRowId(newParent.getRowId());
child.setCreatedTime(LocalDateTime.now());
@ -82,5 +110,4 @@ public class PBomUpgrade {
}
}

View File

@ -22,6 +22,7 @@ public class DbLogRecordServiceImpl implements ILogRecordService {
BomNewLogEntity logEnt=new BomNewLogEntity();
logEnt.setRowId(IdWorker.getId());
logEnt.setModelName(logRecord.getTenant());
logEnt.setOpBizNo(logRecord.getBizNo());
logEnt.setOpAction(logRecord.getType());
logEnt.setOpContent(logRecord.getAction());

View File

@ -19,6 +19,8 @@ public class VersionUtil {
static final String versionPrefix = "A";
static final String mBomVersionPrefix = "B";
/**
* 获取下一个版本号(大版本)
*/
@ -32,6 +34,15 @@ public class VersionUtil {
}
public static String getMBomNextVersion(String preVersion) {
if (StrUtil.isBlank(preVersion)) {
return mBomVersionPrefix + "00";
}
Integer versionNum = Convert.toInt(StrUtil.replace(preVersion, mBomVersionPrefix, "")) + 1;
return mBomVersionPrefix + StrUtil.padPre(versionNum.toString(), 2, '0');
}
/**
* 获取下一个小版本号(小版本)
*/

View File

@ -95,7 +95,7 @@
<!--物料编码搜索-父级-->
<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
FROM t_bom_new_ebom_parent a where a.last_version_is=1 and a.status &lt; 4 and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
@ -104,11 +104,11 @@
<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.*
c.source, if(c.row_id is null,0,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 ( b.material_no in
where a.last_version_is=1 and a.status &lt; 4 and ( b.material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
@ -215,4 +215,17 @@
#{item}
</foreach>
</update>
<!--检查是否已发布数据的跟节点-->
<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
and b.material_no=#{materialNo}
</select>
<!--检查是否已发布数据的用户跟节点-->
<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
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
</select>
</mapper>

View File

@ -6,18 +6,42 @@
<!--@mbg.generated-->
<!--@Table t_bom_new_log -->
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
<result column="op_biz_no" property="opBizNo" jdbcType="BIGINT"/>
<result column="model_name" property="modelName" jdbcType="VARCHAR"/>
<result column="op_biz_no" property="opBizNo" jdbcType="VARCHAR"/>
<result column="op_action" property="opAction" jdbcType="VARCHAR"/>
<result column="op_content" property="opContent" jdbcType="VARCHAR"/>
<result column="op_content_ext" property="opContentExt" jdbcType="VARCHAR"/>
<result column="op_user_job_no" property="opUserJobNo" jdbcType="VARCHAR"/>
<result column="op_user_name" property="opUserName" jdbcType="VARCHAR"/>
<result column="op_time" property="opTime" jdbcType="TIMESTAMP"/>
<result column="dpt_name" property="dptName" jdbcType="VARCHAR" />
<result column="dpt_name" property="dptName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
row_id, op_biz_no, op_action, op_content, op_content_ext, op_user_job_no, op_user_name, op_time ,dpt_name </sql>
row_id, model_name, op_biz_no, op_action, op_content, op_content_ext, op_user_job_no, op_user_name, op_time, dpt_name </sql>
<sql id="whr">
<if test="query.modelName!=null and query.modelName!=''">
and model_name like concat('%',#{query.modelName},'%')
</if>
<if test="query.opAction!=null and query.opAction!=''">
and op_action like concat('%',#{query.opAction},'%')
</if>
<if test="query.opUserName!=null and query.opUserName!=''">
and op_user_name =#{query.opUserName}
</if>
<if test="query.opUserJobNo!=null and query.opUserJobNo!=''">
and op_user_job_no =#{query.opUserJobNo}
</if>
<if test="query.startDate!=null and query.startDate!=''">
and op_time &gt;= #{query.startDate} and op_time &lt;= #{query.endDate}
</if>
</sql>
<select id="getListByPage" resultType="com.nflg.product.bomnew.pojo.entity.BomNewLogEntity">
select * from t_bom_new_log where 1=1
<include refid="whr"/>
order by op_time desc
</select>
</mapper>

View File

@ -187,5 +187,16 @@
</select>
<!--将MBOM迁移到历史表-->
<insert id="insertMBomIntoHistory">
INSERT INTO `nflg`.`t_bom_new_mbom_parent_history` (`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`, `last_version_is`, `status`, `sysn_sap_user_name`, `sysn_sap_time`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_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`, `last_version_is`, `status`, `sysn_sap_user_name`, `sysn_sap_time`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `expire_end_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `order_no`, `modify_time` from t_bom_new_mbom_parent where row_id=#{rowId};
INSERT INTO `nflg`.`t_bom_new_mbom_detail_history` (`row_id`, `bom_row_id`, `parent_row_id`, `drawing_no`, `fac_code`, `material_no`, `current_version`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `num`, `project_type`, `super_material_status`, `virtual_part_is`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `modify_time`, `material_back_status`, `virtual_part_type`)
select `row_id`, `bom_row_id`, `parent_row_id`, `drawing_no`, `fac_code`, `material_no`, `current_version`, `order_number`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `unit_weight`, `total_weight`, `num`, `project_type`, `super_material_status`, `virtual_part_is`, `source_row_id`, `devise_user_code`, `devise_name`, `created_by`, `created_time`, `remark`, `dept_name`, `level_num`, `change_desc`, `notice_nums`, `modify_time`, `material_back_status`, `virtual_part_type` from t_bom_new_mbom_detail where bom_row_id=#{rowId};
</insert>
</mapper>

View File

@ -173,7 +173,7 @@
<!--物料编码搜索-父级-->
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
SELECT created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_pbom_parent a where a.last_version_is=1
FROM t_bom_new_pbom_parent a where a.last_version_is=1 and a.status=1
<if test="userFac!=null and userFac!=''">
and fac_code=#{userFac}
</if> and material_no in
@ -189,7 +189,7 @@
from t_bom_new_pbom_parent a
join t_bom_new_pbom_child b on a.row_id =b.parent_row_id
left join t_bom_new_pbom_parent c on b.material_no=c.material_no and b.fac_code=c.fac_code and c.last_version_is=1
where a.last_version_is=1
where a.last_version_is=1 and a.status=1
<if test="userFac!=null and userFac!=''">
and a.fac_code=#{userFac}
</if>
@ -201,6 +201,18 @@
</select>
<!--检查是否已发布数据的跟节点-->
<select id="checkIsRoot" resultType="java.lang.Integer">
select COUNT(1) 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=#{materialNo}
</select>
<!--检查是否已发布数据的用户跟节点-->
<select id="checkIsUserRoot" resultType="java.lang.Integer">
select COUNT(1) 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=#{materialNo} and b.created_by=#{jobNo}
</select>
</mapper>

View File

@ -85,7 +85,7 @@ public class SessionUtil {
}
public static String getLanguage() {
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getLanguage).orElse(null);
return Optional.ofNullable(loginUser.get()).map(LoginUserInfoDTO::getLanguage).orElse("");
}
public static String getSessionKey() {