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

View File

@@ -69,8 +69,8 @@
>
<el-option
v-for="item in dict.ST_INV_TYPE_MV"
:disabled="item.value === '21' || item.value === '31'"
:key="item.value"
:disabled="item.value === '21' || item.value === '31'"
:label="item.label"
:value="item.value"
/>
@@ -136,8 +136,8 @@
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
v-if="form.bill_type !== '30'"
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
@@ -157,18 +157,19 @@
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column v-if="crud.status.add!==1" prop="work_status" label="状态" align="center" :formatter="bill_statusFormat" :min-width="flexWidth('work_status',crud.data,'状态')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column prop="qty" label="重量" :formatter="crud.formatNum3" align="center" :min-width="flexWidth('qty',crud.data,'重量')" />
<el-table-column prop="qty_unit_name" label="单位" align="center" :min-width="flexWidth('qty_unit_name',crud.data,'单位')" />
<el-table-column prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column prop="turnout_sect_name" label="移出库区" :min-width="flexWidth('turnout_sect_name',crud.data,'移出库区')" />
<el-table-column prop="turnout_struct_code" label="移出货位" :min-width="flexWidth('turnout_struct_code',crud.data,'移出货位')" />
<el-table-column prop="turnin_sect_name" label="入库区" :min-width="flexWidth('turnin_sect_name',crud.data,'移入库区')" />
<el-table-column prop="turnin_struct_code" label="移入货位" :min-width="flexWidth('turnin_struct_code',crud.data,'移入货位')" align="center">
<!-- key的作用只是让列按照对应顺序排列没有其他作用-->
<el-table-column key="1" type="index" label="序号" width="50" align="center" />
<el-table-column v-if="crud.status.add!==1" key="2" prop="work_status" label="状态" align="center" :formatter="bill_statusFormat" :min-width="flexWidth('work_status',crud.data,'状态')" />
<el-table-column key="3" prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column key="4" prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column key="5" prop="pcsn" label="批次号" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column key="6" prop="qty" label="重量" :formatter="crud.formatNum3" align="center" :min-width="flexWidth('qty',crud.data,'重量')" />
<el-table-column key="7" prop="qty_unit_name" label="单位" align="center" :min-width="flexWidth('qty_unit_name',crud.data,'单位')" />
<el-table-column key="8" prop="storagevehicle_code" label="载具号" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column key="9" prop="turnout_sect_name" label="移出库区" :min-width="flexWidth('turnout_sect_name',crud.data,'移出库区')" />
<el-table-column key="10" prop="turnout_struct_code" label="出货位" :min-width="flexWidth('turnout_struct_code',crud.data,'移出货位')" />
<el-table-column key="11" prop="turnin_sect_name" label="移入库区" :min-width="flexWidth('turnin_sect_name',crud.data,'移入库区')" />
<el-table-column key="12" prop="turnin_struct_code" label="移入货位" :min-width="flexWidth('turnin_struct_code',crud.data,'移入货位')" align="center">
<template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.turnin_struct_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="queryStruct(scope.$index, scope.row)" />
@@ -338,28 +339,30 @@ export default {
tableChanged(rows) {
const tablemap = new Map()
rows.forEach((item) => {
console.log(item)
if (this.form.tableData.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].stockrecord_id === item.stockrecord_id) {
if (this.form.tableData[i].storagevehicle_code === item.storagevehicle_code) {
this.flagnow = true
}
}
if (!this.flagnow) {
this.$set(item, 'edit', false)
this.$set(item, 'work_status', '10')
this.$set(item, 'turnin_sect_code', '')
this.$set(item, 'turnin_struct_code', '')
tablemap.set(item.stockrecord_id, item)
/* this.$set(item, 'turnin_sect_code', '')
this.$set(item, 'turnin_struct_code', '') */
tablemap.set(item.storagevehicle_code, item)
}
} else {
this.$set(item, 'edit', false)
this.$set(item, 'work_status', '10')
this.$set(item, 'turnin_sect_code', '')
this.$set(item, 'turnin_struct_code', '')
tablemap.set(item.stockrecord_id, item)
/* this.$set(item, 'turnin_sect_code', '')
this.$set(item, 'turnin_struct_code', '') */
tablemap.set(item.storagevehicle_code, item)
}
})
console.log(tablemap)
for (const value of tablemap.values()) {
this.form.tableData.push(value)
}