|
|
@@ -6,15 +6,16 @@
|
|
|
fixed
|
|
|
placeholder
|
|
|
@click-left="goBack"
|
|
|
- @click-right="refresh"
|
|
|
>
|
|
|
<template #left>
|
|
|
<van-icon name="arrow-left" size="25" />
|
|
|
<div style="color: #fff">返回</div>
|
|
|
</template>
|
|
|
- <template #right>
|
|
|
- <div style="color: #fff">刷新<van-icon name="replay" /></div>
|
|
|
- </template>
|
|
|
+<!-- <template #right>-->
|
|
|
+<!-- <div class="nav-right" @click="onClickRight">-->
|
|
|
+<!-- <van-icon name="list-switch" size="25" />-->
|
|
|
+<!-- </div>-->
|
|
|
+<!-- </template>-->
|
|
|
</van-nav-bar>
|
|
|
<div class="move-stock">
|
|
|
<div class="code">
|
|
|
@@ -31,8 +32,6 @@
|
|
|
v-model="searchBarcode"
|
|
|
placeholder="请扫描商品条码"
|
|
|
@search="_handlerScan(searchBarcode)"
|
|
|
- @input="onBarcodeChange"
|
|
|
- @clear="onBarcodeClear"
|
|
|
label="商品条码:"
|
|
|
left-icon=""
|
|
|
:class="[scanType===2?'search-input-barcode':'','van-hairline--bottom']"
|
|
|
@@ -125,8 +124,6 @@
|
|
|
/>
|
|
|
<!-- 条码输入组件 -->
|
|
|
<input-barcode :back="back" @setBarcode="setBarcode" ref="inputBarcodeRef" />
|
|
|
- <!-- 组合商品还库 -->
|
|
|
- <move-stock-combine ref="moveStockCombineRef" :matched-sku="combineMatchedSku" @set-combine="setCombineMoveStock" @cancel="onCombineCancel" />
|
|
|
<van-dialog v-model:show="moveStockTrueFalseBy"
|
|
|
:beforeClose="beforeClose"
|
|
|
:title="'商品条码:'+ model.sku +',还库:'+location" show-cancel-button >
|
|
|
@@ -174,20 +171,17 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {computed, onMounted, onUnmounted, ref} from 'vue'
|
|
|
-import {useRouter} from 'vue-router'
|
|
|
-import {useStore} from '@/store/modules/user'
|
|
|
-import {androidFocus, getHeader, goBack, scanError, scanSuccess} from '@/utils/android'
|
|
|
-import {closeListener, openListener, scanInit} from '@/utils/keydownListener'
|
|
|
-import {getInventory, getInventoryList, movementReturn} from '@/api/check/index'
|
|
|
+import { onMounted, onUnmounted, ref, computed } from 'vue'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+import { useStore } from '@/store/modules/user'
|
|
|
+import { androidFocus, getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
|
|
|
+import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
|
|
|
+import { getInventory, getInventoryList, movementReturn } from '@/api/check/index'
|
|
|
import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
|
|
|
-import {closeLoading, showLoading} from '@/utils/loading'
|
|
|
+import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
import nodataUrl from '@/assets/nodata.png'
|
|
|
-import {showNotify, showToast} from 'vant'
|
|
|
-import {barcodeToUpperCase} from '@/utils/dataType.js'
|
|
|
-import {getListCombineSku} from '@/api/picking'
|
|
|
-import MoveStockCombine from './components/MoveStockCombine.vue'
|
|
|
-
|
|
|
+import { showNotify, showToast } from 'vant'
|
|
|
+import { barcodeToUpperCase } from '@/utils/dataType.js'
|
|
|
const router = useRouter()
|
|
|
const store = useStore()
|
|
|
try {
|
|
|
@@ -199,7 +193,7 @@ try {
|
|
|
const warehouse = store.warehouse
|
|
|
const pattern=/^[1-9]\d*$/
|
|
|
// 容器号和扫描类型的状态
|
|
|
-const containerNo = ref('FJ-WH01-1')
|
|
|
+const containerNo = ref('')
|
|
|
//输入框组件类型
|
|
|
const inputBarcodeType = ref('')
|
|
|
//扫描类型
|
|
|
@@ -213,17 +207,12 @@ const totalList=ref([])
|
|
|
const searchRef=ref(null)
|
|
|
//扫描条码
|
|
|
const searchBarcode=ref('')
|
|
|
-const oldSearchBarcode=ref('')
|
|
|
//扫描库位
|
|
|
const location=ref('')
|
|
|
//
|
|
|
const model=ref({})
|
|
|
const countRef=ref(null)
|
|
|
const back=ref(true)
|
|
|
-// 组合商品还库
|
|
|
-const moveStockCombineRef = ref(null)
|
|
|
-const combineData = ref(null)
|
|
|
-const combineMatchedSku = ref([])
|
|
|
// 页面初始化
|
|
|
onMounted(() => {
|
|
|
openListener()
|
|
|
@@ -249,8 +238,7 @@ const setBarcode = (code) => {
|
|
|
scanType.value = 2
|
|
|
containerNo.value = code
|
|
|
searchBarcode.value=''
|
|
|
- moveList.value=[]
|
|
|
- combineData.value=null
|
|
|
+ moveList.value=''
|
|
|
location.value=''
|
|
|
// if(searchBarcode.value){
|
|
|
// _getInventoryList(searchBarcode.value)
|
|
|
@@ -263,23 +251,6 @@ const _setContainerNo=()=>{
|
|
|
inputBarcodeRef.value?.show('', '请扫描反拣容器')
|
|
|
}
|
|
|
|
|
|
-// 商品条码调整时,清空还库推荐、库存列表、还库库位
|
|
|
-const onBarcodeChange = () => {
|
|
|
- if (searchBarcode.value === '' || (oldSearchBarcode.value && oldSearchBarcode.value.length !== searchBarcode.value.length)) {
|
|
|
- moveList.value = []
|
|
|
- totalList.value = []
|
|
|
- location.value = ''
|
|
|
- combineData.value = null
|
|
|
- }
|
|
|
-}
|
|
|
-const onBarcodeClear = () => {
|
|
|
- moveList.value = []
|
|
|
- totalList.value = []
|
|
|
- location.value = ''
|
|
|
- combineData.value = null
|
|
|
- oldSearchBarcode.value = ''
|
|
|
-}
|
|
|
-
|
|
|
// 扫描条码监听
|
|
|
const _handlerScan = (code) => {
|
|
|
console.log(code)
|
|
|
@@ -295,35 +266,8 @@ const _handlerScan = (code) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 商品条码查询为空时,查询组合商品列表
|
|
|
-const _handleCombineProduct = async (code) => {
|
|
|
- try {
|
|
|
- showLoading()
|
|
|
- const res = await getListCombineSku({ combineSku: barcodeToUpperCase(code), workEnvironment: 'movement' })
|
|
|
- closeLoading()
|
|
|
- const _err = (msg) => {
|
|
|
- scanError()
|
|
|
- searchBarcode.value = ''
|
|
|
- showNotify({ type: 'danger', duration: 5000, message: msg })
|
|
|
- }
|
|
|
- if (!res.data?.length) return _err(`条码:${code},未找到可还库库存,请检查条码!`)
|
|
|
- if (res.data.length > 1) return _err('组合商品不支持多商品')
|
|
|
- const innerBarcode = res.data[0].barcode
|
|
|
- combineData.value = res.data[0]
|
|
|
- searchBarcode.value = code
|
|
|
- oldSearchBarcode.value = code
|
|
|
- _getInventoryList(innerBarcode, true)
|
|
|
- scanSuccess()
|
|
|
- } catch (err) {
|
|
|
- closeLoading()
|
|
|
- scanError()
|
|
|
- searchBarcode.value = ''
|
|
|
- showNotify({ type: 'danger', duration: 5000, message: `条码查询失败,请检查条码!` })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 获取库存数据
|
|
|
-const _getInventoryList = async (barcode, fromCombineQuery = false) => {
|
|
|
+const _getInventoryList = async (barcode) => {
|
|
|
const data = { warehouse, location: containerNo.value, barcode }
|
|
|
try {
|
|
|
showLoading()
|
|
|
@@ -331,43 +275,25 @@ const _getInventoryList = async (barcode, fromCombineQuery = false) => {
|
|
|
closeLoading()
|
|
|
moveList.value = res.data
|
|
|
if (res.data.length === 0) {
|
|
|
- _handleCombineProduct(barcode)
|
|
|
+ scanError()
|
|
|
+ searchBarcode.value = ''
|
|
|
+ showNotify({ duration: 5000, message: `条码:${barcode},未找到可还库库存,请检查条码!` })
|
|
|
return
|
|
|
}
|
|
|
- // 仅当直接扫描普通条码命中时清除组合标记;从组合商品内件查询来时保留
|
|
|
- if (!fromCombineQuery) combineData.value = null
|
|
|
scanSuccess()
|
|
|
- if (!fromCombineQuery) {
|
|
|
- searchBarcode.value = res.data[0].sku
|
|
|
- oldSearchBarcode.value = res.data[0].sku
|
|
|
- }
|
|
|
- const params = { warehouse, barcode, locationRegexp: '^(?!STAGE_|SORTATION_|REVERSEPICK_|FJ-|TRANSFER_).*$', queryLocationInfo: true }
|
|
|
- if (barcode === '') return
|
|
|
- getInventory(params).then(res => {
|
|
|
- totalList.value = res.data
|
|
|
+ searchBarcode.value= res.data[0].sku
|
|
|
+ const params={ warehouse, barcode,locationRegexp:'^(?!STAGE_|SORTATION_|REVERSEPICK_|FJ-|TRANSFER_).*$',queryLocationInfo:true }
|
|
|
+ if(barcode==='') return
|
|
|
+ getInventory(params).then(res=>{
|
|
|
+ totalList.value=res.data
|
|
|
})
|
|
|
- scanType.value = 3
|
|
|
+ scanType.value=3
|
|
|
} catch (err) {
|
|
|
closeLoading()
|
|
|
console.error(err)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 刷新
|
|
|
-const refresh = () => {
|
|
|
- moveList.value = []
|
|
|
- totalList.value = []
|
|
|
- location.value = ''
|
|
|
- combineData.value = null
|
|
|
- scanType.value = 2
|
|
|
- if (containerNo.value && searchBarcode.value) {
|
|
|
- oldSearchBarcode.value = ''
|
|
|
- _getInventoryList(searchBarcode.value)
|
|
|
- } else {
|
|
|
- loadData()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
//移动数量
|
|
|
const moveCount=ref('')
|
|
|
//移动弹框
|
|
|
@@ -385,30 +311,11 @@ const onMove=(item)=>{
|
|
|
return
|
|
|
}
|
|
|
model.value=item
|
|
|
- if (combineData.value) {
|
|
|
- combineMatchedSku.value = [{ ...item, matchedJson: combineData.value, expectedQuantity: item.availableQty }]
|
|
|
- moveStockCombineRef.value?.show()
|
|
|
- } else {
|
|
|
- moveCount.value=''
|
|
|
- moveStockTrueFalseBy.value=true
|
|
|
- setTimeout(()=>{
|
|
|
- countRef.value?.focus()
|
|
|
- },300)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// 组合商品还库确认
|
|
|
-const setCombineMoveStock = ({ dataList }) => {
|
|
|
- if (!dataList?.[0]) return
|
|
|
- const row = dataList[0]
|
|
|
- moveCount.value = String(row.quantity)
|
|
|
- model.value = { ...model.value, ...row }
|
|
|
- createMoveStock()
|
|
|
-}
|
|
|
-
|
|
|
-// 组合商品还库取消
|
|
|
-const onCombineCancel = () => {
|
|
|
- moveCount.value = ''
|
|
|
+ moveCount.value=''
|
|
|
+ moveStockTrueFalseBy.value=true
|
|
|
+ setTimeout(()=>{
|
|
|
+ countRef.value?.focus()
|
|
|
+ },300)
|
|
|
}
|
|
|
/**
|
|
|
* 确认还库
|
|
|
@@ -466,7 +373,6 @@ const createMoveStock=()=>{
|
|
|
location.value=''
|
|
|
moveList.value=[]
|
|
|
totalList.value=[]
|
|
|
- combineData.value=null
|
|
|
}else {
|
|
|
location.value=''
|
|
|
_getInventoryList(searchBarcode.value)
|
|
|
@@ -528,6 +434,7 @@ const onSelectMode = async (value) => {
|
|
|
inputBarcodeRef.value?.show()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 数据刷新
|
|
|
const loadData = () => {
|
|
|
if(searchBarcode.value){
|