feat(加工): 小程序 BOM/分配与分拣标准名对齐
补人工追价入口;移动端 BOM/成品预览;分拣任务标准商品名优先。
This commit is contained in:
@@ -101,7 +101,7 @@ function taskGroupKey(task) {
|
||||
function taskPickerLabel(task) {
|
||||
const type = taskScopeType(task);
|
||||
if (type === 'category') return String(task.scope_label || task.scope_key || '未分类').trim();
|
||||
if (type === 'sku') return String(task.scope_label || task.scope_key || '商品').trim();
|
||||
if (type === 'sku') return String(task.scope_standard_label || task.scope_label || task.scope_key || '商品').trim();
|
||||
// 区域模式(2026-11-05 新增):选择器/分组标签必须显示**区域名**,否则落到下面的兜底 → 全部显示订单号
|
||||
if (type === 'zone') return String(task.scope_label || task.scope_key || '未设区域').trim();
|
||||
return String(task.order_code_short || task.order_code || '订单').trim();
|
||||
|
||||
@@ -172,7 +172,7 @@ function normalizePickingItem(item, pickStatus, options = {}) {
|
||||
input_qty: inputQty,
|
||||
input_weight: inputWeight,
|
||||
input_measure: pickByWeight ? inputWeight : inputQty,
|
||||
display_name: displayText(item.item_name, skuCode || '未知商品'),
|
||||
display_name: displayText(item.standard_name || item.item_name, skuCode || '未知商品'),
|
||||
display_sku: skuCode || '待生成',
|
||||
display_barcode: barcode || skuCode || '待生成',
|
||||
picked_qty_num: pickedQty,
|
||||
|
||||
@@ -3545,6 +3545,24 @@ const PICKING_TASK_COMPANY_NAME_SQL = `
|
||||
END
|
||||
`;
|
||||
|
||||
const PICKING_SCOPE_STANDARD_LABEL_SQL = `CASE
|
||||
WHEN pt.scope_type = 'sku' THEN (
|
||||
SELECT COALESCE(
|
||||
NULLIF(TRIM(s_scope.sku_name), ''),
|
||||
NULLIF(TRIM(pc_scope.name), ''),
|
||||
NULLIF(TRIM(pi_scope.item_name), '')
|
||||
)
|
||||
FROM picking_items pi_scope
|
||||
LEFT JOIN skus s_scope ON s_scope.sku_code = pi_scope.sku_code
|
||||
LEFT JOIN product_catalog pc_scope
|
||||
ON pc_scope.item_type = 'product' AND pc_scope.code = pi_scope.sku_code
|
||||
WHERE pi_scope.pick_code = pt.pick_code
|
||||
ORDER BY pi_scope.sort_order NULLS LAST, pi_scope.created_at ASC
|
||||
LIMIT 1
|
||||
)
|
||||
ELSE NULL
|
||||
END`;
|
||||
|
||||
export async function listPickingTasks(
|
||||
ctx: TenantContext | null,
|
||||
limit = 50,
|
||||
@@ -3591,6 +3609,7 @@ export async function listPickingTasks(
|
||||
`SELECT pt.id, pt.pick_code, pt.order_code, pt.warehouse_code, pt.pick_status, pt.created_at, pt.branch_code,
|
||||
pt.picker_id,
|
||||
pt.scope_type, pt.scope_key, pt.scope_label,
|
||||
${PICKING_SCOPE_STANDARD_LABEL_SQL} AS scope_standard_label,
|
||||
COALESCE(NULLIF(TRIM(pr.full_name), ''), NULLIF(TRIM(pr.username), '')) AS picker_name,
|
||||
COALESCE(
|
||||
(SELECT MIN(o.delivery_date)
|
||||
@@ -3727,6 +3746,7 @@ export async function listMyPickingTasks(
|
||||
`SELECT pt.id, pt.pick_code, pt.order_code, pt.warehouse_code, pt.pick_status, pt.created_at, pt.branch_code,
|
||||
pt.picker_id,
|
||||
pt.scope_type, pt.scope_key, pt.scope_label,
|
||||
${PICKING_SCOPE_STANDARD_LABEL_SQL} AS scope_standard_label,
|
||||
COALESCE(NULLIF(TRIM(pr.full_name), ''), NULLIF(TRIM(pr.username), '')) AS picker_name,
|
||||
COALESCE(
|
||||
(SELECT MIN(o.delivery_date)
|
||||
|
||||
@@ -274,6 +274,16 @@ function formatQty(value: unknown) {
|
||||
}
|
||||
|
||||
/** 批量打印用:已落库实拣量(重量 → 数量 → 应拣),与旧秤端标签同口径 */
|
||||
function taskScopeDisplayName(
|
||||
task: PickingTaskRow,
|
||||
t: (key: string, vars?: Record<string, string | number>) => string
|
||||
): string {
|
||||
return (
|
||||
String(task.scope_standard_label || task.scope_label || task.scope_key || '').trim() ||
|
||||
t('picking.scope.sku')
|
||||
);
|
||||
}
|
||||
|
||||
function persistedPickQty(item: PickingItemRow): number {
|
||||
const weight = Number(item.picked_weight) || 0;
|
||||
const picked = Number(item.picked_qty) || 0;
|
||||
@@ -356,7 +366,7 @@ function taskOrderDisplay(
|
||||
return `${task.order_code || '-'} · ${task.scope_label || task.scope_key || t('picking.scope.category')}`;
|
||||
}
|
||||
if (task.scope_type === 'sku') {
|
||||
return `${task.order_code || '-'} · ${task.scope_label || task.scope_key || t('picking.scope.sku')}`;
|
||||
return `${task.order_code || '-'} · ${taskScopeDisplayName(task, t)}`;
|
||||
}
|
||||
if (task.scope_type === 'customer') {
|
||||
return task.order_codes || t('picking.scope.multiOrder');
|
||||
|
||||
@@ -54,6 +54,8 @@ export interface PickingItemRow {
|
||||
}
|
||||
|
||||
export interface PickingTaskRow {
|
||||
/** 按商品汇总时的标准商品名(展示优先于 scope_label 别名) */
|
||||
scope_standard_label?: string | null;
|
||||
id: string;
|
||||
pick_code: string;
|
||||
order_code: string | null;
|
||||
|
||||
Reference in New Issue
Block a user