Browse Source

2024-08-07

产品数据管理3
java8
fengyuan_yang 1 year ago
parent
commit
bea350838a
  1. 28
      src/main/java/com/xujie/sys/modules/part/service/impl/PartInformationServiceImpl.java

28
src/main/java/com/xujie/sys/modules/part/service/impl/PartInformationServiceImpl.java

@ -609,33 +609,25 @@ public class PartInformationServiceImpl extends ServiceImpl<PartInformationMappe
@Transactional
public void copyPart(PartInformationVo inData) {
// 校验该物料是否存在
PartInformationEntity partInformationEntity = partInformationMapper.selectOne(new QueryWrapper<PartInformationEntity>().eq("site", inData.getSite()).eq("part_no", inData.getPartNo()));
PartInformationEntity partInformationEntity = partInformationMapper.selectOne(new QueryWrapper<PartInformationEntity>().eq("site", inData.getSite()).eq("sourceBu", inData.getBuNo()).eq("part_no", inData.getPartNo()));
if (partInformationEntity != null) {
throw new RuntimeException("物料已存在!");
}
PartInformationEntity fromPart = partInformationMapper.selectOne(new QueryWrapper<PartInformationEntity>().eq("site", inData.getPreviousVersion().getSite()).eq("part_no", inData.getPreviousVersion().getPartNo()));
PartInformationEntity fromPart = partInformationMapper.selectOne(new QueryWrapper<PartInformationEntity>().eq("site", inData.getPreviousVersion().getSite()).eq("sourceBu", inData.getPreviousVersion().getBuNo()).eq("part_no", inData.getPreviousVersion().getPartNo()));
PartInformationEntity toPart = new PartInformationEntity();
BeanUtils.copyProperties(fromPart, toPart);
// if ("Y".equals(inData.getCopyGeneral())) {
// toPart.setPartType(fromPart.getPartType()); // 零件类型
// toPart.setUmId(fromPart.getUmId()); // 库存计量单位
// toPart.setCodeNo(fromPart.getCodeNo()); // 属性模板
// toPart.setCreateBy(inData.getCreateBy()); // 备注
// }
toPart.setSite(inData.getSite());
toPart.setBuNo(inData.getBuNo());
toPart.setPartNo(inData.getPartNo());
toPart.setPartDesc(inData.getPartDesc());
if ("Y".equals(inData.getCopyGeneral())) {
toPart.setPartType(fromPart.getPartType()); // 零件类型
toPart.setUmId(fromPart.getUmId()); // 库存计量单位
toPart.setCodeNo(fromPart.getCodeNo()); // 属性模板
toPart.setCreateBy(inData.getCreateBy()); // 备注
}
// 新增
partInformationMapper.insert(toPart);
if ("Y".equals(inData.getCopyDefaultLocation())) { // 新增物料默认库位
List<LocationInformationVo> fromLocationList = partInformationMapper.getFromPartLocation(fromPart);
if (!fromLocationList.isEmpty()) {
List<LocationInformationVo> ifsDefaultLocations = fromLocationList.stream().map(a -> {
a.setPartNo(toPart.getPartNo());
return a;
}).collect(Collectors.toList());
partInformationMapper.savePartDefaultLocation(ifsDefaultLocations);
}
}
}
/**

Loading…
Cancel
Save