Ver código fonte

库存并库init

zh 3 meses atrás
pai
commit
bcc18c68d0
2 arquivos alterados com 71 adições e 3 exclusões
  1. 14 0
      src/api/location/merge.ts
  2. 57 3
      src/views/robot/merge/index.vue

+ 14 - 0
src/api/location/merge.ts

@@ -69,3 +69,17 @@ export function boxInbound(warehouse: string) {
     params: { warehouse }
   })
 }
+
+/**
+ * 重新下发指定站点和料箱的任务
+ * @param warehouse 仓库
+ * @param stationCode 站点编码
+ * @param boxCode 料箱编码
+ */
+export function reissueTask(warehouse: string, stationCode: string, boxCode: string) {
+  return request<boolean>({
+    url: '/api/wms/location/merge/reissueTask',
+    method: 'post',
+    params: { warehouse, stationCode, boxCode }
+  })
+}

+ 57 - 3
src/views/robot/merge/index.vue

@@ -62,7 +62,7 @@
       </div>
       <div class="table-row">
         <div class="cell label">目标库位</div>
-        <div class="cell value input-cell">
+        <div class="cell value input-cell input-wide">
           <van-field
             ref="targetLocationInputRef"
             v-model="productInfo.targetLocationNew"
@@ -111,7 +111,7 @@
               'box-selected': selectedBox === station.stationCode,
               'box-split': station.splitCount
             }"
-            @click="!station.splitCount && station.status !== 'offline' && selectStation(station)"
+                        @click="handleStationClick(station)"
           >
             <!-- 分割的料箱 -->
             <template v-if="station.splitCount && station.subLocations">
@@ -199,7 +199,7 @@ 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, type BoxRelatedMergeDetailsVO, type LocationMergeDetails } from '@/api/location/merge'
+import { getWorkingDetailsByBox, getBoxSplitCode, boxInbound, reissueTask, type BoxRelatedMergeDetailsVO, type LocationMergeDetails } from '@/api/location/merge'
 import { getInventory, inventoryMovement } from '@/api/inventory'
 import { showConfirmDialog } from 'vant'
 
@@ -732,6 +732,56 @@ const currentLocation = reactive({
   relatedLocations: [] as LocationRecommendInfo[]
 })
 
+// 点击站台处理
+const handleStationClick = (station: StationItem) => {
+  // 分割的料箱不处理,由子库位处理
+  if (station.splitCount) return
+  // 离线状态不可点击
+  if (station.status === 'offline') return
+  // 异常状态弹出重新下发确认框
+  if (station.status === 'error') {
+    showReissueConfirm(station)
+    return
+  }
+  // 其他状态正常选择
+  selectStation(station)
+}
+
+// 显示重新下发确认框
+const showReissueConfirm = (station: StationItem) => {
+  showConfirmDialog({
+    title: '重新下发任务',
+    message: `站台${station.displayNumber}的料箱出现异常,是否重新下发任务?`
+  })
+    .then(() => {
+      doReissueTask(station)
+    })
+    .catch(() => {
+      // 用户取消
+    })
+}
+
+// 执行重新下发任务
+const doReissueTask = async (station: StationItem) => {
+  if (!station.boxCode) {
+    showToast('料箱编码不存在')
+    return
+  }
+  try {
+    showLoadingToast({ message: '正在重新下发...', forbidClick: true })
+    await reissueTask(warehouse, station.stationCode, station.boxCode)
+    closeToast()
+    showToast('重新下发成功')
+    // 重新加载料箱数据
+    if (boxCode.value) {
+      loadBoxData(boxCode.value)
+    }
+  } catch (error: any) {
+    closeToast()
+    showToast(error.message || '重新下发失败')
+  }
+}
+
 // 选择站台(对于未分割的料箱,库位编码等于料箱编码)
 const selectStation = (station: StationItem) => {
   if (station.status === 'waiting' || station.status === 'emptyBox' || station.status === 'offline') return
@@ -978,6 +1028,10 @@ const submitMove = () => {
     &.value-large {
       flex: 1.4;
     }
+
+    &.input-wide {
+      flex: 1.13;
+    }
   }
 }