代码更新

This commit is contained in:
梁州 2024-08-02 23:10:15 +08:00
parent 207e4a8e6f
commit 0c5f55649b
5 changed files with 162 additions and 272 deletions

View File

@ -8,12 +8,16 @@ const updateConfig = (params) => {
return request.post('/config/updateConfig', params) return request.post('/config/updateConfig', params)
} }
const getConfigsByPage = (params) => {
return request.post('/config/getConfigsByPage', params)
}
const restartSystem = (params) => { const restartSystem = (params) => {
return request({ return request({
url: '/system/restartSystem', url: '/system/restartSystem',
method: 'post', method: 'post',
data: params, data: params,
timeout: 5000 timeout: 10000
}) })
} }
@ -22,12 +26,13 @@ const reloadConfig = (params) => {
url: '/system/reloadConfig', url: '/system/reloadConfig',
method: 'post', method: 'post',
data: params, data: params,
timeout: 5000 timeout: 10000
}) })
} }
export { export {
getConfigs, getConfigs,
getConfigsByPage,
updateConfig, updateConfig,
restartSystem, restartSystem,
reloadConfig reloadConfig

View File

@ -104,6 +104,14 @@ const callEmptyVehicle = (params) => {
}) })
} }
const queryFinishByStandAndGoods = (params) => {
return request({
url: '/task/queryFinishByStandAndGoods',
method: 'post',
data: params
})
}
export { export {
sendGoodsInTask, sendGoodsInTask,
sendGoodsOutTask, sendGoodsOutTask,
@ -117,5 +125,6 @@ export {
confirmFinishedWork, confirmFinishedWork,
confirmFinishWork, confirmFinishWork,
getFinishedWorkInfo, getFinishedWorkInfo,
callEmptyVehicle callEmptyVehicle,
queryFinishByStandAndGoods
} }

View File

@ -24,7 +24,7 @@
label-width="150px" style="max-width: 100%" :rules="rules" status-icon> label-width="150px" style="max-width: 100%" :rules="rules" status-icon>
<div style="display: flex;"> <div style="display: flex;">
<div style="display: block; margin: 5px;"> <div style="display: block; margin: 5px;">
<div style="display: none;">{{ workFormEntity.tip }}</div> <div>{{ workFormEntity.tip }}</div>
<div style="display: flex;"> <div style="display: flex;">
<div style="display: flex; flex-direction: column;"> <div style="display: flex; flex-direction: column;">
<div class="display-title-div"> <div class="display-title-div">
@ -136,7 +136,7 @@
<script setup> <script setup>
import store from '@/store' import store from '@/store'
import { getWorkByStandAndGoods, confirmFinishWork } from '@/api/task' import { getWorkByStandAndGoods, confirmFinishWork, queryFinishByStandAndGoods } from '@/api/task'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
@ -148,7 +148,7 @@ export default {
data() { data() {
return { return {
standId: store.getters.getStandId, standId: store.getters.getStandId,
// timer: '', timer: '',
labelPosition: 'top', labelPosition: 'top',
workFormRef: ref(), workFormRef: ref(),
workFormEntity: reactive({ workFormEntity: reactive({
@ -172,27 +172,16 @@ export default {
}, },
mounted() { mounted() {
this.$refs.goodsId.focus() this.$refs.goodsId.focus()
// this.timer = setInterval(() => { this.timer = setInterval(() => {
// // this.getAllTasks() this.queryFinish()
// }, 2000) }, 2000)
}, },
beforeUnmount() { beforeUnmount() {
// clearInterval(this.timer) clearInterval(this.timer)
}, },
methods: { methods: {
//
getCurrentWorkInfo() { getCurrentWorkInfo() {
// this.workFormEntity = {
// goodsId: '5678932/CS',
// planPickNum: 10,
// remainNumOrigin: 5,
// remainNumReal: 5,
// remark: '',
// finishedRows: 800,
// totalRows: 2500,
// finishedCounts: 2500,
// totalCounts: 6000,
// tip: ''
// }
const request = { const request = {
standId: this.standId, standId: this.standId,
goodsId: this.workFormEntity.goodsId goodsId: this.workFormEntity.goodsId
@ -220,6 +209,29 @@ export default {
ElMessage.error('查询工作信息错误') ElMessage.error('查询工作信息错误')
}) })
}, },
//
queryFinish() {
if (this.workFormEntity.goodsId == '') {
return
}
const request = {
standId: this.standId,
goodsId: this.workFormEntity.goodsId
}
queryFinishByStandAndGoods(request).then(res => {
const response = res.data
if (response.code == 0) {
if (response.returnData != null) {
this.workFormEntity.tip = response.returnData.tip
}
this.resetForms()
ElMessage.success(response.message)
}
}).catch(err => {
console.log(err)
})
},
//
resetForms() { resetForms() {
this.workFormEntity = reactive({ this.workFormEntity = reactive({
goodsId: '', goodsId: '',
@ -233,7 +245,9 @@ export default {
totalCounts: 0, totalCounts: 0,
tip: '' tip: ''
}) })
this.$refs.goodsId.focus()
}, },
//
confirmTask() { confirmTask() {
if (this.standId == '' || this.workFormEntity.goodsId == '') { if (this.standId == '' || this.workFormEntity.goodsId == '') {
ElMessage({ ElMessage({
@ -251,12 +265,11 @@ export default {
confirmFinishWork(confirmParams).then(res => { confirmFinishWork(confirmParams).then(res => {
const response = res.data const response = res.data
if (response.code == 0) { if (response.code == 0) {
ElMessage({ if (response.returnData != null) {
message: response.message, this.workFormEntity.tip = response.returnData.tip
type: 'success', }
})
this.resetForms() this.resetForms()
this.$refs.goodsId.focus() ElMessage.success(response.message)
} else { } else {
ElMessage.error(response.message) ElMessage.error(response.message)
} }

View File

@ -6,102 +6,69 @@
: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="success" @click="exportExcel()">导出表格</el-button>
</el-row> </el-row>
<br /> <br />
<el-table id="stock-table" :data="displayStocks" stripe border v-loading="loading" class="table-class" <el-table :data="configList" stripe border v-loading="loading" class="table-class" max-height="550px"
max-height="650px" highlight-current-row @row-click="getCurrentRow" :row-style="rowStyle" highlight-current-row @row-click="getCurrentRow" :header-cell-style="{ 'text-align': 'center' }"
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }"> :cell-style="{ 'text-align': 'center' }">
<el-table-column width="65px" fixed="left"> <el-table-column width="65px" fixed="left">
<template v-slot="scope"> <template v-slot="scope">
<el-radio :label="scope.row.stockId" v-model="stockId">&nbsp;</el-radio> <el-radio :label="scope.row.configId" v-model="configId">&nbsp;</el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="goodsRelated.goodsId" label="物料号" fixed="left" min-width="120px" show-overflow-tooltip /> <el-table-column prop="configId" label="配置id" fixed="left" min-width="80px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.goodsName" label="物料名称" fixed="left" min-width="120px" show-overflow-tooltip /> <el-table-column prop="configName" label="配置名称" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.remainNum" label="剩余数量" min-width="120px" /> <el-table-column prop="configKey" label="配置键" show-overflow-tooltip min-width="120px" />
<el-table-column prop="goodsRelated.totalNum" label="入库数量" min-width="120px" /> <el-table-column prop="configValue" label="配置值" show-overflow-tooltip min-width="140px" />
<el-table-column prop="vehicleId" label="载具号" min-width="120px" show-overflow-tooltip /> <el-table-column prop="configType" label="配置类型" :formatter="configTypeFormat" min-width="100px"
<el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px" show-overflow-tooltip /> show-overflow-tooltip />
<el-table-column prop="isInventory" label="是否盘点" min-width="120px" /> <el-table-column fixed="right" label="操作" width="120px">
<el-table-column prop="createTime" label="上架时间" :formatter="timeFormat" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.goodsStatus" label="物料状态" :formatter="goodsStatusFormat" min-width="120px" />
<el-table-column prop="stockStatus" label="库存状态" :formatter="stockStatusFormat" fixed="right"
min-width="120px" />
<!-- <el-table-column fixed="right" label="操作" width="120px" v-if="selStock == null">
<template v-slot="scope"> <template v-slot="scope">
<el-button plain type="primary" @click="editCurrentRowStock(scope.row)">编辑</el-button> <el-button plain type="primary" @click="editCurrentRowStock(scope.row)">编辑</el-button>
</template> </template>
</el-table-column> --> </el-table-column>
</el-table> </el-table>
<br /> <br />
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]" <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 25, 50]"
:small="false" :disabled="false" :background="false" :default-page-size="10" @size-change="search" :small="false" :disabled="false" :background="false" :default-page-size="10" @size-change="search"
@current-change="search" layout="total, sizes, prev, pager, next, jumper" :total="total" /> @current-change="search" layout="total, sizes, prev, pager, next, jumper" :total="total" />
<el-dialog v-model="dialogVisible" title="库存信息" width="40%" draggable :show-close="false"> <el-dialog v-model="dialogVisible" title="库存信息" width="40%" draggable :show-close="false">
<el-form ref="stockFormRef" :model="stockFormEntity" :label-position="labelPosition" label-width="100px" <el-form ref="configFormRef" :model="configFormEntity" :label-position="labelPosition"
style="max-width: 100%" :rules="rules" status-icon> label-width="100px" style="max-width: 100%" :rules="rules" status-icon>
<el-row :gutter="16"> <el-row :gutter="16">
<el-col :span="12" :offset="0"> <el-col :span="12" :offset="0">
<el-form-item label="型号" prop="goodsType"> <el-form-item label="配置名称" prop="configName">
<el-input v-model="stockFormEntity.goodsType" clearable /> <el-input v-model="configFormEntity.configName" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="规格" prop="specification"> <el-form-item label="配置类型" prop="configType">
<el-input v-model="stockFormEntity.specification" clearable /> <el-select-v2 v-model="configFormEntity.configType" placeholder="请选择配置类型"
:options="configTypeOptions"></el-select-v2>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="16"> <el-row :gutter="16">
<el-col :span="12" :offset="0"> <el-col :span="12" :offset="0">
<el-form-item label="条码号" prop="barcode"> <el-form-item label="配置键" prop="configKey">
<el-input v-model="stockFormEntity.barcode" clearable /> <el-input v-model="configFormEntity.configKey" disabled />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="批次号" prop="batchNo"> <el-form-item label="配置值" prop="configValue">
<el-input v-model="stockFormEntity.batchNo" clearable /> <el-input v-if="configFormEntity.configType == '1'" type="textarea" :rows="1"
</el-form-item> v-model="configFormEntity.configValue" placeholder="" :maxlength="-1"
</el-col> :show-word-limit="false" :autosize="{ minRows: 1, maxRows: 4 }">
</el-row> </el-input>
<el-row :gutter="16"> <el-select v-if="configFormEntity.configType == '2'"
<el-col :span="12" :offset="0"> v-model="configFormEntity.configValue" multiple collapse-tags collapse-tags-tooltip
<el-form-item label="入库数量" prop="originNum"> :placeholder="'请选择' + configFormEntity.configName">
<el-input-number v-model.number="stockFormEntity.originNum" clearable <el-option v-for="(value, index) in mails" :key="index" :label="value"
controls-position="right" :min="0" /> :value="value" />
</el-form-item> </el-select>
</el-col> <el-switch v-if="configFormEntity.configType == '3'" style="margin-left: 5px;"
<el-col :span="12"> v-model="configFormEntity.configValue" active-value="1"
<el-form-item label="实际数量为0时删除库存" prop="realNum"> inactive-value="0" />
<el-input-number v-model.number="stockFormEntity.realNum" controls-position="right"
:min="0" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="库位" prop="locationId">
<el-input v-model="stockFormEntity.locationId" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="订单号" prop="orderId">
<el-input v-model="stockFormEntity.orderId" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="库存状态" prop="stockStatus">
<el-select-v2 v-model="stockFormEntity.stockStatus" placeholder="请选择库存状态"
:options="stockStatusOptions"></el-select-v2>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料状态" prop="goodsStatus">
<el-select-v2 v-model="stockFormEntity.goodsStatus" placeholder="请选择物料状态"
:options="goodsStatusOptions"></el-select-v2>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -109,7 +76,7 @@
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button> <el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitStockInfo(stockFormEntity)"> <el-button type="primary" @click="submitChange()">
确定 确定
</el-button> </el-button>
</span> </span>
@ -120,15 +87,12 @@
</template> </template>
<script setup> <script setup>
import { getAllStocks, updateStockInfo } from '@/api/stock.js' import { getConfigsByPage, updateConfig } from '@/api/config.js'
import { downloadStockExcel } from '@/api/excel.js' import { configTypeFormatter } from '@/utils/formatter.js'
import { dateFormatter, locationFormatter, timeFormatter } from '@/utils/formatter.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
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 { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
// import FileSaver from 'file-saver';
// import * as XLSX from 'xlsx';
</script> </script>
<script> <script>
export default { export default {
@ -136,218 +100,119 @@ export default {
data() { data() {
return { return {
pageInfo: {}, pageInfo: {},
displayStocks: [], configList: [],
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
configNameQuery: '', configNameQuery: '',
loading: true, loading: false,
stockId: '', configId: '',
stockFormRef: ref(), configFormRef: ref(),
stockFormEntity: reactive({}), configFormEntity: reactive({}),
rules: reactive({ rules: reactive({
goodsType: [ configId: [
{ required: true, message: '请输入型号' } { required: true, message: '请输入配置id' }
], ],
specification: [ configName: [
{ required: true, message: '请输入规格' } { required: true, message: '请输入配置名称' }
], ],
barcode: [ configKey: [
{ required: true, message: '请输入条码号' } { required: true, message: '请输入配置键' }
], ],
batchNo: [ configValue: [
{ required: true, message: '请输入批次号' } { required: true, message: '请输入配置值' }
], ],
locationId: [ configType: [
{ required: true, message: '请输入库位' } { required: true, message: '请输入配置类型' }
],
orderId: [
{ required: true, message: '请输入订单号' }
],
stockStatus: [
{ required: true, message: '请输入库存状态' }
],
goodsStatus: [
{ required: true, message: '请输入物料状态' }
],
originNum: [
{ required: true, message: '请输入入库数量' },
{ type: 'number', message: '请输入数字' }
],
realNum: [
{ required: true, message: '请输入实际数量' },
{ type: 'number', message: '请输入数字' }
] ]
}), }),
labelPosition: 'top', labelPosition: 'top',
dialogVisible: false, dialogVisible: false,
goodsStatusOptions: [ configTypeOptions: [
{ {
value: 0, value: '1',
label: '合格' label: '输入框'
}, },
{ {
value: 1, value: '2',
label: '不合格' label: '下拉多选'
}, },
{ {
value: 2, value: '3',
label: '延期' label: '开关'
},
{
value: 3,
label: '过期'
},
{
value: 5,
label: '长时间未使用'
}
],
stockStatusOptions: [
{
value: 0,
label: '库存正常'
},
{
value: 1,
label: '出库中'
},
{
value: 2,
label: '盘点中'
},
{
value: 3,
label: '移库中'
},
{
value: 9,
label: '库存锁定'
} }
], ],
mails: []
} }
}, },
mounted() { mounted() {
this.search() this.search()
}, },
methods: { methods: {
locationFormat: (row, column, cellValue, index) => { configTypeFormat: (row, column, cellValue, index) => {
return locationFormatter(cellValue) return configTypeFormatter(cellValue)
},
dateFormat: (row, column, cellValue, index) => {
return dateFormatter(cellValue)
},
timeFormat: (row, column, cellValue, index) => {
return timeFormatter(cellValue)
},
goodsStatusFormat: (row, column, cellValue, index) => {
if (cellValue === 0) {
return '合格'
} else if (cellValue === 1) {
return '不合格'
} else if (cellValue === 2) {
return '延期'
} else if (cellValue === 3) {
return '过期'
} else if (cellValue === 5) {
return '长时间未使用'
}
},
stockStatusFormat: (row, column, cellValue, index) => {
switch (cellValue) {
case 0:
return '库存正常'
case 1:
return '出库中'
case 2:
return '盘点中'
case 3:
return '移库中'
case 9:
return '库存锁定'
default:
return '异常'
}
},
rowStyle: ({ row, rowIndex }) => {
if (row.goodsStatus == 3) {
return { "color": "red" }
}
if (row.goodsStatus == 5) {
return { "color": "yellow" }
}
}, },
search() { search() {
this.loading = true this.loading = true
const request = { const request = {
pageNo: this.currentPage, pageNo: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
goodsId: this.goodsIdQuery.trim() configName: this.configNameQuery.trim()
} }
getAllStocks(request).then(res => { getConfigsByPage(request).then(res => {
const tableResponse = res.data const tableResponse = res.data
if (tableResponse.code != 0) { if (tableResponse.code == 0) {
this.configList = tableResponse.returnData.lists
this.configList.forEach((config) => {
if (config.configType == '2') {
const tempArray = config.configValue.split(';')
config.configValue = tempArray
}
if (config.configKey == 'MAIL_ADDRESS') {
const tempArray = config.configValue.split(';')
this.mails = tempArray
}
})
this.total = tableResponse.returnData.total
} else {
ElMessage.error(tableResponse.message) ElMessage.error(tableResponse.message)
} }
this.displayStocks = tableResponse.returnData.lists
this.total = tableResponse.returnData.total
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
ElMessage.error('查询库存错误') ElMessage.error('查询配置错误')
}) })
this.loading = false this.loading = false
}, },
reset() { reset() {
this.queryKey = '' this.configNameQuery = ''
this.search() this.search()
}, },
getCurrentRow(row) { getCurrentRow(row) {
this.stockId = row.stockId this.configId = row.configId
this.$emit('update:selStock', row)
},
exportExcel() {
downloadStockExcel().then(res => {
const link = document.createElement('a');//a
try {
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //blobblobtypexls
let blob = res.data //blob
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //
let _fileName = "库存报表" + dateFormatter(new Date) + ".xlsx"
link.style.display = 'none'//
// URL
const url = window.URL || window.webkitURL || window.moxURL
link.href = url.createObjectURL(blob)
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
url.revokeObjectURL(link.href)//url
} catch (e) {
ElMessage({
message: '下载文件失败:: ' + e,
type: 'error',
showClose: true
})
}
}).catch(err => {
ElMessage({
message: '导出失败:: ' + err,
type: 'error',
showClose: true
})
})
}, },
editCurrentRowStock(row) { editCurrentRowStock(row) {
this.stockFormEntity = row this.configFormEntity = reactive({
configId: row.configId,
configName: row.configName,
configKey: row.configKey,
configValue: row.configValue,
configType: row.configType
})
this.dialogVisible = true this.dialogVisible = true
}, },
submitStockInfo(stockFormEntity) { submitChange() {
updateStockInfo(stockFormEntity).then(res => { const request = {
configId: this.configFormEntity.configId,
configName: this.configFormEntity.configName,
configKey: this.configFormEntity.configKey,
configValue: this.configFormEntity.configValue,
configType: this.configFormEntity.configType
}
updateConfig(request).then(res => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.dialogVisible = false this.dialogVisible = false
ElMessage({ ElMessage({
message: '更新库存成功', message: '更新系统配置成功',
type: 'success' type: 'success'
}) })
this.search() this.search()
@ -356,7 +221,7 @@ export default {
} }
}).catch(err => { }).catch(err => {
ElMessage({ ElMessage({
message: '更新料箱信息失败: ' + err, message: '更新系统配置失败: ' + err,
type: 'error', type: 'error',
showClose: true showClose: true
}) })

View File

@ -104,16 +104,14 @@ function vehicleStatusFormatter(value) {
} }
} }
function kateTaskTypeFormatter(value) { function configTypeFormatter(value) {
switch (value) { switch (value) {
case 1: case '1':
return '配件' return '输入框'
case 2: case '2':
return '合件' return '下拉多选'
case 3: case '3':
return '紧急' return '开关'
case 4:
return '原包装'
default: default:
return '任务类型异常' return '任务类型异常'
} }
@ -128,6 +126,6 @@ export {
kateTaskStatusFormatter, kateTaskStatusFormatter,
pickingStatusFormatter, pickingStatusFormatter,
vehicleStatusFormatter, vehicleStatusFormatter,
kateTaskTypeFormatter, configTypeFormatter,
dueFormatter dueFormatter
} }