Browse Source

Revert "宝时快上-精准推荐第一版"

This reverts commit 09699867155bf58f38cf97d5a0cfa323419e7cc5.
zhaohuanhuan 2 weeks ago
parent
commit
ad871bbc29

+ 1 - 14
src/api/haikang/index.ts

@@ -1,7 +1,7 @@
 // @ts-ignore
 import request from '@/utils/request'
 // @ts-ignore
-import {getWaitPutawayListType, getRecommendedLocationType, getRecommendedLocationTypeNew, setBindAllocateWallType } from '@/types/haikang'
+import {getWaitPutawayListType, getRecommendedLocationType,setBindAllocateWallType } from '@/types/haikang'
 /**
  * 上架任务列表
  * @param params
@@ -24,19 +24,6 @@ export function getRecommendedLocation(params:getRecommendedLocationType) {
     params
   })
 }
-
-/**
- * 推荐库位-精准推荐
- * @param data
- */
-export function getRecommendedLocationNew(data:getRecommendedLocationTypeNew) {
-  return request({
-    url: '/api/basic/location/resource/getRecommendedLocation',
-    method: 'post',
-    data
-  })
-}
-
 /**
  * 商品绑定分拨墙格口
  * @param data

+ 4 - 46
src/types/haikang.ts

@@ -27,6 +27,9 @@ export interface getWaitPutawayListType {
   [property: string]: any;
 }
 
+/** 推荐区域:拣货区 / 存储区 / 挂装区 */
+export type PutawayArea = 'PICKING' | 'STORAGE' | 'HANGING'
+
 /**
  * 推荐库位
  * @param warehouse 仓库
@@ -47,52 +50,7 @@ export interface getRecommendedLocationType {
   /**
    * 推荐区域
    */
-  putawayArea?: string;
-  [property: string]: any;
-}
-
-/**
- * 推荐库位查询对象
- *
- * LocationRecommendedQO
- */
-export interface getRecommendedLocationTypeNew {
-  /**
-   * 需排除的库位列表
-   */
-  excludedLocations?: string[];
-  /**
-   * 批次号
-   */
-  lotNum: string;
-  /**
-   * 货主编码
-   */
-  owner: string;
-  /**
-   * 数量
-   */
-  qty: number;
-  /**
-   * 商品SKU
-   */
-  sku: string;
-  /**
-   * 仓库编码
-   */
-  warehouse: string;
-  /**
-   * 库区组
-   */
-  zoneGroup?: string;
-  /**
-   * 推荐场景,如退货上架 RETURN_SHELVE
-   */
-  scene?: string;
-  /**
-   * 库位类型 PICKING(拣货位) STORAGE(存储位),不传或全部时不筛选
-   */
-  locationUse?: string;
+  putawayArea?: PutawayArea;
   [property: string]: any;
 }
 

+ 4 - 6
src/views/inbound/putaway/components/LocationList.vue

@@ -11,9 +11,9 @@
       </thead>
       <tbody>
       <tr v-for="(item, index) in props.locationList" :key="index" v-if="props.locationList.length>0">
-        <td>{{ item.locationId }}</td>
-        <td>{{ (locationType[item.locationUsage] || item.locationUsage) }}</td>
-        <td>{{ item.qty || 0}}</td>
+        <td>{{ item.location }}</td>
+        <td>{{ locationType[item.type] || item.type }}</td>
+        <td>{{ item.quantity || 0 }}</td>
         <td>{{ item.max || '无' }}</td>
       </tr>
       <tr v-else>
@@ -28,8 +28,6 @@
 <script setup lang="ts">
 //库位类型
 const locationType = {
-  'GY': '挂装区',
-  'TH': '退货拣货位',
   'EA': '件拣货库位',
   'AP': '补充拣货位',
   'CS': '箱拣货库位',
@@ -43,7 +41,7 @@ const locationType = {
 }
 const props = defineProps({
   locationList: Array,
-})
+});
 </script>
 <style scoped lang="sass">
 .move-stock-list

