Merge origin/dev into release/test preserving current workflows

This commit is contained in:
2026-09-14 11:05:48 +08:00
17 changed files with 328 additions and 24 deletions
+40
View File
@@ -0,0 +1,40 @@
export const DROPSHIP_SCAN_INTENT = Object.freeze({
BLOCKED: 'BLOCKED',
INVALID: 'INVALID',
DUPLICATE: 'DUPLICATE',
RESOLVE_CARTON: 'RESOLVE_CARTON',
SELECT_PALLET: 'SELECT_PALLET',
BIND_PENDING: 'BIND_PENDING'
})
export const PALLET_NO_PATTERN = /^DP-[0-9]{6}-[0-9]{4}$/
function normalize(value) {
return value == null ? '' : String(value).trim().toUpperCase()
}
export function createDropshipScanState(value = {}) {
return {
online: value.online !== false,
activePalletNo: normalize(value.activePalletNo),
pendingBoxCode: normalize(value.pendingBoxCode),
lastScanCode: normalize(value.lastScanCode)
}
}
export function planDropshipScan(currentState, rawCode, { unboundCartons = 0 } = {}) {
const state = createDropshipScanState(currentState)
const scanCode = normalize(rawCode)
if (!state.online) return { state, intent: DROPSHIP_SCAN_INTENT.BLOCKED, message: '当前网络不可用,不能执行正式扫码' }
if (!scanCode) return { state, intent: DROPSHIP_SCAN_INTENT.INVALID, message: '扫码内容不能为空' }
if (scanCode === state.lastScanCode) return { state, intent: DROPSHIP_SCAN_INTENT.DUPLICATE, message: '请勿重复扫描同一码' }
if (PALLET_NO_PATTERN.test(scanCode)) {
const next = { ...state, activePalletNo: scanCode, lastScanCode: scanCode }
return { state: next, intent: Number(unboundCartons) > 0 ? DROPSHIP_SCAN_INTENT.BIND_PENDING : DROPSHIP_SCAN_INTENT.SELECT_PALLET, palletNo: scanCode }
}
return { state: { ...state, pendingBoxCode: scanCode, lastScanCode: scanCode }, intent: DROPSHIP_SCAN_INTENT.RESOLVE_CARTON, boxCode: scanCode, palletNo: state.activePalletNo || null }
}
export function releaseDropshipScan(state, { clearBox = false } = {}) {
return { ...createDropshipScanState(state), pendingBoxCode: clearBox ? '' : state.pendingBoxCode, lastScanCode: '' }
}
-2
View File
@@ -7,8 +7,6 @@ export const ITEM_STATUS = Object.freeze({
export function isSealedPalletItem(item) {
return item?.unitType === 'SEALED_PALLET'
|| item?.palletId !== null && item?.palletId !== undefined
|| item?.indivisible === true
}
export function summarizeInventoryResources(resources) {
+1 -1
View File
@@ -1,4 +1,4 @@
const INTERNAL_ID_FIELD_PATTERN = /(?:taskId|inboundId|orderId|loadingPlanId|containerBookingId|任务ID|入库单ID|订单ID|装柜计划ID|柜次ID)\s*[:=:]?\s*[A-Za-z0-9_-]*/gi
const INTERNAL_ID_FIELD_PATTERN = /(?:taskId|inboundId|orderId|loadingPlanId|containerBookingId|cartonId|palletId|warehouseId|任务ID|入库单ID|订单ID|装柜计划ID|柜次ID|箱明细ID|托盘ID|仓库ID)\s*[:=:]?\s*[A-Za-z0-9_-]*/gi
const LONG_INTERNAL_NUMBER_PATTERN = /(^|[^A-Za-z0-9])\d{18,20}(?=$|[^A-Za-z0-9])/g
export function displayBusinessValue(value, missing = '—') {