| | |
| | | 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.*; |
| | | import com.vincent.rsf.server.manager.enums.CommonStatus; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.mapper.LocMapper; |
| | | import com.vincent.rsf.server.manager.mapper.LocTypeRelaMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | |
| | | |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaService locTypeRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaRelaService locAreaRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaService locAreaService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaMapper locTypeRelaMapper; |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @Override |
| | | public R modifyLocs(LocModifyParams locs) { |
| | | if (locs.getId().isEmpty()) { |
| | |
| | | if (!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty()) { |
| | | join = StringUtils.join(loc.getTypeIds(), ","); |
| | | } |
| | | boolean update = this.update(new LambdaUpdateWrapper<Loc>() |
| | | List<Loc> existsLocs = this.list(new LambdaQueryWrapper<Loc>() |
| | | .in(Loc::getId, locs.getId()) |
| | | .eq(Loc::getStatus, 1) |
| | | .set(!Objects.isNull(loc.getAreaId()), Loc::getAreaId, loc.getAreaId()) |
| | | .set(!Objects.isNull(loc.getWarehouseId()), Loc::getWarehouseId, loc.getWarehouseId()) |
| | | .set(!Objects.isNull(loc.getUseStatus()), Loc::getUseStatus, loc.getUseStatus()) |
| | | .set(!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty(), Loc::getType, join) |
| | | .set(!Objects.isNull(loc.getLength()), Loc::getLength, loc.getLength()) |
| | | .set(!Objects.isNull(loc.getWidth()), Loc::getWidth, loc.getWidth()) |
| | | .set(!Objects.isNull(loc.getHeight()), Loc::getHeight, loc.getHeight()) |
| | | .set(!Objects.isNull(loc.getChannel()), Loc::getChannel, loc.getChannel()) |
| | | .set(!Objects.isNull(loc.getFlagLabelMange()), Loc::getFlagLabelMange, loc.getFlagLabelMange()) |
| | | .set(!Objects.isNull(loc.getStatus()), Loc::getStatus, loc.getStatus())); |
| | | if (!update) { |
| | | .eq(Loc::getStatus, 1)); |
| | | if (existsLocs.isEmpty()) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | } |
| | | for (Loc currentLoc : existsLocs) { |
| | | if (!Objects.isNull(loc.getAreaId())) { |
| | | currentLoc.setAreaId(loc.getAreaId()); |
| | | } |
| | | if (!Objects.isNull(loc.getWarehouseId())) { |
| | | currentLoc.setWarehouseId(loc.getWarehouseId()); |
| | | } |
| | | if (!Objects.isNull(loc.getUseStatus())) { |
| | | currentLoc.setUseStatus(loc.getUseStatus()); |
| | | } |
| | | if (!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty()) { |
| | | currentLoc.setType(join); |
| | | } |
| | | if (!Objects.isNull(loc.getLength())) { |
| | | currentLoc.setLength(loc.getLength()); |
| | | } |
| | | if (!Objects.isNull(loc.getWidth())) { |
| | | currentLoc.setWidth(loc.getWidth()); |
| | | } |
| | | if (!Objects.isNull(loc.getHeight())) { |
| | | currentLoc.setHeight(loc.getHeight()); |
| | | } |
| | | if (!Objects.isNull(loc.getChannel())) { |
| | | currentLoc.setChannel(loc.getChannel()); |
| | | } |
| | | if (!Objects.isNull(loc.getFlagLabelMange())) { |
| | | currentLoc.setFlagLabelMange(loc.getFlagLabelMange()); |
| | | } |
| | | if (!Objects.isNull(loc.getStatus()) && loc.getStatus().equals(CommonStatus.COMMONSTATUS_NO.val)) { |
| | | currentLoc.setUseStatus(LocStsType.LOC_STS_TYPE_X.type); |
| | | } |
| | | if (!Objects.isNull(loc.getStatus())) { |
| | | currentLoc.setStatus(loc.getStatus()); |
| | | } |
| | | if (!this.updateById(currentLoc)) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | } |
| | | } |
| | | |
| | | return R.ok(loc); |
| | | } |