fix:移库推荐库位

This commit is contained in:
zhengxuming
2025-08-20 10:26:22 +08:00
parent 952f87e295
commit 8bb61fdb73
5 changed files with 70 additions and 30 deletions

View File

@@ -342,8 +342,11 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
return this.list();
}
List<String> collect = Arrays.stream(regions.split(",")).collect(Collectors.toList());
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
.in(SchBasePoint::getRegion_code, collect));
List<SchBasePoint> schBasePointList = pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
.in(SchBasePoint::getRegion_code, collect)
.ne(SchBasePoint::getPoint_status, "3"));
schBasePointList = schBasePointList.stream().filter(a -> !(a.getRegion_code().equals("YLXCQ") && "1".equals(a.getPoint_type()))).collect(Collectors.toList());
return schBasePointList;
}
}

View File

@@ -3,8 +3,10 @@ package org.nl.wms.sch_manage.service.util.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
@@ -28,6 +30,8 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author: gbx
@@ -179,12 +183,12 @@ public class VehicleInTask extends AbstractTask {
);
//更新组盘
iMdPbGroupPlateService.update(
new GroupPlate(),
new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
);
if(CollectionUtils.isNotEmpty(groupPlateList)){
iMdPbGroupPlateService.delete(groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet()));
}
// 更新任务
taskObj.setRemark("已完成");

View File

@@ -196,7 +196,7 @@ public class VehicleOutTask extends AbstractTask {
//删除
Set<String> groupSet = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>().lambda()
.in(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code()))
.stream().map(GroupPlate::getStoragevehicle_code).collect(Collectors.toSet());
.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(groupSet)) {
iMdPbGroupplateService.delete(groupSet);
}

View File

@@ -2,11 +2,13 @@ package org.nl.wms.warehouse_manage.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.IdUtil;
@@ -115,6 +117,13 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
moveDao.setInput_time(DateUtil.now());
this.save(moveDao);
//只能本库移动或移动到不合格区
for (JSONObject jsonObject : dto.getTableData()) {
if (!jsonObject.getString("turnout_sect_code").equals(jsonObject.getString("turnin_sect_code")) || !jsonObject.getString("turnin_sect_code").equals("BHG")) {
throw new IllegalArgumentException("只能移动不合格区或在本库区移库!");
}
}
// 新增明细以及任务
dto.setMoveinv_id(moveDao.getMoveinv_id());
iStIvtMoveinvdtlService.createMoveDtl(dto);
@@ -164,8 +173,29 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
@Override
public IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page) {
return mdPbStoragevehicleextMapper.getCanuseIvt(new Page<>(page.getPage() + 1, page.getSize()),
IPage<JSONObject> iPage = mdPbStoragevehicleextMapper.getCanuseIvt(new Page<>(page.getPage() + 1, page.getSize()),
whereJson);
Integer a = 0;
for(JSONObject jsonObject: iPage.getRecords()){
//查找一个
List<Structattr> inPoints = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
.eq(Structattr::getOccupancy_state, 1)
.eq(Structattr::getLock_type, "0")
.eq(Structattr::getSect_id, jsonObject.getString("sect_id"))
.isNull(Structattr::getStoragevehicle_code)
.isNull(Structattr::getTask_code));
if(CollectionUtils.isNotEmpty(inPoints) && a < inPoints.size()){
jsonObject.put("turnin_struct_id",inPoints.get(a).getStruct_id());
jsonObject.put("turnin_struct_code",inPoints.get(a).getStruct_code());
jsonObject.put("turnin_struct_name",inPoints.get(a).getStruct_name());
jsonObject.put("turnin_sect_id",inPoints.get(a).getSect_id());
jsonObject.put("turnin_sect_code",inPoints.get(a).getSect_code());
jsonObject.put("turnin_sect_name",inPoints.get(a).getSect_name());
}
a++;
}
return iPage;
}
@Override