优化
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { prepareTerminalDrayage } from './phase5-terminal-drayage.mjs'
|
||||
import { createHash } from 'node:crypto'
|
||||
|
||||
const MODULE = 'phase4-overseas-pda'
|
||||
const SCENARIO = 'phase4-overseas-pda-container-receiving'
|
||||
@@ -47,6 +48,10 @@ function forbidden(response) { return [401, 403].includes(response?.http) || (re
|
||||
function trace(response) { return `HTTP=${response?.http ?? 'missing'}, code=${response?.body?.code ?? 'missing'}, requestId=${response?.requestId || 'missing'}, traceId=${response?.traceId || 'missing'}` }
|
||||
function key(context, action, suffix = '') { return `${context.marker}-${context.pdaContainerSuffix || ''}-${action}-${suffix}`.replace(/[^A-Za-z0-9:_-]/g, '').slice(0, 120) }
|
||||
function markerSuffix(context) { return `${context.marker}${context.pdaContainerSuffix || ''}`.replace(/[^A-Za-z0-9]/g, '').slice(-16).toUpperCase() }
|
||||
export function pickerFixtureSuffix(context) {
|
||||
if (typeof context.marker !== 'string' || !context.marker.trim()) throw Error('PDA账号缺少本轮运行标识')
|
||||
return createHash('sha256').update(JSON.stringify([context.marker, context.pdaContainerSuffix || ''])).digest('hex').slice(0, 32).toUpperCase()
|
||||
}
|
||||
function records(data) { return Array.isArray(data?.records) ? data.records : Array.isArray(data) ? data : [] }
|
||||
function receivingSnapshot(data) {
|
||||
return JSON.stringify({
|
||||
@@ -313,7 +318,7 @@ export async function resolvePickerAccess(context) {
|
||||
|
||||
export async function createPicker(context, index, overseasWarehouseId, access) {
|
||||
const role = access.role
|
||||
const suffix = markerSuffix(context)
|
||||
const suffix = pickerFixtureSuffix(context)
|
||||
const username = `pda_overseas_${suffix.toLowerCase()}_${index}`.slice(0, 64)
|
||||
const password = `Pda${suffix.replace(/[^A-Za-z0-9]/g, '')}A${index}9`
|
||||
const phone = await context.findAvailablePhone(MODULE)
|
||||
|
||||
Reference in New Issue
Block a user