This commit is contained in:
2026-08-14 17:38:06 +08:00
parent d1b4a4d3f3
commit 010204da57
12 changed files with 259 additions and 33 deletions
@@ -201,7 +201,7 @@ describe('InboundMeasurementPanel', () => {
expect(text).toContain('扫描箱测量数据明细')
expect(text).toContain('订单总箱数')
expect(text).toContain('确认箱数合计')
expect(text).toContain('实测总毛重')
expect(text).toContain('货物总重量')
expect(text).toContain('实测总体积')
expect(text).toContain('实测总材积重')
expect(text).not.toContain('租户')
@@ -271,6 +271,22 @@ describe('InboundMeasurementPanel', () => {
expect(getInboundMeasurement).toHaveBeenCalledTimes(1)
})
it('shows a normal A0409 business reason instead of relabeling it as a version conflict', async () => {
vi.mocked(updateConfirmedPackageCount).mockRejectedValueOnce(
new ApiResponseError('该托盘已被占用,请重新选择', 'A0409', 409),
)
const wrapper = await mountPanel()
const countInput = wrapper.find('.measurement-count-editor input')
await countInput.setValue('9')
const save = wrapper.findAll('button').find((button) => button.text().includes('保存测量数据'))
await save?.trigger('click')
await flushPromises()
expect(wrapper.text()).toContain('该托盘已被占用,请重新选择')
expect(wrapper.text()).toContain('操作未完成')
expect(wrapper.text()).not.toContain('数据版本已变化,当前修改尚未丢失')
})
it('requires the dirty draft to be saved before submitting for review', async () => {
const wrapper = await mountPanel()
const countInput = wrapper.find('.measurement-count-editor input')
@@ -314,11 +314,8 @@ function validateDraft() {
function setOperationError(error: unknown, fallback: string) {
const details = getApiErrorDetails(error, fallback)
operationError.value = details
conflictDetected.value = details.code === 'A0409'
|| details.code === 'CONFLICT'
|| details.code === 'HTTP_409'
|| details.message.includes('版本')
|| details.message.includes('并发')
conflictDetected.value = details.message.includes('版本已变化')
|| details.message.includes('并发修改')
return details
}
@@ -532,7 +529,7 @@ defineExpose({ saveDraft, submitForReview, updateActualGrossWeight, mayMaintain,
<label><span>数据版本</span><el-input :model-value="String(form.version)" readonly /></label>
<label><span>确认箱数合计</span><el-input :model-value="formatNumber(confirmedPackageCount, 0)" readonly /></label>
<label><span>订单总箱数</span><el-input :model-value="formatNumber(expectedPackageCount, 0)" readonly /></label>
<label><span>实测总毛重(T.K.GW)</span><el-input :model-value="formatNumber(detail.actualGrossWeightKg)" readonly /></label>
<label><span>货物总重量(kg)</span><el-input :model-value="formatNumber(detail.actualGrossWeightKg)" readonly /></label>
<label><span>原单总毛重(T.K.GW)</span><el-input-number v-model="form.originalGrossWeightKg" :min="0" :precision="3" controls-position="right" /></label>
<label><span>实测总体积(T.CBM)</span><el-input :model-value="formatNumber(detail.actualVolumeCbm, 4)" readonly /></label>
<label><span>原单总体积(T.CBM)</span><el-input-number v-model="form.originalVolumeCbm" :min="0" :precision="4" controls-position="right" /></label>
+7 -1
View File
@@ -39,6 +39,11 @@ export interface InboundMeasurementItem {
export interface InboundMeasurementWeightResult {
id: MeasurementIdentifier
fileId: MeasurementIdentifier
palletId: MeasurementIdentifier
palletCode: string
palletType: string
palletCapacityCbm: number
palletTareWeightKg: number
ocrProvider: string | null
ocrRawText: string | null
ocrWeightValue: number | null
@@ -46,7 +51,8 @@ export interface InboundMeasurementWeightResult {
confidence: number | null
adjustedWeightValue: number | null
adjustedWeightUnit: string | null
finalWeightKg: number | null
grossWeightKg: number | null
netWeightKg: number | null
recognitionStatus: string
adjustmentReason: string | null
adjustedBy: MeasurementIdentifier | null