feat(shipping-notice): 增强发货通知候选管理功能,支持候选选择、重复检测与业务摘要修订
This commit is contained in:
1 parent
70f684b94a
commit
b595e157e9
83 files changed
+5857
-200
No files matched your search
@@ -93,7 +93,7 @@ export interface UseChatShippingOptions {
|
||||
agentId: number,
|
||||
kb: string,
|
||||
files: ChatUploadFileSpec[],
|
||||
context?: { task_id?: string; batch_no?: string; display_query?: string },
|
||||
context?: { task_id?: string; batch_no?: string; shipping_intake_nos?: string[]; display_query?: string },
|
||||
hooks?: { onAssistantMessageFinished?: (message: ChatMessage, runMessages: ChatMessage[]) => void | Promise<void> },
|
||||
) => Promise<void>;
|
||||
startChatTurn: (options: import('../types/chat-turn.types').StartChatTurnOptions) => Promise<boolean>;
|
||||
@@ -429,6 +429,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
const getCurrentShippingChatContext = () => ({
|
||||
task_id: getActiveBatchTaskId() || getActiveShippingTaskId(),
|
||||
batch_no: getActiveShippingBatchNo(),
|
||||
shipping_intake_nos: shippingIntakes.getParsedIntakeNos(),
|
||||
});
|
||||
|
||||
const getCurrentShippingChatContextWithDisplay = (displayQuery: string) => ({
|
||||
@@ -561,6 +562,8 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
*/
|
||||
const finalizeShippingAssistantMessage = async () => {
|
||||
if (!isShippingNoticeAgent.value) return;
|
||||
await shippingIntakes.refreshStatuses();
|
||||
shippingIntakes.clearConsumedAttachments();
|
||||
await refreshShippingActions();
|
||||
};
|
||||
|
||||
@@ -730,6 +733,49 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
shippingDuplicateAttachmentId.value = null;
|
||||
};
|
||||
|
||||
/** 更新 Candidate 选择状态,并将 API 失败统一反馈给用户。 */
|
||||
const setShippingCandidateSelected = async (candidateNo: string, selected: boolean) => {
|
||||
try {
|
||||
await shippingIntakes.setCandidateSelected(candidateNo, selected);
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCandidateUpdateFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
/** 保存 Candidate 结构化修订,并保留服务端校验错误。 */
|
||||
const updateShippingCandidateSummary = async (
|
||||
candidateNo: string,
|
||||
businessSummary: Record<string, unknown>,
|
||||
done?: (success: boolean) => void,
|
||||
) => {
|
||||
try {
|
||||
await shippingIntakes.updateCandidateSummary(candidateNo, businessSummary);
|
||||
msg.success(t('chat.shippingCandidateUpdateDone'));
|
||||
done?.(true);
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCandidateUpdateFailed'));
|
||||
done?.(false);
|
||||
}
|
||||
};
|
||||
|
||||
/** 保存 Candidate 重复决策,并统一展示权限或目标漂移错误。 */
|
||||
const resolveShippingCandidateDuplicate = async (
|
||||
candidateNo: string,
|
||||
action: import('../types/shipping.types').ShippingDuplicateAction,
|
||||
targetTaskNo?: string,
|
||||
reason?: string,
|
||||
done?: (success: boolean) => void,
|
||||
) => {
|
||||
try {
|
||||
await shippingIntakes.resolveCandidateDuplicate(candidateNo, action, targetTaskNo, reason);
|
||||
msg.success(t('chat.shippingNoticeDuplicateResolved'));
|
||||
done?.(true);
|
||||
} catch (error: unknown) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingNoticeDuplicateResolveFailed'));
|
||||
done?.(false);
|
||||
}
|
||||
};
|
||||
|
||||
const {
|
||||
handleShippingAutoUploadFile,
|
||||
handleShippingAutoUploadNoticeBatch,
|
||||
@@ -763,6 +809,7 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
startChatTurn,
|
||||
refreshShippingActions,
|
||||
getParsedIntakeNos: shippingIntakes.getParsedIntakeNos,
|
||||
getSelectedCandidateNos: shippingIntakes.getSelectedCandidateNos,
|
||||
clearConsumedNoticeAttachments: shippingIntakes.clearConsumedAttachments,
|
||||
msg,
|
||||
t,
|
||||
@@ -819,8 +866,12 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
hasBlockingNoticeIntake: () => shippingIntakes.hasBlockingUploadOrParse.value,
|
||||
hasNoticeIntakeFailures: () => shippingIntakes.hasParseFailures.value,
|
||||
hasBlockingNoticeDuplicates: () => shippingIntakes.hasBlockingDuplicates.value,
|
||||
hasCandidateReviewIssues: () => shippingIntakes.hasCandidateReviewIssues.value,
|
||||
hasSelectedNoticeCandidates: () => shippingIntakes.getSelectedCandidateNos().length > 0,
|
||||
openShippingDuplicateDialog,
|
||||
getParsedIntakeNos: shippingIntakes.getParsedIntakeNos,
|
||||
refreshNoticeIntakeStatuses: shippingIntakes.refreshStatuses,
|
||||
clearConsumedNoticeAttachments: shippingIntakes.clearConsumedAttachments,
|
||||
refreshShippingActions,
|
||||
shippingSuggestedPrompt,
|
||||
isShippingShortageQueryIntent,
|
||||
@@ -1132,6 +1183,10 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
handleShippingLocalFilesSelected,
|
||||
removeShippingNoticeAttachment: shippingIntakes.removeNoticeAttachment,
|
||||
retryShippingNoticeAttachment: shippingIntakes.retryNoticeAttachment,
|
||||
shippingNoticeAllReadyForConfirmation: shippingIntakes.allReadyForConfirmation,
|
||||
setShippingCandidateSelected,
|
||||
updateShippingCandidateSummary,
|
||||
resolveShippingCandidateDuplicate,
|
||||
showShippingDuplicateDialog,
|
||||
shippingDuplicateAttachment,
|
||||
canForceCreateShippingDuplicate,
|
||||
|
||||
Reference in new issue
Block a user