feat(finance): 完成成本快照运行层、销售事实与人工支出登记
迁移 108-111:快照业务时间与预估转实际、销售事实表、系统成本项、公司人工支出登记。接单平台按工单实际 reward 入账;人工支出支持登记/审批/驳回/报销并写 actual 快照。新增销售毛利页、人工支出页与订单入口。
This commit is contained in:
@@ -3,7 +3,10 @@ import {
|
||||
findLatestOrderByPlatformOrderIdWithExecutor,
|
||||
updateOrderWithExecutor,
|
||||
} from '../../repositories/order-repo.js'
|
||||
import { replaceOrderItemsWithExecutor } from '../../repositories/order-item-repo.js'
|
||||
import {
|
||||
applyOrderItemRevenueAllocationWithExecutor,
|
||||
replaceOrderItemsWithExecutor,
|
||||
} from '../../repositories/order-item-repo.js'
|
||||
import { withTransaction } from '../../db/client.js'
|
||||
import { syncDeliveryTasksForOrder } from './delivery-task-service.js'
|
||||
import { resolveOrderItemForFulfillment } from '../fulfillment/product-resolution-service.js'
|
||||
@@ -182,6 +185,11 @@ export async function upsertOrderFromSource(
|
||||
updatedAt: now,
|
||||
})),
|
||||
)
|
||||
await applyOrderItemRevenueAllocationWithExecutor(
|
||||
executor,
|
||||
order.id,
|
||||
Number(order.total_amount) || 0,
|
||||
)
|
||||
|
||||
return { order, orderItems }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user