zh 2 mēneši atpakaļ
vecāks
revīzija
1d7920303f

+ 23 - 3
src/api/location/merge.ts

@@ -59,18 +59,26 @@ export function getBoxSplitCode(warehouse: string, locations: string[]) {
   })
 }
 
+/**
+ * 料箱回库结果
+ */
+export interface BoxInboundResult {
+  t1: string // 料箱编码
+  t2: string // 执行结果消息
+}
+
 /**
  * 执行料箱回库(呼唤机器人)
  * @param warehouse 仓库
  * @param boxCodes 可选的料箱编码列表,如果不传则回库所有料箱
  */
-export function boxInbound(warehouse: string, boxCodes?: string[]) {
+export function boxInbound(warehouse: string, boxCodes?: string[]): Promise<BoxInboundResult[]> {
   const params: any = { warehouse }
   if (boxCodes && boxCodes.length > 0) {
     params.boxCodes = boxCodes
   }
 
-  return request<[string, string][]>({
+  return request<BoxInboundResult[]>({
     url: '/api/wms/location/merge/boxInbound',
     method: 'post',
     params,
@@ -140,4 +148,16 @@ export function getWorkingMergeTasks(warehouse: string) {
     method: 'get',
     params: { warehouse }
   })
-}
+}
+
+/**
+ * 海康-站点解绑
+ * @param data
+ */
+export function boxAndStationUnbindTask(params:any) {
+  return request({
+    url: '/api/wms/location/merge/boxAndStationUnbindTask',
+    method: 'post',
+    params
+  })
+}

+ 32 - 3
src/views/robot/merge/components/BoxSelectionDialog.vue

@@ -67,6 +67,8 @@ import { ref, computed } from 'vue'
 import { showToast, showLoadingToast, closeToast } from 'vant'
 import { boxInbound } from '@/api/location/merge'
 import { scanError, scanSuccess } from '@/utils/android'
+import { log } from 'console'
+import { BoxInboundResult } from '@/api/location/merge.ts'
 
 interface Props {
   boxList: string[]
@@ -128,12 +130,39 @@ const confirmSelection = async () => {
 
   try {
     showLoadingToast({ message: '正在呼唤机器人...', forbidClick: true })
-    await boxInbound(props.warehouse, checkedBoxes.value)
+    const { data } = await boxInbound(props.warehouse, checkedBoxes.value)
     closeToast()
-    scanSuccess()
-    showToast('呼唤机器人成功')
+    // 显示详细结果
+    let message = '呼唤机器人结果:\n'
+    data.forEach((item: BoxInboundResult) => {
+      message += `${item.t1}: ${item.t2}\n`
+    })
+
+    // 判断整体结果
+    const hasSuccess = data.some((item: BoxInboundResult) =>
+      item.t2.includes('回库成功')
+    )
+    const hasFailure = data.some((item: BoxInboundResult) =>
+      !item.t2.includes('回库成功')
+    )
+
+    if (hasSuccess && !hasFailure) {
+      // 全部成功
+      scanSuccess()
+      showToast(message.trim())
+    } else if (!hasSuccess && hasFailure) {
+      // 全部失败
+      scanError()
+      showToast(message.trim())
+    } else {
+      // 部分成功
+      scanSuccess()
+      showToast(message.trim())
+    }
+
     show.value = false
     emit('success')
+
   } catch (error: any) {
     closeToast()
     scanError()

+ 20 - 22
src/views/robot/merge/index.vue

@@ -129,12 +129,12 @@
                   'box-waiting': station.status === 'waiting',
                   'box-error': station.status === 'error',
                   'box-selected': selectedBox === station.stationCode,
-                  'box-split': station.splitCount && station.status !== 'error' && station.status !== 'waiting'
+                  'box-split': station.splitCount && ['offline', 'filled', 'emptyBox'].includes(station.status)
                 }"
                 @click="handleStationClick(station)"
               >
                 <!-- 分割的料箱(异常/等待调箱状态不渲染分割) -->
-                <template v-if="station.splitCount && station.subLocations && station.status !== 'error' && station.status !== 'waiting'">
+                <template v-if="station.splitCount && station.subLocations && ['offline', 'filled', 'emptyBox'].includes(station.status)">
                   <div class="sub-grid" :style="getSubGridStyle(station.splitCount)">
                     <div
                       v-for="sub in station.subLocations"
@@ -176,12 +176,12 @@
                   'box-waiting': station.status === 'waiting',
                   'box-error': station.status === 'error',
                   'box-selected': selectedBox === station.stationCode,
-                  'box-split': station.splitCount && station.status !== 'error' && station.status !== 'waiting'
+                  'box-split': station.splitCount && ['offline', 'filled', 'emptyBox'].includes(station.status)
                 }"
                 @click="handleStationClick(station)"
               >
                 <!-- 分割的料箱(异常/等待调箱状态不渲染分割) -->
-                <template v-if="station.splitCount && station.subLocations && station.status !== 'error' && station.status !== 'waiting'">
+                <template v-if="station.splitCount && station.subLocations && ['offline', 'filled', 'emptyBox'].includes(station.status)">
                   <div class="sub-grid" :style="getSubGridStyle(station.splitCount)">
                     <div
                       v-for="sub in station.subLocations"
@@ -211,7 +211,7 @@
     <div class="footer-buttons">
       <van-button class="btn-robot" size="small" @click="callRobot">呼唤机器人</van-button>
       <div class="btn-right">
-        <van-button type="primary" class="btn-reset" size="small" @click="resetInput">重新输入</van-button>
+        <van-button type="primary" class="btn-reset" size="small" @click="resetAllData">重新输入</van-button>
         <van-button class="btn-submit" size="small" @click="submitMove">提交移库</van-button>
       </div>
     </div>
@@ -277,9 +277,8 @@ import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
 import { onMounted, onUnmounted, ref, reactive, nextTick } from 'vue'
 import { showToast, showLoadingToast, closeToast } from 'vant'
 import { useStore } from '@/store/modules/user'
-import { getWorkingDetailsByBox, getBoxSplitCode, boxInbound, reissueTask, getBoxStatus, type BoxRelatedMergeDetailsVO, type LocationMergeDetails } from '@/api/location/merge'
+import { getWorkingDetailsByBox, getBoxSplitCode, boxAndStationUnbindTask, reissueTask, getBoxStatus, type BoxRelatedMergeDetailsVO, type LocationMergeDetails } from '@/api/location/merge'
 import { getInventory, inventoryMovement } from '@/api/inventory'
-import { boxAndStationUnbindTask } from '@/api/haikang'
 import { showConfirmDialog } from 'vant'
 import { getHeader, androidFocus, goBack, scanError, scanSuccess } from '@/utils/android'
 import MergeTaskDetailsDialog from './components/MergeTaskDetailsDialog.vue'
@@ -531,6 +530,7 @@ const resetAllData = () => {
   mergeDataList.value = []
   clickableLocationsMap.value = new Map()
   resetProductInfo()
+  productInfo.targetLocationNew = '' // 清空目标库位
   initStations()
   scanType.value = 1
   focusBoxCodeInput()
@@ -817,7 +817,7 @@ const updateStationList = (boxDetailsList: BoxRelatedMergeDetailsVO[], splitMap:
       status = 'offline'
     } else if (boxStatus === 40) {
       status = 'error'
-      label = '异'
+      label = '调库'
     }
 
     // 获取分割数量
@@ -904,7 +904,7 @@ const handleStationClick = (station: StationItem) => {
     return
   }
   // 空料箱状态弹出解绑确认框(仅当料箱无分割,即料箱即库位时才能触发)
-  if (station.status === 'emptyBox' && (!station.splitCount || station.splitCount === 1)) {
+  if (station.status === 'emptyBox') {
     showUnbindConfirm(station)
     return
   }
@@ -918,7 +918,7 @@ const handleStationClick = (station: StationItem) => {
 const showReissueConfirm = (station: StationItem) => {
   showConfirmDialog({
     title: '重新下发任务',
-    message: `站台${station.displayNumber}的料箱出现异常,是否重新下发任务?`
+    message: `料箱${station.boxCode}调用海康异常,是否重新下发任务?`
   })
     .then(() => {
       doReissueTask(station)
@@ -949,8 +949,7 @@ const doUnbindTask = async (station: StationItem) => {
     const data = {
       warehouse,
       boxCode: station.boxCode,
-      stationCode: station.stationCode,
-      releaseStation: false
+      stationCode: station.stationCode
     }
     await boxAndStationUnbindTask(data)
     closeToast()
@@ -1014,7 +1013,7 @@ const refreshBoxStatus = async () => {
         status = 'offline'
       } else if (newBoxStatus === 40) {
         status = 'error'
-        label = '异'
+        label = '调库'
       }
 
       return { ...station, status, label }
@@ -1156,6 +1155,11 @@ const selectSubLocation = (station: StationItem, sub: SubLocation) => {
     return
   }
 
+  if (station.status === 'emptyBox') {
+    showUnbindConfirm(station)
+    return
+  }
+
   selectedBox.value = sub.locationCode
 
   // 获取库位推荐信息
@@ -1210,7 +1214,7 @@ const currentBoxList = ref<string[]>([])
 // 料箱选择成功
 const onBoxSelectionSuccess = () => {
   // 重置页面数据并聚焦到料箱输入框
-  resetAllData()
+  refreshBoxData()
 }
 
 
@@ -1301,11 +1305,6 @@ const callRobot = () => {
   boxSelectionDialogRef.value?.showDialog()
 }
 
-// 重新输入(不重置料箱号)
-const resetInput = () => {
-  resetExceptBoxCode()
-}
-
 // 提交移库
 const submitMove = () => {
   if (!boxCode.value) {
@@ -1421,7 +1420,7 @@ const submitMove = () => {
 }
 
 .station-tabs {
-  margin-bottom: 12px;
+  margin-bottom: 50px;
   background: #fff;
   border-radius: 4px;
   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
@@ -1613,12 +1612,11 @@ const submitMove = () => {
     }
 
         &.box-error {
-      background: #ffcccc;
       border-color: #ff6666;
       cursor: pointer;
 
       .box-label {
-        color: #cc0000;
+        color: #ff6666;
       }
     }