|
@@ -956,6 +956,56 @@ const stopPolling = () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 静默刷新盒子数据(调用getWorkingDetailsByBox更新库存信息)
|
|
|
|
|
+const refreshBoxData = async () => {
|
|
|
|
|
+ if (!boxCode.value) return
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 调用 getWorkingDetailsByBox 获取最新任务详情
|
|
|
|
|
+ const res = await getWorkingDetailsByBox(boxCode.value, warehouse)
|
|
|
|
|
+ const boxDetailsList: BoxRelatedMergeDetailsVO[] = res.data || []
|
|
|
|
|
+
|
|
|
|
|
+ if (boxDetailsList.length === 0) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 保存返回的数据
|
|
|
|
|
+ mergeDataList.value = boxDetailsList
|
|
|
|
|
+
|
|
|
|
|
+ // 遍历 mergeDetails 取源库位和目标库位,去重
|
|
|
|
|
+ const locationSet = new Set<string>()
|
|
|
|
|
+ boxDetailsList.forEach(boxDetail => {
|
|
|
|
|
+ boxDetail.mergeDetails?.forEach((detail: LocationMergeDetails) => {
|
|
|
|
|
+ if (detail.sourceLocation) locationSet.add(detail.sourceLocation)
|
|
|
|
|
+ if (detail.targetLocation) locationSet.add(detail.targetLocation)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const locations = Array.from(locationSet)
|
|
|
|
|
+
|
|
|
|
|
+ if (locations.length > 0) {
|
|
|
|
|
+ // 调用 getBoxSplitCode 获取库位分割信息
|
|
|
|
|
+ const splitRes = await getBoxSplitCode(warehouse, locations)
|
|
|
|
|
+ const splitMap: Record<string, number> = splitRes.data || {}
|
|
|
|
|
+
|
|
|
|
|
+ // 构建可点击库位信息
|
|
|
|
|
+ buildClickableLocationsMap(boxDetailsList)
|
|
|
|
|
+
|
|
|
|
|
+ // 更新站台区域
|
|
|
|
|
+ updateStationList(boxDetailsList, splitMap)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 检查是否需要启动轮询
|
|
|
|
|
+ if (hasWaitingBox()) {
|
|
|
|
|
+ startPolling()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ stopPolling()
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('刷新盒子数据失败', error)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 执行重新下发任务
|
|
// 执行重新下发任务
|
|
|
const doReissueTask = async (station: StationItem) => {
|
|
const doReissueTask = async (station: StationItem) => {
|
|
|
if (!station.boxCode) {
|
|
if (!station.boxCode) {
|
|
@@ -1201,11 +1251,20 @@ const submitMove = () => {
|
|
|
toLocation: productInfo.targetLocationNew
|
|
toLocation: productInfo.targetLocationNew
|
|
|
}
|
|
}
|
|
|
showLoadingToast({ message: '提交中...', forbidClick: true })
|
|
showLoadingToast({ message: '提交中...', forbidClick: true })
|
|
|
|
|
+ // 保存移库前的数据用于判断是否清空
|
|
|
|
|
+ const movedQty = Number(productInfo.actualMoveQty)
|
|
|
|
|
+ const availableQty = Number(productInfo.moveQty)
|
|
|
inventoryMovement(data)
|
|
inventoryMovement(data)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
closeToast()
|
|
closeToast()
|
|
|
scanSuccess()
|
|
scanSuccess()
|
|
|
showToast('提交移库成功')
|
|
showToast('提交移库成功')
|
|
|
|
|
+ // 如果源库位被清空,更新盒子信息
|
|
|
|
|
+ if (movedQty >= availableQty) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ refreshBoxData()
|
|
|
|
|
+ }, 500)
|
|
|
|
|
+ }
|
|
|
// 重置除料箱号外的数据,继续下一个移库
|
|
// 重置除料箱号外的数据,继续下一个移库
|
|
|
resetExceptBoxCode()
|
|
resetExceptBoxCode()
|
|
|
})
|
|
})
|