diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts index 91d451e40..2ce10d5bd 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts @@ -27,7 +27,9 @@ export class RecordService { if (!values) { return; } - await this.createRecord(model, values, transaction, context, null); + if (values.record_category === RecordTypes.purchaseDirect || values.record_category === RecordTypes.rentDirect) { + await this.createRecord(model, values, transaction, context, null); + } } /** * 处理直发单生成单 @@ -648,7 +650,7 @@ export class RecordService { async createRecord(model, values, transaction, context, updateData) { delete values.number; delete values.id; - values.vehicles.forEach((item) => delete item.record_vehicles); + values.vehicles?.forEach((item) => delete item.record_vehicles); //采购直发单 if (values.record_category === RecordTypes.purchaseDirect && values.category === RecordCategory.purchase2lease) { const inProject = await this.db.getModel('project').findOne({