|
|
@@ -2,7 +2,7 @@
|
|
|
<template>
|
|
|
<div class="box-return">
|
|
|
<van-nav-bar
|
|
|
- title="海康-入库" left-arrow fixed placeholder @click-left="goBack">
|
|
|
+ title="海康-入库/解绑" left-arrow fixed placeholder @click-left="goBack">
|
|
|
<template #left>
|
|
|
<van-icon name="arrow-left" size="25" />
|
|
|
<div style="color: #fff">返回</div>
|
|
|
@@ -12,11 +12,15 @@
|
|
|
<div class="content-tips">
|
|
|
<div style="flex: 1"><van-notice-bar left-icon="volume-o">{{ tips }}</van-notice-bar></div>
|
|
|
</div>
|
|
|
+ <van-tabs v-model:active="active" type="card">
|
|
|
+ <van-tab title="料箱入库" name="1"></van-tab>
|
|
|
+ <van-tab title="解绑站点" name="2" ></van-tab>
|
|
|
+ </van-tabs>
|
|
|
<div class="content-code">
|
|
|
<div class="barcode-input">
|
|
|
<van-search
|
|
|
ref="boxRef"
|
|
|
- v-model="scanBox"
|
|
|
+ v-model.lazy="scanBox"
|
|
|
placeholder="请扫描料箱编码"
|
|
|
@search="_handlerScan(scanBox)"
|
|
|
label="料箱编码:"
|
|
|
@@ -29,7 +33,7 @@
|
|
|
</div>
|
|
|
<div class="barcode-input">
|
|
|
<van-search
|
|
|
- v-model="scanStation"
|
|
|
+ v-model.lazy="scanStation"
|
|
|
placeholder="请扫描工作站点"
|
|
|
@search="_handlerScan(scanStation)"
|
|
|
label="工作站点:"
|
|
|
@@ -50,7 +54,7 @@ import { getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
|
|
|
import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
|
import { barcodeToUpperCase } from '@/utils/dataType'
|
|
|
import { showNotify } from 'vant'
|
|
|
-import { createHikBoxInboundTask } from '@/api/haikang'
|
|
|
+import { boxAndStationUnbindTask, createHikBoxInboundTask } from '@/api/haikang'
|
|
|
import { useStore } from '@/store/modules/user'
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
const tips=ref('请扫描料箱')
|
|
|
@@ -69,6 +73,7 @@ onMounted(() => {
|
|
|
scanInit(_handlerScan)
|
|
|
|
|
|
})
|
|
|
+const active=ref('1')
|
|
|
// 扫描条码监听
|
|
|
const _handlerScan = (code) => {
|
|
|
if (scanType.value == 1) {
|
|
|
@@ -89,8 +94,11 @@ const _handlerScan = (code) => {
|
|
|
}
|
|
|
if(code){
|
|
|
scanStation.value = code
|
|
|
- console.log('入库')
|
|
|
- _createHikBoxInboundTask()
|
|
|
+ if(active.value==1){
|
|
|
+ _createHikBoxInboundTask()
|
|
|
+ }else {
|
|
|
+ _boxAndStationUnbindTask()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -120,6 +128,31 @@ const _createHikBoxInboundTask=()=>{
|
|
|
closeLoading()
|
|
|
})
|
|
|
}
|
|
|
+const _boxAndStationUnbindTask=()=>{
|
|
|
+ const data={
|
|
|
+ warehouse,
|
|
|
+ boxCode:scanBox.value,
|
|
|
+ stationCode:scanStation.value
|
|
|
+ }
|
|
|
+ showLoading()
|
|
|
+ boxAndStationUnbindTask(data).then(res=>{
|
|
|
+ if(res.data){
|
|
|
+ tips.value='请继续扫描料箱编号'
|
|
|
+ scanType.value=1
|
|
|
+ scanBox.value=''
|
|
|
+ scanStation.value=''
|
|
|
+ showNotify({ type: 'success', duration: 3000, message:'料箱入库成功,请继续扫描需要入库料箱' })
|
|
|
+ scanSuccess()
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ tips.value='料箱解绑失败,请重新扫描工作站点'
|
|
|
+ scanStation.value=''
|
|
|
+ showNotify({ type: 'danger', duration: 3000, message:'料箱解绑失败,请重新扫描工作站点' })
|
|
|
+ scanError()
|
|
|
+ }).finally(()=>{
|
|
|
+ closeLoading()
|
|
|
+ })
|
|
|
+}
|
|
|
onUnmounted(() => {
|
|
|
closeListener()
|
|
|
})
|