fix: 修复直发单生成租赁单时维修赔偿数据没有更新 (#1459)

Reviewed-on: daoyoucloud/tachybase#1459
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-08-14 12:57:16 +08:00 committed by sealday
parent 27cda38a90
commit f020a2a4d3

View File

@ -45,16 +45,14 @@ export class RecordService {
records.map((item) => item.id), records.map((item) => item.id),
transaction, transaction,
); );
// 删除新建时创建的订单 await this.db.getRepository('records').destroy({
await this.db.sequelize.query( filter: {
` direct_record_id: {
delete from records $eq: model.id,
where records.direct_record_id = ${model.id} },
`,
{
transaction,
}, },
); transaction,
});
const numbers = deleteDatas.map((item) => item.number); const numbers = deleteDatas.map((item) => item.number);
await this._createRecord(model, values, transaction, context, numbers); await this._createRecord(model, values, transaction, context, numbers);
} }
@ -392,6 +390,9 @@ export class RecordService {
purchaseData['number'] = numbers[0]; purchaseData['number'] = numbers[0];
} }
purchaseData.items.forEach((element) => { purchaseData.items.forEach((element) => {
element.fee_items?.forEach((feeItem) => {
delete feeItem.id;
});
delete element.record_id; delete element.record_id;
delete element.id; delete element.id;
}); });
@ -411,6 +412,9 @@ export class RecordService {
leaseData['number'] = numbers[1]; leaseData['number'] = numbers[1];
} }
leaseData.items.forEach((element) => { leaseData.items.forEach((element) => {
element.fee_items?.forEach((feeItem) => {
delete feeItem.id;
});
delete element.record_id; delete element.record_id;
delete element.id; delete element.id;
}); });
@ -448,6 +452,9 @@ export class RecordService {
leaseInData['number'] = numbers[0]; leaseInData['number'] = numbers[0];
} }
leaseInData.items.forEach((element) => { leaseInData.items.forEach((element) => {
element.fee_items?.forEach((feeItem) => {
delete feeItem.id;
});
delete element.record_id; delete element.record_id;
delete element.id; delete element.id;
}); });
@ -467,6 +474,9 @@ export class RecordService {
leaseOutData['number'] = numbers[1]; leaseOutData['number'] = numbers[1];
} }
leaseOutData.items.forEach((element) => { leaseOutData.items.forEach((element) => {
element.fee_items?.forEach((feeItem) => {
delete feeItem.id;
});
delete element.record_id; delete element.record_id;
delete element.id; delete element.id;
}); });