优化
This commit is contained in:
@@ -45,7 +45,7 @@ describe('inbound measurement API', () => {
|
||||
|
||||
await expect(getInboundMeasurement('10001', '7001')).resolves.toEqual(detail)
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/first-leg/inbounds/7001/measurement', {
|
||||
params: { tenantId: '10001' },
|
||||
params: { tenantId: '10001', requestAt: expect.any(Number) },
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ export async function getInboundMeasurement(customerId: string, inboundId: strin
|
||||
// items[].boxCode, machineNo, deviceMeasuredAt. Keep the response aligned with the backend OpenAPI.
|
||||
const response = await http.get<ApiEnvelope<InboundMeasurementDetail>, ApiEnvelope<InboundMeasurementDetail>>(
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -323,6 +323,7 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).toContain('仓库修改外箱(宽)')
|
||||
expect(source).toContain('仓库修改外箱(高)')
|
||||
expect(source).toContain('saveWarehouseOuterDimensions')
|
||||
expect(source).toContain("'MEASURE_REJECTED', 'WAIT_SPLIT'")
|
||||
expect(source).not.toContain('请至少输入一项需要修改的外箱尺寸')
|
||||
expect(source).toContain(".map((value) => value == null || value === '' ? null : Number(value))")
|
||||
expect(source).toContain('相关数值已重新计算')
|
||||
@@ -381,6 +382,7 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).not.toContain("!customerSource && mode !== 'ACTUAL'")
|
||||
expect(source).toContain('rawDimensions.map((value) => value + rule.edgeAdditionCm * 2)')
|
||||
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('matchedDimensions.map((value) => roundedUp(value * specificationCoefficient, 3))')
|
||||
expect(source).toContain('const selectedMode: MeasurementCalculationMode = measurementSectionModes.outer')
|
||||
|
||||
@@ -375,7 +375,10 @@ function calculatedMeasurementRow(
|
||||
const matchedDimensions = mode === 'ADD' && rule
|
||||
? rawDimensions.map((value) => value + rule.edgeAdditionCm * 2)
|
||||
: 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
|
||||
? matchedSpecificationCoefficient(chargeRule, calculationSource)
|
||||
: 1
|
||||
@@ -985,7 +988,9 @@ async function updateMeasurementCalculationMode(row: Record<string, unknown> | n
|
||||
async function saveWarehouseOuterDimensions(row: Record<string, unknown>) {
|
||||
const summary = detail.value?.summary
|
||||
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 || '')
|
||||
? measurement!.processStatus
|
||||
: summary?.mainStatus || measurement?.processStatus || ''
|
||||
|
||||
Reference in New Issue
Block a user