|
|
@@ -170,6 +170,8 @@ const count=ref('')
|
|
|
const countRef= ref(null)
|
|
|
const countTrueFalseBy=ref(false)
|
|
|
const activeItem=ref({})
|
|
|
+// 存储需要跳转的库位(当弹框显示时扫描到库位)
|
|
|
+const pendingLocationJump=ref('')
|
|
|
//容器号ref
|
|
|
const scanCountRef = ref(null)
|
|
|
onMounted(() => {
|
|
|
@@ -363,6 +365,35 @@ const onScan = (type) => {
|
|
|
const barcodeCombineRef=ref(null)
|
|
|
//扫描条码监听
|
|
|
const _handlerScan=(code)=> {
|
|
|
+ // 如果数量弹框正在显示,检查是否需要自动确认
|
|
|
+ if (countTrueFalseBy.value) {
|
|
|
+ const modelLocative = locationList.value[activeIndex.value]
|
|
|
+
|
|
|
+ // 检查是否扫描到当前数据内的库位
|
|
|
+ let scannedLocation = code
|
|
|
+ if (locationContainerMap.value[barcodeToUpperCase(code)]) {
|
|
|
+ scannedLocation = locationContainerMap.value[barcodeToUpperCase(code)]
|
|
|
+ }
|
|
|
+ if (taskMap.value[barcodeToUpperCase(scannedLocation)]) {
|
|
|
+ // 扫描到当前任务中的库位,自动确认,接口成功后再跳转
|
|
|
+ pendingLocationJump.value = barcodeToUpperCase(scannedLocation)
|
|
|
+ onSubmitCount()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否扫描到当前库位内的商品条码
|
|
|
+ const barcodeList = [...new Set(
|
|
|
+ modelLocative.list
|
|
|
+ .flatMap(item => [item.barcode, item.barcodeAs])
|
|
|
+ .filter(value => value !== null)
|
|
|
+ )]
|
|
|
+ if (barcodeList.some(item => barcodeToUpperCase(item) === barcodeToUpperCase(code))) {
|
|
|
+ // 扫描到当前库位内的条码,自动确认
|
|
|
+ onSubmitCount()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(scanType.value===1){
|
|
|
if(code.split('-')[0]!=='JH'){
|
|
|
showToast({duration:5000,message:'请使用标准拣货容器'})
|
|
|
@@ -444,12 +475,8 @@ const _handlerScan=(code)=> {
|
|
|
onScan(4)
|
|
|
activeItem.value=activeBarcode
|
|
|
countTrueFalseBy.value=true
|
|
|
- setTimeout(()=>{
|
|
|
- countRef.value?.focus()
|
|
|
- },200)
|
|
|
// setTimeout(()=>{
|
|
|
- // //匹配到条码扣减库存
|
|
|
- // onCount(activeBarcode,0)
|
|
|
+ // countRef.value?.focus()
|
|
|
// },200)
|
|
|
}).catch(()=>{
|
|
|
const allOperationTimeExist = modelLocative.list.every(({ operationTime }) => operationTime);
|
|
|
@@ -465,11 +492,9 @@ const _handlerScan=(code)=> {
|
|
|
//匹配到条码扣减库存
|
|
|
activeItem.value=activeBarcode
|
|
|
countTrueFalseBy.value=true
|
|
|
- setTimeout(()=>{
|
|
|
- countRef.value?.focus()
|
|
|
- },200)
|
|
|
- // onCount(activeBarcode,0)
|
|
|
- // },200)
|
|
|
+ // setTimeout(()=>{
|
|
|
+ // countRef.value?.focus()
|
|
|
+ // },200)
|
|
|
}
|
|
|
}else{
|
|
|
//查询组合条码
|
|
|
@@ -687,7 +712,6 @@ const _setPickingDetail=(params,type)=>{
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- scanSuccess()
|
|
|
if(selectTask.value.length===taskItem.value.length){
|
|
|
showDialog({
|
|
|
title: '温馨提示',
|
|
|
@@ -702,12 +726,32 @@ const _setPickingDetail=(params,type)=>{
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+ // 如果任务全部完成,则不跳转,优先执行完成逻辑
|
|
|
+ if (selectTask.value.length === taskItem.value.length) {
|
|
|
+ pendingLocationJump.value = '' // 清空待跳转标记
|
|
|
+ scanSuccess()
|
|
|
+ } else {
|
|
|
+ // 检查是否有待跳转的库位(弹框显示时扫描库位的情况)
|
|
|
+ if (pendingLocationJump.value) {
|
|
|
+ nextTick(() => {
|
|
|
+ nextLocation.value = ''
|
|
|
+ activeIndex.value = locationList.value.findIndex(item => item.location === pendingLocationJump.value)
|
|
|
+ onScan(3)
|
|
|
+ scanSuccess()
|
|
|
+ pendingLocationJump.value = '' // 清空标记
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ scanSuccess()
|
|
|
+ }
|
|
|
+ }
|
|
|
}).catch((err)=> {
|
|
|
closeLoading()
|
|
|
scanBarcode.value = ''
|
|
|
onScan(4)
|
|
|
messageTips.value = err.message
|
|
|
scanError()
|
|
|
+ // 接口调用失败,清空待跳转库位标记
|
|
|
+ pendingLocationJump.value = ''
|
|
|
if(err.code=='ERR_NETWORK'){
|
|
|
messageTips.value = '网络开小车了,请稍后重试!'
|
|
|
}if(err.code=='ECONNABORTED'){
|