Commit a4d031f7 by yubin

页面修改

parent 257fada7
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<el-form-item label="物料" prop="materialId"> <el-form-item label="物料" prop="materialId">
<el-input <el-input
v-model="queryParams.materialId" v-model="queryParams.materialId"
placeholder="请输入物料编码" placeholder="请输入物料名或sap编码"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
</el-form-item> </el-form-item>
<el-form-item label="库位" prop="locationId"> <el-form-item label="库位" prop="locationId">
<el-input <el-input
placeholder="请选择库位"
v-model="queryLocationName" v-model="queryLocationName"
readonly readonly
@focus="openLocationSelector" @focus="openLocationSelector"
......
...@@ -139,9 +139,10 @@ ...@@ -139,9 +139,10 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="上架区" prop="zoneCode"> <!-- 仅改字段名:zoneCode → loadingArea,文字仍为“上架区” -->
<el-form-item label="上架区" prop="loadingArea">
<el-input <el-input
v-model="queryParams.zoneCode" v-model="queryParams.loadingArea"
placeholder="请输入上架区" placeholder="请输入上架区"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
...@@ -176,7 +177,8 @@ ...@@ -176,7 +177,8 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-row :gutter="20" style="margin: 10px 0;"> <el-row :gutter="20" style="margin: 10px 0;">
<el-col :span="6"> <el-col :span="6">
<div><strong>区域代码:</strong>{{ scope.row.zoneCode || '-' }}</div> <!-- 仅改字段名:zoneCode → loadingArea -->
<div><strong>区域代码:</strong>{{ scope.row.loadingArea || '-' }}</div>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<div><strong>排:</strong>{{ scope.row.rowCode || '-' }}</div> <div><strong>排:</strong>{{ scope.row.rowCode || '-' }}</div>
...@@ -246,7 +248,8 @@ ...@@ -246,7 +248,8 @@
<dict-tag :options="dict.type.location_usage" :value="scope.row.locationUsage"/> <dict-tag :options="dict.type.location_usage" :value="scope.row.locationUsage"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上架区" align="center" prop="zoneCode" min-width="100" /> <!-- 仅改字段名:zoneCode → loadingArea,文字仍为“上架区” -->
<el-table-column label="上架区" align="center" prop="loadingArea" min-width="100" />
<el-table-column label="拣货区" align="center" prop="pickingArea" min-width="100" /> <el-table-column label="拣货区" align="center" prop="pickingArea" min-width="100" />
<el-table-column label="允许混放产品" align="center" prop="allowMixedProducts" min-width="120"> <el-table-column label="允许混放产品" align="center" prop="allowMixedProducts" min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -264,7 +267,8 @@ ...@@ -264,7 +267,8 @@
<el-table-column label="库位容量(千克)" align="center" prop="capacity" min-width="120" /> <el-table-column label="库位容量(千克)" align="center" prop="capacity" min-width="120" />
<el-table-column label="体积容量(立方米)" align="center" prop="volumeCapacity" min-width="120" /> <el-table-column label="体积容量(立方米)" align="center" prop="volumeCapacity" min-width="120" />
<el-table-column label="允许存放的危险等级" align="center" prop="allowedHazardLevels" min-width="140" /> <el-table-column label="允许存放的危险等级" align="center" prop="allowedHazardLevels" min-width="140" />
<el-table-column label="允许存放的物料名称" align="center" prop="allowedCategoryNames" min-width="200"> <!-- 注释:允许存放的物料名称列 -->
<!-- <el-table-column label="允许存放的物料名称" align="center" prop="allowedCategoryNames" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip <el-tooltip
:content="scope.row.allowedCategoryNames" :content="scope.row.allowedCategoryNames"
...@@ -294,7 +298,7 @@ ...@@ -294,7 +298,7 @@
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="温区" align="center" prop="temperatureZone" width="100" /> <el-table-column label="温区" align="center" prop="temperatureZone" width="100" />
<el-table-column label="应用状态" align="center" prop="isEnabled" width="100"> <el-table-column label="应用状态" align="center" prop="isEnabled" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -405,8 +409,9 @@ ...@@ -405,8 +409,9 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上架区" prop="zoneCode"> <!-- 仅改字段名:zoneCode → loadingArea,文字仍为“上架区” -->
<el-input v-model="form.zoneCode" placeholder="请输入上架区" /> <el-form-item label="上架区" prop="loadingArea">
<el-input v-model="form.loadingArea" placeholder="请输入上架区" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -459,8 +464,9 @@ ...@@ -459,8 +464,9 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="区域代码" prop="zoneCode"> <!-- 仅改字段名:zoneCode → loadingArea,文字仍为“区域代码” -->
<el-input v-model="form.zoneCode" placeholder="请输入区域代码" /> <el-form-item label="区域代码" prop="loadingArea">
<el-input v-model="form.loadingArea" placeholder="请输入区域代码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -511,7 +517,8 @@ ...@@ -511,7 +517,8 @@
<el-input v-model="form.allowedHazardLevels" placeholder="请输入允许存放的危险等级" /> <el-input v-model="form.allowedHazardLevels" placeholder="请输入允许存放的危险等级" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <!-- 注释:允许存放物料表单项 -->
<!-- <el-col :span="12">
<el-form-item label="允许存放物料" prop="allowedCategoryIds"> <el-form-item label="允许存放物料" prop="allowedCategoryIds">
<div style="display: flex; align-items: center; flex-direction: column; gap: 8px;"> <div style="display: flex; align-items: center; flex-direction: column; gap: 8px;">
<el-input <el-input
...@@ -523,7 +530,7 @@ ...@@ -523,7 +530,7 @@
/> />
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
...@@ -550,8 +557,8 @@ ...@@ -550,8 +557,8 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 选择允许存放的物料对话框 --> <!-- 注释:选择允许存放的物料对话框 -->
<el-dialog <!-- <el-dialog
title="选择允许存放的物料" title="选择允许存放的物料"
:visible.sync="showMaterialSelect" :visible.sync="showMaterialSelect"
width="1000px" width="1000px"
...@@ -571,7 +578,7 @@ ...@@ -571,7 +578,7 @@
<el-button @click="handleMaterialSelectionCancel">取消</el-button> <el-button @click="handleMaterialSelectionCancel">取消</el-button>
<el-button type="primary" @click="confirmMaterialSelection">确认选择</el-button> <el-button type="primary" @click="confirmMaterialSelection">确认选择</el-button>
</div> </div>
</el-dialog> </el-dialog> -->
<!-- 导入组件 --> <!-- 导入组件 -->
<import-excel <import-excel
...@@ -594,14 +601,18 @@ ...@@ -594,14 +601,18 @@
<script> <script>
import { listLocations, getLocations, delLocations, addLocations, updateLocations } from "@/api/inventory/locations" import { listLocations, getLocations, delLocations, addLocations, updateLocations } from "@/api/inventory/locations"
import { listWarehouses } from "@/api/inventory/warehouses" import { listWarehouses } from "@/api/inventory/warehouses"
import materialsSeletor from "../../../components/materialsSeletor.vue" // 注释:物料选择器组件导入
// import materialsSeletor from "../../../components/materialsSeletor.vue"
// import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue" // import WarehouseSelector from "@/views/compononents/WarehouseSelector.vue"
import ImportExcel from "@/components/ImportExcel/index" import ImportExcel from "@/components/ImportExcel/index"
import { listMaterials } from "@/api/inventory/materials" // 注释:物料列表API导入
// import { listMaterials } from "@/api/inventory/materials"
export default { export default {
name: "Locations", name: "Locations",
components: { materialsSeletor, ImportExcel }, // 注释:物料选择器组件注册
// components: { materialsSeletor, ImportExcel },
components: { ImportExcel },
dicts: ['sys_normal_disable', 'location_type', 'location_usage', 'yorn','is_enabled'], dicts: ['sys_normal_disable', 'location_type', 'location_usage', 'yorn','is_enabled'],
data() { data() {
return { return {
...@@ -615,7 +626,7 @@ export default { ...@@ -615,7 +626,7 @@ export default {
title: "", title: "",
open: false, open: false,
// 查询参数 // 查询参数:仅改 zoneCode → loadingArea
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
...@@ -626,11 +637,11 @@ export default { ...@@ -626,11 +637,11 @@ export default {
layerCode: null, layerCode: null,
locationUsage: null, locationUsage: null,
allowMixedProducts: null, allowMixedProducts: null,
zoneCode: null, loadingArea: null, // 替换原 zoneCode
pickingArea: null pickingArea: null
}, },
// 表单数据 // 表单数据:仅改 zoneCode → loadingArea
form: { form: {
id: null, id: null,
locationCode: null, locationCode: null,
...@@ -638,15 +649,16 @@ export default { ...@@ -638,15 +649,16 @@ export default {
warehouseId: null, warehouseId: null,
warehouseName: null, warehouseName: null,
locationType: null, locationType: null,
zoneCode: null, loadingArea: null, // 替换原 zoneCode
rowCode: null, rowCode: null,
columnCode: null, columnCode: null,
layerCode: null, layerCode: null,
capacity: null, capacity: null,
volumeCapacity: null, volumeCapacity: null,
allowedHazardLevels: null, allowedHazardLevels: null,
allowedCategoryIds: null, // 原materialCodes // 注释:物料相关字段
allowedCategoryNames: null, // 原materialNames // allowedCategoryIds: null, // 原materialCodes
// allowedCategoryNames: null, // 原materialNames
temperatureZone: null, temperatureZone: null,
isEnabled: 1, isEnabled: 1,
isUsed: 1, isUsed: 1,
...@@ -657,11 +669,11 @@ export default { ...@@ -657,11 +669,11 @@ export default {
locationHandling: null, locationHandling: null,
turnoverDemand: null, turnoverDemand: null,
pickingArea: null, pickingArea: null,
allowMixedProducts: null, allowMixedProducts: "1",
allowMixedBatches: null allowMixedBatches: "1"
}, },
// 表单验证规则 // 表单验证规则:无修改
rules: { rules: {
locationCode: [ locationCode: [
{ required: true, message: '库位编码不能为空', trigger: 'blur' }, { required: true, message: '库位编码不能为空', trigger: 'blur' },
...@@ -691,22 +703,22 @@ export default { ...@@ -691,22 +703,22 @@ export default {
] ]
}, },
// 仓库相关 // 仓库相关:无修改
warehouseList: [], warehouseList: [],
loadingWarehouse: false, loadingWarehouse: false,
queryWarehouseName: '', queryWarehouseName: '',
// 物料选择相关 // 注释:物料选择相关数据
showMaterialSelect: false, // showMaterialSelect: false,
tempSelectedMaterials: { // tempSelectedMaterials: {
materialCodes: [], // materialCodes: [],
names: [], // names: [],
categoryIds: [] // categoryIds: []
}, // },
materialCodeToNameMap: {}, // materialCodeToNameMap: {},
materialMapLoaded: false, // materialMapLoaded: false,
// 仓库选择器相关 // 仓库选择器相关:无修改
warehouseSelectorVisible: false, warehouseSelectorVisible: false,
warehouseSelectTarget: '', warehouseSelectTarget: '',
currentDetailItem: null currentDetailItem: null
...@@ -716,33 +728,35 @@ export default { ...@@ -716,33 +728,35 @@ export default {
console.log('【Locations组件】开始初始化') console.log('【Locations组件】开始初始化')
this.getList() this.getList()
this.getWarehouseList() this.getWarehouseList()
this.initMaterialCodeToNameMap() // 注释:初始化物料映射表
// this.initMaterialCodeToNameMap()
}, },
methods: { methods: {
// 注释:初始化物料选择器方法
// ========== 新增:初始化物料选择器(核心修复数据残留) ========== // ========== 新增:初始化物料选择器(核心修复数据残留) ==========
initMaterialSelector() { // initMaterialSelector() {
console.log('【初始化物料选择器】清空残留数据') // console.log('【初始化物料选择器】清空残留数据')
// 1. 清空临时选择数据(区分新增/修改) // // 1. 清空临时选择数据(区分新增/修改)
this.tempSelectedMaterials = { // this.tempSelectedMaterials = {
materialCodes: this.form.id ? (this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(u => u.trim()) : []) : [], // materialCodes: this.form.id ? (this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(u => u.trim()) : []) : [],
names: this.form.id ? (this.form.allowedCategoryNames ? this.form.allowedCategoryNames.split(',').filter(n => n.trim()) : []) : [], // names: this.form.id ? (this.form.allowedCategoryNames ? this.form.allowedCategoryNames.split(',').filter(n => n.trim()) : []) : [],
categoryIds: this.form.id ? (this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(c => c.trim()) : []) : [] // categoryIds: this.form.id ? (this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(c => c.trim()) : []) : []
} // }
// 2. 延迟打开弹窗,确保数据先清空 // // 2. 延迟打开弹窗,确保数据先清空
this.$nextTick(() => { // this.$nextTick(() => {
this.showMaterialSelect = true // this.showMaterialSelect = true
// 3. 兼容子组件清空选中状态(如果有该方法) // // 3. 兼容子组件清空选中状态(如果有该方法)
if (this.$refs.materialsSeletor && this.$refs.materialsSeletor.clearSelection) { // if (this.$refs.materialsSeletor && this.$refs.materialsSeletor.clearSelection) {
this.$refs.materialsSeletor.clearSelection() // this.$refs.materialsSeletor.clearSelection()
// 修改模式下重新设置选中值 // // 修改模式下重新设置选中值
if (this.form.id) { // if (this.form.id) {
this.$refs.materialsSeletor.setSelection(this.tempSelectedMaterials.materialCodes) // this.$refs.materialsSeletor.setSelection(this.tempSelectedMaterials.materialCodes)
} // }
} // }
}) // })
}, // },
// 清空查询仓库 // 清空查询仓库:无修改
clearQueryWarehouse() { clearQueryWarehouse() {
console.log('【清空查询仓库】执行清空操作') console.log('【清空查询仓库】执行清空操作')
this.queryWarehouseName = '' this.queryWarehouseName = ''
...@@ -750,14 +764,14 @@ export default { ...@@ -750,14 +764,14 @@ export default {
this.handleQuery() this.handleQuery()
}, },
// 清空表单仓库 // 清空表单仓库:无修改
clearFormWarehouse() { clearFormWarehouse() {
console.log('【清空表单仓库】执行清空操作') console.log('【清空表单仓库】执行清空操作')
this.form.warehouseName = '' this.form.warehouseName = ''
this.form.warehouseId = null this.form.warehouseId = null
}, },
// 仓库选择回调 // 仓库选择回调:无修改
handleWarehouseSelected(warehouse) { handleWarehouseSelected(warehouse) {
console.log('【仓库选择回调】选中的仓库数据:', warehouse) console.log('【仓库选择回调】选中的仓库数据:', warehouse)
if (!warehouse) return if (!warehouse) return
...@@ -780,14 +794,14 @@ export default { ...@@ -780,14 +794,14 @@ export default {
this.warehouseSelectorVisible = false this.warehouseSelectorVisible = false
}, },
// 打开仓库选择器 // 打开仓库选择器:无修改
openWarehouseSelector(target = 'form') { openWarehouseSelector(target = 'form') {
console.log('【打开仓库选择器】目标:', target) console.log('【打开仓库选择器】目标:', target)
this.warehouseSelectTarget = target this.warehouseSelectTarget = target
this.warehouseSelectorVisible = true this.warehouseSelectorVisible = true
}, },
// 获取仓库列表 // 获取仓库列表:无修改
getWarehouseList() { getWarehouseList() {
console.log('【获取仓库列表】开始请求仓库数据') console.log('【获取仓库列表】开始请求仓库数据')
this.loadingWarehouse = true this.loadingWarehouse = true
...@@ -802,7 +816,7 @@ export default { ...@@ -802,7 +816,7 @@ export default {
}) })
}, },
// 根据仓库ID获取仓库名称 // 根据仓库ID获取仓库名称:无修改
getWarehouseNameById(warehouseId) { getWarehouseNameById(warehouseId) {
console.log('【根据仓库ID获取名称】仓库ID:', warehouseId) console.log('【根据仓库ID获取名称】仓库ID:', warehouseId)
if (!warehouseId) return '-' if (!warehouseId) return '-'
...@@ -814,49 +828,50 @@ export default { ...@@ -814,49 +828,50 @@ export default {
return warehouseName return warehouseName
}, },
// 初始化物料编码-名称映射表 // 注释:初始化物料编码-名称映射表方法
async initMaterialCodeToNameMap() { // // 初始化物料编码-名称映射表
console.log('【初始化物料映射表】开始加载物料数据') // async initMaterialCodeToNameMap() {
try { // console.log('【初始化物料映射表】开始加载物料数据')
this.materialMapLoaded = true // try {
let pageNum = 1 // this.materialMapLoaded = true
const pageSize = 1000 // let pageNum = 1
let hasMore = true // const pageSize = 1000
this.materialCodeToNameMap = {} // let hasMore = true
// this.materialCodeToNameMap = {}
while (hasMore) {
console.log(`【初始化物料映射表】请求第${pageNum}页物料数据,每页${pageSize}条`) // while (hasMore) {
const response = await listMaterials({ // console.log(`【初始化物料映射表】请求第${pageNum}页物料数据,每页${pageSize}条`)
pageNum, // const response = await listMaterials({
pageSize, // pageNum,
isUsed: 1, // pageSize,
materialCode: null, // isUsed: 1,
materialName: null // materialCode: null,
}) // materialName: null
// })
if (response.rows && response.rows.length) {
console.log(`【初始化物料映射表】第${pageNum}页返回${response.rows.length}条物料数据`) // if (response.rows && response.rows.length) {
response.rows.forEach(item => { // console.log(`【初始化物料映射表】第${pageNum}页返回${response.rows.length}条物料数据`)
if (item.materialCode && item.materialName) { // response.rows.forEach(item => {
const code = item.materialCode.trim().toUpperCase() // if (item.materialCode && item.materialName) {
this.materialCodeToNameMap[code] = item.materialName // const code = item.materialCode.trim().toUpperCase()
} // this.materialCodeToNameMap[code] = item.materialName
}) // }
hasMore = pageNum * pageSize < response.total // })
pageNum++ // hasMore = pageNum * pageSize < response.total
} else { // pageNum++
hasMore = false // } else {
} // hasMore = false
} // }
console.log('【初始化物料映射表】完成,映射表长度:', Object.keys(this.materialCodeToNameMap).length) // }
} catch (error) { // console.log('【初始化物料映射表】完成,映射表长度:', Object.keys(this.materialCodeToNameMap).length)
console.error('【初始化物料映射表】失败:', error) // } catch (error) {
this.materialMapLoaded = false // console.error('【初始化物料映射表】失败:', error)
this.$modal.msgError('物料数据加载失败,请刷新页面重试!') // this.materialMapLoaded = false
} // this.$modal.msgError('物料数据加载失败,请刷新页面重试!')
}, // }
// },
// 行点击事件
// 行点击事件:无修改
handleRowClick(row, event, column) { handleRowClick(row, event, column) {
console.log('【行点击事件】点击的行数据:', row, '列类型:', column.type) console.log('【行点击事件】点击的行数据:', row, '列类型:', column.type)
if (column.type !== 'selection') { if (column.type !== 'selection') {
...@@ -864,7 +879,7 @@ export default { ...@@ -864,7 +879,7 @@ export default {
} }
}, },
// 获取库位列表 // 获取库位列表:无修改(queryParams 已改 loadingArea)
getList() { getList() {
console.log('【获取库位列表】查询参数:', this.queryParams) console.log('【获取库位列表】查询参数:', this.queryParams)
this.loading = true this.loading = true
...@@ -888,14 +903,14 @@ export default { ...@@ -888,14 +903,14 @@ export default {
}) })
}, },
// 查询事件 // 查询事件:无修改
handleQuery() { handleQuery() {
console.log('【查询事件】执行查询操作') console.log('【查询事件】执行查询操作')
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
this.getList() this.getList()
}, },
// 重置查询条件 // 重置查询条件:仅改 queryParams 中的 zoneCode → loadingArea
resetQuery() { resetQuery() {
console.log('【重置查询条件】执行重置操作') console.log('【重置查询条件】执行重置操作')
// 修改:使用el-form的resetFields方法 // 修改:使用el-form的resetFields方法
...@@ -912,14 +927,14 @@ export default { ...@@ -912,14 +927,14 @@ export default {
layerCode: null, layerCode: null,
locationUsage: null, locationUsage: null,
allowMixedProducts: null, allowMixedProducts: null,
zoneCode: null, loadingArea: null, // 替换原 zoneCode
pickingArea: null pickingArea: null
} }
this.queryWarehouseName = '' this.queryWarehouseName = ''
this.getList() this.getList()
}, },
// 表格选择事件 // 表格选择事件:无修改
handleSelectionChange(selection) { handleSelectionChange(selection) {
console.log('【表格选择事件】选中的行:', selection) console.log('【表格选择事件】选中的行:', selection)
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
...@@ -928,7 +943,7 @@ export default { ...@@ -928,7 +943,7 @@ export default {
console.log('【表格选择事件】处理后 - ids:', this.ids, 'single:', this.single, 'multiple:', this.multiple) console.log('【表格选择事件】处理后 - ids:', this.ids, 'single:', this.single, 'multiple:', this.multiple)
}, },
// 新增库位 // 新增库位:无修改
handleAdd() { handleAdd() {
console.log('【新增库位】执行新增操作') console.log('【新增库位】执行新增操作')
this.reset() this.reset()
...@@ -936,7 +951,7 @@ export default { ...@@ -936,7 +951,7 @@ export default {
this.title = "添加库位" this.title = "添加库位"
}, },
// 修改库位 // 修改库位:无修改
async handleUpdate(row) { async handleUpdate(row) {
console.log('【修改库位】触发修改操作,传入的行数据:', row) console.log('【修改库位】触发修改操作,传入的行数据:', row)
this.reset() this.reset()
...@@ -965,63 +980,64 @@ export default { ...@@ -965,63 +980,64 @@ export default {
this.form.warehouseName = this.getWarehouseNameById(this.form.warehouseId) this.form.warehouseName = this.getWarehouseNameById(this.form.warehouseId)
} }
await this.initMaterialCodeToNameMap() // 注释:物料相关处理逻辑
// await this.initMaterialCodeToNameMap()
// 处理物料编码和名称(支持数组或字符串格式) // 处理物料编码和名称(支持数组或字符串格式)
let materialCodes = [] // let materialCodes = []
let materialNames = [] // let materialNames = []
// 优先从allowedCategoryIds数组读取(原materialIds) // 优先从allowedCategoryIds数组读取(原materialIds)
if (Array.isArray(rowData.allowedCategoryIds) && rowData.allowedCategoryIds.length) { // if (Array.isArray(rowData.allowedCategoryIds) && rowData.allowedCategoryIds.length) {
materialCodes = rowData.allowedCategoryIds // materialCodes = rowData.allowedCategoryIds
.filter(code => code && code.trim()) // .filter(code => code && code.trim())
.map(code => code.trim().toUpperCase()) // .map(code => code.trim().toUpperCase())
.filter((code, index, self) => self.indexOf(code) === index) // .filter((code, index, self) => self.indexOf(code) === index)
} // }
// 兼容字符串格式 // 兼容字符串格式
else if (rowData.allowedCategoryIds) { // else if (rowData.allowedCategoryIds) {
materialCodes = rowData.allowedCategoryIds.split(',') // materialCodes = rowData.allowedCategoryIds.split(',')
.filter(code => code && code.trim()) // .filter(code => code && code.trim())
.map(code => code.trim().toUpperCase()) // .map(code => code.trim().toUpperCase())
.filter((code, index, self) => self.indexOf(code) === index) // .filter((code, index, self) => self.indexOf(code) === index)
} // }
// 处理物料名称 // 处理物料名称
if (Array.isArray(rowData.allowedCategoryNames) && rowData.allowedCategoryNames.length) { // if (Array.isArray(rowData.allowedCategoryNames) && rowData.allowedCategoryNames.length) {
materialNames = rowData.allowedCategoryNames // materialNames = rowData.allowedCategoryNames
.filter(name => name && name.trim()) // .filter(name => name && name.trim())
.filter((name, index, self) => self.indexOf(name) === index) // .filter((name, index, self) => self.indexOf(name) === index)
} // }
else if (rowData.allowedCategoryNames) { // else if (rowData.allowedCategoryNames) {
materialNames = rowData.allowedCategoryNames.split(',') // materialNames = rowData.allowedCategoryNames.split(',')
.filter(name => name && name.trim()) // .filter(name => name && name.trim())
.filter((name, index, self) => self.indexOf(name) === index) // .filter((name, index, self) => self.indexOf(name) === index)
} // }
// 兜底:通过物料编码映射名称 // 兜底:通过物料编码映射名称
else if (materialCodes.length) { // else if (materialCodes.length) {
materialNames = materialCodes.map(code => { // materialNames = materialCodes.map(code => {
return this.materialCodeToNameMap[code] || `【未匹配】${code}` // return this.materialCodeToNameMap[code] || `【未匹配】${code}`
}) // })
} // }
// 处理分类ID(现在存储的是物料编码) // 处理分类ID(现在存储的是物料编码)
let categoryIds = materialCodes // let categoryIds = materialCodes
// 更新表单数据 // 更新表单数据
this.form.allowedCategoryIds = materialCodes.join(',') // this.form.allowedCategoryIds = materialCodes.join(',')
this.form.allowedCategoryNames = materialNames.join(',') // this.form.allowedCategoryNames = materialNames.join(',')
// 更新临时选择数据 // 更新临时选择数据
this.tempSelectedMaterials = { // this.tempSelectedMaterials = {
materialCodes: materialCodes, // materialCodes: materialCodes,
names: materialNames, // names: materialNames,
categoryIds: categoryIds // categoryIds: categoryIds
} // }
console.log('【修改库位】处理后的物料数据:', { // console.log('【修改库位】处理后的物料数据:', {
allowedCategoryIds: this.form.allowedCategoryIds, // allowedCategoryIds: this.form.allowedCategoryIds,
allowedCategoryNames: this.form.allowedCategoryNames // allowedCategoryNames: this.form.allowedCategoryNames
}) // })
this.open = true this.open = true
this.title = "修改库位" this.title = "修改库位"
...@@ -1031,25 +1047,26 @@ export default { ...@@ -1031,25 +1047,26 @@ export default {
} }
}, },
// 提交表单 // 提交表单:无修改
submitForm() { submitForm() {
console.log('【提交表单】开始验证表单,当前表单数据:', this.form) console.log('【提交表单】开始验证表单,当前表单数据:', this.form)
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
console.log('【提交表单】表单验证通过,开始格式化数据') console.log('【提交表单】表单验证通过,开始格式化数据')
// 注释:物料字段格式化逻辑
// 格式化物料相关字段(去重、过滤空值) // 格式化物料相关字段(去重、过滤空值)
const formatField = (value) => { // const formatField = (value) => {
if (!value) return '' // if (!value) return ''
const result = value.split(',') // const result = value.split(',')
.filter(item => item && item.trim()) // .filter(item => item && item.trim())
.filter((item, index, self) => self.indexOf(item) === index) // .filter((item, index, self) => self.indexOf(item) === index)
.join(',') // .join(',')
console.log(`【提交表单】格式化字段值 "${value}" 结果: "${result}"`) // console.log(`【提交表单】格式化字段值 "${value}" 结果: "${result}"`)
return result // return result
} // }
this.form.allowedCategoryIds = formatField(this.form.allowedCategoryIds) // this.form.allowedCategoryIds = formatField(this.form.allowedCategoryIds)
this.form.allowedCategoryNames = formatField(this.form.allowedCategoryNames) // this.form.allowedCategoryNames = formatField(this.form.allowedCategoryNames)
// 转换表单数据 // 转换表单数据
const submitData = { const submitData = {
...@@ -1076,7 +1093,7 @@ export default { ...@@ -1076,7 +1093,7 @@ export default {
}) })
}, },
// 删除库位 // 删除库位:无修改
handleDelete(row) { handleDelete(row) {
console.log('【删除库位】触发删除操作,行数据:', row) console.log('【删除库位】触发删除操作,行数据:', row)
const ids = row?.id ? [row.id] : this.ids const ids = row?.id ? [row.id] : this.ids
...@@ -1100,7 +1117,7 @@ export default { ...@@ -1100,7 +1117,7 @@ export default {
}) })
}, },
// 导出库位 // 导出库位:无修改(queryParams 已改 loadingArea)
handleExport() { handleExport() {
console.log('【导出库位】执行导出操作,查询参数:', this.queryParams) console.log('【导出库位】执行导出操作,查询参数:', this.queryParams)
const exportParams = { const exportParams = {
...@@ -1112,77 +1129,78 @@ export default { ...@@ -1112,77 +1129,78 @@ export default {
this.download('inventory/locations/export', exportParams, `locations_${new Date().getTime()}.xlsx`) this.download('inventory/locations/export', exportParams, `locations_${new Date().getTime()}.xlsx`)
}, },
// 物料选择变化 // 注释:物料选择相关方法
handleMaterialSelectionChange(selectedData) { // // 物料选择变化
console.log('【物料选择变化】接收到的选择数据:', selectedData) // handleMaterialSelectionChange(selectedData) {
// console.log('【物料选择变化】接收到的选择数据:', selectedData)
// 修复:从selectedData中取materialIds(而非materialCodes)
const materialCodes = (selectedData.materialIds || []) // // 修复:从selectedData中取materialIds(而非materialCodes)
.filter(code => code && code.trim()) // const materialCodes = (selectedData.materialIds || [])
.map(code => code.trim().toUpperCase()) // .filter(code => code && code.trim())
.filter((code, index, self) => self.indexOf(code) === index) // .map(code => code.trim().toUpperCase())
// .filter((code, index, self) => self.indexOf(code) === index)
// 物料名称取selectedData.names
const names = (selectedData.names || []) // // 物料名称取selectedData.names
.filter(name => name && name.trim()) // const names = (selectedData.names || [])
.filter((name, index, self) => self.indexOf(name) === index) // .filter(name => name && name.trim())
// .filter((name, index, self) => self.indexOf(name) === index)
// 分类ID取selectedData.categoryIds(现在存储的是物料编码)
const categoryIds = materialCodes // // 分类ID取selectedData.categoryIds(现在存储的是物料编码)
// const categoryIds = materialCodes
this.tempSelectedMaterials = {
materialCodes, // this.tempSelectedMaterials = {
names, // materialCodes,
categoryIds // names,
} // categoryIds
// }
console.log('【物料选择变化】处理后的临时选择数据:', this.tempSelectedMaterials)
}, // console.log('【物料选择变化】处理后的临时选择数据:', this.tempSelectedMaterials)
// },
// 取消物料选择
handleMaterialSelectionCancel() { // // 取消物料选择
console.log('【取消物料选择】执行取消操作,恢复原有选择状态') // handleMaterialSelectionCancel() {
this.showMaterialSelect = false // console.log('【取消物料选择】执行取消操作,恢复原有选择状态')
// 恢复原有选择状态 // this.showMaterialSelect = false
this.tempSelectedMaterials = { // // 恢复原有选择状态
materialCodes: this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(u => u.trim()) : [], // this.tempSelectedMaterials = {
names: this.form.allowedCategoryNames ? this.form.allowedCategoryNames.split(',').filter(n => n.trim()) : [], // materialCodes: this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(u => u.trim()) : [],
categoryIds: this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(c => c.trim()) : [] // names: this.form.allowedCategoryNames ? this.form.allowedCategoryNames.split(',').filter(n => n.trim()) : [],
} // categoryIds: this.form.allowedCategoryIds ? this.form.allowedCategoryIds.split(',').filter(c => c.trim()) : []
console.log('【取消物料选择】恢复后的临时选择数据:', this.tempSelectedMaterials) // }
}, // console.log('【取消物料选择】恢复后的临时选择数据:', this.tempSelectedMaterials)
// },
// 确认物料选择
confirmMaterialSelection() { // // 确认物料选择
console.log('【确认物料选择】当前临时选择数据:', this.tempSelectedMaterials) // confirmMaterialSelection() {
// console.log('【确认物料选择】当前临时选择数据:', this.tempSelectedMaterials)
// 修复:判断tempSelectedMaterials.materialCodes是否有值
if (!this.tempSelectedMaterials.materialCodes.length) { // // 修复:判断tempSelectedMaterials.materialCodes是否有值
console.warn('【确认物料选择】未选择任何物料,提示用户') // if (!this.tempSelectedMaterials.materialCodes.length) {
this.$modal.msgWarning('请至少选择一个物料!') // console.warn('【确认物料选择】未选择任何物料,提示用户')
return // this.$modal.msgWarning('请至少选择一个物料!')
} // return
// }
// 更新表单数据(确保去重和过滤)
this.form.allowedCategoryIds = this.tempSelectedMaterials.materialCodes.join(',') // // 更新表单数据(确保去重和过滤)
this.form.allowedCategoryNames = this.tempSelectedMaterials.names.join(',') // this.form.allowedCategoryIds = this.tempSelectedMaterials.materialCodes.join(',')
// this.form.allowedCategoryNames = this.tempSelectedMaterials.names.join(',')
console.log('【确认物料选择】更新后的表单物料数据:', {
allowedCategoryIds: this.form.allowedCategoryIds, // console.log('【确认物料选择】更新后的表单物料数据:', {
allowedCategoryNames: this.form.allowedCategoryNames // allowedCategoryIds: this.form.allowedCategoryIds,
}) // allowedCategoryNames: this.form.allowedCategoryNames
// })
this.showMaterialSelect = false
this.$modal.msgSuccess(`成功选择 ${this.tempSelectedMaterials.names.length} 个物料`) // this.showMaterialSelect = false
}, // this.$modal.msgSuccess(`成功选择 ${this.tempSelectedMaterials.names.length} 个物料`)
// },
// 导入库位
// 导入库位:无修改
handleImport() { handleImport() {
console.log('【导入库位】打开导入组件') console.log('【导入库位】打开导入组件')
this.$refs.import.show() this.$refs.import.show()
}, },
// 重置表单 // 重置表单:仅改 form 中的 zoneCode → loadingArea
reset() { reset() {
console.log('【重置表单】执行表单重置') console.log('【重置表单】执行表单重置')
this.form = { this.form = {
...@@ -1192,15 +1210,16 @@ export default { ...@@ -1192,15 +1210,16 @@ export default {
warehouseId: null, warehouseId: null,
warehouseName: null, warehouseName: null,
locationType: null, locationType: null,
zoneCode: null, loadingArea: null, // 替换原 zoneCode
rowCode: null, rowCode: null,
columnCode: null, columnCode: null,
layerCode: null, layerCode: null,
capacity: null, capacity: null,
volumeCapacity: null, volumeCapacity: null,
allowedHazardLevels: null, allowedHazardLevels: null,
allowedCategoryIds: null, // 原materialCodes // 注释:物料相关字段
allowedCategoryNames: null, // 原materialNames // allowedCategoryIds: null, // 原materialCodes
// allowedCategoryNames: null, // 原materialNames
temperatureZone: null, temperatureZone: null,
isEnabled: 1, isEnabled: 1,
isUsed: 1, isUsed: 1,
...@@ -1211,25 +1230,26 @@ export default { ...@@ -1211,25 +1230,26 @@ export default {
locationHandling: null, locationHandling: null,
turnoverDemand: null, turnoverDemand: null,
pickingArea: null, pickingArea: null,
allowMixedProducts: null, allowMixedProducts: "1",
allowMixedBatches: null allowMixedBatches: "1"
}
this.tempSelectedMaterials = {
materialCodes: [],
names: [],
categoryIds: []
} }
// 注释:物料临时数据重置
// this.tempSelectedMaterials = {
// materialCodes: [],
// names: [],
// categoryIds: []
// }
// 修复:清空物料选择器残留 // 修复:清空物料选择器残留
if (this.$refs.materialsSeletor && this.$refs.materialsSeletor.clearSelection) { // if (this.$refs.materialsSeletor && this.$refs.materialsSeletor.clearSelection) {
this.$refs.materialsSeletor.clearSelection() // this.$refs.materialsSeletor.clearSelection()
} // }
if (this.$refs.form) { if (this.$refs.form) {
this.$refs.form.resetFields() this.$refs.form.resetFields()
} }
console.log('【重置表单】重置完成,表单数据:', this.form) console.log('【重置表单】重置完成,表单数据:', this.form)
}, },
// 取消操作 // 取消操作:无修改
cancel() { cancel() {
console.log('【取消操作】关闭弹窗并重置表单') console.log('【取消操作】关闭弹窗并重置表单')
this.open = false this.open = false
......
...@@ -132,36 +132,6 @@ ...@@ -132,36 +132,6 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!-- 新增:允许存放物料列 - 修复可选链语法 -->
<el-table-column label="允许存放物料" align="center" prop="allowMaterialCodes" min-width="150">
<template slot-scope="scope">
<el-tooltip
:content="scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length ? scope.row.allowMaterialCodes.join(',') : '无'"
placement="top"
effect="light"
>
<div class="material-tags">
<el-tag
v-for="(code, index) in (scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length ? scope.row.allowMaterialCodes.slice(0, 3) : [])"
:key="index"
type="info"
size="small"
style="margin-right: 5px;"
>
{{ code }}
</el-tag>
<el-tag
v-if="scope.row.allowMaterialCodes && scope.row.allowMaterialCodes.length > 3"
type="info"
size="small"
style="background: #f0f9eb; border-color: #c2e7b0;"
>
+{{ scope.row.allowMaterialCodes.length - 3 }}
</el-tag>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="创建日期" align="center" prop="createTime" min-width="160" /> <el-table-column label="创建日期" align="center" prop="createTime" min-width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -202,7 +172,7 @@ ...@@ -202,7 +172,7 @@
<el-input <el-input
v-model="form.warehousesCode" v-model="form.warehousesCode"
placeholder="请输入仓库编码" placeholder="请输入仓库编码"
:readonly="!!form.id" <!-- 修改时编码不可改 --> :readonly="!!form.id"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -270,28 +240,6 @@ ...@@ -270,28 +240,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- 新增:允许存放物料选择项(和其他页面选择器交互一致) -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="允许存放物料" prop="allowMaterialCodes">
<el-input
v-model="allowMaterialDisplay"
placeholder="请选择允许存放的物料(可选)"
readonly
@click="openMaterialSelector"
:suffix-icon="''"
>
<template v-if="allowMaterialDisplay" #suffix>
<i
class="el-icon-circle-close el-input__icon"
style="cursor: pointer;"
@click.stop="clearMaterialSelection"
></i>
</template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">确 定</el-button>
...@@ -299,25 +247,7 @@ ...@@ -299,25 +247,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 物料选择器弹窗 -->
<el-dialog
title="选择允许存放的物料"
:visible.sync="materialSelectorVisible"
width="1000px"
append-to-body
:close-on-click-modal="false"
>
<MaterialSelector
ref="materialSelector"
@selection-change="handleMaterialSelectionChange"
:selected-material-codes="form.allowMaterialCodes"
:multiple="true"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="materialSelectorVisible = false">取消</el-button>
<el-button type="primary" @click="confirmMaterialSelection">确认选择</el-button>
</div>
</el-dialog>
<!-- 导入组件 --> <!-- 导入组件 -->
<import-excel <import-excel
...@@ -334,11 +264,10 @@ ...@@ -334,11 +264,10 @@
<script> <script>
import { listWarehouses, getWarehouses, delWarehouses, addWarehouses, updateWarehouses } from "@/api/inventory/warehouses" import { listWarehouses, getWarehouses, delWarehouses, addWarehouses, updateWarehouses } from "@/api/inventory/warehouses"
import ImportExcel from "@/components/ImportExcel/index" import ImportExcel from "@/components/ImportExcel/index"
import MaterialSelector from '@/components/materialsSeletor.vue'
export default { export default {
name: "Warehouses", name: "Warehouses",
components: { ImportExcel, MaterialSelector }, components: { ImportExcel, },
dicts: ['warehouse_type', 'sys_normal_disable'], dicts: ['warehouse_type', 'sys_normal_disable'],
data() { data() {
// 自定义校验规则:验证手机号 // 自定义校验规则:验证手机号
...@@ -410,12 +339,7 @@ export default { ...@@ -410,12 +339,7 @@ export default {
createUserCode: null, createUserCode: null,
updateTime: null, updateTime: null,
updateUserCode: null, updateUserCode: null,
allowMaterialCodes: [] // 允许存放的物料编码
}, },
// 物料选择器相关
materialSelectorVisible: false,
allowMaterialDisplay: '', // 物料选择器显示文本
tempSelectedMaterials: [], // 临时选中的物料编码
// 表单校验 // 表单校验
rules: { rules: {
warehousesCode: [ warehousesCode: [
...@@ -474,8 +398,6 @@ export default { ...@@ -474,8 +398,6 @@ export default {
cancel() { cancel() {
this.open = false this.open = false
this.reset() this.reset()
// 重置物料选择器
this.materialSelectorVisible = false
this.allowMaterialDisplay = '' this.allowMaterialDisplay = ''
this.tempSelectedMaterials = [] this.tempSelectedMaterials = []
}, },
...@@ -639,50 +561,6 @@ export default { ...@@ -639,50 +561,6 @@ export default {
handleImport() { handleImport() {
this.$refs.import.show() this.$refs.import.show()
}, },
// 打开物料选择器
openMaterialSelector() {
// 初始化临时选中数据
this.tempSelectedMaterials = [...this.form.allowMaterialCodes]
this.materialSelectorVisible = true
// 清空子组件选中状态(如果有该方法)
this.$nextTick(() => {
if (this.$refs.materialSelector && this.$refs.materialSelector.clearSelection) {
this.$refs.materialSelector.clearSelection()
// 回显已选物料
if (this.tempSelectedMaterials.length) {
this.$refs.materialSelector.setSelection(this.tempSelectedMaterials)
}
}
})
},
// 物料选择变化回调
handleMaterialSelectionChange(selectedData) {
// 兼容不同格式的返回值
this.tempSelectedMaterials = (selectedData.materialIds || selectedData || [])
.filter(code => code && code.trim())
.map(code => code.trim())
.filter((code, index, self) => self.indexOf(code) === index)
},
// 确认物料选择
confirmMaterialSelection() {
if (!this.tempSelectedMaterials.length) {
this.allowMaterialDisplay = ''
} else {
this.allowMaterialDisplay = this.tempSelectedMaterials.join(', ')
}
this.form.allowMaterialCodes = [...this.tempSelectedMaterials]
this.materialSelectorVisible = false
},
// 清空物料选择
clearMaterialSelection() {
this.allowMaterialDisplay = ''
this.tempSelectedMaterials = []
this.form.allowMaterialCodes = []
}
} }
} }
</script> </script>
......
...@@ -95,10 +95,10 @@ public class OutboundOrderItemsController extends BaseController ...@@ -95,10 +95,10 @@ public class OutboundOrderItemsController extends BaseController
@PreAuthorize("@ss.hasPermi('inventory:items:export')") @PreAuthorize("@ss.hasPermi('inventory:items:export')")
@Log(title = "出库单明细", businessType = BusinessType.EXPORT) @Log(title = "出库单明细", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrderItems outboundOrderItems) public void export(HttpServletResponse response, OutboundOrdersSummaryVO outboundOrderItems)
{ {
List<OutboundOrderItems> list = outboundOrderItemsService.selectOutboundOrderItemsList(outboundOrderItems); List<OutboundOrdersSummaryVO> list = outboundOrderItemsService.selectOutboundOrdersitmesExportList(outboundOrderItems);
ExcelUtil<OutboundOrderItems> util = new ExcelUtil<OutboundOrderItems>(OutboundOrderItems.class); ExcelUtil<OutboundOrdersSummaryVO> util = new ExcelUtil<OutboundOrdersSummaryVO>(OutboundOrdersSummaryVO.class);
util.exportExcel(response, list, "出库单明细数据"); util.exportExcel(response, list, "出库单明细数据");
} }
......
package com.ruoyi.inventory.controller; package com.ruoyi.inventory.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -8,6 +9,7 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -8,6 +9,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.inventory.domain.Inventory; import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.vo.inboundVO.InboundTemplateVO; import com.ruoyi.inventory.domain.vo.inboundVO.InboundTemplateVO;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO; import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -61,8 +63,8 @@ public class OutboundOrdersController extends BaseController ...@@ -61,8 +63,8 @@ public class OutboundOrdersController extends BaseController
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, OutboundOrders outboundOrders) public void export(HttpServletResponse response, OutboundOrders outboundOrders)
{ {
List<OutboundOrders> list = outboundOrdersService.selectOutboundOrdersList(outboundOrders); List<OutboundTemplateVO> list = outboundOrdersService.selectOutboundOrdersExportList(outboundOrders);
ExcelUtil<OutboundOrders> util = new ExcelUtil<OutboundOrders>(OutboundOrders.class); ExcelUtil<OutboundTemplateVO> util = new ExcelUtil<OutboundTemplateVO>(OutboundTemplateVO.class);
util.exportExcel(response, list, "出库单主数据"); util.exportExcel(response, list, "出库单主数据");
} }
......
package com.ruoyi.inventory.controller; package com.ruoyi.inventory.controller;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -8,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.inventory.domain.Owners; import com.ruoyi.inventory.domain.Owners;
import com.ruoyi.inventory.domain.vo.OwnerTemplateVO; import com.ruoyi.inventory.domain.vo.OwnerTemplateVO;
import com.ruoyi.inventory.domain.vo.StorageLocationsLocationTemplateVO; import com.ruoyi.inventory.domain.vo.StorageLocationsLocationTemplateVO;
import org.springframework.beans.BeanUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -55,8 +57,17 @@ public class StorageLocationsController extends BaseController ...@@ -55,8 +57,17 @@ public class StorageLocationsController extends BaseController
public void export(HttpServletResponse response, StorageLocations storageLocations) public void export(HttpServletResponse response, StorageLocations storageLocations)
{ {
List<StorageLocations> list = storageLocationsService.selectStorageLocationsList(storageLocations); List<StorageLocations> list = storageLocationsService.selectStorageLocationsList(storageLocations);
ExcelUtil<StorageLocations> util = new ExcelUtil<StorageLocations>(StorageLocations.class); List<StorageLocationsLocationTemplateVO> list1 = new ArrayList<>();
util.exportExcel(response, list, "库位数据"); StorageLocationsLocationTemplateVO storageLocationsLocationTemplateVO = new StorageLocationsLocationTemplateVO();
for (StorageLocations loc : list) {
BeanUtils.copyProperties(loc,storageLocationsLocationTemplateVO);
storageLocationsLocationTemplateVO.setIsEnabled(String.valueOf(loc.getIsEnabled()));
storageLocationsLocationTemplateVO.setLocationType(loc.getLocationType());
storageLocationsLocationTemplateVO.setLocationUsage(String.valueOf(loc.getLocationUsage()));
list1.add(storageLocationsLocationTemplateVO);
}
ExcelUtil<StorageLocationsLocationTemplateVO> util = new ExcelUtil<StorageLocationsLocationTemplateVO>(StorageLocationsLocationTemplateVO.class);
util.exportExcel(response, list1, "库位数据");
} }
/** /**
......
package com.ruoyi.inventory.domain; package com.ruoyi.inventory.domain;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
...@@ -13,8 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity; ...@@ -13,8 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi * @author ruoyi
* @date 2025-12-01 * @date 2025-12-01
*/ */
@Getter @Data
@Setter
public class StorageLocations extends BaseEntity public class StorageLocations extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -137,251 +137,6 @@ public class StorageLocations extends BaseEntity ...@@ -137,251 +137,6 @@ public class StorageLocations extends BaseEntity
/** 仓库名称 */ /** 仓库名称 */
private String warehousesName; private String warehousesName;
// ========== getter/setter 方法保持不变 ========== private String loadingArea;
public String getAllowedCategoryNames() {
return allowedCategoryNames;
}
public void setAllowedCategoryNames(String allowedCategoryNames) {
this.allowedCategoryNames = allowedCategoryNames;
}
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public String getWarehousesId() {
return warehousesId;
}
public void setWarehousesId(String warehousesId) {
this.warehousesId = warehousesId;
}
public String getWarehousesName() {
return warehousesName;
}
public void setWarehousesName(String warehousesName) {
this.warehousesName = warehousesName;
}
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;
}
/**
* 重写toString方法,补充所有新增字段
*/
@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("warehousesId", getWarehousesId()) // 新增:仓库ID
.append("warehousesName", getWarehousesName()) // 新增:仓库名称
.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("allowedCategoryNames", getAllowedCategoryNames()) // 新增:分类名称
.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();
}
} }
\ No newline at end of file
...@@ -23,7 +23,6 @@ public class OutboundOrdersSummaryVO extends BaseEntity ...@@ -23,7 +23,6 @@ public class OutboundOrdersSummaryVO extends BaseEntity
// ========== 物料基础信息(来自materials表) ========== // ========== 物料基础信息(来自materials表) ==========
/** 物料ID */ /** 物料ID */
@Excel(name = "物料ID")
private String materialId; private String materialId;
/** 物料名称 */ /** 物料名称 */
...@@ -31,61 +30,43 @@ public class OutboundOrdersSummaryVO extends BaseEntity ...@@ -31,61 +30,43 @@ public class OutboundOrdersSummaryVO extends BaseEntity
private String materialName; private String materialName;
/** SAP编码 */ /** SAP编码 */
@Excel(name = "SAP编码") @Excel(name = "SAP物料号")
private String sapNo; private String sapNo;
/** TS编码 */ /** TS编码 */
@Excel(name = "TS编码") @Excel(name = "TS Code")
private String tsCode; private String tsCode;
/** 危化品ID */ /** 危化品ID */
@Excel(name = "危化品ID") @Excel(name = "危险类别")
private String hazardId; private String hazardId;
/** 物料规格 */ /** 物料规格 */
@Excel(name = "物料规格") @Excel(name = "规格型号")
private String specification; private String specification;
/** 物料单位 */ /** 物料单位 */
@Excel(name = "物料单位") @Excel(name = "计量单位")
private String materialUnit; private String materialUnit;
/** 单重 */ /** 单重 */
@Excel(name = "单") @Excel(name = "单位重量")
private BigDecimal unitWeight; private BigDecimal unitWeight;
/** 包装重量 */ // 移除表格中没有的Excel注解字段
@Excel(name = "包装重量")
private BigDecimal packageWeight;
private String itemStatus; private String itemStatus;
@Excel(name = "单价")
private String unitPrice; private String unitPrice;
/** 总重量 */ // 以下字段表格无,全部移除@Excel注解
@Excel(name = "总重量") private BigDecimal packageWeight;
private BigDecimal totalWeight; private BigDecimal totalWeight;
/** 体积 */
@Excel(name = "体积")
private BigDecimal volume; private BigDecimal volume;
/** 保质期天数 */
@Excel(name = "保质期天数")
private Long shelfLifeDays; private Long shelfLifeDays;
/** 存储温度 */
@Excel(name = "存储温度")
private String storageTemperature; private String storageTemperature;
/** 特殊要求 */
@Excel(name = "特殊要求")
private String specialRequirements; private String specialRequirements;
/** 物料排序号 */
@Excel(name = "物料排序号")
private Long sortNo; private Long sortNo;
// ========== 统计计算字段(聚合查询) ==========
/** 计划数量(汇总) */ /** 计划数量(汇总) */
@Excel(name = "计划数量") @Excel(name = "计划数量")
private BigDecimal plannedQuantity; private BigDecimal plannedQuantity;
...@@ -95,29 +76,25 @@ public class OutboundOrdersSummaryVO extends BaseEntity ...@@ -95,29 +76,25 @@ public class OutboundOrdersSummaryVO extends BaseEntity
private BigDecimal actualQuantity; private BigDecimal actualQuantity;
/** 总金额(汇总:单价*实际数量) */ /** 总金额(汇总:单价*实际数量) */
@Excel(name = "金额") @Excel(name = "金额")
private BigDecimal totalAmount; private BigDecimal totalAmount;
// ========== 仓库信息(来自warehouses表) ========== // 仓库ID表格无,移除Excel注解
/** 仓库ID */
@Excel(name = "仓库ID")
private String warehouseId; private String warehouseId;
/** 仓库名称 */ /** 仓库名称 */
@Excel(name = "仓库名称") @Excel(name = "仓库")
private String warehouseName; private String warehouseName;
// ========== 订单批次信息(来自outbound_order_items表) ==========
/** 批次号 */ /** 批次号 */
@Excel(name = "批次") @Excel(name = "批次")
private String batchCode; private String batchCode;
/** 子订单ID(出库单明细订单ID) */ // 子订单ID表格无,移除Excel注解
@Excel(name = "子订单ID")
private String orderId; private String orderId;
/** 主订单ID(出库单主表订单ID) */ /** 主订单ID(出库单主表订单ID) */
@Excel(name = "主订单ID") @Excel(name = "主订单")
private String mainOrderId; private String mainOrderId;
// ========== 检索条件字段 ========== // ========== 检索条件字段 ==========
...@@ -129,10 +106,12 @@ public class OutboundOrdersSummaryVO extends BaseEntity ...@@ -129,10 +106,12 @@ public class OutboundOrdersSummaryVO extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate; private Date endDate;
/** 库位ID(检索条件) */ private String orderStatus;
@Excel(name = "库位ID 检索条件") // 库位ID表格无,移除Excel注解
private String locationId; private String locationId;
/** 库位名称 */
@Excel(name = "库位")
private String locationName; private String locationName;
} }
\ No newline at end of file
...@@ -26,7 +26,7 @@ public class StorageLocationsLocationTemplateVO { ...@@ -26,7 +26,7 @@ public class StorageLocationsLocationTemplateVO {
private String LocationUsage; private String LocationUsage;
@Excel(name = "库位类型",dictType = "location_type") @Excel(name = "库位类型",dictType = "location_type")
private String locationType; private Long locationType;
@Excel(name = "库位属性",dictType = "is_enabled") @Excel(name = "库位属性",dictType = "is_enabled")
private String isEnabled; private String isEnabled;
...@@ -38,7 +38,7 @@ public class StorageLocationsLocationTemplateVO { ...@@ -38,7 +38,7 @@ public class StorageLocationsLocationTemplateVO {
private String turnoverDemand; private String turnoverDemand;
@Excel(name = "上架区") @Excel(name = "上架区")
private String zoneCode; private String loadingArea;
@Excel(name = "拣货区") @Excel(name = "拣货区")
private String pickingArea; private String pickingArea;
......
...@@ -80,5 +80,7 @@ public interface OutboundOrderItemsMapper ...@@ -80,5 +80,7 @@ public interface OutboundOrderItemsMapper
public int deleteOutboundOrderItemsByOrderId(String orderId); public int deleteOutboundOrderItemsByOrderId(String orderId);
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems);
} }
...@@ -5,6 +5,7 @@ import java.util.Map; ...@@ -5,6 +5,7 @@ import java.util.Map;
import com.ruoyi.inventory.domain.OutboundOrders; import com.ruoyi.inventory.domain.OutboundOrders;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
/** /**
* 出库单主Mapper接口 * 出库单主Mapper接口
...@@ -91,4 +92,5 @@ public interface OutboundOrdersMapper ...@@ -91,4 +92,5 @@ public interface OutboundOrdersMapper
public List<Map<String,String>> SelectOutboundOrdersMaterialsTopTenByQuantity(); public List<Map<String,String>> SelectOutboundOrdersMaterialsTopTenByQuantity();
public String outboundOrdersCount(); public String outboundOrdersCount();
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders);
} }
...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.service; ...@@ -3,6 +3,7 @@ package com.ruoyi.inventory.service;
import java.util.List; import java.util.List;
import com.ruoyi.inventory.domain.OutboundOrderItems; import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.vo.OutboundOrdersSummaryVO; import com.ruoyi.inventory.domain.vo.OutboundOrdersSummaryVO;
import com.ruoyi.inventory.domain.vo.OutboundTemplateVO;
/** /**
* 出库单明细Service接口 * 出库单明细Service接口
...@@ -68,4 +69,8 @@ public interface IOutboundOrderItemsService ...@@ -68,4 +69,8 @@ public interface IOutboundOrderItemsService
public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems); public List<OutboundOrderItems> selectOutboundOrderItemsStatisticsList(OutboundOrderItems outboundOrderItems);
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems);
} }
...@@ -79,4 +79,6 @@ public interface IOutboundOrdersService ...@@ -79,4 +79,6 @@ public interface IOutboundOrdersService
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
String importOutboundOrders(List<OutboundTemplateVO> inboundOrdersList, Boolean isUpdateSupport, String operName,Integer orderType); String importOutboundOrders(List<OutboundTemplateVO> inboundOrdersList, Boolean isUpdateSupport, String operName,Integer orderType);
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders);
} }
...@@ -207,6 +207,8 @@ public class InventoryServiceImpl implements IInventoryService ...@@ -207,6 +207,8 @@ public class InventoryServiceImpl implements IInventoryService
insertInventoryTransactions.insertInventoryTransactions(transactions); insertInventoryTransactions.insertInventoryTransactions(transactions);
} }
//入库单确认入库日志 //入库单确认入库日志
private void createInventoryInboundLog(Inventory inventory, private void createInventoryInboundLog(Inventory inventory,
Long addQty, String createUser, Date createTime) { Long addQty, String createUser, Date createTime) {
......
...@@ -45,6 +45,7 @@ public class InventoryTransactionsServiceImpl implements IInventoryTransactionsS ...@@ -45,6 +45,7 @@ public class InventoryTransactionsServiceImpl implements IInventoryTransactionsS
return inventoryTransactionsMapper.selectInventoryTransactionsList(inventoryTransactions); return inventoryTransactionsMapper.selectInventoryTransactionsList(inventoryTransactions);
} }
/** /**
* 新增库存事务 * 新增库存事务
* *
......
...@@ -76,6 +76,12 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService ...@@ -76,6 +76,12 @@ public class OutboundOrderItemsServiceImpl implements IOutboundOrderItemsService
} }
@Override @Override
public List<OutboundOrdersSummaryVO> selectOutboundOrdersitmesExportList(OutboundOrdersSummaryVO outboundOrderItems) {
List<OutboundOrdersSummaryVO> list = outboundOrderItemsMapper.selectOutboundOrdersitmesExportList(outboundOrderItems);
return list;
}
@Override
public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems) public int insertOutboundOrderItems(OutboundOrderItems outboundOrderItems)
{ {
outboundOrderItems.setCreateTime(DateUtils.getNowDate()); outboundOrderItems.setCreateTime(DateUtils.getNowDate());
......
...@@ -281,6 +281,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService { ...@@ -281,6 +281,7 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
if (!toUpdateInventoryMap.isEmpty()) { if (!toUpdateInventoryMap.isEmpty()) {
List<Inventory> needUpdateList = new ArrayList<>(toUpdateInventoryMap.values()); List<Inventory> needUpdateList = new ArrayList<>(toUpdateInventoryMap.values());
inventoryMapper.batchUpdateInventory(needUpdateList); inventoryMapper.batchUpdateInventory(needUpdateList);
needUpdateList.forEach(inv -> { needUpdateList.forEach(inv -> {
String cacheKey = buildInventoryKey(inv.getMaterialId(), inv.getLocationId(), inv.getInventoryType().toString()); String cacheKey = buildInventoryKey(inv.getMaterialId(), inv.getLocationId(), inv.getInventoryType().toString());
...@@ -829,6 +830,12 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService { ...@@ -829,6 +830,12 @@ public class OutboundOrdersServiceImpl implements IOutboundOrdersService {
} }
} }
@Override
public List<OutboundTemplateVO> selectOutboundOrdersExportList(OutboundOrders outboundOrders) {
List<OutboundTemplateVO> list = outboundOrdersMapper.selectOutboundOrdersExportList(outboundOrders);
return list;
}
/** /**
* 处理无库位明细拆分(仅拆分实际被扣减的库存ID) * 处理无库位明细拆分(仅拆分实际被扣减的库存ID)
*/ */
......
...@@ -264,13 +264,15 @@ ...@@ -264,13 +264,15 @@
<where> <where>
oi.is_used = 1 and o.is_used = 1 oi.is_used = 1 and o.is_used = 1
<if test="orderId != null and orderId != ''"> and oi.order_id like concat('%', #{orderId}, '%')</if> <if test="orderId != null and orderId != ''"> and oi.order_id like concat('%', #{orderId}, '%')</if>
<if test="materialId != null and materialId != ''"> and oi.material_id = #{materialId}</if> <if test="materialId != null and materialId != ''"> and m.sap_no like concat('%', #{materialId}, '%')or m.material_name like concat('%', #{materialId}, '%')</if>
<if test="batchCode != null and batchCode != ''"> and oi.batch_code = #{batchCode}</if> <if test="batchCode != null and batchCode != ''"> and oi.batch_code = #{batchCode}</if>
<if test="startDate != null and startDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}</if> <if test="startDate != null and startDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}</if> <if test="endDate != null and endDate != ''"> and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and oi.warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and oi.warehouse_id = #{warehouseId}</if>
<if test="locationId != null and locationId != ''"> and oi.location_id = #{locationId}</if> <if test="locationId != null and locationId != ''"> and oi.location_id = #{locationId}</if>
<if test="itemStatus != null "> and oi.item_status = #{itemStatus}</if> <if test="itemStatus != null "> and oi.item_status = #{itemStatus}</if>
<if test="orderStatus != null "> and o.order_status = #{orderStatus}</if>
</where> </where>
group by oi.material_id, group by oi.material_id,
m.material_name, m.material_name,
...@@ -357,7 +359,107 @@ ...@@ -357,7 +359,107 @@
o.order_id o.order_id
order by sum(oi.unit_price * oi.actual_quantity) desc,m.sap_no, m.sort_no order by sum(oi.unit_price * oi.actual_quantity) desc,m.sap_no, m.sort_no
</select> </select>
<select id="selectOutboundOrdersitmesExportList"
parameterType="OutboundOrdersSummaryVO"
resultMap="OutboundOrdersSummaryVOResult">
select
oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
sum(oi.planned_quantity) as planned_quantity,
sum(oi.actual_quantity) as actual_quantity,
oi.unit_price,
sum(oi.unit_price * oi.actual_quantity) as total_amount,
w.warehouses_name as warehouse_name,
oi.batch_code,
o.order_id as main_order_id,
sl.location_name,
-- 以下为VO中保留但无Excel注解的字段(保证关联完整性)
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
oi.warehouse_id,
oi.order_id as sub_order_id,
oi.location_id,
oi.item_status,
oi.remark
from outbound_order_items oi
left join outbound_orders o on oi.outbound_order_id = o.id
left join materials m on oi.material_id = m.id
left join warehouses w on oi.warehouse_id = w.id
left join storage_locations sl on oi.location_id = sl.id
<where>
oi.is_used = 1 and o.is_used = 1
-- 整合两个SQL的所有检索条件(去重且兼容)
<if test="orderId != null and orderId != ''">
and oi.order_id like concat('%', #{orderId}, '%')
</if>
<if test="materialId != null and materialId != ''">
and (m.sap_no like concat('%', #{materialId}, '%')
or m.material_name like concat('%', #{materialId}, '%')
or oi.material_id like concat('%', #{materialId}, '%'))
</if>
<if test="batchCode != null and batchCode != ''">
and oi.batch_code = #{batchCode}
</if>
<if test="startDate != null and startDate != ''">
and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(COALESCE(oi.shipped_at, o.inbound_date),'%Y-%m-%d') &lt;= #{endDate}
</if>
<if test="warehouseId != null and warehouseId != ''">
and oi.warehouse_id = #{warehouseId}
</if>
<if test="locationId != null and locationId != ''">
and oi.location_id = #{locationId}
</if>
<if test="itemStatus != null ">
and oi.item_status = #{itemStatus}
</if>
<if test="orderStatus != null ">
and o.order_status = #{orderStatus}
</if>
</where>
-- 分组字段整合:覆盖两个SQL的分组维度,保证汇总逻辑一致
group by oi.material_id,
m.material_name,
m.sap_no,
m.ts_code,
m.hazard_id,
m.specification,
m.material_unit,
m.unit_weight,
oi.unit_price,
w.warehouses_name,
oi.batch_code,
o.order_id,
sl.location_name,
m.package_weight,
m.total_weight,
m.volume,
m.shelf_life_days,
m.storage_temperature,
m.special_requirements,
m.sort_no,
oi.warehouse_id,
oi.order_id,
oi.location_id,
oi.item_status
-- 排序规则:优先按总金额降序,再按SAP编码、物料排序号
order by sum(oi.unit_price * oi.actual_quantity) desc,
m.sap_no,
m.sort_no
</select>
<!-- 批量删除:逻辑删除 --> <!-- 批量删除:逻辑删除 -->
<update id="deleteOutboundOrderItemsByIds" parameterType="String"> <update id="deleteOutboundOrderItemsByIds" parameterType="String">
update outbound_order_items update outbound_order_items
......
...@@ -71,6 +71,38 @@ ...@@ -71,6 +71,38 @@
<result property="inboundOrderId" column="inbound_order_id" /> <result property="inboundOrderId" column="inbound_order_id" />
</resultMap> </resultMap>
<resultMap id="OutboundTemplateVOMap" type="com.ruoyi.inventory.domain.vo.OutboundTemplateVO">
<id column="id" property="id"/>
<result column="inbound_date" property="inboundDate"/>
<result column="sap_no" property="sapNo"/>
<result column="material_id" property="materialId"/>
<result column="material_name" property="materialName"/>
<result column="ts_code" property="tsCode"/>
<result column="batch_code" property="batchCode"/>
<result column="planned_quantity" property="plannedQuantity"/>
<result column="divisor" property="divisor"/>
<result column="piece_weight" property="pieceWeight"/>
<result column="actual_packages" property="actualPackages"/>
<result column="actual_quantity" property="actualQuantity"/>
<result column="location_name" property="locationName"/>
<result column="location_id" property="locationId"/>
<result column="warehouse_id" property="warehouseId"/>
<result column="warehouse_name" property="warehouseName"/>
<result column="remark" property="remark"/>
<result column="label_color" property="labelColor"/>
<result column="voucher_number" property="voucherNumber"/>
<result column="insulation" property="insulation"/>
<result column="danger_check_type" property="dangerCheckType"/>
<result column="order_id" property="orderId"/>
<result column="system_no" property="systemNo"/>
<result column="order_type" property="orderType"/>
<result column="owner_id" property="ownerId"/>
<result column="owner_name" property="ownerName"/>
<result column="destination" property="destination"/>
<result column="reservation" property="reservation"/>
<result column="single_piece_weight" property="singlePieceWeight"/>
</resultMap>
<sql id="selectOutboundOrdersVo"> <sql id="selectOutboundOrdersVo">
select select
oo.id, oo.id,
...@@ -106,7 +138,6 @@ ...@@ -106,7 +138,6 @@
<select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersOutboundOrderItemsResult"> <select id="selectOutboundOrdersList" parameterType="OutboundOrders" resultMap="OutboundOrdersOutboundOrderItemsResult">
<include refid="selectOutboundOrdersVo"/> <include refid="selectOutboundOrdersVo"/>
<if test="orderId != null and orderId != ''"> and oo.order_id like concat('%', #{orderId}, '%')</if> <if test="orderId != null and orderId != ''"> and oo.order_id like concat('%', #{orderId}, '%')</if>
<if test="batchCode != null and batchCode != ''"> and oo.batch_code like concat('%', #{batchCode}, '%')</if>
<if test="systemNo != null and systemNo != ''"> and oo.system_no like concat('%', #{systemNo}, '%')</if> <if test="systemNo != null and systemNo != ''"> and oo.system_no like concat('%', #{systemNo}, '%')</if>
<if test="orderTypeId != null and orderTypeId != ''"> and oo.order_type_id = #{orderTypeId}</if> <if test="orderTypeId != null and orderTypeId != ''"> and oo.order_type_id = #{orderTypeId}</if>
<if test="orderType != null and orderType != ''"> and oo.order_type = #{orderType}</if> <if test="orderType != null and orderType != ''"> and oo.order_type = #{orderType}</if>
...@@ -115,8 +146,12 @@ ...@@ -115,8 +146,12 @@
<if test="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if> <if test="ownerId != null and ownerId != ''"> and oo.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and oo.order_status = #{orderStatus}</if> <if test="orderStatus != null "> and oo.order_status = #{orderStatus}</if>
<if test="isImport != null "> and oo.is_import = #{isImport}</if> <if test="isImport != null "> and oo.is_import = #{isImport}</if>
<if test="startDate != null"> and oo.inbound_date &gt;= #{startDate}</if> <if test="startDate != null and startDate != ''">
<if test="endDate != null"> and oo.inbound_date &lt;= #{endDate}</if> and DATE(oo.inbound_date) >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE(oo.inbound_date) &lt;= #{endDate}
</if>
<if test="destination != null and destination != ''"> and oo.destination = #{destination}</if> <if test="destination != null and destination != ''"> and oo.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if> <if test="totalPlannedQuantity != null "> and oo.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if> <if test="totalActualQuantity != null "> and oo.total_actual_quantity = #{totalActualQuantity}</if>
...@@ -371,4 +406,69 @@ ...@@ -371,4 +406,69 @@
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>
<select id="selectOutboundOrdersExportList"
parameterType="OutboundOrders"
resultMap="OutboundTemplateVOMap">
select
oi.id,
o.inbound_date,
m.sap_no,
m.id as material_id,
m.material_name,
m.ts_code,
oi.batch_code,
oi.planned_quantity,
oi.divisor,
m.package_weight as piece_weight,
null as actual_packages,
oi.actual_quantity,
sl.location_name,
sl.id as location_id,
w.id as warehouse_id,
w.warehouses_name as warehouse_name,
oi.remark,
oi.label_color,
oi.voucher_number,
m.storage_temperature as insulation,
m.risk_level as danger_check_type,
o.order_id,
o.system_no,
o.order_type,
ow.id as owner_id,
ow.owner_name,
o.destination,
null as reservation,
m.unit_weight as single_piece_weight
from outbound_order_items oi
left join outbound_orders o on oi.outbound_order_id = o.id
left join owners ow on o.owner_id = ow.id
left join materials m on oi.material_id = m.id
left join warehouses w on oi.warehouse_id = w.id
left join storage_locations sl on oi.location_id = sl.id
<where>
<if test="orderId != null and orderId != ''"> and o.order_id like concat('%', #{orderId}, '%')</if>
<if test="systemNo != null and systemNo != ''"> and o.system_no like concat('%', #{systemNo}, '%')</if>
<if test="orderTypeId != null and orderTypeId != ''"> and o.order_type_id = #{orderTypeId}</if>
<if test="orderType != null and orderType != ''"> and o.order_type = #{orderType}</if>
<if test="batchCode != null and batchCode != ''"> and o.batch_code like concat('%', #{batchCode}, '%')</if>
<if test="warehouseId != null and warehouseId != ''"> and o.warehouse_id = #{warehouseId}</if>
<if test="ownerId != null and ownerId != ''"> and o.owner_id = #{ownerId}</if>
<if test="orderStatus != null "> and o.order_status = #{orderStatus}</if>
<if test="isImport != null "> and o.is_import = #{isImport}</if>
<if test="startDate != null and startDate != ''">
and DATE(o.inbound_date) >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE(o.inbound_date) &lt;= #{endDate}
</if>
<if test="destination != null and destination != ''"> and o.destination = #{destination}</if>
<if test="totalPlannedQuantity != null "> and o.total_planned_quantity = #{totalPlannedQuantity}</if>
<if test="totalActualQuantity != null "> and o.total_actual_quantity = #{totalActualQuantity}</if>
<if test="totalPackages != null "> and o.total_packages = #{totalPackages}</if>
<if test="sortNo != null "> and o.sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and o.create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and o.update_user_code = #{updateUserCode}</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -143,11 +143,11 @@ ...@@ -143,11 +143,11 @@
</update> </update>
<update id="deleteOwnersById" parameterType="String"> <update id="deleteOwnersById" parameterType="String">
update owners set is_used = 1 where id = #{id} update owners set is_used = 0 where id = #{id}
</update> </update>
<update id="deleteOwnersByIds" parameterType="String"> <update id="deleteOwnersByIds" parameterType="String">
update owners set is_used = 1 where id in update owners set is_used = 0 where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
<result property="pickingArea" column="picking_area" /> <result property="pickingArea" column="picking_area" />
<result property="allowMixedProducts" column="allow_mixed_products" /> <result property="allowMixedProducts" column="allow_mixed_products" />
<result property="allowMixedBatches" column="allow_mixed_batches" /> <result property="allowMixedBatches" column="allow_mixed_batches" />
<!-- 新增loading_area字段映射 -->
<result property="loadingArea" column="loading_area" />
</resultMap> </resultMap>
<!-- 关联仓库表的ResultMap - 继承基础ResultMap(自动包含新字段) --> <!-- 关联仓库表的ResultMap - 继承基础ResultMap(自动包含新字段) -->
...@@ -57,7 +59,9 @@ ...@@ -57,7 +59,9 @@
-- 新增字段查询 -- 新增字段查询
sl.putaway_order, sl.picking_order, sl.location_usage, sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area, sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area
from storage_locations sl from storage_locations sl
where sl.is_used = 1 where sl.is_used = 1
</sql> </sql>
...@@ -73,6 +77,8 @@ ...@@ -73,6 +77,8 @@
sl.putaway_order, sl.picking_order, sl.location_usage, sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area, sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches, sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area,
w.warehouses_name w.warehouses_name
from storage_locations sl from storage_locations sl
left join warehouses w on sl.warehouses_id = w.id left join warehouses w on sl.warehouses_id = w.id
...@@ -108,6 +114,8 @@ ...@@ -108,6 +114,8 @@
<if test="warehousesId != null and warehousesId != ''"> and sl.warehouses_id = #{warehousesId}</if> <if test="warehousesId != null and warehousesId != ''"> and sl.warehouses_id = #{warehousesId}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if> <if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if> <if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area like concat('%', #{loadingArea}, '%')</if>
order by sl.sort_no desc order by sl.sort_no desc
</select> </select>
...@@ -131,6 +139,8 @@ ...@@ -131,6 +139,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if> <if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if> <if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if> <if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 --> <!-- 按sort_no降序排序 -->
order by sl.sort_no desc order by sl.sort_no desc
</select> </select>
...@@ -145,7 +155,9 @@ ...@@ -145,7 +155,9 @@
-- 新增字段查询 -- 新增字段查询
sl.putaway_order, sl.picking_order, sl.location_usage, sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area, sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area
from storage_locations sl from storage_locations sl
where sl.id = #{id} where sl.id = #{id}
</select> </select>
...@@ -174,6 +186,8 @@ ...@@ -174,6 +186,8 @@
sl.putaway_order, sl.picking_order, sl.location_usage, sl.putaway_order, sl.picking_order, sl.location_usage,
sl.location_handling, sl.turnover_demand, sl.picking_area, sl.location_handling, sl.turnover_demand, sl.picking_area,
sl.allow_mixed_products, sl.allow_mixed_batches, sl.allow_mixed_products, sl.allow_mixed_batches,
-- 新增loading_area字段查询
sl.loading_area,
w.warehouses_name, w.warehouses_address, w.warehouses_manager, w.warehouses_phone w.warehouses_name, w.warehouses_address, w.warehouses_manager, w.warehouses_phone
from storage_locations sl from storage_locations sl
left join warehouses w on sl.warehouses_code = w.warehouses_code left join warehouses w on sl.warehouses_code = w.warehouses_code
...@@ -272,6 +286,8 @@ ...@@ -272,6 +286,8 @@
<if test="pickingArea != null">picking_area,</if> <if test="pickingArea != null">picking_area,</if>
<if test="allowMixedProducts != null">allow_mixed_products,</if> <if test="allowMixedProducts != null">allow_mixed_products,</if>
<if test="allowMixedBatches != null">allow_mixed_batches,</if> <if test="allowMixedBatches != null">allow_mixed_batches,</if>
<!-- 新增loading_area字段插入 -->
<if test="loadingArea != null">loading_area,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
...@@ -305,6 +321,8 @@ ...@@ -305,6 +321,8 @@
<if test="pickingArea != null">#{pickingArea},</if> <if test="pickingArea != null">#{pickingArea},</if>
<if test="allowMixedProducts != null">#{allowMixedProducts},</if> <if test="allowMixedProducts != null">#{allowMixedProducts},</if>
<if test="allowMixedBatches != null">#{allowMixedBatches},</if> <if test="allowMixedBatches != null">#{allowMixedBatches},</if>
<!-- 新增loading_area字段值 -->
<if test="loadingArea != null">#{loadingArea},</if>
</trim> </trim>
</insert> </insert>
...@@ -317,7 +335,9 @@ ...@@ -317,7 +335,9 @@
is_enabled, is_used, sort_no, create_time, create_user_code, is_enabled, is_used, sort_no, create_time, create_user_code,
update_time, update_user_code, warehouses_id, putaway_order, picking_order, update_time, update_user_code, warehouses_id, putaway_order, picking_order,
location_usage, location_handling, turnover_demand, picking_area, location_usage, location_handling, turnover_demand, picking_area,
allow_mixed_products, allow_mixed_batches allow_mixed_products, allow_mixed_batches,
-- 新增loading_area字段
loading_area
) VALUES ) VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
...@@ -327,7 +347,9 @@ ...@@ -327,7 +347,9 @@
#{item.isEnabled}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.isEnabled}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode},
#{item.updateTime}, #{item.updateUserCode}, #{item.warehousesId}, #{item.putawayOrder}, #{item.pickingOrder}, #{item.updateTime}, #{item.updateUserCode}, #{item.warehousesId}, #{item.putawayOrder}, #{item.pickingOrder},
#{item.LocationUsage}, #{item.locationHandling}, #{item.turnoverDemand}, #{item.pickingArea}, #{item.LocationUsage}, #{item.locationHandling}, #{item.turnoverDemand}, #{item.pickingArea},
#{item.allowMixedProducts}, #{item.allowMixedBatches} #{item.allowMixedProducts}, #{item.allowMixedBatches},
-- 新增loading_area字段值
#{item.loadingArea}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -364,6 +386,8 @@ ...@@ -364,6 +386,8 @@
<if test="pickingArea != null">picking_area = #{pickingArea},</if> <if test="pickingArea != null">picking_area = #{pickingArea},</if>
<if test="allowMixedProducts != null">allow_mixed_products = #{allowMixedProducts},</if> <if test="allowMixedProducts != null">allow_mixed_products = #{allowMixedProducts},</if>
<if test="allowMixedBatches != null">allow_mixed_batches = #{allowMixedBatches},</if> <if test="allowMixedBatches != null">allow_mixed_batches = #{allowMixedBatches},</if>
<!-- 新增loading_area字段更新 -->
<if test="loadingArea != null">loading_area = #{loadingArea},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
...@@ -409,6 +433,8 @@ ...@@ -409,6 +433,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if> <if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if> <if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if> <if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 --> <!-- 按sort_no降序排序 -->
order by sl.sort_no desc order by sl.sort_no desc
</select> </select>
...@@ -432,6 +458,8 @@ ...@@ -432,6 +458,8 @@
<if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if> <if test="pickingArea != null and pickingArea != ''"> and sl.picking_area = #{pickingArea}</if>
<if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if> <if test="allowMixedProducts != null "> and sl.allow_mixed_products = #{allowMixedProducts}</if>
<if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if> <if test="allowMixedBatches != null "> and sl.allow_mixed_batches = #{allowMixedBatches}</if>
<!-- 新增loading_area查询条件 -->
<if test="loadingArea != null and loadingArea != ''"> and sl.loading_area = #{loadingArea}</if>
<!-- 按sort_no降序排序 --> <!-- 按sort_no降序排序 -->
order by sl.sort_no desc order by sl.sort_no desc
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论