代码更新:

1. 增加间接物料的功能。
This commit is contained in:
梁州 2024-12-30 16:01:55 +08:00
parent a2918c1ac1
commit ffac5ff1ab
5 changed files with 163 additions and 11 deletions

View File

@ -52,10 +52,22 @@ const deleteGoodsInfo = (params) => {
}) })
} }
/**
* 一键配置间接物料相关信息
*/
const updateIndirectInfos = (params) => {
return request({
url: '/goods/updateIndirectInfos',
method: 'post',
data: params
})
}
export { export {
getGoodsInfoByPage, getGoodsInfoByPage,
deleteGoodsInfo, deleteGoodsInfo,
getGoodsInfoByGoodsId, getGoodsInfoByGoodsId,
getGoodsInfo, getGoodsInfo,
updateGoodsInfo updateGoodsInfo,
updateIndirectInfos
} }

View File

@ -7,6 +7,7 @@
:suffix-icon="Search" /> :suffix-icon="Search" />
<el-button type="primary" @click="search()">搜索</el-button> <el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button> <el-button type="warning" @click="reset()">重置</el-button>
<el-button type="warning" style="width: 201px; background-color: red; color: #000;" @click="setIndirect()">一键设置间接物料相关信息</el-button>
</el-row> </el-row>
<el-row> <el-row>
<el-button style="background-color: #00CED1; color: #000;" <el-button style="background-color: #00CED1; color: #000;"
@ -192,7 +193,7 @@
<script setup> <script setup>
import store from '@/store' import store from '@/store'
import { getGoodsInfoByPage, deleteGoodsInfo, updateGoodsInfo } from '@/api/goods.js' import { getGoodsInfoByPage, deleteGoodsInfo, updateGoodsInfo, updateIndirectInfos } from '@/api/goods.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox, ElMessage } from 'element-plus'
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
@ -229,6 +230,20 @@ export default {
this.search() this.search()
}, },
methods: { methods: {
setIndirect() {
const request = {}
updateIndirectInfos(request).then(res => {
const response = res.data
if (response.code == 0) {
ElMessage.success(response.message)
} else {
errorBox(response.message)
}
}).catch(err => {
console.log(err)
errorBox('一键设置错误。')
})
},
search() { search() {
this.loading = true this.loading = true
const request = { const request = {

View File

@ -5,6 +5,8 @@
<el-row> <el-row>
<el-input v-model="locationIdQuery" style="width: 256px; margin-right: 10px;" placeholder="库位" <el-input v-model="locationIdQuery" style="width: 256px; margin-right: 10px;" placeholder="库位"
:suffix-icon="Search" /> :suffix-icon="Search" />
<el-select-v2 v-model="goodsTypeQuery" style="width: 158px; margin-right: 10px;" placeholder="物料类型"
:options="goodsTypeOptions" @change="search()"></el-select-v2>
<el-button type="primary" @click="search()">搜索</el-button> <el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button> <el-button type="warning" @click="reset()">重置</el-button>
</el-row> </el-row>
@ -33,6 +35,8 @@
<el-table-column prop="isLock" label="锁定" :formatter="isLockFormat" min-width="120px" /> <el-table-column prop="isLock" label="锁定" :formatter="isLockFormat" min-width="120px" />
<el-table-column prop="locationStatus" label="状态" :formatter="locationStatusFormat" min-width="120px" /> <el-table-column prop="locationStatus" label="状态" :formatter="locationStatusFormat" min-width="120px" />
<el-table-column prop="vehicleId" label="料箱" min-width="120px" show-overflow-tooltip /> <el-table-column prop="vehicleId" label="料箱" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsType" label="物料类型" fixed="left" :formatter="goodsTypeFormat"
min-width="120px" show-overflow-tooltip />
<el-table-column fixed="right" label="操作" width="120px"> <el-table-column fixed="right" label="操作" width="120px">
<template v-slot="scope"> <template v-slot="scope">
<el-button plain type="primary" @click="editCurrentRowLocation(scope.row)">编辑</el-button> <el-button plain type="primary" @click="editCurrentRowLocation(scope.row)">编辑</el-button>
@ -115,6 +119,12 @@
<el-input v-model="locationFormEntity.vehicleId" /> <el-input v-model="locationFormEntity.vehicleId" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="物料类型" prop="goodsType">
<el-select-v2 v-model="locationFormEntity.goodsType" placeholder="选择物料类型"
:options="goodsTypeOptions"></el-select-v2>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<template #footer> <template #footer>
@ -138,7 +148,7 @@ import { Search } from '@element-plus/icons-vue'
import { errorBox } from '@/utils/myMessageBox.js' import { errorBox } from '@/utils/myMessageBox.js'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { locationStatusFormatter, locationFormatter } from '@/utils/formatter.js' import { locationStatusFormatter, locationFormatter, jsonFormatter } from '@/utils/formatter.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
</script> </script>
<script> <script>
@ -151,6 +161,7 @@ export default {
pageSize: 10, pageSize: 10,
total: 0, total: 0,
locationIdQuery: '', locationIdQuery: '',
goodsTypeQuery: '',
loading: true, loading: true,
dialogVisible: false, dialogVisible: false,
locationId: '', locationId: '',
@ -183,7 +194,21 @@ export default {
value: 1, value: 1,
label: '占用' label: '占用'
}, },
] ],
goodsTypeOptions: [
{
value: "",
label: '全部'
},
{
value: "直接物料",
label: '直接物料'
},
{
value: "间接物料",
label: '间接物料'
}
],
} }
}, },
mounted() { mounted() {
@ -195,7 +220,8 @@ export default {
const tableRequest = { const tableRequest = {
pageNo: this.currentPage, pageNo: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
locationId: this.locationIdQuery.trim() locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
} }
getLocations(tableRequest).then(res => { getLocations(tableRequest).then(res => {
const tableResponse = res.data const tableResponse = res.data
@ -225,6 +251,13 @@ export default {
return '锁定' return '锁定'
} }
}, },
goodsTypeFormat: (row, column, cellValue, index) => {
if (cellValue == "间接物料") {
return '间接物料'
} else {
return '直接物料'
}
},
reset() { reset() {
this.locationIdQuery = '' this.locationIdQuery = ''
this.search() this.search()
@ -241,7 +274,8 @@ export default {
wDepth: row.wDepth, wDepth: row.wDepth,
isLock: row.isLock, isLock: row.isLock,
locationStatus: row.locationStatus, locationStatus: row.locationStatus,
vehicleId: row.vehicleId vehicleId: row.vehicleId,
goodsType: row.goodsType == "间接物料" ? "间接物料" : "直接物料",
} }
this.dialogVisible = true this.dialogVisible = true
}, },
@ -257,7 +291,8 @@ export default {
wDepth: formData.wDepth, wDepth: formData.wDepth,
isLock: formData.isLock, isLock: formData.isLock,
locationStatus: formData.locationStatus, locationStatus: formData.locationStatus,
vehicleId: formData.vehicleId vehicleId: formData.vehicleId,
goodsType: formData.goodsType == "间接物料" ? "间接物料" : "",
} }
updateLocation(request).then(res => { updateLocation(request).then(res => {
if (res.data.code == 0) { if (res.data.code == 0) {
@ -278,6 +313,7 @@ export default {
exportExcel() { exportExcel() {
const params = { const params = {
locationId: this.locationIdQuery.trim(), locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
userName: store.getters.getUserName userName: store.getters.getUserName
} }
downloadLocationsExcel(params).then(res => { downloadLocationsExcel(params).then(res => {

View File

@ -18,6 +18,8 @@
:suffix-icon="Search" /> :suffix-icon="Search" />
<el-input v-model="locationIdQuery" style="width: 196px; margin-right: 10px;" placeholder="库位" <el-input v-model="locationIdQuery" style="width: 196px; margin-right: 10px;" placeholder="库位"
:suffix-icon="Search" /> :suffix-icon="Search" />
<el-select-v2 v-model="goodsTypeQuery" style="width: 158px; margin-right: 10px;" placeholder="物料类型"
:options="goodsTypeOptions" @change="search()"></el-select-v2>
<el-date-picker v-model="createTimeQuery" type="date" placeholder="选择上架日期" :shortcuts="shortcuts" <el-date-picker v-model="createTimeQuery" type="date" placeholder="选择上架日期" :shortcuts="shortcuts"
style="width: 158px; margin-right: 10px;" clearable /> style="width: 158px; margin-right: 10px;" clearable />
<el-button type="primary" @click="search()">搜索</el-button> <el-button type="primary" @click="search()">搜索</el-button>
@ -42,6 +44,8 @@
show-overflow-tooltip /> show-overflow-tooltip />
<el-table-column prop="goodsId" label="物料号" fixed="left" min-width="120px" show-overflow-tooltip /> <el-table-column prop="goodsId" label="物料号" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsName" label="物料名称" min-width="120px" show-overflow-tooltip /> <el-table-column prop="goodsName" label="物料名称" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsType" label="物料类型" :formatter="goodsTypeFormat"
min-width="120px" show-overflow-tooltip />
<el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px" <el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px"
sortable="custom" show-overflow-tooltip /> sortable="custom" show-overflow-tooltip />
<el-table-column prop="totalNum" label="入库数量" min-width="120px" /> <el-table-column prop="totalNum" label="入库数量" min-width="120px" />
@ -165,6 +169,12 @@
<el-input v-model="stockFormEntity.lastUpdateUser" disabled /> <el-input v-model="stockFormEntity.lastUpdateUser" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="物料类型" prop="goodsType">
<el-select-v2 v-model="stockFormEntity.goodsType" placeholder="选择物料类型"
:options="goodsTypeOptions"></el-select-v2>
</el-form-item>
</el-col>
</el-row> </el-row>
</el-form> </el-form>
<template #footer> <template #footer>
@ -211,6 +221,7 @@ export default {
goodsIdQuery: '', goodsIdQuery: '',
vehicleIdQuery: '', vehicleIdQuery: '',
locationIdQuery: '', locationIdQuery: '',
goodsTypeQuery: '',
createTimeQuery: null, createTimeQuery: null,
shortcuts: [ shortcuts: [
{ {
@ -286,6 +297,20 @@ export default {
} }
], ],
goodsList: [], goodsList: [],
goodsTypeOptions: [
{
value: "",
label: '全部'
},
{
value: "直接物料",
label: '直接物料'
},
{
value: "间接物料",
label: '间接物料'
}
],
} }
}, },
mounted() { mounted() {
@ -348,6 +373,13 @@ export default {
return '长时间未使用' return '长时间未使用'
} }
}, },
goodsTypeFormat: (row, column, cellValue, index) => {
if (cellValue == "间接物料") {
return '间接物料'
} else {
return '直接物料'
}
},
stockStatusFormat: (row, column, cellValue, index) => { stockStatusFormat: (row, column, cellValue, index) => {
switch (cellValue) { switch (cellValue) {
case 0: case 0:
@ -394,6 +426,7 @@ export default {
goodsId: this.goodsIdQuery.trim(), goodsId: this.goodsIdQuery.trim(),
vehicleId: this.vehicleIdQuery.trim(), vehicleId: this.vehicleIdQuery.trim(),
locationId: this.locationIdQuery.trim(), locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
createTime: timeFormatter(this.createTimeQuery), createTime: timeFormatter(this.createTimeQuery),
userName: store.getters.getUserName userName: store.getters.getUserName
} }
@ -427,6 +460,7 @@ export default {
goodsId: this.goodsIdQuery.trim(), goodsId: this.goodsIdQuery.trim(),
vehicleId: this.vehicleIdQuery.trim(), vehicleId: this.vehicleIdQuery.trim(),
locationId: this.locationIdQuery.trim(), locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
createTime: timeFormatter(this.createTimeQuery), createTime: timeFormatter(this.createTimeQuery),
userName: store.getters.getUserName userName: store.getters.getUserName
} }
@ -472,7 +506,8 @@ export default {
goodsName: row.goodsName, goodsName: row.goodsName,
goodsStatus: row.goodsStatus, goodsStatus: row.goodsStatus,
remainNum: row.remainNum, remainNum: row.remainNum,
totalNum: row.totalNum totalNum: row.totalNum,
goodsType: row.goodsType == "间接物料" ? "间接物料" : "直接物料",
} }
this.dialogVisible = true this.dialogVisible = true
}, },
@ -485,7 +520,8 @@ export default {
goodsId: this.stockFormEntity.goodsId, goodsId: this.stockFormEntity.goodsId,
goodsStatus: this.stockFormEntity.goodsStatus, goodsStatus: this.stockFormEntity.goodsStatus,
remainNum: this.stockFormEntity.remainNum, remainNum: this.stockFormEntity.remainNum,
userName: store.getters.getUserName userName: store.getters.getUserName,
goodsType: this.stockFormEntity.goodsType,
} }
updateStockInfo(request).then(res => { updateStockInfo(request).then(res => {
if (res.data.code == 0) { if (res.data.code == 0) {

View File

@ -9,6 +9,8 @@
:suffix-icon="Search" /> :suffix-icon="Search" />
<el-select-v2 v-model="isEmptyQuery" style="width: 158px; margin-right: 10px;" placeholder="是否空箱" <el-select-v2 v-model="isEmptyQuery" style="width: 158px; margin-right: 10px;" placeholder="是否空箱"
:options="isEmptyOptions" @change="search()"></el-select-v2> :options="isEmptyOptions" @change="search()"></el-select-v2>
<el-select-v2 v-model="vehicleTypeQuery" style="width: 158px; margin-right: 10px;"
placeholder="物料类型" :options="vehicleTypeOptions" @change="search()"></el-select-v2>
<el-button type="primary" @click="search()">搜索</el-button> <el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button> <el-button type="warning" @click="reset()">重置</el-button>
</el-row> </el-row>
@ -30,7 +32,12 @@
min-width="120px" show-overflow-tooltip /> min-width="120px" show-overflow-tooltip />
<el-table-column prop="vehicleStatus" label="状态" :formatter="vehicleStatusFormat" min-width="120px" /> <el-table-column prop="vehicleStatus" label="状态" :formatter="vehicleStatusFormat" min-width="120px" />
<el-table-column prop="isEmpty" label="空托" :formatter="isEmptyFormat" min-width="120px" /> <el-table-column prop="isEmpty" label="空托" :formatter="isEmptyFormat" min-width="120px" />
<el-table-column prop="lastInTime" label="最近入库时间" sortable="custom" :formatter="timeFormat" min-width="120px" /> <el-table-column prop="lastInTime" label="最近入库时间" sortable="custom" :formatter="timeFormat"
min-width="120px" />
<el-table-column prop="vehicleType" label="物料类型" fixed="left" :formatter="vehicleTypeFormat"
min-width="120px" show-overflow-tooltip />
<el-table-column prop="details" label="绑定关系" :formatter="jsonFormat" min-width="180px"
show-overflow-tooltip />
<el-table-column fixed="right" label="操作" width="120px" v-if="selVehicle == null"> <el-table-column fixed="right" label="操作" width="120px" v-if="selVehicle == null">
<template v-slot="scope"> <template v-slot="scope">
<el-button plain type="primary" @click="editCurrentRowVehicle(scope.row)">编辑</el-button> <el-button plain type="primary" @click="editCurrentRowVehicle(scope.row)">编辑</el-button>
@ -71,6 +78,21 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="物料类型" prop="vehicleType">
<el-select-v2 v-model="vehicleFormEntity.vehicleType" placeholder="选择物料类型"
:options="vehicleTypeOptions"></el-select-v2>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="绑定关系" prop="details">
<el-input type="textarea" :rows="2" v-model="vehicleFormEntity.details" placeholder=""
:maxlength="-1" :show-word-limit="false" :autosize="{ minRows: 2, maxRows: 4 }">
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
@ -92,7 +114,7 @@ import { errorBox } from '@/utils/myMessageBox.js'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { Search } from '@element-plus/icons-vue' import { Search } from '@element-plus/icons-vue'
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { vehicleStatusFormatter, locationFormatter, dateFormatter, timeFormatter } from '@/utils/formatter.js' import { vehicleStatusFormatter, locationFormatter, dateFormatter, timeFormatter, jsonFormatter } from '@/utils/formatter.js'
import { toUnderScoreCase } from '@/utils/stringUtils.js' import { toUnderScoreCase } from '@/utils/stringUtils.js'
// import uploadVehicles from '@/excel/uploadVehicles.vue' // import uploadVehicles from '@/excel/uploadVehicles.vue'
import { downloadVehicleExcel } from '@/api/excel.js' import { downloadVehicleExcel } from '@/api/excel.js'
@ -114,6 +136,7 @@ export default {
queryKey: '', queryKey: '',
locationQuery: '', locationQuery: '',
isEmptyQuery: -99, isEmptyQuery: -99,
vehicleTypeQuery: '',
loading: true, loading: true,
dialogVisible: false, dialogVisible: false,
vehicleId: '', vehicleId: '',
@ -143,6 +166,20 @@ export default {
label: '空箱' label: '空箱'
} }
], ],
vehicleTypeOptions: [
{
value: "",
label: '全部'
},
{
value: "直接物料",
label: '直接物料'
},
{
value: "间接物料",
label: '间接物料'
}
],
// //
vehicleStatusOptions: [ vehicleStatusOptions: [
{ {
@ -177,6 +214,7 @@ export default {
isAsc: this.isAsc, isAsc: this.isAsc,
vehicleId: this.queryKey.trim(), vehicleId: this.queryKey.trim(),
currentLocation: this.locationQuery.trim(), currentLocation: this.locationQuery.trim(),
vehicleType: this.vehicleTypeQuery.trim(),
isEmpty: this.isEmptyQuery == -99 ? null : this.isEmptyQuery, isEmpty: this.isEmptyQuery == -99 ? null : this.isEmptyQuery,
userName: store.getters.getUserName userName: store.getters.getUserName
} }
@ -208,6 +246,13 @@ export default {
timeFormat: (row, column, cellValue, index) => { timeFormat: (row, column, cellValue, index) => {
return timeFormatter(cellValue) return timeFormatter(cellValue)
}, },
vehicleTypeFormat: (row, column, cellValue, index) => {
if (cellValue == "间接物料") {
return '间接物料'
} else {
return '直接物料'
}
},
isEmptyFormat: (row, column, cellValue, index) => { isEmptyFormat: (row, column, cellValue, index) => {
if (cellValue == 0) { if (cellValue == 0) {
return '带料' return '带料'
@ -216,6 +261,9 @@ export default {
return '空箱' return '空箱'
} }
}, },
jsonFormat: (row, column, cellValue, index) => {
return jsonFormatter(cellValue)
},
reset() { reset() {
this.queryKey = '' this.queryKey = ''
this.locationQuery = '' this.locationQuery = ''
@ -227,6 +275,8 @@ export default {
currentLocation: row.currentLocation, currentLocation: row.currentLocation,
isEmpty: row.isEmpty, isEmpty: row.isEmpty,
vehicleStatus: row.vehicleStatus, vehicleStatus: row.vehicleStatus,
vehicleType: row.vehicleType == "间接物料" ? "间接物料" : "直接物料",
details: jsonFormatter(row.details),
lastInTime: row.lastInTime lastInTime: row.lastInTime
} }
this.dialogVisible = true this.dialogVisible = true
@ -237,6 +287,8 @@ export default {
currentLocation: formData.currentLocation, currentLocation: formData.currentLocation,
isEmpty: formData.isEmpty, isEmpty: formData.isEmpty,
vehicleStatus: formData.vehicleStatus, vehicleStatus: formData.vehicleStatus,
vehicleType: formData.vehicleType,
details: formData.details,
lastInTime: formData.lastInTime, lastInTime: formData.lastInTime,
userName: store.getters.getUserName userName: store.getters.getUserName
} }
@ -263,6 +315,7 @@ export default {
pageSize: this.pageSize, pageSize: this.pageSize,
vehicleId: this.queryKey.trim(), vehicleId: this.queryKey.trim(),
currentLocation: this.locationQuery.trim(), currentLocation: this.locationQuery.trim(),
vehicleType: this.vehicleTypeQuery.trim(),
isEmpty: this.isEmptyQuery == -99 ? null : this.isEmptyQuery, isEmpty: this.isEmptyQuery == -99 ? null : this.isEmptyQuery,
userName: store.getters.getUserName userName: store.getters.getUserName
} }