docs(tec): 更新货代发货通知批次库存能力文档
- 添加单票与多票发货需求的处理方式 - 说明库存 Excel 上传后的保存与关联机制 - 解释库存匹配与 Excel 生成的独立执行方式 - 明确批次库存的真相来源 feat(chat): 优化发货库存上传提示语 - 根据上传结果生成更详细的提示信息 - 增加批次号的提示逻辑 - 使用国际化支持替换硬编码字符串 refactor(chat): 重构发货库存上传处理逻辑 - 移除多余的任务选择逻辑 - 简化上传处理流程 - 增强代码可读性与维护性 feat(locales): 更新多语言支持的提示信息 - 添加库存上传与任务处理的多语言提示 - 更新库存缺口与任务状态的描述
This commit is contained in:
1 parent
1bd9f278fe
commit
1cf8ff40bd
34 files changed
+4367
-3553
No files matched your search
@@ -48,9 +48,6 @@ export interface ShippingUploadHandlerContext {
|
||||
* @returns 自动上传、文件选择器和建议提示相关处理函数
|
||||
*/
|
||||
export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext) {
|
||||
const hasMultipleShippingBatchTasks = () =>
|
||||
Array.isArray(ctx.shippingBatchTasks.value) && ctx.shippingBatchTasks.value.length > 1;
|
||||
|
||||
const resetInventoryTaskSelection = () => {
|
||||
ctx.shippingInventorySelectionActive.value = false;
|
||||
ctx.shippingInventorySelectionTaskId.value = '';
|
||||
@@ -76,22 +73,14 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
const uploadInventoryForTask = async (taskId: string, file: File) => {
|
||||
ctx.resolvedShippingTaskId.value = taskId;
|
||||
const result = await uploadWorkspaceShippingInventory(taskId, file);
|
||||
const batchNo = String(
|
||||
((result as unknown as { data?: { batch_no?: string } }).data?.batch_no)
|
||||
|| ((result as unknown as { data?: { batch?: { batch_no?: string } } }).data?.batch?.batch_no)
|
||||
|| '',
|
||||
).trim();
|
||||
if (batchNo) ctx.resolvedShippingBatchNo.value = batchNo;
|
||||
await continueShippingInventoryUploadWithDify(taskId, result as unknown as Record<string, unknown>, file.name);
|
||||
};
|
||||
|
||||
const promptInventoryTaskSelection = async (pendingFile?: File) => {
|
||||
if (pendingFile) ctx.pendingShippingInventoryFile.value = pendingFile;
|
||||
ctx.shippingBatchTasksExpanded.value = true;
|
||||
ctx.pendingShippingUploadTaskId.value = '';
|
||||
ctx.shippingInventorySelectionTaskId.value = '';
|
||||
ctx.shippingInventorySelectionActive.value = true;
|
||||
await ctx.pushShippingLocalAssistantMessage(
|
||||
ctx.t(
|
||||
pendingFile
|
||||
? 'chat.shippingNoticeUi.inventoryTaskPickPendingHint'
|
||||
: 'chat.shippingNoticeUi.inventoryTaskPickHint',
|
||||
),
|
||||
);
|
||||
void ctx.refreshShippingActions();
|
||||
};
|
||||
|
||||
const selectShippingInventoryUploadTask = (taskId: string): boolean => {
|
||||
@@ -148,16 +137,13 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
const handleShippingAutoUploadFile = async (file: File) => {
|
||||
const kind = classifyShippingUploadFile(file, extractExt);
|
||||
if (kind === 'inventory') {
|
||||
if (hasMultipleShippingBatchTasks()) {
|
||||
await promptInventoryTaskSelection(file);
|
||||
return;
|
||||
}
|
||||
let taskId = ctx.getActiveShippingTaskId();
|
||||
if (!taskId) {
|
||||
const created = await createWorkspaceShippingTask({
|
||||
source_type: 'manual',
|
||||
conversation_id: String(ctx.conversationId.value || '').trim() || undefined,
|
||||
});
|
||||
syncBatchContextFromNoticeResponse(created as unknown as Record<string, unknown>);
|
||||
taskId = String(created.task_id || '').trim();
|
||||
if (!taskId) {
|
||||
ctx.msg.warning('自动创建发货任务失败');
|
||||
@@ -250,10 +236,6 @@ export function createShippingUploadHandlers(ctx: ShippingUploadHandlerContext)
|
||||
};
|
||||
|
||||
const openShippingInventoryPicker = (): boolean => {
|
||||
if (hasMultipleShippingBatchTasks()) {
|
||||
void promptInventoryTaskSelection();
|
||||
return true;
|
||||
}
|
||||
const taskId = ctx.getActiveShippingTaskId();
|
||||
if (!taskId) {
|
||||
ctx.msg.warning(ctx.t('chat.shippingNoticeMissingTaskId'));
|
||||
|
||||
Reference in new issue
Block a user