diff --git a/furniture-3d-system/prisma/migrations/20260813103000_add_supply_chain_product_archive_operator_owners/migration.sql b/furniture-3d-system/prisma/migrations/20260813103000_add_supply_chain_product_archive_operator_owners/migration.sql new file mode 100644 index 00000000..b2ab3bbe --- /dev/null +++ b/furniture-3d-system/prisma/migrations/20260813103000_add_supply_chain_product_archive_operator_owners/migration.sql @@ -0,0 +1,4 @@ +ALTER TABLE "SupplyChainProductArchive" + ADD COLUMN "opsDirector" TEXT NOT NULL DEFAULT '', + ADD COLUMN "opsDeptHead" TEXT NOT NULL DEFAULT '', + ADD COLUMN "opsHead" TEXT NOT NULL DEFAULT ''; diff --git a/furniture-3d-system/prisma/schema.prisma b/furniture-3d-system/prisma/schema.prisma index 68e43683..4a7ef4e5 100644 --- a/furniture-3d-system/prisma/schema.prisma +++ b/furniture-3d-system/prisma/schema.prisma @@ -537,6 +537,9 @@ model SupplyChainProductArchive { replaceCount String @default("") region String @default("") supplierName String @default("") + opsDirector String @default("") + opsDeptHead String @default("") + opsHead String @default("") purchaseOwner String @default("") supplierType String @default("") supplierStatus String @default("") diff --git a/furniture-3d-system/scripts/sync-supply-chain-product-archive-enrichment.ts b/furniture-3d-system/scripts/sync-supply-chain-product-archive-enrichment.ts index ebfca39d..6e114d57 100644 --- a/furniture-3d-system/scripts/sync-supply-chain-product-archive-enrichment.ts +++ b/furniture-3d-system/scripts/sync-supply-chain-product-archive-enrichment.ts @@ -67,6 +67,11 @@ async function main() { } const syncJstBase = process.argv.includes('--sync-jst-base') + const operatorOnly = process.argv.includes('--operator-only') + const opsDirectorOnly = process.argv.includes('--ops-director-only') + if (operatorOnly && opsDirectorOnly) { + throw new Error('--operator-only and --ops-director-only cannot be used together') + } const jstBatchSize = Number(readArgument('jst-batch-size') || '500') if ( !Number.isSafeInteger(jstBatchSize) || @@ -87,10 +92,14 @@ async function main() { const [ { prisma }, { supplyChainProductArchiveEnrichmentSyncService }, + { supplyChainProductArchiveOperatorInitialSyncService }, + { supplyChainProductArchiveOpsDirectorSyncService }, { jstSkuProductArchiveFullSyncService }, ] = await Promise.all([ import('../src/lib/prisma'), import('../src/server/services/supply-chain-product-archive-enrichment-sync.service'), + import('../src/server/services/supply-chain-product-archive-operator-initial-sync.service'), + import('../src/server/services/supply-chain-product-archive-ops-director-sync.service'), syncJstBase ? import('../src/server/services/jst-sku-product-archive-full-sync.service') : Promise.resolve({ jstSkuProductArchiveFullSyncService: null }), @@ -103,10 +112,27 @@ async function main() { concurrency: jstConcurrency, }) : null - const enrichmentResult = await supplyChainProductArchiveEnrichmentSyncService.syncAll({ - batchSize: batchSizeValue, - }) - console.log(JSON.stringify({ baseResult, enrichmentResult }, null, 2)) + const operatorInitialResult = operatorOnly + ? await supplyChainProductArchiveOperatorInitialSyncService.syncAll({ + batchSize: batchSizeValue, + }) + : null + const opsDirectorResult = opsDirectorOnly + ? await supplyChainProductArchiveOpsDirectorSyncService.syncAll({ + batchSize: batchSizeValue, + }) + : null + const enrichmentResult = operatorOnly || opsDirectorOnly + ? null + : await supplyChainProductArchiveEnrichmentSyncService.syncAll({ + batchSize: batchSizeValue, + }) + console.log(JSON.stringify({ + baseResult, + operatorInitialResult, + opsDirectorResult, + enrichmentResult, + }, null, 2)) } finally { await prisma.$disconnect() } diff --git a/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx b/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx index 07de933e..0a157949 100644 --- a/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx +++ b/furniture-3d-system/src/app/intake/oa-board/OaBoardClient.tsx @@ -3308,11 +3308,13 @@ export default function OaBoardClient({ dashboard, loadErrorMessage, sampleProgressItems = [], + currentSampleStageOpeningCodes = [], currentUserName = '', }: { dashboard: OaBoardDashboardDTO loadErrorMessage?: string | null sampleProgressItems?: SampleProgressDTO[] + currentSampleStageOpeningCodes?: string[] currentUserName?: string }) { const { items: allItems, stageGraph, dailyReport, monthlyReport } = dashboard @@ -4473,7 +4475,7 @@ export default function OaBoardClient({ ) : activeTab === 'brand-planning' ? ( ) : activeTab === 'sample-progress' ? ( - + ) : activeTab === 'timeout-analysis' ? ( ) diff --git a/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx b/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx index b50bf34a..9efd4218 100644 --- a/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx +++ b/furniture-3d-system/src/app/intake/sample-progress/SampleProgressClient.tsx @@ -17,10 +17,10 @@ const inputDate = (value: string | Date) => { return Number.isNaN(date.getTime()) ? '' : date.toISOString().slice(0, 10) } -export default function SampleProgressClient({ initialItems, currentUserName, embedded = false }: { initialItems: SampleProgressDTO[]; currentUserName: string; embedded?: boolean }) { +export default function SampleProgressClient({ initialItems, currentUserName, currentSampleStageOpeningCodes = [], embedded = false }: { initialItems: SampleProgressDTO[]; currentUserName: string; currentSampleStageOpeningCodes?: string[]; embedded?: boolean }) { const [items, setItems] = useState(initialItems) const [keyword, setKeyword] = useState('') - const [status, setStatus] = useState('ACTIVE') + const [status, setStatus] = useState('CURRENT_STAGE') const [page, setPage] = useState(1) const [editing, setEditing] = useState(null) const [saving, setSaving] = useState(false) @@ -29,15 +29,17 @@ export default function SampleProgressClient({ initialItems, currentUserName, em const [previewImage, setPreviewImage] = useState(null) const canEdit = (item: SampleProgressDTO) => canEditSampleProgress(currentUserName, item) + const currentStageCodes = useMemo(() => new Set(currentSampleStageOpeningCodes.map((code) => code.trim().toUpperCase())), [currentSampleStageOpeningCodes]) + const currentStageItems = useMemo(() => items.filter((item) => currentStageCodes.has(item.openingCode.trim().toUpperCase())), [currentStageCodes, items]) const filtered = useMemo(() => items.filter((item) => { const haystack = [item.openingCode, item.brand, item.supplier, item.designer, item.purchaseOwner, item.color, item.material].join(' ').toLowerCase() - const statusMatches = status === 'ALL' || (status === 'ACTIVE' ? !hiddenTerminalStatuses.has(item.status) : item.status === status) + const statusMatches = status === 'ALL' || (status === 'CURRENT_STAGE' ? currentStageCodes.has(item.openingCode.trim().toUpperCase()) : item.status === status) return (!keyword || haystack.includes(keyword.toLowerCase())) && statusMatches - }), [items, keyword, status]) + }), [currentStageCodes, items, keyword, status]) const totalPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE)) const rows = filtered.slice((Math.min(page, totalPages) - 1) * PAGE_SIZE, Math.min(page, totalPages) * PAGE_SIZE) - const overdueCount = items.filter(isOverdue).length - const statusCounts = SAMPLE_PROGRESS_STATUSES.map((value) => ({ value, count: items.filter((item) => item.status === value).length })) + const overdueCount = currentStageItems.filter(isOverdue).length + const statusCounts = SAMPLE_PROGRESS_STATUSES.map((value) => ({ value, count: currentStageItems.filter((item) => item.status === value).length })) async function remove(item: SampleProgressDTO) { if (!window.confirm(`确认删除 ${item.openingCode} 的打样记录?`)) return @@ -53,12 +55,13 @@ export default function SampleProgressClient({ initialItems, currentUserName, em -
- } label="在管打样" value={`${items.length} 款`} tone="plain" /> +
+ } label="当前打样节点" value={`${currentStageItems.length} 款`} tone="plain" /> } label="交期已超期" value={`${overdueCount} 款`} tone={overdueCount ? 'danger' : 'plain'} /> + } label="OA 台账匹配" value={`${currentStageItems.length} / ${currentStageCodes.size}`} tone={currentStageItems.length === currentStageCodes.size ? 'success' : 'danger'} />
-
+
{statusCounts.map(({ value, count }) => (