30 lines
885 B
TypeScript
30 lines
885 B
TypeScript
export type ConsignmentActionTargetInput = {
|
|
workOrderId?: number | null
|
|
shareId?: number | null
|
|
allocationId?: number | null
|
|
}
|
|
|
|
export type ConsignmentActionTarget = {
|
|
workOrderId?: number | null
|
|
shareId?: number | null
|
|
allocationId?: number | null
|
|
}
|
|
|
|
/**
|
|
* 卖家侧操作定位参数。
|
|
*
|
|
* 有 allocation/share 时按新占用模型传参;历史整单履约没有占用记录,
|
|
* 这时不要传 workOrderId,让后端回退到库存自身的 bound_work_order_id。
|
|
*/
|
|
export function resolveConsignmentActionTarget(
|
|
item: ConsignmentActionTargetInput,
|
|
): ConsignmentActionTarget {
|
|
const hasAllocationTarget = Number(item.allocationId || 0) > 0 || Number(item.shareId || 0) > 0
|
|
if (!hasAllocationTarget) return {}
|
|
return {
|
|
workOrderId: item.workOrderId ?? null,
|
|
shareId: item.shareId ?? null,
|
|
allocationId: item.allocationId ?? null,
|
|
}
|
|
}
|