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