|
|
@@ -243,9 +243,9 @@ const isLocationInRecommendedList = (locationCode) => {
|
|
|
}
|
|
|
|
|
|
// 从已排除库位记录中提取 locationId 列表(换一换时使用)
|
|
|
-const getExcludedLocationIds = (listByLot) => {
|
|
|
- if (!listByLot.length) return undefined
|
|
|
- return [...new Set(listByLot.map(loc => (typeof loc === 'string' ? loc : loc?.locationId)).filter(Boolean))]
|
|
|
+const getExcludedLocationIds = (list) => {
|
|
|
+ if (!list.length) return undefined
|
|
|
+ return [...new Set(list.map(loc => (typeof loc === 'string' ? loc : loc?.locationId)).filter(Boolean))]
|
|
|
}
|
|
|
|
|
|
// 单一批次命中:获取推荐库位并进入库位扫描
|
|
|
@@ -467,7 +467,7 @@ const matchingBarcodeItem = (data, barcode) => {
|
|
|
const switchTask = () => {
|
|
|
inputBarcodeType.value = 'switchTask'
|
|
|
back.value = false
|
|
|
- if (systemForcePublishEnabled.value) excludedLocations.value = {}
|
|
|
+ if (systemForcePublishEnabled.value) excludedLocations.value = []
|
|
|
locationType.value = ''
|
|
|
changeLocationTypePickerRef.value?.clearCache()
|
|
|
inputBarcodeRef.value?.show('', `请扫描容器号`, '')
|
|
|
@@ -481,8 +481,8 @@ const barcodeActiveList = ref([])
|
|
|
const barcodeCombineRef = ref(null)
|
|
|
const putawayCombineData = ref(null)
|
|
|
const combineMatchedSku = ref([])
|
|
|
-// 已推荐过的库位,按 lotNum 批次维度存储,用于换一换时排除
|
|
|
-const excludedLocations = ref({})
|
|
|
+// 已推荐过的库位,用于换一换时排除
|
|
|
+const excludedLocations = ref([])
|
|
|
// 换一换按钮 loading
|
|
|
const changeLocationLoading = ref(false)
|
|
|
// 上架区域,默认全部
|
|
|
@@ -499,7 +499,7 @@ const onSelectLocationType = async (value = '') => {
|
|
|
locationType.value = value
|
|
|
locationTypeSheetShow.value = false
|
|
|
if (value !== prev && barcodeActiveList.value.length > 0) {
|
|
|
- excludedLocations.value = {}
|
|
|
+ excludedLocations.value = []
|
|
|
await _getRecommendedLocation(barcodeActiveList.value[0])
|
|
|
}
|
|
|
}
|
|
|
@@ -512,7 +512,7 @@ const reset = () => {
|
|
|
barcodeActiveList.value = []
|
|
|
putawayCombineData.value = null
|
|
|
combineMatchedSku.value = []
|
|
|
- excludedLocations.value = {}
|
|
|
+ excludedLocations.value = []
|
|
|
forbidForcePutaway.value = true // 重置为默认不强制,待下次推荐接口返回后再更新
|
|
|
locationType.value = ''
|
|
|
}
|
|
|
@@ -595,7 +595,7 @@ const _handlePutawayCombineProduct = (code) => {
|
|
|
// 扫描条码监听
|
|
|
const _handlerScan = (code) => {
|
|
|
if (scanType.value === SCAN_TYPE.BARCODE) {
|
|
|
- excludedLocations.value = {}
|
|
|
+ excludedLocations.value = []
|
|
|
searchBarcode.value = code
|
|
|
oldSearchBarcode.value = code
|
|
|
lotBarcodeList.value = matchingBarcodeItem(dataMap.value, code)
|
|
|
@@ -639,8 +639,7 @@ const _getRecommendedLocation = async (item, options = {}) => {
|
|
|
return
|
|
|
}
|
|
|
const { fromChangeLocation = false } = options
|
|
|
- const listByLot = fromChangeLocation ? (excludedLocations.value[lotNumber] || []) : []
|
|
|
- const uniqueLocationIds = getExcludedLocationIds(listByLot)
|
|
|
+ const uniqueLocationIds = fromChangeLocation ? getExcludedLocationIds(excludedLocations.value) : undefined
|
|
|
try {
|
|
|
const total = barcodeQuantity(barcodeActiveList.value)
|
|
|
const params = { warehouse, lotNum: lotNumber, owner, sku, qty: total, lotAtt08 }
|
|
|
@@ -651,15 +650,6 @@ const _getRecommendedLocation = async (item, options = {}) => {
|
|
|
if (res.data) {
|
|
|
forbidForcePutaway.value = res.data.forbidForcePutaway // 货主策略:是否禁止强制上架
|
|
|
const loc = res.data.locationList
|
|
|
- if (fromChangeLocation) {
|
|
|
- // 按批次维度存储已推荐库位(与接口 locationList 项一致,含 locationId),用于后续换一换排除
|
|
|
- const lotExcluded = excludedLocations.value[lotNumber] || []
|
|
|
- const recommended = Array.isArray(loc) ? loc : []
|
|
|
- excludedLocations.value = {
|
|
|
- ...excludedLocations.value,
|
|
|
- [lotNumber]: [...lotExcluded, ...recommended]
|
|
|
- }
|
|
|
- }
|
|
|
locationList.value = loc
|
|
|
searchCount.value = 1
|
|
|
}
|
|
|
@@ -681,14 +671,8 @@ const doChangeLocationWithType = async (item) => {
|
|
|
changeLocationLoading.value = true
|
|
|
try {
|
|
|
const batchItem = barcodeActiveList.value[0]
|
|
|
- const lotNumber = batchItem.lotNumber
|
|
|
- const currentLoc = locationList.value?.[0]
|
|
|
- if (currentLoc) {
|
|
|
- const lotExcluded = excludedLocations.value[lotNumber] || []
|
|
|
- excludedLocations.value = {
|
|
|
- ...excludedLocations.value,
|
|
|
- [lotNumber]: [...lotExcluded, currentLoc]
|
|
|
- }
|
|
|
+ if (locationList.value?.length) {
|
|
|
+ excludedLocations.value = [...excludedLocations.value, ...locationList.value]
|
|
|
}
|
|
|
const reqOpts = { fromChangeLocation: true }
|
|
|
if (item?.value) reqOpts.changeTypeName = item.value
|