This commit is contained in:
2026-09-04 14:31:09 +08:00
parent 4eda56acf1
commit dd47f3841c
4 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ describe('inbound measurement API', () => {
await expect(getInboundMeasurement('10001', '7001')).resolves.toEqual(detail) await expect(getInboundMeasurement('10001', '7001')).resolves.toEqual(detail)
expect(http.get).toHaveBeenCalledWith('/platform/v1/first-leg/inbounds/7001/measurement', { expect(http.get).toHaveBeenCalledWith('/platform/v1/first-leg/inbounds/7001/measurement', {
params: { tenantId: '10001' }, params: { tenantId: '10001', requestAt: expect.any(Number) },
}) })
}) })
+3 -1
View File
@@ -37,7 +37,9 @@ export async function getInboundMeasurement(customerId: string, inboundId: strin
// items[].boxCode, machineNo, deviceMeasuredAt. Keep the response aligned with the backend OpenAPI. // items[].boxCode, machineNo, deviceMeasuredAt. Keep the response aligned with the backend OpenAPI.
const response = await http.get<ApiEnvelope<InboundMeasurementDetail>, ApiEnvelope<InboundMeasurementDetail>>( const response = await http.get<ApiEnvelope<InboundMeasurementDetail>, ApiEnvelope<InboundMeasurementDetail>>(
measurementPath(inboundId), measurementPath(inboundId),
{ params: { tenantId: customerId } }, // Calculation-mode saves use a sibling PUT endpoint. A cache may otherwise keep
// returning the pre-save measurement and make a successful update look failed.
{ params: { tenantId: customerId, requestAt: Date.now() } },
) )
return unwrapApiResponse(response) return unwrapApiResponse(response)
} }
@@ -323,6 +323,7 @@ describe('UnifiedOrdersView contract', () => {
expect(source).toContain('仓库修改外箱(宽)') expect(source).toContain('仓库修改外箱(宽)')
expect(source).toContain('仓库修改外箱(高)') expect(source).toContain('仓库修改外箱(高)')
expect(source).toContain('saveWarehouseOuterDimensions') expect(source).toContain('saveWarehouseOuterDimensions')
expect(source).toContain("'MEASURE_REJECTED', 'WAIT_SPLIT'")
expect(source).not.toContain('请至少输入一项需要修改的外箱尺寸') expect(source).not.toContain('请至少输入一项需要修改的外箱尺寸')
expect(source).toContain(".map((value) => value == null || value === '' ? null : Number(value))") expect(source).toContain(".map((value) => value == null || value === '' ? null : Number(value))")
expect(source).toContain('相关数值已重新计算') expect(source).toContain('相关数值已重新计算')
@@ -381,6 +382,7 @@ describe('UnifiedOrdersView contract', () => {
expect(source).not.toContain("!customerSource && mode !== 'ACTUAL'") expect(source).not.toContain("!customerSource && mode !== 'ACTUAL'")
expect(source).toContain('rawDimensions.map((value) => value + rule.edgeAdditionCm * 2)') expect(source).toContain('rawDimensions.map((value) => value + rule.edgeAdditionCm * 2)')
expect(source).toContain('matchedSpecificationCoefficient(chargeRule, calculationSource)') expect(source).toContain('matchedSpecificationCoefficient(chargeRule, calculationSource)')
expect(source).toContain(".find((item) => item.id === boundChargeRuleId && item.status === 'ACTIVE')")
expect(source).toContain('listCustomerChargeRules(customerId, tenantId)') expect(source).toContain('listCustomerChargeRules(customerId, tenantId)')
expect(source).toContain('matchedDimensions.map((value) => roundedUp(value * specificationCoefficient, 3))') expect(source).toContain('matchedDimensions.map((value) => roundedUp(value * specificationCoefficient, 3))')
expect(source).toContain('const selectedMode: MeasurementCalculationMode = measurementSectionModes.outer') expect(source).toContain('const selectedMode: MeasurementCalculationMode = measurementSectionModes.outer')
@@ -375,7 +375,10 @@ function calculatedMeasurementRow(
const matchedDimensions = mode === 'ADD' && rule const matchedDimensions = mode === 'ADD' && rule
? rawDimensions.map((value) => value + rule.edgeAdditionCm * 2) ? rawDimensions.map((value) => value + rule.edgeAdditionCm * 2)
: rawDimensions : rawDimensions
const chargeRule = activeMeasurementChargeRule.value const boundChargeRuleId = String(source.chargeRuleId || '')
const chargeRule = measurementChargeRules.value
.find((item) => item.id === boundChargeRuleId && item.status === 'ACTIVE')
|| activeMeasurementChargeRule.value
const specificationCoefficient = mode === 'MULTIPLY' && chargeRule const specificationCoefficient = mode === 'MULTIPLY' && chargeRule
? matchedSpecificationCoefficient(chargeRule, calculationSource) ? matchedSpecificationCoefficient(chargeRule, calculationSource)
: 1 : 1
@@ -985,7 +988,9 @@ async function updateMeasurementCalculationMode(row: Record<string, unknown> | n
async function saveWarehouseOuterDimensions(row: Record<string, unknown>) { async function saveWarehouseOuterDimensions(row: Record<string, unknown>) {
const summary = detail.value?.summary const summary = detail.value?.summary
const measurement = measurementDetail.value const measurement = measurementDetail.value
const editableMeasurementStatuses = new Set(['WAIT_MEASURE', 'MEASURING', 'MEASURE_PENDING', 'MEASURE_REJECTED']) const editableMeasurementStatuses = new Set([
'WAIT_MEASURE', 'MEASURING', 'MEASURE_PENDING', 'MEASURE_REJECTED', 'WAIT_SPLIT',
])
const currentStatus = editableMeasurementStatuses.has(measurement?.processStatus || '') const currentStatus = editableMeasurementStatuses.has(measurement?.processStatus || '')
? measurement!.processStatus ? measurement!.processStatus
: summary?.mainStatus || measurement?.processStatus || '' : summary?.mainStatus || measurement?.processStatus || ''