+ 0 - 3
src/views/inbound/putaway/task/index.vue

@@ -610,9 +610,6 @@ const _getRecommendedLocation = async (item, options = {}) => {
       searchCount.value = 1
     }
   } catch (err) {
-    forcePublishEnabled.value=true
-    locationList.value=[]
-    scanError()
     console.error(err)
   }
 }

+ 37 - 53
src/views/outbound/check/large/index.vue

@@ -6,9 +6,13 @@
         <van-icon name="arrow-left" size="25" />
         <div style="color: #fff">返回</div>
       </template>
+      <!--      <template #right>-->
+      <!--        <div class="nav-right" @click="onClickRight">提交任务</div>-->
+      <!--      </template>-->
     </van-nav-bar>
     <div class="large">
       <div class="large-title">
+        <!--        <div><span style="font-size: 12px">订单号:</span>{{ orderNo || '&#45;&#45;' }}</div>-->
         <div class="large-tips">
           <van-notice-bar :background="'none'" :speed="50" :text="tips" />
         </div>
@@ -122,6 +126,7 @@
 import { onMounted, onUnmounted, computed, ref } from 'vue'
 import { androidFocus, getHeader, goBack, scanError, scanSuccess } from '@/utils/android'
 import { closeListener, openListener, scanInit } from '@/utils/keydownListener'
+import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
 import { useStore } from '@/store/modules/user'
 import { closeLoading, showLoading } from '@/utils/loading'
 import { getOrderPacking, getPendingReviewTask, listEnableCheckDocumentPrint, reversePicking } from '@/api/check'
@@ -129,7 +134,6 @@ import { barcodeToUpperCase } from '@/utils/dataType'
 import { showConfirmDialog, showDialog, showNotify, showToast } from 'vant'
 import { fluxPrint } from '@/api/picking'
 import Printer from '@/components/Printer.vue'
-import InputBarcode from '@/views/outbound/picking/components/InputBarcode.vue'
 import CheckPacking from '@/views/outbound/check/components/CheckPacking.vue'
 import BatchPacking from '@/views/outbound/check/components/BatchPacking.vue'
 import PackingList from '@/views/outbound/check/components/PackingList.vue'
