diff --git a/dist.tar.gz b/dist.tar.gz index 8745f2f6..3c1a7412 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/src/api/stock/stock.ts b/src/api/stock/stock.ts index 320b74c0..0bb91fdd 100644 --- a/src/api/stock/stock.ts +++ b/src/api/stock/stock.ts @@ -508,3 +508,51 @@ export function importStockWarehouse( isSystemApi: true } as any) } + +export type StockTransactionListSort = { + sortField?: string + sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC' | string + sort_field?: string + sort_order?: string +} + +export type StockTransactionListParams = { + pagination?: { + page?: number + pageSize?: number + } + where?: Record + sort?: StockTransactionListSort +} + +/** 商品出入库流水列表查询 */ +export function stockTransactionList(data: StockTransactionListParams) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'stock.transaction.list', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 货主侧商品出入库流水列表查询 */ +export function stockTransactionStoreList( + data: StockTransactionListParams & { store_id: number } +) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'stock.transaction.storeList', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/api/storeWarehouse.store/storeWarehouse.ts b/src/api/storeWarehouse.store/storeWarehouse.ts index 82045f36..ddc07430 100644 --- a/src/api/storeWarehouse.store/storeWarehouse.ts +++ b/src/api/storeWarehouse.store/storeWarehouse.ts @@ -1,11 +1,8 @@ import request from '@/utils/request' const v = "1.0"; -/** 查询仓货签约列表 */ +/** 查询当前主体可见的仓库-货主签约列表 */ export function storeWarehouseList(data: { - counterparty_id?: number - auth_status?: number - use_status?: number keyword?: string page?: number page_size?: number @@ -66,10 +63,11 @@ export function storeWarehouseConfirmSign(data: { } as any) } -/** 修改签约关系使用状态 */ +/** 解除或停用签约关系(仓库侧传 warehouse_use_status,货主侧传 store_use_status) */ export function storeWarehouseUnbind(data: { id: number - use_status?: number + warehouse_use_status?: number + store_use_status?: number }) { return request({ url: '/system', diff --git a/src/api/storewarehouse.warehouse/storeWarehouse.ts b/src/api/storewarehouse.warehouse/storeWarehouse.ts new file mode 100644 index 00000000..81f7089f --- /dev/null +++ b/src/api/storewarehouse.warehouse/storeWarehouse.ts @@ -0,0 +1,23 @@ +import request from '@/utils/request' + +const v = '1.0' + +/** 仓库侧查询当前仓库可见的货主签约列表 */ +export function storeWarehouseWarehouseList(data: { + page?: number + page_size?: number + keyword?: string + auth_status?: string +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storeWarehouse.warehouse.list', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/lang/en-US.ts b/src/lang/en-US.ts index 8742d050..974b8f82 100644 --- a/src/lang/en-US.ts +++ b/src/lang/en-US.ts @@ -66,6 +66,9 @@ export default { 'packageSupplier':'Package Supplier', 'pickcart':'Pickcart', 'PickingShortage':'Picking Shortage', + 'shipperSigning':'Shipper Signing', + 'Product Flow':'Product Flow', + 'Externalwarehouse':'External Warehouse', }, "login": { "title": "Login", diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index abe61533..3e99fbef 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -67,6 +67,9 @@ export default { 'packageSupplier':'包装供应商', 'pickcart':'拣货车', 'PickingShortage':'缺货补货', + 'shipperSigning':'货主签约', + 'Productflow':'商品流水', + 'Externalwarehouse':'外部仓库', }, "login": { "title": "登录", diff --git a/src/permission.ts b/src/permission.ts index c41330a6..bc05cbc9 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -8,6 +8,26 @@ import { getToken } from '@/utils/auth' import { usePrinterComponentStore } from '@/stores/modules/printerComponent' import getPageTitle from '@/utils/get-page-title' import i18n from '@/lang' +import type { RouteRecordRaw } from 'vue-router' + +type RouteLogNode = { + path: string + name?: string | symbol + redirect?: RouteRecordRaw['redirect'] + meta?: RouteRecordRaw['meta'] + children?: RouteLogNode[] +} + +/** 格式化路由树,便于控制台查看(去掉 component 等不可序列化字段) */ +function formatRoutesForLog(routes: readonly RouteRecordRaw[]): RouteLogNode[] { + return routes.map((route) => ({ + path: route.path, + name: route.name, + redirect: route.redirect, + meta: route.meta, + children: route.children?.length ? formatRoutesForLog(route.children) : undefined + })) +} NProgress.configure({ showSpinner: false }) @@ -62,22 +82,15 @@ router.beforeEach(async (to, from) => { const permissionStore = usePermissionStore() // generate accessible routes based on menus const accessRoutes = await permissionStore.generateRoutes(user.menus || []) - - // console.log('从后端获取并转换后的动态路由:', accessRoutes) - // console.log('合并后的前端完整路由表 (添加前):', router.getRoutes()) // dynamically add accessible routes accessRoutes.forEach(route => { router.addRoute(route) }) - // 打印已添加的动态路由信息与添加后的完整路由表,便于调试 - try { - // console.log('已添加的动态路由 paths:', accessRoutes.map(r => r.path)) - } catch (e) { - // console.log('已添加的动态路由 (无法列出 paths):', accessRoutes) - } - // console.log('合并后的前端完整路由表 (添加后):', router.getRoutes()) + console.log('[Router] 动态路由 (后端菜单转换):', formatRoutesForLog(accessRoutes)) + console.log('[Router] 合并后完整路由 (constantRoutes + 动态):', formatRoutesForLog(permissionStore.routes)) + console.log('[Router] Vue Router 实例路由:', formatRoutesForLog(router.getRoutes())) // hack method to ensure that addRoutes is complete // set the replace: true, so the navigation will not leave a history record diff --git a/src/router/map.ts b/src/router/map.ts index de023191..3506fbeb 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -29,7 +29,9 @@ export const componentMap: Record = { 'storage/entry': () => import('@/views/storage/entry/index.vue'), 'storage/inventory': () => import('@/views/storage/inventory/index.vue'), 'storage/stockout': () => import('@/views/storage/stockout/index.vue'), - 'store/index': () => import('@/views/store/index.vue'), + 'store/productflow': () => import('@/views/storage/productflow/index.vue'), + 'store/index': () => import('@/views/store/stores/index.vue'), + 'Externalwarehouse/shipperSigning/index': () => import('@/views/Externalwarehouse/shipperSigning/index.vue'), 'wave/index': () => import('@/views/order/waveOrder/index.vue'), /** 与后端菜单 component 字段兼容 */ 'order/waveOrder': () => import('@/views/order/waveOrder/index.vue'), diff --git a/src/views/Externalwarehouse/shipperSigning/index.vue b/src/views/Externalwarehouse/shipperSigning/index.vue new file mode 100644 index 00000000..b34a2479 --- /dev/null +++ b/src/views/Externalwarehouse/shipperSigning/index.vue @@ -0,0 +1,379 @@ + + + + + diff --git a/src/views/dashboard/components/AppDownload.vue b/src/views/dashboard/components/AppDownload.vue index 9c687baa..ea40f8ca 100644 --- a/src/views/dashboard/components/AppDownload.vue +++ b/src/views/dashboard/components/AppDownload.vue @@ -125,7 +125,9 @@ const fetchPdaInfo = async () => { try { loadingPda.value = true pdaError.value = false - const response = await axios.get('https://dl.wms.gztbyc.com/pda/latest.json') + const response = await axios.get('https://dl.wms.gztbyc.com/pda/latest.json', { + params: { timestamp: new Date().getTime() } + }) if (response.data) { pdaData.value = response.data } @@ -141,7 +143,9 @@ const fetchPrintServerInfo = async () => { try { loadingPrint.value = true printError.value = false - const response = await axios.get('https://dl.wms.gztbyc.com/printServer/latest.json') + const response = await axios.get('https://dl.wms.gztbyc.com/printServer/latest.json', { + params: { timestamp: new Date().getTime() } + }) if (response.data) { printData.value = response.data } diff --git a/src/views/storage/entry/entry-config.ts b/src/views/storage/entry/entry-config.ts index 00ebf5db..84d3e7dd 100644 --- a/src/views/storage/entry/entry-config.ts +++ b/src/views/storage/entry/entry-config.ts @@ -411,6 +411,141 @@ export function formatReceivingBindingsSummary(bindings: unknown): string { return `${numbers.slice(0, 2).join('、')} 等 ${numbers.length} 个` } +function normalizeEntryDetailPayload(res: Record | null | undefined) { + const entryOrder = (res?.entryOrder ?? (res?.data as Record | undefined)?.entryOrder) as + | Record + | null + | undefined + const dataItems = (res?.data as Record | undefined)?.items + const items = Array.isArray(dataItems) + ? dataItems + : Array.isArray(entryOrder?.items) + ? entryOrder.items + : [] + return { entryOrder: entryOrder ?? null, items } +} + +function mapEntryPrintDetailItem( + item: Record, + idx: number, + entryOrder: Record | null +): Record { + const stock = (item.stock ?? {}) as Record + const barcodes = Array.isArray(stock.barcodes) ? stock.barcodes : [] + const firstBarcode = (barcodes[0] as Record | undefined)?.barcode + + const warehouse_item_code = String(stock.item_code ?? item.warehouse_item_code ?? item.external_item_code ?? '') + const warehouse_item_name = String(stock.item_name ?? item.warehouse_item_name ?? item.product_name ?? '') + const warehouse_item_spec = String(stock.sku_property ?? item.warehouse_item_spec ?? '') + const count = Number(item.planned ?? item.count ?? 0) + const received_quantity = Number(item.completed ?? item.received_quantity ?? 0) + const barcode = String(item.barcode ?? firstBarcode ?? '') + + return { + ...item, + ...stock, + seq_no: idx + 1, + order_line_no: item.order_line_no ?? idx + 1, + stock_id: item.stock_id ?? stock.id, + warehouse_item_code, + warehouse_item_name, + warehouse_item_spec, + item_code: warehouse_item_code, + product_code: warehouse_item_code, + product_name: warehouse_item_name, + barcode, + count, + planned: count, + received_quantity, + completed: received_quantity, + actual_quantity: received_quantity, + confirm_quantity: item.confirm_quantity ?? '', + external_item_code: item.external_item_code ?? '', + inventory_type: + item.inventory_type != null && item.inventory_type !== '' + ? formatEntryInventoryType(null, null, item.inventory_type) + : '', + entry_order_code: entryOrder?.entry_order_code ?? '', + purchase_order_code: entryOrder?.purchase_order_code ?? '', + store_name: entryOrder?.store_remask ?? entryOrder?.store_name ?? '', + } +} + +/** 将 storage.entry.get 响应组装为入库单打印模板可用数据 */ +export function buildEntryPrintFormData( + res: Record | null | undefined, + listRow?: Record | null +): Record { + const { entryOrder, items } = normalizeEntryDetailPayload(res) + if (!entryOrder) { + throw new Error('入库单数据为空') + } + + const receivingBindings = Array.isArray(entryOrder.receivingBindings) + ? entryOrder.receivingBindings + : Array.isArray(listRow?.receivingBindings) + ? listRow.receivingBindings + : [] + + const details = items.map((item, idx) => + mapEntryPrintDetailItem(item as Record, idx, entryOrder) + ) + + const total_items = details.length + const total_quantity = details.reduce((sum, item) => sum + (Number(item.count) || 0), 0) + const total_received_quantity = details.reduce( + (sum, item) => sum + (Number(item.received_quantity) || 0), + 0 + ) + + const result: Record = { + ...listRow, + ...entryOrder, + id: entryOrder.id ?? listRow?.id, + entry_order_code: entryOrder.entry_order_code ?? listRow?.entry_order_code ?? '', + purchase_order_code: entryOrder.purchase_order_code ?? listRow?.purchase_order_code ?? '', + store_name: entryOrder.store_remask ?? entryOrder.store_name ?? listRow?.store_name ?? '', + store_remask: entryOrder.store_remask ?? entryOrder.store_name ?? listRow?.store_remask ?? listRow?.store_name ?? '', + order_status: translateEntryField('order_status', entryOrder.order_status ?? listRow?.order_status), + order_type: translateEntryField('order_type', entryOrder.order_type ?? listRow?.order_type), + sync_status: translateEntryField('sync_status', entryOrder.sync_status ?? listRow?.sync_status), + source_type: translateEntryField('source_type', entryOrder.source_type ?? listRow?.source_type), + total_order_lines: entryOrder.total_order_lines ?? listRow?.total_order_lines ?? total_items, + total_items, + total_quantity, + total_received_quantity, + receiving_bindings_summary: formatReceivingBindingsSummary(receivingBindings), + receivingBindings, + details, + } + + if (details.length > 0) { + const first = details[0] + const promoteFields = [ + 'warehouse_item_code', + 'warehouse_item_name', + 'warehouse_item_spec', + 'product_name', + 'product_code', + 'barcode', + 'count', + 'received_quantity', + 'actual_quantity', + 'confirm_quantity', + 'stock_id', + 'order_line_no', + 'seq_no', + ] + promoteFields.forEach((field) => { + if (result[field] === undefined || result[field] === null || result[field] === '') { + result[field] = first?.[field] ?? '' + } + }) + } + + return result +} + export type EntryTableColumn = { prop: string label: string diff --git a/src/views/storage/entry/index.vue b/src/views/storage/entry/index.vue index 4bed492c..f1ecaba0 100644 --- a/src/views/storage/entry/index.vue +++ b/src/views/storage/entry/index.vue @@ -346,7 +346,8 @@ import { formatEntryHasReceiving, formatReceivingBindingsSummary, getEntryHasReceivingTagType, - translateEntryField + translateEntryField, + buildEntryPrintFormData } from './entry-config' import entrydetail from './component/entrydetail.vue' @@ -478,26 +479,10 @@ async function fetchEntryPrintData(row: any, _index: number): Promise - const result: Record = { ...entryOrder } - - // items 与 entryOrder 同级,在 res.data 下 - const items: any[] = res.data.items || [] - result.details = items.map((item: any, idx: number) => { - const stock = item.stock || {} - return { - ...item, - ...stock, - // 条码:取 barcodes 数组第一条的 barcode - barcode: item.barcode ?? stock.barcodes?.[0]?.barcode ?? '', - // 序号 - seq_no: idx + 1, - } - }) - return result + return buildEntryPrintFormData(res as Record, row) } function openBindDialog(row: any) { diff --git a/src/views/storage/productflow/index.vue b/src/views/storage/productflow/index.vue new file mode 100644 index 00000000..b382c154 --- /dev/null +++ b/src/views/storage/productflow/index.vue @@ -0,0 +1,472 @@ + + + + + diff --git a/src/views/storage/productflow/productflow-config.ts b/src/views/storage/productflow/productflow-config.ts new file mode 100644 index 00000000..2be98013 --- /dev/null +++ b/src/views/storage/productflow/productflow-config.ts @@ -0,0 +1,149 @@ +import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config' + +export function formatDateTime(dateStr: string | null | undefined): string { + if (!dateStr) return '—' + return String(dateStr).replace('T', ' ').slice(0, 19) +} + +export const transactionTypeConfig: Record = { + INBOUND: { text: '入库', tagType: 'success' }, + OUTBOUND: { text: '出库', tagType: 'danger' }, + LOCK: { text: '锁定', tagType: 'warning' }, + UNLOCK: { text: '解锁', tagType: 'info' }, + ADJUST: { text: '调整', tagType: 'primary' }, + TRANSFER: { text: '移库', tagType: 'primary' } +} + +export const orderTypeConfig: Record = { + ORDER: '订单', + DELIVERY_ORDER: '出库单', + RECEIVING: '收货单', + ENTRY_ORDER: '入库单', + INVENTORY: '盘点单', + RETURN: '退货单' +} + +export const columns = [ + { prop: 'created_at', label: '流水时间', width: 160, sortable: true }, + { prop: 'transaction_type', label: '流水类型', width: 90 }, + { prop: 'stock_id', label: '商品ID', width: 90 }, + { prop: 'store_id', label: '货主ID', width: 90 }, + { prop: 'warehouse_id', label: '仓库ID', width: 90 }, + { prop: 'quantity', label: '变动数量', width: 90 }, + { prop: 'before_quantity', label: '变动前库存', width: 100 }, + { prop: 'after_quantity', label: '变动后库存', width: 100 }, + { prop: 'before_locked_quantity', label: '变动前锁定', width: 100 }, + { prop: 'after_locked_quantity', label: '变动后锁定', width: 100 }, + { prop: 'batch_no', label: '批次号', minWidth: 110 }, + { prop: 'order_type', label: '订单类型', width: 100 }, + { prop: 'order_no', label: '订单号', minWidth: 160 }, + { prop: 'order_id', label: '订单ID', width: 90 }, + { prop: 'operator_name', label: '操作人', width: 90 }, + { prop: 'remark', label: '备注', minWidth: 140 } +] + +/** 商品流水主工具栏按钮 */ +export const productflowToolbarButtons: ToolbarButtonConfig[] = [ + { key: 'refresh', label: '刷新', type: 'primary', size: 'small', loadingKey: 'loading', action: 'loadList' }, + { key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' }, + { + key: 'toggleDetail', + label: '显示详情', + dynamicLabelKey: 'detailToggleLabel', + size: 'small', + action: 'toggleDetailVisible' + } +] + +export const availableFields = [ + { + label: '商品ID', + value: 'stock_id', + type: 'number', + placeholder: '请输入商品ID', + operators: ['eq'], + defaultOperator: 'eq' + }, + { + label: '订单号', + value: 'order_no', + type: 'text', + placeholder: '请输入订单号', + operators: ['contains', 'eq'], + defaultOperator: 'eq' + }, + { + label: '批次号', + value: 'batch_no', + type: 'text', + placeholder: '请输入批次号', + operators: ['contains', 'eq'], + defaultOperator: 'eq' + }, + { + label: '操作人', + value: 'operator_name', + type: 'text', + placeholder: '请输入操作人', + operators: ['eq', 'contains'], + defaultOperator: 'eq' + }, + { + label: '货主', + value: 'store_id', + type: 'select', + multiple: true, + filterable: true, + options: [] as Array<{ label: string; value: unknown }> + }, + { + label: '流水时间', + value: 'created_at', + type: 'date', + operators: ['between', 'eq', 'gt', 'lt'], + defaultOperator: 'between' + }, + { + label: '流水类型', + value: 'transaction_type', + type: 'select', + options: Object.entries(transactionTypeConfig).map(([value, cfg]) => ({ + label: cfg.text, + value + })) + }, + { + label: '订单类型', + value: 'order_type', + type: 'select', + options: Object.entries(orderTypeConfig).map(([value, label]) => ({ + label, + value + })) + } +] + +export function getTransactionTypeLabel(type: string): string { + return transactionTypeConfig[type]?.text || type || '—' +} + +export function getTransactionTypeTag(type: string): string { + return transactionTypeConfig[type]?.tagType || 'info' +} + +export function getOrderTypeLabel(type: string): string { + return orderTypeConfig[type] || type || '—' +} + +export function formatQuantityDelta(row: { + quantity?: number + before_quantity?: number + after_quantity?: number + transaction_type?: string +}): number | undefined { + if (row.quantity !== undefined && row.quantity !== null) return row.quantity + const before = row.before_quantity + const after = row.after_quantity + if (before === undefined || after === undefined) return undefined + return after - before +} diff --git a/src/views/store/shipperSigning/index.vue b/src/views/store/shipperSigning/index.vue new file mode 100644 index 00000000..b34a2479 --- /dev/null +++ b/src/views/store/shipperSigning/index.vue @@ -0,0 +1,379 @@ + + + + + diff --git a/src/views/store/component/detail.vue b/src/views/store/stores/component/detail.vue similarity index 100% rename from src/views/store/component/detail.vue rename to src/views/store/stores/component/detail.vue diff --git a/src/views/store/component/log.vue b/src/views/store/stores/component/log.vue similarity index 100% rename from src/views/store/component/log.vue rename to src/views/store/stores/component/log.vue diff --git a/src/views/store/index.vue b/src/views/store/stores/index.vue similarity index 96% rename from src/views/store/index.vue rename to src/views/store/stores/index.vue index 5a8897d3..03e75027 100644 --- a/src/views/store/index.vue +++ b/src/views/store/stores/index.vue @@ -1,16 +1,5 @@