修复 R125 发票删除后重传查重
这个提交包含在:
@@ -31,6 +31,10 @@ function isUsedInvoice(invoice) {
|
||||
);
|
||||
}
|
||||
|
||||
function isInactiveArchivedInvoice(invoice) {
|
||||
return Boolean(invoice?.status === "archived" && invoice?.archived_reason !== USED_COMPLETE_ARCHIVED_REASON);
|
||||
}
|
||||
|
||||
function classifyInvoiceConflict(conflict, ownerEmployeeId) {
|
||||
if (!conflict) {
|
||||
return null;
|
||||
@@ -40,6 +44,10 @@ function classifyInvoiceConflict(conflict, ownerEmployeeId) {
|
||||
return INVOICE_UNAVAILABLE_REASONS.usedByCompany;
|
||||
}
|
||||
|
||||
if (isInactiveArchivedInvoice(conflict)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (conflict.owner_employee_id && conflict.owner_employee_id !== ownerEmployeeId) {
|
||||
return INVOICE_UNAVAILABLE_REASONS.duplicateOtherOwner;
|
||||
}
|
||||
@@ -94,8 +102,15 @@ async function findInvoiceDedupConflicts(tx, input) {
|
||||
where: {
|
||||
...(input.excludeInvoiceId ? { id: { not: input.excludeInvoiceId } } : {}),
|
||||
is_duplicate_override: false,
|
||||
OR: filters,
|
||||
status: { in: ["pending_ocr", "ocr_failed", "available", "bound", "archived"] },
|
||||
AND: [
|
||||
{ OR: filters },
|
||||
{
|
||||
OR: [
|
||||
{ status: { in: ["pending_ocr", "ocr_failed", "available", "bound"] } },
|
||||
{ status: "archived", archived_reason: USED_COMPLETE_ARCHIVED_REASON },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
orderBy: [{ created_at: "asc" }, { id: "asc" }],
|
||||
select: {
|
||||
|
||||
在新工单中引用
屏蔽一个用户