优化
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user