@@ -139,7 +143,6 @@ try {
   getHeader()
   androidFocus()
 } catch (error) {
-  router.push('/login')
 }
 // 页面初始化
 onMounted(() => {
@@ -207,6 +210,7 @@ const packingCount = computed(() => {
   return packingList.value.reduce((sum, item) => sum + (+item.qty || 0), 0);
 })
 
+//
 //扫描订单产品总数
 const scanOrderBarcodeCount = computed(() => {
   return dataList.value.reduce((sum, item) => {
@@ -249,52 +253,42 @@ const matchBarcodeList = ref([])
 const barcodeNumberTrueFalseBy = ref(false)
 const barcodeNumberRef = ref(null)
 const barcodeNumber=ref('')
+const pattern=/^[0-9]\d*$/
 const _handlerScan = async (code) => {
-  if (code) { 
-    // 含唯一码/IMEI 的订单仅允许 PC 端复核
-    if (isUniqueCode.value) { 
+  if (code) {
+    if (isUniqueCode.value) {
       scanError()
       scanBarcode.value = ''
       showNotify({ type: 'warning', duration: 3000, message: `此单包含唯一码/IMEI码,请到PC复核` })
       return
     }
-    // 待复核(60)/部分复核(600) 行:主副条码、SKU、69 码去重,作合法扫描集合
-    const barcode = [...new Set( 
+    const barcode = [...new Set(
       orderList.value
         .filter(item => (item.status == '60' || item.status == '600'))
         .flatMap(item => [item.barcode, item.barcode2, item.sku, item.universalCode])
         .filter(value => value !== null && value !== '' && value !== undefined),
     )]
-    // 与大写后的集合元素比对,忽略大小写
-    const checkBarcode = barcodeToUpperCase(code) 
-    // 扫描条码匹配
-    if (barcode.some(item => barcodeToUpperCase(item) === checkBarcode)) { 
-      // 将命中行排到列表前,其余保持顺序在后
-      dataList.value = await barcodeMatching(checkBarcode) 
-      // 当前码对应且仍有待扫数量
-      matchBarcodeList.value = dataList.value.filter(item => (item.barcode === checkBarcode || item.sku === checkBarcode || item.barcode2 === checkBarcode || item.universalCode == checkBarcode)
-          && (item.status == '60' || item.status == '600') && item.qty > 0) 
-      // 有匹配行则继续处理
+    const checkBarcode = barcodeToUpperCase(code)
+    if (barcode.some(item => barcodeToUpperCase(item) === checkBarcode)) {
+      dataList.value = await barcodeMatching(checkBarcode)
+      matchBarcodeList.value = dataList.value.filter(item => (item.barcode === checkBarcode || item.sku === checkBarcode || item.barcode2 === checkBarcode || item.universalCode == checkBarcode) && (item.status == '60' || item.status == '600') && item.qty > 0)
       if (matchBarcodeList.value.length > 0) {
-        scanBarcode.value = code 
-        // 匹配行 qty 求和
-        const allCount = matchBarcodeList.value.reduce((sum, item) => sum + Number(item.qty), 0) 
-        // 弹出数量录入
-        if (allCount > 1) { 
+        scanBarcode.value = code
+        const allCount = matchBarcodeList.value.reduce((sum, item) => sum + Number(item.qty), 0)
+        if (allCount > 1) {
           barcodeNumberTrueFalseBy.value = true
           setTimeout(() => {
             barcodeNumber.value=''
-            barcodeNumberRef.value?.focus() // 延迟聚焦,避免与扫描框抢焦点
+            barcodeNumberRef.value?.focus()
           },300)
           return
         }
-        // 仅一件则直接按 1 扣减
-        cutBarcode([matchBarcodeList.value[0]], 1) 
+        cutBarcode([matchBarcodeList.value[0]], 1)
       } else {
         scanBarcode.value = ''
         scanError()
         tips.value = `商品条码${code},已全部扫描完成`
-        showNotify({ type: 'warning', duration: 3000, message: `商品条码${code},已全部扫描完成` }) 
+        showNotify({ type: 'warning', duration: 3000, message: `商品条码${code},已全部扫描完成` })
       }
     } else {
       scanBarcode.value = ''
@@ -350,15 +344,12 @@ const cutBarcode = (list, count) => { //扣减数量
   // 更新扫描数据的逻辑
   const updateData = (item) => {
     const itemIndex = dataList.value.findIndex(data => data.lotNum === item.lotNum)
-    // 扣减的数量
-    const deductedAmount = item.originalDetailAmount - item.qty 
+    const deductedAmount = item.originalDetailAmount - item.qty // 扣减的数量
     if (itemIndex !== -1) {
       dataList.value[itemIndex] = {
         ...dataList.value[itemIndex],
-         // 更新实际扣减的数量
-        quantity: dataList.value[itemIndex].quantity + deductedAmount,
-        // 更新原始数量
-        oldQuantity:dataList.value[itemIndex].oldQuantity + deductedAmount,
+        quantity: dataList.value[itemIndex].quantity + deductedAmount, // 更新实际扣减的数量
+        oldQuantity:dataList.value[itemIndex].oldQuantity + deductedAmount, // 更新实际扣减的数量
       }
     } else {
       item.quantity = deductedAmount
@@ -367,22 +358,21 @@ const cutBarcode = (list, count) => { //扣减数量
     }
   }
   list.forEach(item => {
-    // 如果剩余数量为0,停止扣减
-    if (remainingCount <= 0) return  
-    // 保存原始数量
-    item.originalDetailAmount = item.qty 
+    if (remainingCount <= 0) return  // 如果剩余数量为0,停止扣减
+    item.originalDetailAmount = item.qty // 保存原始数量
     if (item.qty > 0) {
-      // 剩余数量大于当前商品的数量,则直接扣除当前商品的数量
+      // 如果剩余数量大于当前商品的数量,则直接扣除当前商品的数量
       if (remainingCount >= item.qty) {
         remainingCount -= item.qty
         item.qty = 0
-      } else { 
-        item.qty -= remainingCount  
+      } else {
+        item.qty -= remainingCount  // 扣减剩余数量
         remainingCount = 0
       }
+      item.isPacking=true
     }
     if (item.qty !== item.originalDetailAmount) {
-      updateData(item)  
+      updateData(item)  // 更新扫描数据
       scanBarcode.value = ''
       tips.value = '请继续扫描商品'
       scanSuccess()
@@ -391,16 +381,14 @@ const cutBarcode = (list, count) => { //扣减数量
   const materiaList=orderList.value.filter(item=>item.status=='600' && item.qty>0)
   const endOrder=orderList.value.filter(item=>item.status=='60' && item.qty>0)
   if(materiaList.length ==0 &&endOrder.length==0){
-    // 进行装箱
     setPacking('single')
     return
   }
 }
-
+// 进行装箱
 const checkPackingRef=ref(null)
 const currPackingList=ref([])
 const batchPackingRef=ref(null)
-// 装箱
 const setPacking=(type)=>{
   if(!printer.value){
     scanError()
@@ -426,11 +414,9 @@ const setPacking=(type)=>{
       return
     }
   }
-   // 普通装箱
-  if (type === 'single') {
+  if (type === 'single') { // 普通装箱
     checkPackingRef.value?.show(currPackingList.value, orderDetail.value)
-  } else { 
-    // 批量装箱
+  } else { // 批量装箱
     const list =orderList.value.filter(item => item.isPacking && item.status=='60')
     if (list.length > 1) {
       scanError()
@@ -547,6 +533,9 @@ const printPickingList=(deliveryNo,curPackingList)=> {
 }
 const printRequests = async(index, dataList)=> {
   if (index >= dataList.length) {
+    // if (this.orderList.length == 0) {
+    //   this.getOrderList();
+    // }
     return;
   }
   try {
@@ -608,7 +597,7 @@ const setBarcode = (code) => {
       tips.value = '请扫描商品条码'
       _getOrderPacking(res.data.orderNo)
       scanSuccess()
-      // 处理详情
+      // 处理每个详情
       res.data.details.forEach((item) => {
         item.quantity = 0
         item.oldQuantity = 0
@@ -685,14 +674,11 @@ const _reversePicking = () => {
     closeLoading()
   })
 }
-// 订单装箱明细原始列表(接口返回,未合并)
 const packingList=ref([])
-// 拉取订单装箱数据:按 sku+traceId 合并数量,再按 traceId 分组;type===1 时弹出装箱清单
 const _getOrderPacking=(orderNo,type)=>{
   showLoading()
   getOrderPacking({ warehouse, code:orderNo }).then(res => {
     packingList.value=res.data
-    // 相同 sku + 追溯码合并为一条,数量累加
     const mergedList = Object.values(
       res.data.reduce((acc, item) => {
         const { sku, traceId, qty } = item
@@ -705,7 +691,6 @@ const _getOrderPacking=(orderNo,type)=>{
         return acc;
       }, {})
     )
-    // 装箱行列表
     packingDetailMap.value = mergedList.reduce((acc, item) => {
       const { traceId } = item
       acc[traceId] = acc[traceId] || []
@@ -716,7 +701,6 @@ const _getOrderPacking=(orderNo,type)=>{
       packingListRef.value?.show(packingDetailMap.value,orderDetail.value)
     }
   }).catch(err => {
-    // 请求失败时清空分组,避免沿用旧数据
     packingDetailMap.value = {}
   }).finally(f=>{
     closeLoading()