|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.Cools; | 
|---|
|  |  |  | import com.vincent.rsf.framework.common.R; | 
|---|
|  |  |  | import com.vincent.rsf.framework.exception.CoolException; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.controller.dto.LocStockDto; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.controller.dto.LocUsageDto; | 
|---|
|  |  |  | 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.mapper.LocTypeRelaMapper; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.service.*; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.vincent.rsf.server.manager.utils.Shelves; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocTypeRelaMapper locTypeRelaMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocService locService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R modifyLocs(LocModifyParams locs) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String join = StringUtils.join(param.getTypeIds(), ","); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String[] split = warehouseAreas.getCode().split("\\."); | 
|---|
|  |  |  | if (split.length == 0){ | 
|---|
|  |  |  | throw new CoolException("库区编码错误!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | StringBuilder locStar = new StringBuilder(); | 
|---|
|  |  |  | for (int i = 0; i < split.length; i++) { | 
|---|
|  |  |  | locStar.append(split[i]).append("-"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<Loc> list = new ArrayList<>(); | 
|---|
|  |  |  | Integer chanl = 0; //默认第一巷道 | 
|---|
|  |  |  | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(),param.getStartRow()); | 
|---|
|  |  |  | for (List<Integer> node : shelves.nodes){ | 
|---|
|  |  |  | if (node.contains(r)) { | 
|---|
|  |  |  | if (!Cools.isEmpty(param.getStartChannel()) && param.getStartChannel() > 0){ | 
|---|
|  |  |  | chanl = shelves.nodes.indexOf(node) + param.getStartChannel(); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | chanl = shelves.nodes.indexOf(node) + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | throw new CoolException("解析巷道号失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { | 
|---|
|  |  |  | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { | 
|---|
|  |  |  | // 获取库位号 | 
|---|
|  |  |  | String locNo = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); | 
|---|
|  |  |  | String locNo = locStar +  String.format("%d", r) + String.format("-%d", b) + String.format("-%d", l); | 
|---|
|  |  |  | Loc loc = new Loc(); | 
|---|
|  |  |  | loc.setCode(locNo) | 
|---|
|  |  |  | .setUseStatus("O") | 
|---|
|  |  |  | .setRow(r) | 
|---|
|  |  |  | .setCol(b) | 
|---|
|  |  |  | .setLev(l) | 
|---|
|  |  |  | .setChannel(chanl) | 
|---|
|  |  |  | .setType(join) | 
|---|
|  |  |  | .setAreaId(param.getAreaId()) | 
|---|
|  |  |  | .setUpdateBy(loginUserId) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取库位使用情况 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public R getLocPies() { | 
|---|
|  |  |  | List<LocUsageDto> locPies = this.baseMapper.getLocPies(); | 
|---|
|  |  |  | return R.ok().add(locPies); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Ryan | 
|---|
|  |  |  | * @date 2025/8/16 | 
|---|
|  |  |  | * @description: 获取库位明细 | 
|---|
|  |  |  | * @version 1.0 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public IPage<LocStockDto> getLocDetls(Page<Object> page) { | 
|---|
|  |  |  | return this.baseMapper.getLocDetls(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|