From 4a9d799535d8c5e66481ccc1e512db1fddb608ae Mon Sep 17 00:00:00 2001 From: jing's Date: Sun, 7 Jan 2024 17:00:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/constant/EBomConstant.java | 3 + .../service/BomNewMbomDetailService.java | 96 +++++++++++-------- 2 files changed, 58 insertions(+), 41 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java index 3dc8b171..1c1f28fc 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomConstant.java @@ -13,6 +13,9 @@ public class EBomConstant { //EBOM 获取时,初始化物料主数据信息是,忽略的字段 public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT = {"material", "materialTexture", "projectType", "materialUnit"}; + public static final String[] EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2 = {"material", "materialTexture", "projectType", "materialUnit","materialNo", + "materialName","materialDesc","drawingNo" + }; //集团总部代码 public static final String MAIN_FACTORY_CODE_1010="1010"; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomDetailService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomDetailService.java index 070933d2..5ac02c88 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomDetailService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomDetailService.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.nflg.product.base.core.exception.NflgBusinessException; +import com.nflg.product.bomnew.constant.EBomConstant; import com.nflg.product.bomnew.constant.MBomConstantEnum; import com.nflg.product.bomnew.mapper.master.BomNewMbomDetailMapper; import com.nflg.product.bomnew.pojo.entity.BomNewMbomDetailEntity; @@ -19,6 +20,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO; import nflg.product.common.constant.STATE; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.List; @@ -61,6 +63,8 @@ public class BomNewMbomDetailService extends ServiceImpl voList = Convert.convert(new TypeReference>() { }, list); + SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(voList, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2); + return voList; } @@ -74,6 +78,7 @@ public class BomNewMbomDetailService extends ServiceImpl queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l) +// .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); +// List list = this.list(queryWrapper); +// if (CollectionUtil.isNotEmpty(list)) { +// throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料"); +// } +// } else { +// //check 父级为超级物料 子级才能为超级物料 +// QueryWrapper queryParentWrapper = new QueryWrapper<>(); +// queryParentWrapper.lambda().eq(BomNewMbomDetailEntity::getRowId, entity.getParentRowId()); +// BomNewMbomDetailEntity parentDetail = this.getOne(queryParentWrapper); +// if (parentDetail == null) { +// throw new NflgBusinessException(STATE.Error, "数据异常联系管理员"); +// } +// if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) { +// throw new NflgBusinessException(STATE.Error, "父级不为超级物料,子级不能设置为超级物料"); +// } +// //check 同级不能多个超级物料 +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, entity.getParentRowId()) +// .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); +// List list = this.list(queryWrapper); +// if (CollectionUtil.isNotEmpty(list)) { +// throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料"); +// } +// +// } - //parentRowId 空情况 - if (Objects.isNull(entity.getParentRowId()) || entity.getParentRowId().longValue() == 0) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, 0l) - .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { - throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料"); - } - } else { - //check 父级为超级物料 子级才能为超级物料 - QueryWrapper queryParentWrapper = new QueryWrapper<>(); - queryParentWrapper.lambda().eq(BomNewMbomDetailEntity::getRowId, entity.getParentRowId()); - BomNewMbomDetailEntity parentDetail = this.getOne(queryParentWrapper); - if (parentDetail == null) { - throw new NflgBusinessException(STATE.Error, "数据异常联系管理员"); - } - if (!Objects.equals(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue(), parentDetail.getSuperMaterialStatus())) { - throw new NflgBusinessException(STATE.Error, "父级不为超级物料,子级不能设置为超级物料"); - } - //check 同级不能多个超级物料 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId, entity.getParentRowId()) - .eq(BomNewMbomDetailEntity::getSuperMaterialStatus, MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); - List list = this.list(queryWrapper); - if (CollectionUtil.isNotEmpty(list)) { - throw new NflgBusinessException(STATE.Error, "同级已有物料设置为超级物料"); - } + //取消 - } + UpdateWrapper updateWrapper=new UpdateWrapper<>(); + updateWrapper.lambda().set(BomNewMbomDetailEntity::getModifyTime,LocalDateTime.now()); + updateWrapper.lambda().set(BomNewMbomDetailEntity::getSuperMaterialStatus,MBomConstantEnum.MBomSuperMaterialStatusEnum.UN_SUPER.getValue()); + updateWrapper.lambda().eq(BomNewMbomDetailEntity::getParentRowId ,entity.getParentRowId()); + update(updateWrapper); + BomNewMbomDetailEntity uppdateBomNewMbomDetailEntity = new BomNewMbomDetailEntity(); uppdateBomNewMbomDetailEntity.setSuperMaterialStatus(MBomConstantEnum.MBomSuperMaterialStatusEnum.SUPER.getValue()); uppdateBomNewMbomDetailEntity.setModifyTime(LocalDateTime.now()); From be4d90159522a42579884e78bdbaad48a0564621 Mon Sep 17 00:00:00 2001 From: jing's Date: Sun, 7 Jan 2024 18:13:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bomnew/mapper/master/BomNewMbomParentMapper.java | 2 +- .../product/bomnew/service/BomNewMbomParentService.java | 2 +- .../resources/mapper/master/BomNewMbomParentMapper.xml | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewMbomParentMapper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewMbomParentMapper.java index a688f008..3532d4c1 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewMbomParentMapper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewMbomParentMapper.java @@ -44,7 +44,7 @@ public interface BomNewMbomParentMapper extends BaseMapper getParentChild(@Param("rowId") Long rowId ); + List getParentChild(@Param("rowId") Long rowId ,@Param("bomRowId") Long bomRowId); BomNewMbomMiddleVO getParentById(@Param("rowId") Long rowId ); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java index a92e9edc..061e446d 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java @@ -106,7 +106,7 @@ public class BomNewMbomParentService extends ServiceImpl listChild = this.getBaseMapper().getParentChild(_rowId); + List listChild = this.getBaseMapper().getParentChild(_rowId,dto.getBomRowId()); if (CollectionUtil.isNotEmpty(listChild)) { listChild.forEach(child -> { IndexListTree.sysnParentParam(parent, child); diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewMbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewMbomParentMapper.xml index 143f317d..0e1ecd1f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewMbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewMbomParentMapper.xml @@ -62,6 +62,7 @@ and fac_code=#{query.facCode} + @@ -112,6 +113,9 @@ left join t_bom_new_mbom_back_material as t2 on t1.row_id=t2.detail_row_id where t1.parent_row_id = #{rowId} + + and t1.bom_row_id=#{bomRowId} + order by t1.order_number @@ -138,7 +142,9 @@ on t1.bom_row_id=t2.row_id where t1.bom_row_id=t2.row_id and t2.last_version_is=1 - + + and t2.status=#{query.status} + and t1.fac_code=#{query.facCode}