fix: 修复项目库存计算无法完结 (#1582)

Reviewed-on: daoyoucloud/tachybase#1582
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-10-09 15:21:42 +08:00 committed by bai.zixv
parent 128c26aa10
commit d61da53c93

View File

@ -25,7 +25,8 @@ export class ProjectService {
const SQL = this.sqlLoader.sqlFiles['project_products_inventory']; const SQL = this.sqlLoader.sqlFiles['project_products_inventory'];
const query = SQL.replace('${project_id}', model.id); const query = SQL.replace('${project_id}', model.id);
const inventory: any = await this.db.sequelize.query(query); const inventory: any = await this.db.sequelize.query(query);
if (inventory[0][0] && inventory[0][0].count) throw new Error('项目产品尚未结清'); //NOTE 0.001:根据换算比例精度是3位数
if (inventory[0][0] && inventory[0][0].count >= 0.001) throw new Error('项目产品尚未结清');
} }
} }
} }