Commit 0c8bf004 by yubin

inventory

parent d9ba64a8
......@@ -59,7 +59,7 @@ export default {
unmatch() {
this.unmatchArray = []
// 没有value不显示
if (this.value === null || typeof this.value === 'undefined' || this.value === '' || this.options.length === 0) return false
if (this.value === null || typeof this.value === 'undefined' || this.value === '' || !this.options || this.options.length === 0) return false
// 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => {
......
......@@ -176,6 +176,15 @@ export const dynamicRoutes = [
title: '物料管理',
permissions: ['inventory:materials:list']
}
},
{
path: 'materials_category',
component: () => import('@/views/inventory/materials_category/index'),
name: 'MaterialsCategory',
meta: {
title: '物料分类管理',
permissions: ['inventory:materials_category:list']
}
}
]
}
......
......@@ -18,12 +18,21 @@
/>
</el-form-item>
<el-form-item label="仓库编码" prop="warehousesCode">
<el-input
<el-select
v-model="queryParams.warehousesCode"
placeholder="请输入仓库编码"
placeholder="请选择仓库编码"
clearable
@keyup.enter.native="handleQuery"
@change="handleQuery"
filterable
style="width: 100%;"
>
<el-option
v-for="warehouse in warehouseOptions"
:key="warehouse.value"
:label="warehouse.label"
:value="warehouse.value"
/>
</el-select>
</el-form-item>
<el-form-item label="层" prop="layerCode">
<el-input
......@@ -39,12 +48,13 @@
placeholder="请选择库位类型"
clearable
@change="handleQuery"
style="width: 100%;"
>
<el-option
v-for="dict in dict.type.location_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="item in dict.type.location_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
......@@ -100,33 +110,81 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="locationsList" @selection-change="handleSelectionChange">
<el-table ref="locationsTable" v-loading="loading" :data="locationsList" @selection-change="handleSelectionChange" @row-click="handleRowClick" row-key="id">
<el-table-column type="expand">
<template slot-scope="scope">
<el-row :gutter="20" style="margin: 10px 0;">
<el-col :span="6">
<div><strong>区域代码:</strong>{{ scope.row.zoneCode || '-' }}</div>
</el-col>
<el-col :span="6">
<div><strong>排:</strong>{{ scope.row.rowCode || '-' }}</div>
</el-col>
<el-col :span="6">
<div><strong>列:</strong>{{ scope.row.columnCode || '-' }}</div>
</el-col>
<el-col :span="6">
<div><strong>层:</strong>{{ scope.row.layerCode || '-' }}</div>
</el-col>
</el-row>
</template>
</el-table-column>
<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">
<el-table-column label="库位编码" align="center" prop="locationCode" width="120" />
<el-table-column label="库位名称" align="center" prop="locationName" width="150" />
<el-table-column label="仓库编码" align="center" prop="warehousesCode" width="180">
<template slot-scope="scope">
{{ getWarehouseName(scope.row.warehousesCode) }}
</template>
</el-table-column>
<el-table-column label="库位类型" align="center" prop="locationType" width="100">
<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">
<el-table-column label="允许存放的分类名称" align="center" prop="allowedCategoryNames" width="300">
<template slot-scope="scope">
<el-tooltip
:content="scope.row.allowedCategoryNames"
placement="top"
effect="light"
:disabled="!(scope.row.allowedCategoryNames && scope.row.allowedCategoryNames.split(',').length > 3)"
>
<div class="category-tags">
<el-tag
v-for="(name, index) in (scope.row.allowedCategoryNames ? scope.row.allowedCategoryNames.split(',') : [])"
:key="name"
type="info"
size="small"
style="margin-right: 5px; margin-bottom: 5px;"
v-show="index < 3"
>
{{ name }}
</el-tag>
<el-tag
v-if="(scope.row.allowedCategoryNames ? scope.row.allowedCategoryNames.split(',').length : 0) > 3"
type="info"
size="small"
style="margin-right: 5px; margin-bottom: 5px; background: #f0f9eb; border-color: #c2e7b0;"
>
+{{ (scope.row.allowedCategoryNames ? scope.row.allowedCategoryNames.split(',').length : 0) - 3 }}
</el-tag>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="温区" align="center" prop="temperatureZone" width="120" />
<el-table-column label="应用状态" align="center" prop="isEnabled" width="100" fixed="right">
<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">
<el-table-column label="排序" align="center" prop="sortNo" width="80" />
<el-table-column label="创建日期" align="center" prop="createTime" width="180" fixed="right" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
......@@ -156,104 +214,126 @@
<!-- 添加或修改库位对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="160px">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库位编码" prop="locationCode">
<el-input v-model="form.locationCode" placeholder="请输入库位编码" />
<el-input
v-model="form.locationCode"
placeholder="请输入库位编码"
:readonly="!!form.id"
:disabled="!!form.id"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库位名称" prop="locationName">
<el-input v-model="form.locationName" placeholder="请输入库位名称" />
<el-input
v-model="form.locationName"
placeholder="请输入库位名称"
:readonly="!!form.id"
:disabled="!!form.id"
/>
</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-select
v-model="form.warehousesCode"
placeholder="请选择仓库编码"
filterable
:loading="loadingWarehouse"
style="width: 100%;"
>
<el-option
v-for="dict in dict.type.location_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="warehouse in warehouseOptions"
:key="warehouse.value"
:label="warehouse.label"
:value="warehouse.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-form-item label="库位类型" prop="locationType">
<el-select v-model="form.locationType" placeholder="请选择库位类型" style="width: 100%;">
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.label"
:value="dict.value"
v-for="item in dict.type.location_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="区域代码" prop="zoneCode">
<el-input v-model="form.zoneCode" placeholder="请输入区域代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排" prop="rowCode">
<el-input v-model="form.rowCode" placeholder="请输入排" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<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-row>
<el-row :gutter="20">
<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-row>
<el-row :gutter="20">
<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 label="物料" prop="materialUuids">
<div style="display: flex; align-items: center;">
<el-input v-model="form.materialNames" placeholder="" readonly style="flex: 1;" />
<el-button type="primary" size="small" @click="showMaterialSelect = true" style="margin-left: 10px">选择物料</el-button>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="应用状态" prop="isEnabled">
<el-radio-group v-model="form.isEnabled" style="width: 100%;">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排序" prop="sortNo">
<el-input v-model="form.sortNo" placeholder="请输入排序" />
<el-input v-model.number="form.sortNo" type="number" placeholder="请输入排序" min="0" step="1" />
</el-form-item>
</el-col>
<el-col :span="24">
......@@ -269,15 +349,24 @@
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 物料选择组件 -->
<MaterialSelectComponent
:visible.sync="showMaterialSelect"
@selection-confirm="handleMaterialSelectionConfirm"
@selection-cancel="handleMaterialSelectionCancel"
/>
</div>
</template>
<script>
import { listLocations, getLocations, delLocations, addLocations, updateLocations } from "@/api/inventory/locations"
import { listMaterials_category }from "@/api/inventory/materials"
import { listWarehouses } from "@/api/inventory/warehouses"
import MaterialSelectComponent from "./MaterialSelectComponent.vue"
export default {
name: "Locations",
components: { MaterialSelectComponent },
data() {
return {
// 遮罩层
......@@ -340,22 +429,97 @@ export default {
form: {},
// 表单校验
rules: {
}
locationCode: [
{ required: true, message: '库位编码不能为空', trigger: 'blur' },
{ min: 1, max: 50, message: '库位编码长度不能超过50个字符', trigger: 'blur' }
],
locationName: [
{ required: true, message: '库位名称不能为空', trigger: 'blur' },
{ min: 1, max: 100, message: '库位名称长度不能超过100个字符', trigger: 'blur' }
],
warehousesCode: [
{ required: true, message: '仓库编码不能为空', trigger: 'change' }
],
locationType: [
{ required: true, message: '库位类型不能为空', trigger: 'change' }
],
isEnabled: [
{ required: true, message: '应用状态不能为空', trigger: 'change' }
]
},
// 仓库列表
warehouseOptions: [],
// 仓库加载状态
loadingWarehouse: false,
// 物料选择组件显示状态
showMaterialSelect: false
}
},
created() {
this.getList()
this.getWarehouseOptions()
},
methods: {
/** 处理行点击事件 */
handleRowClick(row, event, column) {
// 排除点击选择列时触发展开/折叠
if (column.type !== 'selection') {
this.$refs.locationsTable.toggleRowExpansion(row)
}
},
/** 查询库位列表 */
getList() {
this.loading = true
listLocations(this.queryParams).then(response => {
// 添加is_used=0条件,只查询未被使用的库位
const params = {
...this.queryParams,
isUsed: 0
}
listLocations(params).then(response => {
this.locationsList = response.rows
this.total = response.total
this.loading = false
})
},
/** 查询仓库列表 */
getWarehouseOptions() {
this.loadingWarehouse = true
// 移除isUsed=0条件,查询所有仓库
listWarehouses({ pageNum: 1, pageSize: 100 }).then(response => {
// 调试:查看仓库数据结构
console.log('仓库数据:', response)
// 确保rows存在且为数组
const rows = response.rows || []
// 处理不同可能的数据结构
this.warehouseOptions = rows.map(item => {
// 根据实际数据结构调整字段名
const warehouseName = item.warehousesName || item.name || '未命名仓库'
const warehouseCode = item.warehouseCode || item.code || item.warehousesCode || ''
return {
label: `${warehouseName} (${warehouseCode})`,
value: warehouseCode
}
}).filter(option => option.value) // 过滤掉无效的仓库选项
console.log('处理后的仓库选项:', this.warehouseOptions)
this.loadingWarehouse = false
}).catch(error => {
console.error('获取仓库列表失败:', error)
this.warehouseOptions = []
this.loadingWarehouse = false
})
},
/** 根据仓库编码获取仓库名称 */
getWarehouseName(warehouseCode) {
if (!warehouseCode) return ''
const warehouse = this.warehouseOptions.find(item => item.value === warehouseCode)
return warehouse ? warehouse.label : warehouseCode
},
// 取消按钮
cancel() {
this.open = false
......@@ -376,7 +540,8 @@ export default {
capacity: null,
volumeCapacity: null,
allowedHazardLevels: null,
allowedCategoryIds: null,
materialUuids: null,
materialNames: null,
temperatureZone: null,
isEnabled: null,
isUsed: null,
......@@ -424,14 +589,19 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// 直接使用表单数据,不需要转换仓库编码字段名
const submitData = {
...this.form
}
if (this.form.id != null) {
updateLocations(this.form).then(response => {
updateLocations(submitData).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addLocations(this.form).then(response => {
addLocations(submitData).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
......@@ -455,6 +625,17 @@ export default {
this.download('inventory/locations/export', {
...this.queryParams
}, `locations_${new Date().getTime()}.xlsx`)
},
/** 处理物料选择确认 */
handleMaterialSelectionConfirm(uuids, names) {
this.form.materialUuids = uuids
this.form.materialNames = names
},
/** 处理物料选择取消 */
handleMaterialSelectionCancel() {
// 可以根据需要执行取消操作
}
}
}
......
......@@ -13,7 +13,7 @@
:default-expand-all="true"
:highlight-current="true"
:loading="loadingTree"
@node-click="handleTreeClick"
@selected-change="handleCategoryChange"
>
<!-- 自定义节点内容插槽 -->
<template #node-content="{ node, data }">
......@@ -341,6 +341,7 @@ import 'splitpanes/dist/splitpanes.css'
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import ImportExcel from "@/components/ImportExcel/index"
import request from '@/utils/request'
export default {
name: "Materials",
......@@ -387,8 +388,8 @@ export default {
// 是否显示弹出层
open: false,
// 当前选中的树节点ID
currentNodeId: null,
// 当前选中的分类列表
selectedCategories: [],
// 查询参数
queryParams: {
......@@ -401,6 +402,7 @@ export default {
categoryCode: null,
categoryNameInput: null,
specification: null,
categoryCodes: []
},
// 表单参数
......@@ -545,38 +547,85 @@ export default {
return result
},
/** 处理树节点点击 */
handleTreeClick(data) {
console.log('点击树节点:', data)
this.currentNodeId = data.sid
/** 处理分类选择变化 */
handleCategoryChange(selectedData) {
console.log('选择分类变化:', selectedData)
this.selectedCategories = selectedData;
// 更新查询参数,按选中的分类筛选物料
this.queryParams.categoryCode = data.categoryCode
this.queryParams.categoryNameInput = null // 清空名称输入
this.queryParams.pageNum = 1
this.getList()
},
if (selectedData.length > 0) {
// 获取所有选中分类的编码
this.queryParams.categoryCodes = selectedData.map(item => item.categoryCode);
// 清空单个分类编码和名称输入
this.queryParams.categoryCode = null;
this.queryParams.categoryNameInput = null;
} else {
// 未选中任何分类,清空所有分类相关参数
this.queryParams.categoryCodes = [];
this.queryParams.categoryCode = null;
}
this.queryParams.pageNum = 1;
this.getList();
},
/** 查询物料列表 */
getList() {
async getList() {
this.loading = true
listMaterials(this.queryParams).then(response => {
try {
let materialsList = [];
let total = 0;
// 检查是否有多个分类编码
if (this.queryParams.categoryCodes && this.queryParams.categoryCodes.length > 0) {
// 使用getMaterial接口并行获取每个分类的物料
const promises = this.queryParams.categoryCodes.map(categoryCode =>
request({
url: `/inventory/materials/getMaterial/${categoryCode}`,
method: 'get'
})
);
const results = await Promise.all(promises);
// 合并所有物料并去重
const materialMap = new Map();
results.forEach(result => {
if (result && result.data) {
const materials = Array.isArray(result.data) ? result.data : [result.data];
materials.forEach(material => {
if (!materialMap.has(material.id)) {
materialMap.set(material.id, material);
materialsList.push(material);
}
});
}
});
total = materialsList.length;
} else {
// 单分类或无分类查询,使用原接口
const response = await listMaterials(this.queryParams);
materialsList = response.rows;
total = response.total;
}
// 对物料列表中的分类字段做映射处理
this.materialsList = response.rows
this.materialsList = materialsList
.filter(item => item.isUsed !== 0 && item.isUsed !== '0')
.map(item => ({
...item,
// 兜底:如果映射表中没有,显示原始code并标注
displayCategory: this.categoryMap[item.categoryCode] || `${item.categoryCode}(未匹配分类)`
}));
this.total = response.total;
}).catch(() => {
this.loading = false;
}).finally(() => {
this.total = total;
} catch (error) {
console.error('获取物料列表失败:', error);
this.materialsList = [];
this.total = 0;
} finally {
this.loading = false;
})
}
},
// 取消按钮
......@@ -659,12 +708,14 @@ export default {
categoryCode: null,
categoryNameInput: null,
specification: null,
categoryCodes: []
};
this.currentNodeId = null;
this.selectedCategories = [];
// 修复树形高亮重置:直接操作 TreeComponent 内部的 el-tree
if (this.$refs.treeComponent && this.$refs.treeComponent.$refs.tree) {
this.$refs.treeComponent.$refs.tree.setCurrentKey(null); // 清空选中
this.$refs.treeComponent.$refs.tree.setCheckedKeys([]); // 清空勾选
} else if (this.$refs.treeComponent) {
// 如果 TreeComponent 有自定义重置方法
this.$refs.treeComponent.resetTree();
......
......@@ -92,10 +92,10 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="warehousesList" @selection-change="handleSelectionChange">
<el-table v-loading="loading" :data="warehousesList" @selection-change="handleSelectionChange" :scroll-x="true">
<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="warehousesCode" width="120" />
<el-table-column label="仓库名称" align="center" prop="warehousesName" width="150" />
<el-table-column label="仓库类型" align="center" prop="warehouseType">
<template slot-scope="scope">
{{ selectDictLabel(dict.type.warehouse_type, scope.row.warehouseType) }}
......@@ -106,14 +106,14 @@
<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">
<el-table-column label="排序" align="center" prop="sortNo" width="80" />
<el-table-column label="应用状态" align="center" prop="isEnabled" width="100" fixed="right">
<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">
<el-table-column label="创建日期" align="center" prop="createTime" width="180" fixed="right" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
......@@ -194,21 +194,16 @@
</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-radio-group v-model="form.isEnabled">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</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="请输入排序" />
......
......@@ -3,7 +3,6 @@ package com.ruoyi.web.controller.inventory;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -83,6 +82,15 @@ public class MaterialsCategoryController extends BaseController
}
/**
* 获取物料树(带分类)结构
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:list')")
@GetMapping("/materialsTree")
public AjaxResult materialsTree(MaterialsCategory materialsCategory)
{
return success(materialsCategoryService.selectMaterialsCategoryTreeList(materialsCategory));
}
/**
* 新增物料分类
*/
@PreAuthorize("@ss.hasPermi('inventory:materials_category:add')")
......
......@@ -4,8 +4,7 @@ import java.util.List;
import java.util.UUID;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.inventory.domain.Owners;
import com.ruoyi.common.core.domain.entity.Materials;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -20,7 +19,6 @@ 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.Materials;
import com.ruoyi.inventory.service.IMaterialsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
......@@ -75,6 +73,16 @@ public class MaterialsController extends BaseController
}
/**
* 获取物料详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:query')")
@GetMapping(value = "getMaterial/{id}")
public AjaxResult getMaterialByCategory(@PathVariable("id") String id)
{
return success(materialsService.selectMaterialsByCategory(id));
}
/**
* 新增物料
*/
@PreAuthorize("@ss.hasPermi('inventory:materials:add')")
......
......@@ -8,6 +8,7 @@ import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.StringUtils;
/**
......@@ -34,6 +35,10 @@ public class TreeSelect implements Serializable
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
/** 物料列表 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Materials> materials;
public TreeSelect()
{
......@@ -59,6 +64,17 @@ public class TreeSelect implements Serializable
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 带物料的构造函数
*/
public TreeSelect(MaterialsCategory materialsCategory, List<Materials> materialsList){
this.sid = materialsCategory.getId();
this.label = materialsCategory.getCategoryName();
this.disabled = StringUtils.equals(String.valueOf(0), String.valueOf(materialsCategory.getIsUsed()));
this.children = materialsCategory.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
this.materials = materialsList;
}
public String getId()
{
return id;
......@@ -106,4 +122,12 @@ public class TreeSelect implements Serializable
public void setSid(String sid) {
this.sid = sid;
}
public List<Materials> getMaterials() {
return materials;
}
public void setMaterials(List<Materials> materials) {
this.materials = materials;
}
}
package com.ruoyi.inventory.domain;
package com.ruoyi.common.core.domain.entity;
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;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 物料对象 materials
......
......@@ -4,6 +4,7 @@ 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;
import com.ruoyi.common.core.domain.entity.Materials;
import java.util.ArrayList;
import java.util.List;
......@@ -43,6 +44,10 @@ public class MaterialsCategory extends BaseEntity
private String parentName;
private List<MaterialsCategory> children = new ArrayList<MaterialsCategory>();
/** 分类下的物料列表 */
private List<Materials> materialsList = new ArrayList<Materials>();
/** 创建日期 */
private String createUserCode;
......@@ -141,6 +146,14 @@ public class MaterialsCategory extends BaseEntity
this.children = children;
}
public List<Materials> getMaterialsList() {
return materialsList;
}
public void setMaterialsList(List<Materials> materialsList) {
this.materialsList = materialsList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -156,6 +169,7 @@ public class MaterialsCategory extends BaseEntity
.append("isUsed", getIsUsed())
.append("parentName", getParentName())
.append("children", getChildren())
.append("materialsList", getMaterialsList())
.toString();
}
}
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.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
import com.ruoyi.inventory.service.IOutboundOrderItemsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 出库单明细Controller
*
* @author ruoyi
* @date 2025-12-03
*/
@RestController
@RequestMapping("/inventory/items")
public class OutboundOrderItemsController extends BaseController
{
@Autowired
private IOutboundOrderItemsService outboundOrderItemsService;
/**
* 查询出库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:items:list')")
@GetMapping("/list")
public TableDataInfo list(OutboundOrderItems outboundOrderItems)
{
startPage();
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
return getDataTable(list);
}
/**
* 导出出库单明细列表
*/
@PreAuthorize("@ss.hasPermi('inventory:items:export')")
@Log(title = "出库单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrderItems outboundOrderItems)
{
List<OutboundOrderItemsInventory> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems);
ExcelUtil<OutboundOrderItemsInventory> util = new ExcelUtil<OutboundOrderItemsInventory>(OutboundOrderItemsInventory.class);
util.exportExcel(response, list, "出库单明细数据");
}
/**
* 获取出库单明细详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:items:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(outboundOrderItemsService.selectOutboundOrderItemsById(id));
}
/**
* 新增出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:add')")
@Log(title = "出库单明细", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OutboundOrderItems outboundOrderItems)
{
return toAjax(outboundOrderItemsService.insertOutboundOrderItems(outboundOrderItems));
}
/**
* 修改出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:edit')")
@Log(title = "出库单明细", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OutboundOrderItems outboundOrderItems)
{
return toAjax(outboundOrderItemsService.updateOutboundOrderItems(outboundOrderItems));
}
/**
* 删除出库单明细
*/
@PreAuthorize("@ss.hasPermi('inventory:items:remove')")
@Log(title = "出库单明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(outboundOrderItemsService.deleteOutboundOrderItemsByIds(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.OutboundOrders;
import com.ruoyi.inventory.service.IOutboundOrdersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 出库单主Controller
*
* @author ruoyi
* @date 2025-12-03
*/
@RestController
@RequestMapping("/inventory/orders")
public class OutboundOrdersController extends BaseController
{
@Autowired
private IOutboundOrdersService outboundOrdersService;
/**
* 查询出库单主列表
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:list')")
@GetMapping("/list")
public TableDataInfo list(OutboundOrders outboundOrders)
{
startPage();
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders);
return getDataTable(list);
}
/**
* 导出出库单主列表
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:export')")
@Log(title = "出库单主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrders outboundOrders)
{
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders);
ExcelUtil<OutboundOrders> util = new ExcelUtil<OutboundOrders>(OutboundOrders.class);
util.exportExcel(response, list, "出库单主数据");
}
/**
* 获取出库单主详细信息
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(outboundOrdersService.selectOutboundOrdersById(id));
}
/**
* 新增出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:add')")
@Log(title = "出库单主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OutboundOrders outboundOrders)
{
return toAjax(outboundOrdersService.insertOutboundOrders(outboundOrders));
}
/**
* 修改出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:edit')")
@Log(title = "出库单主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OutboundOrders outboundOrders)
{
return toAjax(outboundOrdersService.updateOutboundOrders(outboundOrders));
}
/**
* 删除出库单主
*/
@PreAuthorize("@ss.hasPermi('inventory:orders:remove')")
@Log(title = "出库单主", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(outboundOrdersService.deleteOutboundOrdersByIds(ids));
}
}
package com.ruoyi.inventory.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 出库单明细对象 outbound_order_items
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrderItems extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 出库单号 检索条件 */
@Excel(name = "出库单号 检索条件")
private String orderId;
/** 货物ID 字典,检索条件 */
@Excel(name = "货物ID 字典,检索条件")
private String materialId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchCode;
/** 仓库ID 检索条件 */
@Excel(name = "仓库ID 检索条件")
private String warehouseId;
/** 库位ID 检索条件 */
@Excel(name = "库位ID 检索条件")
private String locationId;
/** 计划数量 */
@Excel(name = "计划数量")
private Long plannedQuantity;
/** 实际数量 */
@Excel(name = "实际数量")
private Long actualQuantity;
/** 约数 */
@Excel(name = "约数")
private Long divisor;
/** 标签颜色 字典,检索条件 */
@Excel(name = "标签颜色 字典,检索条件")
private Long labelColor;
/** 凭证号 检索条件 */
@Excel(name = "凭证号 检索条件")
private String voucherNumber;
/** 状态1-待发货 2-部分发货 3-已完成 字典,检索条件 */
@Excel(name = "状态1-待发货 2-部分发货 3-已完成 字典,检索条件")
private Long itemStatus;
/** 发货时间 暂无用 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发货时间 暂无用", width = 30, dateFormat = "yyyy-MM-dd")
private Date shippedAt;
/** 发货方 暂无用 */
@Excel(name = "发货方 暂无用")
private String shippedBy;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@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 setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatchCode(String batchCode)
{
this.batchCode = batchCode;
}
public String getBatchCode()
{
return batchCode;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setLocationId(String locationId)
{
this.locationId = locationId;
}
public String getLocationId()
{
return locationId;
}
public void setPlannedQuantity(Long plannedQuantity)
{
this.plannedQuantity = plannedQuantity;
}
public Long getPlannedQuantity()
{
return plannedQuantity;
}
public void setActualQuantity(Long actualQuantity)
{
this.actualQuantity = actualQuantity;
}
public Long getActualQuantity()
{
return actualQuantity;
}
public void setDivisor(Long divisor)
{
this.divisor = divisor;
}
public Long getDivisor()
{
return divisor;
}
public void setLabelColor(Long labelColor)
{
this.labelColor = labelColor;
}
public Long getLabelColor()
{
return labelColor;
}
public void setVoucherNumber(String voucherNumber)
{
this.voucherNumber = voucherNumber;
}
public String getVoucherNumber()
{
return voucherNumber;
}
public void setItemStatus(Long itemStatus)
{
this.itemStatus = itemStatus;
}
public Long getItemStatus()
{
return itemStatus;
}
public void setShippedAt(Date shippedAt)
{
this.shippedAt = shippedAt;
}
public Date getShippedAt()
{
return shippedAt;
}
public void setShippedBy(String shippedBy)
{
this.shippedBy = shippedBy;
}
public String getShippedBy()
{
return shippedBy;
}
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("orderId", getOrderId())
.append("materialId", getMaterialId())
.append("batchCode", getBatchCode())
.append("warehouseId", getWarehouseId())
.append("locationId", getLocationId())
.append("plannedQuantity", getPlannedQuantity())
.append("actualQuantity", getActualQuantity())
.append("divisor", getDivisor())
.append("labelColor", getLabelColor())
.append("voucherNumber", getVoucherNumber())
.append("itemStatus", getItemStatus())
.append("shippedAt", getShippedAt())
.append("shippedBy", getShippedBy())
.append("remark", getRemark())
.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 java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 出库单主对象 outbound_orders
*
* @author ruoyi
* @date 2025-12-03
*/
public class OutboundOrders extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private String id;
/** 出库单号 检索条件 */
@Excel(name = "出库单号 检索条件")
private String orderId;
/** 系统编号 检索条件 */
@Excel(name = "系统编号 检索条件")
private String systemNo;
/** 入库类型 字典,检索条件 */
@Excel(name = "入库类型 字典,检索条件")
private String orderTypeId;
/** 批次ID 检索条件 */
@Excel(name = "批次ID 检索条件")
private String batchCode;
/** 仓库ID 暂无用 */
@Excel(name = "仓库ID 暂无用")
private String warehouseId;
/** 货主ID */
@Excel(name = "货主ID")
private String ownerId;
/** 出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件 */
@Excel(name = "出库单状态1-草稿 2-已完成 3-已取消 字典,检索条件")
private Long orderStatus;
/** 出库日期 日期无时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库日期 日期无时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date inboundDate;
/** 目的地 */
@Excel(name = "目的地")
private String destination;
/** 计划量 暂无用 */
@Excel(name = "计划量 暂无用")
private Long totalPlannedQuantity;
/** 实际量 暂无用 */
@Excel(name = "实际量 暂无用")
private Long totalActualQuantity;
/** 总件数 暂无用 */
@Excel(name = "总件数 暂无用")
private Long totalPackages;
/** 应用数据1使用0删除 删除用 */
@Excel(name = "应用数据1使用0删除 删除用")
private Long isUsed;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 创建日期 */
@Excel(name = "创建日期")
private String createUserCode;
/** 排序号 */
@Excel(name = "排序号")
private String updateUserCode;
/** 出库单明细信息 */
private List<OutboundOrderItems> outboundOrderItemsList;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setOrderId(String orderId)
{
this.orderId = orderId;
}
public String getOrderId()
{
return orderId;
}
public void setSystemNo(String systemNo)
{
this.systemNo = systemNo;
}
public String getSystemNo()
{
return systemNo;
}
public void setOrderTypeId(String orderTypeId)
{
this.orderTypeId = orderTypeId;
}
public String getOrderTypeId()
{
return orderTypeId;
}
public void setBatchCode(String batchCode)
{
this.batchCode = batchCode;
}
public String getBatchCode()
{
return batchCode;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setOwnerId(String ownerId)
{
this.ownerId = ownerId;
}
public String getOwnerId()
{
return ownerId;
}
public void setOrderStatus(Long orderStatus)
{
this.orderStatus = orderStatus;
}
public Long getOrderStatus()
{
return orderStatus;
}
public void setInboundDate(Date inboundDate)
{
this.inboundDate = inboundDate;
}
public Date getInboundDate()
{
return inboundDate;
}
public void setDestination(String destination)
{
this.destination = destination;
}
public String getDestination()
{
return destination;
}
public void setTotalPlannedQuantity(Long totalPlannedQuantity)
{
this.totalPlannedQuantity = totalPlannedQuantity;
}
public Long getTotalPlannedQuantity()
{
return totalPlannedQuantity;
}
public void setTotalActualQuantity(Long totalActualQuantity)
{
this.totalActualQuantity = totalActualQuantity;
}
public Long getTotalActualQuantity()
{
return totalActualQuantity;
}
public void setTotalPackages(Long totalPackages)
{
this.totalPackages = totalPackages;
}
public Long getTotalPackages()
{
return totalPackages;
}
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;
}
public List<OutboundOrderItems> getOutboundOrderItemsList()
{
return outboundOrderItemsList;
}
public void setOutboundOrderItemsList(List<OutboundOrderItems> outboundOrderItemsList)
{
this.outboundOrderItemsList = outboundOrderItemsList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderId", getOrderId())
.append("systemNo", getSystemNo())
.append("orderTypeId", getOrderTypeId())
.append("batchCode", getBatchCode())
.append("warehouseId", getWarehouseId())
.append("ownerId", getOwnerId())
.append("orderStatus", getOrderStatus())
.append("inboundDate", getInboundDate())
.append("destination", getDestination())
.append("totalPlannedQuantity", getTotalPlannedQuantity())
.append("totalActualQuantity", getTotalActualQuantity())
.append("totalPackages", getTotalPackages())
.append("remark", getRemark())
.append("isUsed", getIsUsed())
.append("sortNo", getSortNo())
.append("createTime", getCreateTime())
.append("createUserCode", getCreateUserCode())
.append("updateTime", getUpdateTime())
.append("updateUserCode", getUpdateUserCode())
.append("outboundOrderItemsList", getOutboundOrderItemsList())
.toString();
}
}
......@@ -66,6 +66,17 @@ public class StorageLocations extends BaseEntity
@Excel(name = "允许存放的分类ID", readConverterExp = "逗=号分隔")
private String allowedCategoryIds;
/** 允许存放的分类name(前端显示,逗号分隔) */
private String allowedCategoryNames;
public String getAllowedCategoryNames() {
return allowedCategoryNames;
}
public void setAllowedCategoryNames(String allowedCategoryNames) {
this.allowedCategoryNames = allowedCategoryNames;
}
/** 温区 */
@Excel(name = "温区")
private String temperatureZone;
......
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.common.core.domain.entity.Materials;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 物料Mapper接口
......@@ -69,4 +69,12 @@ public interface MaterialsMapper
*/
public int updateMaterialsIsUsedByIds(String[] ids);
/**
* 批量删除,修改物料的使用状态
*
* @param id 需要删除的数据主键集合
* @return 结果
*/
public List<Materials> selectMaterialsByCategory(String id);
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
/**
* 出库单明细Mapper接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface OutboundOrderItemsMapper
{
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
public OutboundOrderItems selectOutboundOrderItemsById(String id);
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItems> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 删除出库单明细
*
* @param id 出库单明细主键
* @return 结果
*/
public int deleteOutboundOrderItemsById(String id);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByIds(String[] ids);
}
package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.domain.OutboundOrderItems;
/**
* 出库单主Mapper接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface OutboundOrdersMapper
{
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
public OutboundOrders selectOutboundOrdersById(String id);
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主集合
*/
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders);
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int insertOutboundOrders(OutboundOrders outboundOrders);
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int updateOutboundOrders(OutboundOrders outboundOrders);
/**
* 删除出库单主
*
* @param id 出库单主主键
* @return 结果
*/
public int deleteOutboundOrdersById(String id);
/**
* 批量删除出库单主
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrdersByIds(String[] ids);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByOrderIds(String[] ids);
/**
* 批量新增出库单明细
*
* @param outboundOrderItemsList 出库单明细列表
* @return 结果
*/
public int batchOutboundOrderItems(List<OutboundOrderItems> outboundOrderItemsList);
/**
* 通过出库单主主键删除出库单明细信息
*
* @param id 出库单主ID
* @return 结果
*/
public int deleteOutboundOrderItemsByOrderId(String id);
}
......@@ -2,6 +2,7 @@ package com.ruoyi.inventory.mapper;
import java.util.List;
import com.ruoyi.inventory.domain.StorageLocationsCategory;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
/**
......@@ -58,6 +59,7 @@ public interface StorageLocationsCategoryMapper
* @param locationCode 库位存放分类主键
* @return 结果
*/
@Delete("delete from storage_locations_category where location_code = #{locationCode}")
public int deleteStorageLocationsCategoryByLocationCode(String locationCode);
/**
* 批量删除库位存放分类
......
package com.ruoyi.inventory.service;
import com.ruoyi.common.core.domain.entity.Materials;
import java.util.List;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.inventory.domain.Owners;
/**
* 物料Service接口
......@@ -60,6 +60,8 @@ public interface IMaterialsService
*/
public int deleteMaterialsById(String id);
public List<Materials> selectMaterialsByCategory(String id);
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
/**
* 出库单明细Service接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IOutboundOrderItemsService
{
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
public OutboundOrderItemsInventory selectOutboundOrderItemsById(String id);
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细集合
*/
public List<OutboundOrderItemsInventory> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems);
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems);
/**
* 批量删除出库单明细
*
* @param ids 需要删除的出库单明细主键集合
* @return 结果
*/
public int deleteOutboundOrderItemsByIds(String[] ids);
/**
* 删除出库单明细信息
*
* @param id 出库单明细主键
* @return 结果
*/
public int deleteOutboundOrderItemsById(String id);
}
package com.ruoyi.inventory.service;
import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrders;
/**
* 出库单主Service接口
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IOutboundOrdersService
{
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
public OutboundOrders selectOutboundOrdersById(String id);
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主集合
*/
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders);
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int insertOutboundOrders(OutboundOrders outboundOrders);
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
public int updateOutboundOrders(OutboundOrders outboundOrders);
/**
* 批量删除出库单主
*
* @param ids 需要删除的出库单主主键集合
* @return 结果
*/
public int deleteOutboundOrdersByIds(String[] ids);
/**
* 删除出库单主信息
*
* @param id 出库单主主键
* @return 结果
*/
public int deleteOutboundOrdersById(String id);
}
......@@ -7,6 +7,7 @@ import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
......@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.MaterialsCategoryMapper;
import com.ruoyi.common.core.domain.entity.MaterialsCategory;
import com.ruoyi.inventory.service.IMaterialsCategoryService;
import com.ruoyi.inventory.service.IMaterialsService;
/**
* 物料分类Service业务层处理
......@@ -28,6 +30,9 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
@Autowired
private MaterialsCategoryMapper materialsCategoryMapper;
@Autowired
private IMaterialsService materialsService;
/**
* 查询物料分类
*
......@@ -93,6 +98,10 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
List<MaterialsCategory> childList = getChildList(materialsCategoryList, materialsCategory);
materialsCategory.setChildren(childList);
// 为当前分类添加物料列表
List<Materials> materialsList = materialsService.selectMaterialsByCategory(materialsCategory.getCategoryCode());
materialsCategory.setMaterialsList(materialsList);
// 如果有子节点,递归处理
if (!childList.isEmpty()) {
for (MaterialsCategory child : childList) {
......@@ -129,7 +138,7 @@ public class MaterialsCategoryServiceImpl implements IMaterialsCategoryService
@Override
public List<TreeSelect> buildTreeSelect(List<MaterialsCategory> materialsCategorys) {
List<MaterialsCategory> materialsCategories = buildMaterialsCategoryTree(materialsCategorys);
return materialsCategories.stream().map(TreeSelect::new).collect(Collectors.toList());
return materialsCategories.stream().map(category -> new TreeSelect(category, category.getMaterialsList())).collect(Collectors.toList());
}
/**
......
......@@ -4,15 +4,14 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
import com.ruoyi.common.core.domain.entity.Materials;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inventory.domain.Owners;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.MaterialsMapper;
import com.ruoyi.inventory.domain.Materials;
import com.ruoyi.inventory.service.IMaterialsService;
/**
......@@ -45,7 +44,6 @@ public class MaterialsServiceImpl implements IMaterialsService
* @param materials 物料
* @return 物料
*/
@Override
public List<Materials> selectMaterialsList(Materials materials)
{
return materialsMapper.selectMaterialsList(materials);
......@@ -102,6 +100,11 @@ public class MaterialsServiceImpl implements IMaterialsService
}
@Override
public List<Materials> selectMaterialsByCategory(String id) {
return materialsMapper.selectMaterialsByCategory(id);
}
@Override
public String importMaterials(List<Materials> materialsList, Boolean isUpdateSupport, String operName)
{
if (StringUtils.isNull(materialsList) || materialsList.size() == 0)
......
package com.ruoyi.inventory.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItemsInventory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.OutboundOrderItemsMapper;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.service.IOutboundOrderItemsService;
/**
* 出库单明细Service业务层处理
*
* @author ruoyi
* @date 2025-12-03
*/
@Service
public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
{
@Autowired
private OutboundOrderItemsMapper outboundOrderItemsMapper;
@Autowired
private InventoryServiceImpl inventoryService;
/**
* 查询出库单明细
*
* @param id 出库单明细主键
* @return 出库单明细
*/
@Override
public OutboundOrderItemsInventory selectOutboundOrderItemsById(String id)
{
OutboundOrderItems outboundOrderItems = outboundOrderItemsMapper.selectOutboundOrderItemsById(id);
Inventory inventory = new Inventory();
BeanUtils.copyProperties(outboundOrderItems, inventory);
Inventory inventory1 = inventoryService.selectInventory(inventory);
OutboundOrderItemsInventory outboundOrderItemsInventory = new OutboundOrderItemsInventory();
outboundOrderItemsInventory.setOutboundOrderItems(outboundOrderItems);
outboundOrderItemsInventory.setInventory(inventory1);
return outboundOrderItemsInventory;
}
/**
* 查询出库单明细列表
*
* @param outboundOrderItems 出库单明细
* @return 出库单明细
*/
@Override
public List<OutboundOrderItemsInventory> selectOutboundOrderItemsList(OutboundOrderItems outboundOrderItems)
{
List<OutboundOrderItems> itemsList = outboundOrderItemsMapper.selectOutboundOrderItemsList(outboundOrderItems);
List<OutboundOrderItemsInventory> resultList = new ArrayList<>();
for (OutboundOrderItems item : itemsList) {
Inventory inventory = new Inventory();
BeanUtils.copyProperties(item, inventory);
Inventory inventory1 = inventoryService.selectInventory(inventory);
OutboundOrderItemsInventory outboundOrderItemsInventory = new OutboundOrderItemsInventory();
outboundOrderItemsInventory.setOutboundOrderItems(item);
outboundOrderItemsInventory.setInventory(inventory1);
resultList.add(outboundOrderItemsInventory);
}
return resultList;
}
/**
* 新增出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
outboundOrderItems.setCreateTime(DateUtils.getNowDate());
return outboundOrderItemsMapper.insertOutboundOrderItems(outboundOrderItems);
}
/**
* 修改出库单明细
*
* @param outboundOrderItems 出库单明细
* @return 结果
*/
@Override
public int updateOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{
outboundOrderItems.setUpdateTime(DateUtils.getNowDate());
return outboundOrderItemsMapper.updateOutboundOrderItems(outboundOrderItems);
}
/**
* 批量删除出库单明细
*
* @param ids 需要删除的出库单明细主键
* @return 结果
*/
@Override
public int deleteOutboundOrderItemsByIds(String[] ids)
{
return outboundOrderItemsMapper.deleteOutboundOrderItemsByIds(ids);
}
/**
* 删除出库单明细信息
*
* @param id 出库单明细主键
* @return 结果
*/
@Override
public int deleteOutboundOrderItemsById(String id)
{
return outboundOrderItemsMapper.deleteOutboundOrderItemsById(id);
}
}
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 java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.mapper.OutboundOrdersMapper;
import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.service.IOutboundOrdersService;
/**
* 出库单主Service业务层处理
*
* @author ruoyi
* @date 2025-12-03
*/
@Service
public class OutboundOrdersServiceImpl implements IOutboundOrdersService
{
@Autowired
private OutboundOrdersMapper outboundOrdersMapper;
/**
* 查询出库单主
*
* @param id 出库单主主键
* @return 出库单主
*/
@Override
public OutboundOrders selectOutboundOrdersById(String id)
{
return outboundOrdersMapper.selectOutboundOrdersById(id);
}
/**
* 查询出库单主列表
*
* @param outboundOrders 出库单主
* @return 出库单主
*/
@Override
public List<OutboundOrders> selectOutboundOrdersList(OutboundOrders outboundOrders)
{
return outboundOrdersMapper.selectOutboundOrdersList(outboundOrders);
}
/**
* 新增出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
@Transactional
@Override
public int insertOutboundOrders(OutboundOrders outboundOrders)
{
outboundOrders.setCreateTime(DateUtils.getNowDate());
int rows = outboundOrdersMapper.insertOutboundOrders(outboundOrders);
insertOutboundOrderItems(outboundOrders);
return rows;
}
/**
* 修改出库单主
*
* @param outboundOrders 出库单主
* @return 结果
*/
@Transactional
@Override
public int updateOutboundOrders(OutboundOrders outboundOrders)
{
outboundOrders.setUpdateTime(DateUtils.getNowDate());
outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(outboundOrders.getId());
insertOutboundOrderItems(outboundOrders);
return outboundOrdersMapper.updateOutboundOrders(outboundOrders);
}
/**
* 批量删除出库单主
*
* @param ids 需要删除的出库单主主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutboundOrdersByIds(String[] ids)
{
outboundOrdersMapper.deleteOutboundOrderItemsByOrderIds(ids);
return outboundOrdersMapper.deleteOutboundOrdersByIds(ids);
}
/**
* 删除出库单主信息
*
* @param id 出库单主主键
* @return 结果
*/
@Transactional
@Override
public int deleteOutboundOrdersById(String id)
{
outboundOrdersMapper.deleteOutboundOrderItemsByOrderId(id);
return outboundOrdersMapper.deleteOutboundOrdersById(id);
}
/**
* 新增出库单明细信息
*
* @param outboundOrders 出库单主对象
*/
public void insertOutboundOrderItems(OutboundOrders outboundOrders)
{
List<OutboundOrderItems> outboundOrderItemsList = outboundOrders.getOutboundOrderItemsList();
String id = outboundOrders.getId();
if (StringUtils.isNotNull(outboundOrderItemsList))
{
List<OutboundOrderItems> list = new ArrayList<OutboundOrderItems>();
for (OutboundOrderItems outboundOrderItems : outboundOrderItemsList)
{
outboundOrderItems.setOrderId(id);
list.add(outboundOrderItems);
}
if (list.size() > 0)
{
outboundOrdersMapper.batchOutboundOrderItems(list);
}
}
}
}
package com.ruoyi.inventory.service.impl;
import java.util.List;
import com.ruoyi.common.core.domain.entity.MaterialsCategory;
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;
......@@ -62,7 +63,25 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override
public List<StorageLocations> selectStorageLocationsList(StorageLocations storageLocations)
{
return storageLocationsMapper.selectStorageLocationsList(storageLocations);
List<StorageLocations> storageLocations1 = storageLocationsMapper.selectStorageLocationsList(storageLocations);
for (StorageLocations storageLocations2 : storageLocations1){
String AllowedCategoryName = "";
if (storageLocations2.getAllowedCategoryIds() != null && !storageLocations2.getAllowedCategoryIds().isEmpty()){
String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(",");
for (String AllowedCategoryId : AllowedCategoryIds) {
MaterialsCategory materialsCategory = materialsCategoryMapper.selectMaterialsCategoryById(AllowedCategoryId);
if (materialsCategory != null && materialsCategory.getCategoryName() != null) {
String categoryName = materialsCategory.getCategoryName().trim(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
AllowedCategoryName += categoryName;
}
}
}
storageLocations2.setAllowedCategoryNames(AllowedCategoryName);
}
return storageLocations1;
}
/**
......@@ -77,13 +96,14 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocations.setCreateTime(DateUtils.getNowDate());
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory);
BeanUtils.copyBeanProp(storageLocationsCategory,storageLocations);
String LocationsID = UUID.randomUUID().toString();
storageLocations.setId(LocationsID);
storageLocations.setCreateTime(DateUtils.getNowDate());
storageLocations.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
storageLocationsCategory.setLocationCode(LocationsID);
if (storageLocations.getAllowedCategoryIds() != null && !storageLocations.getAllowedCategoryIds().isEmpty()){
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
for (String categoryId : CategoryId) {
storageLocationsCategory.setId(java.util.UUID.randomUUID().toString());
......@@ -94,6 +114,7 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryName(materialsCategory.getCategoryName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
return storageLocationsMapper.insertStorageLocations(storageLocations);
}
......@@ -117,11 +138,11 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
String[] CategoryId = storageLocations.getAllowedCategoryIds().split(",");
StorageLocationsCategory storageLocationsCategory = new StorageLocationsCategory();
BeanUtils.copyBeanProp(storageLocations,storageLocationsCategory);
BeanUtils.copyBeanProp(storageLocationsCategory,storageLocations);
storageLocationsCategory.setLocationCode(LocationsID);
storageLocationsCategory.setLocationCode(LocationsCode);
for (String categoryId : CategoryId) {
storageLocations.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setId(java.util.UUID.randomUUID().toString());
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
......@@ -143,7 +164,6 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override
public int deleteStorageLocationsByIds(String[] ids)
{
storageLocationsCategoryMapper.deleteStorageLocationsCategoryByIds(ids);
return storageLocationsMapper.deleteStorageLocationsByIds(ids);
}
......
......@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectInboundOrdersList" parameterType="InboundOrders" resultMap="InboundOrdersResult">
<include refid="selectInboundOrdersVo"/>
<where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
<if test="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
......
......@@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
order by sort_no asc
</select>
<select id="selectMaterialsByCategory" parameterType="String" resultMap="MaterialsResult">
<include refid="selectMaterialsVo"/>
where category_code = #{id}
order by sort_no asc
</select>
<insert id="insertMaterials" parameterType="Materials">
insert into materials
......
<?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.OutboundOrderItemsMapper">
<resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="itemStatus" column="item_status" />
<result property="shippedAt" column="shipped_at" />
<result property="shippedBy" column="shipped_by" />
<result property="remark" column="remark" />
<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="selectOutboundOrderItemsVo">
select id, order_id, material_id, batch_code, warehouse_id, location_id, planned_quantity, actual_quantity, divisor, label_color, voucher_number, item_status, shipped_at, shipped_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_order_items
</sql>
<select id="selectOutboundOrderItemsList" parameterType="OutboundOrderItems" resultMap="OutboundOrderItemsResult">
<include refid="selectOutboundOrderItemsVo"/>
<where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="materialId != null and materialId != ''"> and material_id = #{materialId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
<if test="plannedQuantity != null "> and planned_quantity = #{plannedQuantity}</if>
<if test="actualQuantity != null "> and actual_quantity = #{actualQuantity}</if>
<if test="divisor != null "> and divisor = #{divisor}</if>
<if test="labelColor != null "> and label_color = #{labelColor}</if>
<if test="voucherNumber != null and voucherNumber != ''"> and voucher_number = #{voucherNumber}</if>
<if test="itemStatus != null "> and item_status = #{itemStatus}</if>
<if test="shippedAt != null "> and shipped_at = #{shippedAt}</if>
<if test="shippedBy != null and shippedBy != ''"> and shipped_by = #{shippedBy}</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="selectOutboundOrderItemsById" parameterType="String" resultMap="OutboundOrderItemsResult">
<include refid="selectOutboundOrderItemsVo"/>
where id = #{id}
</select>
<insert id="insertOutboundOrderItems" parameterType="OutboundOrderItems">
insert into outbound_order_items
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderId != null">order_id,</if>
<if test="materialId != null">material_id,</if>
<if test="batchCode != null">batch_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="locationId != null">location_id,</if>
<if test="plannedQuantity != null">planned_quantity,</if>
<if test="actualQuantity != null">actual_quantity,</if>
<if test="divisor != null">divisor,</if>
<if test="labelColor != null">label_color,</if>
<if test="voucherNumber != null">voucher_number,</if>
<if test="itemStatus != null">item_status,</if>
<if test="shippedAt != null">shipped_at,</if>
<if test="shippedBy != null">shipped_by,</if>
<if test="remark != null">remark,</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="orderId != null">#{orderId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="batchCode != null">#{batchCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="locationId != null">#{locationId},</if>
<if test="plannedQuantity != null">#{plannedQuantity},</if>
<if test="actualQuantity != null">#{actualQuantity},</if>
<if test="divisor != null">#{divisor},</if>
<if test="labelColor != null">#{labelColor},</if>
<if test="voucherNumber != null">#{voucherNumber},</if>
<if test="itemStatus != null">#{itemStatus},</if>
<if test="shippedAt != null">#{shippedAt},</if>
<if test="shippedBy != null">#{shippedBy},</if>
<if test="remark != null">#{remark},</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="updateOutboundOrderItems" parameterType="OutboundOrderItems">
update outbound_order_items
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="locationId != null">location_id = #{locationId},</if>
<if test="plannedQuantity != null">planned_quantity = #{plannedQuantity},</if>
<if test="actualQuantity != null">actual_quantity = #{actualQuantity},</if>
<if test="divisor != null">divisor = #{divisor},</if>
<if test="labelColor != null">label_color = #{labelColor},</if>
<if test="voucherNumber != null">voucher_number = #{voucherNumber},</if>
<if test="itemStatus != null">item_status = #{itemStatus},</if>
<if test="shippedAt != null">shipped_at = #{shippedAt},</if>
<if test="shippedBy != null">shipped_by = #{shippedBy},</if>
<if test="remark != null">remark = #{remark},</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="deleteOutboundOrderItemsById" parameterType="String">
delete from outbound_order_items where id = #{id}
</delete>
<delete id="deleteOutboundOrderItemsByIds" parameterType="String">
delete from outbound_order_items 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.OutboundOrdersMapper">
<resultMap type="OutboundOrders" id="OutboundOrdersResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="systemNo" column="system_no" />
<result property="orderTypeId" column="order_type_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="ownerId" column="owner_id" />
<result property="orderStatus" column="order_status" />
<result property="inboundDate" column="inbound_date" />
<result property="destination" column="destination" />
<result property="totalPlannedQuantity" column="total_planned_quantity" />
<result property="totalActualQuantity" column="total_actual_quantity" />
<result property="totalPackages" column="total_packages" />
<result property="remark" column="remark" />
<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>
<resultMap id="OutboundOrdersOutboundOrderItemsResult" type="OutboundOrders" extends="OutboundOrdersResult">
<collection property="outboundOrderItemsList" ofType="OutboundOrderItems" column="id" select="selectOutboundOrderItemsList" />
</resultMap>
<resultMap type="OutboundOrderItems" id="OutboundOrderItemsResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="materialId" column="material_id" />
<result property="batchId" column="batch_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="plannedQuantity" column="planned_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="plannedPackages" column="planned_packages" />
<result property="actualPackages" column="actual_packages" />
<result property="divisor" column="divisor" />
<result property="labelColor" column="label_color" />
<result property="voucherNumber" column="voucher_number" />
<result property="unitPrice" column="unit_price" />
<result property="itemStatus" column="item_status" />
<result property="receivedAt" column="received_at" />
<result property="receivedBy" column="received_by" />
<result property="remark" column="remark" />
<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="selectOutboundOrdersVo">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code from outbound_orders
</sql>
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersResult">
<include refid="selectOutboundOrdersVo"/>
<where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="systemNo != null and systemNo != ''"> and system_no = #{systemNo}</if>
<if test="orderTypeId != null and orderTypeId != ''"> and order_type_id = #{orderTypeId}</if>
<if test="batchCode != null and batchCode != ''"> and batch_code = #{batchCode}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and order_status = #{orderStatus}</if>
<if test="inboundDate != null "> and inbound_date = #{inboundDate}</if>
<if test="destination != null and destination != ''"> and destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and total_actual_quantity = #{totalActualQuantity}</if>
<if test="totalPackages != null "> and total_packages = #{totalPackages}</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="selectOutboundOrdersById" parameterType="String" resultMap="OutboundOrdersOutboundOrderItemsResult">
select id, order_id, system_no, order_type_id, batch_code, warehouse_id, owner_id, order_status, inbound_date, destination, total_planned_quantity, total_actual_quantity, total_packages, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from outbound_orders
where id = #{id}
</select>
<select id="selectOutboundOrderItemsList" parameterType="String" resultMap="OutboundOrderItemsResult">
select id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from outbound_order_items
where order_id = #{id}
</select>
<insert id="insertOutboundOrders" parameterType="OutboundOrders">
insert into outbound_orders
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="orderId != null">order_id,</if>
<if test="systemNo != null">system_no,</if>
<if test="orderTypeId != null">order_type_id,</if>
<if test="batchCode != null">batch_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="ownerId != null">owner_id,</if>
<if test="orderStatus != null">order_status,</if>
<if test="inboundDate != null">inbound_date,</if>
<if test="destination != null">destination,</if>
<if test="totalPlannedQuantity != null">total_planned_quantity,</if>
<if test="totalActualQuantity != null">total_actual_quantity,</if>
<if test="totalPackages != null">total_packages,</if>
<if test="remark != null">remark,</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="orderId != null">#{orderId},</if>
<if test="systemNo != null">#{systemNo},</if>
<if test="orderTypeId != null">#{orderTypeId},</if>
<if test="batchCode != null">#{batchCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="ownerId != null">#{ownerId},</if>
<if test="orderStatus != null">#{orderStatus},</if>
<if test="inboundDate != null">#{inboundDate},</if>
<if test="destination != null">#{destination},</if>
<if test="totalPlannedQuantity != null">#{totalPlannedQuantity},</if>
<if test="totalActualQuantity != null">#{totalActualQuantity},</if>
<if test="totalPackages != null">#{totalPackages},</if>
<if test="remark != null">#{remark},</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="updateOutboundOrders" parameterType="OutboundOrders">
update outbound_orders
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if>
<if test="systemNo != null">system_no = #{systemNo},</if>
<if test="orderTypeId != null">order_type_id = #{orderTypeId},</if>
<if test="batchCode != null">batch_code = #{batchCode},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="ownerId != null">owner_id = #{ownerId},</if>
<if test="orderStatus != null">order_status = #{orderStatus},</if>
<if test="inboundDate != null">inbound_date = #{inboundDate},</if>
<if test="destination != null">destination = #{destination},</if>
<if test="totalPlannedQuantity != null">total_planned_quantity = #{totalPlannedQuantity},</if>
<if test="totalActualQuantity != null">total_actual_quantity = #{totalActualQuantity},</if>
<if test="totalPackages != null">total_packages = #{totalPackages},</if>
<if test="remark != null">remark = #{remark},</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="deleteOutboundOrdersById" parameterType="String">
delete from outbound_orders where id = #{id}
</delete>
<delete id="deleteOutboundOrdersByIds" parameterType="String">
delete from outbound_orders where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteOutboundOrderItemsByOrderIds" parameterType="String">
delete from outbound_order_items where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
<delete id="deleteOutboundOrderItemsByOrderId" parameterType="String">
delete from outbound_order_items where order_id = #{orderId}
</delete>
<insert id="batchOutboundOrderItems">
insert into outbound_order_items( id, order_id, material_id, batch_id, warehouse_id, location_id, planned_quantity, actual_quantity, planned_packages, actual_packages, divisor, label_color, voucher_number, unit_price, item_status, received_at, received_by, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.orderId}, #{item.materialId}, #{item.batchId}, #{item.warehouseId}, #{item.locationId}, #{item.plannedQuantity}, #{item.actualQuantity}, #{item.plannedPackages}, #{item.actualPackages}, #{item.divisor}, #{item.labelColor}, #{item.voucherNumber}, #{item.unitPrice}, #{item.itemStatus}, #{item.receivedAt}, #{item.receivedBy}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteStorageLocationsCategoryById" parameterType="String">
update storage_locations_category set is_used = 0 where id= #{id}
update storage_locations_category set is_used = 0 where id = #{id}
</delete>
<delete id="deleteStorageLocationsCategoryByIds" parameterType="String">
......
......@@ -34,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectStorageLocationsList" parameterType="StorageLocations" resultMap="StorageLocationsResult">
<include refid="selectStorageLocationsVo"/>
<where>
where is_used=1
<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>
......@@ -49,11 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论