Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
716ff8fe32
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewMbomParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO;
|
||||
|
|
@ -71,6 +72,9 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
page.getRecords().add(parent);
|
||||
}
|
||||
|
||||
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(page.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
|
@ -79,6 +83,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
//不是通过物料或图号搜索
|
||||
page = this.getBaseMapper().getMBomListPage(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(page.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
|
||||
|
||||
return page;
|
||||
|
|
@ -113,6 +118,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
|||
});
|
||||
}
|
||||
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(listChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
|
||||
return listChild;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -158,7 +159,8 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
|
|||
}
|
||||
|
||||
} else if (StringUtils.isNotEmpty(query.getDrawingNo())) {
|
||||
materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
|
||||
materialMainList = materialMainService.lambdaQuery().likeRight(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
|
||||
|
||||
if (CollUtil.isEmpty(materialMainList)) {
|
||||
throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 图号的物料信息不存在", query.getDrawingNo()));
|
||||
}
|
||||
|
|
@ -224,6 +226,19 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
|
|||
if(parentRow==null){
|
||||
throw new NflgBusinessException(STATE.Error,"添加的数据未查询到父节点");
|
||||
}
|
||||
|
||||
Map<String,List<OptionalMbomMaterialListVO>> frequencyMap= dto.getDatas().stream().collect(Collectors.groupingBy(OptionalMbomMaterialListVO::getMaterialNo));
|
||||
|
||||
frequencyMap.forEach((key,value)->{
|
||||
List<OptionalMbomMaterialListVO> list= frequencyMap.get(key);
|
||||
if(list.size()>1){
|
||||
throw new NflgBusinessException(STATE.Error,StrUtil.format("{} 物料编码重复",key));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
List<OptionalMbomMaterialEntity> entityList=Convert.convert(new TypeReference<List<OptionalMbomMaterialEntity>>(){
|
||||
|
||||
},dto.getDatas());
|
||||
|
|
@ -232,7 +247,10 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
|
|||
entityList.forEach(item->{
|
||||
item.setParentRowId(dto.getRowId());
|
||||
item.setRootRowId(parentRow.getRootRowId());
|
||||
if(Objects.isNull(item.getRowId()) || item.getRowId().longValue() == 0){
|
||||
item.setCreatedTime(DateUtil.now());
|
||||
}
|
||||
|
||||
item.setCreatedBy(SessionUtil.getUserCode());
|
||||
item .setRealName(SessionUtil.getRealName());
|
||||
item .setDeptName(SessionUtil.getDepartName());
|
||||
|
|
|
|||
Loading…
Reference in New Issue