Selaa lähdekoodia

拣货-增加库位容器支持库位容器扫描

zhaohuanhuan 7 kuukautta sitten
vanhempi
commit
2b54b45cfb
2 muutettua tiedostoa jossa 39 lisäystä ja 2 poistoa
  1. 5 0
      src/utils/dataType.js
  2. 34 2
      src/views/outbound/picking/list/index.vue

+ 5 - 0
src/utils/dataType.js

@@ -12,6 +12,11 @@ export function toMap(data, key, val=undefined, optional = {}) {
   }
   // 遍历数据
   data.forEach(item => {
+    // 跳过 key 值为 null、undefined 或空字符串的项
+    if (item[key] == null || item[key] === '') {
+      return;
+    }
+    
     // 如果 optional.type 是 String,则处理字符串转换
     if (optional.type === String) {
       item[key] = item[key] + '';  // 转为字符串

+ 34 - 2
src/views/outbound/picking/list/index.vue

@@ -52,6 +52,10 @@
           <div class="right">
             <div class="right-list"  v-for="(item,index) in locationList[activeIndex].list"
                  :class="activeClass(item)">
+              <div v-if="index==0 && item.locationContainer " class="location-container">
+                <span class="location-label">库位容器:</span>
+                <span class="location-value">{{item.locationContainer}}</span>
+              </div>
               <div>{{ ownerMap[item.owner] || item.owner }}</div>
               <div class="content" @click="onLotAtt(item)" >
                 <div class="c-left">
@@ -201,6 +205,8 @@ const preBarcode=ref('')
 const taskItem=ref([])
 //匹配组合商品数据
 const matchedSku=ref([])
+//库位容器
+const locationContainerMap=ref({})
 // 切换容器号
 const containerNoInputRef=ref(null)
 const onContainerNo=(type)=>{
@@ -220,6 +226,7 @@ const loadData =  async (pickingCode,type) => {
   if(taskList.value.length==0){
     return
   }
+  locationContainerMap.value=toMap(taskList.value,'locationContainer','location')
   result()
   allQuantity.value=expectedQuantity.value
   taskItem.value=taskList.value
@@ -372,9 +379,13 @@ const _handlerScan=(code)=> {
       showToast({duration:5000,message:'请先扫描容器号'})
       return
     }
-    if(taskMap.value[code.toUpperCase()]){
+    let location=code
+    if(locationContainerMap.value[barcodeToUpperCase(code)]){
+      location=locationContainerMap.value[barcodeToUpperCase(code)]
+    }
+    if(taskMap.value[barcodeToUpperCase(location)]){
       nextLocation.value=''
-      activeIndex.value = locationList.value.findIndex(item => item.location === barcodeToUpperCase(code))
+      activeIndex.value = locationList.value.findIndex(item => item.location === barcodeToUpperCase(location))
       onScan(3)
       scanSuccess()
     }else{
@@ -993,6 +1004,27 @@ const onRefresh = () => {
         margin-bottom: 5px
         border-bottom: 1px solid #D3D3D3
         border-radius: 0 8px 8px 0
+
+        .location-container
+          margin-bottom: 5px
+          padding: 2px 10px
+          background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%)
+          border: 1px solid #dee2e6
+          border-radius: 4px
+          border-left: 3px solid #6c757d
+
+          .location-label
+            font-size: 11px
+            color: #6c757d
+            font-weight: 500
+            letter-spacing: 0.3px
+
+          .location-value
+            font-size: 13px
+            color: #495057
+            font-weight: 600
+            margin-left: 2px
+
         .content
           display: flex
           justify-content: space-between