|
|
@@ -202,6 +202,13 @@ import { useStore } from '@/store/modules/user'
|
|
|
import { getWorkingDetailsByBox, getBoxSplitCode, boxInbound, reissueTask, getBoxStatus, type BoxRelatedMergeDetailsVO, type LocationMergeDetails } from '@/api/location/merge'
|
|
|
import { getInventory, inventoryMovement } from '@/api/inventory'
|
|
|
import { showConfirmDialog } from 'vant'
|
|
|
+import { getHeader, androidFocus, scanError, scanSuccess } from '@/utils/android'
|
|
|
+
|
|
|
+try {
|
|
|
+ getHeader()
|
|
|
+ androidFocus()
|
|
|
+} catch (error) {
|
|
|
+}
|
|
|
|
|
|
const store = useStore()
|
|
|
const warehouse = store.warehouse
|
|
|
@@ -227,6 +234,11 @@ let pollingTimer: ReturnType<typeof setInterval> | null = null
|
|
|
|
|
|
// 页面初始化
|
|
|
onMounted(() => {
|
|
|
+ // 检查仓库是否已选择
|
|
|
+ if (!warehouse) {
|
|
|
+ showToast('请先选择仓库')
|
|
|
+ return
|
|
|
+ }
|
|
|
openListener()
|
|
|
scanInit(_handlerScan)
|
|
|
// 获取焦点
|
|
|
@@ -376,17 +388,20 @@ const onBarcodeEnter = async () => {
|
|
|
productInfo.expiryDate = inventoryData.lotAtt02 || inventoryData.expiryDate || ''
|
|
|
productInfo.moveQty = inventoryData.quantityAvailable || inventoryData.quantity || ''
|
|
|
|
|
|
+ scanSuccess()
|
|
|
showToast('商品信息获取成功')
|
|
|
// 切换到扫描目标库位
|
|
|
scanType.value = 4
|
|
|
focusTargetLocationInput()
|
|
|
} else {
|
|
|
+ scanError()
|
|
|
showToast('未找到库存信息')
|
|
|
currentInventoryData.value = null
|
|
|
resetProductInfo()
|
|
|
}
|
|
|
} catch (error: any) {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast(error.message || '查询失败')
|
|
|
}
|
|
|
}
|
|
|
@@ -444,6 +459,7 @@ const loadBoxData = async (code: string) => {
|
|
|
|
|
|
if (boxDetailsList.length === 0) {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast('未找到相关任务')
|
|
|
return
|
|
|
}
|
|
|
@@ -475,6 +491,7 @@ const loadBoxData = async (code: string) => {
|
|
|
}
|
|
|
|
|
|
closeToast()
|
|
|
+ scanSuccess()
|
|
|
|
|
|
// 加载完成后检查是否需要启动轮询
|
|
|
if (hasWaitingBox()) {
|
|
|
@@ -486,6 +503,7 @@ const loadBoxData = async (code: string) => {
|
|
|
focusSourceLocationInput()
|
|
|
} catch (error: any) {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast(error.message || '加载失败')
|
|
|
}
|
|
|
}
|
|
|
@@ -853,6 +871,7 @@ const stopPolling = () => {
|
|
|
// 执行重新下发任务
|
|
|
const doReissueTask = async (station: StationItem) => {
|
|
|
if (!station.boxCode) {
|
|
|
+ scanError()
|
|
|
showToast('料箱编码不存在')
|
|
|
return
|
|
|
}
|
|
|
@@ -860,6 +879,7 @@ const doReissueTask = async (station: StationItem) => {
|
|
|
showLoadingToast({ message: '正在重新下发...', forbidClick: true })
|
|
|
await reissueTask(warehouse, station.stationCode, station.boxCode)
|
|
|
closeToast()
|
|
|
+ scanSuccess()
|
|
|
showToast('重新下发成功')
|
|
|
// 局部刷新料箱状态
|
|
|
setTimeout(() => {
|
|
|
@@ -867,6 +887,7 @@ const doReissueTask = async (station: StationItem) => {
|
|
|
}, 500)
|
|
|
} catch (error: any) {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast(error.message || '重新下发失败')
|
|
|
}
|
|
|
}
|
|
|
@@ -879,6 +900,7 @@ const selectStation = (station: StationItem) => {
|
|
|
|
|
|
// 检查是否可点击
|
|
|
if (!isLocationClickable(locationCode)) {
|
|
|
+ scanError()
|
|
|
showToast('该库位不在合并任务中')
|
|
|
return
|
|
|
}
|
|
|
@@ -933,9 +955,11 @@ const callRobot = async () => {
|
|
|
showLoadingToast({ message: '正在呼唤机器人...', forbidClick: true })
|
|
|
await boxInbound(warehouse)
|
|
|
closeToast()
|
|
|
+ scanSuccess()
|
|
|
showToast('呼唤机器人成功')
|
|
|
} catch (error: any) {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast(error.message || '呼唤机器人失败')
|
|
|
}
|
|
|
}
|
|
|
@@ -948,26 +972,32 @@ const resetInput = () => {
|
|
|
// 提交移库
|
|
|
const submitMove = () => {
|
|
|
if (!boxCode.value) {
|
|
|
+ scanError()
|
|
|
showToast('请先扫描料箱号')
|
|
|
return
|
|
|
}
|
|
|
if (!sourceLocation.value) {
|
|
|
+ scanError()
|
|
|
showToast('请先扫描源库位')
|
|
|
return
|
|
|
}
|
|
|
if (!productInfo.barcode) {
|
|
|
+ scanError()
|
|
|
showToast('请先扫描商品条码')
|
|
|
return
|
|
|
}
|
|
|
if (!productInfo.targetLocationNew) {
|
|
|
+ scanError()
|
|
|
showToast('请先选择目标库位')
|
|
|
return
|
|
|
}
|
|
|
if (!productInfo.moveQty || Number(productInfo.moveQty) <= 0) {
|
|
|
+ scanError()
|
|
|
showToast('请输入有效的移库数量')
|
|
|
return
|
|
|
}
|
|
|
if (Number(productInfo.moveQty) > Number(productInfo.stockQty)) {
|
|
|
+ scanError()
|
|
|
showToast('移库数量不能大于库存数量')
|
|
|
return
|
|
|
}
|
|
|
@@ -992,12 +1022,14 @@ const submitMove = () => {
|
|
|
inventoryMovement(data)
|
|
|
.then(() => {
|
|
|
closeToast()
|
|
|
+ scanSuccess()
|
|
|
showToast('提交移库成功')
|
|
|
// 重置除料箱号外的数据,继续下一个移库
|
|
|
resetExceptBoxCode()
|
|
|
})
|
|
|
.catch((err: any) => {
|
|
|
closeToast()
|
|
|
+ scanError()
|
|
|
showToast(err.message || '提交移库失败')
|
|
|
})
|
|
|
})
|