From 349053e2edf8095f786b330b991830b3a406d8ac Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Fri, 15 May 2026 18:22:48 +0800 Subject: [PATCH] =?UTF-8?q?5=E6=9C=8815?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/print/print.ts | 69 ++- src/api/setting.express/express.ts | 23 +- src/api/setting.platform/platform.ts | 2 +- src/api/storage.report/report.ts | 59 ++ src/lang/en-US.ts | 1 + src/lang/zh-CN.ts | 1 + src/router/map.ts | 1 + .../WavePlatformPrintPreviewDialog.vue | 62 +- src/views/storage/inventory/index.vue | 50 +- .../storage/inventory/inventory-config.ts | 2 + src/views/storage/report/index.vue | 492 ++++++++++++++++ src/views/storage/report/report-config.ts | 195 +++++++ .../components/CourierCodeManagement.vue | 328 ++++++----- .../components/PlatformCodeManagement.vue | 279 ++++----- .../setting/encoding/encoding-config.ts | 52 ++ src/views/system/setting/encoding/index.vue | 144 ++++- .../setting/encoding/styles/encoding-sub.scss | 61 ++ .../setting/printStation/components/add.vue | 10 +- .../setting/printStation/components/info.vue | 12 +- workflows/api-doc-agent/config/响应.md | 347 ++++++------ workflows/api-doc-agent/config/接口.md | 12 +- workflows/api-doc-system/apidata/config.json | 46 +- workflows/api-doc-system/apidata/data.json | 533 ++++++------------ .../interface-details/interface-details.json | 323 ++++++----- .../data/module-list/module-list.json | 178 ++---- .../data/module/config/_module.lifecycle.json | 2 +- .../data/module/config/module.json | 4 +- .../module/dashboard/_module.lifecycle.json | 2 +- .../data/module/dashboard/module.json | 4 +- .../data/module/index/_module.lifecycle.json | 2 +- .../data/module/index/module.json | 4 +- .../order.archiveorder/_module.lifecycle.json | 2 +- .../module/order.archiveorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../order.deliveryexpectionorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.deliveryorder/module.json | 4 +- .../order.entrustorder/_module.lifecycle.json | 2 +- .../module/order.entrustorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.expectionorder/module.json | 4 +- .../module/order.index/_module.lifecycle.json | 2 +- .../data/module/order.index/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.outboundorder/module.json | 4 +- .../order.pendingorder/_module.lifecycle.json | 2 +- .../module/order.pendingorder/module.json | 4 +- .../module/order.print/_module.lifecycle.json | 2 +- .../data/module/order.print/module.json | 4 +- .../order.revieworder/_module.lifecycle.json | 2 +- .../data/module/order.revieworder/module.json | 4 +- .../module/order.wave/_module.lifecycle.json | 2 +- .../data/module/order.wave/module.json | 4 +- .../data/module/order/_module.lifecycle.json | 2 +- .../data/module/order/module.json | 4 +- .../data/module/pick/_module.lifecycle.json | 2 +- .../data/module/pick/module.json | 4 +- .../data/module/print/_module.lifecycle.json | 2 +- .../data/module/print/module.json | 73 ++- .../printer.station/_module.lifecycle.json | 2 +- .../data/module/printer.station/module.json | 4 +- .../setting.account/_module.lifecycle.json | 2 +- .../data/module/setting.account/module.json | 4 +- .../setting.express/_module.lifecycle.json | 2 +- .../data/module/setting.express/module.json | 45 +- .../_module.lifecycle.json | 2 +- .../setting.expressinterface/module.json | 4 +- .../setting.permission/_module.lifecycle.json | 2 +- .../module/setting.permission/module.json | 4 +- .../setting.platform/_module.lifecycle.json | 2 +- .../data/module/setting.platform/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/setting.printtemplate/module.json | 4 +- .../setting.role/_module.lifecycle.json | 2 +- .../data/module/setting.role/module.json | 4 +- .../setting.warehouse/_module.lifecycle.json | 2 +- .../data/module/setting.warehouse/module.json | 4 +- .../data/module/stock/_module.lifecycle.json | 2 +- .../data/module/stock/module.json | 4 +- .../storage.entry/_module.lifecycle.json | 2 +- .../data/module/storage.entry/module.json | 4 +- .../storage.inventory/_module.lifecycle.json | 2 +- .../data/module/storage.inventory/module.json | 8 +- .../storage.report/_module.lifecycle.json | 12 + .../data/module/storage.report/module.json | 103 ++++ .../storage.stockout/_module.lifecycle.json | 2 +- .../data/module/storage.stockout/module.json | 4 +- .../storage_receiving/_module.lifecycle.json | 2 +- .../data/module/storage_receiving/module.json | 4 +- .../data/module/store/_module.lifecycle.json | 2 +- .../data/module/store/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/storewarehouse.store/module.json | 4 +- .../data/module/user/_module.lifecycle.json | 2 +- .../data/module/user/module.json | 4 +- .../module/warehouse/_module.lifecycle.json | 2 +- .../data/module/warehouse/module.json | 4 +- .../api-doc-system/data/pending-updates.json | 123 +--- 98 files changed, 2296 insertions(+), 1548 deletions(-) create mode 100644 src/api/storage.report/report.ts create mode 100644 src/views/storage/report/index.vue create mode 100644 src/views/storage/report/report-config.ts create mode 100644 src/views/system/setting/encoding/encoding-config.ts create mode 100644 src/views/system/setting/encoding/styles/encoding-sub.scss create mode 100644 workflows/api-doc-system/data/module/storage.report/_module.lifecycle.json create mode 100644 workflows/api-doc-system/data/module/storage.report/module.json diff --git a/src/api/print/print.ts b/src/api/print/print.ts index 6b9e4e20..31f7da4f 100644 --- a/src/api/print/print.ts +++ b/src/api/print/print.ts @@ -174,20 +174,31 @@ export function getPrintRecordItem(id: string | number) { }) } -/** print.send 请求体(与 print 模块 module.json 一致:template 仅 customize 必填,express 可不传) */ -export type PrintSendParams = { +/** customize:computerId / printer / template 等;express 路径下由服务端忽略 */ +export type PrintSendCustomizeParams = { + type: 'customize' computerId: string count?: number data: Record printer: string - /** customize 时必填且宜含 page_width、page_height、template_content;express 可不传 */ - template?: Record - /** 业务时间戳,可选;接口类型为 string */ + /** 宜含 page_width、page_height、template_content */ + template: Record timestamp?: string - /** 当前实现支持 customize、express */ - type: string } +/** + * express:须 printStationId、requestCode;data 须含 waveGroups(见 order.print.getWavePlatformPrintData)。 + * computerId / count / printer / timestamp / template 在 express 下不适用,请求体中不发送。 + */ +export type PrintSendExpressParams = { + type: 'express' + printStationId: string + requestCode: string + data: Record +} + +export type PrintSendParams = PrintSendCustomizeParams | PrintSendExpressParams + /** print.send 业务响应字段(成功 code 多为 200,flag 为 success) */ export type PrintSendResult = { flag?: string @@ -196,10 +207,16 @@ export type PrintSendResult = { printId?: number } +/** savePrinters.express 单项:首选 express_code + printer_name(兼容 express_id、name 由服务端映射) */ +export type PrintSavePrintersExpressItem = { + express_code: string + printer_name: string +} + /** print.savePrinters:defaultPrinter、express、print_station_id 均为必填(见 print 模块 module.json) */ export type PrintSavePrintersParams = { defaultPrinter: string - express: Array> + express: PrintSavePrintersExpressItem[] | Array> print_station_id: number } @@ -225,20 +242,28 @@ export function savePrinters(data: PrintSavePrintersParams) { } export function sendPrint(data: PrintSendParams) { - const body: Record = { - computerId: data.computerId, - data: data.data, - printer: data.printer, - type: data.type - } - if (data.count !== undefined && data.count !== null) { - body.count = data.count - } - if (data.timestamp !== undefined && data.timestamp !== null) { - body.timestamp = typeof data.timestamp === 'string' ? data.timestamp : String(data.timestamp) - } - if (data.template !== undefined && data.template !== null) { - body.template = data.template + let body: Record + if (data.type === 'express') { + body = { + type: 'express', + printStationId: data.printStationId, + requestCode: data.requestCode, + data: data.data + } + } else { + body = { + type: data.type, + computerId: data.computerId, + data: data.data, + printer: data.printer, + template: data.template + } + if (data.count !== undefined && data.count !== null) { + body.count = data.count + } + if (data.timestamp !== undefined && data.timestamp !== null) { + body.timestamp = typeof data.timestamp === 'string' ? data.timestamp : String(data.timestamp) + } } return request({ url: '/system', diff --git a/src/api/setting.express/express.ts b/src/api/setting.express/express.ts index 233c391a..9a2430ba 100644 --- a/src/api/setting.express/express.ts +++ b/src/api/setting.express/express.ts @@ -42,7 +42,15 @@ export function expressListBase() { }) } -export function expressCreate(data: { code: string, name: string, platform?: string }) { +/** setting.express.create:code、name、express_code 必填;expressCode 为驼峰等价写法 */ +export type ExpressCreatePayload = { + code: string + name: string + express_code: string + expressCode?: string +} + +export function expressCreate(data: ExpressCreatePayload) { return request({ url: '/system', method: 'post', @@ -68,7 +76,18 @@ export function expressCheckCodeUnique(data: { id?: number, code: string }) { }) } -export function expressUpdate(data: any) { +/** setting.express.update:id 必填;至少一项可更新字段;express_code 与 expressCode 等价 */ +export type ExpressUpdatePayload = { + id: number + code?: string + name?: string + express_code?: string + expressCode?: string + setting_id?: number + settingId?: number +} + +export function expressUpdate(data: ExpressUpdatePayload) { return request({ url: '/system', method: 'post', diff --git a/src/api/setting.platform/platform.ts b/src/api/setting.platform/platform.ts index 76b92f9c..8325db65 100644 --- a/src/api/setting.platform/platform.ts +++ b/src/api/setting.platform/platform.ts @@ -16,7 +16,7 @@ export function settingPlatformIndexGetPlatformList(data?: Record) { return request({ url: '/system', method: 'post', diff --git a/src/api/storage.report/report.ts b/src/api/storage.report/report.ts new file mode 100644 index 00000000..7c049289 --- /dev/null +++ b/src/api/storage.report/report.ts @@ -0,0 +1,59 @@ +import request from '@/utils/request' + +const v = '1.0' + +/** 与 apidata/data.json 中 list 单项字段一致 */ +export interface StorageReportListItem { + start_time?: string | null + end_time?: string | null + stock_id: number + store_id: number + begin_total: number + end_total: number + inbound_total: number + outbound_total: number + store_name?: string + item_name?: string + barcode?: string + item_code?: string + space_id?: number | null + space_name?: string | null + [key: string]: unknown +} + +export interface StorageReportSearchBody { + where?: { + start_time?: string | Date + end_time?: string | Date + by_space?: boolean + store_ids?: number[] + } +} + +/** 与网关返回一致:成功时 data 内含 list */ +export interface StorageReportSearchResult { + flag?: string + code?: number + message?: string + data?: { + list?: StorageReportListItem[] + } + list?: StorageReportListItem[] +} + +/** 不传或传 `{}` 表示无业务参数(与页面首次打开一致) */ +export function searchInventoryReport( + data?: StorageReportSearchBody +): Promise { + return request({ + url: '/system', + method: 'post', + params: { + method: 'storage.report.search', + v, + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} diff --git a/src/lang/en-US.ts b/src/lang/en-US.ts index 26ab132f..4a83a03e 100644 --- a/src/lang/en-US.ts +++ b/src/lang/en-US.ts @@ -25,6 +25,7 @@ export default { "Combo Stock ": "Combo Stock", "Stock Storage": "Stock Storage", "receiving": "Receiving", + "Report": "Report", "Entry Order": "Entry Order", "Stock out": "Stock Out", "inventory": "Inventory", diff --git a/src/lang/zh-CN.ts b/src/lang/zh-CN.ts index 830885fb..ada72053 100644 --- a/src/lang/zh-CN.ts +++ b/src/lang/zh-CN.ts @@ -25,6 +25,7 @@ export default { "Combo Stock ": "组合商品", "Stock Storage": "商品库存", "receiving": "收货单", + "Report": "库存报表", "Entry Order": "入库单", "Stock out": "出库单", "inventory": "库存", diff --git a/src/router/map.ts b/src/router/map.ts index a235cf85..ba049a61 100644 --- a/src/router/map.ts +++ b/src/router/map.ts @@ -17,6 +17,7 @@ export const componentMap: Record = { 'stock/storestock/index': () => import('@/views/stock/storestock/index.vue'), 'stock/combo_stock/index': () => import('@/views/stock/combo_stock/index.vue'), 'storage/receiving': () => import('@/views/storage/receiving/index.vue'), + 'storage/report': () => import('@/views/storage/report/index.vue'), 'storage/entry': () => import('@/views/storage/entry/index.vue'), 'storage/inventory': () => import('@/views/storage/inventory/index.vue'), 'storage/stockout': () => import('@/views/storage/stockout/index.vue'), diff --git a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue index 7f388b35..7c76cc77 100644 --- a/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue +++ b/src/views/order/waveOrder/component/WavePlatformPrintPreviewDialog.vue @@ -22,9 +22,9 @@ > @@ -129,9 +129,10 @@ const emit = defineEmits<{ }>() const printRootRef = ref(null) +/** 下拉值使用打印台主键 stationId(print.send express 的 printStationId);computer_id_legacy 用于迁移旧版本地存储 */ type StationOption = { - id: string | number - computer_id: string + stationId: string + computer_id_legacy: string name: string default_printer_name: string } @@ -232,10 +233,16 @@ function extractPrintStationRows(res: any): any[] { return [] } -/** 与 printStation info 表单一致:列表行上名称、默认打印机字段别名 */ +/** 与 print.getList 行一致:stationId 为打印台 id;computer_id_legacy 为关联打印电脑(仅迁移/展示用) */ function mapStationRow(item: Record): StationOption { - const rawCid = item.computer_id ?? item.computerId ?? item.id - const computer_id = rawCid != null && String(rawCid).trim() !== '' ? String(rawCid) : '' + const rawSid = item.id ?? item.print_station_id ?? item.station_id + let stationId = rawSid != null && String(rawSid).trim() !== '' ? String(rawSid).trim() : '' + const rawComputer = item.computer_id ?? item.computerId + const computer_id_legacy = + rawComputer != null && String(rawComputer).trim() !== '' ? String(rawComputer).trim() : '' + if (!stationId && computer_id_legacy) { + stationId = computer_id_legacy + } const nameRaw = item.name ?? item.station_name ?? @@ -244,7 +251,7 @@ function mapStationRow(item: Record): StationOption { item.stationName ?? item.label ?? '' - const name = nameRaw != null && String(nameRaw).trim() !== '' ? String(nameRaw).trim() : computer_id + const name = nameRaw != null && String(nameRaw).trim() !== '' ? String(nameRaw).trim() : stationId const defPrinter = item.default_printer_name ?? item.defaultPrinterName ?? @@ -253,8 +260,8 @@ function mapStationRow(item: Record): StationOption { '' const default_printer_name = String(defPrinter ?? '').trim() return { - id: item.id ?? rawCid ?? computer_id, - computer_id, + stationId, + computer_id_legacy, name, default_printer_name } @@ -276,8 +283,16 @@ async function loadStationOptions() { // 初始化默认打印台:优先本地存储,其次当前值,最后回退到首项 const savedStation = getSavedStationId() const currentStationId = String(printSettings.station || '').trim() - const hasSaved = !!savedStation && stationOptions.value.some((item) => item.computer_id === savedStation) - const hasCurrent = !!currentStationId && stationOptions.value.some((item) => item.computer_id === currentStationId) + const hasSaved = !!savedStation && stationOptions.value.some((item) => item.stationId === savedStation) + const hasCurrent = !!currentStationId && stationOptions.value.some((item) => item.stationId === currentStationId) + /** 历史本地存的是关联电脑 ID,迁移为当前列表中的 stationId */ + const legacyComputerMatch = + !!savedStation && + !hasSaved && + stationOptions.value.find((item) => { + const cid = item.computer_id_legacy + return cid != null && String(cid).trim() === savedStation + }) if (!stationOptions.value.length) { printSettings.station = '' @@ -287,13 +302,16 @@ async function loadStationOptions() { if (hasSaved) { printSettings.station = savedStation + } else if (legacyComputerMatch) { + printSettings.station = legacyComputerMatch.stationId + saveStationId(legacyComputerMatch.stationId) } else if (hasCurrent) { saveStationId(String(currentStationId)) } else { const first = stationOptions.value[0] if (first) { - printSettings.station = first.computer_id - saveStationId(first.computer_id) + printSettings.station = first.stationId + saveStationId(first.stationId) } } } catch { @@ -314,6 +332,12 @@ function handleStationChange(val: string | number) { saveStationId(stationId) } +function buildExpressRequestCode(): string { + const wids = (props.requestMeta?.wave_ids || []).map(String).join('-') + const wh = props.requestMeta?.warehouse_id ?? '' + return `wave-print-${wh}-${wids}-${Date.now()}` +} + async function printToStation() { if (!printSettings.station) { ElMessage.warning('请选择打印台') @@ -325,23 +349,19 @@ async function printToStation() { } const sid = String(printSettings.station).trim() - const stationRow = stationOptions.value.find((s) => s.computer_id === sid) - const printer = stationRow?.default_printer_name ?? '' stationPrinting.value = true try { const printPayload: PrintSendParams = { type: 'express', - computerId: sid, - printer, + printStationId: sid, + requestCode: buildExpressRequestCode(), data: { waveGroups: props.payload.waveGroups || [], wave_ids: props.payload.wave_ids || [], summary: props.payload.summary || {}, request_meta: props.requestMeta || {} - }, - timestamp: String(Date.now()), - count: 1 + } } const res: any = await stationApi.sendPrint(printPayload) if (res && (res.code === 0 || res.code === 200 || res.flag === 'success' || res.status === 'success')) { diff --git a/src/views/storage/inventory/index.vue b/src/views/storage/inventory/index.vue index ef85a098..9ce0228b 100644 --- a/src/views/storage/inventory/index.vue +++ b/src/views/storage/inventory/index.vue @@ -74,6 +74,14 @@ {{ row.inventory_warning_tip_text || '--' }} + + + +