Compare commits
No commits in common. "9b6be17119d46e0834f82d242617869672d68995" and "fe3a963748b8825d3c06a22747c741a3d7f910d8" have entirely different histories.
9b6be17119
...
fe3a963748
@ -53,9 +53,6 @@ export type WavePickTaskListItem = {
|
|||||||
pick_user_name?: string
|
pick_user_name?: string
|
||||||
review_user_id?: number | string
|
review_user_id?: number | string
|
||||||
review_user_name?: string
|
review_user_name?: string
|
||||||
/** 领料人:领取/认领波次的人员(order.wave.wavePickTaskList 返回) */
|
|
||||||
claim_operator_id?: number | string
|
|
||||||
claim_operator?: string
|
|
||||||
current_cart_id?: number | string
|
current_cart_id?: number | string
|
||||||
current_cart_code_snapshot?: string
|
current_cart_code_snapshot?: string
|
||||||
device_id?: string
|
device_id?: string
|
||||||
|
|||||||
@ -140,7 +140,7 @@
|
|||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
|
||||||
|
|||||||
@ -1367,8 +1367,9 @@ export const waveIndexRangeScanField = scanBasicField({
|
|||||||
defaultOperator: 'between',
|
defaultOperator: 'between',
|
||||||
hideOperator: true
|
hideOperator: true
|
||||||
})
|
})
|
||||||
/** ScanBox:波次类型(wave_scope)。0=未分配、1=大团购、2=散单、3=小团购;
|
/** ScanBox:波次类型(wave_scope)。后端按值解析 wave_id 范围:
|
||||||
* 后端按值解析波次ID 范围(未分配 wave_id = 0,其余按 wave_type 反查波次ID),多选由后端 OR 合并。 */
|
* 0=未分配波次(wave_id = 0)、1=团购(反查 wave_type=1 的波次ID)、2=散单(反查 wave_type=2 的波次ID);
|
||||||
|
* 多选(如 [1,2])由后端将两个范围条件 OR 合并。 */
|
||||||
export const waveScopeScanField = scanBasicField({
|
export const waveScopeScanField = scanBasicField({
|
||||||
label: '波次类型',
|
label: '波次类型',
|
||||||
value: 'wave_scope',
|
value: 'wave_scope',
|
||||||
@ -1376,10 +1377,9 @@ export const waveScopeScanField = scanBasicField({
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
conditionType: 'number',
|
conditionType: 'number',
|
||||||
options: [
|
options: [
|
||||||
{ label: '未分配', value: 0 },
|
{ label: '未分配波次', value: 0 },
|
||||||
{ label: '大团购', value: 1 },
|
{ label: '团购', value: 1 },
|
||||||
{ label: '散单', value: 2 },
|
{ label: '散单', value: 2 }
|
||||||
{ label: '小团购', value: 3 }
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export const deliveryOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
export const deliveryOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'delivery_order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
|
||||||
|
|||||||
@ -122,10 +122,6 @@
|
|||||||
{{ row.review_user_name || row.review_user_id || '—' }}
|
{{ row.review_user_name || row.review_user_id || '—' }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #column-claim_operator="{ row }">
|
|
||||||
{{ row.claim_operator || row.claim_operator_id || '—' }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #column-start_at="{ row }">
|
<template #column-start_at="{ row }">
|
||||||
{{ formatDateTime(row.start_at || row.start_time) }}
|
{{ formatDateTime(row.start_at || row.start_time) }}
|
||||||
</template>
|
</template>
|
||||||
@ -514,8 +510,6 @@ function normalizePickTaskRow(row: WavePickTaskListItem) {
|
|||||||
pick_user_name: row.pick_user_name || '',
|
pick_user_name: row.pick_user_name || '',
|
||||||
review_user_id: row.review_user_id,
|
review_user_id: row.review_user_id,
|
||||||
review_user_name: row.review_user_name || '',
|
review_user_name: row.review_user_name || '',
|
||||||
claim_operator_id: row.claim_operator_id,
|
|
||||||
claim_operator: row.claim_operator || '',
|
|
||||||
current_cart_id: row.current_cart_id,
|
current_cart_id: row.current_cart_id,
|
||||||
current_cart_code_snapshot: row.current_cart_code_snapshot || '',
|
current_cart_code_snapshot: row.current_cart_code_snapshot || '',
|
||||||
device_id: row.device_id || '',
|
device_id: row.device_id || '',
|
||||||
|
|||||||
@ -1106,7 +1106,6 @@ export const pickTaskWaveColumns = applyWaveListCopyActions([
|
|||||||
{ prop: 'operator_name', label: '操作人', minWidth: 120 },
|
{ prop: 'operator_name', label: '操作人', minWidth: 120 },
|
||||||
{ prop: 'pick_user_name', label: '拣货员', minWidth: 120 },
|
{ prop: 'pick_user_name', label: '拣货员', minWidth: 120 },
|
||||||
{ prop: 'review_user_name', label: '复核人', minWidth: 120 },
|
{ prop: 'review_user_name', label: '复核人', minWidth: 120 },
|
||||||
{ prop: 'claim_operator', label: '领料人', minWidth: 120 },
|
|
||||||
{ prop: 'current_cart_id', label: '当前车ID', width: 100 },
|
{ prop: 'current_cart_id', label: '当前车ID', width: 100 },
|
||||||
{ prop: 'current_cart_code_snapshot', label: '当前车编码', minWidth: 140 },
|
{ prop: 'current_cart_code_snapshot', label: '当前车编码', minWidth: 140 },
|
||||||
{ prop: 'device_id', label: '设备ID', minWidth: 140 },
|
{ prop: 'device_id', label: '设备ID', minWidth: 140 },
|
||||||
|
|||||||
@ -335,7 +335,7 @@
|
|||||||
]"
|
]"
|
||||||
@selection-change="handleSystemProductSelectionChange"
|
@selection-change="handleSystemProductSelectionChange"
|
||||||
@row-click="handleSystemProductRowClick"
|
@row-click="handleSystemProductRowClick"
|
||||||
@page-change="onSystemProductPageChange"
|
@page-change="querySystemProducts"
|
||||||
@page-size-change="onSystemProductPageSizeChange"
|
@page-size-change="onSystemProductPageSizeChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -533,12 +533,6 @@ import * as receivingApi from '@/api/storage_receiving/receiving'
|
|||||||
import * as stockApi from '@/api/stock/stock'
|
import * as stockApi from '@/api/stock/stock'
|
||||||
import * as indexApi from '@/api/index/index'
|
import * as indexApi from '@/api/index/index'
|
||||||
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
import { getStatusTextClass } from '@/views/order/orderManagement/config/order-common-config'
|
||||||
import {
|
|
||||||
isStockApiSuccess,
|
|
||||||
parseStockWarehouseSearch,
|
|
||||||
mapStockPickerItem,
|
|
||||||
getStockBarcodes
|
|
||||||
} from '@/views/order/orderManagement/utils/stock-picker-helpers'
|
|
||||||
import * as warehouseApi from '@/api/warehouse/warehouse'
|
import * as warehouseApi from '@/api/warehouse/warehouse'
|
||||||
import { buildStockQuery } from '@/utils/stockQueryBuilder'
|
import { buildStockQuery } from '@/utils/stockQueryBuilder'
|
||||||
import * as XLSX from 'xlsx'
|
import * as XLSX from 'xlsx'
|
||||||
@ -962,7 +956,6 @@ const systemProductPickerVisible = ref(false)
|
|||||||
const systemProductLoading = ref(false)
|
const systemProductLoading = ref(false)
|
||||||
const systemProductKeyword = ref('')
|
const systemProductKeyword = ref('')
|
||||||
const systemProductResults = ref<any[]>([])
|
const systemProductResults = ref<any[]>([])
|
||||||
const systemProductAllResults = ref<any[]>([])
|
|
||||||
const systemProductSelection = ref<any[]>([])
|
const systemProductSelection = ref<any[]>([])
|
||||||
const systemProductPagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
const systemProductPagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||||
|
|
||||||
@ -1540,6 +1533,27 @@ const normalizeQuantityByTotalAndSpec = (itemPayload: any) => {
|
|||||||
itemPayload.box_remainder = safeTotal % safeSpec
|
itemPayload.box_remainder = safeTotal % safeSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const buildSystemProductSearchParams = (keyword: string, storeId?: number) => {
|
||||||
|
const params: Record<string, any> = {}
|
||||||
|
|
||||||
|
if (Number.isFinite(storeId) && (storeId as number) > 0) {
|
||||||
|
params.store_id = { operator: 'eq', value: storeId }
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = String(keyword || '').trim()
|
||||||
|
if (!text) return params
|
||||||
|
|
||||||
|
if (/^\d{6,}$/.test(text)) {
|
||||||
|
params.barcode = { operator: 'contains', value: text, type: 'text' }
|
||||||
|
} else if (/^\d+$/.test(text)) {
|
||||||
|
params.id = { operator: 'eq', value: Number(text), type: 'number' }
|
||||||
|
} else {
|
||||||
|
params.item_name = { operator: 'contains', value: text, type: 'text' }
|
||||||
|
}
|
||||||
|
|
||||||
|
return params
|
||||||
|
}
|
||||||
|
|
||||||
const querySystemProductById = async (skuId: number) => {
|
const querySystemProductById = async (skuId: number) => {
|
||||||
if (!Number.isFinite(skuId) || skuId <= 0) return null
|
if (!Number.isFinite(skuId) || skuId <= 0) return null
|
||||||
try {
|
try {
|
||||||
@ -2027,111 +2041,37 @@ const handleSystemProductRowClick = (row: any) => {
|
|||||||
systemProductSelection.value = [row]
|
systemProductSelection.value = [row]
|
||||||
}
|
}
|
||||||
|
|
||||||
/** stock.warehouse.search 响应行归一化:暴露当前弹窗所需字段并保留原始行数据 */
|
|
||||||
const normalizeSystemProductRow = (raw: any): any => {
|
|
||||||
const mapped = mapStockPickerItem(raw)
|
|
||||||
const itemId = Number(mapped?.item_id)
|
|
||||||
if (!Number.isInteger(itemId) || itemId <= 0) return null
|
|
||||||
|
|
||||||
const storeNameCandidates = [
|
|
||||||
raw?.store_stock?.store_remask,
|
|
||||||
raw?.store_stock?.store_name,
|
|
||||||
raw?.store_name,
|
|
||||||
raw?.store_remask,
|
|
||||||
mapped?.store_name,
|
|
||||||
mapped?.store_remask,
|
|
||||||
raw?.stock?.store_remask,
|
|
||||||
raw?.goods?.store_remask
|
|
||||||
]
|
|
||||||
let storeName = ''
|
|
||||||
for (const candidate of storeNameCandidates) {
|
|
||||||
const text = String(candidate ?? '').trim()
|
|
||||||
if (text && text.toLowerCase() !== 'null') {
|
|
||||||
storeName = text
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const weightRaw = raw?.weight ?? raw?.gross_weight
|
|
||||||
const weight = weightRaw === '' || weightRaw === null || weightRaw === undefined
|
|
||||||
? ''
|
|
||||||
: Number(weightRaw)
|
|
||||||
|
|
||||||
return {
|
|
||||||
...raw,
|
|
||||||
...mapped,
|
|
||||||
id: itemId,
|
|
||||||
item_name: String(mapped?.item_name ?? '').trim() || String(raw?.product_name ?? '').trim(),
|
|
||||||
barcodes: getStockBarcodes(raw),
|
|
||||||
store_name: storeName,
|
|
||||||
weight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 应用本地分页切片:warehouseSearch 一次返回全部匹配,由前端分页展示 */
|
|
||||||
const applySystemProductPageSlice = () => {
|
|
||||||
const { page, pageSize } = systemProductPagination
|
|
||||||
const start = (page - 1) * pageSize
|
|
||||||
const end = start + pageSize
|
|
||||||
systemProductResults.value = systemProductAllResults.value.slice(start, end)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onSystemProductPageChange = (page: number) => {
|
|
||||||
const maxPage = Math.max(1, Math.ceil(systemProductPagination.total / systemProductPagination.pageSize))
|
|
||||||
systemProductPagination.page = Math.min(Math.max(1, page), maxPage)
|
|
||||||
applySystemProductPageSlice()
|
|
||||||
}
|
|
||||||
|
|
||||||
const onSystemProductPageSizeChange = (size: number) => {
|
const onSystemProductPageSizeChange = (size: number) => {
|
||||||
systemProductPagination.pageSize = size
|
systemProductPagination.pageSize = size
|
||||||
systemProductPagination.page = 1
|
querySystemProducts(1)
|
||||||
applySystemProductPageSlice()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询系统商品:使用 stock.warehouse.search 关键字检索(store_id + keyword),一次取回全部匹配后本地分页 */
|
|
||||||
const querySystemProducts = async (page = 1) => {
|
const querySystemProducts = async (page = 1) => {
|
||||||
systemProductLoading.value = true
|
systemProductLoading.value = true
|
||||||
try {
|
try {
|
||||||
const keyword = String(systemProductKeyword.value ?? '').trim()
|
const paginationParam = { page, pageSize: systemProductPagination.pageSize }
|
||||||
const storeId = boundStoreId.value
|
const where = buildStockQuery(
|
||||||
|
buildSystemProductSearchParams(systemProductKeyword.value, boundStoreId.value)
|
||||||
|
)
|
||||||
|
const res: any = await stockApi.stockWarehouse(paginationParam, where)
|
||||||
|
|
||||||
const requestData: { keyword?: string; store_id?: number } = {}
|
if (res && (res.code === 200 || res.flag === 'success') && res.data) {
|
||||||
if (keyword) {
|
systemProductResults.value = res.data.list || []
|
||||||
requestData.keyword = keyword
|
systemProductPagination.total = res.data.pagination?.total || res.data.total || systemProductResults.value.length
|
||||||
}
|
systemProductPagination.page = page
|
||||||
if (storeId != null && Number.isFinite(Number(storeId)) && Number(storeId) > 0) {
|
} else {
|
||||||
requestData.store_id = Number(storeId)
|
|
||||||
}
|
|
||||||
|
|
||||||
const res: any = await stockApi.warehouseSearch(requestData)
|
|
||||||
if (!isStockApiSuccess(res)) {
|
|
||||||
systemProductAllResults.value = []
|
|
||||||
systemProductResults.value = []
|
systemProductResults.value = []
|
||||||
systemProductPagination.total = 0
|
systemProductPagination.total = 0
|
||||||
systemProductPagination.page = 1
|
systemProductPagination.page = page
|
||||||
if (res?.message) {
|
if (res?.message) {
|
||||||
ElMessage.error(res.message)
|
ElMessage.error(res.message)
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { list } = parseStockWarehouseSearch(res)
|
|
||||||
systemProductAllResults.value = (list || [])
|
|
||||||
.map((row: any) => normalizeSystemProductRow(row))
|
|
||||||
.filter((row: any): row is any => row != null)
|
|
||||||
|
|
||||||
systemProductPagination.total = systemProductAllResults.value.length
|
|
||||||
const maxPage = Math.max(1, Math.ceil(systemProductPagination.total / systemProductPagination.pageSize))
|
|
||||||
const safePage = Math.min(Math.max(1, page), maxPage)
|
|
||||||
systemProductPagination.page = safePage
|
|
||||||
applySystemProductPageSlice()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('查询系统商品失败', error)
|
console.error('查询系统商品失败', error)
|
||||||
ElMessage.error('查询系统商品失败')
|
ElMessage.error('查询系统商品失败')
|
||||||
systemProductAllResults.value = []
|
|
||||||
systemProductResults.value = []
|
systemProductResults.value = []
|
||||||
systemProductPagination.total = 0
|
systemProductPagination.total = 0
|
||||||
systemProductPagination.page = 1
|
|
||||||
} finally {
|
} finally {
|
||||||
systemProductLoading.value = false
|
systemProductLoading.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { storeWarehouseWarehouseList } from '@/api/storeWarehouse.warehouse/storeWarehouse'
|
import { storeWarehouseWarehouseList } from '@/api/storewarehouse.warehouse/storeWarehouse'
|
||||||
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
|
import { storeWarehouseUnbind, storeWarehouseRename, storeWarehouseConfirmSign } from '@/api/storewarehouse.store/storeWarehouse'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/index.vue'
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user