From 38f04f2ad0d572e374474f82e7fea53eadbbd4ea Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Fri, 11 Oct 2024 17:42:14 +0800 Subject: [PATCH] =?UTF-8?q?2024-10-11=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PartInformationServiceImpl.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java index cf016eae..1049764c 100644 --- a/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java +++ b/src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java @@ -384,6 +384,28 @@ public class PartInformationServiceImpl extends ServiceImpl().eq("um_id", data.getUmId())); + if (data.getDensity() != null && !("Weight".equals(um.getUmType()) || "Volume".equals(um.getUmType()))) { + throw new RuntimeException("单位类型为 Weight 或者 Volume 时才可设置密度!"); + } + + // 查询是否已存在 master part,没有就创建 + MasterPartInformationEntity masterPart = masterPartInformationMapper.selectOne(new QueryWrapper().eq("part_no", data.getPartNo())); + if (masterPart == null) { + // 创建 masterPart + MasterPartInformationEntity masterPartEntity = new MasterPartInformationEntity(); + masterPartEntity.setPartNo(data.getPartNo()); + masterPartEntity.setPartDesc(data.getPartDesc()); + masterPartEntity.setUmId(data.getUmId()); + masterPartEntity.setOfficialFlag("N"); + masterPartEntity.setCodeNo(data.getCodeNo()); + masterPartEntity.setLotTrackingCode("Not Lot Tracking"); + masterPartEntity.setLotQuantityRule("One Lot Per Production Order"); + masterPartEntity.setSubLotRule("No Sub Lots Allowed"); + masterPartEntity.setComponentLotRule("Many Lots Allowed"); + masterPartInformationMapper.insert(masterPartEntity); + } partInformationMapper.insert(data); // 创建物料的默认revision PartRevisionEntity partRevision = new PartRevisionEntity();