setActiveId(row.id)}>
| {day(row.payDate)} |
- {row.platform}{row.shopName} |
- {row.itemCode}{row.ownerName || '(未匹配)'} |
- {row.shopStyleCode || '—'} |
- {row.shopItemCode || '—'} |
- {row.soId || '—'}内部 {row.oId || '—'} |
+ {text(row.platform)} |
+ {text(row.shopName)} |
+ {text(row.soId)} |
+ {text(row.oId)} |
+ {text(row.itemCode)} |
+ {text(row.shopStyleCode)} |
+ {text(row.shopItemCode)} |
+ {row.qty} |
+ {money(row.buyerPaidAmount)} |
+ {money(row.platformBearAmount)} |
+ {money(row.sellerIncomeAmount)} |
+ {money(row.limitUnitPrice)} |
+ {money(row.limitTotal)} |
+ {money(row.gapAmount)} |
+ {text(row.ownerName)} |
+ {text(row.deptOwner)} |
+ {text(row.profitCenter)} |
+ {text(row.orderStatus)} |
+ {text(row.refundStatus)} |
{day(row.listedAt)} |
{day(row.flowEndDate)} |
-
- {money(row.sellerIncomeAmount)}
- {row.gapAmount !== null ? row.gapAmount.toFixed(2) : ''}
- 限价 {money(row.limitTotal)}({money(row.limitUnitPrice)}×{row.qty})
- |
{row.statusLabel} |
))}
@@ -696,17 +749,28 @@ export function BreachOrderTab({ canExport = false }: { canExport?: boolean }) {
+
买家实付{money(order.buyerPaidAmount)}
+
平台承担{money(order.platformBearAmount)}
商家实收{money(order.sellerIncomeAmount)}
+
限价单价{money(order.limitUnitPrice)}
限价×数量{money(order.limitTotal)}
价差{order.gapAmount !== null ? order.gapAmount.toFixed(2) : '—'}
付款日期{day(order.payDate)}
-
平台 / 店铺{order.platform} · {order.shopName}
-
商品编码{order.itemCode}
-
运营负责人{order.ownerName || '—'}
-
店铺款式编码{order.shopStyleCode || '—'}
-
店铺商品编码{order.shopItemCode || '—'}
+
平台{text(order.platform)}
+
店铺{text(order.shopName)}
+
线上订单号{text(order.soId)}
+
内部订单号{text(order.oId)}
+
商品编码{text(order.itemCode)}
+
店铺款式编码{text(order.shopStyleCode)}
+
店铺商品编码{text(order.shopItemCode)}
+
数量{order.qty}
+
运营负责人{text(order.ownerName)}
+
部门负责人{text(order.deptOwner)}
+
利润中心{text(order.profitCenter)}
+
订单状态{text(order.orderStatus)}
+
退款状态{text(order.refundStatus)}
上架时间{day(order.listedAt)}
限价流程结束日期{day(order.flowEndDate)}
diff --git a/furniture-3d-system/src/lib/breach-order-generation.ts b/furniture-3d-system/src/lib/breach-order-generation.ts
index e0eaf939..94be94af 100644
--- a/furniture-3d-system/src/lib/breach-order-generation.ts
+++ b/furniture-3d-system/src/lib/breach-order-generation.ts
@@ -64,6 +64,11 @@ export type BreachGenerationAuth = {
adjustedLimitPrice: number | null
}
+export type BreachGenerationOwnerPersonnel = {
+ departmentOwner: string
+ profitCenter: string
+}
+
/** 破价判定豁免所需的流程数据(货号维度)。 */
export type BreachGenerationAuthContext = {
/** 内部条码(商品编码)→ 货号 */
@@ -78,6 +83,8 @@ export type BreachGenerationAuthContext = {
limitTimelineByBarcode?: Map
/** 货号 → 价格授权列表 */
authsByStyle: Map
+ /** 运营负责人(标准化姓名)→ 人员信息中的部门负责人/利润中心 */
+ personnelByOwner?: Map
}
export type BreachGenerationCandidate = {
@@ -98,6 +105,8 @@ export type BreachGenerationCandidate = {
limitTotal: number
gapAmount: number
ownerName: string
+ deptOwner: string
+ profitCenter: string
orderStatus: string
refundStatus: string
listedAt: Date | null
@@ -272,6 +281,7 @@ export function buildBreachOrderCandidates(
current.buyerPaidAmount = Number(current.buyerPaidAmount || 0) + Number(line.buyerPaidAmount || 0)
current.sellerIncomeAmount = Number(current.sellerIncomeAmount || 0) + Number(line.sellerIncomeAmount || 0)
current.fromManualSwap = Boolean(current.fromManualSwap || line.fromManualSwap)
+ current.linkOwnerName = current.linkOwnerName || line.linkOwnerName
} else {
aggregated.set(key, { ...line })
}
@@ -372,7 +382,8 @@ export function buildBreachOrderCandidates(
?? (limitTimeline ? null : (styleCode ? authContext?.flowEndDateByStyle.get(styleCode) : null))
?? linkLimit?.flowEndDate
?? null
- const candidateOwnerName = orderOwnerName || linkOwnerName || cleanOwnerName(linkLimit?.ownerName)
+ const candidateOwnerName = linkOwnerName || orderOwnerName || cleanOwnerName(linkLimit?.ownerName)
+ const personnel = authContext?.personnelByOwner?.get(normalizeOwnerName(candidateOwnerName))
if (!candidateOwnerName) stats.missingOwnerName += 1
if (!listedAt) stats.missingListedAt += 1
if (!flowEndDate) stats.missingFlowEndDate += 1
@@ -399,6 +410,8 @@ export function buildBreachOrderCandidates(
limitTotal,
gapAmount: Number((buyerPaid - limitTotal).toFixed(4)),
ownerName: candidateOwnerName,
+ deptOwner: cleanOwnerName(personnel?.departmentOwner),
+ profitCenter: cleanOwnerName(personnel?.profitCenter),
orderStatus: row.orderStatus || '',
refundStatus: row.refundStatus || '',
listedAt,
diff --git a/furniture-3d-system/src/lib/breach-order-metadata.ts b/furniture-3d-system/src/lib/breach-order-metadata.ts
index 6f555674..655beed7 100644
--- a/furniture-3d-system/src/lib/breach-order-metadata.ts
+++ b/furniture-3d-system/src/lib/breach-order-metadata.ts
@@ -10,6 +10,8 @@ export type BreachOrderMetadataCandidate = {
limitTotal: number
gapAmount: number
ownerName: string
+ deptOwner: string
+ profitCenter: string
orderStatus: string
refundStatus: string
listedAt: Date | null
@@ -29,6 +31,8 @@ export type StoredBreachOrderMetadata = {
limitTotal: unknown
gapAmount: unknown
ownerName: string
+ deptOwner: string
+ profitCenter: string
orderStatus: string
refundStatus: string
listedAt: Date | null
@@ -46,6 +50,8 @@ export type BreachOrderSnapshotRefresh = {
limitTotal: number
gapAmount: number
ownerName: string | null
+ deptOwner: string
+ profitCenter: string
orderStatus: string
refundStatus: string
listedAt: Date | null
@@ -62,6 +68,10 @@ function sameDate(left: Date | null, right: Date | null) {
return (left?.getTime() ?? null) === (right?.getTime() ?? null)
}
+function preferCandidate(candidate: string | null | undefined, stored: string | null | undefined) {
+ return String(candidate ?? '').trim() || String(stored ?? '')
+}
+
/**
* 刷新破价计算快照,并补齐元数据空值。
* 不包含 status / appeal / review 等人工流程字段。
@@ -71,9 +81,9 @@ export function planBreachOrderSnapshotRefresh(
stored: StoredBreachOrderMetadata | undefined,
): BreachOrderSnapshotRefresh | null {
if (!stored) return null
- const ownerName = !stored.ownerName.trim() && candidate.ownerName.trim()
- ? candidate.ownerName.trim()
- : stored.ownerName
+ const ownerName = preferCandidate(candidate.ownerName, stored.ownerName)
+ const deptOwner = preferCandidate(candidate.deptOwner, stored.deptOwner)
+ const profitCenter = preferCandidate(candidate.profitCenter, stored.profitCenter)
const listedAt = stored.listedAt ?? candidate.listedAt
const flowEndDate = stored.flowEndDate ?? candidate.flowEndDate
const changed = !sameDate(stored.payDate, candidate.payDate)
@@ -85,6 +95,8 @@ export function planBreachOrderSnapshotRefresh(
|| !sameNumber(stored.limitTotal, candidate.limitTotal)
|| !sameNumber(stored.gapAmount, candidate.gapAmount)
|| stored.ownerName !== ownerName
+ || stored.deptOwner !== deptOwner
+ || stored.profitCenter !== profitCenter
|| stored.orderStatus !== candidate.orderStatus
|| stored.refundStatus !== candidate.refundStatus
|| !sameDate(stored.listedAt, listedAt)
@@ -101,6 +113,8 @@ export function planBreachOrderSnapshotRefresh(
limitTotal: candidate.limitTotal,
gapAmount: candidate.gapAmount,
ownerName,
+ deptOwner,
+ profitCenter,
orderStatus: candidate.orderStatus,
refundStatus: candidate.refundStatus,
listedAt,
diff --git a/furniture-3d-system/src/lib/supply-chain-breach-order.ts b/furniture-3d-system/src/lib/supply-chain-breach-order.ts
index 6380c121..08135101 100644
--- a/furniture-3d-system/src/lib/supply-chain-breach-order.ts
+++ b/furniture-3d-system/src/lib/supply-chain-breach-order.ts
@@ -140,7 +140,7 @@ export const BREACH_REJECT_REASONS = [
'申诉原因与破价无关',
] as const
-/** 乐捐:驳回按 ¥10/单计;人员已离职不计。 */
+/** 乐捐:未通过审核的破价订单暂按 ¥10/单计;审核通过或人员已离职不计。 */
export const BREACH_FINE_AMOUNT = 10
/** 优惠出资方字典(用于核对实付款与商家实收的差额由谁承担)。 */
diff --git a/furniture-3d-system/src/server/repositories/__tests__/jst-breach-order-source.repository.test.ts b/furniture-3d-system/src/server/repositories/__tests__/jst-breach-order-source.repository.test.ts
index a5a20cca..9d894f20 100644
--- a/furniture-3d-system/src/server/repositories/__tests__/jst-breach-order-source.repository.test.ts
+++ b/furniture-3d-system/src/server/repositories/__tests__/jst-breach-order-source.repository.test.ts
@@ -59,6 +59,9 @@ describe('jst-breach-order-source repository', () => {
await expect(repository.listLinkOwners(['10025303494470'])).resolves.toEqual(
new Map([['10025303494470', '负责人甲']]),
)
+ const sqlText = String(request.query.mock.calls[0]?.[0] ?? '')
+ expect(sqlText).toContain('shopproid AS itemId')
+ expect(sqlText).toContain('ider AS ownerName')
expect(repository.listItemOwners).toHaveBeenCalledWith(['10025303494470'])
})
diff --git a/furniture-3d-system/src/server/repositories/jst-breach-order-source.repository.ts b/furniture-3d-system/src/server/repositories/jst-breach-order-source.repository.ts
index c2ef4e3c..8973d27e 100644
--- a/furniture-3d-system/src/server/repositories/jst-breach-order-source.repository.ts
+++ b/furniture-3d-system/src/server/repositories/jst-breach-order-source.repository.ts
@@ -283,7 +283,7 @@ class JstBreachOrderSourceRepository {
return listedAtByKey
}
- /** 按店铺款式编码读取链接维度负责人(op_TargetManagement 最新记录)。 */
+ /** 按店铺款式编码读取运营负责人(与停产下架同口径:链接 itemId → 负责人)。 */
async listLinkOwners(itemIds: readonly string[]): Promise