标准箱

This commit is contained in:
hongchao 2025-06-17 08:50:46 +08:00
parent c341db3674
commit 3706fc63c4
6 changed files with 190 additions and 127 deletions

View File

@ -24,7 +24,7 @@ import { onMounted, reactive, ref } from 'vue'
import { appLoginAPI, getUserInfoAPI, iwsLoginAPI } from '@/services/index.js'
import { useMemberStore } from '@/stores'
const memberStore = useMemberStore()
const origin = []
const origin = window.location.href
//
const loginForm = reactive({
username: uni.getStorageSync('username'),

View File

@ -25,9 +25,9 @@
<uni-col :span="6">
<view class="coding-btn" @click="codeScan">二维码识别</view>
</uni-col>
<!-- <uni-col :span="6">
<uni-col :span="6">
<view class="coding-btn" @click="boxScan">标准箱识别</view>
</uni-col> -->
</uni-col>
</uni-row>
</view>
<scan-qr-code
@ -35,6 +35,12 @@
@scanSuccess="handleScanSuccess"
@scanError="handleScanError"
/>
<ScanQrCodeBox
ref="scanQrCodeRefBox"
@scanSuccessBox="handleScanSuccessBox"
@scanErrorBox="handleScanErrorBox"
/>
<scroll-view scroll-y @scrolltolower="onScrollTolower" style="padding-bottom: 50rpx">
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.id">
<uni-row :gutter="24">
@ -85,7 +91,7 @@ import { getInfoBindByCode, appWarehouseApi } from '@/services/standard.js'
import { getTypeByQrcode } from '@/services/new-purchase/bind.js'
import { onBackPress, onLoad, onShow } from '@dcloudio/uni-app'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
import ScanQrCodeBox from '@/pages/devicesSearch/ScanQrCodeBox.vue'
const codeDeviceList = ref([])
const total = ref(0) //
// const query = defineProps() //
@ -96,6 +102,7 @@ const boxInfo = ref({})
const qrCode = ref('')
const maInfo = ref({})
const scanQrCodeRef = ref(null)
const scanQrCodeRefBox = ref(null)
// const typeId = ref('')
// const taskId = ref('')
// const maTypeName = ref('')
@ -236,35 +243,56 @@ const confirmCodeInBound = async () => {
//
const boxScan = async () => {
boxCode.value = ''
var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
mpaasScanModule.mpaasScan(
{
// qrCodebarCode
scanType: ['qrCode', 'barCode'],
// false
hideAlbum: false,
//ios zh-Hansen
language: 'en',
//(ios)
failedMsg: '未识别到二维码,请重试',
//Android
screenType: 'full',
},
(ret) => {
console.log(ret)
if (ret.resp_code == 10) {
uni.showToast({ title: '用户取消', icon: 'none' })
}
if (ret.resp_code == 11) {
uni.showToast({ title: '扫码失败', icon: 'none' })
}
if (ret.resp_code == 1000) {
boxCode.value = ret.resp_result
boxInBound()
}
},
)
if (scanQrCodeRefBox.value) {
scanQrCodeRefBox.value.scanQrCode()
}
// var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
// mpaasScanModule.mpaasScan(
// {
// // qrCodebarCode
// scanType: ['qrCode', 'barCode'],
// // false
// hideAlbum: false,
// //ios zh-Hansen
// language: 'en',
// //(ios)
// failedMsg: '',
// //Android
// screenType: 'full',
// },
// (ret) => {
// console.log(ret)
// if (ret.resp_code == 10) {
// uni.showToast({ title: '', icon: 'none' })
// }
// if (ret.resp_code == 11) {
// uni.showToast({ title: '', icon: 'none' })
// }
// if (ret.resp_code == 1000) {
// boxCode.value = ret.resp_result
// boxInBound()
// }
// },
// )
}
//
const handleScanSuccessBox = (result) => {
boxCode.value = result?.text || ''
if (boxCode.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
boxInBound()
}
}
//
const handleScanErrorBox = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
//
const boxInBound = async () => {
if (boxCode.value == '') {
@ -275,7 +303,7 @@ const boxInBound = async () => {
maTypeId: queryParams.value.typeId,
}
const res = await getInfoBindByCode(param)
console.log(res)
uni.showToast({ title: JSON.stringify(res, null, 2), icon: 'none' })
if (res.code == 200) {
boxInfo.value = res.data
uni.showModal({
@ -284,11 +312,9 @@ const boxInBound = async () => {
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
if (boxInfo.value.successMaTotal > 0) {
confirmBoxInBound()
}
}
},
})
} else {

View File

@ -50,8 +50,8 @@
/>
<ScanQrCodeBox
ref="scanQrCodeRefBox"
@scanSuccess="handleScanSuccessBox"
@scanError="handleScanErrorBox"
@scanSuccessBox="handleScanSuccessBox"
@scanErrorBox="handleScanErrorBox"
/>
<view class="table-list-item">
<uni-row :gutter="24" style="display: flex; align-items: center">

View File

@ -9,12 +9,21 @@
<uni-col :span="6">
<view class="coding-btn" @click="codeScan">二维码识别</view>
</uni-col>
<!-- <uni-col :span="6">
<uni-col :span="6">
<view class="coding-btn" @click="boxScan">标准箱识别</view>
</uni-col> -->
</uni-col>
</uni-row>
</view>
<ScanQrCode
ref="scanQrCodeRef"
@scanSuccess="handleScanSuccess"
@scanError="handleScanError"
/>
<ScanQrCodeBox
ref="scanQrCodeRefBox"
@scanSuccessBox="handleScanSuccessBox"
@scanErrorBox="handleScanErrorBox"
/>
<view class="card" style="margin-top: 10px;">
<view style="font-size: 32rpx;font-weight: 600;margin-bottom: 20rpx;">设备信息</view>
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 10px;">
@ -85,8 +94,9 @@
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getCodeListApi,repairInputWarehouseApi,rejectWarehouseApi,getInfoByQrcodeApi,repairInputWarehouseApiTwo } from '@/services/repair/testedInBound.js'
import { getBoxCodeListApi } from '@/services/standard.js'
import { getBoxCodeListApi,sanQrBoxInputApi } from '@/services/standard.js'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
import ScanQrCodeBox from '@/pages/devicesSearch/ScanQrCodeBox.vue'
const taskInfo = ref({})
const maId = ref("") //
const maCode = ref("") //
@ -99,60 +109,51 @@ const maInfo = ref({}) //二维码
const boxCode = ref("") //
const boxInfo = ref([])
const scanQrCodeRef = ref(null)
const scanQrCodeRefBox = ref(null)
//
const ocrScan = () => {
}
//
const codeScan = async () => {
qrCode.value=""
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
uni.scanCode({
success: function (res) {
// qrCode.value = res.resp_result.split("qrcode=")[1];
console.log('条码内容:' + res.result);
qrCode.value = res.result
codeInBound()
}
});
// mpaasScanModule.mpaasScan({
// // qrCodebarCode
// 'scanType': ['qrCode','barCode'],
// // false
// 'hideAlbum': false,
// //ios zh-Hansen
// 'language' : 'en',
// //(ios)
// 'failedMsg': '',
// //Android
// 'screenType': 'full'
// },(ret) => {
// console.log(ret)
// if(ret.resp_code==10){
// uni.showToast({ title: '', icon: 'none' })
// maInfo.value = {}
// }
// if(ret.resp_code==11){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==1000){
// // uni.showToast({ title: '', icon: 'none' })
// qrCode.value = ret.resp_result.split("qrcode=")[1];
// codeInBound()
// }
// // uni.showModal({
// // title: "",
// // // resp_code 10111000
// // // resp_message
// // // resp_result
// // content: JSON.stringify(ret),
// // showCancel: false,
// // confirmText: ""
// // })
// })
//
const codeScan = () => {
if (scanQrCodeRef.value) {
scanQrCodeRef.value.scanQrCode()
}
}
//
const handleScanSuccess = (result) => {
qrCode.value = result?.text || ''
if (qrCode.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
codeInBound()
}
}
//
const handleScanError = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
//
// const codeScan = async () => {
// qrCode.value=""
// // var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// uni.scanCode({
// success: function (res) {
// // qrCode.value = res.resp_result.split("qrcode=")[1];
// console.log('' + res.result);
// qrCode.value = res.result
// codeInBound()
// }
// });
// }
//
const codeInBound = async () => {
if(qrCode.value==""){
@ -205,36 +206,59 @@ const cinfirmCodeInBound = async () => {
}
}
}
//
const boxScan = async () => {
boxCode.value=""
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
mpaasScanModule.mpaasScan({
// qrCodebarCode
'scanType': ['qrCode','barCode'],
// false
'hideAlbum': false,
//ios zh-Hansen
'language' : 'en',
//(ios)
'failedMsg': '未识别到二维码,请重试',
//Android
'screenType': 'full'
},(ret) => {
console.log(ret)
if(ret.resp_code==10){
uni.showToast({ title: '用户取消', icon: 'none' })
}
if(ret.resp_code==11){
uni.showToast({ title: '扫码失败', icon: 'none' })
}
if(ret.resp_code==1000){
boxCode.value = ret.resp_result;
boxInBound()
}
})
if (scanQrCodeRefBox.value) {
scanQrCodeRefBox.value.scanQrCode()
}
}
//
const handleScanSuccessBox = (result) => {
boxCode.value = result?.text || ''
if (boxCode.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
boxInBound()
}
}
//
const handleScanErrorBox = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
//
// const boxScan = async () => {
// boxCode.value=""
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
// mpaasScanModule.mpaasScan({
// // qrCodebarCode
// 'scanType': ['qrCode','barCode'],
// // false
// 'hideAlbum': false,
// //ios zh-Hansen
// 'language' : 'en',
// //(ios)
// 'failedMsg': '',
// //Android
// 'screenType': 'full'
// },(ret) => {
// console.log(ret)
// if(ret.resp_code==10){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==11){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==1000){
// boxCode.value = ret.resp_result;
// boxInBound()
// }
// })
// }
//
const boxInBound = async () => {
if(boxCode.value==""){
@ -242,25 +266,22 @@ const boxInBound = async () => {
}else{
let param = {
boxCode: boxCode.value,
maTypeId:queryParams.value.typeId
// maTypeId:queryParams.value.typeId
}
const res = await getBoxCodeListApi(param)
console.log(res)
if(res.code==200){
if(res.data.length>0){
let successMaTotal = res.data.length
boxInfo.value = res.data
uni.showModal({
title: '提示',
content: `监测到${boxCode.value}标准箱中符合入库条件设备${boxInfo.value.successMaTotal}台,是否确定入库?`,
content: `监测到${boxCode.value}标准箱中符合入库条件设备${successMaTotal}台,是否确定入库?`,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
if(boxInfo.value.successMaTotal>0){
confirmBoxInBound()
}
}
if(successMaTotal>0){
confirmBoxInBound()
}
}
})
@ -274,7 +295,15 @@ const boxInBound = async () => {
}
//
const confirmBoxInBound = async () => {
let param = {
boxCode: boxCode.value,
}
const res = await sanQrBoxInputApi(param)
if(res.code==200){
uni.showToast({ title: '入库成功', icon: 'none'})
}else{
uni.showToast({ title: '入库失败', icon: 'none'})
}
}

View File

@ -313,6 +313,7 @@ const confirmTransfer = () => {
"inputUser":transferUser.value,
}
console.log(param)
appTransferApi(param).then(res => {
console.log(res)
if(res.code=200){

View File

@ -119,7 +119,14 @@ export const appTransferRejectApi = (data)=> {
})
}
// 标准箱识别--确认入库
export const sanQrBoxInputApi = (data) => {
return http({
method: 'POST',
url: '/material/repair_input_details/sanQrBoxInput',
data:data,
})
}