现场调试修改 入库 出库 放货重新分配货位

This commit is contained in:
liuhanqing
2025-12-26 13:23:28 +08:00
parent ced125c8e9
commit 6b56e5f2ad
53 changed files with 3397 additions and 1832 deletions

View File

@@ -1,10 +1,10 @@
<template>
<view class="container">
<view class="input-group">
<text class="input-label">{{ $t('inbound.emptyPalletBox.emptyPallet.trayCode') }}</text>
<text class="input-label">托盘条码:</text>
<uni-easyinput
v-model="formData.trayCode"
:placeholder="$t('inbound.emptyPalletBox.emptyPallet.trayCodePlaceholder')"
placeholder="请输入或扫码输入托盘条码"
:clearable="true"
@clear="handleClear"
@confirm="handleConfirm"
@@ -16,33 +16,18 @@
</template>
</uni-easyinput>
</view>
<view class="input-group">
<text class="input-label">{{ $t('inbound.emptyPalletBox.emptyPallet.warehouse') }}</text>
<!-- <view class="input-group">
<text class="input-label">仓库</text>
<uni-data-select
v-model="formData.warehouseId"
:localdata="warehouseList"
:clear="false"
:placeholder="$t('inbound.emptyPalletBox.emptyPallet.warehousePlaceholder')"
@change="handleWarehouseChange"
placeholder="请选择仓库"
/>
</view>
<view class="input-group" v-if="currentWarehouseType == '1'">
<text class="input-label">{{ $t('inbound.emptyPalletBox.emptyPallet.cargoSpace') }}</text>
<view class="cargo-input-group">
<uni-easyinput
v-model="formData.cargoSpaceName"
:placeholder="$t('inbound.emptyPalletBox.emptyPallet.cargoSpacePlaceholder')"
:clearable="true"
@input="handleCargoSpaceInput"
/>
<button class="recommend-btn" @click="handleRecommendCargoSpace">{{ $t('inbound.emptyPalletBox.emptyPallet.recommendCargoSpace') }}</button>
</view>
</view>
<view v-if="currentWarehouseType == '1' && cargoSpaceHeight" class="cargo-space-info">
<text class="cargo-space-height">{{ $t('inbound.emptyPalletBox.emptyPallet.cargoSpaceHeight') }}{{ cargoSpaceHeight }}{{ $t('inbound.emptyPalletBox.emptyPallet.meter') }}</text>
</view>
</view> -->
<view class="button-group">
<button class="submit-button" @click="handleSubmit">{{ $t('inbound.emptyPalletBox.emptyPallet.submit') }}</button>
<button class="submit-button" @click="handleSubmit">空托盘入库</button>
</view>
</view>
@@ -57,16 +42,11 @@ import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
return {
formData: {
trayCode: '',
warehouseId: '',
cargoSpaceId: '',
cargoSpaceName:'',
warehouseId: ''
},
warehouseList: [],
cargoSpaceId: '',
cargoSpaceList: [],
currentWarehouseType: null,
cargoSpaceHeight:''
warehouseList: []
}
},
onReady() {
@@ -77,7 +57,7 @@ import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
}, 100)
// 获取仓库列表
this.getWarehouseList()
// this.getWarehouseList()
},
methods: {
// 获取仓库列表
@@ -85,20 +65,20 @@ import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
try {
const response = await getBasWarehouList({
pageNum:1,
pageSize:100,
typeData:['1','2']
pageSize:100
})
if (response.code === 200) {
this.warehouseList = response.rows.map(item => ({
value: item.warehouseId,
text: item.warehouseName,
type: item.warehouseType
text: item.warehouseName
// type: item.warehouseType
}))
}
} catch (error) {
console.error('获取仓库列表失败:', error)
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.getWarehouseListFailed'),
title: '获取仓库列表失败',
icon: 'none'
})
}
@@ -119,103 +99,34 @@ import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
})
},
handleWarehouseChange(warehouseId) {
if (!warehouseId) return
const selectedWarehouse = this.warehouseList.find(item => item.value === warehouseId)
this.currentWarehouseType = selectedWarehouse ? selectedWarehouse.type : null
},
// 处理货位选择
async handleRecommendCargoSpace() {
// try {
const response = await getCargoSpaceList({ warehouseId: this.formData.warehouseId, status: 1 })
if (response.code === 200 && response.rows.length > 0) {
// 获取第一个推荐货位
this.formData.cargoSpaceId = response.rows[0].cargoSpaceId
this.formData.cargoSpaceName = response.rows[0].cargoSpaceName
// 手动触发handleCargoSpaceInput方法获取货位高度信息
await this.handleCargoSpaceInput(response.rows[0].cargoSpaceName)
} else {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.noAvailableCargoSpace'),
icon: 'none'
})
}
// } catch (error) {
// uni.showToast({
// title: '获取推荐货位失败',
// icon: 'none'
// })
// }
},
// 处理货位选择
async handleCargoSpaceInput(value) {
if (value) {
try {
const response = await getCargoSpaceList({ cargoSpaceName: value, warehouseId: this.formData.warehouseId })
if (response.code === 200 && response.rows.length > 0) {
this.formData.cargoSpaceId = response.rows[0].cargoSpaceId
this.cargoSpaceHeight = response.rows[0].cargoHight
console.log(this.formData.cargoSpaceId)
} else {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} catch (error) {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} else {
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
},
async handleSubmit() {
if (!this.formData.trayCode) {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.enterTrayCode'),
icon: 'none'
})
return
}
if (!this.formData.warehouseId) {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.selectWarehouse'),
icon: 'none'
})
return
}
if (this.currentWarehouseType === '1' && (!this.formData.cargoSpaceId || this.formData.cargoSpaceId === null)) {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.selectCargoSpace'),
title: '请输入托盘条码',
icon: 'none'
})
return
}
// if (!this.formData.warehouseId) {
// uni.showToast({
// title: '请选择仓库',
// icon: 'none'
// })
// return
// }
await emptyTrayIn(this.formData).then(response => {
if (response.code === 200) {
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.inboundSuccess'),
title: '空托盘入库成功',
icon: 'success'
})
// 清空表单
this.formData = {
trayCode: '',
warehouseId: '',
cargoSpaceId: '',
cargoSpaceName: ''
warehouseId: ''
}
this.cargoSpaceHeight=''
this.currentWarehouseType=null
// 重新聚焦到托盘条码输入框
setTimeout(() => {
this.$nextTick(() => {
@@ -224,14 +135,14 @@ import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
}, 100)
} else {
uni.showToast({
title: response.msg || this.$t('inbound.emptyPalletBox.emptyPallet.inboundOperationFailed'),
title: response.msg || '入库操作失败',
icon: 'none'
})
}
}).catch(error => {
console.error('入库失败:', error)
uni.showToast({
title: this.$t('inbound.emptyPalletBox.emptyPallet.inboundFailed'),
title: '入库失败',
icon: 'none'
})
})