Commit 9a9aa266 by yubin

仓库,库位管理

parent f3255ab9
import request from '@/utils/request'
// 查询库位列表
export function listLocations(query) {
return request({
url: '/inventory/locations/list',
method: 'get',
params: query
})
}
// 查询库位详细
export function getLocations(id) {
return request({
url: '/inventory/locations/' + id,
method: 'get'
})
}
// 新增库位
export function addLocations(data) {
return request({
url: '/inventory/locations',
method: 'post',
data: data
})
}
// 修改库位
export function updateLocations(data) {
return request({
url: '/inventory/locations',
method: 'put',
data: data
})
}
// 删除库位
export function delLocations(id) {
return request({
url: '/inventory/locations/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询仓库列表
export function listWarehouses(query) {
return request({
url: '/inventory/warehouses/list',
method: 'get',
params: query
})
}
// 查询仓库详细
export function getWarehouses(id) {
return request({
url: '/inventory/warehouses/' + id,
method: 'get'
})
}
// 新增仓库
export function addWarehouses(data) {
return request({
url: '/inventory/warehouses',
method: 'post',
data: data
})
}
// 修改仓库
export function updateWarehouses(data) {
return request({
url: '/inventory/warehouses',
method: 'put',
data: data
})
}
// 删除仓库
export function delWarehouses(id) {
return request({
url: '/inventory/warehouses/' + id,
method: 'delete'
})
}
<template> <template>
<div> <div>
<template v-for="(item, index) in options"> <template v-for="(item, index) in options">
<template v-if="values.includes(item.value)"> <template v-if="values.includes(String(item.value))">
<span <span
v-if="(item.raw.listClass == 'default' || item.raw.listClass == '') && (item.raw.cssClass == '' || item.raw.cssClass == null)" v-if="(item.raw.listClass == 'default' || item.raw.listClass == '') && (item.raw.cssClass == '' || item.raw.cssClass == null)"
:key="item.value" :key="item.value"
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
// 传入值为数组 // 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项 let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => { this.values.forEach(item => {
if (!this.options.some(v => v.value === item)) { if (!this.options.some(v => String(v.value) === item || v.value === item)) {
this.unmatchArray.push(item) this.unmatchArray.push(item)
unmatch = true // 如果有未匹配项,将标志设置为true unmatch = true // 如果有未匹配项,将标志设置为true
} }
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="库位编码" prop="locationCode">
<el-input
v-model="queryParams.locationCode"
placeholder="请输入库位编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="库位名称" prop="locationName">
<el-input
v-model="queryParams.locationName"
placeholder="请输入库位名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库编码" prop="warehousesCode">
<el-input
v-model="queryParams.warehousesCode"
placeholder="请输入仓库编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="层" prop="layerCode">
<el-input
v-model="queryParams.layerCode"
placeholder="请输入层"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="库位类型" prop="locationType">
<el-select
v-model="queryParams.locationType"
placeholder="请选择库位类型"
clearable
@change="handleQuery"
>
<el-option
v-for="dict in dict.type.location_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['inventory:locations:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['inventory:locations:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['inventory:locations:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['inventory:locations:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="locationsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="库位编码" align="center" prop="locationCode" />
<el-table-column label="库位名称" align="center" prop="locationName" />
<el-table-column label="仓库编码" align="center" prop="warehousesCode" />
<el-table-column label="库位类型" align="center" prop="locationType">
<template slot-scope="scope">
{{ selectDictLabel(dict.type.location_type, scope.row.locationType) }}
</template>
</el-table-column>
<el-table-column label="区域代码" align="center" prop="zoneCode" />
<el-table-column label="排" align="center" prop="rowCode" />
<el-table-column label="列" align="center" prop="columnCode" />
<el-table-column label="层" align="center" prop="layerCode" />
<el-table-column label="库位容量(千克)" align="center" prop="capacity" />
<el-table-column label="体积容量(立方米)" align="center" prop="volumeCapacity" />
<el-table-column label="允许存放的危险等级" align="center" prop="allowedHazardLevels" />
<el-table-column label="允许存放的分类ID" align="center" prop="allowedCategoryIds" />
<el-table-column label="温区" align="center" prop="temperatureZone" />
<el-table-column label="应用状态" align="center" prop="isEnabled">
<template slot-scope="scope">
{{ selectDictLabel(dict.type.sys_normal_disable, scope.row.isEnabled) }}
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" />
<el-table-column label="创建日期" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['inventory:locations:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['inventory:locations:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改库位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库位编码" prop="locationCode">
<el-input v-model="form.locationCode" placeholder="请输入库位编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库位名称" prop="locationName">
<el-input v-model="form.locationName" placeholder="请输入库位名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库编码" prop="warehousesCode">
<el-input v-model="form.warehousesCode" placeholder="请输入仓库编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="区域代码" prop="zoneCode">
<el-input v-model="form.zoneCode" placeholder="请输入区域代码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库位类型" prop="locationType">
<el-select v-model="form.locationType" placeholder="请选择库位类型">
<el-option
v-for="dict in dict.type.location_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="应用状态" prop="isEnabled">
<el-select v-model="form.isEnabled" placeholder="请选择应用状态">
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="排" prop="rowCode">
<el-input v-model="form.rowCode" placeholder="请输入排" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="列" prop="columnCode">
<el-input v-model="form.columnCode" placeholder="请输入列" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="层" prop="layerCode">
<el-input v-model="form.layerCode" placeholder="请输入层" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库位容量(千克)" prop="capacity">
<el-input v-model="form.capacity" placeholder="请输入库位容量(千克)" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="体积容量(立方米)" prop="volumeCapacity">
<el-input v-model="form.volumeCapacity" placeholder="请输入体积容量(立方米)" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="存放危险等级" prop="allowedHazardLevels">
<el-input v-model="form.allowedHazardLevels" placeholder="请输入允许存放的危险等级" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="存放分类" prop="allowedCategoryIds">
<el-input v-model="form.allowedCategoryIds" placeholder="" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="排序" prop="sortNo">
<el-input v-model="form.sortNo" placeholder="请输入排序" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="温区" prop="temperatureZone">
<el-input v-model="form.temperatureZone" type="textarea" placeholder="请输入内容" :rows="3" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listLocations, getLocations, delLocations, addLocations, updateLocations } from "@/api/inventory/locations"
import { listMaterials_category }from "@/api/inventory/materials"
export default {
name: "Locations",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 库位表格数据
locationsList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 字典类型
dict: {
type: {
location_type: [
{ label: "货架", value: "1" },
{ label: "地面", value: "2" },
{ label: "货位", value: "3" },
{ label: "专区", value: "4" }
],
sys_normal_disable: [
{ label: "启用", value: "1" },
{ label: "禁用", value: "0" }
]
}
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
locationCode: null,
locationName: null,
warehousesCode: null,
locationType: null,
zoneCode: null,
rowCode: null,
columnCode: null,
layerCode: null,
capacity: null,
volumeCapacity: null,
allowedHazardLevels: null,
allowedCategoryIds: null,
temperatureZone: null,
isEnabled: null,
isUsed: null,
sortNo: null,
createUserCode: null,
updateUserCode: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询库位列表 */
getList() {
this.loading = true
listLocations(this.queryParams).then(response => {
this.locationsList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
locationCode: null,
locationName: null,
warehousesCode: null,
locationType: null,
zoneCode: null,
rowCode: null,
columnCode: null,
layerCode: null,
capacity: null,
volumeCapacity: null,
allowedHazardLevels: null,
allowedCategoryIds: null,
temperatureZone: null,
isEnabled: null,
isUsed: null,
sortNo: null,
createTime: null,
createUserCode: null,
updateTime: null,
updateUserCode: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加库位"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getLocations(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改库位"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLocations(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addLocations(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除库位编号为"' + ids + '"的数据项?').then(function() {
return delLocations(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('inventory/locations/export', {
...this.queryParams
}, `locations_${new Date().getTime()}.xlsx`)
}
}
}
</script>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
icon="el-icon-upload2" icon="el-icon-upload2"
size="mini" size="mini"
@click="handleImport" @click="handleImport"
v-hasPermi="['inventory:owners:import']" v-hasPermi="['inventory:owners:add']"
>导入</el-button> >导入</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
...@@ -107,27 +107,27 @@ ...@@ -107,27 +107,27 @@
<el-table v-loading="loading" :data="ownersList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="ownersList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="货主编码" align="center" prop="ownerCode" /> <el-table-column label="货主编码" align="center" prop="ownerCode" width="120"/>
<el-table-column label="货主名称" align="center" prop="ownerName" /> <el-table-column label="货主名称" align="center" prop="ownerName"width="220" />
<el-table-column label="货主类型" align="center" prop="ownerType"> <el-table-column label="货主类型" align="center" prop="ownerType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.owner_type" :value="scope.row.ownerType"/> <dict-tag :options="dict.type.owner_type" :value="scope.row.ownerType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="联系人" align="center" prop="contactPerson" /> <el-table-column label="联系人" align="center" prop="contactPerson" />
<el-table-column label="联系电话" align="center" prop="contactPhone" /> <el-table-column label="联系电话" align="center" prop="contactPhone" width="120"/>
<el-table-column label="邮箱" align="center" prop="email" /> <el-table-column label="邮箱" align="center" prop="email" width="200"/>
<el-table-column label="地址" align="center" prop="address" /> <el-table-column label="地址" align="center" prop="address" width="220"/>
<el-table-column label="税号" align="center" prop="taxNumber" /> <el-table-column label="税号" align="center" prop="taxNumber"width="180" />
<el-table-column label="银行账户" align="center" prop="bankAccount" /> <el-table-column label="银行账户" align="center" prop="bankAccount" width="180"/>
<el-table-column label="是否激活" align="center" prop="isActive"> <el-table-column label="是否激活" align="center" prop="isActive">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isActive === 1 ? '激活' : '未激活' }} <dict-tag :options="dict.type.yes_no" :value="scope.row.isActive"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" /> <el-table-column label="排序" align="center" prop="sortNo" />
<el-table-column label="创建日期" align="center" prop="createUserCode" /> <el-table-column label="创建日期" align="center" prop="createTime" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
<el-form-item label="仓库编码" prop="warehousesCode">
<el-input
v-model="queryParams.warehousesCode"
placeholder="请输入仓库编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库名称" prop="warehousesName">
<el-input
v-model="queryParams.warehousesName"
placeholder="请输入仓库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库类型" prop="warehouseType">
<el-select
v-model="queryParams.warehouseType"
placeholder="请选择仓库类型"
clearable
@change="handleQuery"
>
<el-option
v-for="dict in dict.type.warehouse_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库管理员" prop="manager">
<el-input
v-model="queryParams.manager"
placeholder="请输入仓库管理员"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['inventory:warehouses:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['inventory:warehouses:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['inventory:warehouses:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['inventory:warehouses:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="warehousesList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="仓库编码" align="center" prop="warehousesCode" />
<el-table-column label="仓库名称" align="center" prop="warehousesName" />
<el-table-column label="仓库类型" align="center" prop="warehouseType">
<template slot-scope="scope">
{{ selectDictLabel(dict.type.warehouse_type, scope.row.warehouseType) }}
</template>
</el-table-column>
<el-table-column label="仓库地点" align="center" prop="address" />
<el-table-column label="仓库区域" align="center" prop="area" />
<el-table-column label="仓库容量" align="center" prop="capacity" />
<el-table-column label="仓库管理员" align="center" prop="manager" />
<el-table-column label="联系电话" align="center" prop="contactPhone" />
<el-table-column label="应用状态" align="center" prop="isEnabled">
<template slot-scope="scope">
{{ selectDictLabel(dict.type.sys_normal_disable, scope.row.isEnabled) }}
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" />
<el-table-column label="创建日期" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['inventory:warehouses:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['inventory:warehouses:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改仓库对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库编码" prop="warehousesCode">
<el-input v-model="form.warehousesCode" placeholder="请输入仓库编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="仓库名称" prop="warehousesName">
<el-input v-model="form.warehousesName" placeholder="请输入仓库名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库类型" prop="warehouseType">
<el-select v-model="form.warehouseType" placeholder="请选择仓库类型">
<el-option
v-for="dict in dict.type.warehouse_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库区域" prop="area">
<el-input v-model="form.area" placeholder="请输入仓库区域" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="仓库容量" prop="capacity">
<el-input v-model="form.capacity" placeholder="请输入仓库容量" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库管理员" prop="manager">
<el-input v-model="form.manager" placeholder="请输入仓库管理员" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="contactPhone">
<el-input v-model="form.contactPhone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="应用状态" prop="isEnabled">
<el-select v-model="form.isEnabled" placeholder="请选择应用状态">
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="排序" prop="sortNo">
<el-input v-model="form.sortNo" placeholder="请输入排序" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="仓库地点" prop="address">
<el-input v-model="form.address" type="textarea" placeholder="请输入内容" :rows="3" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWarehouses, getWarehouses, delWarehouses, addWarehouses, updateWarehouses } from "@/api/inventory/warehouses"
export default {
name: "Warehouses",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 仓库表格数据
warehousesList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 字典类型
dict: {
type: {
warehouse_type: [
{ label: "普通仓", value: "1" },
{ label: "危险品仓", value: "2" },
{ label: "冷藏仓", value: "3" }
],
sys_normal_disable: [
{ label: "启用", value: "1" },
{ label: "禁用", value: "0" }
]
}
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
warehousesCode: null,
warehousesName: null,
warehouseType: null,
address: null,
area: null,
capacity: null,
manager: null,
contactPhone: null,
isEnabled: null,
isUsed: null,
sortNo: null,
createUserCode: null,
updateUserCode: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询仓库列表 */
getList() {
this.loading = true
listWarehouses(this.queryParams).then(response => {
this.warehousesList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
warehousesCode: null,
warehousesName: null,
warehouseType: null,
address: null,
area: null,
capacity: null,
manager: null,
contactPhone: null,
isEnabled: null,
isUsed: null,
sortNo: null,
createTime: null,
createUserCode: null,
updateTime: null,
updateUserCode: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加仓库"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getWarehouses(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改仓库"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWarehouses(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addWarehouses(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除仓库编号为"' + ids + '"的数据项?').then(function() {
return delWarehouses(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('inventory/warehouses/export', {
...this.queryParams
}, `warehouses_${new Date().getTime()}.xlsx`)
}
}
}
</script>
...@@ -19,7 +19,7 @@ public class TreeSelect implements Serializable ...@@ -19,7 +19,7 @@ public class TreeSelect implements Serializable
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 节点ID */ /** 节点ID */
private Long id; private String id;
/** 节点名称 */ /** 节点名称 */
private String label; private String label;
...@@ -38,7 +38,7 @@ public class TreeSelect implements Serializable ...@@ -38,7 +38,7 @@ public class TreeSelect implements Serializable
public TreeSelect(SysDept dept) public TreeSelect(SysDept dept)
{ {
this.id = dept.getDeptId(); this.id = String.valueOf(dept.getDeptId());
this.label = dept.getDeptName(); this.label = dept.getDeptName();
this.disabled = StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()); this.disabled = StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus());
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
...@@ -46,17 +46,17 @@ public class TreeSelect implements Serializable ...@@ -46,17 +46,17 @@ public class TreeSelect implements Serializable
public TreeSelect(SysMenu menu) public TreeSelect(SysMenu menu)
{ {
this.id = menu.getMenuId(); this.id = String.valueOf(menu.getMenuId());
this.label = menu.getMenuName(); this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
} }
public Long getId() public String getId()
{ {
return id; return id;
} }
public void setId(Long id) public void setId(String id)
{ {
this.id = id; this.id = id;
} }
......
...@@ -126,7 +126,9 @@ public class MyBatisConfig ...@@ -126,7 +126,9 @@ public class MyBatisConfig
sessionFactory.setDataSource(dataSource); sessionFactory.setDataSource(dataSource);
sessionFactory.setTypeAliasesPackage(typeAliasesPackage); sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); if (StringUtils.isNotBlank(configLocation)) {
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
}
return sessionFactory.getObject(); return sessionFactory.getObject();
} }
} }
\ No newline at end of file
...@@ -62,7 +62,7 @@ public class OwnersController extends BaseController ...@@ -62,7 +62,7 @@ public class OwnersController extends BaseController
util.exportExcel(response, list, "货主信息数据"); util.exportExcel(response, list, "货主信息数据");
} }
@PreAuthorize("@ss.hasPermi('inventory:owners:import')") @PreAuthorize("@ss.hasPermi('inventory:owners:add')")
@Log(title = "货主信息", businessType = BusinessType.IMPORT) @Log(title = "货主信息", businessType = BusinessType.IMPORT)
@PostMapping("/import") @PostMapping("/import")
public AjaxResult importTemplate(MultipartFile file , boolean updateSupport) throws Exception public AjaxResult importTemplate(MultipartFile file , boolean updateSupport) throws Exception
......
package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.inventory.domain.StorageLocations;
import com.ruoyi.inventory.service.IStorageLocationsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库位Controller
*
* @author ruoyi
* @date 2025-12-01
*/
@RestController
@RequestMapping("/inventory/locations")
public class StorageLocationsController extends BaseController
{
@Autowired
private IStorageLocationsService storageLocationsService;
/**
* 查询库位列表
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:list')")
@GetMapping("/list")
public TableDataInfo list(StorageLocations storageLocations)
{
startPage();
List<StorageLocations> list = storageLocationsService.selectStorageLocationsList(storageLocations);
return getDataTable(list);
}
/**
* 导出库位列表
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:export')")
@Log(title = "库位", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StorageLocations storageLocations)
{
List<StorageLocations> list = storageLocationsService.selectStorageLocationsList(storageLocations);
ExcelUtil<StorageLocations> util = new ExcelUtil<StorageLocations>(StorageLocations.class);
util.exportExcel(response, list, "库位数据");
}
/**
* 获取库位详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(storageLocationsService.selectStorageLocationsById(id));
}
/**
* 新增库位
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:add')")
@Log(title = "库位", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StorageLocations storageLocations)
{
return toAjax(storageLocationsService.insertStorageLocations(storageLocations));
}
/**
* 修改库位
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:edit')")
@Log(title = "库位", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StorageLocations storageLocations)
{
return toAjax(storageLocationsService.updateStorageLocations(storageLocations));
}
/**
* 删除库位
*/
@PreAuthorize("@ss.hasPermi('inventory:locations:remove')")
@Log(title = "库位", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(storageLocationsService.deleteStorageLocationsByIds(ids));
}
}
package com.ruoyi.inventory.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.inventory.domain.Warehouses;
import com.ruoyi.inventory.service.IWarehousesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 仓库Controller
*
* @author ruoyi
* @date 2025-12-01
*/
@RestController
@RequestMapping("/inventory/warehouses")
public class WarehousesController extends BaseController
{
@Autowired
private IWarehousesService warehousesService;
/**
* 查询仓库列表
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:list')")
@GetMapping("/list")
public TableDataInfo list(Warehouses warehouses)
{
startPage();
List<Warehouses> list = warehousesService.selectWarehousesList(warehouses);
return getDataTable(list);
}
/**
* 导出仓库列表
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:export')")
@Log(title = "仓库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Warehouses warehouses)
{
List<Warehouses> list = warehousesService.selectWarehousesList(warehouses);
ExcelUtil<Warehouses> util = new ExcelUtil<Warehouses>(Warehouses.class);
util.exportExcel(response, list, "仓库数据");
}
/**
* 获取仓库详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(warehousesService.selectWarehousesById(id));
}
/**
* 新增仓库
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:add')")
@Log(title = "仓库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Warehouses warehouses)
{
return toAjax(warehousesService.insertWarehouses(warehouses));
}
/**
* 修改仓库
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:edit')")
@Log(title = "仓库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Warehouses warehouses)
{
return toAjax(warehousesService.updateWarehouses(warehouses));
}
/**
* 删除仓库
*/
@PreAuthorize("@ss.hasPermi('inventory:warehouses:remove')")
@Log(title = "仓库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(warehousesService.deleteWarehousesByIds(ids));
}
}
package com.ruoyi.inventory.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库位对象 storage_locations
*
* @author ruoyi
* @date 2025-12-01
*/
public class StorageLocations extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 库位编码 检索条件 */
@Excel(name = "库位编码 检索条件")
private String locationCode;
/** 库位名称 检索条件 */
@Excel(name = "库位名称 检索条件")
private String locationName;
/** 仓库编码 检索条件 */
@Excel(name = "仓库编码 检索条件")
private String warehousesCode;
/** 库位类型 1-货架 2-地面 3-货位 4-专区 字典设置,检索条件 */
@Excel(name = "库位类型 1-货架 2-地面 3-货位 4-专区 字典设置,检索条件")
private Long locationType;
/** 区域代码 */
@Excel(name = "区域代码")
private String zoneCode;
/** 排 */
@Excel(name = "排")
private String rowCode;
/** 列 */
@Excel(name = "列")
private String columnCode;
/** 层 文字,检索条件 */
@Excel(name = "层 文字,检索条件")
private String layerCode;
/** 库位容量(千克) */
@Excel(name = "库位容量(千克)")
private Long capacity;
/** 体积容量(立方米) */
@Excel(name = "体积容量(立方米)")
private Long volumeCapacity;
/** 允许存放的危险等级(逗号分隔) */
@Excel(name = "允许存放的危险等级", readConverterExp = "逗=号分隔")
private String allowedHazardLevels;
/** 允许存放的分类ID(逗号分隔) */
@Excel(name = "允许存放的分类ID", readConverterExp = "逗=号分隔")
private String allowedCategoryIds;
/** 温区 */
@Excel(name = "温区")
private String temperatureZone;
/** 应用状态1使用0未使用 */
@Excel(name = "应用状态1使用0未使用")
private Long isEnabled;
/** 应用数据1使用0删除 删除用 */
private Long isUsed;
/** 排序 */
private Long sortNo;
/** 创建日期 */
private String createUserCode;
/** 排序号 */
private String updateUserCode;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setLocationName(String locationName)
{
this.locationName = locationName;
}
public String getLocationName()
{
return locationName;
}
public void setWarehousesCode(String warehousesCode)
{
this.warehousesCode = warehousesCode;
}
public String getWarehousesCode()
{
return warehousesCode;
}
public void setLocationType(Long locationType)
{
this.locationType = locationType;
}
public Long getLocationType()
{
return locationType;
}
public void setZoneCode(String zoneCode)
{
this.zoneCode = zoneCode;
}
public String getZoneCode()
{
return zoneCode;
}
public void setRowCode(String rowCode)
{
this.rowCode = rowCode;
}
public String getRowCode()
{
return rowCode;
}
public void setColumnCode(String columnCode)
{
this.columnCode = columnCode;
}
public String getColumnCode()
{
return columnCode;
}
public void setLayerCode(String layerCode)
{
this.layerCode = layerCode;
}
public String getLayerCode()
{
return layerCode;
}
public void setCapacity(Long capacity)
{
this.capacity = capacity;
}
public Long getCapacity()
{
return capacity;
}
public void setVolumeCapacity(Long volumeCapacity)
{
this.volumeCapacity = volumeCapacity;
}
public Long getVolumeCapacity()
{
return volumeCapacity;
}
public void setAllowedHazardLevels(String allowedHazardLevels)
{
this.allowedHazardLevels = allowedHazardLevels;
}
public String getAllowedHazardLevels()
{
return allowedHazardLevels;
}
public void setAllowedCategoryIds(String allowedCategoryIds)
{
this.allowedCategoryIds = allowedCategoryIds;
}
public String getAllowedCategoryIds()
{
return allowedCategoryIds;
}
public void setTemperatureZone(String temperatureZone)
{
this.temperatureZone = temperatureZone;
}
public String getTemperatureZone()
{
return temperatureZone;
}
public void setIsEnabled(Long isEnabled)
{
this.isEnabled = isEnabled;
}
public Long getIsEnabled()
{
return isEnabled;
}
public void setIsUsed(Long isUsed)
{
this.isUsed = isUsed;
}
public Long getIsUsed()
{
return isUsed;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("locationCode", getLocationCode())
.append("locationName", getLocationName())
.append("warehousesCode", getWarehousesCode())
.append("locationType", getLocationType())
.append("zoneCode", getZoneCode())
.append("rowCode", getRowCode())
.append("columnCode", getColumnCode())
.append("layerCode", getLayerCode())
.append("capacity", getCapacity())
.append("volumeCapacity", getVolumeCapacity())
.append("allowedHazardLevels", getAllowedHazardLevels())
.append("allowedCategoryIds", getAllowedCategoryIds())
.append("temperatureZone", getTemperatureZone())
.append("isEnabled", getIsEnabled())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
package com.ruoyi.inventory.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库位存放分类对象 storage_locations_category
*
* @author ruoyi
* @date 2025-12-01
*/
public class StorageLocationsCategory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 库位编码 */
@Excel(name = "库位编码")
private String locationCode;
/** 仓库编码 */
@Excel(name = "仓库编码")
private String warehousesCode;
/** 分类编码 */
@Excel(name = "分类编码")
private String categoryId;
/** 分类名称 */
@Excel(name = "分类名称")
private String categoryName;
/** 排序 暂无用 */
@Excel(name = "排序 暂无用")
private Long sortNo;
/** 创建日期 */
@Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
@Excel(name = "排序号")
private String updateUserCode;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setWarehousesCode(String warehousesCode)
{
this.warehousesCode = warehousesCode;
}
public String getWarehousesCode()
{
return warehousesCode;
}
public void setCategoryId(String categoryId)
{
this.categoryId = categoryId;
}
public String getCategoryId()
{
return categoryId;
}
public void setCategoryName(String categoryName)
{
this.categoryName = categoryName;
}
public String getCategoryName()
{
return categoryName;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("locationCode", getLocationCode())
.append("warehousesCode", getWarehousesCode())
.append("categoryId", getCategoryId())
.append("categoryName", getCategoryName())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
package com.ruoyi.inventory.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 仓库对象 warehouses
*
* @author ruoyi
* @date 2025-12-01
*/
public class Warehouses extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 仓库编码 检索条件 */
@Excel(name = "仓库编码 检索条件")
private String warehousesCode;
/** 仓库名称 检索条件 */
@Excel(name = "仓库名称 检索条件")
private String warehousesName;
/** 仓库类型1-普通仓 2-危险品仓 3-冷藏仓 字典设置,检索条件 */
@Excel(name = "仓库类型1-普通仓 2-危险品仓 3-冷藏仓 字典设置,检索条件")
private Long warehouseType;
/** 仓库地点 检索条件 */
@Excel(name = "仓库地点 检索条件")
private String address;
/** 仓库区域 */
@Excel(name = "仓库区域")
private Long area;
/** 仓库容量 */
@Excel(name = "仓库容量")
private Long capacity;
/** 仓库管理员 文字,检索条件 */
@Excel(name = "仓库管理员 文字,检索条件")
private String manager;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactPhone;
/** 应用状态1使用0未使用 */
@Excel(name = "应用状态1使用0未使用")
private Long isEnabled;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
private String createUserCode;
/** 排序号 */
private String updateUserCode;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setWarehousesCode(String warehousesCode)
{
this.warehousesCode = warehousesCode;
}
public String getWarehousesCode()
{
return warehousesCode;
}
public void setWarehousesName(String warehousesName)
{
this.warehousesName = warehousesName;
}
public String getWarehousesName()
{
return warehousesName;
}
public void setWarehouseType(Long warehouseType)
{
this.warehouseType = warehouseType;
}
public Long getWarehouseType()
{
return warehouseType;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setArea(Long area)
{
this.area = area;
}
public Long getArea()
{
return area;
}
public void setCapacity(Long capacity)
{
this.capacity = capacity;
}
public Long getCapacity()
{
return capacity;
}
public void setManager(String manager)
{
this.manager = manager;
}
public String getManager()
{
return manager;
}
public void setContactPhone(String contactPhone)
{
this.contactPhone = contactPhone;
}
public String getContactPhone()
{
return contactPhone;
}
public void setIsEnabled(Long isEnabled)
{
this.isEnabled = isEnabled;
}
public Long getIsEnabled()
{
return isEnabled;
}
public void setIsUsed(Long isUsed)
{
this.isUsed = isUsed;
}
public Long getIsUsed()
{
return isUsed;
}
public void setSortNo(Long sortNo)
{
this.sortNo = sortNo;
}
public Long getSortNo()
{
return sortNo;
}
public void setCreateUserCode(String createUserCode)
{
this.createUserCode = createUserCode;
}
public String getCreateUserCode()
{
return createUserCode;
}
public void setUpdateUserCode(String updateUserCode)
{
this.updateUserCode = updateUserCode;
}
public String getUpdateUserCode()
{
return updateUserCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("warehousesCode", getWarehousesCode())
.append("warehousesName", getWarehousesName())
.append("warehouseType", getWarehouseType())
.append("address", getAddress())
.append("area", getArea())
.append("capacity", getCapacity())
.append("manager", getManager())
.append("contactPhone", getContactPhone())
.append("isEnabled", getIsEnabled())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.toString();
}
}
...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper; ...@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.Materials; import com.ruoyi.inventory.domain.Materials;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -10,6 +11,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
* @author ruoyi * @author ruoyi
* @date 2025-11-28 * @date 2025-11-28
*/ */
@Mapper
public interface MaterialsMapper public interface MaterialsMapper
{ {
/** /**
......
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
import org.apache.ibatis.annotations.Update;
/**
* 库位存放分类Mapper接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface StorageLocationsCategoryMapper
{
/**
* 查询库位存放分类
*
* @param id 库位存放分类主键
* @return 库位存放分类
*/
public StorageLocationsCategory selectStorageLocationsCategoryById(String id);
/**
* 查询库位存放分类列表
*
* @param storageLocationsCategory 库位存放分类
* @return 库位存放分类集合
*/
public List<StorageLocationsCategory> selectStorageLocationsCategoryList(StorageLocationsCategory storageLocationsCategory);
/**
* 新增库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
public int insertStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory);
/**
* 修改库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
public int updateStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory);
/**
* 删除库位存放分类
*
* @param id 库位存放分类主键
* @return 结果
*/
public int deleteStorageLocationsCategoryById(String id);
/**
* 删除库位存放分类
*
* @param locationCode 库位存放分类主键
* @return 结果
*/
public int deleteStorageLocationsCategoryByLocationCode(String locationCode);
/**
* 批量删除库位存放分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteStorageLocationsCategoryByIds(String[] ids);
/**
* 修改库位状态
*
* @param id 需要删除的数据主键集合
* @return 结果
*/
@Update("update storage_locations_category set is_enabled = 0 where warehouses_code=#{id}")
public int updateStorageLocationsCategoryStatus(String id);
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.StorageLocations;
import org.apache.ibatis.annotations.Update;
/**
* 库位Mapper接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface StorageLocationsMapper
{
/**
* 查询库位
*
* @param id 库位主键
* @return 库位
*/
public StorageLocations selectStorageLocationsById(String id);
/**
* 查询库位列表
*
* @param storageLocations 库位
* @return 库位集合
*/
public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations);
/**
* 新增库位
*
* @param storageLocations 库位
* @return 结果
*/
public int insertStorageLocations(StorageLocations storageLocations);
/**
* 修改库位
*
* @param storageLocations 库位
* @return 结果
*/
public int updateStorageLocations(StorageLocations storageLocations);
/**
* 删除库位
*
* @param id 库位主键
* @return 结果
*/
public int deleteStorageLocationsById(String id);
/**
* 批量删除库位
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteStorageLocationsByIds(String[] ids);
/**
* 查询库位
*
* @param warehousesCode 库位主键
* @return 库位
*/
public List<StorageLocations> selectStorageLocationsByWarehousesCode(String warehousesCode);
/**
* 查询库位
*
* @param warehousesCode 库位主键
* @return 库位
*/
public List<StorageLocations> selectStorageLocationsByWarehousesCodes(String[] warehousesCode);
@Update("update storage_locations set is_enabled = 0 where warehouses_code=#{id}")
public int updateStorageLocationsStatus(String id);
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.Warehouses;
import org.apache.ibatis.annotations.Update;
/**
* 仓库Mapper接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface WarehousesMapper
{
/**
* 查询仓库
*
* @param id 仓库主键
* @return 仓库
*/
public Warehouses selectWarehousesById(String id);
/**
* 查询仓库列表
*
* @param warehouses 仓库
* @return 仓库集合
*/
public List<Warehouses> selectWarehousesList(Warehouses warehouses);
/**
* 新增仓库
*
* @param warehouses 仓库
* @return 结果
*/
public int insertWarehouses(Warehouses warehouses);
/**
* 修改仓库
*
* @param warehouses 仓库
* @return 结果
*/
public int updateWarehouses(Warehouses warehouses);
/**
* 删除仓库
*
* @param id 仓库主键
* @return 结果
*/
public int deleteWarehousesById(String id);
/**
* 批量删除仓库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWarehousesByIds(String[] ids);
/**
* 批量删除仓库
*
* @param id 需要删除的数据主键集合
* @return 结果
*/
@Update("update warehouses set is_enabled = 0 where id=#{id}")
public int updateWarehouseStatus(String id);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
/**
* 库位存放分类Service接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface IStorageLocationsCategoryService
{
/**
* 查询库位存放分类
*
* @param id 库位存放分类主键
* @return 库位存放分类
*/
public StorageLocationsCategory selectStorageLocationsCategoryById(String id);
/**
* 查询库位存放分类列表
*
* @param storageLocationsCategory 库位存放分类
* @return 库位存放分类集合
*/
public List<StorageLocationsCategory> selectStorageLocationsCategoryList(StorageLocationsCategory storageLocationsCategory);
/**
* 新增库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
public int insertStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory);
/**
* 修改库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
public int updateStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory);
/**
* 批量删除库位存放分类
*
* @param ids 需要删除的库位存放分类主键集合
* @return 结果
*/
public int deleteStorageLocationsCategoryByIds(String[] ids);
/**
* 删除库位存放分类信息
*
* @param id 库位存放分类主键
* @return 结果
*/
public int deleteStorageLocationsCategoryById(String id);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.StorageLocations;
/**
* 库位Service接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface IStorageLocationsService
{
/**
* 查询库位
*
* @param id 库位主键
* @return 库位
*/
public StorageLocations selectStorageLocationsById(String id);
/**
* 查询库位
*
* @param warehousesCode 库位主键
* @return 库位
*/
public List<StorageLocations> selectStorageLocationsByWarehousesCode(String warehousesCode);
/**
* 查询库位
*
* @param warehousesCodes 库位主键
* @return 库位
*/
public List<StorageLocations> selectStorageLocationsByWarehousesCodes(String[] warehousesCodes);
/**
* 查询库位列表
*
* @param storageLocations 库位
* @return 库位集合
*/
public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations);
/**
* 新增库位
*
* @param storageLocations 库位
* @return 结果
*/
public int insertStorageLocations(StorageLocations storageLocations);
/**
* 修改库位
*
* @param storageLocations 库位
* @return 结果
*/
public int updateStorageLocations(StorageLocations storageLocations);
/**
* 批量删除库位
*
* @param ids 需要删除的库位主键集合
* @return 结果
*/
public int deleteStorageLocationsByIds(String[] ids);
/**
* 删除库位信息
*
* @param id 库位主键
* @return 结果
*/
public int deleteStorageLocationsById(String id);
int updateLocationsCategoryStatus(String id);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.Warehouses;
/**
* 仓库Service接口
*
* @author ruoyi
* @date 2025-12-01
*/
public interface IWarehousesService
{
/**
* 查询仓库
*
* @param id 仓库主键
* @return 仓库
*/
public Warehouses selectWarehousesById(String id);
/**
* 查询仓库列表
*
* @param warehouses 仓库
* @return 仓库集合
*/
public List<Warehouses> selectWarehousesList(Warehouses warehouses);
/**
* 新增仓库
*
* @param warehouses 仓库
* @return 结果
*/
public int insertWarehouses(Warehouses warehouses);
/**
* 修改仓库
*
* @param warehouses 仓库
* @return 结果
*/
public int updateWarehouses(Warehouses warehouses);
int updateWarehouseStatus(Warehouses warehouses);
/**
* 批量删除仓库
*
* @param ids 需要删除的仓库主键集合
* @return 结果
*/
public int deleteWarehousesByIds(String[] ids);
/**
* 删除仓库信息
*
* @param id 仓库主键
* @return 结果
*/
public int deleteWarehousesById(String id);
}
...@@ -123,11 +123,8 @@ public class MaterialsServiceImpl implements IMaterialsService ...@@ -123,11 +123,8 @@ public class MaterialsServiceImpl implements IMaterialsService
// 填充创建人、创建时间、修改人、修改时间 // 填充创建人、创建时间、修改人、修改时间
materials.setCreateBy(operId); materials.setCreateBy(operId);
materials.setCreateTime(now); materials.setCreateTime(now);
materials.setUpdateBy(operId);
materials.setUpdateTime(now);
// 填充创建用户编码和更新用户编码 // 填充创建用户编码和更新用户编码
materials.setCreateUserCode(operId); materials.setCreateUserCode(operId);
materials.setUpdateUserCode(operId);
// 设置默认值 // 设置默认值
if (materials.getIsActive() == null) if (materials.getIsActive() == null)
{ {
......
...@@ -109,11 +109,8 @@ public class OwnersServiceImpl implements IOwnersService ...@@ -109,11 +109,8 @@ public class OwnersServiceImpl implements IOwnersService
// 填充创建人、创建时间、修改人、修改时间 // 填充创建人、创建时间、修改人、修改时间
owners.setCreateBy(operId); owners.setCreateBy(operId);
owners.setCreateTime(now); owners.setCreateTime(now);
owners.setUpdateBy(operId);
owners.setUpdateTime(now);
// 填充创建用户编码和更新用户编码 // 填充创建用户编码和更新用户编码
owners.setCreateUserCode(operId); owners.setCreateUserCode(operId);
owners.setUpdateUserCode(operId);
// 设置默认值 // 设置默认值
if (owners.getIsActive() == null) if (owners.getIsActive() == null)
{ {
......
package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
import com.ruoyi.inventory.service.IStorageLocationsCategoryService;
/**
* 库位存放分类Service业务层处理
*
* @author ruoyi
* @date 2025-12-01
*/
@Service
public class StorageLocationsCategoryServiceImpl implements IStorageLocationsCategoryService
{
@Autowired
private StorageLocationsCategoryMapper storageLocationsCategoryMapper;
/**
* 查询库位存放分类
*
* @param id 库位存放分类主键
* @return 库位存放分类
*/
@Override
public StorageLocationsCategory selectStorageLocationsCategoryById(String id)
{
return storageLocationsCategoryMapper.selectStorageLocationsCategoryById(id);
}
/**
* 查询库位存放分类列表
*
* @param storageLocationsCategory 库位存放分类
* @return 库位存放分类
*/
@Override
public List<StorageLocationsCategory> selectStorageLocationsCategoryList(StorageLocationsCategory storageLocationsCategory)
{
return storageLocationsCategoryMapper.selectStorageLocationsCategoryList(storageLocationsCategory);
}
/**
* 新增库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
@Override
public int insertStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory)
{
storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
return storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
/**
* 修改库位存放分类
*
* @param storageLocationsCategory 库位存放分类
* @return 结果
*/
@Override
public int updateStorageLocationsCategory(StorageLocationsCategory storageLocationsCategory)
{
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
return storageLocationsCategoryMapper.updateStorageLocationsCategory(storageLocationsCategory);
}
/**
* 批量删除库位存放分类
*
* @param ids 需要删除的库位存放分类主键
* @return 结果
*/
@Override
public int deleteStorageLocationsCategoryByIds(String[] ids)
{
return storageLocationsCategoryMapper.deleteStorageLocationsCategoryByIds(ids);
}
/**
* 删除库位存放分类信息
*
* @param id 库位存放分类主键
* @return 结果
*/
@Override
public int deleteStorageLocationsCategoryById(String id)
{
return storageLocationsCategoryMapper.deleteStorageLocationsCategoryById(id);
}
}
package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.inventory.domain.MaterialsCategory;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
import com.ruoyi.inventory.mapper.MaterialsCategoryMapper;
import com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.StorageLocationsMapper;
import com.ruoyi.inventory.domain.StorageLocations;
import com.ruoyi.inventory.service.IStorageLocationsService;
/**
* 库位Service业务层处理
*
* @author ruoyi
* @date 2025-12-01
*/
@Service
public class StorageLocationsServiceImpl implements IStorageLocationsService
{
@Autowired
private StorageLocationsMapper storageLocationsMapper;
@Autowired
private StorageLocationsCategoryMapper storageLocationsCategoryMapper;
@Autowired
private MaterialsCategoryMapper materialsCategoryMapper;
/**
* 查询库位
*
* @param id 库位主键
* @return 库位
*/
@Override
public StorageLocations selectStorageLocationsById(String id)
{
return storageLocationsMapper.selectStorageLocationsById(id);
}
@Override
public List<StorageLocations> selectStorageLocationsByWarehousesCode(String warehousesCode) {
return storageLocationsMapper.selectStorageLocationsByWarehousesCode(warehousesCode);
}
@Override
public List<StorageLocations> selectStorageLocationsByWarehousesCodes(String[] warehousesCodes) {
return storageLocationsMapper.selectStorageLocationsByWarehousesCodes(warehousesCodes);
}
/**
* 查询库位列表
*
* @param storageLocations 库位
* @return 库位
*/
@Override
public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations)
{
return storageLocationsMapper.selectStorageLocationsList(storageLocations);
}
/**
* 新增库位
*
* @param storageLocations 库位
* @return 结果
*/
@Override
public int insertStorageLocations(StorageLocations storageLocations)
{
storageLocations.setCreateTime(DateUtils.getNowDate());
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory);
String LocationsID = UUID.randomUUID().toString();
storageLocations.setId(LocationsID);
storageLocations.setCreateTime(DateUtils.getNowDate());
storageLocations.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
storageLocationsCategory.setLocationCode(LocationsID);
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
for (String categoryId : CategoryId) {
storageLocationsCategory.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId);
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
return storageLocationsMapper.insertStorageLocations(storageLocations);
}
/**
* 修改库位
*
* @param storageLocations 库位
* @return 结果
*/
@Override
public int updateStorageLocations(StorageLocations storageLocations)
{
storageLocations.setUpdateTime(DateUtils.getNowDate());
storageLocations.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
String LocationsID = storageLocations.getId();
String LocationsCode = storageLocations.getLocationCode();
StorageLocations storageLocations1 = storageLocationsMapper.selectStorageLocationsById(LocationsID);
if (storageLocations1.getAllowedCategoryIds()!=storageLocations.getAllowedCategoryIds()||storageLocations1.getIsEnabled()!=storageLocations.getIsEnabled()){
storageLocationsCategoryMapper.deleteStorageLocationsCategoryByLocationCode(LocationsID);
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory);
storageLocationsCategory.setLocationCode(LocationsID);
for (String categoryId : CategoryId) {
storageLocations.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(categoryId);
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
return storageLocationsMapper.updateStorageLocations(storageLocations);
}
/**
* 批量删除库位
*
* @param ids 需要删除的库位主键
* @return 结果
*/
@Override
public int deleteStorageLocationsByIds(String[] ids)
{
storageLocationsCategoryMapper.deleteStorageLocationsCategoryByIds(ids);
return storageLocationsMapper.deleteStorageLocationsByIds(ids);
}
/**
* 删除库位信息
*
* @param id 库位主键
* @return 结果
*/
@Override
public int deleteStorageLocationsById(String id)
{
storageLocationsCategoryMapper.deleteStorageLocationsCategoryById(id);
return storageLocationsMapper.deleteStorageLocationsById(id);
}
@Override
public int updateLocationsCategoryStatus(String id)
{
storageLocationsCategoryMapper.updateStorageLocationsCategoryStatus(id);
return storageLocationsMapper.updateStorageLocationsStatus(id);
}
}
package com.ruoyi.inventory.service.impl;
import java.util.List;
import java.util.UUID;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.inventory.domain.StorageLocations;
import com.ruoyi.inventory.service.IWarehousesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.WarehousesMapper;
import com.ruoyi.inventory.domain.Warehouses;
/**
* 仓库Service业务层处理
*
* @author ruoyi
* @date 2025-12-01
*/
@Service
public class WarehousesServiceImpl implements IWarehousesService
{
@Autowired
private WarehousesMapper warehousesMapper;
@Autowired
private StorageLocationsServiceImpl storageLocationsService;
/**
* 查询仓库
*
* @param id 仓库主键
* @return 仓库
*/
@Override
public Warehouses selectWarehousesById(String id)
{
return warehousesMapper.selectWarehousesById(id);
}
/**
* 查询仓库列表
*
* @param warehouses 仓库
* @return 仓库
*/
@Override
public List<Warehouses> selectWarehousesList(Warehouses warehouses)
{
return warehousesMapper.selectWarehousesList(warehouses);
}
/**
* 新增仓库
*
* @param warehouses 仓库
* @return 结果
*/
@Override
public int insertWarehouses(Warehouses warehouses)
{
warehouses.setCreateTime(DateUtils.getNowDate());
warehouses.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
warehouses.setId(UUID.randomUUID().toString());
return warehousesMapper.insertWarehouses(warehouses);
}
/**
* 修改仓库
*
* @param warehouses 仓库
* @return 结果
*/
@Override
public int updateWarehouses(Warehouses warehouses)
{
warehouses.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
warehouses.setUpdateTime(DateUtils.getNowDate());
Warehouses warehouses1 = warehousesMapper.selectWarehousesById(warehouses.getId());
if (warehouses1.getIsEnabled()!=warehouses.getIsEnabled()){
updateWarehouseStatus(warehouses);
}
return warehousesMapper.updateWarehouses(warehouses);
}
@Override
public int updateWarehouseStatus(Warehouses warehouses)
{
storageLocationsService.updateLocationsCategoryStatus(warehouses.getWarehousesCode());
return warehousesMapper.updateWarehouseStatus(warehouses.getId());
}
/**
* 批量删除仓库
*
* @param ids 需要删除的仓库主键
* @return 结果
*/
@Override
public int deleteWarehousesByIds(String[] ids)
{
List<StorageLocations> storageLocations = storageLocationsService.selectStorageLocationsByWarehousesCodes(ids);
for (StorageLocations storageLocation : storageLocations) {
storageLocationsService.deleteStorageLocationsById(storageLocation.getId());
}
return warehousesMapper.deleteWarehousesByIds(ids);
}
/**
* 删除仓库信息
*
* @param id 仓库主键
* @return 结果
*/
@Override
public int deleteWarehousesById(String id)
{
List<StorageLocations> storageLocations = storageLocationsService.selectStorageLocationsByWarehousesCode(id);
for (StorageLocations storageLocation : storageLocations) {
storageLocationsService.deleteStorageLocationsById(storageLocation.getId());
}
return warehousesMapper.deleteWarehousesById(id);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.StorageLocationsCategoryMapper">
<resultMap type="StorageLocationsCategory" id="StorageLocationsCategoryResult">
<result property="id" column="id" />
<result property="locationCode" column="location_code" />
<result property="warehousesCode" column="warehouses_code" />
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_name" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectStorageLocationsCategoryVo">
select id, location_code, warehouses_code, category_id, category_name, sort_no, create_time, create_user_code, update_time, update_user_code from storage_locations_category
</sql>
<select id="selectStorageLocationsCategoryList" parameterType="StorageLocationsCategory" resultMap="StorageLocationsCategoryResult">
<include refid="selectStorageLocationsCategoryVo"/>
<where>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if>
<if test="categoryId != null and categoryId != ''"> and category_id = #{categoryId}</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectStorageLocationsCategoryById" parameterType="String" resultMap="StorageLocationsCategoryResult">
<include refid="selectStorageLocationsCategoryVo"/>
where id = #{id}
</select>
<insert id="insertStorageLocationsCategory" parameterType="StorageLocationsCategory">
insert into storage_locations_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="locationCode != null">location_code,</if>
<if test="warehousesCode != null">warehouses_code,</if>
<if test="categoryId != null">category_id,</if>
<if test="categoryName != null">category_name,</if>
<if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="warehousesCode != null">#{warehousesCode},</if>
<if test="categoryId != null">#{categoryId},</if>
<if test="categoryName != null">#{categoryName},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
</trim>
</insert>
<update id="updateStorageLocationsCategory" parameterType="StorageLocationsCategory">
update storage_locations_category
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="warehousesCode != null">warehouses_code = #{warehousesCode},</if>
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="categoryName != null">category_name = #{categoryName},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStorageLocationsCategoryById" parameterType="String">
update storage_locations_category set is_used = 0 where id= #{id}
</delete>
<delete id="deleteStorageLocationsCategoryByIds" parameterType="String">
update storage_locations_category set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.StorageLocationsMapper">
<resultMap type="StorageLocations" id="StorageLocationsResult">
<result property="id" column="id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehousesCode" column="warehouses_code" />
<result property="locationType" column="location_type" />
<result property="zoneCode" column="zone_code" />
<result property="rowCode" column="row_code" />
<result property="columnCode" column="column_code" />
<result property="layerCode" column="layer_code" />
<result property="capacity" column="capacity" />
<result property="volumeCapacity" column="volume_capacity" />
<result property="allowedHazardLevels" column="allowed_hazard_levels" />
<result property="allowedCategoryIds" column="allowed_category_ids" />
<result property="temperatureZone" column="temperature_zone" />
<result property="isEnabled" column="is_enabled" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectStorageLocationsVo">
select id, location_code, location_name, warehouses_code, location_type, zone_code, row_code, column_code, layer_code, capacity, volume_capacity, allowed_hazard_levels, allowed_category_ids, temperature_zone, is_enabled, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from storage_locations
</sql>
<select id="selectStorageLocationsList" parameterType="StorageLocations" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/>
<where>
<if test="locationCode != null and locationCode != ''"> and location_code = #{locationCode}</if>
<if test="locationName != null and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
<if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if>
<if test="locationType != null "> and location_type = #{locationType}</if>
<if test="zoneCode != null and zoneCode != ''"> and zone_code = #{zoneCode}</if>
<if test="rowCode != null and rowCode != ''"> and row_code = #{rowCode}</if>
<if test="columnCode != null and columnCode != ''"> and column_code = #{columnCode}</if>
<if test="layerCode != null and layerCode != ''"> and layer_code = #{layerCode}</if>
<if test="capacity != null "> and capacity = #{capacity}</if>
<if test="volumeCapacity != null "> and volume_capacity = #{volumeCapacity}</if>
<if test="allowedHazardLevels != null and allowedHazardLevels != ''"> and allowed_hazard_levels = #{allowedHazardLevels}</if>
<if test="allowedCategoryIds != null and allowedCategoryIds != ''"> and allowed_category_ids = #{allowedCategoryIds}</if>
<if test="temperatureZone != null and temperatureZone != ''"> and temperature_zone = #{temperatureZone}</if>
<if test="isEnabled != null "> and is_enabled = #{isEnabled}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectStorageLocationsById" parameterType="String" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/>
where id = #{id}
</select>
<select id="selectStorageLocationsByWarehousesCode" parameterType="String" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/>
where warehouses_code = #{warehousesCode}
</select>
<select id="selectStorageLocationsByWarehousesCodes" parameterType="String" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/>
where warehouses_code in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{warehousesCodes}
</foreach>
</select>
<insert id="insertStorageLocations" parameterType="StorageLocations">
insert into storage_locations
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="locationCode != null">location_code,</if>
<if test="locationName != null">location_name,</if>
<if test="warehousesCode != null">warehouses_code,</if>
<if test="locationType != null">location_type,</if>
<if test="zoneCode != null">zone_code,</if>
<if test="rowCode != null">row_code,</if>
<if test="columnCode != null">column_code,</if>
<if test="layerCode != null">layer_code,</if>
<if test="capacity != null">capacity,</if>
<if test="volumeCapacity != null">volume_capacity,</if>
<if test="allowedHazardLevels != null">allowed_hazard_levels,</if>
<if test="allowedCategoryIds != null">allowed_category_ids,</if>
<if test="temperatureZone != null">temperature_zone,</if>
<if test="isEnabled != null">is_enabled,</if>
<if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="locationName != null">#{locationName},</if>
<if test="warehousesCode != null">#{warehousesCode},</if>
<if test="locationType != null">#{locationType},</if>
<if test="zoneCode != null">#{zoneCode},</if>
<if test="rowCode != null">#{rowCode},</if>
<if test="columnCode != null">#{columnCode},</if>
<if test="layerCode != null">#{layerCode},</if>
<if test="capacity != null">#{capacity},</if>
<if test="volumeCapacity != null">#{volumeCapacity},</if>
<if test="allowedHazardLevels != null">#{allowedHazardLevels},</if>
<if test="allowedCategoryIds != null">#{allowedCategoryIds},</if>
<if test="temperatureZone != null">#{temperatureZone},</if>
<if test="isEnabled != null">#{isEnabled},</if>
<if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
</trim>
</insert>
<update id="updateStorageLocations" parameterType="StorageLocations">
update storage_locations
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="locationName != null">location_name = #{locationName},</if>
<if test="warehousesCode != null">warehouses_code = #{warehousesCode},</if>
<if test="locationType != null">location_type = #{locationType},</if>
<if test="zoneCode != null">zone_code = #{zoneCode},</if>
<if test="rowCode != null">row_code = #{rowCode},</if>
<if test="columnCode != null">column_code = #{columnCode},</if>
<if test="layerCode != null">layer_code = #{layerCode},</if>
<if test="capacity != null">capacity = #{capacity},</if>
<if test="volumeCapacity != null">volume_capacity = #{volumeCapacity},</if>
<if test="allowedHazardLevels != null">allowed_hazard_levels = #{allowedHazardLevels},</if>
<if test="allowedCategoryIds != null">allowed_category_ids = #{allowedCategoryIds},</if>
<if test="temperatureZone != null">temperature_zone = #{temperatureZone},</if>
<if test="isEnabled != null">is_enabled = #{isEnabled},</if>
<if test="isUsed != null">is_used = #{isUsed},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStorageLocationsById" parameterType="String">
update storage_locations set is_used = 0 where id = #{id}
</delete>
<delete id="deleteStorageLocationsByIds" parameterType="String">
update storage_locations set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.WarehousesMapper">
<resultMap type="Warehouses" id="WarehousesResult">
<result property="id" column="id" />
<result property="warehousesCode" column="warehouses_code" />
<result property="warehousesName" column="warehouses_name" />
<result property="warehouseType" column="warehouse_type" />
<result property="address" column="address" />
<result property="area" column="area" />
<result property="capacity" column="capacity" />
<result property="manager" column="manager" />
<result property="contactPhone" column="contact_phone" />
<result property="isEnabled" column="is_enabled" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
</resultMap>
<sql id="selectWarehousesVo">
select id, warehouses_code, warehouses_name, warehouse_type, address, area, capacity, manager, contact_phone, is_enabled, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from warehouses
</sql>
<select id="selectWarehousesList" parameterType="Warehouses" resultMap="WarehousesResult">
<include refid="selectWarehousesVo"/>
<where>
<if test="warehousesCode != null and warehousesCode != ''"> and warehouses_code = #{warehousesCode}</if>
<if test="warehousesName != null and warehousesName != ''"> and warehouses_name like concat('%', #{warehousesName}, '%')</if>
<if test="warehouseType != null "> and warehouse_type = #{warehouseType}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="area != null "> and area = #{area}</if>
<if test="capacity != null "> and capacity = #{capacity}</if>
<if test="manager != null and manager != ''"> and manager = #{manager}</if>
<if test="contactPhone != null and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
<if test="isEnabled != null "> and is_enabled = #{isEnabled}</if>
<if test="isUsed != null "> and is_used = #{isUsed}</if>
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
</where>
</select>
<select id="selectWarehousesById" parameterType="String" resultMap="WarehousesResult">
<include refid="selectWarehousesVo"/>
where id = #{id}
</select>
<insert id="insertWarehouses" parameterType="Warehouses">
insert into warehouses
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="warehousesCode != null">warehouses_code,</if>
<if test="warehousesName != null">warehouses_name,</if>
<if test="warehouseType != null">warehouse_type,</if>
<if test="address != null">address,</if>
<if test="area != null">area,</if>
<if test="capacity != null">capacity,</if>
<if test="manager != null">manager,</if>
<if test="contactPhone != null">contact_phone,</if>
<if test="isEnabled != null">is_enabled,</if>
<if test="isUsed != null">is_used,</if>
<if test="sortNo != null">sort_no,</if>
<if test="createTime != null">create_time,</if>
<if test="createUserCode != null">create_user_code,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateUserCode != null">update_user_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="warehousesCode != null">#{warehousesCode},</if>
<if test="warehousesName != null">#{warehousesName},</if>
<if test="warehouseType != null">#{warehouseType},</if>
<if test="address != null">#{address},</if>
<if test="area != null">#{area},</if>
<if test="capacity != null">#{capacity},</if>
<if test="manager != null">#{manager},</if>
<if test="contactPhone != null">#{contactPhone},</if>
<if test="isEnabled != null">#{isEnabled},</if>
<if test="isUsed != null">#{isUsed},</if>
<if test="sortNo != null">#{sortNo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUserCode != null">#{createUserCode},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateUserCode != null">#{updateUserCode},</if>
</trim>
</insert>
<update id="updateWarehouses" parameterType="Warehouses">
update warehouses
<trim prefix="SET" suffixOverrides=",">
<if test="warehousesCode != null">warehouses_code = #{warehousesCode},</if>
<if test="warehousesName != null">warehouses_name = #{warehousesName},</if>
<if test="warehouseType != null">warehouse_type = #{warehouseType},</if>
<if test="address != null">address = #{address},</if>
<if test="area != null">area = #{area},</if>
<if test="capacity != null">capacity = #{capacity},</if>
<if test="manager != null">manager = #{manager},</if>
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
<if test="isEnabled != null">is_enabled = #{isEnabled},</if>
<if test="isUsed != null">is_used = #{isUsed},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUserCode != null">create_user_code = #{createUserCode},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateUserCode != null">update_user_code = #{updateUserCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWarehousesById" parameterType="String">
delete from warehouses where id = #{id}
</delete>
<delete id="deleteWarehousesByIds" parameterType="String">
delete from warehouses where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论