代码更新

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

View File

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

View File

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

View File

@ -6,102 +6,69 @@
:suffix-icon="Search" />
<el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button>
<el-button type="success" @click="exportExcel()">导出表格</el-button>
</el-row>
<br />
<el-table id="stock-table" :data="displayStocks" stripe border v-loading="loading" class="table-class"
max-height="650px" highlight-current-row @row-click="getCurrentRow" :row-style="rowStyle"
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
<el-table :data="configList" stripe border v-loading="loading" class="table-class" max-height="550px"
highlight-current-row @row-click="getCurrentRow" :header-cell-style="{ 'text-align': 'center' }"
:cell-style="{ 'text-align': 'center' }">
<el-table-column width="65px" fixed="left">
<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>
</el-table-column>
<el-table-column prop="goodsRelated.goodsId" label="物料号" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.goodsName" label="物料名称" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.remainNum" label="剩余数量" min-width="120px" />
<el-table-column prop="goodsRelated.totalNum" label="入库数量" min-width="120px" />
<el-table-column prop="vehicleId" label="载具号" min-width="120px" show-overflow-tooltip />
<el-table-column prop="locationId" label="库位" :formatter="locationFormat" min-width="120px" show-overflow-tooltip />
<el-table-column prop="isInventory" label="是否盘点" min-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">
<el-table-column prop="configId" label="配置id" fixed="left" min-width="80px" show-overflow-tooltip />
<el-table-column prop="configName" label="配置名称" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="configKey" label="配置键" show-overflow-tooltip min-width="120px" />
<el-table-column prop="configValue" label="配置值" show-overflow-tooltip min-width="140px" />
<el-table-column prop="configType" label="配置类型" :formatter="configTypeFormat" min-width="100px"
show-overflow-tooltip />
<el-table-column fixed="right" label="操作" width="120px">
<template v-slot="scope">
<el-button plain type="primary" @click="editCurrentRowStock(scope.row)">编辑</el-button>
</template>
</el-table-column> -->
</el-table-column>
</el-table>
<br />
<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"
@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-form ref="stockFormRef" :model="stockFormEntity" :label-position="labelPosition" label-width="100px"
style="max-width: 100%" :rules="rules" status-icon>
<el-form ref="configFormRef" :model="configFormEntity" :label-position="labelPosition"
label-width="100px" style="max-width: 100%" :rules="rules" status-icon>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="型号" prop="goodsType">
<el-input v-model="stockFormEntity.goodsType" clearable />
<el-form-item label="配置名称" prop="configName">
<el-input v-model="configFormEntity.configName" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格" prop="specification">
<el-input v-model="stockFormEntity.specification" clearable />
<el-form-item label="配置类型" prop="configType">
<el-select-v2 v-model="configFormEntity.configType" placeholder="请选择配置类型"
:options="configTypeOptions"></el-select-v2>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="条码号" prop="barcode">
<el-input v-model="stockFormEntity.barcode" clearable />
<el-form-item label="配置键" prop="configKey">
<el-input v-model="configFormEntity.configKey" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="批次号" prop="batchNo">
<el-input v-model="stockFormEntity.batchNo" clearable />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="入库数量" prop="originNum">
<el-input-number v-model.number="stockFormEntity.originNum" clearable
controls-position="right" :min="0" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实际数量为0时删除库存" prop="realNum">
<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 label="配置值" prop="configValue">
<el-input v-if="configFormEntity.configType == '1'" type="textarea" :rows="1"
v-model="configFormEntity.configValue" placeholder="" :maxlength="-1"
:show-word-limit="false" :autosize="{ minRows: 1, maxRows: 4 }">
</el-input>
<el-select v-if="configFormEntity.configType == '2'"
v-model="configFormEntity.configValue" multiple collapse-tags collapse-tags-tooltip
:placeholder="'请选择' + configFormEntity.configName">
<el-option v-for="(value, index) in mails" :key="index" :label="value"
:value="value" />
</el-select>
<el-switch v-if="configFormEntity.configType == '3'" style="margin-left: 5px;"
v-model="configFormEntity.configValue" active-value="1"
inactive-value="0" />
</el-form-item>
</el-col>
</el-row>
@ -109,7 +76,7 @@
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitStockInfo(stockFormEntity)">
<el-button type="primary" @click="submitChange()">
确定
</el-button>
</span>
@ -120,15 +87,12 @@
</template>
<script setup>
import { getAllStocks, updateStockInfo } from '@/api/stock.js'
import { downloadStockExcel } from '@/api/excel.js'
import { dateFormatter, locationFormatter, timeFormatter } from '@/utils/formatter.js'
import { getConfigsByPage, updateConfig } from '@/api/config.js'
import { configTypeFormatter } from '@/utils/formatter.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { Search } from '@element-plus/icons-vue'
import { ref, reactive } from 'vue'
import { ElMessage } from 'element-plus'
// import FileSaver from 'file-saver';
// import * as XLSX from 'xlsx';
</script>
<script>
export default {
@ -136,218 +100,119 @@ export default {
data() {
return {
pageInfo: {},
displayStocks: [],
configList: [],
currentPage: 1,
pageSize: 10,
total: 0,
configNameQuery: '',
loading: true,
stockId: '',
stockFormRef: ref(),
stockFormEntity: reactive({}),
loading: false,
configId: '',
configFormRef: ref(),
configFormEntity: reactive({}),
rules: reactive({
goodsType: [
{ required: true, message: '请输入型号' }
configId: [
{ required: true, message: '请输入配置id' }
],
specification: [
{ required: true, message: '请输入规格' }
configName: [
{ required: true, message: '请输入配置名称' }
],
barcode: [
{ required: true, message: '请输入条码号' }
configKey: [
{ required: true, message: '请输入配置键' }
],
batchNo: [
{ required: true, message: '请输入批次号' }
configValue: [
{ required: true, message: '请输入配置值' }
],
locationId: [
{ 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: '请输入数字' }
configType: [
{ required: true, message: '请输入配置类型' }
]
}),
labelPosition: 'top',
dialogVisible: false,
goodsStatusOptions: [
configTypeOptions: [
{
value: 0,
label: '合格'
value: '1',
label: '输入框'
},
{
value: 1,
label: '不合格'
value: '2',
label: '下拉多选'
},
{
value: 2,
label: '延期'
},
{
value: 3,
label: '过期'
},
{
value: 5,
label: '长时间未使用'
}
],
stockStatusOptions: [
{
value: 0,
label: '库存正常'
},
{
value: 1,
label: '出库中'
},
{
value: 2,
label: '盘点中'
},
{
value: 3,
label: '移库中'
},
{
value: 9,
label: '库存锁定'
value: '3',
label: '开关'
}
],
mails: []
}
},
mounted() {
this.search()
},
methods: {
locationFormat: (row, column, cellValue, index) => {
return locationFormatter(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" }
}
configTypeFormat: (row, column, cellValue, index) => {
return configTypeFormatter(cellValue)
},
search() {
this.loading = true
const request = {
pageNo: this.currentPage,
pageSize: this.pageSize,
goodsId: this.goodsIdQuery.trim()
configName: this.configNameQuery.trim()
}
getAllStocks(request).then(res => {
getConfigsByPage(request).then(res => {
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)
}
this.displayStocks = tableResponse.returnData.lists
this.total = tableResponse.returnData.total
}).catch(err => {
console.log(err)
ElMessage.error('查询库存错误')
ElMessage.error('查询配置错误')
})
this.loading = false
},
reset() {
this.queryKey = ''
this.configNameQuery = ''
this.search()
},
getCurrentRow(row) {
this.stockId = row.stockId
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
})
})
this.configId = row.configId
},
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
},
submitStockInfo(stockFormEntity) {
updateStockInfo(stockFormEntity).then(res => {
submitChange() {
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) {
this.dialogVisible = false
ElMessage({
message: '更新库存成功',
message: '更新系统配置成功',
type: 'success'
})
this.search()
@ -356,7 +221,7 @@ export default {
}
}).catch(err => {
ElMessage({
message: '更新料箱信息失败: ' + err,
message: '更新系统配置失败: ' + err,
type: 'error',
showClose: true
})

View File

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