feat: Enhance mold serial summary retrieval and improve category handling

- Updated the `getMoldSerialSummary` function to dynamically retrieve category values for mold statuses and operations, allowing for more flexible data aggregation.
- Implemented a mapping mechanism to categorize status codes based on their labels, improving the clarity of the summary results.
- Adjusted SQL queries to utilize the new category mappings for more accurate counts of mold statuses.
- Refactored the packaging and loading unit deletion logic to handle company code checks more efficiently, ensuring proper data access control.
This commit is contained in:
kjs
2026-04-16 18:23:20 +09:00
parent c503e2c59c
commit b158b0aa77
49 changed files with 824 additions and 777 deletions

View File

@@ -228,10 +228,11 @@ export async function deletePkgUnitItem(
const { id } = req.params;
const pool = getPool();
const result = await pool.query(
`DELETE FROM pkg_unit_item WHERE id=$1 AND company_code=$2 RETURNING id`,
[id, companyCode]
);
const query = companyCode === "*"
? `DELETE FROM pkg_unit_item WHERE id=$1 RETURNING id`
: `DELETE FROM pkg_unit_item WHERE id=$1 AND company_code=$2 RETURNING id`;
const params = companyCode === "*" ? [id] : [id, companyCode];
const result = await pool.query(query, params);
if (result.rowCount === 0) {
res.status(404).json({ success: false, message: "데이터를 찾을 수 없습니다." });
@@ -471,10 +472,11 @@ export async function deleteLoadingUnitPkg(
const { id } = req.params;
const pool = getPool();
const result = await pool.query(
`DELETE FROM loading_unit_pkg WHERE id=$1 AND company_code=$2 RETURNING id`,
[id, companyCode]
);
const query = companyCode === "*"
? `DELETE FROM loading_unit_pkg WHERE id=$1 RETURNING id`
: `DELETE FROM loading_unit_pkg WHERE id=$1 AND company_code=$2 RETURNING id`;
const params = companyCode === "*" ? [id] : [id, companyCode];
const result = await pool.query(query, params);
if (result.rowCount === 0) {
res.status(404).json({ success: false, message: "데이터를 찾을 수 없습니다." });