| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.LocMastInitParam; |
| | | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; |
| | | import com.vincent.rsf.server.manager.entity.LocType; |
| | | import com.vincent.rsf.server.manager.entity.LocTypeRela; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.mapper.LocMapper; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.mapper.LocTypeRelaMapper; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.LocTypeRelaService; |
| | | import com.vincent.rsf.server.manager.service.LocTypeService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | |
| | | @Autowired |
| | | private LocTypeRelaService locTypeRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaRelaService locAreaRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaService locAreaService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaMapper locTypeRelaMapper; |
| | |
| | | if (!update) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | } |
| | | return R.ok("操作成功!!"); |
| | | |
| | | return R.ok(loc); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public boolean saveType(Loc loc) { |
| | | |
| | | List<LocTypeRela> relas = new ArrayList<>(); |
| | | loc.getTypeIds().forEach(id -> { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | |
| | | @Override |
| | | public boolean updateLoc(Loc loc) { |
| | | locTypeRelaMapper.delete(new LambdaQueryWrapper<LocTypeRela>().eq(LocTypeRela::getLocId, loc.getId())); |
| | | |
| | | List<LocTypeRela> relas = new ArrayList<>(); |
| | | loc.getTypeIds().forEach(id -> { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public R batchBindLocs(LocModifyParams locs) { |
| | | if (locs.getId().isEmpty()) { |
| | | throw new CoolException("库位ID不能为空!!"); |
| | | } |
| | | Loc loc = locs.getLoc(); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId())); |
| | | if (locAreas.isEmpty()) { |
| | | throw new CoolException("库位分区不存在!!"); |
| | | } |
| | | List<LocAreaRela> relas = new ArrayList<>(); |
| | | locs.getId().forEach(id -> { |
| | | LocAreaRela locAreaRela = new LocAreaRela(); |
| | | locAreaRela.setLocId(id).setLocAreaId(locs.getLocAreaId()); |
| | | relas.add(locAreaRela); |
| | | }); |
| | | if (!locAreaRelaService.saveBatch(relas)) { |
| | | throw new CoolException("库位分区失败!!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |