将每一步的钢卷二维码进行保存,新步骤采用新码
This commit is contained in:
@@ -32,9 +32,18 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 历史码提示 -->
|
||||||
|
<view class="warning-card" v-if="form.coilId && qrcodeStatus === 0">
|
||||||
|
<view class="warning-icon">⚠️</view>
|
||||||
|
<view class="warning-content">
|
||||||
|
<text class="warning-title">历史二维码</text>
|
||||||
|
<text class="warning-desc">此二维码已失效,不允许进行分卷操作</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 分卷列表 -->
|
<!-- 分卷列表 -->
|
||||||
<view class="form-card" v-if="form.coilId" @click="closeWarehouseList">
|
<view class="form-card" v-if="form.coilId && qrcodeStatus === 1" @click="closeWarehouseList">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
<text class="title-dot"></text>
|
<text class="title-dot"></text>
|
||||||
<text class="title-text">分卷配置</text>
|
<text class="title-text">分卷配置</text>
|
||||||
@@ -215,7 +224,8 @@ export default {
|
|||||||
warehouseSearchKeyword: '',
|
warehouseSearchKeyword: '',
|
||||||
filteredWarehousesInPicker: [],
|
filteredWarehousesInPicker: [],
|
||||||
currentPickerItemIndex: -1,
|
currentPickerItemIndex: -1,
|
||||||
loading: false
|
loading: false,
|
||||||
|
qrcodeStatus: 1 // 二维码状态:0=历史码,1=当前有效码
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -348,6 +358,19 @@ export default {
|
|||||||
const enterCoilNo = content.enter_coil_no;
|
const enterCoilNo = content.enter_coil_no;
|
||||||
const currentCoilNo = content.current_coil_no;
|
const currentCoilNo = content.current_coil_no;
|
||||||
|
|
||||||
|
// 保存二维码状态
|
||||||
|
this.qrcodeStatus = qrcodeRecord.status || 1;
|
||||||
|
|
||||||
|
// 如果是历史码,直接拒绝
|
||||||
|
if (this.qrcodeStatus === 0) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '历史二维码',
|
||||||
|
content: '此二维码已失效,不允许进行分卷操作,请使用最新二维码',
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!enterCoilNo) {
|
if (!enterCoilNo) {
|
||||||
throw new Error('二维码中未包含有效的入场钢卷号');
|
throw new Error('二维码中未包含有效的入场钢卷号');
|
||||||
}
|
}
|
||||||
@@ -478,6 +501,16 @@ export default {
|
|||||||
|
|
||||||
// 提交分卷
|
// 提交分卷
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
|
// 历史二维码不允许分卷
|
||||||
|
if (this.qrcodeStatus === 0) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '历史二维码',
|
||||||
|
content: '此二维码已失效,不允许进行分卷操作,请使用最新二维码',
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 验证所有分卷都有钢卷号和班组
|
// 验证所有分卷都有钢卷号和班组
|
||||||
for (let i = 0; i < this.splitCoils.length; i++) {
|
for (let i = 0; i < this.splitCoils.length; i++) {
|
||||||
if (!this.splitCoils[i].currentCoilNo) {
|
if (!this.splitCoils[i].currentCoilNo) {
|
||||||
|
|||||||
@@ -11,6 +11,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</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="coil-list" v-if="scannedCoils.length > 0">
|
||||||
<view class="card-title">
|
<view class="card-title">
|
||||||
@@ -20,11 +29,12 @@
|
|||||||
|
|
||||||
<view class="coil-item" v-for="(coil, index) in scannedCoils" :key="index">
|
<view class="coil-item" v-for="(coil, index) in scannedCoils" :key="index">
|
||||||
<view class="coil-content">
|
<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-info">
|
||||||
<view class="coil-row">
|
<view class="coil-row">
|
||||||
<text class="coil-label">入场钢卷号:</text>
|
<text class="coil-label">入场钢卷号:</text>
|
||||||
<text class="coil-value">{{ coil.enterCoilNo }}</text>
|
<text class="coil-value">{{ coil.enterCoilNo }}</text>
|
||||||
|
<text class="history-tag" v-if="coil.qrcodeStatus === 0">历史码</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="coil-row">
|
<view class="coil-row">
|
||||||
<text class="coil-label">当前钢卷号:</text>
|
<text class="coil-label">当前钢卷号:</text>
|
||||||
@@ -184,6 +194,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
// 是否包含历史二维码
|
||||||
|
hasHistoryQrcode() {
|
||||||
|
return this.scannedCoils.some(coil => coil.qrcodeStatus === 0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.loadWarehouses();
|
this.loadWarehouses();
|
||||||
},
|
},
|
||||||
@@ -299,6 +316,17 @@ export default {
|
|||||||
const content = JSON.parse(qrcodeRecord.content);
|
const content = JSON.parse(qrcodeRecord.content);
|
||||||
const enterCoilNo = content.enter_coil_no;
|
const enterCoilNo = content.enter_coil_no;
|
||||||
const currentCoilNo = content.current_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) {
|
if (!enterCoilNo) {
|
||||||
throw new Error('二维码中未包含有效的入场钢卷号');
|
throw new Error('二维码中未包含有效的入场钢卷号');
|
||||||
@@ -341,6 +369,10 @@ export default {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存二维码状态到钢卷数据中
|
||||||
|
coilData.qrcodeStatus = qrcodeStatus;
|
||||||
|
|
||||||
this.scannedCoils.push(coilData);
|
this.scannedCoils.push(coilData);
|
||||||
|
|
||||||
console.log('钢卷详情:', coilData);
|
console.log('钢卷详情:', coilData);
|
||||||
@@ -403,6 +435,16 @@ export default {
|
|||||||
|
|
||||||
// 提交合卷
|
// 提交合卷
|
||||||
handleConfirm() {
|
handleConfirm() {
|
||||||
|
// 检查是否包含历史二维码
|
||||||
|
if (this.hasHistoryQrcode) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '包含历史二维码',
|
||||||
|
content: '列表中包含已失效的二维码,不允许进行合卷操作,请移除后重试',
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 验证
|
// 验证
|
||||||
if (this.scannedCoils.length < 2) {
|
if (this.scannedCoils.length < 2) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -592,6 +634,10 @@ export default {
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&.index-history {
|
||||||
|
background: #999;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.coil-info {
|
.coil-info {
|
||||||
@@ -599,6 +645,7 @@ export default {
|
|||||||
|
|
||||||
.coil-row {
|
.coil-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@@ -616,6 +663,15 @@ export default {
|
|||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.history-tag {
|
||||||
|
font-size: 20rpx;
|
||||||
|
padding: 2rpx 10rpx;
|
||||||
|
background: #f8d7da;
|
||||||
|
color: #721c24;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,17 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 历史码提示 -->
|
||||||
|
<view class="warning-card" v-if="form.coilId && qrcodeStatus === 0">
|
||||||
|
<view class="warning-icon">⚠️</view>
|
||||||
|
<view class="warning-content">
|
||||||
|
<text class="warning-title">历史二维码</text>
|
||||||
|
<text class="warning-desc">此二维码已失效,已为您加载最新物料信息,仅可查看,无法修改</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 历史数据提示 -->
|
<!-- 历史数据提示 -->
|
||||||
<view class="warning-card" v-if="form.coilId && coilDetail.dataType === 0">
|
<view class="warning-card" v-if="form.coilId && coilDetail.dataType === 0 && qrcodeStatus !== 0">
|
||||||
<view class="warning-icon">⚠️</view>
|
<view class="warning-icon">⚠️</view>
|
||||||
<view class="warning-content">
|
<view class="warning-content">
|
||||||
<text class="warning-title">历史数据</text>
|
<text class="warning-title">历史数据</text>
|
||||||
@@ -67,8 +76,8 @@
|
|||||||
v-model="form.currentCoilNo"
|
v-model="form.currentCoilNo"
|
||||||
placeholder="请输入当前钢卷号"
|
placeholder="请输入当前钢卷号"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
:disabled="coilDetail.dataType === 0"
|
:disabled="coilDetail.dataType === 0 || qrcodeStatus === 0"
|
||||||
:class="{ 'form-input-disabled': coilDetail.dataType === 0 }"
|
:class="{ 'form-input-disabled': coilDetail.dataType === 0 || qrcodeStatus === 0 }"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -79,8 +88,8 @@
|
|||||||
v-model="form.team"
|
v-model="form.team"
|
||||||
placeholder="请输入班组名称"
|
placeholder="请输入班组名称"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
:disabled="coilDetail.dataType === 0"
|
:disabled="coilDetail.dataType === 0 || qrcodeStatus === 0"
|
||||||
:class="{ 'form-input-disabled': coilDetail.dataType === 0 }"
|
:class="{ 'form-input-disabled': coilDetail.dataType === 0 || qrcodeStatus === 0 }"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -89,13 +98,13 @@
|
|||||||
<text class="form-label-optional">目标库区</text>
|
<text class="form-label-optional">目标库区</text>
|
||||||
<view
|
<view
|
||||||
class="picker-input"
|
class="picker-input"
|
||||||
@click="coilDetail.dataType !== 0 && showWarehousePicker()"
|
@click="(coilDetail.dataType !== 0 && qrcodeStatus !== 0) && showWarehousePicker()"
|
||||||
:class="{ 'picker-input-disabled': coilDetail.dataType === 0 }"
|
:class="{ 'picker-input-disabled': coilDetail.dataType === 0 || qrcodeStatus === 0 }"
|
||||||
>
|
>
|
||||||
<text class="picker-text" :class="{ 'picker-placeholder': !currentWarehouseName }">
|
<text class="picker-text" :class="{ 'picker-placeholder': !currentWarehouseName }">
|
||||||
{{ currentWarehouseName || '请选择目标库区' }}
|
{{ currentWarehouseName || '请选择目标库区' }}
|
||||||
</text>
|
</text>
|
||||||
<text class="picker-arrow" v-if="coilDetail.dataType !== 0">▼</text>
|
<text class="picker-arrow" v-if="coilDetail.dataType !== 0 && qrcodeStatus !== 0">▼</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -107,8 +116,8 @@
|
|||||||
type="digit"
|
type="digit"
|
||||||
placeholder="请输入毛重(选填)"
|
placeholder="请输入毛重(选填)"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
:disabled="coilDetail.dataType === 0"
|
:disabled="coilDetail.dataType === 0 || qrcodeStatus === 0"
|
||||||
:class="{ 'form-input-disabled': coilDetail.dataType === 0 }"
|
:class="{ 'form-input-disabled': coilDetail.dataType === 0 || qrcodeStatus === 0 }"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -120,8 +129,8 @@
|
|||||||
type="digit"
|
type="digit"
|
||||||
placeholder="请输入净重(选填)"
|
placeholder="请输入净重(选填)"
|
||||||
class="form-input"
|
class="form-input"
|
||||||
:disabled="coilDetail.dataType === 0"
|
:disabled="coilDetail.dataType === 0 || qrcodeStatus === 0"
|
||||||
:class="{ 'form-input-disabled': coilDetail.dataType === 0 }"
|
:class="{ 'form-input-disabled': coilDetail.dataType === 0 || qrcodeStatus === 0 }"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -135,7 +144,7 @@
|
|||||||
<view class="action-buttons">
|
<view class="action-buttons">
|
||||||
<button class="btn btn-secondary" @click="handleReset">重新扫码</button>
|
<button class="btn btn-secondary" @click="handleReset">重新扫码</button>
|
||||||
<button
|
<button
|
||||||
v-if="coilDetail.dataType === 1"
|
v-if="coilDetail.dataType === 1 && qrcodeStatus === 1"
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
@click="handleConfirm"
|
@click="handleConfirm"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@@ -237,7 +246,8 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
currentWarehouseName: '',
|
currentWarehouseName: '',
|
||||||
warehouseSearchKeyword: '',
|
warehouseSearchKeyword: '',
|
||||||
filteredWarehousesInPicker: [],
|
filteredWarehousesInPicker: [],
|
||||||
loading: false
|
loading: false,
|
||||||
|
qrcodeStatus: 1 // 二维码状态:0=历史码,1=当前有效码
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -337,8 +347,8 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 扫码
|
// 扫码
|
||||||
handleScan() {
|
handleScan() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
console.log('扫码结果:', res.result);
|
console.log('扫码结果:', res.result);
|
||||||
try {
|
try {
|
||||||
@@ -357,23 +367,46 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
const enterCoilNo = content.enter_coil_no;
|
const enterCoilNo = content.enter_coil_no;
|
||||||
const currentCoilNo = content.current_coil_no;
|
const currentCoilNo = content.current_coil_no;
|
||||||
|
|
||||||
|
// 保存二维码状态(0=历史码,1=当前有效码)
|
||||||
|
this.qrcodeStatus = qrcodeRecord.status || 1;
|
||||||
|
|
||||||
if (!enterCoilNo) {
|
if (!enterCoilNo) {
|
||||||
throw new Error('二维码中未包含有效的入场钢卷号');
|
throw new Error('二维码中未包含有效的入场钢卷号');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 通过入场钢卷号和当前钢卷号查询最新的钢卷详情
|
// 3. 如果是历史码,提示用户并加载最新数据
|
||||||
// 使用追溯接口来获取准确的钢卷信息
|
if (this.qrcodeStatus === 0) {
|
||||||
const traceRes = await getMaterialCoilTrace(enterCoilNo, currentCoilNo);
|
uni.showToast({
|
||||||
|
title: '历史二维码,已加载最新信息',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 通过入场钢卷号查询最新的钢卷详情(不传currentCoilNo,获取所有相关钢卷)
|
||||||
|
// 如果是历史码,查询该入场钢卷号的最新数据
|
||||||
|
const traceRes = await getMaterialCoilTrace(enterCoilNo, this.qrcodeStatus === 0 ? null : currentCoilNo);
|
||||||
if (traceRes.code !== 200 || !traceRes.data || !traceRes.data.records || traceRes.data.records.length === 0) {
|
if (traceRes.code !== 200 || !traceRes.data || !traceRes.data.records || traceRes.data.records.length === 0) {
|
||||||
throw new Error('未找到钢卷信息');
|
throw new Error('未找到钢卷信息');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 从追溯结果中找到当前数据(dataType = 1)且匹配当前钢卷号的记录
|
// 5. 从追溯结果中找到当前数据(dataType = 1)
|
||||||
let coilData = null;
|
let coilData = null;
|
||||||
for (const record of traceRes.data.records) {
|
if (this.qrcodeStatus === 0) {
|
||||||
if (record.dataType === 1 && record.currentCoilNo === currentCoilNo) {
|
// 历史码:找到最新的当前数据(dataType = 1)
|
||||||
coilData = record;
|
for (const record of traceRes.data.records) {
|
||||||
break;
|
if (record.dataType === 1) {
|
||||||
|
coilData = record;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 当前码:找到匹配当前钢卷号的记录
|
||||||
|
for (const record of traceRes.data.records) {
|
||||||
|
if (record.dataType === 1 && record.currentCoilNo === currentCoilNo) {
|
||||||
|
coilData = record;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +454,7 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log('钢卷详情:', coilData);
|
console.log('钢卷详情:', coilData);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '扫码成功',
|
title: '扫码成功',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
});
|
});
|
||||||
@@ -436,9 +469,9 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('扫码失败:', err);
|
console.error('扫码失败:', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '扫码失败,请重试',
|
title: '扫码失败,请重试',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -483,6 +516,7 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
this.warehouseKeyword = '';
|
this.warehouseKeyword = '';
|
||||||
this.currentWarehouseName = '';
|
this.currentWarehouseName = '';
|
||||||
this.filteredWarehouses = this.warehouses;
|
this.filteredWarehouses = this.warehouses;
|
||||||
|
this.qrcodeStatus = 1; // 重置二维码状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -496,6 +530,12 @@ import { getRawMaterial } from '@/api/wms/rawMaterial.js'
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 历史二维码不允许修改
|
||||||
|
if (this.qrcodeStatus === 0) {
|
||||||
|
uni.showToast({ title: '历史二维码不允许修改', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 验证必填项
|
// 验证必填项
|
||||||
if (!this.form.currentCoilNo) {
|
if (!this.form.currentCoilNo) {
|
||||||
uni.showToast({ title: '请输入当前钢卷号', icon: 'none' });
|
uni.showToast({ title: '请输入当前钢卷号', icon: 'none' });
|
||||||
|
|||||||
Reference in New Issue
Block a user