将每一步的钢卷二维码进行保存,新步骤采用新码

This commit is contained in:
2025-10-30 12:33:06 +08:00
parent 181309e553
commit 7ea75aef84
3 changed files with 160 additions and 31 deletions

View File

@@ -11,6 +11,15 @@
</view>
</view>
<!-- 历史码提示 -->
<view class="warning-card" v-if="hasHistoryQrcode">
<view class="warning-icon"></view>
<view class="warning-content">
<text class="warning-title">包含历史二维码</text>
<text class="warning-desc">列表中包含已失效的二维码不允许进行合卷操作请移除后重试</text>
</view>
</view>
<!-- 已扫描的钢卷列表 -->
<view class="coil-list" v-if="scannedCoils.length > 0">
<view class="card-title">
@@ -20,11 +29,12 @@
<view class="coil-item" v-for="(coil, index) in scannedCoils" :key="index">
<view class="coil-content">
<view class="coil-index">{{ index + 1 }}</view>
<view class="coil-index" :class="{ 'index-history': coil.qrcodeStatus === 0 }">{{ index + 1 }}</view>
<view class="coil-info">
<view class="coil-row">
<text class="coil-label">入场钢卷号</text>
<text class="coil-value">{{ coil.enterCoilNo }}</text>
<text class="history-tag" v-if="coil.qrcodeStatus === 0">历史码</text>
</view>
<view class="coil-row">
<text class="coil-label">当前钢卷号</text>
@@ -184,6 +194,13 @@ export default {
}
},
computed: {
// 是否包含历史二维码
hasHistoryQrcode() {
return this.scannedCoils.some(coil => coil.qrcodeStatus === 0);
}
},
onLoad() {
this.loadWarehouses();
},
@@ -299,6 +316,17 @@ export default {
const content = JSON.parse(qrcodeRecord.content);
const enterCoilNo = content.enter_coil_no;
const currentCoilNo = content.current_coil_no;
const qrcodeStatus = qrcodeRecord.status || 1;
// 如果是历史码,提示用户
if (qrcodeStatus === 0) {
uni.showModal({
title: '历史二维码',
content: '此二维码已失效,不允许进行合卷操作,请使用最新二维码',
showCancel: false
});
return;
}
if (!enterCoilNo) {
throw new Error('二维码中未包含有效的入场钢卷号');
@@ -341,6 +369,10 @@ export default {
});
return;
}
// 保存二维码状态到钢卷数据中
coilData.qrcodeStatus = qrcodeStatus;
this.scannedCoils.push(coilData);
console.log('钢卷详情:', coilData);
@@ -403,6 +435,16 @@ export default {
// 提交合卷
handleConfirm() {
// 检查是否包含历史二维码
if (this.hasHistoryQrcode) {
uni.showModal({
title: '包含历史二维码',
content: '列表中包含已失效的二维码,不允许进行合卷操作,请移除后重试',
showCancel: false
});
return;
}
// 验证
if (this.scannedCoils.length < 2) {
uni.showToast({
@@ -592,6 +634,10 @@ export default {
font-size: 24rpx;
font-weight: bold;
flex-shrink: 0;
&.index-history {
background: #999;
}
}
.coil-info {
@@ -599,6 +645,7 @@ export default {
.coil-row {
display: flex;
align-items: center;
margin-bottom: 8rpx;
&:last-child {
@@ -616,6 +663,15 @@ export default {
color: #333;
font-weight: 500;
}
.history-tag {
font-size: 20rpx;
padding: 2rpx 10rpx;
background: #f8d7da;
color: #721c24;
border-radius: 8rpx;
margin-left: 10rpx;
}
}
}
}