diff --git a/src/pages/scrap/record/scrapRecord.vue b/src/pages/scrap/record/scrapRecord.vue index 503e5010..d52e7e92 100644 --- a/src/pages/scrap/record/scrapRecord.vue +++ b/src/pages/scrap/record/scrapRecord.vue @@ -19,7 +19,17 @@ - + + + + @@ -46,7 +56,9 @@ import { onLoad, onNavigationBarButtonTap, onReady, onReachBottom, onPullDownRef import { scrapRecordSubmit } from '@/api/request2.js' import { goHome, deepCopyData } from '@/common/basic.js' - +import { + calc +} from '@/common/calc' import { getInventoryStatusDesc, getDirectoryItemArray, getScarpReasonList } from '@/common/directory.js' import { getBusinessType, createItemInfo, createDetailInfo, calcHandleQty } from '@/common/record.js' @@ -56,7 +68,8 @@ import winScanPack from '@/mycomponents/scan/winScanPack.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue' import winScanLocation from '@/mycomponents/scan/winScanLocation.vue' import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.vue' -import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' +import RecordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' +import RecordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue' import { useCountStore } from '@/store' // 获取自定义的store const store = useCountStore() @@ -77,6 +90,7 @@ const comMessageRef = ref() const scanPopup = ref() const scanLocationCode = ref() const managementList = ref([]) +const managementType = ref('') const show = ref(false) const reasonCode = ref('') onLoad((option) => { @@ -102,8 +116,46 @@ onNavigationBarButtonTap((e) => { goHome() } }) - -const getScanResult = (result) => { +const getScanResult = (result, managementTypeParams)=> { + managementType.value = managementTypeParams + console.log("模式" + managementTypeParams) + if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") { + setDataBatch(result) + } else { + setData(result) + } +} +const setDataBatch = (result)=> { + let {balance,label} = result; + let pack = result.package; + let item = detailSource.value.find(res => { + if (res.itemCode == balance.itemCode) { + return res + } + }) + if (item == undefined) { + const itemp = createItemInfo(balance, pack); + let newDetail = createDetailInfo(balance, pack); // + itemp.subList.push(newDetail); + detailSource.value.push(itemp) + } else { + const detail = item.subList.find(r => { + if (r.batch == balance.batch && + r.locationCode == balance.locationCode && + r.inventoryStatus == balance.inventoryStatus) { + return r; + } + }) + if (detail == undefined) { + let newDetail = createDetailInfo(balance, pack); + item.subList.push(newDetail); + } else { + detail.handleQty = calc.add(detail.handleQty, result.label.qty) + } + } + calcHandleQty(detailSource.value) +} +const setData = (result) => { const { balance } = result const { label } = result const pack = result.package @@ -157,11 +209,17 @@ const removePack = () => { } const openScanPopup = () => { - if (fromLocationCode.value == '') { - showFromLocationPopup() - return + if (this.businessType) { + if (fromLocationCode.value == '') { + showFromLocationPopup() + return + } + scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) + }else { + //TODO 没有定义 + // getBusinessType() } - scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value) + } const showFromLocationPopup = () => { nextTick(() => {