ソースを参照

Revert "还库-增加组合商品"

This reverts commit 2f64393e0bc0f99820a34a027b348b85f002fcc9.
zhaohuanhuan 2 週間 前
コミット
9bfaae798b

+ 0 - 105
src/views/outbound/check/moveStock/components/MoveStockCombine.vue

@@ -1,105 +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 }}件 </div>
-            </template>
-          </van-cell>
-          <div class="goods-lot">生产:{{ item.productionDate || '--' }}, 失效:{{ item.expirationDate || '--' }}</div>
-        </div>
-      </div>
-      <div class="goods-number">可还套数:{{ maxCount }}</div>
-      <van-field label="还库套数" type="number" class="code-input" v-model="count" ref="countRef" placeholder="还库套数" autocomplete="off" />
-    </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: () => [] }
-})
-const matchedSkuList = computed(() => props.matchedSku)
-const maxCount = computed(() => {
-  const min = Math.min(
-    ...props.matchedSku.map((item) => (item.expectedQuantity || 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) }
-  })
-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
-  .goods-lot
-    font-size: 12px
-    color: #666
-    margin-left: 20px
-    text-align: left
-</style>

+ 32 - 125
src/views/outbound/check/moveStock/index.vue

@@ -6,15 +6,16 @@
       fixed
       placeholder
       @click-left="goBack"
-      @click-right="refresh"
     >
       <template #left>
         <van-icon name="arrow-left" size="25" />
         <div  style="color: #fff">返回</div>
       </template>
-      <template #right>
-        <div style="color: #fff">刷新<van-icon name="replay" /></div>
-      </template>
+<!--      <template #right>-->
+<!--        <div class="nav-right" @click="onClickRight">-->
+<!--          <van-icon name="list-switch" size="25" />-->
+<!--        </div>-->
+<!--      </template>-->
     </van-nav-bar>
     <div class="move-stock">
       <div class="code">
@@ -31,8 +32,6 @@
             v-model="searchBarcode"
             placeholder="请扫描商品条码"
             @search="_handlerScan(searchBarcode)"
-            @input="onBarcodeChange"
-            @clear="onBarcodeClear"
             label="商品条码:"
             left-icon=""
             :class="[scanType===2?'search-input-barcode':'','van-hairline--bottom']"
@@ -125,8 +124,6 @@
     />
     <!-- 条码输入组件 -->
     <input-barcode :back="back" @setBarcode="setBarcode" ref="inputBarcodeRef" />
-    <!-- 组合商品还库 -->
-    <move-stock-combine ref="moveStockCombineRef" :matched-sku="combineMatchedSku" @set-combine="setCombineMoveStock" @cancel="onCombineCancel" />
     <van-dialog v-model:show="moveStockTrueFalseBy"
                 :beforeClose="beforeClose"
                 :title="'商品条码:'+ model.sku +',还库:'+location" show-cancel-button  >
@@ -174,20 +171,17 @@
 </template>
 
 <script setup>
-import {computed, onMounted, onUnmounted, ref} from 'vue'
-import {useRouter} from 'vue-router'
-import {useStore} from '@/store/modules/user'
-import {androidFocus, getHeader, goBack, scanError, scanSuccess} from '@/utils/android'
-import {closeListener, openListener, scanInit} from '@/utils/keydownListener'
-import {getInventory, getInventoryList, movementReturn} from '@/api/check/index'
+import { onMounted, onUnmounted, ref, computed } from 'vue'
+import { useRouter } from 'vue-router'
+import { useStore } from '@/store/modules/user'
+import { androidFocus, getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
+import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
+import { getInventory, getInventoryList, movementReturn } from '@/api/check/index'
 import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
-import {closeLoading, showLoading} from '@/utils/loading'
+import { closeLoading, showLoading } from '@/utils/loading'
 import nodataUrl from '@/assets/nodata.png'
-import {showNotify, showToast} from 'vant'
-import {barcodeToUpperCase} from '@/utils/dataType.js'
-import {getListCombineSku} from '@/api/picking'
-import MoveStockCombine from './components/MoveStockCombine.vue'
-
+import { showNotify, showToast } from 'vant'
+import { barcodeToUpperCase } from '@/utils/dataType.js'
 const router = useRouter()
 const store = useStore()
 try {
@@ -199,7 +193,7 @@ try {
 const warehouse = store.warehouse
 const pattern=/^[1-9]\d*$/
 // 容器号和扫描类型的状态
-const containerNo = ref('FJ-WH01-1')
+const containerNo = ref('')
 //输入框组件类型
 const inputBarcodeType = ref('')
 //扫描类型
@@ -213,17 +207,12 @@ const totalList=ref([])
 const searchRef=ref(null)
 //扫描条码
 const searchBarcode=ref('')
-const oldSearchBarcode=ref('')
 //扫描库位
 const location=ref('')
 //
 const model=ref({})
 const countRef=ref(null)
 const back=ref(true)
-// 组合商品还库
-const moveStockCombineRef = ref(null)
-const combineData = ref(null)
-const combineMatchedSku = ref([])
 // 页面初始化
 onMounted(() => {
   openListener()
@@ -249,8 +238,7 @@ const setBarcode = (code) => {
   scanType.value = 2
   containerNo.value = code
   searchBarcode.value=''
-  moveList.value=[]
-  combineData.value=null
+  moveList.value=''
   location.value=''
   // if(searchBarcode.value){
   //   _getInventoryList(searchBarcode.value)
@@ -263,23 +251,6 @@ const _setContainerNo=()=>{
   inputBarcodeRef.value?.show('', '请扫描反拣容器')
 }
 
-// 商品条码调整时,清空还库推荐、库存列表、还库库位
-const onBarcodeChange = () => {
-  if (searchBarcode.value === '' || (oldSearchBarcode.value && oldSearchBarcode.value.length !== searchBarcode.value.length)) {
-    moveList.value = []
-    totalList.value = []
-    location.value = ''
-    combineData.value = null
-  }
-}
-const onBarcodeClear = () => {
-  moveList.value = []
-  totalList.value = []
-  location.value = ''
-  combineData.value = null
-  oldSearchBarcode.value = ''
-}
-
 // 扫描条码监听
 const _handlerScan = (code) => {
   console.log(code)
@@ -295,35 +266,8 @@ const _handlerScan = (code) => {
   }
 }
 
-// 商品条码查询为空时,查询组合商品列表
-const _handleCombineProduct = async (code) => {
-  try {
-    showLoading()
-    const res = await getListCombineSku({ combineSku: barcodeToUpperCase(code), workEnvironment: 'movement' })
-    closeLoading()
-    const _err = (msg) => {
-      scanError()
-      searchBarcode.value = ''
-      showNotify({ type: 'danger', duration: 5000, message: msg })
-    }
-    if (!res.data?.length) return _err(`条码:${code},未找到可还库库存,请检查条码!`)
-    if (res.data.length > 1) return _err('组合商品不支持多商品')
-    const innerBarcode = res.data[0].barcode
-    combineData.value = res.data[0]
-    searchBarcode.value = code
-    oldSearchBarcode.value = code
-    _getInventoryList(innerBarcode, true)
-    scanSuccess()
-  } catch (err) {
-    closeLoading()
-    scanError()
-    searchBarcode.value = ''
-    showNotify({ type: 'danger', duration: 5000, message: `条码查询失败,请检查条码!` })
-  }
-}
-
 // 获取库存数据
-const _getInventoryList = async (barcode, fromCombineQuery = false) => {
+const _getInventoryList = async (barcode) => {
   const data = { warehouse, location: containerNo.value, barcode }
   try {
     showLoading()
@@ -331,43 +275,25 @@ const _getInventoryList = async (barcode, fromCombineQuery = false) => {
     closeLoading()
     moveList.value = res.data
     if (res.data.length === 0) {
-      _handleCombineProduct(barcode)
+      scanError()
+      searchBarcode.value = ''
+      showNotify({ duration: 5000, message: `条码:${barcode},未找到可还库库存,请检查条码!` })
       return
     }
-    // 仅当直接扫描普通条码命中时清除组合标记;从组合商品内件查询来时保留
-    if (!fromCombineQuery) combineData.value = null
     scanSuccess()
-    if (!fromCombineQuery) {
-      searchBarcode.value = res.data[0].sku
-      oldSearchBarcode.value = res.data[0].sku
-    }
-    const params = { warehouse, barcode, locationRegexp: '^(?!STAGE_|SORTATION_|REVERSEPICK_|FJ-|TRANSFER_).*$', queryLocationInfo: true }
-    if (barcode === '') return
-    getInventory(params).then(res => {
-      totalList.value = res.data
+    searchBarcode.value= res.data[0].sku
+    const params={ warehouse, barcode,locationRegexp:'^(?!STAGE_|SORTATION_|REVERSEPICK_|FJ-|TRANSFER_).*$',queryLocationInfo:true }
+    if(barcode==='') return
+    getInventory(params).then(res=>{
+      totalList.value=res.data
     })
-    scanType.value = 3
+    scanType.value=3
   } catch (err) {
     closeLoading()
     console.error(err)
   }
 }
 
-// 刷新
-const refresh = () => {
-  moveList.value = []
-  totalList.value = []
-  location.value = ''
-  combineData.value = null
-  scanType.value = 2
-  if (containerNo.value && searchBarcode.value) {
-    oldSearchBarcode.value = ''
-    _getInventoryList(searchBarcode.value)
-  } else {
-    loadData()
-  }
-}
-
 //移动数量
 const moveCount=ref('')
 //移动弹框
@@ -385,30 +311,11 @@ const onMove=(item)=>{
     return
   }
   model.value=item
-  if (combineData.value) {
-    combineMatchedSku.value = [{ ...item, matchedJson: combineData.value, expectedQuantity: item.availableQty }]
-    moveStockCombineRef.value?.show()
-  } else {
-    moveCount.value=''
-    moveStockTrueFalseBy.value=true
-    setTimeout(()=>{
-      countRef.value?.focus()
-    },300)
-  }
-}
-
-// 组合商品还库确认
-const setCombineMoveStock = ({ dataList }) => {
-  if (!dataList?.[0]) return
-  const row = dataList[0]
-  moveCount.value = String(row.quantity)
-  model.value = { ...model.value, ...row }
-  createMoveStock()
-}
-
-// 组合商品还库取消
-const onCombineCancel = () => {
-  moveCount.value = ''
+  moveCount.value=''
+  moveStockTrueFalseBy.value=true
+  setTimeout(()=>{
+    countRef.value?.focus()
+  },300)
 }
 /**
  * 确认还库
@@ -466,7 +373,6 @@ const  createMoveStock=()=>{
       location.value=''
       moveList.value=[]
       totalList.value=[]
-      combineData.value=null
     }else {
       location.value=''
       _getInventoryList(searchBarcode.value)
@@ -528,6 +434,7 @@ const onSelectMode = async (value) => {
     inputBarcodeRef.value?.show()
   }
 }
+
 // 数据刷新
 const loadData = () => {
   if(searchBarcode.value){