Merge branch 'hugo-auto-transfer' into dev
This commit is contained in:
commit
00c52fdaae
44 files changed
+1487
-524
No files matched your search
@@ -1399,6 +1399,19 @@ export async function batchConfirmWorkspaceShippingNoticesUploaded(businessNos:
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动刷新 Crane 分配状态。后端只排队一次状态回查,不重新上传 Excel。
|
||||
* @param businessNo - 对外发货通知单号,同时是 Crane 的 Pull Request #
|
||||
* @returns 已排队的回查结果
|
||||
*/
|
||||
export async function refreshWorkspaceCraneUploadStatus(businessNo: string) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-notices/${encodeURIComponent(businessNo)}/refresh-crane-upload`,
|
||||
jsonPost({}),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/** 按多个发货通知单号批量受理货代 RPA 上传;RPA 成功仍以回调为准。 */
|
||||
export async function batchStartWorkspaceShippingNoticeRpaUpload(businessNos: string[]) {
|
||||
return requestJson<{ results: Array<Record<string, unknown>> }>(
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
getWorkspaceShippingFreightNoticeGroups,
|
||||
batchConfirmWorkspaceShippingNoticesUploaded,
|
||||
batchStartWorkspaceShippingNoticeRpaUpload,
|
||||
refreshWorkspaceCraneUploadStatus,
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
retryShippingNoticeIntake,
|
||||
decideWorkspaceShippingOrderReviewLineFulfillment,
|
||||
@@ -2542,7 +2543,7 @@ const freightNoticeGroupsLoadFailed = ref(false);
|
||||
/** 货代上传分组请求在途守卫:独立于 loading,避免轮询 tick 与动作后刷新并发重载。 */
|
||||
const freightGroupsInFlight = ref(false);
|
||||
const selectedFreightBusinessNos = ref<string[]>([]);
|
||||
const freightBatchBusy = ref<'download' | 'confirm' | 'rpa' | 'regenerate' | null>(null);
|
||||
const freightBatchBusy = ref<'download' | 'confirm' | 'rpa' | 'regenerate' | 'refresh' | null>(null);
|
||||
/**
|
||||
* 判断货代通知聚合行是否已具备上传成功事实。
|
||||
* 核心逻辑:聚合接口 upload_status 已经过后端 project_notice_upload_status 归一,
|
||||
@@ -3459,7 +3460,7 @@ watch(
|
||||
function hasFreightGroupsInFlightRpa(groups: ShippingFreightNoticeGroup[]): boolean {
|
||||
return (groups || []).some((group) => {
|
||||
const st = String(group.upload_status || '').trim().toLowerCase();
|
||||
return st === 'uploading';
|
||||
return st === 'uploading' || st === 'allocating';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3524,14 +3525,35 @@ function toggleFreightNoticeSelection(businessNo: string, checked: boolean) {
|
||||
: selectedFreightBusinessNos.value.filter((item) => item !== businessNo);
|
||||
}
|
||||
|
||||
/** 已选通知单中任一已上传时,批量写入动作必须 fail-closed,避免重复提交成功通知。 */
|
||||
/** 已选通知单中任一已上传或仍在 Crane 分配中时,批量写入动作必须停住,避免重复上传。 */
|
||||
const selectedFreightNoticesContainUploaded = computed(() => {
|
||||
const selected = new Set(selectedFreightBusinessNos.value);
|
||||
return freightNoticeGroups.value.some((group) => (
|
||||
selected.has(group.business_no) && isFreightNoticeUploaded(group)
|
||||
selected.has(group.business_no)
|
||||
&& (isFreightNoticeUploaded(group) || String(group.upload_status || '').trim().toLowerCase() === 'allocating')
|
||||
));
|
||||
});
|
||||
|
||||
/**
|
||||
* 手动刷新一张仍在分配中的 Crane 发货单。
|
||||
* @param businessNo - 发货通知单号,即 Pull Request #
|
||||
*/
|
||||
async function refreshCraneUploadStatus(businessNo: string) {
|
||||
if (freightBatchBusy.value) return;
|
||||
freightBatchBusy.value = 'refresh';
|
||||
try {
|
||||
await refreshWorkspaceCraneUploadStatus(businessNo);
|
||||
const taskNo = String(confirmedNoticeTaskNo.value || '').trim();
|
||||
if (taskNo) await loadFreightNoticeGroups(taskNo);
|
||||
freightNoticeGroupsFinalized = false;
|
||||
startWorkflowProgressPolling();
|
||||
} catch (error) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
} finally {
|
||||
freightBatchBusy.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadFreightNotice(businessNo: string) {
|
||||
try {
|
||||
await downloadWorkspaceShippingNoticeExcelFile(businessNo);
|
||||
@@ -3824,13 +3846,21 @@ function freightLineNoDisplay(line: { line_no?: string | number | null }): {
|
||||
* @param group - 当前发货通知单聚合行(含 upload_status 与逐单错误字段)。
|
||||
*/
|
||||
function freightUploadStatusDisplay(group: ShippingFreightNoticeGroup): {
|
||||
state: 'uploaded' | 'uploading' | 'failed' | 'needs_human' | 'pending';
|
||||
state: 'uploaded' | 'uploading' | 'allocating' | 'failed' | 'needs_human' | 'pending';
|
||||
label: string;
|
||||
chipClass: string;
|
||||
reason: string | null;
|
||||
} {
|
||||
const status = String(group.upload_status || '').trim().toLowerCase();
|
||||
const reason = group.upload_error_message || group.upload_error_code || null;
|
||||
if (status === 'allocating') {
|
||||
return {
|
||||
state: 'allocating',
|
||||
label: t('chat.shippingOrderReview.lifecycle.freightUpload.uploadStatus.allocating'),
|
||||
chipClass: 'bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-200',
|
||||
reason: null,
|
||||
};
|
||||
}
|
||||
if (status === 'uploaded') {
|
||||
return {
|
||||
state: 'uploaded',
|
||||
@@ -5496,7 +5526,15 @@ watch(
|
||||
<span :class="freightUploadStatusDisplay(group).chipClass" :title="freightUploadStatusDisplay(group).reason || undefined" class="rounded-full px-2 py-0.5 font-medium cursor-help" tabindex="0">{{ freightUploadStatusDisplay(group).label }}</span>
|
||||
<button type="button" class="rounded border border-brand-200 px-2 py-1 font-medium text-brand-700 hover:bg-brand-50" data-testid="review-freight-upload-download" :disabled="saving" @click="void downloadFreightNotice(group.business_no)">{{ t('chat.shippingOrderReview.lifecycle.freightUpload.download') }}</button>
|
||||
<button
|
||||
v-if="canRunFreightNoticeAction(group, 'retry_freight_upload_rpa')"
|
||||
v-if="freightUploadStatusDisplay(group).state === 'allocating'"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface-muted disabled:opacity-50"
|
||||
data-testid="review-freight-upload-refresh"
|
||||
:disabled="freightBatchBusy !== null"
|
||||
@click="void refreshCraneUploadStatus(group.business_no)"
|
||||
>{{ t('chat.shippingOrderReview.lifecycle.freightUpload.refreshStatus') }}</button>
|
||||
<button
|
||||
v-if="canRunFreightNoticeAction(group, 'retry_freight_upload_rpa') && freightUploadStatusDisplay(group).state !== 'allocating'"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface-muted disabled:opacity-50"
|
||||
data-testid="review-freight-upload-rpa"
|
||||
@@ -5504,7 +5542,7 @@ watch(
|
||||
@click="void runFreightNoticeAction(group, 'rpa')"
|
||||
>{{ t('chat.shippingOrderReview.lifecycle.freightUpload.rpa') }}</button>
|
||||
<button
|
||||
v-if="canRunFreightNoticeAction(group, 'mark_manual_uploaded')"
|
||||
v-if="canRunFreightNoticeAction(group, 'mark_manual_uploaded') && freightUploadStatusDisplay(group).state !== 'allocating'"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 font-medium text-primary hover:bg-surface-muted disabled:opacity-50"
|
||||
data-testid="review-freight-upload-confirm"
|
||||
|
||||
Reference in new issue
Block a user