ai-query对接新版freesun-agent接口的分支
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
2.9 KiB

/**
* 文件作用:保存单张上传发票的文件、OCR 结果及处理状态。
* 职责范围:承接识别结果、人工修正结果和判重结果。
* 不负责:作为有效报销发票台账使用。
*/
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const FinanceInvoiceUploadItem = dc.orm.define('FinanceInvoiceUploadItem', {
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
batchId: { type: DataTypes.BIGINT, allowNull: false, field: 'batch_id' },
originalFileName: { type: DataTypes.STRING(255), allowNull: false, field: 'original_file_name' },
fileUrl: { type: DataTypes.STRING(1000), allowNull: false, field: 'file_url' },
fileType: { type: DataTypes.STRING(20), allowNull: false, field: 'file_type' },
fileSize: { type: DataTypes.BIGINT, allowNull: false, field: 'file_size' },
ocrStatus: { type: DataTypes.STRING(20), allowNull: false, defaultValue: 'pending', field: 'ocr_status' },
ocrRawResult: { type: DataTypes.JSONB, field: 'ocr_raw_result' },
invoiceType: { type: DataTypes.STRING(50), field: 'invoice_type' },
invoiceCode: { type: DataTypes.STRING(50), field: 'invoice_code' },
invoiceNumber: { type: DataTypes.STRING(50), field: 'invoice_number' },
invoiceDate: { type: DataTypes.DATEONLY, field: 'invoice_date' },
buyerName: { type: DataTypes.STRING(255), field: 'buyer_name' },
sellerName: { type: DataTypes.STRING(255), field: 'seller_name' },
commodityName: { type: DataTypes.TEXT, field: 'commodity_name' },
taxExclusiveAmount: { type: DataTypes.DECIMAL(18, 2), field: 'tax_exclusive_amount' },
taxAmount: { type: DataTypes.DECIMAL(18, 2), field: 'tax_amount' },
totalAmount: { type: DataTypes.DECIMAL(18, 2), field: 'total_amount' },
status: { type: DataTypes.STRING(20), allowNull: false, defaultValue: 'pending' },
errorMessage: { type: DataTypes.STRING(500), field: 'error_message' },
matchedInvoiceId: { type: DataTypes.BIGINT, field: 'matched_invoice_id' },
reimbursementUserId: { type: DataTypes.BIGINT, field: 'reimbursement_user_id' },
reimbursementUserName: { type: DataTypes.STRING(100), field: 'reimbursement_user_name' },
reimbursementDepartmentId: { type: DataTypes.BIGINT, field: 'reimbursement_department_id' },
reimbursementDepartmentName: { type: DataTypes.STRING(100), field: 'reimbursement_department_name' },
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: dc.orm.literal('CURRENT_TIMESTAMP'), field: 'created_at' },
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: dc.orm.literal('CURRENT_TIMESTAMP'), field: 'updated_at' },
}, { tableName: 'finance_invoice_upload_item', timestamps: false, comment: '财务发票上传项' });
dc.models.FinanceInvoiceUploadItem = FinanceInvoiceUploadItem;
return FinanceInvoiceUploadItem;
};