This commit is contained in:
2026-10-21 21:30:24 +08:00
parent 234216b3eb
commit 5356a8c898
28 changed files with 1543 additions and 45 deletions
@@ -104,11 +104,14 @@ export async function prepareFleetTrip(context, module, dispatchNo, warehouseId)
}, '建立本轮TEST车辆主档及容量')
proof.vehicleId = id(vehicle.id)
if (!proof.vehicleId) throw new Error('车辆主档没有返回真实资源ID')
await prepareQualifiedDriver(context, module, proof)
const confirmedTimes = (before.dispatchInfo?.fbaAppointments || []).filter(row => row.status === 'SUCCESS' && row.confirmedAt).map(row => row.confirmedAt).sort()
const arrival = before.dispatchInfo?.estimatedArrivalAt ?? confirmedTimes[0] ?? null
await prepareQualifiedDriver(context, module, proof, arrival)
proof.updateRequest = { recordVersion: before.recordVersion, idempotencyKey: key(proof, 'EDIT'),
publishLooseboardDemand: before.publishLooseboardDemand,
vehicle: { mode: 'MASTER', vehicleId: proof.vehicleId },
driver: { mode: 'MASTER', driverId: proof.driverId, evidence: { expectedTaskEndAt: proof.expectedDriverEndAt } },
plannedDepartureAt: new Date(Date.now() + 3600000).toISOString(), estimatedArrivalAt: before.dispatchInfo?.estimatedArrivalAt ?? null,
plannedDepartureAt: new Date(Date.now() + 3600000).toISOString(), estimatedArrivalAt: arrival,
remark: `${context.marker} TEST合成资料正常履约` }
let result = await command(context, module, 'PUT', path, proof.updateRequest, '通过排车主单编辑正式分配车辆司机')
for (const action of ['submit-review', 'dispatch-review', 'loading-review']) {
@@ -127,8 +130,8 @@ export async function prepareFleetTrip(context, module, dispatchNo, warehouseId)
proof.preparation = 'VERIFIED'; await context.checkpoint?.(); return proof
}
async function prepareQualifiedDriver(context, module, proof) {
proof.expectedDriverEndAt = new Date(Date.now() + 48 * 3600000).toISOString()
async function prepareQualifiedDriver(context, module, proof, arrival) {
proof.expectedDriverEndAt = new Date(Math.max(Date.now() + 48 * 3600000, arrival ? Date.parse(arrival) + 6 * 3600000 : 0)).toISOString()
let driver = await command(context, module, 'POST', `${BASE}/drivers`, {
name: `${proof.marker}验收司机`, phone: '19900000000', ownership: 'OWNED', region: 'OVERSEAS',
licenseNumber: proof.marker, licenseType: 'Class A', licenseZone: 'UTC',