|
|
@@ -6,16 +6,15 @@
|
|
|
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 class="nav-right" @click="onClickRight">-->
|
|
|
-<!-- <van-icon name="list-switch" size="25" />-->
|
|
|
-<!-- </div>-->
|
|
|
-<!-- </template>-->
|
|
|
+ <template #right>
|
|
|
+ <div style="color: #fff">刷新<van-icon name="replay" /></div>
|
|
|
+ </template>
|
|
|
</van-nav-bar>
|
|
|
<div class="move-stock">
|
|
|
<div class="code">
|
|
|
@@ -32,6 +31,8 @@
|
|
|
v-model="searchBarcode"
|
|
|
placeholder="请扫描商品条码"
|
|
|
@search="_handlerScan(searchBarcode)"
|
|
|
+ @input="onBarcodeChange"
|
|
|
+ @clear="onBarcodeClear"
|
|
|
label="商品条码:"
|
|
|
left-icon=""
|
|
|
:class="[scanType===2?'search-input-barcode':'','van-hairline--bottom']"
|
|
|
@@ -124,6 +125,8 @@
|
|
|
/>
|
|
|
<!-- 条码输入组件 -->
|
|
|
<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 >
|
|
|
@@ -171,17 +174,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-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 {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 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 {showNotify, showToast} from 'vant'
|
|
|
+import {barcodeToUpperCase} from '@/utils/dataType.js'
|
|
|
+import {getListCombineSku} from '@/api/picking'
|
|
|
+import MoveStockCombine from './components/MoveStockCombine.vue'
|
|
|
+
|
|
|
const router = useRouter()
|
|
|
const store = useStore()
|
|
|
try {
|
|
|
@@ -193,7 +199,7 @@ try {
|
|
|
const warehouse = store.warehouse
|
|
|
const pattern=/^[1-9]\d*$/
|
|
|
// 容器号和扫描类型的状态
|
|
|
-const containerNo = ref('')
|
|
|
+const containerNo = ref('FJ-WH01-1')
|
|
|
//输入框组件类型
|
|
|
const inputBarcodeType = ref('')
|
|
|
//扫描类型
|
|
|
@@ -207,12 +213,17 @@ 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()
|
|
|
@@ -238,7 +249,8 @@ const setBarcode = (code) => {
|
|
|
scanType.value = 2
|
|
|
containerNo.value = code
|
|
|
searchBarcode.value=''
|
|
|
- moveList.value=''
|
|
|
+ moveList.value=[]
|
|
|
+ combineData.value=null
|
|
|
location.value=''
|
|
|
// if(searchBarcode.value){
|
|
|
// _getInventoryList(searchBarcode.value)
|
|
|
@@ -251,6 +263,23 @@ 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)
|
|
|
@@ -266,8 +295,35 @@ 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) => {
|
|
|
+const _getInventoryList = async (barcode, fromCombineQuery = false) => {
|
|
|
const data = { warehouse, location: containerNo.value, barcode }
|
|
|
try {
|
|
|
showLoading()
|
|
|
@@ -275,25 +331,43 @@ const _getInventoryList = async (barcode) => {
|
|
|
closeLoading()
|
|
|
moveList.value = res.data
|
|
|
if (res.data.length === 0) {
|
|
|
- scanError()
|
|
|
- searchBarcode.value = ''
|
|
|
- showNotify({ duration: 5000, message: `条码:${barcode},未找到可还库库存,请检查条码!` })
|
|
|
+ _handleCombineProduct(barcode)
|
|
|
return
|
|
|
}
|
|
|
+ // 仅当直接扫描普通条码命中时清除组合标记;从组合商品内件查询来时保留
|
|
|
+ if (!fromCombineQuery) combineData.value = null
|
|
|
scanSuccess()
|
|
|
- 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
|
|
|
+ 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
|
|
|
})
|
|
|
- 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('')
|
|
|
//移动弹框
|
|
|
@@ -311,11 +385,30 @@ const onMove=(item)=>{
|
|
|
return
|
|
|
}
|
|
|
model.value=item
|
|
|
- moveCount.value=''
|
|
|
- moveStockTrueFalseBy.value=true
|
|
|
- setTimeout(()=>{
|
|
|
- countRef.value?.focus()
|
|
|
- },300)
|
|
|
+ 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 = ''
|
|
|
}
|
|
|
/**
|
|
|
* 确认还库
|
|
|
@@ -373,6 +466,7 @@ const createMoveStock=()=>{
|
|
|
location.value=''
|
|
|
moveList.value=[]
|
|
|
totalList.value=[]
|
|
|
+ combineData.value=null
|
|
|
}else {
|
|
|
location.value=''
|
|
|
_getInventoryList(searchBarcode.value)
|
|
|
@@ -434,7 +528,6 @@ const onSelectMode = async (value) => {
|
|
|
inputBarcodeRef.value?.show()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 数据刷新
|
|
|
const loadData = () => {
|
|
|
if(searchBarcode.value){
|