feat(耗材管理): 添加扫码功能及SN查询接口

实现耗材SN扫码功能,包括扫码添加、入库和出库操作
添加后端API接口根据SN查询耗材信息
优化耗材表单UI,分步骤展示不同信息区块
同步数据库模型确保耗材相关表结构正确
This commit is contained in:
zhang1106
2026-03-10 11:10:04 +08:00
parent 686089c21a
commit a316fa4d38
5 changed files with 865 additions and 179 deletions
+17
View File
@@ -179,6 +179,23 @@ router.post('/import', async (req, res) => {
}
});
router.get('/by-sn/:sn', async (req, res) => {
try {
const sn = req.params.sn;
const consumables = await Consumable.findAll();
const consumable = consumables.find(c => {
const snList = c.snList || [];
return snList.includes(sn);
});
res.json({
found: !!consumable,
consumable
});
} catch (error) {
res.status(500).json({ error: error.message });
}
});
router.get('/categories/list', async (req, res) => {
try {
const categories = await Consumable.findAll({