问题修改
This commit is contained in:
parent
a021fbbc0f
commit
030aa30b97
|
|
@ -119,6 +119,7 @@
|
||||||
<script>
|
<script>
|
||||||
import ImageUtils from "../../services/utils/imageUtils";
|
import ImageUtils from "../../services/utils/imageUtils";
|
||||||
import {decryptWithSM4} from "../../utils/sm";
|
import {decryptWithSM4} from "../../utils/sm";
|
||||||
|
import {getDeviceListAPI} from "../../services/picking/outbound";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -525,7 +526,6 @@ export default {
|
||||||
console.log("resData.data.result",resData.data.result)
|
console.log("resData.data.result",resData.data.result)
|
||||||
|
|
||||||
if (resData.code===0){
|
if (resData.code===0){
|
||||||
console.log(111111)
|
|
||||||
if (resData.data.result) {
|
if (resData.data.result) {
|
||||||
this.queryCodeParams.maCode = resData.data.result
|
this.queryCodeParams.maCode = resData.data.result
|
||||||
await this.closeCamera();
|
await this.closeCamera();
|
||||||
|
|
@ -554,55 +554,6 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// const response = await new Promise((resolve, reject)=>
|
|
||||||
// {
|
|
||||||
// uni.request({
|
|
||||||
// url: '/material/app/ocr/getOcrCode',
|
|
||||||
// method: 'POST',
|
|
||||||
// data: {
|
|
||||||
// image: cleanBase64,
|
|
||||||
// jiju_type: '',
|
|
||||||
// auth_lic: 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4='
|
|
||||||
// },
|
|
||||||
// header: {
|
|
||||||
// "Content-Type": "application/json;charset=UTF-8"
|
|
||||||
// },
|
|
||||||
// timeout: 30000,
|
|
||||||
// success: resolve,
|
|
||||||
// fail: reject
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// console.log("response",response);
|
|
||||||
// console.log("response.data",response.data);
|
|
||||||
//
|
|
||||||
// // 建议的解析逻辑
|
|
||||||
// if (response.data?.code === 0) {
|
|
||||||
// const ocrData = response.data.data;
|
|
||||||
// if (ocrData?.result) {
|
|
||||||
// this.queryCodeParams.maCode = ocrData.result;
|
|
||||||
// await this.closeCamera();
|
|
||||||
// this.getCode();
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '识别成功',
|
|
||||||
// icon: 'success'
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '未识别到有效编码',
|
|
||||||
// icon: 'none'
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // 处理HTTP或业务错误
|
|
||||||
// const errorMsg = response.data?.msg || 'OCR识别失败';
|
|
||||||
// uni.showToast({
|
|
||||||
// title: errorMsg,
|
|
||||||
// icon: 'none'
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('图片处理或OCR识别失败:', error);
|
console.error('图片处理或OCR识别失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -682,39 +633,62 @@ export default {
|
||||||
// quality: 50,
|
// quality: 50,
|
||||||
// outputFormat: 'base64'
|
// outputFormat: 'base64'
|
||||||
// });
|
// });
|
||||||
|
|
||||||
console.log('相册图片处理完成,开始OCR识别...');
|
console.log('相册图片处理完成,开始OCR识别...');
|
||||||
const response = await new Promise((resolve, reject)=>
|
|
||||||
{
|
uni.request({
|
||||||
uni.request({
|
url: '/material/app/ocr/getOcrCode',
|
||||||
url: '/material/app/ocr/getOcrCode',
|
method: 'POST',
|
||||||
method: 'POST',
|
data: {
|
||||||
data: {
|
image: processedBase64,
|
||||||
image: processedBase64,
|
jiju_type: '',
|
||||||
jiju_type: '',
|
auth_lic: 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4='
|
||||||
auth_lic: 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4='
|
},
|
||||||
},
|
header: {
|
||||||
timeout: 30000,
|
"Content-Type": "application/json;charset=UTF-8"
|
||||||
success: resolve,
|
},
|
||||||
fail: reject
|
success: async (res) => {
|
||||||
});
|
if (!res.data.code){
|
||||||
}
|
res=JSON.parse(decryptWithSM4(res.data))
|
||||||
);
|
} else {
|
||||||
console.log("response",response.data);
|
res =res.data
|
||||||
if (response.data?.data?.result) {
|
}
|
||||||
this.queryCodeParams.maCode = response.data.data.result;
|
console.log("res", res);
|
||||||
await this.closeCamera();
|
console.log("res.data",res.data)
|
||||||
this.getCode();
|
const {data: resData} = res
|
||||||
uni.showToast({
|
console.log("resData",resData)
|
||||||
title: '识别成功',
|
console.log("resData.data",resData.data)
|
||||||
icon: 'success'
|
console.log("resData.code",resData.code)
|
||||||
});
|
console.log("resData.data.result",resData.data.result)
|
||||||
} else {
|
|
||||||
uni.showToast({
|
if (resData.code===0){
|
||||||
title: '未识别到有效编码',
|
if (resData.data.result) {
|
||||||
icon: 'none'
|
this.queryCodeParams.maCode = resData.data.result
|
||||||
});
|
await this.closeCamera();
|
||||||
}
|
await this.getCode();
|
||||||
|
await uni.showToast({
|
||||||
|
title: '识别成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '识别失败!' + resData.data.msg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '识别失败!',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请求失败:' + err.errMsg,
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('相册图片处理或OCR识别失败:', error);
|
console.error('相册图片处理或OCR识别失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -736,33 +710,61 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const response = await new Promise((resolve, reject)=>
|
getDeviceListAPI({'maCode': this.queryCodeParams.maCode}).then(response => {
|
||||||
{
|
console.log("xxxxxxxxxxx",response)
|
||||||
uni.request({
|
if (response.data && response.data.length !== 0) {
|
||||||
url: '/material/ma_machine/getHisByCode',
|
this.optionList = response.data.data.map(option => ({
|
||||||
method: 'GET',
|
value: option.maId,
|
||||||
data: {maCode: this.queryCodeParams.maCode},
|
text: option.maCode
|
||||||
success: resolve,
|
}));
|
||||||
fail: reject
|
if (response.data.data.length === 1) {
|
||||||
});
|
this.codeData = response.data.data[0];
|
||||||
}
|
}
|
||||||
)
|
}else{
|
||||||
;
|
uni.showToast({
|
||||||
|
title: '未查询到该编号信息',
|
||||||
if (response.data?.data && response.data.data.length > 0) {
|
icon: 'none',
|
||||||
this.optionList = response.data.data.map(option => ({
|
duration: 2000
|
||||||
value: option.maId,
|
})
|
||||||
text: option.maCode
|
|
||||||
}));
|
|
||||||
if (response.data.data.length === 1) {
|
|
||||||
this.codeData = response.data.data[0];
|
|
||||||
}
|
}
|
||||||
} else {
|
}).catch(error => {
|
||||||
uni.showToast({
|
console.error("获取设备信息失败", error)
|
||||||
title: '未查询到该编号信息',
|
uni.hideLoading()
|
||||||
icon: 'none'
|
})
|
||||||
});
|
|
||||||
}
|
// const response = await new Promise((resolve, reject)=>
|
||||||
|
// {
|
||||||
|
// uni.request({
|
||||||
|
// url: '/material/ma_machine/getHisByCode',
|
||||||
|
// method: 'GET',
|
||||||
|
// data: {maCode: this.queryCodeParams.maCode},
|
||||||
|
// success: resolve,
|
||||||
|
// fail: reject
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// ;
|
||||||
|
// let res;
|
||||||
|
// if (!response.data.code) {
|
||||||
|
// res=JSON.parse(decryptWithSM4(res.data))
|
||||||
|
// } else {
|
||||||
|
// res =res.data
|
||||||
|
// }
|
||||||
|
// console.log("res", res);
|
||||||
|
// if (response.data?.data && response.data.data.length > 0) {
|
||||||
|
// this.optionList = response.data.data.map(option => ({
|
||||||
|
// value: option.maId,
|
||||||
|
// text: option.maCode
|
||||||
|
// }));
|
||||||
|
// if (response.data.data.length === 1) {
|
||||||
|
// this.codeData = response.data.data[0];
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '未查询到该编号信息',
|
||||||
|
// icon: 'none'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('查询失败:', error);
|
console.error('查询失败:', error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue