This commit is contained in:
zlwu committed 2026-06-25 12:41:07 +08:00
1 parent 66609c0e21
commit 0b50eff3d8
93 files changed
+40172 -30060

No files matched your search

@@ -89,10 +89,7 @@ function protocolStatusTagTypeForTab(
}
function buildInboundMetaFields(tabKey: ProductionWorkOrderTabKey): CardMetaField[] {
const fields: CardMetaField[] = [
{ label: '样本编码', getValue: (row) => row.sampleCode || '—' },
{ label: '实验室入库编码', getValue: (row) => row.labStorageCode || '—' }
]
const fields: CardMetaField[] = []
if (tabKey === 'inbound_cell_storage') {
fields.push({
label: '来源类型',
@@ -120,6 +117,9 @@ function buildInboundMetaFields(tabKey: ProductionWorkOrderTabKey): CardMetaFiel
},
{ label: '接收时间', getValue: (row) => row.receptionTime || '—' },
{ label: '创建时间', getValue: (row) => row.createTime || '—' },
{ label: '工单号', getValue: (row) => row.workOrderNo || '—' },
{ label: '样本编码', getValue: (row) => row.sampleCode || '—' },
{ label: '实验室入库编码', getValue: (row) => row.labStorageCode || '—' },
{
label: '备注',
getValue: (row) => row.remark || '—',
+32 -6
View File
@@ -25,11 +25,29 @@ export function getStorageSlotOrderNum(slot: Record<string, unknown>): number {
return Number.isFinite(parsed) ? parsed : 0
}
/** 解析 slotCode「{prefix}{row}-{col}」 */
export function parseStorageSlotCode(code: string): { row: number; col: number } | null {
/** 货架布局 order_num 步长(row * STRIDE + col) */
export const SLOT_LAYOUT_ROW_STRIDE = 1000
export function decodeSlotLayoutOrder(orderNum: number): { row: number; col: number } {
const order = Number(orderNum) || 0
if (order >= SLOT_LAYOUT_ROW_STRIDE) {
return { row: Math.trunc(order / SLOT_LAYOUT_ROW_STRIDE), col: order % SLOT_LAYOUT_ROW_STRIDE }
}
return { row: 0, col: order }
}
/** 解析旧版 slotCode「{prefix}{row}-{col}」;纯数字序号返回 null */
export function parseLegacyRowColSlotCode(code: string): { row: number; col: number; prefix: string } | null {
const match = (code || '').trim().match(/^(.*?)(\d+)-(\d+)$/)
if (!match) return null
return { row: parseInt(match[2], 10), col: parseInt(match[3], 10) }
return { prefix: match[1], row: parseInt(match[2], 10), col: parseInt(match[3], 10) }
}
/** @deprecated 兼容旧调用;新数据请用 decodeSlotLayoutOrder + 序号 slotCode */
export function parseStorageSlotCode(code: string): { row: number; col: number } | null {
const legacy = parseLegacyRowColSlotCode(code)
if (legacy) return { row: legacy.row, col: legacy.col }
return null
}
/** 从根到节点的 node_code 路径,用 `-` 连接 */
@@ -68,17 +86,25 @@ export function buildFullSlotCodeFromFlat(
return local || path
}
/** 盒内格位:order_num → 行 → 列 → 编码 */
/** 盒内格位:order_num → 布局行列 → 序号 */
export function compareStorageFacilitySlots(
a: Record<string, unknown>,
b: Record<string, unknown>
): number {
const orderDiff = getStorageSlotOrderNum(a) - getStorageSlotOrderNum(b)
if (orderDiff !== 0) return orderDiff
const oa = getStorageSlotOrderNum(a)
const ob = getStorageSlotOrderNum(b)
if (oa >= SLOT_LAYOUT_ROW_STRIDE && ob >= SLOT_LAYOUT_ROW_STRIDE) {
const da = decodeSlotLayoutOrder(oa)
const db = decodeSlotLayoutOrder(ob)
if (da.row !== db.row) return da.row - db.row
if (da.col !== db.col) return da.col - db.col
}
const codeA = String(a.slotCode ?? a.slot_code ?? '')
const codeB = String(b.slotCode ?? b.slot_code ?? '')
const pa = parseStorageSlotCode(codeA)
const pb = parseStorageSlotCode(codeB)
const pa = parseLegacyRowColSlotCode(codeA)
const pb = parseLegacyRowColSlotCode(codeB)
if (pa && pb) {
if (pa.row !== pb.row) return pa.row - pb.row
if (pa.col !== pb.col) return pa.col - pb.col