| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/8/18 |
| | | * @description: 物料信息同步 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(timeout = 30, rollbackFor = Exception.class) |
| | | public R syncMatGroups(List<SyncMatGroupsParams> matGroupsParams) { |
| | | List<MatnrGroup> syncMatGroups = new ArrayList<>(); |
| | | matGroupsParams.forEach(matGroupsParam -> { |
| | | MatnrGroup matnrGroup = new MatnrGroup(); |
| | | BeanUtils.copyProperties(matGroupsParam, matnrGroup); |
| | | if (Objects.isNull(matGroupsParam.getCode())) { |
| | | throw new CoolException("物料分组编码不能为空!!"); |
| | | } |
| | | if (Objects.isNull(matGroupsParam.getName())) { |
| | | throw new CoolException("分组名称不能为空!!"); |
| | | } |
| | | if (Objects.isNull(matGroupsParam.getParCode())) { |
| | | throw new CoolException("上级物料分组编码不能为空!!"); |
| | | } |
| | | syncMatGroups.add(matnrGroup); |
| | | }); |
| | | if (!matnrGroupService.saveBatch(syncMatGroups)) { |
| | | throw new CoolException("物料分组保存失败!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |