|
|
@@ -148,6 +148,8 @@
|
|
|
<location-list :locationList="locationList" />
|
|
|
</div>
|
|
|
</van-action-sheet>
|
|
|
+ <!-- 组合商品上架数量-->
|
|
|
+ <barcode-combine ref="barcodeCombineRef" @setCombine="setPutawayCombine" @cancel="onCombineCancel" :matched-sku="combineMatchedSku" />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
@@ -155,6 +157,7 @@ import { onMounted, onUnmounted, ref, computed } from 'vue'
|
|
|
import { androidFocus, getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
|
|
|
import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
|
|
|
import LocationList from '@/views/inbound/putaway/components/LocationList.vue'
|
|
|
+import BarcodeCombine from '@/views/inbound/putaway/components/BarcodeCombine.vue'
|
|
|
import { openListener,closeListener,scanInit } from '@/utils/keydownListener.js'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
@@ -162,6 +165,7 @@ import { useStore } from '@/store/modules/user'
|
|
|
import { showNotify, showToast } from 'vant'
|
|
|
import { getCurrentTime } from '@/utils/date'
|
|
|
import { getWaitPutawayListNew, setPutawayNew } from '@/api/putaway/index'
|
|
|
+import { getListCombineSku } from '@/api/picking'
|
|
|
import { barcodeToUpperCase } from '@/utils/dataType.js'
|
|
|
import { getRecommendedLocation } from '@/api/haikang/index'
|
|
|
import { getOwnerList } from '@/hooks/basic/index'
|
|
|
@@ -182,7 +186,7 @@ onMounted(() => {
|
|
|
})
|
|
|
const warehouse = store.warehouse
|
|
|
//容器号
|
|
|
-const containerNo = ref('')
|
|
|
+const containerNo = ref('zhh-c')
|
|
|
//数据列表
|
|
|
const dataList = ref([])
|
|
|
//
|
|
|
@@ -376,6 +380,10 @@ const switchTask = () => {
|
|
|
const lotBarcodeList = ref([])
|
|
|
const lotBarcodeTrueFalseBy = ref(false)
|
|
|
const barcodeActiveList = ref([])
|
|
|
+// 组合商品
|
|
|
+const barcodeCombineRef = ref(null)
|
|
|
+const putawayCombineData = ref(null)
|
|
|
+const combineMatchedSku = ref([])
|
|
|
const reset = () => {
|
|
|
searchCount.value = ''
|
|
|
searchBarcode.value = ''
|
|
|
@@ -383,11 +391,42 @@ const reset = () => {
|
|
|
oldSearchBarcode.value = ''
|
|
|
locationList.value = []
|
|
|
barcodeActiveList.value = []
|
|
|
+ putawayCombineData.value = null
|
|
|
+ combineMatchedSku.value = []
|
|
|
+}
|
|
|
+// 组合商品上架数量弹框
|
|
|
+const _showPutawayCombineDialog = (batchItem) => {
|
|
|
+ if (!putawayCombineData.value || !batchItem?.length) return
|
|
|
+ const total = batchItem.reduce((sum, i) => sum + Number(i.quantity || 0), 0)
|
|
|
+ combineMatchedSku.value = [{
|
|
|
+ matchedJson: putawayCombineData.value,
|
|
|
+ expectedQuantity: total,
|
|
|
+ receivedQuantity: 0,
|
|
|
+ }]
|
|
|
+ barcodeCombineRef.value?.show()
|
|
|
+}
|
|
|
+// 组合商品确认上架数量
|
|
|
+const setPutawayCombine = ({ dataList }) => {
|
|
|
+ if (dataList?.[0]?.quantity != null) {
|
|
|
+ searchCount.value = String(dataList[0].quantity)
|
|
|
+ }
|
|
|
+ showNotify({ type: 'success', duration: 2000, message: `已填入上架数量:${searchCount.value},请扫描库位并确认上架` })
|
|
|
+}
|
|
|
+// 组合商品取消
|
|
|
+const onCombineCancel = () => {
|
|
|
+ const qtyPerSet = putawayCombineData.value?.quantity ?? 1
|
|
|
+ searchCount.value = String(qtyPerSet)
|
|
|
}
|
|
|
// 选择单据
|
|
|
const onDetailActive = (item) => {
|
|
|
barcodeActiveList.value = item
|
|
|
lotBarcodeTrueFalseBy.value = false
|
|
|
+ if (putawayCombineData.value) {
|
|
|
+ _showPutawayCombineDialog(item)
|
|
|
+ _getRecommendedLocation(item[0].lotNumber, item[0].owner)
|
|
|
+ scanType.value = 3
|
|
|
+ return
|
|
|
+ }
|
|
|
searchCount.value = 1
|
|
|
scanType.value = 3
|
|
|
_getRecommendedLocation(item[0].lotNumber, item[0].owner)
|
|
|
@@ -400,6 +439,46 @@ const onAsnCancel = () => {
|
|
|
locationList.value = []
|
|
|
}
|
|
|
}
|
|
|
+// 商品条码不匹配时,查询组合条码
|
|
|
+const _handlePutawayCombineProduct = (code) => {
|
|
|
+ showLoading()
|
|
|
+ getListCombineSku({ combineSku: barcodeToUpperCase(code), workEnvironment: 'inbound' })
|
|
|
+ .then((res) => {
|
|
|
+ const _err = (msg) => {
|
|
|
+ closeLoading()
|
|
|
+ scanError()
|
|
|
+ showNotify({ type: 'danger', duration: 3000, message: msg })
|
|
|
+ reset()
|
|
|
+ }
|
|
|
+ if (!res.data?.length) return _err(`${code}-商品条码不匹配,请重新扫描`)
|
|
|
+ if (res.data.length > 1) return _err('不支持多商品组合商品')
|
|
|
+ const combineBarcode = res.data[0].barcode
|
|
|
+ lotBarcodeList.value = matchingBarcodeItem(dataMap.value, combineBarcode)
|
|
|
+ if (lotBarcodeList.value.length === 0) return _err('组合商品与待上架数据不匹配,请检查组合商品配置!')
|
|
|
+ putawayCombineData.value = res.data[0]
|
|
|
+ closeLoading()
|
|
|
+ scanSuccess()
|
|
|
+ if (lotBarcodeList.value.length === 1) {
|
|
|
+ barcodeActiveList.value = lotBarcodeList.value[0]
|
|
|
+ _showPutawayCombineDialog(lotBarcodeList.value[0])
|
|
|
+ _getRecommendedLocation(barcodeActiveList.value[0].lotNumber, barcodeActiveList.value[0].owner)
|
|
|
+ scanType.value = 3
|
|
|
+ } else {
|
|
|
+ locationList.value = []
|
|
|
+ barcodeActiveList.value = []
|
|
|
+ searchCount.value = ''
|
|
|
+ searchLocation.value = ''
|
|
|
+ lotBarcodeTrueFalseBy.value = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ closeLoading()
|
|
|
+ scanError()
|
|
|
+ showNotify({ type: 'danger', duration: 3000, message: `${code}-商品条码不匹配,请重新扫描` })
|
|
|
+ reset()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 扫描条码监听
|
|
|
const _handlerScan = (code) => {
|
|
|
if (scanType.value == 2) {
|
|
|
@@ -407,6 +486,8 @@ const _handlerScan = (code) => {
|
|
|
oldSearchBarcode.value = code
|
|
|
lotBarcodeList.value = matchingBarcodeItem(dataMap.value, code)
|
|
|
if (lotBarcodeList.value.length > 0) {
|
|
|
+ putawayCombineData.value = null
|
|
|
+ combineMatchedSku.value = []
|
|
|
if (lotBarcodeList.value.length == 1) {
|
|
|
barcodeActiveList.value = lotBarcodeList.value[0]
|
|
|
_getRecommendedLocation(barcodeActiveList.value[0].lotNumber, barcodeActiveList.value[0].owner)
|
|
|
@@ -420,14 +501,12 @@ const _handlerScan = (code) => {
|
|
|
lotBarcodeTrueFalseBy.value = true
|
|
|
}
|
|
|
} else {
|
|
|
- scanError()
|
|
|
- showNotify({ type: 'danger', duration: 3000, message: `${code}-商品条码不匹配,请重新扫描` })
|
|
|
- reset()
|
|
|
+ _handlePutawayCombineProduct(code)
|
|
|
}
|
|
|
} else if (scanType.value == 3) {
|
|
|
searchLocation.value = barcodeToUpperCase(code)
|
|
|
scanType.value = 4
|
|
|
- searchCount.value = 1
|
|
|
+ if (!searchCount.value) searchCount.value = 1
|
|
|
scanSuccess()
|
|
|
}
|
|
|
}
|