修复报销票据门禁提示与 OCR 降级(08-30-b2-submit-error-ocr-fallback)
这个提交包含在:
@@ -0,0 +1,32 @@
|
||||
const INVOICE_AMOUNT_EVIDENCE_STATUS = Object.freeze({
|
||||
verified: "verified",
|
||||
manualReview: "manual_review",
|
||||
ocrFailed: "ocr_failed",
|
||||
});
|
||||
|
||||
function resolveInvoiceAmountEvidence({
|
||||
totalAmount,
|
||||
ocrAttempts,
|
||||
ocrLastRequestedAt,
|
||||
ocrCompletedAt,
|
||||
ocrLastError,
|
||||
}) {
|
||||
if (totalAmount != null) {
|
||||
return INVOICE_AMOUNT_EVIDENCE_STATUS.verified;
|
||||
}
|
||||
|
||||
const hasOcrExecutionEvidence =
|
||||
Number(ocrAttempts ?? 0) > 0 ||
|
||||
ocrLastRequestedAt != null ||
|
||||
ocrCompletedAt != null ||
|
||||
(typeof ocrLastError === "string" && ocrLastError.trim().length > 0);
|
||||
|
||||
return hasOcrExecutionEvidence
|
||||
? INVOICE_AMOUNT_EVIDENCE_STATUS.ocrFailed
|
||||
: INVOICE_AMOUNT_EVIDENCE_STATUS.manualReview;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
INVOICE_AMOUNT_EVIDENCE_STATUS,
|
||||
resolveInvoiceAmountEvidence,
|
||||
};
|
||||
在新工单中引用
屏蔽一个用户