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

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,60 +1,146 @@
<template>
<view class="container">
<!-- 出口选择框 -->
<!-- <view class="input-group">
<text class="input-label">选择出口</text>
<uni-data-select
v-model="selectedExit"
:localdata="exitOptions"
placeholder="请选择出口"
class="select-input">
</uni-data-select>
</view> -->
<view class="input-group">
<view class="input-label">托盘条码:</view>
<uni-easyinput
v-model="trayCode"
:placeholder="$t('stocktaking.confirm.trayCodePlaceholder')"
placeholder="请输入或扫码输入托盘条码"
:clearable="true"
@input="handleInput"
@clear="handleClear"
ref="trayCodeInput"
>
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
<view class="materials-list" v-if="materialList.length > 0">
<button class="add-button" @click="showAddMaterialPopup">{{ $t('stocktaking.confirm.addMaterial') }}</button>
<view v-for="(item, index) in materialList" :key="index" class="material-card">
<view class="material-header">
<text class="material-title">{{ item.extraField.materialDesc || item.productId }}</text>
<text class="material-code">{{ item.productId }} | {{ $t('stocktaking.confirm.systemQuantity') }}: {{ item.outQuantity }}{{ $t('stocktaking.confirm.unit') }}</text>
</view>
<view class="material-content">
<view class="quantity-control">
<button class="control-btn" @click="item.countQuantity = Math.max(0, Number(item.countQuantity) - 1)">-</button>
<text class="quantity-value">{{ item.countQuantity }}</text>
<button class="control-btn" @click="item.countQuantity = Number(item.countQuantity) + 1">+</button>
<text class="quantity-diff" :class="{ 'plus': item.countQuantity > item.outQuantity, 'minus': item.countQuantity < item.outQuantity,'equal':item.countQuantity==item.outQuantity }">{{ item.countQuantity > item.outQuantity ? $t('stocktaking.confirm.surplus') + (item.countQuantity - item.outQuantity) : item.countQuantity < item.outQuantity ? $t('stocktaking.confirm.loss') + (item.outQuantity - item.countQuantity) : $t('stocktaking.confirm.match') }}</text>
<button class="clear-btn" @click="item.countQuantity = 0">{{ $t('stocktaking.confirm.clearQuantity') }}</button>
</view>
</view>
</view>
</view>
<view class="materials-list">
<view v-for="(item, index) in materialList" :key="index" class="material-card">
<view class="material-header">
<text class="material-title">{{ item.productName }}</text>
<view class="material-code-section">
<view class="code-input-group">
<text class="code-label">物料编码:</text>
<uni-easyinput
v-model="item.productId"
placeholder="请输入物料编码"
class="code-input"
@input="handleMaterialCodeChange(index, $event)"
/>
</view>
<view class="code-input-group">
<text class="code-label">盘点数量:</text>
<uni-easyinput
v-model="item.countQuantity"
type="number"
placeholder="请输入盘点数量"
class="code-input"
@input="handleMaterialQtyChange(index, $event)"
/>
</view>
<text class="quantity-info">系统数量: {{ item.outQuantity }}件</text>
</view>
</view>
</view>
<button class="add-button" @click="showAddMaterialPopup">新增</button>
</view>
<view class="button-group" v-if="materialList.length > 0">
<button class="confirm-button" @click="handleConfirm">{{ $t('stocktaking.confirm.confirmStocktaking') }}</button>
<button class="confirm-button" @click="handleConfirm">确认盘点</button>
</view>
<!-- 新增物料弹窗 -->
<uni-popup ref="addMaterialPopup" type="center">
<view class="popup-content">
<view class="popup-title">{{ $t('stocktaking.confirm.addMaterialTitle') }}</view>
<view class="popup-form">
<view class="form-item">
<text class="form-label">{{ $t('stocktaking.confirm.materialCodeLabel') }}</text>
<uni-easyinput v-model="newMaterial.productId" :placeholder="$t('stocktaking.confirm.materialCodePlaceholder')" />
<view class="popup-title">新增物料</view>
<view class="popup-form grid">
<view class="form-row">
<view class="form-col">
<text class="form-label">物料编码</text>
<uni-easyinput v-model="newMaterial.productId" placeholder="请输入物料编码" />
</view>
<view class="form-col">
<text class="form-label">数量</text>
<uni-easyinput v-model="newMaterial.inQuantity" type="number" placeholder="请输入数量" />
</view>
</view>
<view class="form-item">
<text class="form-label">{{ $t('stocktaking.confirm.quantityLabel') }}</text>
<uni-easyinput v-model="newMaterial.inQuantity" type="number" :placeholder="$t('stocktaking.confirm.quantityPlaceholder')" />
<view class="form-row">
<view class="form-col">
<text class="form-label">台次</text>
<uni-easyinput v-model="newMaterial.spare5" placeholder="请输入台次" />
</view>
<view class="form-col">
<text class="form-label">件次</text>
<uni-easyinput v-model="newMaterial.spare7" placeholder="请输入件次" />
</view>
</view>
<view class="form-row">
<view class="form-col">
<text class="form-label">合同号</text>
<uni-easyinput v-model="newMaterial.spare6" placeholder="请输入合同号" />
</view>
<view class="form-col">
<text class="form-label">管理号</text>
<uni-easyinput v-model="newMaterial.spare9" placeholder="请输入管理号" />
</view>
</view>
<view class="form-row">
<view class="form-col">
<text class="form-label">质量等级</text>
<uni-data-select :localdata="productStatus" v-model="newMaterial.spare8" placeholder="请选择质量等级"></uni-data-select>
</view>
<view class="form-col">
<text class="form-label">批次</text>
<uni-easyinput v-model="newMaterial.lotNo" placeholder="请输入批次" />
</view>
</view>
<!-- 可选扩展项(暂不显示) -->
<view class="form-row">
<view class="form-col">
<text class="form-label">状态</text>
<uni-data-select :localdata="turnover_type" v-model="newMaterial.spare2" placeholder="请选择状态"></uni-data-select>
</view>
<view class="form-col">
<text class="form-label">套账</text>
<uni-data-select :localdata="account_type" v-model="newMaterial.spare3" placeholder="请选择套账"></uni-data-select>
</view>
</view>
<view class="form-row">
<view class="form-col">
<text class="form-label">来源</text>
<uni-data-select :localdata="origin_type" v-model="newMaterial.spare1" placeholder="请选择来源"></uni-data-select>
</view>
<view class="form-col">
<text class="form-label">用途</text>
<uni-data-select :localdata="purpose_type" v-model="newMaterial.spare4" placeholder="请选择用途"></uni-data-select>
</view>
</view>
<view class="form-row">
<view class="form-col">
<text class="form-label">供应商</text>
<uni-easyinput v-model="newMaterial.supplierId" placeholder="请输入供应商"/>
</view>
<view class="form-col">
<text class="form-label">单价</text>
<uni-easyinput v-model="newMaterial.printDate" placeholder="请输入单价"/>
</view>
</view>
</view>
<view class="popup-buttons">
<button class="cancel-btn" @click="hideAddMaterialPopup">{{ $t('stocktaking.confirm.cancel') }}</button>
<button class="submit-btn" @click="handleAddMaterial">{{ $t('stocktaking.confirm.confirm') }}</button>
<button class="cancel-btn" @click="hideAddMaterialPopup">取消</button>
<button class="submit-btn" @click="handleAddMaterial">确定</button>
</view>
</view>
</uni-popup>
@@ -62,8 +148,7 @@
</template>
<script>
import { getTrayMaterials, confirmPandian } from '@/api/pandian/confirm.js'
import { confirmPandian,getTaskDetail } from '@/api/pandian/confirm.js'
export default {
onReady() {
setTimeout(() => {
@@ -74,17 +159,57 @@
},
data() {
return {
selectedExit: '',
exitOptions: [
{ value: '1', text: '1' },
{ value: '1', text: '1' }
],
productStatus:[
{ value:'1',text:'优秀'},
{ value:'2',text:'良好'},
{ value:'3',text:'合格'},
{ value:'4',text:'不合格'}
],
origin_type:[
{ value:'1',text:'国产'},
{ value:'2',text:'进口'}
],
turnover_type:[
{ value:'1',text:'正常'},
{ value:'2',text:'积压'}
],
account_type:[
{ value:'1',text:'帐内'},
{ value:'2',text:'帐外'}
],
purpose_type:[
{ value:'1',text:'民用'},
{ value:'2',text:'军用'}
],
trayCode: '',
materialList: [],
newMaterial: {
productId: '',
inQuantity: ''
inQuantity: '',
spare5:'',//台次
spare6:'',//合同号
spare7:'',//件次
spare8:'',//质量等级
spare9:'',//管理号
spare1:'',//来源
spare2:'',//状态
spare3:'',//套账
spare4:'',//用途
supplierId:'',
printDate:''
}
}
},
methods: {
methods: {
// 处理输入事件
handleInput(value) {
if (value) {
this.fetchTrayInfo(value)
}
@@ -93,26 +218,40 @@
handleClear() {
this.materialList = []
},
// 处理物料编码变化
handleMaterialCodeChange(index, value) {
this.materialList[index].productId = value
},
// 处理盘点数量变化
handleMaterialQtyChange(index, value) {
const num = Number(value)
if (Number.isNaN(num) || num < 0) {
this.materialList[index].countQuantity = 0
uni.showToast({ title: '数量需为非负数字', icon: 'none' })
} else {
this.materialList[index].countQuantity = num
}
},
// 处理扫码事件
handleScan() {
uni.scanCode({
success: (res) => {
this.trayCode = res.result
this.fetchTrayInfo(res.result)
}
})
},
// handleScan() {
// uni.scanCode({
// success: (res) => {
// this.trayCode = res.result
// this.fetchTrayInfo(res.result)
// }
// })
// },
// 获取托盘信息
async fetchTrayInfo(trayCode) {
try {
const response = await getTrayMaterials({trayCode:trayCode,inOut:'4'})
const response = await getTaskDetail({trayCode:trayCode})
this.materialList = response.data.map(item => ({
...item,
countQuantity: item.outQuantity
}))
} catch (error) {
uni.showToast({
title: this.$t('stocktaking.confirm.getTrayInfoFailed'),
title: '获取托盘信息失败',
icon: 'none'
})
}
@@ -126,14 +265,25 @@
this.$refs.addMaterialPopup.close()
this.newMaterial = {
productId: '',
inQuantity: ''
inQuantity: '',
spare5:'',//台次
spare6:'',//合同号
spare7:'',//件次
spare8:'',//质量等级
spare9:'',//管理号
spare1:'',//来源
spare2:'',//状态
spare3:'',//套账
spare4:'',//用途
supplierId:'',
printDate:''
}
},
// 处理新增物料
handleAddMaterial() {
if (!this.newMaterial.productId || !this.newMaterial.inQuantity) {
uni.showToast({
title: this.$t('stocktaking.confirm.fillCompleteInfo'),
title: '请填写完整信息',
icon: 'none'
})
return
@@ -144,45 +294,76 @@
countQuantity: Number(this.newMaterial.inQuantity),
outQuantity: 0,
stockId: null,
extraField: {
materialDesc: ''
}
spare5:this.newMaterial.spare5,//台次
spare6:this.newMaterial.spare6,//合同号
spare7:this.newMaterial.spare7,//件次
spare8:this.newMaterial.spare8,//质量等级
spare9:this.newMaterial.spare9,//管理号
spare1:this.newMaterial.spare1,//来源
spare2:this.newMaterial.spare2,//状态
spare3:this.newMaterial.spare3,//套账
spare4:this.newMaterial.spare4,//用途
supplierId:this.newMaterial.supplierId,
printDate:this.newMaterial.printDate
})
this.hideAddMaterialPopup()
uni.showToast({
title: this.$t('stocktaking.confirm.addSuccess'),
title: '新增成功',
icon: 'success'
})
},
// 确认盘点
async handleConfirm() {
try {
const data = {
trayCode: this.trayCode,
materials: this.materialList.map(item => ({
stockId: item.stockId,
productId:item.productId,
jobDetailId:item.jobDetailId,
inQuantity: item.countQuantity,
inOrOutDId:item.inOrOutDId
}))
}
// 验证出口选择
// if (!this.selectedExit) {
// uni.showToast({
// title: '请选择出口',
// icon: 'none'
// })
// return
// }
try {
const data = {
trayCode: this.trayCode,
// exitId: this.selectedExit,
materials: this.materialList.map(item => ({
stockId: item.stockId,
productId:item.productId,
jobDetailId:item.jobDetailId,
inQuantity: Number(item.countQuantity) || 0,
inOrOutDId:item.inOrOutDId,
spare5:item.spare5,//台次
spare6:item.spare6,//合同号
spare7:item.spare7,//件次
spare8:item.spare8,//质量等级
spare9:item.spare9,//管理号
spare1:item.spare1,//来源
spare2:item.spare2,//状态
spare3:item.spare3,//套账
spare4:item.spare4,//用途
supplierId:item.supplierId,
printDate:item.printDate
}))
}
const response=await confirmPandian(data)
if(response.code==200){
uni.showToast({
title: this.$t('stocktaking.confirm.stocktakingSuccess'),
title: '盘点成功',
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.selectedExit = ''
}
} catch (error) {
uni.showToast({
title: this.$t('stocktaking.confirm.stocktakingFailed'),
title: '盘点失败',
icon: 'none'
})
}
@@ -218,6 +399,23 @@
padding: 0 20rpx;
}
.input-label {
font-size: 28rpx;
color: #333;
margin-bottom: 16rpx;
display: block;
font-weight: 500;
}
.select-input {
:deep(.uni-data-select) {
background-color: #f8f8f8;
border-radius: 8rpx;
height: 80rpx;
padding: 0 24rpx;
}
}
.materials-list {
padding: 0 20rpx;
}
@@ -250,13 +448,54 @@
color: #333;
font-weight: 500;
display: block;
margin-bottom: 8rpx;
margin-bottom: 12rpx;
}
.material-code {
.material-code-section {
display: flex;
flex-direction: column;
gap: 8rpx;
}
.code-input-group {
display: flex;
align-items: center;
gap: 12rpx;
}
.code-label {
font-size: 28rpx;
color: #666;
display: block;
min-width: 140rpx;
flex-shrink: 0;
}
.code-input {
flex: 1;
:deep(.uni-easyinput__content) {
background-color: #f8f9fa;
border-radius: 6rpx;
height: 60rpx;
padding: 0 16rpx;
border: 1rpx solid #e9ecef;
&:focus-within {
border-color: #3B7FFF;
background-color: #fff;
}
}
:deep(.uni-easyinput__content-input) {
font-size: 26rpx;
color: #333;
}
}
.quantity-info {
font-size: 26rpx;
color: #666;
margin-left: 152rpx;
}
.material-content {
@@ -369,18 +608,43 @@
}
.popup-form {
margin-bottom: 30rpx;
}
.form-item {
margin-bottom: 20rpx;
margin-bottom: 30rpx;
}
.form-label {
font-size: 28rpx;
color: #333;
margin-bottom: 10rpx;
display: block;
font-size: 28rpx;
color: #333;
margin-bottom: 10rpx;
display: block;
}
/* 弹窗两列表单布局 */
.popup-form.grid {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.form-row {
display: flex;
gap: 20rpx;
}
.form-col {
flex: 1;
}
.form-col :deep(.uni-easyinput__content),
.form-col :deep(.uni-data-select) {
background-color: #f8f8f8;
border-radius: 8rpx;
height: 72rpx;
padding: 0 20rpx;
}
.form-col :deep(.uni-easyinput__content-input) {
font-size: 26rpx;
color: #333;
}
.popup-buttons {

View File

@@ -6,8 +6,8 @@
<image src="/static/images/tabbar/tray121.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('stocktaking.confirm.title') }}</text>
<text class="desc">{{ $t('stocktaking.confirm.desc') }}</text>
<text class="title">盘点确认</text>
<text class="desc">托盘物料盘点确认</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/pandian/pkconfirm')">
@@ -15,8 +15,8 @@
<image src="/static/images/tabbar/tray121.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('stocktaking.confirmPK.title') }}</text>
<text class="desc">{{ $t('stocktaking.confirmPK.desc') }}</text>
<text class="title">盘点确认(PK)</text>
<text class="desc">托盘物料盘点确认(PK)</text>
</view>
</view>
</view>

View File

@@ -5,13 +5,13 @@
v-model="selectedWarehouse"
:localdata="warehouseList"
:clear="false"
:placeholder="$t('stocktaking.confirmPK.selectWarehouse')"
placeholder="请选择仓库"
@change="handleWarehouseChange"
/>
</view>
<view class="add-button-container" v-if="selectedWarehouse!=''">
<button class="add-button" @click="showAddMaterialPopup">{{ $t('stocktaking.confirmPK.addMaterial') }}</button>
<button class="add-button" @click="showAddMaterialPopup">新增物料</button>
</view>
<view class="inventory-list" v-if="inventoryList.length > 0">
@@ -19,19 +19,19 @@
<uni-card>
<view class="card-content">
<view class="info-row">
<text class="label">{{ $t('stocktaking.confirmPK.materialCode') }}:</text>
<text class="label">物料编码:</text>
<text class="value">{{ item.extraField.productId }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('stocktaking.confirmPK.materialName') }}:</text>
<text class="label">物料名称:</text>
<text class="value">{{ item.extraField.materialDesc }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('stocktaking.confirmPK.inventoryQuantity') }}:</text>
<text class="label">库存数量:</text>
<text class="value">{{ item.quantity }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('stocktaking.confirmPK.countQuantity') }}:</text>
<text class="label">盘点数量:</text>
<view class="value">
<uni-easyinput
v-model.number="item.newQuantity"
@@ -43,7 +43,7 @@
</view>
</view>
<view class="button-row">
<button class="confirm-button" @click="handleConfirm(item)">{{ $t('stocktaking.confirmPK.countButton') }}</button>
<button class="confirm-button" @click="handleConfirm(item)">盘点</button>
</view>
</view>
</uni-card>
@@ -51,26 +51,26 @@
</view>
<view class="empty-state" v-else>
<text>{{ $t('stocktaking.confirmPK.noInventoryData') }}</text>
<text>暂无盘点数据</text>
</view>
<!-- 新增物料弹窗 -->
<uni-popup ref="addMaterialPopup" type="center">
<view class="popup-content">
<view class="popup-title">{{ $t('stocktaking.confirmPK.addMaterialTitle') }}</view>
<view class="popup-title">新增物料</view>
<view class="popup-form">
<view class="form-item">
<text class="form-label">{{ $t('stocktaking.confirmPK.materialCodeLabel') }}</text>
<uni-easyinput v-model="newMaterial.productId" :placeholder="$t('stocktaking.confirm.materialCodePlaceholder')" />
<text class="form-label">物料编码</text>
<uni-easyinput v-model="newMaterial.productId" placeholder="请输入物料编码" />
</view>
<view class="form-item">
<text class="form-label">{{ $t('stocktaking.confirmPK.quantityLabel') }}</text>
<uni-easyinput v-model="newMaterial.newQuantity" type="number" :placeholder="$t('stocktaking.confirm.quantityPlaceholder')" />
<text class="form-label">数量</text>
<uni-easyinput v-model="newMaterial.newQuantity" type="number" placeholder="请输入数量" />
</view>
</view>
<view class="popup-buttons">
<button class="cancel-btn" @click="hideAddMaterialPopup">{{ $t('stocktaking.confirmPK.cancel') }}</button>
<button class="submit-btn" @click="handleAddMaterial">{{ $t('stocktaking.confirmPK.confirm') }}</button>
<button class="cancel-btn" @click="hideAddMaterialPopup">取消</button>
<button class="submit-btn" @click="handleAddMaterial">确定</button>
</view>
</view>
</uni-popup>
@@ -122,7 +122,7 @@
} catch (error) {
console.error('获取仓库列表失败:', error)
uni.showToast({
title: this.$t('stocktaking.confirmPK.getWarehouseListFailed'),
title: '获取仓库列表失败',
icon: 'none'
})
}
@@ -144,7 +144,7 @@
} catch (error) {
console.error('获取库存列表失败:', error)
uni.showToast({
title: this.$t('stocktaking.confirmPK.getInventoryListFailed'),
title: '获取库存列表失败',
icon: 'none'
})
}
@@ -159,14 +159,14 @@
async handleConfirm(item) {
if (!item.newQuantity || item.newQuantity < 0) {
uni.showToast({
title: this.$t('stocktaking.confirmPK.enterValidCountQuantity'),
title: '请输入有效的盘点数量',
icon: 'none'
})
return
}
if(item.newQuantity==item.quantity){
uni.showToast({
title: this.$t('stocktaking.confirmPK.quantityMatch'),
title: '库存数量与盘点数量一致,无需盘点',
icon: 'none'
})
}
@@ -181,21 +181,21 @@
if (response.code === 200) {
uni.showToast({
title: this.$t('stocktaking.confirmPK.countSuccess'),
title: '盘点成功',
icon: 'success'
})
// 刷新库存列表
this.getInventoryList()
} else {
uni.showToast({
title: response.msg || this.$t('stocktaking.confirmPK.countFailed'),
title: response.msg || '盘点失败',
icon: 'none'
})
}
} catch (error) {
console.error('盘点失败:', error)
uni.showToast({
title: this.$t('stocktaking.confirmPK.countFailed'),
title: '盘点失败',
icon: 'none'
})
}
@@ -213,7 +213,7 @@
showAddMaterialPopup() {
if(!this.selectedWarehouse)
return uni.showToast({
title: this.$t('stocktaking.confirmPK.selectWarehouse'),
title: '请选择仓库',
icon: 'none'
})
this.$refs.addMaterialPopup.open()
@@ -233,7 +233,7 @@
async handleAddMaterial() {
if (!this.newMaterial.productId || !this.newMaterial.newQuantity || this.newMaterial.newQuantity < 0) {
uni.showToast({
title: this.$t('stocktaking.confirmPK.enterValidMaterialInfo'),
title: '请输入有效的物料信息',
icon: 'none'
})
return
@@ -249,7 +249,7 @@
if (response.code === 200) {
uni.showToast({
title: this.$t('stocktaking.confirmPK.addSuccess'),
title: '新增成功',
icon: 'success'
})
// 关闭弹窗并刷新列表
@@ -257,7 +257,7 @@
this.getInventoryList()
} else {
uni.showToast({
title: response.msg || this.$t('stocktaking.confirmPK.addFailed'),
title: response.msg || '新增失败',
icon: 'none'
})
}