材料站OCR识别

This commit is contained in:
bb_pan 2025-09-11 10:04:07 +08:00
parent a570bec3c5
commit f93891ea26
3 changed files with 30 additions and 22 deletions

View File

@ -93,11 +93,9 @@
<uni-col :span="6"> <uni-col :span="6">
<button class="item-btn" type="primary" @click="handleRfid">RFID识别</button> <button class="item-btn" type="primary" @click="handleRfid">RFID识别</button>
</uni-col> </uni-col>
<!--
<uni-col :span="6"> <uni-col :span="6">
<button class="item-btn" type="primary" @click="ocrClick">OCR识别</button> <button class="item-btn" type="primary" @click="ocrClick">OCR识别</button>
</uni-col> </uni-col>
-->
</uni-row> </uni-row>
</view> </view>
<ScanQrCode <ScanQrCode
@ -541,7 +539,7 @@ const ocrClick = () => {
console.log('编码识别--', queryParams.value) console.log('编码识别--', queryParams.value)
uni.navigateTo({ uni.navigateTo({
url: `/pages/materialsStation/toolsLease/ocrScan/ocrOutScan?params=${JSON.stringify( url: `/pages/materialsStation/toolsLease/ocrScan/ocrOutScan?params=${JSON.stringify(
queryParams.value, { ...queryParams.value, proId: queryParamsTemp.value.proId },
)}`, )}`,
}) })
} }

View File

@ -36,14 +36,14 @@
</view> </view>
<view class="table-list-item"> <view class="table-list-item">
<uni-forms :model="codeData" label-width="100" :border="true"> <uni-forms :model="codeData" label-width="100" :border="true">
<uni-forms-item label="设备类型:" name="maName"> <uni-forms-item label="设备类型:" name="typeName">
<text style="height: 100%; display: flex; align-items: center">{{ <text style="height: 100%; display: flex; align-items: center">{{
codeData.maName codeData.typeName
}}</text> }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="规格型号:" name="maModel"> <uni-forms-item label="规格型号:" name="typeModelName">
<text style="height: 100%; display: flex; align-items: center">{{ <text style="height: 100%; display: flex; align-items: center">{{
codeData.maModel codeData.typeModelName
}}</text> }}</text>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="设备编码:" name="maCode"> <uni-forms-item label="设备编码:" name="maCode">
@ -105,7 +105,7 @@
<script> <script>
import { decryptWithSM4 } from '@/utils/sm' import { decryptWithSM4 } from '@/utils/sm'
import { getDeviceListAPI, getDeviceListAPINew } from '@/services/picking/outbound' import { getInfoByCodeApi } from '@/services/picking/outbound'
import ElectronicSeal from '@/components/ElectronicSeal/index.vue' import ElectronicSeal from '@/components/ElectronicSeal/index.vue'
export default { export default {
@ -176,7 +176,7 @@ export default {
addCode() { addCode() {
if (this.codeData.typeId != this.queryParams.typeId) { if (this.codeData.typeId != this.queryParams.typeId) {
uni.showToast({ uni.showToast({
title: `当前添加的 (${this.codeData.maName}) 类型不匹配, 请重新添加`, title: `当前添加的 (${this.codeData.typeName}) 类型不匹配, 请重新添加`,
icon: 'none', icon: 'none',
}) })
return return
@ -191,8 +191,8 @@ export default {
const params = { const params = {
maCode: this.codeData.maCode, maCode: this.codeData.maCode,
maId: this.codeData.maId, maId: this.codeData.maId,
typeName: this.codeData.maModel, typeName: this.codeData.typeModelName,
materialName: this.codeData.maName, materialName: this.codeData.typeName,
typeId: this.codeData.typeId, typeId: this.codeData.typeId,
outType: 4, outType: 4,
} }
@ -758,16 +758,17 @@ export default {
title: '加载中...', title: '加载中...',
mask: true, mask: true,
}) })
const res = await getDeviceListAPINew({ maCode: this.queryCodeParams.maCode }) const res = await getInfoByCodeApi({ maCode: this.queryCodeParams.maCode, proId: this.queryParams.proId })
console.log('🚀 ~ getCode ~ res:', res) console.log('🚀 ~ getCode ~ res:', res)
if (res.code === 200 && res.data && res.data.length > 0) { if (res.code === 200 && res.data.recordList && res.data.recordList.length > 0) {
this.optionList = res.data.map((option) => ({ this.optionList = res.data.recordList.map((option) => ({
value: option.maId, value: option.maId,
text: option.maCode, text: option.maCode,
})) }))
if (res.data.length === 1) { if (res.data.recordList.length === 1) {
this.codeData = res.data[0] this.codeData = res.data.recordList[0]
console.log('🚀 ~ getCode ~ this.codeData:', this.codeData)
} }
} else { } else {
uni.showToast({ uni.showToast({
@ -787,9 +788,9 @@ export default {
async changeTag() { async changeTag() {
if (!this.queryCodeParams.maId) return if (!this.queryCodeParams.maId) return
try { try {
const res = await getDeviceListAPINew({ maId: this.queryCodeParams.maId }) const res = await getInfoByCodeApi({ maId: this.queryCodeParams.maId, maCode: this.queryCodeParams.maCode, proId: this.queryParams.proId })
if (res.data && res.data.length !== 0) { if (res.data.recordList && res.data.recordList.length !== 0) {
this.codeData = res.data[0] this.codeData = res.data.recordList[0]
} }
} catch (error) { } catch (error) {
console.error('获取编号信息失败', error) console.error('获取编号信息失败', error)

View File

@ -116,6 +116,15 @@ export const getDeviceListAPINew = (data) => {
}) })
} }
// 材料站-OCR 编码识别
export const getInfoByCodeApi = (data) => {
return http({
method: 'GET',
url: '/material/material_lease_apply_info/getInfoByCode',
data,
})
}
export const backOutDetailsApi = (data) => { export const backOutDetailsApi = (data) => {
return http({ return http({
method: 'POST', method: 'POST',