This commit is contained in:
2026-08-14 10:09:46 +08:00
parent 0bc752a2be
commit 66089f9b99
31 changed files with 719 additions and 141 deletions
@@ -262,13 +262,17 @@ async function createMarkerContainer(context, resource) {
}
}
async function createContainerCost(context, customerId, container, voucherFileId, snapshotInput) {
if (context.financeFixtureHooks?.createContainerCost) return context.financeFixtureHooks.createContainerCost(context, customerId, container, voucherFileId, snapshotInput)
const body = { customerId: Number(customerId), costType: 'CONTAINER_SHARED', orderId: null,
export function buildContainerCostBody(marker, customerId, container, voucherFileId) {
return { customerId: String(customerId), costType: 'CONTAINER_SHARED', orderId: null,
// Finance names this field containerId, but its Firstleg cost snapshot contract
// resolves it as the loading plan ID, not the physical container booking ID.
containerId: String(container.loadingPlanId), expenseName: `${context.marker}-整柜成本`, amount: 300,
currency: 'CNY', voucherFileIds: [voucherFileId], remark: context.marker }
containerId: String(container.loadingPlanId), expenseName: `${marker}-整柜成本`, amount: 300,
currency: 'CNY', voucherFileIds: [voucherFileId], remark: marker }
}
async function createContainerCost(context, customerId, container, voucherFileId, snapshotInput) {
if (context.financeFixtureHooks?.createContainerCost) return context.financeFixtureHooks.createContainerCost(context, customerId, container, voucherFileId, snapshotInput)
const body = buildContainerCostBody(context.marker, customerId, container, voucherFileId)
const response = await request(context, 'POST', '/api/platform/finance/v1/cost-entries', body)
if (response?.body?.code === 'FIN_400') {
const first = snapshotInput?.items?.[0]