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

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

@@ -2,43 +2,28 @@
<view class="container">
<view class="form-card">
<uni-forms>
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.warehouse')">
<uni-forms-item label="仓库">
<uni-data-select
v-model="formData.warehouseId"
:localdata="warehouseList"
:clear="false"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.warehousePlaceholder')"
placeholder="请选择仓库"
@change="handleWarehouseChange"
/>
</uni-forms-item>
<view class="cargo-space-container" v-if="currentWarehouseType == '1'">
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.cargoSpace')">
<view class="cargo-input-group">
<uni-easyinput
v-model="formData.cargoSpaceName"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.cargoSpacePlaceholder')"
:clearable="true"
@input="handleCargoSpaceInput"
/>
<button class="recommend-btn" @click="handleRecommendCargoSpace">{{ $t('outbound.emptyPalletBox.emptyPallet.recommendCargoSpace') }}</button>
</view>
</uni-forms-item>
</view>
<view v-if="currentWarehouseType == '1' && cargoSpaceHeight" class="cargo-space-info">
<text class="cargo-space-height">{{ $t('outbound.emptyPalletBox.emptyPallet.cargoSpaceHeight') }}{{ cargoSpaceHeight }}{{ $t('outbound.emptyPalletBox.emptyPallet.meter') }}</text>
</view>
<view class="cargo-space-container" v-if="currentWarehouseType == '2'">
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.exit')">
<view class="cargo-space-container">
<uni-forms-item label="出口">
<uni-data-select
v-model="formData.exitId"
:localdata="exitList"
:clear="false"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.exitPlaceholder')"
placeholder="请选择出口"
/>
</uni-forms-item>
</view>
<button class="submit-button" hover-class="button-hover" @click="handleSubmit">{{ $t('outbound.emptyPalletBox.emptyPallet.submit') }}</button>
<button class="submit-button" hover-class="button-hover" @click="handleSubmit">空托盘出库</button>
</uni-forms>
</view>
</view>
@@ -53,9 +38,7 @@ export default {
return {
formData: {
warehouseId: '',
cargoSpaceId: '',
exitId: '',
cargoSpaceName: ''
exitId: ''
},
warehouseList: [],
cargoSpaceList: [],
@@ -73,17 +56,17 @@ export default {
const res = await getBasWarehouList({
pageNum:1,
pageSize:100,
typeData:['1','2']
// typeData:['1','2']
})
if (res.code === 200) {
this.warehouseList = res.rows.map(item => ({
value: item.warehouseId,
text: item.warehouseName,
type: item.warehouseType
text: item.warehouseName
// type: item.warehouseType
}))
}
} catch (error) {
console.error(this.$t('outbound.emptyPalletBox.emptyPallet.getWarehouseListFailed'), error)
console.error('获取仓库列表失败', error)
}
},
async handleWarehouseChange(warehouseId) {
@@ -92,97 +75,27 @@ export default {
this.currentWarehouseType = selectedWarehouse ? selectedWarehouse.type : ''
this.formData.exitId = ''
if (this.currentWarehouseType == '2') {
// if (this.currentWarehouseType == '2') {
// 模拟出口数据,实际项目中应该从后端获取
this.exitList = [
{ value: '1', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '1' },
{ value: '2', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '2' },
{ value: '3', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '3' }
{ value: '1', text: '出口方向1' },
{ value: '2', text: '出口方向2' }
]
}
},
handleCargoSpaceSelect(item) {
this.formData.cargoSpaceId = item.value
},
async handleRecommendCargoSpace() {
if (!this.formData.warehouseId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectWarehouse'),
icon: 'none'
})
return
}
// try {
const response = await getFullCargoSpaceListByWarehouse({ warehouseId: this.formData.warehouseId })
if (response.code === 200 && response.data.length > 0) {
// 获取第一个推荐货位
this.formData.cargoSpaceId = response.data[0].cargoSpaceId
this.formData.cargoSpaceName = response.data[0].cargoSpaceName
// 手动触发handleCargoSpaceInput方法获取货位高度信息
await this.handleCargoSpaceInput(response.data[0].cargoSpaceName)
} else {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.noAvailableCargoSpace'),
icon: 'none'
})
}
// } catch (error) {
// console.error('获取推荐货位失败:', 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('outbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} catch (error) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} else {
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
},
async handleSubmit() {
if (!this.formData.warehouseId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectWarehouse'),
title: '请选择仓库',
icon: 'none'
})
return
}
if (this.currentWarehouseType == '1' && !this.formData.cargoSpaceId) {
if ( !this.formData.exitId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectCargoSpace'),
icon: 'none'
})
return
}
if (this.currentWarehouseType == '2' && !this.formData.exitId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectExit'),
title: '请选择出口',
icon: 'none'
})
return
@@ -194,22 +107,19 @@ export default {
if (response.code === 200) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.outboundSuccess'),
title: '空托盘出库成功',
icon: 'success'
})
// 重置表单数据
this.formData = {
warehouseId: '',
cargoSpaceId: '',
exitId: ''
}
this.cargoSpaceList = []
this.exitList = []
this.currentWarehouseType = ''
this.cargoSpaceHeight = ''
} else {
uni.showToast({
title: response.msg || this.$t('outbound.emptyPalletBox.emptyPallet.outboundOperationFailed'),
title: response.msg || '出库操作失败',
icon: 'none'
})
}