提交
This commit is contained in:
1 parent
7e9155fef1
commit
2fd826dbe1
80 files changed
+32546
-36145
No files matched your search
@@ -1,3 +1,5 @@
|
||||
export const LAB_STORAGE_CODE_PLACEHOLDER = '{lab_storage_code}'
|
||||
|
||||
export type ProductionTaskSetItemPreview = {
|
||||
taskName: string
|
||||
routeId: string
|
||||
@@ -6,10 +8,24 @@ export type ProductionTaskSetItemPreview = {
|
||||
remark: string
|
||||
}
|
||||
|
||||
export function mapWorkOrderTasksToSetItems(tasks: Record<string, any>[] | undefined): {
|
||||
export function revertTaskNamePlaceholders(
|
||||
taskName: string,
|
||||
labStorageCode?: string | null
|
||||
): string {
|
||||
const text = String(taskName || '')
|
||||
const code = String(labStorageCode || '').trim()
|
||||
if (!code) return text
|
||||
return text.split(code).join(LAB_STORAGE_CODE_PLACEHOLDER)
|
||||
}
|
||||
|
||||
export function mapWorkOrderTasksToSetItems(
|
||||
tasks: Record<string, any>[] | undefined,
|
||||
options?: { labStorageCode?: string | null }
|
||||
): {
|
||||
items: ProductionTaskSetItemPreview[]
|
||||
skippedEmptyNameCount: number
|
||||
} {
|
||||
const labStorageCode = options?.labStorageCode
|
||||
const items: ProductionTaskSetItemPreview[] = []
|
||||
let skippedEmptyNameCount = 0
|
||||
for (const row of tasks || []) {
|
||||
@@ -19,7 +35,7 @@ export function mapWorkOrderTasksToSetItems(tasks: Record<string, any>[] | undef
|
||||
continue
|
||||
}
|
||||
items.push({
|
||||
taskName,
|
||||
taskName: revertTaskNamePlaceholders(taskName, labStorageCode),
|
||||
routeId: String(row.routeId || '').trim(),
|
||||
routeName: String(row.routeName || '').trim(),
|
||||
description: String(row.description || '').trim(),
|
||||
@@ -28,3 +44,14 @@ export function mapWorkOrderTasksToSetItems(tasks: Record<string, any>[] | undef
|
||||
}
|
||||
return { items, skippedEmptyNameCount }
|
||||
}
|
||||
|
||||
export function resolveWorkOrderLabStorageCode(
|
||||
row: Record<string, any> | null | undefined
|
||||
): string {
|
||||
if (!row) return ''
|
||||
const fromRow = String(row.labStorageCode || '').trim()
|
||||
if (fromRow) return fromRow
|
||||
return String(
|
||||
(row.reception as Record<string, any> | undefined)?.labStorageCode || ''
|
||||
).trim()
|
||||
}
|
||||
Reference in new issue
Block a user