zhaohuanhuan 1 год назад
Родитель
Сommit
80a08bae90

+ 3 - 3
src/utils/android.ts

@@ -1,4 +1,4 @@
-import { showToast } from 'vant'
+
 // @ts-ignore
 import { useStore } from '@/store/modules/user'
 const store = useStore()
@@ -26,7 +26,7 @@ export function logout(){
     window.android.logout()
     // store.removeToken()
   }catch (e){
-    showToast(JSON.stringify(e))
+    // showToast(JSON.stringify(e))
   }
 }
 /**
@@ -53,7 +53,7 @@ export function playVoicePickNum(number: number) {
     // @ts-ignore
     window.android.playVoicePickNum(number)
   }catch (e){
-    showToast(JSON.stringify(e))
+    // showToast(JSON.stringify(e))
   }
 }
 

+ 2 - 2
src/utils/request.ts

@@ -1,7 +1,7 @@
 // src/utils/resquest.ts
 import axios from 'axios'
 import { useStore } from '../store/modules/user'
-import { showDialog, showToast } from 'vant'
+import { showDialog, showFailToast, showToast } from 'vant'
 // @ts-ignore
 import router from '@/router'
 const store = useStore()
@@ -49,7 +49,7 @@ service.interceptors.response.use(
         }
         return
       }
-      showToast(res)
+      showFailToast({duration:5000,message:res.message})
       return Promise.reject(res);
     }
     return res;

+ 0 - 1
src/views/index.vue

@@ -3,7 +3,6 @@
     <van-image class="image" :src="imageUrl" ></van-image>
     <div class="home" @click="onRouter">欢迎进入</div>
   </div>
-
 </template>
 <script setup>
 import imageUrl from '@/assets/img.png'

+ 45 - 18
src/views/outbound/picking/list/index.vue

@@ -51,7 +51,7 @@
               <div class="content">
                 <div class="c-left">
                   <div class="c-left-count">{{ item.expectedQuantity }}</div>
-                  <div class="c-left-tips">数量</div>
+<!--                  <div class="c-left-tips">数量</div>-->
                 </div>
                 <div class="c-right">
                   <div style="font-weight: bold;">{{ item.barcode }}</div>
@@ -96,12 +96,13 @@
     <container-no-input ref="containerNoInputRef" @setContainer="setContainer" :selectTask="selectTask"  />
     <!--    拣货任务号-->
     <picking-no-input  ref="pickingNoInputRef" @loadData="loadData" />
+    <input-barcode ref="inputBarcodeRef" @setBarcode="_handlerScan" />
     <van-floating-bubble v-if="locationList.length>0"  :gap="50" axis="xy" magnetic="x"  @click="onContainerNo(containerNo===''?2:scanType)">容器</van-floating-bubble>
   </div>
 </template>
 <script lang="ts" setup>
 import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
-import { showDialog, showToast } from 'vant'
+import { showDialog, showFailToast, showToast } from 'vant'
 import { fetchPickingData, getPickingTask } from '@/views/outbound/picking/list/hooks/list'
 import { getOwnerList } from '@/hooks/basic'
 import { useRouter,useRoute } from 'vue-router'
@@ -121,6 +122,7 @@ import { barcodeToUpperCase } from '@/utils/dataType'
 import { containerDef } from '@/views/outbound/picking/list/hooks/containerDef'
 import { getCarrierList } from '@/hooks/basic/carrier'
 import { basicStore } from '@/store/modules/basic'
+import InputBarcode from '@/views/outbound/components/InputBarcode.vue'
 onUnmounted(() => {
   closeListener()
 })
@@ -205,7 +207,8 @@ const loadData =  async (pickingCode) => {
         lotNum:item.lotNum,
         line:item.line,
         operationTime: item.operationTime,
-        container: item.container
+        container: item.container,
+        quantity:item.quantity
       };
     });
   if(selectTask.value.length>0){
@@ -224,6 +227,12 @@ const setContainer=(code,type)=>{
     onScan(type)
   }
 }
+
+// 设置扫码
+const setBarcode=(code)=>{
+
+}
+
 // 获取拣货任务号
 const getPickingCode= async()=>{
   const { pickingCode } = await fetchPickingData(warehouse)
@@ -245,7 +254,7 @@ if(Object.keys(basic.carrierMap).length == 0){
 getOwnerData()
 // 计算已成功数量
 const quantity = computed(() => {
-  return taskItem.value.reduce((sum, item) => {
+  return selectTask.value.reduce((sum, item) => {
     return Number(sum) + (Number(item.quantity) ?? 0)
   }, 0)
 })
@@ -264,7 +273,7 @@ const tips = () => {
     return '请扫描下一拣货库位'
   }else if(scanType.value==3){
     return '请扫描商品条码'
-  }else {
+  }else if(scanType.value==4){
     return messageTips.value
   }
 }
@@ -297,11 +306,20 @@ const onScan = (type) => {
 }
 //扫描条码监听
 const _handlerScan=(code)=> {
+  if(scanType.value===1){
+    if(code.split('-')[0]!=='JH'){
+      showToast({duration:5000,message:'请使用标准拣货容器'})
+      return
+    }
+    containerNo.value=code
+    onScan(2)
+    return
+  }
   scanBarcode.value=code
   const modelLocative=locationList.value[activeIndex.value]
   if(scanType.value===2){
     if(containerNo.value == '') {
-      showToast('请先扫描容器号')
+      showToast({duration:5000,message:'请先扫描容器号'})
       return
     }
     if(taskMap.value[code.toUpperCase()]){
@@ -310,10 +328,10 @@ const _handlerScan=(code)=> {
       scanSuccess()
     }else{
       scanError()
-      showToast('无效库位!请检查扫描库位')
+      showToast({duration:5000,message:'无效库位!请检查扫描库位'})
     }
   }
-  if(scanType.value===3){
+  if(scanType.value===3 || scanType.value===4 ){
     // 将当前库位下的商品条码拿出对比
     const barcode = [...new Set(
       modelLocative.list
@@ -338,37 +356,39 @@ const _handlerScan=(code)=> {
         },200)
     }else{
       scanError()
-      showToast('无效条码!请检查扫描条码')
+      showToast({duration:5000,message:'无效条码!请检查扫描条码'})
+
     }
   }
 }
 // 进行条件验证
 const validate = (data) => {
   if (containerNo.value === '') {
-    showToast('请先扫描拣货容器');
+    showToast({duration:5000,message:'请先扫描拣货容器'})
     return false;
   }
   if (scanType.value === 2) {
-    showToast('请先扫描库位');
+    showToast({duration:5000,message:'请先扫描库位'})
     return false;
   }
   if (scanType.value === 3) {
-    showToast('请先扫描条码');
+    showToast({duration:5000,message:'请先扫描条码'})
     return false;
   }
   if (data.count < 0) {
     messageTips.value='拣货数量无效'
-    showToast('拣货数量无效');
+    showToast({duration:5000,message:'拣货数量无效'})
     return false;
   }
   if (data.count > data.expectedQuantity) {
-    showToast('拣货数量不能大于所需数量');
+    showToast({duration:5000,message:'拣货数量不能大于所需数量'})
     messageTips.value='拣货数量不能大于所需数量'
     return false;
   }
   if (isLot(selectTask.value, [data])) {
     messageTips.value='当前容器下已有其他批次产品,请更换容器号'
-    showToast('当前容器下已有其他批次产品,请更换容器号');
+    scanBarcode.value=''
+    showToast({duration:5000,message:'当前容器下已有其他批次产品,请更换容器号'})
     return false;
   }
   return true;
@@ -393,7 +413,7 @@ const onCount=(item,type)=>{
   //扣减库存
   setPickingDetail(params).then((res)=>{
     jumpLoading.value=false
-    if(!res.data){
+    if(res.data==false){
       showDialog({
         title:'温馨提示',
         message:'该库位条码存在取消单,任务已被刷新,请将当前货品归还原库位'
@@ -410,7 +430,8 @@ const onCount=(item,type)=>{
         lotNum: data.lotNum,
         line:data.line,
         operationTime: data.operationTime,
-        container:data.container
+        container:data.container,
+        quantity:data.quantity
       }
       selectTask.value.push(task)
       locationList.value[activeIndex.value].list[0].operationTime=params[0].operationTime
@@ -434,6 +455,8 @@ const onCount=(item,type)=>{
       })
     }
   }).catch((err)=>{
+    scanBarcode.value=''
+    onScan(4)
     messageTips.value=err.message
     scanError()
     jumpLoading.value=false
@@ -449,16 +472,20 @@ const jump=(item)=>{
 const actions = [
   { name: '任务获取',key:'task' },
   { name: '任务号作业' ,key:'picking'},
+  { name: '检索条码' ,key:'inputBarcode'},
 ];
 const onClickRight = () => {
   modeTrueFalseBy.value=true
 }
 const pickingNoInputRef=ref(null)
+const inputBarcodeRef=ref(null)
 const onSelectMode=(value) => {
   if(value.key=='task'){
     router.push('/picking-task')
   }else if(value.key=='picking'){
     pickingNoInputRef.value?.show()
+  }else if(value.key=='inputBarcode'){
+    inputBarcodeRef.value?.show()
   }
 }
 //库位商品拣货完成高亮 allActive
@@ -587,7 +614,7 @@ const onRefresh = () => {
               font-size: 24px
             .c-left-count
               font-weight: bold
-              font-size: 24px
+              font-size: 30px
           .c-right
             flex: 0 0 75%
             max-width: 75%

+ 24 - 8
src/views/outbound/picking/task/index.vue

@@ -98,14 +98,15 @@
           name="pattern"
           ref="countRef"
           class="count-input"
+          @keydown.enter="onCountTask"
           :rules="[{ pattern, message: '请输入正确数量' }]"
         >
         </van-field>
         <div v-if="model.type" class="tips">
-          <div class="tips-item">货主:{{ownerMap[model.owner]}}</div>
+<!--          <div class="tips-item">货主:{{ownerMap[model.owner]}}</div>-->
           <div class="tips-item">承运商:{{model.carrier}}</div>
-          <div class="tips-item">类型:{{model.typeDescribe}}</div>
           <div class="tips-item" @click="count=modelCount">数量:<span class="all-count">{{modelCount}}</span></div>
+          <div class="tips-item">类型:{{model.typeDescribe}}</div>
           <div class="tips-item" v-if="model.warehouseAttribute">属性仓:{{model.warehouseAttribute}}</div>
           <div class="tips-item" v-if="model.issuePartyName">店铺:{{model.issuePartyName}}</div>
           <div class="tips-item" v-if="model.ruleName">规则:{{model.ruleName}}</div>
@@ -162,8 +163,8 @@ const ownerTaskTitle = computed(() => {
     '*': '攒单任务',
     'S': '特殊订单列表',
     'U': '加急订单列表',
-    'N': '普通/截单生成任务',
-    'Y': '单品生成任务',
+    'N': '普通/截单',
+    'Y': '单品',
   };
   const typeTitle = typeMap[type] || '订单列表';
 
@@ -200,7 +201,7 @@ const onTaskList=async (row:Object,type)=>{
   const { data }: pickingListResponse = await getPickingTaskDetail(params)
   closeLoading()
   if(data.length==0){
-    showToast('任务已被获取,请刷新后重新查看!')
+    showToast({duration:5000,message:'任务已被获取,请刷新后重新查看!'})
     return
   }
   if(model.value.type==='*'){
@@ -245,7 +246,7 @@ const onBuildTask=(action)=>
   new Promise((resolve) => {
     if (action === 'confirm') {
       if (checkedResult.value.length == 0) {
-        showToast('请先选择订单')
+        showToast({duration:5000,message:'请先选择订单'})
         return resolve(false)
       }
       createPicking()
@@ -260,11 +261,11 @@ const  beforeClose= (action) =>
   new Promise((resolve) => {
     if(action==='confirm'){
       if(count.value==''){
-        showToast('请输入拣货数量')
+        showToast({duration:5000,message:'请输入拣货数量'})
         return resolve(false)
       }
       if(Number(count.value)>modelCount.value){
-        showToast('任务数量不能大于最大可生成数量'+modelCount.value)
+        showToast({duration:5000,message:'任务数量不能大于最大可生成数量'+modelCount.value})
         return resolve(false)
       }
       orderTrueFalseBy.value=false
@@ -273,6 +274,18 @@ const  beforeClose= (action) =>
     }
     resolve(true)
   });
+const onCountTask=()=>{
+  if(count.value==''){
+    showToast({duration:5000,message:'请输入拣货数量'})
+    return
+  }
+  if(Number(count.value)>modelCount.value){
+    showToast({duration:5000,message:'任务数量不能大于最大可生成数量'+modelCount.value})
+    return
+  }
+  orderTrueFalseBy.value=false
+  createPicking()
+}
 /**
  * 创建任务数量
  * @param row
@@ -283,6 +296,9 @@ const onCreateTask=(row)=>{
   createTaskTrueFalseBy.value=true
     if(row.count<=60){
       count.value=row.count
+      setTimeout(()=>{
+        countRef.value.focus()
+      },300)
     }else {
       countRefFocus()
     }

+ 1 - 1
src/views/test.vue

@@ -37,7 +37,7 @@ export default {
         typingTimer = setTimeout(() => {
           // 处理条形码完成逻辑,比如发送请求或其他操作
           console.log('扫描完成:', barcode.value);
-          showToast(inputValue.value)
+          // showToast(inputValue.value)
           // barcode.value = ''; // 清空条形码值(根据实际需要决定是否清空)
         }, debounceDelay);
       }