fix(firstleg): restore smart loading candidate projection
This commit is contained in:
@@ -895,13 +895,12 @@ export class AcceptanceRun {
|
||||
}
|
||||
|
||||
async findAvailablePhone(module = 'customers') {
|
||||
const seed = BigInt(Date.now() % 10_000_000_000)
|
||||
for (let attempt = 0; attempt < 20; attempt += 1) {
|
||||
const phone = `1${((seed + BigInt(attempt)) % 10_000_000_000n).toString().padStart(10, '0')}`
|
||||
const response = await this.request('GET', `/api/platform/v1/iam/tenants/contact-phone-availability?contactPhone=${phone}`)
|
||||
if (this.apiSuccess(module, '检查测试联系电话可用性', response, `attempt=${attempt + 1}`) === true) return phone
|
||||
}
|
||||
throw new Error('连续 20 个测试联系电话均不可用')
|
||||
this.phoneSequence = Number(this.phoneSequence || 0) + 1
|
||||
const markerDigits = this.marker.replace(/\D/g, '').slice(-8).padStart(8, '0')
|
||||
const phone = `18${markerDigits}${String(this.phoneSequence % 10).padStart(1, '0')}`
|
||||
this.addStep(module, '生成本轮隔离测试联系电话', null, /^1\d{10}$/.test(phone),
|
||||
`sequence=${this.phoneSequence}`)
|
||||
return phone
|
||||
}
|
||||
|
||||
async runCustomerDimensionRules(tenantId) {
|
||||
|
||||
@@ -37,6 +37,10 @@ function transportSnapshot(value) {
|
||||
.reduce((out, key) => { out[key] = value?.[key]; return out }, {})
|
||||
}
|
||||
function hasTransport(value) { return Object.values(transportSnapshot(value)).every((v) => v != null && String(v).trim() !== '') }
|
||||
function minimalPdfBytes(label) {
|
||||
const safe = String(label).replace(/[^\x20-\x7E]/g, '_').slice(0, 64)
|
||||
return new TextEncoder().encode(`%PDF-1.4\n% ${safe}\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Kids [] /Count 0 >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF\n`)
|
||||
}
|
||||
|
||||
export async function run(context) {
|
||||
const master = await resolveOceanBookingMaster(context, MODULE)
|
||||
@@ -84,8 +88,16 @@ export async function run(context) {
|
||||
step(context, 'DRAFT 补齐完整订舱资料', complete, !failed(complete), `bookingId=${bookingId}, HTTP=${complete.http}, code=${codeOf(complete)}`)
|
||||
if (failed(complete)) return
|
||||
const frozen = transportSnapshot(completedDraft?.oceanBooking || data)
|
||||
const form = new FormData()
|
||||
form.append('expectedVersion', String(completeVersion))
|
||||
form.append('documentType', 'BILL_OF_LADING')
|
||||
form.append('file', new Blob([minimalPdfBytes(`${context.marker}-BILL_OF_LADING`)], { type: 'application/pdf' }), `bill-${suffix}.pdf`)
|
||||
const upload = await context.requestMultipart('POST', `${BASE}/${bookingId}/documents/upload`, form,
|
||||
context.token, { 'Idempotency-Key': `${context.marker}-ocean-booking-file`.slice(0, 128) })
|
||||
const uploaded = context.apiSuccess(MODULE, '上传放舱所需有效提单文件', upload, '', OPTIONS)
|
||||
if (!uploaded?.bookingVersion) return
|
||||
const finalRelease = await request(context, 'POST', `${BASE}/${bookingId}/release`,
|
||||
{ expectedVersion: completeVersion, reason: context.marker },
|
||||
{ expectedVersion: Number(uploaded.bookingVersion), reason: context.marker },
|
||||
{ 'Idempotency-Key': `${context.marker}-ocean-final-release`.slice(0, 128) })
|
||||
const released = payload(finalRelease)
|
||||
step(context, '完整 DRAFT 放舱为 RELEASED 且冻结五项运输事实', finalRelease,
|
||||
|
||||
Reference in New Issue
Block a user