From 7f4a4549b6bcf5540b5c85fbcd4fdd286fffef7e Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Thu, 3 Sep 2026 18:05:47 +0800 Subject: [PATCH] 1 --- .../order.pendingorder/orderpendingOrder.ts | 4 +- src/api/returnreceived/index.ts | 4 + src/api/setting.warehouse/settingwarehouse.ts | 23 ++ src/api/storage_receiving/receiving.ts | 20 +- .../storewarehouse.store/storeWarehouse.ts | 78 +++- src/api/workbench/workbench.ts | 58 ++- src/components/BatchReceivingPrintDialog.vue | 2 +- src/views/data/packingflow/index.vue | 16 +- src/views/express/returnReceived/index.vue | 12 +- .../returnReceived/returnReceived-config.ts | 10 + src/views/express/returnUnpack/index.vue | 8 +- src/views/material/packageMaterial/index.vue | 5 +- .../component/ComboGoodsSearchDialog.vue | 7 +- src/views/stock/combo_stock/index.vue | 5 +- src/views/stock/stock/index.vue | 17 +- src/views/storage/entry/index.vue | 21 +- src/views/storage/inventory/index.vue | 13 +- .../log/component/TransactionDetail.vue | 12 +- src/views/storage/log/index.vue | 8 +- .../management/replenishmentDemand/index.vue | 18 +- .../component/ProductflowDetail.vue | 8 +- src/views/storage/productflow/index.vue | 6 +- src/views/storage/productflow/store/index.vue | 10 +- .../storage/receiving/component/Product.vue | 70 +++- src/views/storage/receiving/index.vue | 70 ++-- .../storage/receiving/receiving-config.ts | 4 + src/views/storage/stockout/index.vue | 9 +- .../newview/pages/WarehouseSettingsForm.vue | 13 + src/views/system/setting/workbench/index.vue | 279 ++++++++++++- .../setting/workbench/workbench-config.ts | 2 +- .../workbench2/config/template-config.ts | 14 +- src/views/system/setting/workbench2/index.vue | 369 +++++++++++++++++- 32 files changed, 1059 insertions(+), 136 deletions(-) diff --git a/src/api/order.pendingorder/orderpendingOrder.ts b/src/api/order.pendingorder/orderpendingOrder.ts index 61d00582..fab6d3e7 100644 --- a/src/api/order.pendingorder/orderpendingOrder.ts +++ b/src/api/order.pendingorder/orderpendingOrder.ts @@ -611,8 +611,8 @@ export function orderPendingOrderParseAddress( }, data, isSystemApi: true, - // 地址解析可能调用外部服务,延长超时时间至 60 秒 - timeout: 60000, + // 地址解析可能调用外部服务,超时时间延长至 10 分钟 + timeout: 600000, } as any); } diff --git a/src/api/returnreceived/index.ts b/src/api/returnreceived/index.ts index 652384c0..4f476a57 100644 --- a/src/api/returnreceived/index.ts +++ b/src/api/returnreceived/index.ts @@ -41,6 +41,10 @@ export type ReturnReceivedListWhere = { store_id?: number /** 是否原单退回:true=有关联原运单,false=无关联 */ is_original_return?: boolean + /** 登记时间范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */ + created_at?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string } + /** 更新时间范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */ + updated_at?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string } } /** returnReceived.list 排序参数 */ diff --git a/src/api/setting.warehouse/settingwarehouse.ts b/src/api/setting.warehouse/settingwarehouse.ts index 05c16fdb..a753e503 100644 --- a/src/api/setting.warehouse/settingwarehouse.ts +++ b/src/api/setting.warehouse/settingwarehouse.ts @@ -78,6 +78,12 @@ export type SettingWarehouseSubjectConfig = SettingWarehouseSenderConfig & { auto_allocate_express_exclude_remarks?: string[] /** 默认库位(库位ID,未配置时为 null) */ default_location_id?: number | null + /** 启用截单(flag:0=关闭,1=开启;默认 1)。启用后订单创建时间早于开始自动分配时间或超过截单时间(开始时间晚于截单时间时截单时间视为次日),不再自动分配快递和储位、不再自动加团 */ + cutoff_order_enabled?: number + /** 开始自动分配时间,格式 HH:mm,默认 08:00,范围 00:00-23:59;早于该时间的订单与超过截单时间行为一致(不自动分配快递和储位、不自动加团) */ + allocate_start_time?: string + /** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59;作为最后允许自动分配的时间,开始时间晚于截单时间时截单时间视为次日(跨天窗口) */ + cutoff_order_time?: string [key: string]: unknown } @@ -161,6 +167,23 @@ export function normalizeWarehouseSubjectConfig( base.default_location_id = Number.isFinite(locId) ? Math.trunc(locId) : null } + // 启用截单(flag:0=关闭,1=开启;默认 1;兼容 boolean / 数字 / 字符串输入) + const cutoffRaw = base.cutoff_order_enabled + if (cutoffRaw === true || cutoffRaw === 1 || cutoffRaw === '1') { + base.cutoff_order_enabled = 1 + } else if (cutoffRaw === false || cutoffRaw === 0 || cutoffRaw === '0') { + base.cutoff_order_enabled = 0 + } else { + base.cutoff_order_enabled = 1 + } + + // 开始自动分配时间 / 截单时间(HH:mm,非法回退默认 08:00 / 18:00) + const HHmmPattern = /^([01]\d|2[0-3]):[0-5]\d$/ + const allocTime = String(base.allocate_start_time ?? '') + base.allocate_start_time = HHmmPattern.test(allocTime) ? allocTime : '08:00' + const cutoffTime = String(base.cutoff_order_time ?? '') + base.cutoff_order_time = HHmmPattern.test(cutoffTime) ? cutoffTime : '18:00' + return base as SettingWarehouseSubjectConfig } diff --git a/src/api/storage_receiving/receiving.ts b/src/api/storage_receiving/receiving.ts index cc3383fd..c1866f8c 100644 --- a/src/api/storage_receiving/receiving.ts +++ b/src/api/storage_receiving/receiving.ts @@ -37,7 +37,25 @@ export function getReceivingListStore(data: any): Promise { } -export function getReceivingDetail(data: any): Promise { +export type ReceivingDetailParams = { + /** 收货单ID */ + id: number + /** 收货明细分页参数 */ + pagination?: { page?: number; pageSize?: number } +} + +/** + * storage.receiving.getReceivingDetail — 收货单详情(含收货明细分页) + * 响应 receiving 主要字段: + * - receiving.store_name: 货主名称(合约表 store_remask 优先,回退 company_name) + * - receiving.details: 收货明细数组,明细项含 + * stock_id(= system_product_id,向后兼容保留 system_product_id) + * space_id(库位展示名称 string|null = custom_space_name || space_name,历史为数字ID) + * space_id_raw(原始库位ID number|null)、space_name、custom_space_name + * box_remainder(箱内剩余数量)、box_weight(实测箱重) + * - receiving.pagination: 明细分页信息 + */ +export function getReceivingDetail(data: ReceivingDetailParams): Promise { return request({ url: '/system', method: 'post', diff --git a/src/api/storewarehouse.store/storeWarehouse.ts b/src/api/storewarehouse.store/storeWarehouse.ts index c350d896..c533e582 100644 --- a/src/api/storewarehouse.store/storeWarehouse.ts +++ b/src/api/storewarehouse.store/storeWarehouse.ts @@ -192,8 +192,77 @@ export function storeWarehouseGetPolicyConfig(data: { } as any) } +/** storeWarehouse.store.getPolicyConfigFields 字段元信息项(对齐接口文档) */ +export interface StorePolicyConfigFieldMeta { + key: string + name?: string + label?: string + /** flag=0/1 开关 / integer / number / string / enum / select 等 */ + type?: string + default?: unknown + required?: boolean + description?: string + min?: number + max?: number + step?: number + precision?: number + maxLength?: number + options?: Array<{ label?: string; value?: unknown; [key: string]: unknown } | string | number | boolean> +} + +/** storeWarehouse.store.getPolicyConfigFields 响应 */ +export interface StorePolicyConfigFieldsResponse { + code?: number + message?: string + data?: StorePolicyConfigFieldMeta[] +} + +/** storeWarehouse.store.savePolicyConfig 请求参数(policy_config 结构与接口文档对齐) */ +export interface StoreSavePolicyConfigParams { + /** 签约关系ID(兼容 contract_id) */ + id: number + /** 策略配置对象 */ + policy_config: StorePolicyConfigPayload +} + +/** policy_config 可配置字段(与 storeWarehouse.store.savePolicyConfig 文档一致) */ +export interface StorePolicyConfigPayload { + receive_mode?: 'standard' | 'strict' | 'manual' | string + auto_allocate_bin?: number + auto_allocate_express?: number + auto_allocate_storage?: number + allow_mix_batch?: number + allow_temp_storage?: number + storage_separation?: number + /** 面单充值元/单,支持 2 位小数 */ + print_recharge_price?: number + max_daily_inbound?: number + remark?: string + /** 面单自定义显示类型:1=隐藏,2=商品名称和数量,3=拣货库位和条码和数量,4=拣货库位和条码后5位和数量,5=拣货库位商品名称条码和数量 */ + waybill_custom_display_type?: number + /** 是否启用外部快递编码(flag:0=关闭,1=开启;默认 0) */ + enable_external_express_code?: number + /** 启用截单(flag:0=关闭,1=开启;默认 1) */ + cutoff_order_enabled?: number + /** 截单时间,格式 HH:mm,默认 18:00,范围 00:00-23:59 */ + cutoff_order_time?: string + /** 开始自动分配时间,格式 HH:mm,默认 08:00,范围 00:00-23:59 */ + allocate_start_time?: string + [key: string]: unknown +} + +/** storeWarehouse.store.savePolicyConfig 响应(返回补齐默认值的 policy_config) */ +export interface StoreSavePolicyConfigResponse { + code?: number + message?: string + data?: { + contract_id: number + policy_config: StorePolicyConfigPayload + } +} + /** 获取签约策略可配置字段元信息列表 */ -export function storeWarehouseGetPolicyConfigFields() { +export function storeWarehouseGetPolicyConfigFields(): Promise { return request({ url: '/system', method: 'post', @@ -207,11 +276,8 @@ export function storeWarehouseGetPolicyConfigFields() { } as any) } -/** 保存签约策略配置 */ -export function storeWarehouseSavePolicyConfig(data: { - id: number - policy_config: Record -}) { +/** 保存签约策略配置(响应含补齐默认值的 policy_config) */ +export function storeWarehouseSavePolicyConfig(data: StoreSavePolicyConfigParams): Promise { return request({ url: '/system', method: 'post', diff --git a/src/api/workbench/workbench.ts b/src/api/workbench/workbench.ts index 878e9074..0dc21e18 100644 --- a/src/api/workbench/workbench.ts +++ b/src/api/workbench/workbench.ts @@ -35,7 +35,7 @@ export function detail(data: { id: number }) { } as any) } -/** 新增工作台(仓库隔离,条码仓库内唯一) */ +/** 新增工作台(仓库隔离,条码仓库内唯一);创建时自动生成 login_code(前缀 wblc + 随机段共 64 位),不接受外部传入 login_code;响应 data 为新建的工作台对象(含自动生成的 login_code) */ export function create(data: { name: string barcode?: string @@ -200,3 +200,59 @@ export function bindCamera(data: { isSystemApi: true } as any) } + +/** 工作台绑定(需登录、需权限):入参绑定码 code 与工作台ID id,校验后完成关联;成功后工作台写入随机生成的 64 位 token,供 index.getWorkbenchBindCode 长轮询返回 */ +export function bind(data: { + /** 缓存生成的绑定码(6 位大写字母+数字) */ + code: string + /** 要绑定的工作台ID */ + id: number +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.bind', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 使用 token 获取工作台信息(免登录、免鉴权):先查缓存 workbench:token:{token},未命中则按 token 查库并回填缓存后返回;token 不存在或无对应工作台返回失败(flag=failure、code=403);返回不含 token/login_code */ +export function getWorkbenchInfo(data: { + /** 工作台 token(64 位) */ + token: string +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.getWorkbenchInfo', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +/** 重置工作台登录码(需登录、需权限):随机生成新的 login_code(前缀 wblc + 随机段共 64 位)并写入数据库,旧 login_code 随即失效(token 不变) */ +export function resetLoginCode(data: { + /** 工作台ID */ + id: number +}) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'workbench.resetLoginCode', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/components/BatchReceivingPrintDialog.vue b/src/components/BatchReceivingPrintDialog.vue index 24000b2f..daf99b40 100644 --- a/src/components/BatchReceivingPrintDialog.vue +++ b/src/components/BatchReceivingPrintDialog.vue @@ -563,7 +563,7 @@ async function loadPrintFormData(index: number) { try { const res: any = await receivingApi.getReceivingDetail({ - id: mainRow.id, + id: Number(mainRow.id), pagination: { page: 1, pageSize: 1000 } }) if (res && res.code === 200) { diff --git a/src/views/data/packingflow/index.vue b/src/views/data/packingflow/index.vue index 104d8cf8..cc846ebe 100644 --- a/src/views/data/packingflow/index.vue +++ b/src/views/data/packingflow/index.vue @@ -450,15 +450,27 @@ function handleSelectionChange(rows: PackingTaskItem[]) { } // ─── 导出处理(导出选中 / 导出全部)─────────────────────────────────────── -/** 构建导出参数:selected=true 仅按勾选任务运单号(waybill_code)过滤;false 全量导出并透传当前排序;where 格式结构与 order.packing.list 一致 */ +/** + * 构建导出参数:where 语义与 order.packing.list 一致(warehouse_id 由服务端注入,禁止传)。 + * 筛选条件有设置时(whereConditions 非空)一并转为 where 传入; + * selected=true 在筛选条件基础上叠加勾选任务运单号(waybill_code in)。 + */ function buildPackingExportPayload(selected: boolean): Record { const payload: Record = {} + // 当前筛选条件一并传入导出(与列表查询 where 语义一致) + const filterWhere = whereConditions.value || {} + if (Object.keys(filterWhere).length) { + payload.where = { ...filterWhere } + } if (selected) { const waybillCodes = selectionRows.value .map((row) => row?.waybill_code) .filter((v: any) => v !== undefined && v !== null && String(v).trim() !== '') if (waybillCodes.length) { - payload.where = { waybill_code: { operator: 'in', value: waybillCodes } } + payload.where = { + ...(payload.where || {}), + waybill_code: { operator: 'in', value: waybillCodes } + } } } if (sortState.value?.sortField) { diff --git a/src/views/express/returnReceived/index.vue b/src/views/express/returnReceived/index.vue index aa90351a..8e77ae74 100644 --- a/src/views/express/returnReceived/index.vue +++ b/src/views/express/returnReceived/index.vue @@ -332,7 +332,7 @@ const upperPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 }) // ─── 导出处理(导出选中 / 导出全部) ────────────────────────────────────────── // where/sort 语义与 returnReceived.list 一致: // - 导出选中:仅传勾选记录运单号 waybill_code({ operator:'in', value: waybillCodes }),不叠加筛选条件 -// - 导出全部:不传 where(全量导出,等价于 list 无筛选);sort 按当前排序透传 +// - 导出全部:筛选条件有设置时传当前条件 where;无筛选时不传 where(全量导出);sort 按当前排序透传 function buildReturnReceivedExportPayload(selected: boolean): Record { const payload: Record = {} if (selected) { @@ -342,6 +342,12 @@ function buildReturnReceivedExportPayload(selected: boolean): Record) { case 'scan_date': where.scan_date = { operator: 'between', value } break + case 'created_at': + case 'updated_at': + where[key] = { operator: 'between', value } + break case 'scanner_id': case 'store_id': { const n = Number(value) diff --git a/src/views/express/returnReceived/returnReceived-config.ts b/src/views/express/returnReceived/returnReceived-config.ts index 9b39ee45..aa8ecb55 100644 --- a/src/views/express/returnReceived/returnReceived-config.ts +++ b/src/views/express/returnReceived/returnReceived-config.ts @@ -39,6 +39,16 @@ export const returnReceivedAvailableFields = [ type: 'boolean', placeholder: '请选择是否原单退回', }, + { + value: 'created_at', + label: '登记时间', + type: 'datetimerange', + }, + { + value: 'updated_at', + label: '更新时间', + type: 'datetimerange', + }, ] // ============================================================ diff --git a/src/views/express/returnUnpack/index.vue b/src/views/express/returnUnpack/index.vue index dcc95160..8d679e98 100644 --- a/src/views/express/returnUnpack/index.vue +++ b/src/views/express/returnUnpack/index.vue @@ -537,7 +537,7 @@ const currentSort = ref<{ prop: string; order: string }>({ prop: '', order: '' } // ─── 导出处理(导出选中 / 导出全部) ────────────────────────────────────────── // where/sort 语义与 returnUnpack.list 一致: // - 导出选中:仅传勾选拆包单号 unpack_no({ operator:'in', value: unpackNos }),不叠加筛选条件 -// - 导出全部:不传 where(全量导出,等价于 list 无筛选);sort 按当前排序透传 +// - 导出全部:筛选条件有设置时传当前条件 where(export 默认不过滤 status,需由调用方传 where.status);无筛选时不传 where(全量导出);sort 按当前排序透传 function buildReturnUnpackExportPayload(selected: boolean): Record { const payload: Record = {} if (selected) { @@ -547,6 +547,12 @@ function buildReturnUnpackExportPayload(selected: boolean): Record if (unpackNos.length) { payload.where = { unpack_no: { operator: 'in', value: unpackNos } } } + } else { + // 当前筛选条件一并传入导出(与列表查询 where 语义一致) + const filterWhere = buildWhereFromConditions(currentConditions.value) + if (Object.keys(filterWhere).length) { + payload.where = { ...filterWhere } + } } if (currentSort.value.prop) { payload.sort = { diff --git a/src/views/material/packageMaterial/index.vue b/src/views/material/packageMaterial/index.vue index 59793851..b391ea51 100644 --- a/src/views/material/packageMaterial/index.vue +++ b/src/views/material/packageMaterial/index.vue @@ -67,9 +67,9 @@