|
@@ -129,8 +129,6 @@
|
|
|
<attribute ref="attributeRef" @set-attribute="setAttribute" />
|
|
<attribute ref="attributeRef" @set-attribute="setAttribute" />
|
|
|
<!-- 商品批次属性-->
|
|
<!-- 商品批次属性-->
|
|
|
<lot-date ref="lotDateRef" @select-lot-date="selectLotDate" />
|
|
<lot-date ref="lotDateRef" @select-lot-date="selectLotDate" />
|
|
|
- <!-- 组合商品-->
|
|
|
|
|
- <barcode-combine ref="barcodeCombineRef" @setCombine="setCombineReceiving" @cancel="onCombineCancel" :container="containerNo" :matched-sku="combineMatchedSku" />
|
|
|
|
|
<!-- 唯一码-->
|
|
<!-- 唯一码-->
|
|
|
<unique-code-input ref="uniqueCodeRef"
|
|
<unique-code-input ref="uniqueCodeRef"
|
|
|
v-model:uniqueCodeList="uniqueCodeList"
|
|
v-model:uniqueCodeList="uniqueCodeList"
|
|
@@ -170,7 +168,6 @@ import {
|
|
|
getReceivingAsnDetails,
|
|
getReceivingAsnDetails,
|
|
|
setProductAttribute, setReceiving,
|
|
setProductAttribute, setReceiving,
|
|
|
} from '@/api/takeDelivery/index'
|
|
} from '@/api/takeDelivery/index'
|
|
|
-import { getListCombineSku } from '@/api/picking'
|
|
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
import { useStore } from '@/store/modules/user'
|
|
import { useStore } from '@/store/modules/user'
|
|
|
import { showNotify, showToast } from 'vant'
|
|
import { showNotify, showToast } from 'vant'
|
|
@@ -178,9 +175,7 @@ import { isAttribute } from '@/views/inbound/takeDelivery/task/hooks/attribute'
|
|
|
import Attribute from '@/views/inbound/takeDelivery/components/Attribute.vue'
|
|
import Attribute from '@/views/inbound/takeDelivery/components/Attribute.vue'
|
|
|
import LotDate from '@/views/inbound/takeDelivery/components/LotDate.vue'
|
|
import LotDate from '@/views/inbound/takeDelivery/components/LotDate.vue'
|
|
|
import UniqueCodeInput from '@/views/inbound/takeDelivery/components/UniqueCodeInput.vue'
|
|
import UniqueCodeInput from '@/views/inbound/takeDelivery/components/UniqueCodeInput.vue'
|
|
|
-import BarcodeCombine from '@/views/inbound/takeDelivery/components/BarcodeCombine.vue'
|
|
|
|
|
-import { receivingBarcodeCombine } from '@/views/inbound/takeDelivery/task/hooks/barcodeCombine'
|
|
|
|
|
-import { barcodeToUpperCase, toMap } from '@/utils/dataType'
|
|
|
|
|
|
|
+import { barcodeToUpperCase, toMap } from '@/utils/dataType.js'
|
|
|
import { getCurrentTime } from '@/utils/date'
|
|
import { getCurrentTime } from '@/utils/date'
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
@@ -193,7 +188,7 @@ try {
|
|
|
}
|
|
}
|
|
|
const warehouse = store.warehouse
|
|
const warehouse = store.warehouse
|
|
|
//开单任务号
|
|
//开单任务号
|
|
|
-const taskNo = ref('BSSH20260318000003')
|
|
|
|
|
|
|
+const taskNo = ref('')
|
|
|
//容器号
|
|
//容器号
|
|
|
const containerNo = ref('')
|
|
const containerNo = ref('')
|
|
|
//商品条码
|
|
//商品条码
|
|
@@ -206,8 +201,6 @@ const taskInfo = ref({ receivedQty: 0, expectedQty: 0 })
|
|
|
const currentTime = ref('--')
|
|
const currentTime = ref('--')
|
|
|
const scanType = ref(2)
|
|
const scanType = ref(2)
|
|
|
|
|
|
|
|
-//任务号下所有asn单数据
|
|
|
|
|
-const allAsnDetailList=ref([])
|
|
|
|
|
const type=localStorage.getItem('checkAllType')?JSON.parse(localStorage.getItem('checkAllType')):true
|
|
const type=localStorage.getItem('checkAllType')?JSON.parse(localStorage.getItem('checkAllType')):true
|
|
|
const checkAllType=ref(type)
|
|
const checkAllType=ref(type)
|
|
|
// 页面初始化
|
|
// 页面初始化
|
|
@@ -251,9 +244,10 @@ const stopTimer = () => {
|
|
|
|
|
|
|
|
const back = ref(true)
|
|
const back = ref(true)
|
|
|
const inputBarcodeType = ref('task')
|
|
const inputBarcodeType = ref('task')
|
|
|
|
|
+//输入框组件
|
|
|
const inputBarcodeRef = ref(null)
|
|
const inputBarcodeRef = ref(null)
|
|
|
const oldSearchBarcode = ref('')
|
|
const oldSearchBarcode = ref('')
|
|
|
-// 任务号/容器号:code 为任务号时拉取任务及ASN明细
|
|
|
|
|
|
|
+// 设置容器号
|
|
|
const setBarcode = (code, type) => {
|
|
const setBarcode = (code, type) => {
|
|
|
if (inputBarcodeType.value === 'lot') {
|
|
if (inputBarcodeType.value === 'lot') {
|
|
|
lotData.value.forEach((lot) => {
|
|
lotData.value.forEach((lot) => {
|
|
@@ -277,6 +271,9 @@ const setBarcode = (code, type) => {
|
|
|
taskNo.value=''
|
|
taskNo.value=''
|
|
|
taskInfo.value={}
|
|
taskInfo.value={}
|
|
|
switchTask()
|
|
switchTask()
|
|
|
|
|
+ }else {
|
|
|
|
|
+ taskInfo.value=res.data
|
|
|
|
|
+ taskNo.value=code
|
|
|
}
|
|
}
|
|
|
containerNo.value=''
|
|
containerNo.value=''
|
|
|
stopTimer()
|
|
stopTimer()
|
|
@@ -287,15 +284,11 @@ const setBarcode = (code, type) => {
|
|
|
startTimer()
|
|
startTimer()
|
|
|
containerNo.value=''
|
|
containerNo.value=''
|
|
|
}
|
|
}
|
|
|
|
|
+ taskInfo.value=res.data
|
|
|
|
|
+ taskNo.value=code
|
|
|
}
|
|
}
|
|
|
- taskInfo.value=res.data
|
|
|
|
|
- taskNo.value=code
|
|
|
|
|
scanType.value=2
|
|
scanType.value=2
|
|
|
uniqueCodeList.value=[]
|
|
uniqueCodeList.value=[]
|
|
|
- const params = { warehouse, asnNos: taskInfo.value?.asnNos.join(',') }
|
|
|
|
|
- getReceivingAsnDetails(params).then(res => {
|
|
|
|
|
- allAsnDetailList.value = res.data
|
|
|
|
|
- })
|
|
|
|
|
scanSuccess()
|
|
scanSuccess()
|
|
|
}).catch(err=>{
|
|
}).catch(err=>{
|
|
|
inputBarcodeRef.value?.show('', '请扫描开单任务号',err.message)
|
|
inputBarcodeRef.value?.show('', '请扫描开单任务号',err.message)
|
|
@@ -305,8 +298,9 @@ const setBarcode = (code, type) => {
|
|
|
closeLoading()
|
|
closeLoading()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-setBarcode('BSSH20260318000003')
|
|
|
|
|
|
|
+// setBarcode('BSSH20250605000006')
|
|
|
|
|
|
|
|
|
|
+//切换任务
|
|
|
const switchTask = () => {
|
|
const switchTask = () => {
|
|
|
inputBarcodeType.value = 'switchTask'
|
|
inputBarcodeType.value = 'switchTask'
|
|
|
back.value = false
|
|
back.value = false
|
|
@@ -324,19 +318,13 @@ const reset = () => {
|
|
|
searchBarcode.value = ''
|
|
searchBarcode.value = ''
|
|
|
oldSearchBarcode.value = ''
|
|
oldSearchBarcode.value = ''
|
|
|
uniqueCodeList.value = []
|
|
uniqueCodeList.value = []
|
|
|
- combineMatchedSku.value = []
|
|
|
|
|
- combineAsnSelectList.value = []
|
|
|
|
|
- isCombineSelectMode.value = false
|
|
|
|
|
- combineReceivingData.value = []
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+// 选择单据
|
|
|
const onDetailActive = (item) => {
|
|
const onDetailActive = (item) => {
|
|
|
- if (isCombineSelectMode.value) {
|
|
|
|
|
- _onCombineAsnSelected(item)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
asnInfo.value = item
|
|
asnInfo.value = item
|
|
|
asnDetailsTrueFalseBy.value = false
|
|
asnDetailsTrueFalseBy.value = false
|
|
|
searchCount.value=1
|
|
searchCount.value=1
|
|
|
|
|
+ // searchCount.value = asnInfo.value.expectedQuantity - asnInfo.value.receivedQuantity
|
|
|
_getProductAttribute(item)
|
|
_getProductAttribute(item)
|
|
|
_getProductLot(item)
|
|
_getProductLot(item)
|
|
|
_getCommodityRule(item)
|
|
_getCommodityRule(item)
|
|
@@ -350,104 +338,29 @@ const onAsnCancel = () => {
|
|
|
}
|
|
}
|
|
|
const uniqueCodeList = ref([])
|
|
const uniqueCodeList = ref([])
|
|
|
|
|
|
|
|
-// 组合商品
|
|
|
|
|
-const barcodeCombineRef = ref(null)
|
|
|
|
|
-const combineMatchedSku = ref([])
|
|
|
|
|
-const combineAsnSelectList = ref([])
|
|
|
|
|
-const isCombineSelectMode = ref(false)
|
|
|
|
|
-const combineReceivingData = ref([]) // 确认实收数后暂存,完成收货时提交
|
|
|
|
|
-
|
|
|
|
|
-// 组合商品只支持1个
|
|
|
|
|
-const _handleCombineProduct = (code) => {
|
|
|
|
|
- showLoading()
|
|
|
|
|
- getListCombineSku({ combineSku: barcodeToUpperCase(code), workEnvironment: 'receiving' }).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 combineData = res.data
|
|
|
|
|
- const matchedList = receivingBarcodeCombine(allAsnDetailList.value, toMap(combineData, 'barcode'))
|
|
|
|
|
- if (!matchedList.length) return _err('组合商品与待收货数据不匹配,请检查组合商品配置!')
|
|
|
|
|
- const asnGroupMap = matchedList.reduce((acc, detail) => {
|
|
|
|
|
- const key = detail.asnNo
|
|
|
|
|
- if (!acc[key]) acc[key] = { asnNo: detail.asnNo, customerId: detail.customerId, expectedQuantity: 0, list: [] }
|
|
|
|
|
- acc[key].list.push(detail)
|
|
|
|
|
- acc[key].expectedQuantity += (detail.expectedQuantity || 0) - (detail.receivedQuantity || 0)
|
|
|
|
|
- return acc
|
|
|
|
|
- }, {})
|
|
|
|
|
- const asnOptions = Object.values(asnGroupMap)
|
|
|
|
|
- if (asnOptions.length > 1) {
|
|
|
|
|
- isCombineSelectMode.value = true
|
|
|
|
|
- combineAsnSelectList.value = asnOptions
|
|
|
|
|
- combineMatchedSku.value = matchedList
|
|
|
|
|
- asnDetailsList.value = asnOptions.map((opt) => ({ asnNo: opt.asnNo, customerId: opt.customerId, expectedQuantity: opt.expectedQuantity }))
|
|
|
|
|
- asnDetailsTrueFalseBy.value = true
|
|
|
|
|
- } else {
|
|
|
|
|
- _showCombineDialog(matchedList)
|
|
|
|
|
- }
|
|
|
|
|
- closeLoading()
|
|
|
|
|
- scanSuccess()
|
|
|
|
|
- }).catch(() => { closeLoading(); scanError() })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-const _showCombineDialog = (matchedList) => {
|
|
|
|
|
- combineMatchedSku.value = matchedList
|
|
|
|
|
- asnInfo.value = matchedList[0]
|
|
|
|
|
- _getProductAttribute(matchedList[0])
|
|
|
|
|
- _getProductLot(matchedList[0])
|
|
|
|
|
- _getCommodityRule(matchedList[0])
|
|
|
|
|
- barcodeCombineRef.value?.show()
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 组合商品取消:收货数量=1套总件数
|
|
|
|
|
-const onCombineCancel = () => {
|
|
|
|
|
- const total = combineMatchedSku.value.reduce((sum, row) => sum + (row.matchedJson?.quantity || 0), 0)
|
|
|
|
|
- searchCount.value = total ? String(total) : '1'
|
|
|
|
|
- combineReceivingData.value = []
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-const _onCombineAsnSelected = (item) => {
|
|
|
|
|
- const selected = combineAsnSelectList.value.find((opt) => opt.asnNo === item.asnNo)
|
|
|
|
|
- if (selected?.list) _showCombineDialog(selected.list)
|
|
|
|
|
- asnDetailsTrueFalseBy.value = isCombineSelectMode.value = false
|
|
|
|
|
- combineAsnSelectList.value = []
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 组合商品确认实收数
|
|
|
|
|
-const setCombineReceiving = ({ dataList }) => {
|
|
|
|
|
- if (!dataList?.length) return
|
|
|
|
|
- const total = dataList.reduce((sum, row) => sum + (row.quantity || 0), 0)
|
|
|
|
|
- searchCount.value = String(total)
|
|
|
|
|
- combineReceivingData.value = dataList
|
|
|
|
|
- showNotify({ type: 'success', duration: 2000, message: `已填入收货数量:${total},请点击完成收货提交` })
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// 条码扫描:scanType 2商品/4数量/3唯一码/5容器
|
|
|
|
|
|
|
+// 扫描条码监听
|
|
|
const _handlerScan = (code) => {
|
|
const _handlerScan = (code) => {
|
|
|
if (scanType.value == 2) {
|
|
if (scanType.value == 2) {
|
|
|
searchBarcode.value = code
|
|
searchBarcode.value = code
|
|
|
oldSearchBarcode.value = code
|
|
oldSearchBarcode.value = code
|
|
|
- if ( allAsnDetailList.value.length > 0) {
|
|
|
|
|
- const upperCode = barcodeToUpperCase(code) || ''
|
|
|
|
|
- const clientMatched = allAsnDetailList.value.filter((detail) => {
|
|
|
|
|
- const bars = [detail.barcode, detail.barcode2, detail.sku].filter(Boolean)
|
|
|
|
|
- return bars.some((bar) => bar && barcodeToUpperCase(bar) === upperCode)
|
|
|
|
|
- })
|
|
|
|
|
- asnDetailsList.value = clientMatched
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const params = { warehouse, barcode: code, asnNos: taskInfo.value?.asnNos.join(',') }
|
|
|
|
|
+ showLoading()
|
|
|
|
|
+ getReceivingAsnDetails(params).then(res => {
|
|
|
uniqueCodeList.value=[]
|
|
uniqueCodeList.value=[]
|
|
|
-
|
|
|
|
|
- if (asnDetailsList.value.length > 0) {
|
|
|
|
|
|
|
+ asnDetailsList.value = res.data
|
|
|
|
|
+ if (res.data.length > 0) {
|
|
|
scanSuccess()
|
|
scanSuccess()
|
|
|
closeLoading()
|
|
closeLoading()
|
|
|
- if (asnDetailsList.value.length == 1) {
|
|
|
|
|
- const item = asnDetailsList.value[0]
|
|
|
|
|
|
|
+ if (res.data.length == 1) {
|
|
|
|
|
+ const item = res.data[0]
|
|
|
asnInfo.value = item
|
|
asnInfo.value = item
|
|
|
- searchCount.value = 1
|
|
|
|
|
|
|
+ // searchCount.value = item.expectedQuantity - item.receivedQuantity
|
|
|
|
|
+ searchCount.value=1
|
|
|
_getProductAttribute(item)
|
|
_getProductAttribute(item)
|
|
|
_getProductLot(item)
|
|
_getProductLot(item)
|
|
|
_getCommodityRule(item)
|
|
_getCommodityRule(item)
|
|
|
}
|
|
}
|
|
|
- if (asnDetailsList.value.length > 1) {
|
|
|
|
|
|
|
+ if (res.data.length > 1) {
|
|
|
asnInfo.value = {}
|
|
asnInfo.value = {}
|
|
|
lotData.value = []
|
|
lotData.value = []
|
|
|
searchCount.value = ''
|
|
searchCount.value = ''
|
|
@@ -455,14 +368,21 @@ const _handlerScan = (code) => {
|
|
|
asnDetailsTrueFalseBy.value = true
|
|
asnDetailsTrueFalseBy.value = true
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- _handleCombineProduct(code)
|
|
|
|
|
|
|
+ scanError()
|
|
|
|
|
+ showNotify({ type: 'danger', duration: 3000, message: `暂未查询到条码《${code}》信息请重试` })
|
|
|
|
|
+ reset()
|
|
|
|
|
+ closeLoading()
|
|
|
}
|
|
}
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ scanError()
|
|
|
|
|
+ closeLoading()
|
|
|
|
|
+ })
|
|
|
} else if (scanType.value == 3) {
|
|
} else if (scanType.value == 3) {
|
|
|
if (code) {
|
|
if (code) {
|
|
|
const uniqueCodeScanType = uniqueCodeRef.value?.uniqueCodeScanType
|
|
const uniqueCodeScanType = uniqueCodeRef.value?.uniqueCodeScanType
|
|
|
if (checkAllType.value && uniqueCodeScanType === 'barcode') {
|
|
if (checkAllType.value && uniqueCodeScanType === 'barcode') {
|
|
|
const barcode = Array.from(new Set([asnInfo.value.barcode, asnInfo.value.barcode2, asnInfo.value.sku].filter(Boolean)));
|
|
const barcode = Array.from(new Set([asnInfo.value.barcode, asnInfo.value.barcode2, asnInfo.value.sku].filter(Boolean)));
|
|
|
- if (barcode.some((bar) => barcodeToUpperCase(bar) === barcodeToUpperCase(code))) {
|
|
|
|
|
|
|
+ if (barcode.some(item => barcodeToUpperCase(item) === barcodeToUpperCase(code))) {
|
|
|
scanSuccess();
|
|
scanSuccess();
|
|
|
uniqueCodeRef.value.uniqueCodeScanType = 'unique'
|
|
uniqueCodeRef.value.uniqueCodeScanType = 'unique'
|
|
|
uniqueCodeRef.value.uniqueBarcode = code
|
|
uniqueCodeRef.value.uniqueBarcode = code
|
|
@@ -508,7 +428,9 @@ const _handlerScan = (code) => {
|
|
|
scanType.value=2
|
|
scanType.value=2
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-// 物理属性
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 物理属性
|
|
|
|
|
+ */
|
|
|
const attributeRef = ref(null)
|
|
const attributeRef = ref(null)
|
|
|
const attributeMap = ref({})
|
|
const attributeMap = ref({})
|
|
|
const attributeTrueFalseBy = ref(true)
|
|
const attributeTrueFalseBy = ref(true)
|
|
@@ -539,8 +461,14 @@ const setAttribute = (data) => {
|
|
|
scanError()
|
|
scanError()
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+/**
|
|
|
|
|
+ * 物理属性 end
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
-// 批次属性
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 商品批次属性
|
|
|
|
|
+ */
|
|
|
|
|
+// 获取商品批次属性
|
|
|
const lotData = ref([])
|
|
const lotData = ref([])
|
|
|
const _getProductLot = (item) => {
|
|
const _getProductLot = (item) => {
|
|
|
const params = { warehouse: item.warehouse, owner: item.customerId, barcode: item.sku }
|
|
const params = { warehouse: item.warehouse, owner: item.customerId, barcode: item.sku }
|
|
@@ -646,7 +574,12 @@ const selectLotDate = (date) => {
|
|
|
inputBarcodeType.value = 'task'
|
|
inputBarcodeType.value = 'task'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 唯一码
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 商品批次属性end
|
|
|
|
|
+ */
|
|
|
|
|
+/**
|
|
|
|
|
+ * 唯一码
|
|
|
|
|
+ */
|
|
|
const uniqueCodeRef = ref(null)
|
|
const uniqueCodeRef = ref(null)
|
|
|
//规则列表
|
|
//规则列表
|
|
|
const uniqueRuleList = ref([])
|
|
const uniqueRuleList = ref([])
|
|
@@ -666,9 +599,12 @@ const _getCommodityRule = (item) => {
|
|
|
uniqueRuleMap.value = toMap(res.data, 'type', 'uniqueRegExp')
|
|
uniqueRuleMap.value = toMap(res.data, 'type', 'uniqueRegExp')
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+/**
|
|
|
|
|
+ * 唯一码end
|
|
|
|
|
+ */
|
|
|
const containerNoRef = ref(null)
|
|
const containerNoRef = ref(null)
|
|
|
const numberRef = ref(null)
|
|
const numberRef = ref(null)
|
|
|
-// 完成收货前校验
|
|
|
|
|
|
|
+// 完成收货校验
|
|
|
const isCheck = () => {
|
|
const isCheck = () => {
|
|
|
if (!asnInfo.value.asnNo) {
|
|
if (!asnInfo.value.asnNo) {
|
|
|
scanError()
|
|
scanError()
|
|
@@ -744,7 +680,7 @@ const isCheck = () => {
|
|
|
}
|
|
}
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
-// 完成收货
|
|
|
|
|
|
|
+// 收货
|
|
|
const onConfirm = () => {
|
|
const onConfirm = () => {
|
|
|
if(isCheck()){
|
|
if(isCheck()){
|
|
|
const lotMap = toMap(lotData.value, 'field', 'mapping')
|
|
const lotMap = toMap(lotData.value, 'field', 'mapping')
|
|
@@ -787,6 +723,9 @@ const loadData = () => {
|
|
|
if (!taskNo.value) {
|
|
if (!taskNo.value) {
|
|
|
inputBarcodeRef.value?.show('', '请扫描开单任务号','')
|
|
inputBarcodeRef.value?.show('', '请扫描开单任务号','')
|
|
|
return
|
|
return
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // currentTime.value=getCurrentTime()
|
|
|
|
|
+ // startTimer()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|