代码更新:

1. 增加工站配置的导入功能。
2. 修复userName字段设定不正确的问题。
This commit is contained in:
梁州 2024-08-12 16:38:52 +08:00
parent e9014815a9
commit 0841251bdd
13 changed files with 127 additions and 79 deletions

View File

@ -33,6 +33,15 @@ const uploadExcelGoods = (data) => {
})
}
const uploadStationConfig = (data) => {
return request({
url: '/excel/uploadStationConfig',
method: 'post',
data: data,
timeout: 100000
})
}
const uploadExcelDbs = (data) => {
return request({
url: '/excel/uploadDbs',
@ -155,5 +164,6 @@ export {
downloadInRecordExcel,
downloadOutRecordExcel,
downloadInventoryRecordExcel,
downloadLocationsExcel
downloadLocationsExcel,
uploadStationConfig
}

View File

@ -1,66 +1,13 @@
import request from "@/http/request";
const getAllGoods = () => {
const getGoodsInfoByPage = (params) => {
return request({
url: '/goods/getAllGoods',
method: 'get'
})
}
const getPartInfo = (params) => {
return request({
url: '/goods/getPartInfo',
method: 'post',
data: params
})
}
const updateGoodsInfo = (params) => {
return request({
url: '/goods/updateGoodsInfo',
method: 'post',
data: params
})
}
const queryPartInfoByPartNo = (params) => {
return request({
url: '/goods/queryPartInfoByPartNo',
method: 'post',
data: params
})
}
const updatePartInfo = (params) => {
return request({
url: '/goods/updatePartInfo',
method: 'post',
data: params
})
}
const queryPartNo = (params) => {
return request({
url: '/goods/queryPartNo',
method: 'post',
data: params
})
}
const deleteCurrentPartInfo = (params) => {
return request({
url: '/goods/deletePartInfo',
url: '/goods/getGoodsInfoByPage',
method: 'post',
data: params
})
}
export {
getAllGoods,
updateGoodsInfo,
queryPartInfoByPartNo,
getPartInfo,
updatePartInfo,
queryPartNo,
deleteCurrentPartInfo
getGoodsInfoByPage
}

View File

@ -0,0 +1,80 @@
<template>
<el-upload ref="uploadRef" :on-preview="previewFile" :limit="1" :on-change="changeFile" :auto-upload="false"
:data="uploadForm.data">
<template #trigger>
<el-button type="primary">选取工站配置文件</el-button>
</template>
<el-button style="margin-left: 10px;" type="success" @click="uploadDbs">上传工站配置数据</el-button>
</el-upload>
</template>
<script setup>
import store from '@/store'
import { ref, reactive } from 'vue';
import { uploadStationConfig } from '@/api/excel.js'
import { ElMessage } from 'element-plus'
import { sizeFormatter } from '@/utils/formatter.js'
const file = ref()
const uploadForm = reactive({
data: {
fileId: '',
name: '',
type: '',
size: null,
userName: store.getters.getUserName
}
})
const changeFile = (uploadFile) => {
file.value = uploadFile
uploadForm.data = {
fileId: file.value.raw.uid,
name: file.value.raw.name,
type: file.value.raw.type,
size: sizeFormatter(file.value.raw.size),
userName: store.getters.getUserName
}
}
const uploadRef = ref()
const uploadDbs = () => {
if (uploadForm == undefined || file.value == undefined) {
ElMessage.error('请选择文件之后再上传')
}
const jsonStr = JSON.stringify(uploadForm.data);
const blob = new Blob([jsonStr], {
type: 'application/json'
});
let formData = new FormData();
// file.value.rawfilefile.valueProxy
formData.append("obj", blob);
formData.append("file", file.value.raw);
uploadStationConfig(formData).then(res => {
if (res.data.code == 0) {
ElMessage({
message: '上传成功',
type: 'success',
})
clearFileInfos()
} else {
ElMessage.error(res.data.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('上传错误')
})
}
const clearFileInfos = () => {
//
uploadRef.value.clearFiles()
uploadForm.data = {
fileId: '',
name: '',
type: '',
size: null,
userName: store.getters.getUserName
}
file.value = undefined
}
const previewFile = () => {
}
</script>
<style scoped></style>

View File

@ -1,7 +1,7 @@
import axios from 'axios'
const request = axios.create({
baseURL: 'http://localhost:12315/wms',
baseURL: 'http://10.90.36.70:443/wmsServer/wms',
timeout: 5000
})

View File

@ -4,19 +4,22 @@
<el-row>
<UploadExcelGoods></UploadExcelGoods>
</el-row>
<el-row>
<UploadExcelStationConfig></UploadExcelStationConfig>
</el-row>
<el-row style="margin-top: 10px;">
<el-input v-model="queryKey" style="width: 256px; margin-right: 10px;" placeholder="零件号" />
<el-input v-model="goodsIdQuery" style="width: 256px; margin-right: 10px;" placeholder="号" />
<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 :data="partInfos" stripe border v-loading="loading" class="table-class" max-height="650px"
<el-table :data="goodsList" stripe border v-loading="loading" class="table-class" max-height="650px"
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.material" v-model="material">&nbsp;</el-radio>
<el-radio :label="scope.row.goodsId" v-model="goodsId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="material" label="零件号" fixed="left" sortable min-width="120px" />
@ -176,12 +179,14 @@
</template>
<script setup>
import { getPartInfo, updatePartInfo, deleteCurrentPartInfo } from '@/api/goods.js'
import store from '@/store'
import { getGoodsInfoByPage } from '@/api/goods.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { ElMessage } from 'element-plus'
import { ref, reactive } from 'vue'
import { dateFormatter } from '@/utils/formatter.js'
import UploadExcelGoods from '@/excel/UploadExcelGoods.vue'
import UploadExcelStationConfig from '@/excel/UploadExcelStationConfig.vue'
import { downloadMaterialExcel } from '@/api/excel.js'
</script>
<script>
@ -189,12 +194,12 @@ export default {
name: 'goods',
data() {
return {
partInfos: [],
pageInfo: {},
goodsList: [],
goodsInfo: {},
currentPage: 1,
pageSize: 10,
total: 0,
queryKey: '',
goodsIdQuery: '',
loading: true,
dialogVisible: false,
material: '',
@ -210,22 +215,20 @@ export default {
methods: {
search() {
this.loading = true
this.pageInfo.pageNum = this.currentPage
this.pageInfo.pageSize = this.pageSize
const tableRequest = {
page: this.pageInfo,
param: {
material: this.queryKey.trim()
},
const request = {
pageNo: this.currentPage,
pageSize: this.pageSize,
goodsId: this.goodsIdQuery.trim(),
userName: store.getters.getUserName
}
getPartInfo(tableRequest).then(res => {
getGoodsInfoByPage(request).then(res => {
const tableResponse = res.data
if (tableResponse.code != 0) {
console.log(tableResponse.code + ':' + tableResponse.message)
if (tableResponse.code == 0) {
this.goodsList = tableResponse.returnData.lists
this.total = tableResponse.returnData.total
} else {
ElMessage.error(tableResponse.message)
}
this.partInfos = tableResponse.rows
this.total = tableResponse.total
}).catch(err => {
ElMessage.error('查询物料错误' + err.message)
})
@ -235,7 +238,7 @@ export default {
return dateFormatter(cellValue)
},
reset() {
this.queryKey = ''
this.goodsIdQuery = ''
this.search
},
// getCurrentPageGoods() {

View File

@ -39,6 +39,7 @@
</template>
<script setup>
import store from '@/store'
import { getTaskRecords } from '@/api/record.js'
import { dateFormatter, taskStatusFormatter, timeFormatter } from '@/utils/formatter.js'
import { downloadInRecordExcel } from '@/api/excel.js'

View File

@ -62,6 +62,7 @@
</template>
<script setup>
import store from '@/store'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { getLocations, updateLocation } from '@/api/location.js'
import { ElMessage, ElLoading } from 'element-plus'

View File

@ -128,6 +128,7 @@
</template>
<script setup>
import store from '@/store'
import { getLocations, updateLocation } from '@/api/location.js'
import { Search } from '@element-plus/icons-vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

View File

@ -75,6 +75,7 @@
</template>
<script setup>
import store from '@/store'
import { getAllVehicles, updateVehicleInfo, deleteCurrentVehicle } from '@/api/vehicle'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { ElMessage } from 'element-plus'

View File

@ -120,6 +120,7 @@
</template>
<script setup>
import store from '@/store'
import { getAllStocks, updateStockInfo } from '@/api/stock.js'
import { downloadStockExcel } from '@/api/excel.js'
import { dateFormatter, locationFormatter, timeFormatter } from '@/utils/formatter.js'

View File

@ -87,6 +87,7 @@ import { ref, reactive } from 'vue'
import { vehicleStatusFormatter, locationFormatter, dateFormatter, timeFormatter } from '@/utils/formatter.js'
// import uploadVehicles from '@/excel/uploadVehicles.vue'
import { downloadVehicleExcel } from '@/api/excel.js'
import store from '@/store'
</script>
<script>
export default {

View File

@ -92,6 +92,7 @@ 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 store from '@/store'
</script>
<script>
export default {

View File

@ -1,7 +1,7 @@
<template>
<div style="margin-bottom: 10px">
<el-config-provider :locale="zhCn">
<el-row style="margin-top: 10px;">
<el-row>
<el-input v-model="queryKey" style="width: 256px; margin-right: 10px;" placeholder="请输入搜索信息" />
<el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button>
@ -103,6 +103,7 @@
</template>
<script setup>
import store from '@/store'
import { queryLogs } from '@/api/wmsLog.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { ElMessage } from 'element-plus'