feat(pl): hard-block over-limit contract qty on arrange and remind after success

Validate arranged+this plan qty against fixed contract product quantities on
transport arrange; return post-success remaining/framework cumulative reminders.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-30 16:47:21 +08:00
1 parent d326996976
commit 3011cb9dae
10 files changed
+1424 -8

No files matched your search

@@ -10,6 +10,10 @@ import {
import { pickBxData } from '@/utils/http/bx'
import { planRequiresSiteLink } from '@/utils/pl-internal-customer'
import type { PlanDeliveryForm, PlanLoadForm } from '@/utils/pl-plan-stop-form'
import {
showContractQtyReminderIfAny,
showContractQtyViolationIfMatch
} from '@/utils/pl-contract-qty-reminder'
export interface ArrangeHistoricalFlags {
hasHistoricalDibang: boolean
@@ -202,10 +206,16 @@ export async function submitPlanArrange(
planId: string,
payload: TransportArrange
): Promise<TransportArrangeResult> {
const res = await transportApi.arrange(planId, payload)
const result = pickBxData<TransportArrangeResult>(res)
if (!result) {
throw new Error('安排失败:未返回结果')
try {
const res = await transportApi.arrange(planId, payload)
const result = pickBxData<TransportArrangeResult>(res)
if (!result) {
throw new Error('安排失败:未返回结果')
}
await showContractQtyReminderIfAny(result.contractQtyReminder)
return result
} catch (error) {
await showContractQtyViolationIfMatch(error)
throw error
}
return result
}