适配PDA稳定柜次身份契约

This commit is contained in:
2026-08-12 18:32:31 +08:00
parent 0b51ed4347
commit c8509cb452
8 changed files with 142 additions and 56 deletions
+23
View File
@@ -0,0 +1,23 @@
function text(value) {
return value == null ? '' : String(value)
}
export function stableTaskIdentity(identity = {}) {
return {
operatorId: text(identity.operatorId ?? identity.accountId ?? identity.userId),
taskId: text(identity.taskId ?? identity.inboundId),
loadingPlanId: text(identity.loadingPlanId),
containerBookingId: text(identity.containerBookingId)
}
}
export function stableTaskIdentityKey(identity = {}) {
const value = stableTaskIdentity(identity)
if (!value.operatorId || !value.taskId || !value.loadingPlanId) return ''
return [value.operatorId, value.taskId, value.loadingPlanId].map(encodeURIComponent).join(':')
}
export function stableTaskOperationIdentity(identity = {}) {
const value = stableTaskIdentity(identity)
return `${value.operatorId}-${value.taskId}-${value.loadingPlanId}-${value.containerBookingId}`
}