feat(耗材管理): 添加扫码功能及SN查询接口
实现耗材SN扫码功能,包括扫码添加、入库和出库操作 添加后端API接口根据SN查询耗材信息 优化耗材表单UI,分步骤展示不同信息区块 同步数据库模型确保耗材相关表结构正确
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user