Przeglądaj źródła

Revert "收货-增加组合商品扫描"

This reverts commit ed612aed3eaffe8f45da87f8c9af0e9de4e0774d.
zhaohuanhuan 3 tygodni temu
rodzic
commit
beb84628cc

+ 0 - 100
src/views/inbound/takeDelivery/components/BarcodeCombine.vue

@@ -1,100 +0,0 @@
-<template>
-  <div class="goods">
-    <van-dialog v-model:show="goodsTrueFalseBy"
-                :beforeClose="beforeClose"
-                title="组合商品包含"
-                show-cancel-button>
-        <div style="width:100%;max-height:150px;overflow:auto">
-          <div v-for="(item,index) in matchedSkuList" :key="index">
-            <van-cell center :title="item.matchedJson.barcode" :label="item.matchedJson.skuName">
-              <template #value>
-                <div>{{ item.matchedJson.quantity }}件</div>
-                <div class="goods-tips">预期数量:{{ (item.expectedQuantity || 0) - (item.receivedQuantity || 0) }}件</div>
-              </template>
-            </van-cell>
-          </div>
-        </div>
-        <div class="goods-number">应收数量:{{ maxCount }}</div>
-        <van-field label="实收数" type="number" class="code-input" v-model="count" ref="countRef" placeholder="实收数" />
-    </van-dialog>
-  </div>
-</template>
-<script setup>
-/** 组合商品弹框 */
-import { computed, ref } from 'vue'
-import { showToast } from 'vant'
-const goodsTrueFalseBy = ref(false)
-const countRef = ref(null)
-const count = ref('')
-const props = defineProps({
-  matchedSku: { type: Array, default: () => [] },
-  container: { type: String, default: '' }
-})
-const matchedSkuList = computed(() => props.matchedSku)
-const maxCount = computed(() => {
-  const min = Math.min(
-    ...props.matchedSku.map((item) => ((item.expectedQuantity || 0) - (item.receivedQuantity || 0)) / (item.matchedJson?.quantity || 1))
-  )
-  return Number.isFinite(min) ? Math.floor(min) : 0
-})
-const show = () => {
-  count.value = ''
-  goodsTrueFalseBy.value = true
-  setTimeout(() => {
-    countRef.value?.focus()
-  }, 200)
-}
-const dataResult = (data) =>
-  data.map((item) => {
-    const { matchedJson, ...rest } = item
-    return { ...rest, quantity: matchedJson.quantity * Number(count.value), containerId: props.container }
-  })
-const emit = defineEmits(['setCombine', 'cancel'])
-const beforeClose = (action) =>
-  new Promise((resolve) => {
-    if (action === 'confirm') {
-      if (count.value == '') {
-        showToast('请输入收货数量')
-        return resolve(false)
-      }
-      if (Number(count.value) <= 0) {
-        showToast('请输入标准收货数量')
-        return resolve(false)
-      }
-      if (Number(count.value) > maxCount.value) {
-        showToast({ duration: 3000, message: '收货数量不能大于应收数量' })
-        return resolve(false)
-      }
-      const dataList = dataResult(matchedSkuList.value)
-      emit('setCombine', { dataList, count: Number(count.value) })
-    } else {
-      emit('cancel')
-    }
-    resolve(true)
-  })
-defineExpose({ show })
-</script>
-<style scoped lang="sass">
-.goods
-  .code-input
-    font-size: 16px
-    font-weight: bold
-    border-bottom: 2px solid #0077ff
-  :deep(.van-cell--center)
-    padding: 5px 20px
-  :deep(.van-cell__title)
-    text-align: left !important
-  :deep(.van-cell__value)
-    width: 40% !important
-    flex: 0 0 40% !important
-    color: #000
-  .goods-number
-    text-align: left
-    font-size: 16px
-    padding-left: 20px
-    margin-top: 5px
-  .goods-tips
-    font-size: 12px
-    text-align: right
-    color: #333
-</style>

+ 0 - 19
src/views/inbound/takeDelivery/task/hooks/barcodeCombine.js

@@ -1,19 +0,0 @@
-import { barcodeToUpperCase } from '@/utils/dataType'
-
-/** 组合商品:匹配ASN明细中条码,附加 matchedJson */
-export function receivingBarcodeCombine(asnDetailList, combineSkuMap) {
-  if (!combineSkuMap || !Array.isArray(asnDetailList) || !asnDetailList.length) return []
-  const mapUpper = Object.fromEntries(
-    Object.entries(combineSkuMap).filter(([barcode]) => barcode).map(([barcode, config]) => [barcodeToUpperCase(barcode), config])
-  )
-  return asnDetailList
-    .map((item) => {
-      const barcodes = [item.barcode, item.barcode2, item.sku].filter(Boolean)
-      const matchedBar = barcodes.find((bar) => mapUpper[barcodeToUpperCase(bar)])
-      if (!matchedBar) return null
-      const matched = mapUpper[barcodeToUpperCase(matchedBar)]
-      const remaining = (item.expectedQuantity || 0) - (item.receivedQuantity || 0)
-      return remaining >= matched.quantity ? { ...item, matchedJson: matched } : null
-    })
-    .filter(Boolean)
-}