代码更新:

1.增加excel导入导出
This commit is contained in:
梁州 2024-08-06 16:24:43 +08:00
parent b69085124a
commit 33c49bfc15
9 changed files with 503 additions and 366 deletions

View File

@ -27,16 +27,9 @@ const uploadExcelParts = (data) => {
const downloadStockExcel = (params) => {
return request({
url: '/excel/downloadStockExcel',
method: 'get',
method: 'post',
responseType: 'blob',
params: {
stockStatus: params.stockStatus,
goodsStatus: params.goodsStatus,
locationId: params.locationId,
vehicleId: params.vehicleId,
goodsId: params.goodsId,
goodsName: params.goodsName
}
data: params
})
}

View File

@ -0,0 +1,72 @@
<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="uploadParts">确认导入库存数据</el-button>
</el-upload>
</template>
<script setup>
import store from '@/store'
import { ref, reactive } from 'vue';
import { uploadExcelParts } 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
}
})
const changeFile = (uploadFile) => {
console.log('max: ' + sizeFormatter(1048576))
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
}
console.log(uploadForm.data)
}
const uploadRef = ref()
const uploadParts = () => {
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);
console.log(formData)
uploadExcelParts(formData).then(res => {
if (res.data.code == 0) {
ElMessage({
message: '导入成功',
type: 'success',
})
//
uploadRef.value.clearFiles()
file.value = undefined
} else {
ElMessage.error(res.data.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('导入错误')
})
}
const previewFile = () => {
}
</script>
<style scoped></style>

View File

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

View File

@ -24,7 +24,12 @@
label-width="150px" style="max-width: 100%" :rules="rules" status-icon>
<div style="display: flex;">
<div style="display: block; margin: 5px;">
<div>{{ workFormEntity.tip }}</div>
<!-- <div
style="display: inline-flex; justify-content: center; height: 60px; width: 700px; margin: 5px; padding: 5px; background-color: #00AAE8;">
<span style="align-self: center; font-weight: bold;font-size: 25px;">
{{ workFormEntity.tip }}
</span>
</div> -->
<div style="display: flex;">
<div style="display: flex; flex-direction: column;">
<div class="display-title-div">

View File

@ -1,120 +1,82 @@
<template>
<el-config-provider :locale="zhCn">
<el-container class="content">
<div class="left">
<fieldset class="display-area">
<div class="work-area">
<fieldset class="title-area">
<legend>
当前WMS盘点任务
工作台
</legend>
<!-- 此表格现在显示当前当前站台正在执行的出库任务 -->
<el-table :data="tasks" stripe border class="table-class" max-height="250px"
:header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }">
<el-table-column prop="vehicleNo" label="托盘号" fixed="left" min-width="120px" />
<el-table-column prop="goodsId" label="物料编码" fixed="left" min-width="120px" />
<el-table-column prop="goodsName" label="物料描述" min-width="120px" />
<el-table-column prop="operateNum" label="操作数量" min-width="120px" />
<el-table-column prop="totalNum" label="库存数量" min-width="120px" />
<el-table-column prop="expirationDate" label="有效日期" min-width="120px" />
<el-table-column prop="batchNo" label="批次号" min-width="120px" />
<el-table-column prop="wipEntityId" label="工单号" min-width="120px" />
<el-table-column prop="taskStatus" label="任务状态" fixed="right" :formatter="taskStatusFormat" min-width="120px" />
<el-table-column prop="createTime" label="运行时长" :formatter="dueFormat" min-width="120px" />
</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="getAllTasks" @current-change="getAllTasks"
layout="total, sizes, prev, pager, next, jumper" :total="total" />
</fieldset>
<div class="title-div">
<span class="title-text">物料盘点</span>
</div>
<div class="station-div">
<span class="station-text">工作站</span>
</div>
<div class="station-no-div">
<span class="station-no-text">{{ standId }}</span>
</div>
<div class="right">
<fieldset class="input-area">
<legend>盘点下发信息</legend>
<el-form ref="inventoryTaskOutRequestRef" :model="inventoryOutEntity" :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="goodsId">
<el-select v-model="inventoryOutEntity.goodsId" :multiple="false" filterable remote
reserve-keyword placeholder="请输入物料编码" :remote-method="queryGoodsId"
:loading="loading">
<el-option v-for="item in goodsOptions" :key="item.goodsId" :label="item.goodsId"
:value="item.goodsId" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="库存数量" prop="totalNum">
<el-input-number v-model.number="inventoryOutEntity.totalNum" readonly
controls-position="right" :min="1" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="托盘号" prop="vehicleId">
<el-input v-model="inventoryOutEntity.vehicleId" clearable placeholder="请输入托盘号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出库站台" prop="destination">
<el-select-v2 v-model="inventoryOutEntity.destination" placeholder="请选择盘点站台"
:options="standOptions"></el-select-v2>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="*盘点前请确认无其他任务正在执行" class="red-character">
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16" class="btn-area">
<el-col :span="8" :offset="8">
<el-form-item>
<el-button type="success" round @click="submitInventoryOutTask()">下发盘点</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</fieldset>
<fieldset class="input-area" style="margin-top: 15px;">
<legend>盘点确认信息</legend>
<el-form ref="inventoryTaskConfirmRequestRef" :model="inventoryConfirmEntity"
: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="托盘号">
<el-input v-model="inventoryConfirmEntity.vehicleNo" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料编码">
<el-input v-model="inventoryConfirmEntity.goodsId" readonly />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="12" :offset="0">
<el-form-item label="盘点前数量">
<el-input v-model="inventoryConfirmEntity.originNum" readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="确认数量" prop="realNum">
<el-input-number v-model.number="inventoryConfirmEntity.realNum" clearable
<fieldset class="main-area">
<legend>
物料盘点
</legend>
<el-form ref="workFormRef" :model="workFormEntity" :label-position="labelPosition"
label-width="150px" style="max-width: 100%" :rules="rules" status-icon>
<div style="display: flex;">
<div style="display: block; margin: 5px;">
<!-- <div
style="display: inline-flex; justify-content: center; height: 60px; width: 655px; margin: 5px; padding: 5px;">
<UploadExcelPart></UploadExcelPart>
</div> -->
<div style="height: 50px; margin-bottom: 20px"><UploadInventoryList></UploadInventoryList></div>
<div
style="display: inline-flex; justify-content: center; height: 40px; width: 655px; margin: 5px; padding: 5px; background-color: #00AAE8;">
<span style="align-self: center; font-weight: bold;font-size: 25px;">
{{ workFormEntity.tip }}
</span>
</div>
<div style="display: flex;">
<div style="display: flex; flex-direction: column;">
<div class="display-title-div">
<span class="display-title-text">料号</span>
</div>
<div class="display-form-div">
<el-input v-model="workFormEntity.goodsId" size="default" ref="goodsId"
v-on:keyup.enter="getCurrentWorkInfo()" clearable></el-input>
</div>
</div>
<div style="display: flex; flex-direction: column;">
<div class="display-title-div">
<span class="display-title-text">箱号</span>
</div>
<div class="display-form-div">
<el-input v-model="workFormEntity.vehicleId" size="default" ref="vehicleId"
v-on:keyup.enter="getCurrentWorkInfo()" clearable></el-input>
</div>
</div>
<div style="display: flex; flex-direction: column;">
<div class="display-title-div">
<span class="display-title-text">实物数量</span>
</div>
<div style="display: flex; margin-top: 20px;">
<div class="display-form-div-left">
<el-input-number v-model.number="workFormEntity.realNum" ref="realNum"
controls-position="right" :min="0" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16" class="btn-area">
<el-col :span="8" :offset="8">
<el-form-item>
<el-button type="success" round @click="submitInventoryConfirmTask()">确认盘点</el-button>
</el-form-item>
</el-col>
</el-row>
</div>
<div class="display-form-div-right">
<span class="display-form-text-right">PC</span>
</div>
</div>
</div>
</div>
</div>
<div style="margin: 10px;">
<div class="arrow" @click="confirmTask()">
<span
style="margin-left: 25px; align-self: center; font-weight: bold;font-size: 45px; writing-mode: vertical-lr;">完成确认</span>
</div>
</div>
</div>
</el-form>
</fieldset>
</div>
@ -124,205 +86,147 @@
<script setup>
import store from '@/store'
import { sendInventoryTask, finishPicking, getTasks, getTaskByTask } from '@/api/task'
import { queryPartNo } from '@/api/goods'
import { taskStatusFormatter, dueFormatter } from '@/utils/formatter.js'
import { getWorkByStandAndGoods, confirmFinishWork, queryFinishByStandAndGoods } from '@/api/task'
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import UploadInventoryList from '@/excel/UploadInventoryList.vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
const inventoryTaskOutRequestRef = ref()
const inventoryTaskConfirmRequestRef = ref()
const rules = reactive({
goodsId: [
{ required: true, message: '请输入物料编号' }
],
realNum: [
{ required: true, message: '请输入数量' },
{ type: 'number', message: '请输入数字' }
],
destination: [
{ required: true, message: '请选择盘点站台' }
]
})
</script>
<script>
export default {
name: 'inventory',
name: 'doKitting',
data() {
return {
standId: store.getters.getStandId,
timer: '',
tasks: [],
pageInfo: {},
currentPage: 1,
pageSize: 10,
total: 0,
loading: false,
labelPosition: 'top',
inventoryOutEntity: {
workFormRef: ref(),
workFormEntity: reactive({
goodsId: '',
totalNum: 0,
vehicleId: '',
destination: '',
userName: store.getters.getUserName
},
inventoryConfirmEntity: {
taskId: '',
goodsId: '',
vehicleNo: '',
originNum: 0,
realNum: 0,
userName: store.getters.getUserName
},
goodsOptions: [],
standOptions: [
{
value: 'P1',
label: '1号盘点站台'
},
{
value: 'P2',
label: '2号盘点站台'
},
planPickNum: 0,
remainNumOrigin: null,
remainNumReal: null,
remark: '',
finishedRows: 0,
totalRows: 0,
finishedCounts: 0,
totalCounts: 0,
tip: ''
}),
rules: reactive({
goodsId: [
{ required: true, message: '请输入料号' }
]
}),
}
},
mounted() {
this.$refs.goodsId.focus()
this.timer = setInterval(() => {
this.getAllTasks()
this.getCurrentInventoryInfo()
this.queryFinish()
}, 2000)
},
beforeUnmount() {
clearInterval(this.timer)
},
methods: {
queryGoodsId(query) {
const param = { material: query }
queryPartNo(param).then(res => {
if (res.data.code == 0) {
this.goodsOptions = res.data.returnData
//
getCurrentWorkInfo() {
const request = {
standId: this.standId,
goodsId: this.workFormEntity.goodsId
}
getWorkByStandAndGoods(request).then(res => {
const response = res.data
if (response.code == 0) {
this.workFormEntity.goodsId = response.returnData.goodsId
this.workFormEntity.planPickNum = response.returnData.planPickNum
this.workFormEntity.remainNumOrigin = response.returnData.remainNumOrigin
this.workFormEntity.remainNumReal = response.returnData.remainNumReal
this.workFormEntity.remark = response.returnData.remark
this.workFormEntity.finishedRows = response.returnData.finishedRows
this.workFormEntity.totalRows = response.returnData.totalRows
this.workFormEntity.finishedCounts = response.returnData.finishedCounts
this.workFormEntity.totalCounts = response.returnData.totalCounts
this.workFormEntity.tip = response.returnData.tip
} else {
this.goodsOptions = []
this.resetForms()
ElMessage.error(response.message)
}
}).catch(err => {
this.goodsOptions = []
ElMessage.error('查询物料信息错误' + err.message)
})
},
getAllTasks() {
this.pageInfo.pageNum = this.currentPage
this.pageInfo.pageSize = this.pageSize
const tableRequest = {
page: this.pageInfo,
param: {
taskType: 3,
userName: store.getters.getUserName
}
}
getTasks(tableRequest).then(res => {
const tableResponse = res.data
if (tableResponse.code != 0) {
console.log(tableResponse.code + ':' + tableResponse.message)
ElMessage.error(tableResponse.message)
}
this.tasks = tableResponse.rows
this.total = tableResponse.total
}).catch(err => {
console.log(err)
ElMessage.error('查询任务错误')
this.resetForms()
ElMessage.error('查询工作信息错误')
})
},
//
getCurrentInventoryInfo() {
//
const taskQuery1 = {
taskType: 3,
taskStatus: 8
}
//
getTaskByTask(taskQuery1).then(res1 => {
if (res1.data.code == 0) {
const currentFinishTask = res1.data.returnData;
if (currentFinishTask != null) {
if (currentFinishTask.taskId == this.inventoryConfirmEntity.taskId) {//
//
queryFinish() {
if (this.workFormEntity.goodsId == '') {
return
}
this.inventoryConfirmEntity.taskId = currentFinishTask.taskId
this.inventoryConfirmEntity.goodsId = currentFinishTask.goodsId
this.inventoryConfirmEntity.vehicleNo = currentFinishTask.vehicleNo
this.inventoryConfirmEntity.originNum = currentFinishTask.totalNum
this.inventoryConfirmEntity.realNum = currentFinishTask.totalNum
} else {
this.inventoryConfirmEntity.taskId = ''
this.inventoryConfirmEntity.goodsId = ''
this.inventoryConfirmEntity.vehicleNo = ''
this.inventoryConfirmEntity.originNum = 0
this.inventoryConfirmEntity.realNum = 0
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)
ElMessage.error('查询任务错误')
})
},
taskStatusFormat: (row, column, cellValue, index) => {
return taskStatusFormatter(cellValue)
//
resetForms() {
this.workFormEntity = reactive({
goodsId: '',
planPickNum: 0,
remainNumOrigin: null,
remainNumReal: null,
remark: '',
finishedRows: 0,
totalRows: 0,
finishedCounts: 0,
totalCounts: 0,
tip: ''
})
this.$refs.goodsId.focus()
},
dueFormat: (row, column, cellValue, index) => {
return dueFormatter(cellValue)
},
submitInventoryOutTask() {
if (this.tasks.length > 0) {
//
confirmTask() {
if (this.standId == '' || this.workFormEntity.goodsId == '') {
ElMessage({
message: '当前还有盘点任务未完成',
message: '站台号和料号不可缺少',
type: 'error',
})
return
}
sendInventoryTask(this.inventoryOutEntity).then(res => {
console.log(res)
if (res.data.code == 0) {
this.inventoryOutEntity.totalNum = res.data.returnData.realNum
ElMessage({
message: '创建盘点出库任务成功!',
type: 'success',
})
} else {
this.inventoryOutEntity.totalNum = 0
ElMessage.error(res.data.message)
const confirmParams = {
standId: this.standId,
goodsId: this.workFormEntity.goodsId,
remainNumOrigin: this.workFormEntity.remainNumOrigin,
remainNumReal: this.workFormEntity.remainNumReal
}
}).catch(err => {
this.inventoryOutEntity.totalNum = 0
console.log(err)
ElMessage.error('创建盘点出库任务错误!')
})
},
submitInventoryConfirmTask() {
if (this.inventoryConfirmEntity.taskId == null) {
ElMessage({
message: '没有正在盘点的任务,请勿乱点按钮',
type: 'error',
})
return
confirmFinishWork(confirmParams).then(res => {
const response = res.data
if (response.code == 0) {
if (response.returnData != null) {
this.workFormEntity.tip = response.returnData.tip
}
finishPicking(this.inventoryConfirmEntity).then(res => {
if (res.data.code == 0) {
ElMessage({
message: '盘点成功,正在回库',
type: 'success',
})
this.inventoryConfirmEntity.taskId = ''
this.inventoryConfirmEntity.goodsId = ''
this.inventoryConfirmEntity.vehicleNo = ''
this.inventoryConfirmEntity.originNum = 0
this.inventoryConfirmEntity.realNum = 0
this.resetForms()
ElMessage.success(response.message)
} else {
ElMessage.error(res.data.message)
ElMessage.error(response.message)
}
}).catch(err => {
console.log(err)
ElMessage.error('盘点错误')
ElMessage.error('确认时发生异常')
})
}
}
@ -335,65 +239,165 @@ export default {
width: 100%;
}
.el-row .el-form-item {
width: 30% inherit;
justify-content: center;
}
.btn-area .el-form-item {
width: 30% inherit;
padding-left: 15px;
}
.el-row .el-form-item .el-select-v2 {
width: 100% !important;
}
.el-row .el-form-item .el-select {
width: 100% !important;
}
.el-row .el-form-item .el-input-number {
width: 100% !important;
}
.el-row .el-form-item .el-button {
margin: auto;
}
.right {
width: 40%;
padding: 5px;
}
.left {
width: 60%;
padding: 5px;
}
.input-area {
margin: auto;
max-width: inherit;
height: 300px;
border: solid 1px;
border-radius: 10px;
box-shadow: 0px 15px 10px -15px #000;
}
.display-area {
margin: auto;
min-width: inherit;
height: 632px;
border: solid 1px;
border-radius: 10px;
box-shadow: 0px 15px 10px -15px #000;
}
.table-class {
.work-area {
width: 100%;
/* padding: 5px; */
}
.red-character :deep(.el-form-item__label) {
color: red;
.main-area {
margin: auto;
min-height: fit-content;
max-height: 90%;
margin-bottom: 10px;
min-width: inherit;
border: solid 1px;
border-radius: 10px;
box-shadow: 0px 15px 10px -15px #000;
overflow: auto;
}
.title-area {
display: flex;
min-height: 10%;
max-height: max-content;
margin-bottom: 10px;
min-width: inherit;
border: solid 1px;
border-radius: 10px;
box-shadow: 0px 15px 10px -15px #000;
overflow: auto;
}
.arrow {
background: linear-gradient(-105deg,
transparent 50%,
#309330 50%,
#309330 100%) top right,
linear-gradient(-75deg,
transparent 50%,
#309330 50%,
#309330 100%) bottom right;
background-size: 100% 50%;
height: 400px;
width: 250px;
background-repeat: no-repeat;
display: inline-flex;
cursor: pointer;
}
:deep(.el-input) {
width: 195px;
height: 130px;
font-size: 25px;
}
:deep(.el-input-number) {
width: 125px;
height: 130px;
font-size: 25px;
}
/* :deep(.el-input .el-input__inner) {
font-size: 60px;
height: 130px;
}
:deep(.el-input-number .el-input__inner) {
font-size: 60px;
height: 130px;
} */
.title-div {
display: inline-flex;
width: -webkit-fill-available;
margin-right: 5px;
padding: 5px;
background-color: #CCCCCC;
}
.title-text {
align-self: center;
font-weight: bold;
font-size: 25px;
}
.station-div {
display: inline-flex;
justify-content: center;
width: 150px;
margin-left: 5px;
margin-right: 5px;
padding: 5px;
background-color: #FFFAAA;
}
.station-text {
align-self: center;
font-weight: bold;
font-size: 25px;
}
.station-no-div {
display: inline-flex;
justify-content: center;
width: 200px;
padding: 5px;
border: 5px double #000000;
}
.station-no-text {
align-self: center;
font-weight: bold;
font-size: 25px;
}
.display-title-div {
display: inline-flex;
justify-content: center;
width: 205px;
height: 80px;
margin: 5px;
padding: 5px;
background-color: #FFFAAA;
}
.display-title-text {
align-self: center;
font-weight: bold;
font-size: 25px;
}
.display-form-div {
display: inline-flex;
justify-content: center;
width: 195px;
margin: 5px;
padding: 5px;
border: 5px double #000000;
margin-top: 25px;
}
.display-form-div-left {
display: inline-flex;
justify-content: center;
width: 125px;
margin: 5px;
padding: 5px;
border: 5px double #000000;
}
.display-form-div-right {
display: inline-flex;
justify-content: center;
width: 50px;
margin: 5px;
padding: 5px;
background-color: #CCCCCC;
}
.display-form-text-right {
align-self: center;
font-weight: bold;
font-size: 25px;
}
</style>

View File

@ -17,15 +17,15 @@
<el-radio :label="scope.row.stockId" v-model="stockId">&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="goodsId" label="物料号" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsName" label="物料名称" fixed="left" min-width="120px" show-overflow-tooltip />
<el-table-column prop="remainNum" label="剩余数量" min-width="120px" />
<el-table-column prop="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="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">
@ -309,7 +309,10 @@ export default {
this.$emit('update:selStock', row)
},
exportExcel() {
downloadStockExcel().then(res => {
const params = {
goodsId: this.goodsIdQuery.trim
}
downloadStockExcel(params).then(res => {
const link = document.createElement('a');//a
try {
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //blobblobtypexls
@ -342,6 +345,25 @@ export default {
})
},
editCurrentRowStock(row) {
this.stockFormEntity = {
stockId: row.stockId,
locationId: row.locationId,
vehicleId: row.vehicleId,
stockStatus: row.stockStatus,
createTime: row.createTime,
lastUpdateTime: row.lastUpdateTime,
lastUpdateUser: row.lastUpdateUser,
isInventory: row.isInventory,
inventoryTaskId: row.inventoryTaskId,
noUseDays: row.noUseDays,
goodsRelated: {
goodsId: row.goodsId,
goodsName: row.goodsName,
goodsStatus: row.goodsStatus,
remainNum: row.remainNum,
totalNum: row.totalNum
}
}
this.stockFormEntity = row
this.dialogVisible = true
},

View File

@ -20,7 +20,7 @@
<el-table-column prop="vehicleId" label="载具号" min-width="120px" />
<el-table-column prop="goodsRelated.goodsId" label="物料编号" min-width="120px" show-overflow-tooltip />
<el-table-column prop="goodsRelated.goodsName" label="物料名称" min-width="120px" show-overflow-tooltip />
<el-table-column prop="taskGroup" label="任务组" min-width="120px" />
<el-table-column prop="taskGroup" label="任务组" min-width="120px" show-overflow-tooltip />
<el-table-column prop="origin" label="起点" min-width="120px" />
<el-table-column prop="destination" label="终点" min-width="120px" />
<el-table-column prop="opNum" label="操作数量" min-width="120px" />
@ -106,7 +106,6 @@
<script setup>
import { getTasksByPage, changeTaskStatus } from '@/api/task.js'
import { getAvailableLocations } from '@/api/location.js'
import { dateFormatter, locationFormatter, taskStatusFormatter, timeFormatter, dueFormatter } from '@/utils/formatter.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { ElMessage } from 'element-plus'
@ -218,30 +217,30 @@ export default {
this.vehicleIdQuery = ''
},
editCurrentRowTask(row) {
if (row.taskType == 1) {
this.availableLocationOptions = []
var currentOption = {
value: row.destination,
label: locationFormatter(row.destination)
}
this.availableLocationOptions.push(currentOption)
//
const requestParam = {
areaId: 1
}
getAvailableLocations(requestParam).then(res => {
if (res.data.code == 0) {
for (const location of res.data.returnData) {
var newOption = {}
newOption.value = location.locationId
newOption.label = locationFormatter(location.locationId)
this.availableLocationOptions.push(newOption)
}
}
}).catch(err => {
ElMessage.error('查找可用库位失败:' + err)
})
}
// if (row.taskType == 1) {
// this.availableLocationOptions = []
// var currentOption = {
// value: row.destination,
// label: locationFormatter(row.destination)
// }
// this.availableLocationOptions.push(currentOption)
// //
// const requestParam = {
// areaId: 1
// }
// getAvailableLocations(requestParam).then(res => {
// if (res.data.code == 0) {
// for (const location of res.data.returnData) {
// var newOption = {}
// newOption.value = location.locationId
// newOption.label = locationFormatter(location.locationId)
// this.availableLocationOptions.push(newOption)
// }
// }
// }).catch(err => {
// ElMessage.error(':' + err)
// })
// }
this.taskFormEntity.taskId = row.taskId
this.taskFormEntity.vehicleNo = row.vehicleNo
this.taskFormEntity.goodsId = row.goodsId

View File

@ -44,7 +44,7 @@
<el-col :span="12">
<el-form-item label="配置类型" prop="configType">
<el-select-v2 v-model="configFormEntity.configType" placeholder="请选择配置类型"
:options="configTypeOptions"></el-select-v2>
:options="configTypeOptions" disabled></el-select-v2>
</el-form-item>
</el-col>
</el-row>
@ -252,4 +252,12 @@ export default {
.el-row .el-form-item .el-input-number {
width: 100% !important;
}
.el-row .el-form-item .el-select {
width: 100% !important;
}
.el-row .el-form-item .el-input {
width: 100% !important;
}
</style>

View File

@ -128,6 +128,39 @@ function configTypeFormatter(value) {
}
}
function sizeFormatter(value) {
if (typeof value != 'number') {
return 'error'
}
const oneByte = 1
const oneKB = oneByte * 1024
const oneMB = oneKB * 1024
const oneGB = oneMB * 1024
const oneTB = oneGB * 1024
const onePB = oneTB * 1024
const oneEB = onePB * 1024
const oneZB = oneEB * 1024
const oneYB = oneZB * 1024
if (value < oneKB) {
return value + 'B'
} else if (value < oneMB) {
return (value / oneKB).toFixed(2) + 'KB'
} else if (value < oneGB) {
return (value / oneMB).toFixed(2) + 'MB'
} else if (value < oneTB) {
return (value / oneGB).toFixed(2) + 'GB'
} else if (value < onePB) {
return (value / oneTB).toFixed(2) + 'TB'
} else if (value < oneEB) {
return (value / onePB).toFixed(2) + 'PB'
} else if (value < oneZB) {
return (value / oneEB).toFixed(2) + 'EB'
} else if (value < oneYB) {
return (value / oneZB).toFixed(2) + 'ZB'
} else {
return (value / oneYB).toFixed(2) + 'YB'
}
}
export {
timeFormatter,
@ -139,5 +172,6 @@ export {
vehicleStatusFormatter,
configTypeFormatter,
dueFormatter,
locationStatusFormatter
locationStatusFormatter,
sizeFormatter
}