Sfoglia il codice sorgente

拣货-增加还原拣货、优化拣货提示

zhaohuanhuan 1 anno fa
parent
commit
8310beb5ac
2 ha cambiato i file con 126 aggiunte e 32 eliminazioni
  1. 14 2
      src/api/picking/index.ts
  2. 112 30
      src/views/outbound/picking/list/index.vue

+ 14 - 2
src/api/picking/index.ts

@@ -134,9 +134,8 @@ export function getBigPickingGoods({warehouse,orderNo,list}:any) {
     data: {warehouse,orderNo,lotNumList:list}
   })
 }
-
 /**
- * 按商品拣货接口
+ * 按巷道拣货接口
  */
 export function getBigPickingAisleNo({warehouse,orderNo,list}:any) {
   return request({
@@ -147,4 +146,17 @@ export function getBigPickingAisleNo({warehouse,orderNo,list}:any) {
 }
 
 
+/**
+ * 还原拣货任务
+ */
+export function removePickingTask(params:any) {
+  return request({
+    url: 'api/wms/picking',
+    method: 'DELETE',
+    params,
+  })
+}
+
+
+
 

+ 112 - 30
src/views/outbound/picking/list/index.vue

@@ -42,7 +42,7 @@
                  v-for="(location,index) in locationList"
                  :key="index"
                  @click="onLocation(index)">
-              {{ location.location }}
+              <span>{{ location.location }}</span><span class="recommend" v-if="nextLocation==location.location && allPicking(location)!=='allActive'" >推荐</span>
             </div>
           </div>
         </van-col>
@@ -111,7 +111,7 @@ import { showConfirmDialog, showDialog, showFailToast, showNotify, showToast } f
 import { fetchPickingData, getPickingTask } from '@/views/outbound/picking/list/hooks/list'
 import { getOwnerList } from '@/hooks/basic'
 import { useRouter,useRoute } from 'vue-router'
-import { getListCombineSku, setPickingDetail } from '@/api/picking'
+import { getListCombineSku, removePickingTask, setPickingDetail } from '@/api/picking'
 const router = useRouter()
 const route = useRoute()
 const store = useStore()
@@ -172,6 +172,9 @@ const scanType = ref(1)
 const selectTask=ref([])
 
 const scanBarcode=ref('')
+//上一个条码
+const preBarcode=ref('')
+
 const taskItem=ref([])
 //匹配组合商品数据
 const matchedSku=ref([])
@@ -184,7 +187,7 @@ const onContainerNo=(type)=>{
 }
 const allQuantity=ref(0)
 //加载数据
-const loadData =  async (pickingCode) => {
+const loadData =  async (pickingCode,type) => {
   pickingNo.value=pickingCode
   //获取第一个拣货单号
   const { taskList,expectedQuantity }=await getPickingTask(warehouse,pickingCode)
@@ -232,6 +235,7 @@ const loadData =  async (pickingCode) => {
   if(selectTask.value.length>0){
     getDefContainer(selectTask.value)
   }else {
+    if(type!=1) return
     scanBarcode.value=''
     containerNo.value=''
     androidFocus()
@@ -252,13 +256,13 @@ const getPickingCode= async()=>{
   const { pickingCode } = await fetchPickingData(warehouse)
   if(pickingCode!=null){
     pickingNo.value=pickingCode
-    await loadData(pickingCode)
+    await loadData(pickingCode,1)
   }else {
     await router.push('/picking-task')
   }
 }
 if(route.query.code){
-  loadData(route.query.code)
+  loadData(route.query.code,1)
 }else {
   getPickingCode()
 }
@@ -333,11 +337,13 @@ const _handlerScan=(code)=> {
   scanBarcode.value=code
   const modelLocative=locationList.value[activeIndex.value]
   if(scanType.value===2){
+
     if(containerNo.value == '') {
       showToast({duration:5000,message:'请先扫描容器号'})
       return
     }
     if(taskMap.value[code.toUpperCase()]){
+      nextLocation.value=''
       activeIndex.value = locationList.value.findIndex(item => item.location === barcodeToUpperCase(code))
       onScan(3)
       scanSuccess()
@@ -347,6 +353,7 @@ const _handlerScan=(code)=> {
     }
   }
   if(scanType.value===3 || scanType.value===4 ){
+    preBarcode.value=scanBarcode.value
     // 将当前库位下的商品条码拿出对比
     const barcode = [...new Set(
       modelLocative.list
@@ -354,22 +361,46 @@ const _handlerScan=(code)=> {
         .filter(value => value !== null )
     )]
     if (barcode.some(item => barcodeToUpperCase(item) ===  barcodeToUpperCase(code))) {
-        locationList.value[activeIndex.value].list=modelLocative.list.reduce((acc, item) => {
-          if (item.barcode === code) {
-            acc.unshift(item);
+        //将匹配到的条码放到第一个
+        modelLocative.list=modelLocative.list.reduce((list, item) => {
+          if (barcodeToUpperCase(item.barcode) === barcodeToUpperCase(code)) {
+            list.unshift(item);
           } else {
-            acc.push(item);
+            list.push(item);
           }
-          return acc;
+          return list;
         }, [])
-        playVoicePickNum(locationList.value[activeIndex.value].list[0].expectedQuantity)
-        locationList.value[activeIndex.value].list[0].count=locationList.value[activeIndex.value].list[0].expectedQuantity
-        onScan(4)
-        setTimeout(()=>{
-          //匹配到条码扣减库存
-          onCount(locationList.value[activeIndex.value].list[0],0)
-        },200)
+        const activeBarcode=modelLocative.list[0]
+        playVoicePickNum(activeBarcode.expectedQuantity)
+        if(activeBarcode.operationTime){
+          showConfirmDialog({
+            title: '温馨提示',
+            message:
+              `当前条码《${activeBarcode.barcode}》已经拣货成功是否确认重复提交?`,
+          })
+            .then(() => {
+              activeBarcode.count=activeBarcode.expectedQuantity
+              onScan(4)
+              setTimeout(()=>{
+                //匹配到条码扣减库存
+                onCount(activeBarcode,0)
+              },200)
+            }).catch(()=>{
+              const allOperationTimeExist = modelLocative.list.every(({ operationTime }) => operationTime);
+              if(allOperationTimeExist){
+                onScan(2)
+              }
+            })
+        }else {
+          activeBarcode.count=activeBarcode.expectedQuantity
+          onScan(4)
+          setTimeout(()=>{
+            //匹配到条码扣减库存
+            onCount(activeBarcode,0)
+          },200)
+        }
     }else{
+      //查询组合条码
       matchedSku.value=[]
       getListCombineSku({combineSku:code, workEnvironment:'picking'}).then(res=>{
         if(res.data.length>0){
@@ -463,7 +494,9 @@ const setCombine=(data)=>{
   }
   _setPickingDetail(data,2)
 }
+const nextLocation=ref()
 const _setPickingDetail=(params,type)=>{
+  const activeList=locationList.value[activeIndex.value]
   //扣减库存
   showLoading()
   setPickingDetail(params).then((res)=>{
@@ -474,7 +507,7 @@ const _setPickingDetail=(params,type)=>{
         title: '温馨提示',
         message: '该库位条码存在取消单,任务已被刷新,请将当前货品归还原库位'
       }).then(() => {
-        loadData(pickingNo.value);
+        loadData(pickingNo.value,1);
       });
       return;
     }
@@ -496,18 +529,27 @@ const _setPickingDetail=(params,type)=>{
     }
     // 更新 locationList 中的 operationTime
     params.forEach((param, index) => {
-      if (locationList.value[activeIndex.value].list[index]) {
-        locationList.value[activeIndex.value].list[index].operationTime = param.operationTime;
-        locationList.value[activeIndex.value].list[index].count = param.quantity;
-        locationList.value[activeIndex.value].list[index].quantity = param.quantity;
+      if (activeList.list[index]) {
+        activeList.list[index].operationTime = param.operationTime;
+        activeList.list[index].count = param.quantity;
+        activeList.list[index].quantity = param.quantity;
       }
     });
     //验证库位里的所有商品是否都存在拣货时间
-    const { list } = locationList.value[activeIndex.value];
+    const { list } = activeList
     const allOperationTimeExist = list.every(({ operationTime }) => operationTime); // 检查所有商品是否都有拣货时间
     if (!allOperationTimeExist) {
       onScan(3); // 如果有商品缺少拣货时间,直接调用 onScan(3)
     } else {
+      nextLocation.value=''
+      if(activeIndex.value<locationList.value.length-1){
+        nextLocation.value=locationList.value[activeIndex.value+1].location
+        showNotify({
+          message: `当前库位商品已全部拣完,请扫描下一个库位${locationList.value[activeIndex.value+1].location}`,
+          duration: 5000,
+          type:'warning'
+        });
+      }
       if(type==2){
         const numberExist = list.every(({ expectedQuantity, quantity }) => expectedQuantity == quantity && quantity!=0); // 检查数量是否匹配
         onScan(numberExist ? 2 : 3)
@@ -541,7 +583,7 @@ const _setPickingDetail=(params,type)=>{
         result()
         getPickingCode()
       }).catch(() => {
-        loadData(pickingNo.value)
+        loadData(pickingNo.value,1)
       })
     }
   }).catch((err)=> {
@@ -590,6 +632,7 @@ const jump=(item)=>{
 const actions = [
   { name: '任务获取',key:'task' },
   { name: '任务号作业' ,key:'picking'},
+  { name: '任务还原',key:'removeTask' },
   { name: '检索条码' ,key:'inputBarcode'},
 ];
 const onClickRight = () => {
@@ -597,13 +640,37 @@ const onClickRight = () => {
 }
 const pickingNoInputRef=ref(null)
 const inputBarcodeRef=ref(null)
-const onSelectMode=(value) => {
+const onSelectMode= async (value) => {
   if(value.key=='task'){
-    router.push({name:'PickingTask',query:{type:'picking'}})
+   await router.push({name:'PickingTask',query:{type:'picking'}})
   }else if(value.key=='picking'){
     pickingNoInputRef.value?.show()
   }else if(value.key=='inputBarcode'){
     inputBarcodeRef.value?.show()
+  }else if(value.key=='removeTask'){
+    if(pickingNo.value){
+      if(selectTask.value.length>0){
+        showDialog({
+          title: '温馨提示',
+          message: '当前任务已有拣出货品不可还原任务!!',
+        }).then(() => {});
+      return
+      }
+      showDialog({
+        title: '温馨提示',
+        message: '您正在进行还原任务操作,是否继续?',
+      }).then(() => {
+        showLoading()
+        removePickingTask({code:pickingNo.value}).then(res=>{
+           router.push({name:'PickingTask'})
+          showToast({duration:3000,message:'当前任务已取消正在跳转到获取任务页面,请稍后~'})
+          // closeLoading()
+        }).catch(() => {
+          closeLoading()
+        })
+      });
+
+    }
   }
 }
 const lotAttRef=ref(null)
@@ -617,6 +684,8 @@ const allPicking = (location) => {
   const all = location.list.every(item => item.operationTime);
   if(all){
     return 'allActive'
+  }else if(nextLocation.value==location.location){
+    return 'nextActive'
   }
 }
 //库位商品高亮
@@ -631,15 +700,18 @@ const activeClass=(item)=>{
     item.operationTime === null
   ) {
     return 'active'
-  }else if(item.operationTime!=null){
+  }
+  else if(item.operationTime!=null){
     return 'allActive'
   }
+
 }
+
 //刷新页面
 const loading = ref(false)
 const onRefresh = () => {
   setTimeout(() => {
-    loadData(pickingNo.value)
+    loadData(pickingNo.value,1)
     showToast('刷新成功')
     loading.value = false
   }, 1000)
@@ -694,16 +766,26 @@ const onRefresh = () => {
         box-sizing: border-box
         word-wrap: break-word
         font-weight: bold
-
+        position: relative
+        .recommend
+          position: absolute
+          right: -10px
+          top: 0
+          font-size: 11px
+          background: #f64e4e
+          border-radius: 6px
+          padding: 0 3px
       .active
         background: #1989fa
         color: #fff
         position: relative
         right: -10px
-
       .allActive
         background: #72dc41
         color: #fff
+      .nextActive
+        background: #ff8d29
+        color: #fff
 
     .right
       height: 80vh