|
|
@@ -1,14 +1,18 @@
|
|
|
<template>
|
|
|
<div class="container">
|
|
|
<van-nav-bar
|
|
|
- title="复核-大件单" left-arrow fixed placeholder @click-left="goBack">
|
|
|
+ title="复核-大件单" left-arrow fixed placeholder @click-left="goBack">
|
|
|
<template #left>
|
|
|
<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 || '--' }}</div>-->
|
|
|
<div class="large-tips">
|
|
|
<van-notice-bar :background="'none'" :speed="50" :text="tips" />
|
|
|
</div>
|
|
|
@@ -16,7 +20,7 @@
|
|
|
</div>
|
|
|
<div class="scan-barcode">
|
|
|
<van-field v-model.lazy="scanBarcode" label-align="left" placeholder="请扫描商品条码/SKU" label="商品条码:"
|
|
|
- ref="barcodeNumberRef" class="input-barcode" autocomplete="off" @keydown.enter="_handlerScan(scanBarcode)" />
|
|
|
+ ref="barcodeNumberRef" class="input-barcode" autocomplete="off" @keydown.enter="_handlerScan(scanBarcode)" />
|
|
|
</div>
|
|
|
<div class="order-detail">
|
|
|
<div class="picking-no">
|
|
|
@@ -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(() => {
|
|
|
@@ -175,22 +178,22 @@ const statusMap = {
|
|
|
const dataList = ref([])
|
|
|
const orderList = computed(() => {
|
|
|
return dataList.value
|
|
|
- .filter(item => item.qty !== 0 || item.isPacking)
|
|
|
- .sort((a, b) => {
|
|
|
- const statusPriority = {
|
|
|
- '60': 0,
|
|
|
- '600': 1,
|
|
|
- '50': 2,
|
|
|
- '40': 3,
|
|
|
- '30': 4,
|
|
|
- '20': 5,
|
|
|
- '00': 6,
|
|
|
- }
|
|
|
- if (statusPriority[a.status] !== statusPriority[b.status]) {
|
|
|
- return statusPriority[a.status] - statusPriority[b.status]
|
|
|
- }
|
|
|
- return 0
|
|
|
- })
|
|
|
+ .filter(item => item.qty !== 0 || item.isPacking)
|
|
|
+ .sort((a, b) => {
|
|
|
+ const statusPriority = {
|
|
|
+ '60': 0,
|
|
|
+ '600': 1,
|
|
|
+ '50': 2,
|
|
|
+ '40': 3,
|
|
|
+ '30': 4,
|
|
|
+ '20': 5,
|
|
|
+ '00': 6,
|
|
|
+ }
|
|
|
+ if (statusPriority[a.status] !== statusPriority[b.status]) {
|
|
|
+ return statusPriority[a.status] - statusPriority[b.status]
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
//订单产品总数
|
|
|
@@ -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,169 +253,153 @@ 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(
|
|
|
- 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 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() // 延迟聚焦,避免与扫描框抢焦点
|
|
|
- },300)
|
|
|
+ barcodeNumber.value = ''
|
|
|
+ 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 = ''
|
|
|
tips.value = `商品条码${code},不匹配请重新扫描!`
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: `商品条码${code},不匹配请重新扫描!` })
|
|
|
+ showNotify({type: 'warning', duration: 3000, message: `商品条码${code},不匹配请重新扫描!`})
|
|
|
scanError()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-const onSubmitCount=()=>{
|
|
|
- if(!barcodeNumber.value){
|
|
|
- tips.value='请输入数量'
|
|
|
- showToast({duration:5000,message:'请输入数量'})
|
|
|
+const onSubmitCount = () => {
|
|
|
+ if (!barcodeNumber.value) {
|
|
|
+ tips.value = '请输入数量'
|
|
|
+ showToast({duration: 5000, message: '请输入数量'})
|
|
|
return
|
|
|
}
|
|
|
const allCount = matchBarcodeList.value.reduce((sum, item) => sum + Number(item.qty), 0)
|
|
|
- if(Number(barcodeNumber.value)>allCount){
|
|
|
- const message='数量不能大于最大数量'+allCount
|
|
|
- tips.value=message
|
|
|
- showToast({duration:5000,message})
|
|
|
+ if (Number(barcodeNumber.value) > allCount) {
|
|
|
+ const message = '数量不能大于最大数量' + allCount
|
|
|
+ tips.value = message
|
|
|
+ showToast({duration: 5000, message})
|
|
|
return
|
|
|
}
|
|
|
- barcodeNumberTrueFalseBy.value=false
|
|
|
+ barcodeNumberTrueFalseBy.value = false
|
|
|
cutBarcode(matchBarcodeList.value, barcodeNumber.value)
|
|
|
}
|
|
|
-const beforeClose= (action) =>
|
|
|
- new Promise((resolve) => {
|
|
|
- if(action==='confirm'){
|
|
|
- if(!barcodeNumber.value){
|
|
|
- tips.value='请输入数量'
|
|
|
- showToast({duration:5000,message:'请输入数量'})
|
|
|
- return resolve(false)
|
|
|
- }
|
|
|
- const allCount = matchBarcodeList.value.reduce((sum, item) => sum + Number(item.qty), 0)
|
|
|
- if(Number(barcodeNumber.value)>allCount){
|
|
|
- const message='数量不能大于最大数量'+allCount
|
|
|
- tips.value=message
|
|
|
- showToast({duration:5000,message})
|
|
|
- return resolve(false)
|
|
|
+const beforeClose = (action) =>
|
|
|
+ new Promise((resolve) => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ if (!barcodeNumber.value) {
|
|
|
+ tips.value = '请输入数量'
|
|
|
+ showToast({duration: 5000, message: '请输入数量'})
|
|
|
+ return resolve(false)
|
|
|
+ }
|
|
|
+ const allCount = matchBarcodeList.value.reduce((sum, item) => sum + Number(item.qty), 0)
|
|
|
+ if (Number(barcodeNumber.value) > allCount) {
|
|
|
+ const message = '数量不能大于最大数量' + allCount
|
|
|
+ tips.value = message
|
|
|
+ showToast({duration: 5000, message})
|
|
|
+ return resolve(false)
|
|
|
+ }
|
|
|
+ resolve(true)
|
|
|
+ cutBarcode(matchBarcodeList.value, barcodeNumber.value)
|
|
|
+ } else {
|
|
|
+ tips.value = '您已取消扣减扫描商品,请重新扫描'
|
|
|
+ scanBarcode.value = ''
|
|
|
+ matchBarcodeList.value = []
|
|
|
+ resolve(true)
|
|
|
}
|
|
|
- resolve(true)
|
|
|
- cutBarcode(matchBarcodeList.value, barcodeNumber.value)
|
|
|
- }else {
|
|
|
- tips.value='您已取消扣减扫描商品,请重新扫描'
|
|
|
- scanBarcode.value=''
|
|
|
- matchBarcodeList.value=[]
|
|
|
- resolve(true)
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
+ });
|
|
|
const cutBarcode = (list, count) => { //扣减数量
|
|
|
let remainingCount = 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
|
|
|
- item.oldQuantity=deductedAmount
|
|
|
+ item.oldQuantity = deductedAmount
|
|
|
dataList.value.push(item)
|
|
|
}
|
|
|
}
|
|
|
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()
|
|
|
}
|
|
|
})
|
|
|
- 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){
|
|
|
- // 进行装箱
|
|
|
+ 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){
|
|
|
+// 进行装箱
|
|
|
+const checkPackingRef = ref(null)
|
|
|
+const currPackingList = ref([])
|
|
|
+const batchPackingRef = ref(null)
|
|
|
+const setPacking = (type) => {
|
|
|
+ if (!printer.value) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '请先设置打印机' })
|
|
|
+ showNotify({type: 'warning', duration: 3000, message: '请先设置打印机'})
|
|
|
return
|
|
|
}
|
|
|
// 获取装箱的商品列表
|
|
|
- currPackingList.value = orderList.value.filter(item => item.isPacking)
|
|
|
+ currPackingList.value = orderList.value.filter(item => item.isPacking)
|
|
|
if (currPackingList.value.length === 0) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '暂无未装箱数据' })
|
|
|
+ showNotify({type: 'warning', duration: 3000, message: '暂无未装箱数据'})
|
|
|
return
|
|
|
}
|
|
|
const materiaList = orderList.value.filter(item => item.status == '600' && item.qty > 0)
|
|
|
@@ -422,89 +410,91 @@ const setPacking=(type)=>{
|
|
|
const hasCommonBarcode = [...packingBarcodes].some(barcode => checkBarcode.has(barcode))
|
|
|
if (hasCommonBarcode) {
|
|
|
scanError();
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: `装箱商品包含耗材${[...checkBarcode].join(',')},请先扫描耗材` })
|
|
|
+ showNotify({
|
|
|
+ type: 'warning',
|
|
|
+ duration: 3000,
|
|
|
+ message: `装箱商品包含耗材${[...checkBarcode].join(',')},请先扫描耗材`
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- // 普通装箱
|
|
|
- if (type === 'single') {
|
|
|
+ if (type === 'single') { // 普通装箱
|
|
|
checkPackingRef.value?.show(currPackingList.value, orderDetail.value)
|
|
|
- } else {
|
|
|
- // 批量装箱
|
|
|
- const list =orderList.value.filter(item => item.isPacking && item.status=='60')
|
|
|
+ } else { // 批量装箱
|
|
|
+ const list = orderList.value.filter(item => item.isPacking && item.status == '60')
|
|
|
if (list.length > 1) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '不支持多个商品装箱' })
|
|
|
+ showNotify({type: 'warning', duration: 3000, message: '不支持多个商品装箱'})
|
|
|
return
|
|
|
}
|
|
|
batchPackingRef.value?.show(currPackingList.value, orderDetail.value)
|
|
|
}
|
|
|
}
|
|
|
//重置装箱状态
|
|
|
-const resetPackingStatus=()=>{
|
|
|
+const resetPackingStatus = () => {
|
|
|
currPackingList.value.forEach((item) => {
|
|
|
- item.quantity=0
|
|
|
+ item.quantity = 0
|
|
|
delete item.isPacking
|
|
|
})
|
|
|
}
|
|
|
//重置装箱
|
|
|
-const packingListRef=ref(null)
|
|
|
-const resetPacking=()=>{
|
|
|
- _getOrderPacking(orderDetail.value.orderNo,1)
|
|
|
+const packingListRef = ref(null)
|
|
|
+const resetPacking = () => {
|
|
|
+ _getOrderPacking(orderDetail.value.orderNo, 1)
|
|
|
}
|
|
|
|
|
|
//重新开始
|
|
|
-const reset=()=>{
|
|
|
+const reset = () => {
|
|
|
showConfirmDialog({
|
|
|
title: '温馨提示',
|
|
|
message: '您正在进行重新开始操作,是否继续?',
|
|
|
}).then(() => {
|
|
|
_reset()
|
|
|
- inputBarcodeRef.value?.show('', '请扫描订单/快递单号','')
|
|
|
+ inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '')
|
|
|
})
|
|
|
}
|
|
|
//打印清单
|
|
|
-const printerRef=ref(null)
|
|
|
+const printerRef = ref(null)
|
|
|
//设置打印机
|
|
|
-const setPrinter=()=>{
|
|
|
+const setPrinter = () => {
|
|
|
printerRef.value?.show(warehouse)
|
|
|
}
|
|
|
-const printer=ref(null)
|
|
|
-if(localStorage.getItem('check-print')){
|
|
|
- printer.value=JSON.parse(localStorage.getItem('check-print'))
|
|
|
+const printer = ref(null)
|
|
|
+if (localStorage.getItem('check-print')) {
|
|
|
+ printer.value = JSON.parse(localStorage.getItem('check-print'))
|
|
|
}
|
|
|
-const print=(templateCode,code)=>{
|
|
|
- if(!printer.value){
|
|
|
+const print = (templateCode, code) => {
|
|
|
+ if (!printer.value) {
|
|
|
scanError()
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '请先设置打印机' });
|
|
|
+ showNotify({type: 'warning', duration: 3000, message: '请先设置打印机'});
|
|
|
return
|
|
|
}
|
|
|
- const data = {warehouse,code,printServer: printer.value.server, printName:printer.value.printer,templateCode }
|
|
|
+ const data = {warehouse, code, printServer: printer.value.server, printName: printer.value.printer, templateCode}
|
|
|
showLoading()
|
|
|
fluxPrint(data)
|
|
|
- .then(res => {
|
|
|
- if(res.code==200){
|
|
|
- scanSuccess()
|
|
|
- showNotify({ type: 'success', duration: 3000, message: '打印已发起,请检查打印情况' });
|
|
|
- printPickingList(code,currPackingList.value)
|
|
|
- }else {
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ scanSuccess()
|
|
|
+ showNotify({type: 'success', duration: 3000, message: '打印已发起,请检查打印情况'});
|
|
|
+ printPickingList(code, currPackingList.value)
|
|
|
+ } else {
|
|
|
+ scanError()
|
|
|
+ tips.value = res.message || '系统异常,请联系技术支持!'
|
|
|
+ showNotify({type: 'danger', duration: 3000, message: res.message || '系统异常,请联系技术支持!'});
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
scanError()
|
|
|
- tips.value=res.message || '系统异常,请联系技术支持!'
|
|
|
- showNotify({ type: 'danger', duration: 3000, message: res.message || '系统异常,请联系技术支持!' });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- scanError()
|
|
|
- tips.value=err.message || '系统异常,请联系技术支持!'
|
|
|
- showNotify({ type: 'danger', duration: 3000, message: err.message || '系统异常,请联系技术支持!' });
|
|
|
- }).finally(() => {
|
|
|
- closeLoading()
|
|
|
+ tips.value = err.message || '系统异常,请联系技术支持!'
|
|
|
+ showNotify({type: 'danger', duration: 3000, message: err.message || '系统异常,请联系技术支持!'});
|
|
|
+ }).finally(() => {
|
|
|
+ closeLoading()
|
|
|
})
|
|
|
}
|
|
|
// 打印装箱清单
|
|
|
-const printPickingList=(deliveryNo,curPackingList)=> {
|
|
|
+const printPickingList = (deliveryNo, curPackingList) => {
|
|
|
// 打印装箱清单
|
|
|
- let printData=[]
|
|
|
+ let printData = []
|
|
|
const findIndex = printConfig.value.findIndex(item => item.ownerList.includes(orderDetail.value.customerId));
|
|
|
// 检查质检数据并添加质检打印任务
|
|
|
const hasQualityCheck = curPackingList.some(item => item.qualityCheck === true);
|
|
|
@@ -522,75 +512,78 @@ const printPickingList=(deliveryNo,curPackingList)=> {
|
|
|
printRequests(0, printData);
|
|
|
return;
|
|
|
}
|
|
|
- printConfig.value.forEach((item,index) => {
|
|
|
+ printConfig.value.forEach((item, index) => {
|
|
|
const isOwner = item.ownerList.includes(orderDetail.value.customerId);
|
|
|
- const printMap = item.printer && item.printer !== '' ? item.printer.split('+') : [printer.value.server,printer.value.printer];
|
|
|
+ const printMap = item.printer && item.printer !== '' ? item.printer.split('+') : [printer.value.server, printer.value.printer];
|
|
|
// 判断 店铺和承运商是否匹配
|
|
|
const isShop = item.shop ? item.shop.includes(orderDetail.value.shop) : true;
|
|
|
- const isCarrier =item.carriers? item.carriers.includes(orderDetail.value.carrierId):true
|
|
|
- if (isOwner && isShop && isCarrier ) {
|
|
|
+ const isCarrier = item.carriers ? item.carriers.includes(orderDetail.value.carrierId) : true
|
|
|
+ if (isOwner && isShop && isCarrier) {
|
|
|
const data = {
|
|
|
warehouse: orderDetail.value.warehouseId,
|
|
|
code: deliveryNo,
|
|
|
printServer: printMap[0],
|
|
|
printName: printMap[1],
|
|
|
templateCode: item.templateCode,
|
|
|
- ignoreNoData:item.templateCode
|
|
|
+ ignoreNoData: item.templateCode
|
|
|
};
|
|
|
const printCount = Math.max(item.printNum, 1)
|
|
|
printData.push(...new Array(printCount).fill(data));
|
|
|
}
|
|
|
- if(index==printConfig.value.length-1){
|
|
|
- printRequests(0,printData)
|
|
|
+ if (index == printConfig.value.length - 1) {
|
|
|
+ printRequests(0, printData)
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-const printRequests = async(index, dataList)=> {
|
|
|
+const printRequests = async (index, dataList) => {
|
|
|
if (index >= dataList.length) {
|
|
|
+ // if (this.orderList.length == 0) {
|
|
|
+ // this.getOrderList();
|
|
|
+ // }
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
const res = await _printMode(dataList[index]);
|
|
|
if (res) {
|
|
|
- if(res.code==200){
|
|
|
- showNotify({ type: 'success', duration: 3000, message: '打印已发起,请检查打印情况' });
|
|
|
- }else {
|
|
|
- if(dataList[index].ignoreNoData && dataList[index].ignoreNoData==true && (res.message.includes('打印数据为空') ||res.message.includes('ignoreNoData'))){
|
|
|
+ if (res.code == 200) {
|
|
|
+ showNotify({type: 'success', duration: 3000, message: '打印已发起,请检查打印情况'});
|
|
|
+ } else {
|
|
|
+ if (dataList[index].ignoreNoData && dataList[index].ignoreNoData == true && (res.message.includes('打印数据为空') || res.message.includes('ignoreNoData'))) {
|
|
|
return
|
|
|
}
|
|
|
- showNotify({ type: 'danger', duration: 3000, message:res.message || '未知系统错误,请联系开发人员' });
|
|
|
+ showNotify({type: 'danger', duration: 3000, message: res.message || '未知系统错误,请联系开发人员'});
|
|
|
}
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('打印请求发生错误:', error);
|
|
|
- showNotify({ type: 'danger', duration: 3000, message: error.message || '系统异常,请联系技术支持!' });
|
|
|
+ showNotify({type: 'danger', duration: 3000, message: error.message || '系统异常,请联系技术支持!'});
|
|
|
} finally {
|
|
|
closeLoading();
|
|
|
await printRequests(index + 1, dataList);
|
|
|
}
|
|
|
}
|
|
|
-const _printMode=(data)=> {
|
|
|
+const _printMode = (data) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
fluxPrint(data)
|
|
|
- .then(res => resolve(res))
|
|
|
- .catch(err => reject(`打印失败: ${err}`));
|
|
|
+ .then(res => resolve(res))
|
|
|
+ .catch(err => reject(`打印失败: ${err}`));
|
|
|
});
|
|
|
}
|
|
|
-const onPrint=(code)=>{
|
|
|
- printer.value=code
|
|
|
- localStorage.setItem('check-print',JSON.stringify(code))
|
|
|
+const onPrint = (code) => {
|
|
|
+ printer.value = code
|
|
|
+ localStorage.setItem('check-print', JSON.stringify(code))
|
|
|
}
|
|
|
//设置订单号
|
|
|
const setBarcode = (code) => {
|
|
|
- const data = { warehouse, code, activityOrderFlag: true }
|
|
|
+ const data = {warehouse, code, activityOrderFlag: true}
|
|
|
showLoading()
|
|
|
- packingDetailMap.value={}
|
|
|
+ packingDetailMap.value = {}
|
|
|
getPendingReviewTask(data).then(res => {
|
|
|
if (res.data.details.length == 0) {
|
|
|
scanError()
|
|
|
inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '暂未查询到待复核数据,请切换单号')
|
|
|
} else {
|
|
|
- if(res.data.releaseStatus=='H' || res.data.status=='90' ||res.data.erpCancelFlag=='Y'){
|
|
|
+ if (res.data.releaseStatus == 'H' || res.data.status == '90' || res.data.erpCancelFlag == 'Y') {
|
|
|
orderNo.value = code
|
|
|
orderDetail.value = res.data
|
|
|
scanError()
|
|
|
@@ -598,9 +591,9 @@ const setBarcode = (code) => {
|
|
|
return
|
|
|
}
|
|
|
const orderNos = [...new Set(res.data.details.map(item => item.orderNo))];
|
|
|
- if(orderNos.length>1){
|
|
|
+ if (orderNos.length > 1) {
|
|
|
scanError()
|
|
|
- inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '仅支持单个订单复核','')
|
|
|
+ inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '仅支持单个订单复核', '')
|
|
|
return
|
|
|
}
|
|
|
orderNo.value = code
|
|
|
@@ -608,7 +601,7 @@ const setBarcode = (code) => {
|
|
|
tips.value = '请扫描商品条码'
|
|
|
_getOrderPacking(res.data.orderNo)
|
|
|
scanSuccess()
|
|
|
- // 处理详情
|
|
|
+ // 处理每个详情项
|
|
|
res.data.details.forEach((item) => {
|
|
|
item.quantity = 0
|
|
|
item.oldQuantity = 0
|
|
|
@@ -634,41 +627,42 @@ const setBarcode = (code) => {
|
|
|
closeLoading()
|
|
|
})
|
|
|
}
|
|
|
-const _reset=()=>{
|
|
|
+const _reset = () => {
|
|
|
orderNo.value = ''
|
|
|
- orderDetail.value=[]
|
|
|
- dataList.value=[]
|
|
|
+ orderDetail.value = []
|
|
|
+ dataList.value = []
|
|
|
tips.value = '请扫描订单/快递单号'
|
|
|
}
|
|
|
-const containerNoMap={
|
|
|
- 'WH01':'FJ-WH01-20',
|
|
|
- 'WH02':'FJ-WH02-20',
|
|
|
- 'WH10':'FJ-WH10-1',
|
|
|
- 'WH99':'FJ-WH99-01',
|
|
|
+const containerNoMap = {
|
|
|
+ 'WH01': 'FJ-WH01-20',
|
|
|
+ 'WH02': 'FJ-WH02-20',
|
|
|
+ 'WH10': 'FJ-WH10-1',
|
|
|
+ 'WH99': 'FJ-WH99-01',
|
|
|
}
|
|
|
//返拣容器
|
|
|
-const cancelOrder=(item,type)=>{
|
|
|
+const cancelOrder = (item, type) => {
|
|
|
const orderDetailStatus = orderList.value.find(item => (item.status != '60' && item.status != '600'));
|
|
|
- if(item.status=='90'){
|
|
|
+ if (item.status == '90') {
|
|
|
scanError()
|
|
|
- showDialog({ title: '温馨提示', message: '已取消, 暂停发货', }).then(() => {
|
|
|
+ showDialog({title: '温馨提示', message: '已取消, 暂停发货',}).then(() => {
|
|
|
inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '上一单为冻结单,请重新扫描单号')
|
|
|
});
|
|
|
- }else if(item.releaseStatus=='H' || type=='release'){
|
|
|
+ } else if (item.releaseStatus == 'H' || type == 'release') {
|
|
|
scanError()
|
|
|
- showDialog({ title: '温馨提示', message: `订单:${orderNo.value},已冻结, 暂停发货`, }).then(() => {
|
|
|
+ showDialog({title: '温馨提示', message: `订单:${orderNo.value},已冻结, 暂停发货`,}).then(() => {
|
|
|
inputBarcodeRef.value?.show('', '请扫描订单/快递单号', '上一单为冻结单,请重新扫描单号')
|
|
|
});
|
|
|
_reset()
|
|
|
- }else if(orderDetailStatus && item.erpCancelFlag=='Y' ){
|
|
|
+ } else if (orderDetailStatus && item.erpCancelFlag == 'Y') {
|
|
|
scanError()
|
|
|
- showDialog({ title: '温馨提示', message: '此取消单包含《待拣货》商品,请将所有商品拣货后返拣', }).then(() => {});
|
|
|
- } else if(item.erpCancelFlag=='Y' || type=='erp'){
|
|
|
+ showDialog({title: '温馨提示', message: '此取消单包含《待拣货》商品,请将所有商品拣货后返拣',}).then(() => {
|
|
|
+ });
|
|
|
+ } else if (item.erpCancelFlag == 'Y' || type == 'erp') {
|
|
|
scanError()
|
|
|
- showConfirmDialog({ title: '温馨提示', message: `订单:${orderNo.value},取消单,请进入还库流程!!!`, })
|
|
|
- .then(() => {
|
|
|
- _reversePicking()
|
|
|
- })
|
|
|
+ showConfirmDialog({title: '温馨提示', message: `订单:${orderNo.value},取消单,请进入还库流程!!!`,})
|
|
|
+ .then(() => {
|
|
|
+ _reversePicking()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
const _reversePicking = () => {
|
|
|
@@ -679,58 +673,57 @@ const _reversePicking = () => {
|
|
|
code: orderDetail.value.orderNo,
|
|
|
}
|
|
|
reversePicking(data).then(res => {
|
|
|
- showNotify({ type: 'success', duration: 5000, message: `${data.code},已进行返拣,请放置《${data.reversePickingContainerNo}》返拣容器中!` })
|
|
|
+ showNotify({
|
|
|
+ type: 'success',
|
|
|
+ duration: 5000,
|
|
|
+ message: `${data.code},已进行返拣,请放置《${data.reversePickingContainerNo}》返拣容器中!`
|
|
|
+ })
|
|
|
loadData()
|
|
|
}).finally(() => {
|
|
|
closeLoading()
|
|
|
})
|
|
|
}
|
|
|
-// 订单装箱明细原始列表(接口返回,未合并)
|
|
|
-const packingList=ref([])
|
|
|
-// 拉取订单装箱数据:按 sku+traceId 合并数量,再按 traceId 分组;type===1 时弹出装箱清单
|
|
|
-const _getOrderPacking=(orderNo,type)=>{
|
|
|
+const packingList = ref([])
|
|
|
+const _getOrderPacking = (orderNo, type) => {
|
|
|
showLoading()
|
|
|
- getOrderPacking({ warehouse, code:orderNo }).then(res => {
|
|
|
- packingList.value=res.data
|
|
|
- // 相同 sku + 追溯码合并为一条,数量累加
|
|
|
+ getOrderPacking({warehouse, code: orderNo}).then(res => {
|
|
|
+ packingList.value = res.data
|
|
|
const mergedList = Object.values(
|
|
|
- res.data.reduce((acc, item) => {
|
|
|
- const { sku, traceId, qty } = item
|
|
|
- const compositeKey = `${sku}_${traceId}`
|
|
|
- if (!acc[compositeKey]) {
|
|
|
- acc[compositeKey] = { ...item }
|
|
|
- } else {
|
|
|
- acc[compositeKey].qty += qty
|
|
|
- }
|
|
|
- return acc;
|
|
|
- }, {})
|
|
|
+ res.data.reduce((acc, item) => {
|
|
|
+ const {sku, traceId, qty} = item
|
|
|
+ const compositeKey = `${sku}_${traceId}`
|
|
|
+ if (!acc[compositeKey]) {
|
|
|
+ acc[compositeKey] = {...item}
|
|
|
+ } else {
|
|
|
+ acc[compositeKey].qty += qty
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, {})
|
|
|
)
|
|
|
- // 装箱行列表
|
|
|
packingDetailMap.value = mergedList.reduce((acc, item) => {
|
|
|
- const { traceId } = item
|
|
|
+ const {traceId} = item
|
|
|
acc[traceId] = acc[traceId] || []
|
|
|
acc[traceId].push(item)
|
|
|
return acc
|
|
|
}, {});
|
|
|
- if(type && type==1){
|
|
|
- packingListRef.value?.show(packingDetailMap.value,orderDetail.value)
|
|
|
+ if (type && type == 1) {
|
|
|
+ packingListRef.value?.show(packingDetailMap.value, orderDetail.value)
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
- // 请求失败时清空分组,避免沿用旧数据
|
|
|
packingDetailMap.value = {}
|
|
|
- }).finally(f=>{
|
|
|
+ }).finally(f => {
|
|
|
closeLoading()
|
|
|
})
|
|
|
}
|
|
|
-const rowStyle=( row )=>{
|
|
|
- if(row.isPacking){
|
|
|
- return { background: '#E6A23C'}
|
|
|
+const rowStyle = (row) => {
|
|
|
+ if (row.isPacking) {
|
|
|
+ return {background: '#E6A23C'}
|
|
|
}
|
|
|
- if( row.status=='600'){
|
|
|
- return { background: '#fff8d9'}
|
|
|
+ if (row.status == '600') {
|
|
|
+ return {background: '#fff8d9'}
|
|
|
}
|
|
|
- if(row.status!='60' ){
|
|
|
- return { background: '#b3b3b3'}
|
|
|
+ if (row.status != '60') {
|
|
|
+ return {background: '#b3b3b3'}
|
|
|
}
|
|
|
|
|
|
return ''
|
|
|
@@ -757,9 +750,9 @@ const getRelatedMaterial = (data) => {
|
|
|
const materialMap = {}
|
|
|
let allocationIdCounter = 0
|
|
|
data.forEach(item => {
|
|
|
- if (item.status == '60' && item.qty>0) {
|
|
|
+ if (item.status == '60' && item.qty > 0) {
|
|
|
item.relatedMaterial.forEach((material, index) => {
|
|
|
- material.oldQty = material.qty * item.qty
|
|
|
+ material.oldQty = material.qty * item.qty
|
|
|
material.qty = material.qty * item.qty
|
|
|
material.barcode = material.barCode
|
|
|
material.barcode2 = material.barCode
|
|
|
@@ -772,7 +765,7 @@ const getRelatedMaterial = (data) => {
|
|
|
if (materialMap[material.barcode]) {
|
|
|
materialMap[material.barcode].qty += material.qty
|
|
|
} else {
|
|
|
- materialMap[material.barcode] = { ...material }
|
|
|
+ materialMap[material.barcode] = {...material}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -850,6 +843,7 @@ window.onRefresh = loadData
|
|
|
margin: 0 15px
|
|
|
padding: 8px 0
|
|
|
border-bottom: 1px solid #eaeaeb
|
|
|
+
|
|
|
.picking-container
|
|
|
padding: 0 15px
|
|
|
text-align: left
|
|
|
@@ -914,6 +908,7 @@ window.onRefresh = loadData
|
|
|
|
|
|
.task-table-bin tbody
|
|
|
background: #cde7ff
|
|
|
+
|
|
|
.count-input
|
|
|
border-bottom: 2px solid #0077ff
|
|
|
|