备份:PWA配置前的完整版本
包含所有最新开发的功能和修复,作为PWA正确配置前的备份点。
This commit is contained in:
@@ -81,6 +81,32 @@ router.get('/summary', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/in', async (req, res) => {
|
||||
try {
|
||||
const { project_id, product_id, quantity, unit_price, total_amount, operator, remark } = req.body;
|
||||
|
||||
const result = await db.query(`
|
||||
INSERT INTO inventory_records
|
||||
(record_type, project_id, product_id, quantity, unit_price, total_amount, record_date, operator, remark)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, CURRENT_DATE, $7, $8)
|
||||
RETURNING id
|
||||
`, ['in', project_id || null, product_id, quantity, unit_price || null, total_amount || null, operator || '系统', remark || null]);
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
message: '入库成功',
|
||||
data: { id: result.rows[0]?.id }
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('入库失败:', error);
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
message: '入库失败',
|
||||
error: process.env.NODE_ENV === 'development' ? error.message : '操作失败'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/out', async (req, res) => {
|
||||
try {
|
||||
const { project_id, product_id, quantity, unit_price, total_amount, operator, remark } = req.body;
|
||||
|
||||
Reference in New Issue
Block a user