pda入库绑定选择,手动出库确认选择,盘点任务完成账务处理优化
This commit is contained in:
@@ -30,15 +30,31 @@
|
||||
<view class="scan-section">
|
||||
<view class="scan-header">
|
||||
<text class="scan-title">版辊信息</text>
|
||||
<view class="scan-btn" @click="startScan">
|
||||
<!-- <view class="scan-btn" @click="startScan">
|
||||
<uni-icons type="scan" size="18" color="#1890ff"></uni-icons>
|
||||
<text class="scan-btn-text">扫码</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="input-wrap">
|
||||
<uni-data-select class="sel"
|
||||
v-model="stockinId"
|
||||
:localdata="inStockinOptions"
|
||||
placeholder="请选择入库单据"
|
||||
@change="handleInStockinChange">
|
||||
</uni-data-select>
|
||||
<uni-data-select class="sel"
|
||||
v-model="barcode"
|
||||
:localdata="rollerNumberOptions"
|
||||
placeholder="请选择版辊号"
|
||||
@change="handleBarcode">
|
||||
</uni-data-select>
|
||||
<!-- <view class="input-wrap">
|
||||
<input class="scan-input" v-model="barcode" placeholder="请输入或扫描版辊编号"
|
||||
@confirm="handleBarcode" />
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <button class="btn-add" @click="addItem" :disabled="!this.barcode || !this.trayCode">
|
||||
<uni-icons type="plus" size="16" color="#fff"></uni-icons>
|
||||
<text class="btn-add-text">加入列表</text>
|
||||
</button> -->
|
||||
</view>
|
||||
|
||||
<!-- 当前扫码物料信息(待添加) -->
|
||||
@@ -60,10 +76,10 @@
|
||||
<text class="info-label">颜色</text>
|
||||
<text class="info-value">{{ currentMaterial.color }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<!-- <view class="info-row">
|
||||
<text class="info-label">色序</text>
|
||||
<text class="info-value">{{ currentMaterial.colorSequence }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="info-row">
|
||||
<text class="info-label">子单号</text>
|
||||
<text class="info-value">{{ currentMaterial.stockinDetailId }}</text>
|
||||
@@ -98,10 +114,10 @@
|
||||
<text class="item-label">辊号</text>
|
||||
<text class="item-value">{{ item.rollerNumber }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<!-- <view class="item-row">
|
||||
<text class="item-label">色序</text>
|
||||
<text class="item-value">{{ item.colorSequence }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="item-row">
|
||||
<text class="item-label">颜色</text>
|
||||
<text class="item-value">{{ item.color }}</text>
|
||||
@@ -141,7 +157,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialByDetailId, getMaterialByRollerNumber, submitBindTray, submitBindTrayMsg, submitAddInJob } from '@/api/warehouse/inbound'
|
||||
import { getMaterialByDetailId, getMaterialByRollerNumber, submitBindTray, submitBindTrayMsg, submitAddInJob, getInboundStockList, getDetailList } from '@/api/warehouse/inbound'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -150,60 +166,141 @@
|
||||
trayCode: '',
|
||||
// 当前扫码
|
||||
barcode: '',
|
||||
stockinId:'',
|
||||
currentMaterial: null,
|
||||
currentQty: '',
|
||||
// 已加入列表的物料
|
||||
items: []
|
||||
items: [],
|
||||
|
||||
inStockinOptions:[],
|
||||
rollerNumberOptions:[],
|
||||
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.taskNo) {
|
||||
this.taskNo = options.taskNo
|
||||
}
|
||||
// if (options.taskNo) {
|
||||
// this.taskNo = options.taskNo
|
||||
// this.getInStockinList()
|
||||
// }
|
||||
this.getInStockinList()
|
||||
},
|
||||
methods: {
|
||||
// 调用摄像头扫码
|
||||
startScan() {
|
||||
var that = this
|
||||
uni.scanCode({
|
||||
onlyFromCamera: false,
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
that.barcode = res.result
|
||||
that.handleBarcode()
|
||||
}
|
||||
})
|
||||
},
|
||||
startScan() {
|
||||
var that = this
|
||||
uni.scanCode({
|
||||
onlyFromCamera: false,
|
||||
scanType: ['barCode', 'qrCode'],
|
||||
success: function(res) {
|
||||
that.barcode = res.result
|
||||
that.handleBarcode()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//获取入库单据
|
||||
async getInStockinList() {
|
||||
try {
|
||||
// 发起请求,RuoYi 的分页接口通常返回 { rows: [], total: number }
|
||||
const res = await getInboundStockList({});
|
||||
|
||||
// 将后端返回的 rows 数据转换为 uni-data-select 需要的格式
|
||||
this.inStockinOptions = (res.rows || []).map(item => {
|
||||
return {
|
||||
value: item.stockinId, // 实际传给后端的值(如单据ID)
|
||||
text: item.stockinId // 显示给用户看的文本(如单据编号)
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('获取入库单列表失败:', error);
|
||||
uni.showToast({ title: '获取数据失败', icon: 'none' });
|
||||
}
|
||||
},
|
||||
|
||||
handleInStockinChange(value) {
|
||||
// 1. 参数 value 直接就是选中的 stockinId,无需 e.detail.value
|
||||
const stockinId = value;
|
||||
|
||||
// 2. 使用 v-model 时,组件会自动更新 this.stockinId,无需手动赋值
|
||||
// this.stockinId = value; (可省略)
|
||||
|
||||
// 3. 每次切换单据,清空并重置版辊号下拉框
|
||||
this.barcode = '';
|
||||
this.rollerNumberOptions = [];
|
||||
|
||||
// 4. 只有选中了值才去请求下级数据,且不要再重复请求入库单列表了
|
||||
if (stockinId) {
|
||||
this.fetchRollerNumberOptions(stockinId); // 传入正确的变量名
|
||||
}
|
||||
},
|
||||
|
||||
// 根据单据号获取版辊号列表
|
||||
async fetchRollerNumberOptions(stockinId) {
|
||||
try {
|
||||
const res = await getDetailList({ stockinId });
|
||||
// console.log(res)
|
||||
this.rollerNumberOptions = (res.data || []).map(item => {
|
||||
return {
|
||||
value: item.rollerNumber, // 实际传给后端的值(如单据ID)
|
||||
text: item.rollerNumber // 显示给用户看的文本(如单据编号)
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('获取版辊号失败,请检查单据明细:', error);
|
||||
}
|
||||
},
|
||||
|
||||
handleRollerNumberChange(value) {
|
||||
// 1. 参数 value 直接就是选中的 stockinId,无需 e.detail.value
|
||||
const rollerNumber = value;
|
||||
|
||||
// 4. 只有选中了值才去请求下级数据,且不要再重复请求入库单列表了
|
||||
if (value) {
|
||||
var that = this
|
||||
// getMaterialByDetailId(this.barcode).then(function(res) {
|
||||
getMaterialByRollerNumber(this.barcode).then(function(res) {
|
||||
that.currentMaterial = res.data
|
||||
that.currentQty = res.data.quantity ? String(res.data.quantity) : ''
|
||||
that.$modal.msgSuccess('物料信息获取成功')
|
||||
}).catch(function() {
|
||||
that.currentMaterial = null
|
||||
that.currentQty = ''
|
||||
// that.$modal.msg('未找到该入库子单信息')
|
||||
that.$modal.msg('未找到该版辊信息,可能是无单据明细或已绑定完成')
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 根据入库明细ID查询物料
|
||||
handleBarcode() {
|
||||
if (!this.barcode) {
|
||||
// this.$modal.msg('请输入入库子单号')
|
||||
this.$modal.msg('请输入版辊信息')
|
||||
return
|
||||
}
|
||||
var that = this
|
||||
// getMaterialByDetailId(this.barcode).then(function(res) {
|
||||
getMaterialByRollerNumber(this.barcode).then(function(res) {
|
||||
that.currentMaterial = res.data
|
||||
that.currentQty = res.data.quantity ? String(res.data.quantity) : ''
|
||||
that.$modal.msgSuccess('物料信息获取成功')
|
||||
}).catch(function() {
|
||||
that.currentMaterial = null
|
||||
that.currentQty = ''
|
||||
// that.$modal.msg('未找到该入库子单信息')
|
||||
that.$modal.msg('未找到该版辊信息,可能是无单据明细或已绑定完成')
|
||||
})
|
||||
},
|
||||
handleBarcode() {
|
||||
if (!this.barcode) {
|
||||
// this.$modal.msg('请输入入库子单号')
|
||||
this.$modal.msg('请输入版辊信息')
|
||||
return
|
||||
}
|
||||
var that = this
|
||||
// getMaterialByDetailId(this.barcode).then(function(res) {
|
||||
getMaterialByRollerNumber(this.barcode).then(function(res) {
|
||||
that.currentMaterial = res.data
|
||||
that.currentQty = res.data.quantity ? String(res.data.quantity) : ''
|
||||
that.$modal.msgSuccess('物料信息获取成功')
|
||||
}).catch(function() {
|
||||
that.currentMaterial = null
|
||||
that.currentQty = ''
|
||||
// that.$modal.msg('未找到该入库子单信息')
|
||||
that.$modal.msg('未找到该版辊信息,可能是无单据明细或已绑定完成')
|
||||
})
|
||||
},
|
||||
|
||||
// 将当前物料加入绑定列表
|
||||
addItem() {
|
||||
if (!this.currentMaterial) {
|
||||
this.$modal.msg('请先扫码查询物料')
|
||||
if (!this.trayCode) {
|
||||
this.$modal.msg('请输入或扫描托盘号')
|
||||
return
|
||||
}
|
||||
if (!this.currentQty || Number(this.currentQty) <= 0) {
|
||||
this.$modal.msg('请输入有效的绑定数量')
|
||||
if (!this.barcode) {
|
||||
this.$modal.msg('请选择要绑定的辊号')
|
||||
return
|
||||
}
|
||||
// 检查是否已存在相同子单
|
||||
@@ -219,7 +316,7 @@
|
||||
productId: this.currentMaterial.rollerNumber,
|
||||
// productName: this.currentMaterial.productName,
|
||||
rollerNumber: this.currentMaterial.rollerNumber,
|
||||
colorSequence: this.currentMaterial.colorSequence,
|
||||
// colorSequence: this.currentMaterial.colorSequence,
|
||||
color: this.currentMaterial.color,
|
||||
spec: this.currentMaterial.spec,
|
||||
quantity: Number(this.currentQty)
|
||||
|
||||
Reference in New Issue
Block a user