现场调试修改 入库 出库 放货重新分配货位
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 出口选择框 -->
|
||||
<view class="input-group">
|
||||
<view class="input-label">出口:</view>
|
||||
<uni-data-select
|
||||
v-model="selectedExit"
|
||||
:localdata="exitOptions"
|
||||
placeholder="请选择出口"
|
||||
class="select-input"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<!-- 托盘条码输入框 -->
|
||||
<view class="input-group">
|
||||
<view class="input-label">物料条码:</view>
|
||||
<uni-easyinput
|
||||
v-model="trayCode"
|
||||
placeholder="请输入或扫码输入托盘条码"
|
||||
placeholder="请扫码输入物料条码"
|
||||
:clearable="true"
|
||||
@input="handleInput"
|
||||
@clear="handleClear"
|
||||
@@ -18,37 +31,21 @@
|
||||
<view class="table-container" v-if="materialList.length > 0">
|
||||
<view class="table">
|
||||
<view class="table-header">
|
||||
<view class="table-cell checkbox-cell">
|
||||
<checkbox :checked="isAllSelected" @click="toggleSelectAll" />
|
||||
</view>
|
||||
|
||||
<view class="table-cell">物资编码</view>
|
||||
<view class="table-cell">物料名称</view>
|
||||
<view class="table-cell">出库数量</view>
|
||||
<view class="table-cell">绑定数量</view>
|
||||
</view>
|
||||
<view v-for="(item, index) in materialList" :key="index" class="table-row">
|
||||
<view class="table-cell checkbox-cell">
|
||||
<checkbox :checked="item.selected" @click="toggleSelect(index)" />
|
||||
</view>
|
||||
|
||||
<view class="table-cell">{{ item.productId }}</view>
|
||||
<view class="table-cell">{{ item.extraField.materialDesc }}</view>
|
||||
<view class="table-cell">{{ item.outQuantity }}</view>
|
||||
<view class="table-cell">
|
||||
<input type="number" v-model.number="item.bindQuantity" @input="handleBindQuantityInput($event, index)" class="quantity-input" />
|
||||
</view>
|
||||
<view class="table-cell">{{ item.productName }}</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="rack-code-input" v-if="materialList.length > 0 && (!materialList[0].spare2 || materialList[0].spare2 !== '2')">
|
||||
<uni-easyinput
|
||||
v-model="rackCode"
|
||||
placeholder="请输入料架码"
|
||||
:clearable="true"
|
||||
>
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="button-group" v-if="materialList.length > 0">
|
||||
<view class="button-group">
|
||||
<button class="confirm-button" @click="handleConfirm">确认出库</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -76,13 +73,26 @@
|
||||
return {
|
||||
trayCode: '',
|
||||
materialList: [],
|
||||
isAllSelected: false,
|
||||
rackCode: ''
|
||||
selectedExit: '',
|
||||
// 出口选项
|
||||
exitOptions: [
|
||||
{ value: 'L1021', text: 'L1021' },
|
||||
{ value: 'L1022', text: 'L1022' },
|
||||
{ value: 'L2002', text: 'L2002' },
|
||||
{ value: 'L2008', text: 'L2008' }
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理输入事件
|
||||
handleInput(value) {
|
||||
if(!this.selectedExit){
|
||||
uni.showToast({
|
||||
title: '请选择出口',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (value) {
|
||||
this.fetchTrayInfo(value)
|
||||
}
|
||||
@@ -103,12 +113,11 @@
|
||||
// 获取托盘信息
|
||||
async fetchTrayInfo(trayCode) {
|
||||
try {
|
||||
const response = await getTaskDetail({trayCode:trayCode,status:'3'})
|
||||
const response = await getTaskDetail({trayCode:trayCode,exitId:this.selectedExit})
|
||||
// 为每个物料添加选择状态和绑定数量
|
||||
this.materialList = response.data.map(item => ({
|
||||
...item,
|
||||
selected: false,
|
||||
bindQuantity: item.pickQuantityReal
|
||||
...item
|
||||
|
||||
}))
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
@@ -119,84 +128,43 @@
|
||||
},
|
||||
// 确认出库
|
||||
async handleConfirm() {
|
||||
const selectedItems = this.materialList.filter(item => item.selected)
|
||||
if (this.materialList[0].spare2 === '2') {
|
||||
try {
|
||||
await ckMakeSure({
|
||||
trayCode: this.trayCode,
|
||||
containerCode: 'MOCK_CONTAINER',
|
||||
mydoJobDetailList: [{
|
||||
jobDetailId: 'MOCK_JOB_DETAIL_ID',
|
||||
pickQuantity: 1
|
||||
}]
|
||||
})
|
||||
uni.showToast({
|
||||
title: '出库确认成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 清空数据
|
||||
this.trayCode = ''
|
||||
this.rackCode = ''
|
||||
this.materialList = []
|
||||
return
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '出库确认失败',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedItems.length === 0) {
|
||||
// 验证出口选择
|
||||
if (!this.selectedExit) {
|
||||
uni.showToast({
|
||||
title: '请选择要出库的物料',
|
||||
title: '请选择出口',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.rackCode) {
|
||||
if (!this.trayCode) {
|
||||
uni.showToast({
|
||||
title: '请输入料架码',
|
||||
title: '请输入托盘条码',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
for (const item of selectedItems) {
|
||||
if (item.bindQuantity <= 0 || item.bindQuantity > item.outQuantity) {
|
||||
uni.showToast({
|
||||
title: '绑定数量必须大于0且不能超过出库数量',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await ckMakeSure({
|
||||
|
||||
const response=await ckMakeSure({
|
||||
trayCode: this.trayCode,
|
||||
containerCode: this.rackCode,
|
||||
mydoJobDetailList: selectedItems.map(item => ({
|
||||
jobDetailId: item.jobDetailId,
|
||||
pickQuantity: item.bindQuantity
|
||||
}))
|
||||
exitId: this.selectedExit
|
||||
})
|
||||
uni.showToast({
|
||||
title: '出库确认成功',
|
||||
if (response.code==200) {
|
||||
uni.showToast({
|
||||
title: '出库成功',
|
||||
icon: 'success'
|
||||
})
|
||||
// 清空数据
|
||||
this.trayCode = ''
|
||||
this.rackCode = ''
|
||||
this.materialList = []
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '出库确认失败',
|
||||
// 清空数据
|
||||
this.trayCode = ''
|
||||
this.materialList = []
|
||||
this.selectedExit = ''
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: response.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
// 切换全选状态
|
||||
toggleSelectAll() {
|
||||
@@ -235,12 +203,49 @@
|
||||
margin-bottom: 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
|
||||
.input-label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.select-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.uni-easyinput__content) {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
height: 80rpx;
|
||||
padding: 0 24rpx;
|
||||
}
|
||||
|
||||
// uni-data-select 样式
|
||||
:deep(.uni-select) {
|
||||
.uni-select__input-box {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
transition: all 0.3s ease;
|
||||
height: 80rpx;
|
||||
|
||||
.uni-select__input-text {
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.uni-select__input-placeholder {
|
||||
font-size: 28rpx;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-select__input-box:hover {
|
||||
border-color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.scan-icon {
|
||||
|
||||
Reference in New Issue
Block a user