Browse Source

2024-10-11

优化
master
fengyuan_yang 1 year ago
parent
commit
38f04f2ad0
  1. 22
      src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java

22
src/main/java/com/spring/modules/part/service/impl/PartInformationServiceImpl.java

@ -384,6 +384,28 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
String msg = String.valueOf(resultMap.get("resultMsg"));
throw new XJException(msg, Integer.parseInt(code));
}
// 根据单位校验密度
UmInformationEntity um = umInformationMapper.selectOne(new QueryWrapper<UmInformationEntity>().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<MasterPartInformationEntity>().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();

Loading…
Cancel
Save