feat: Refactor work process and item inspection logic
- Updated SQL queries in `popProductionController` to separate work order process and result handling, ensuring batch_id is now managed in the work_order_process_result table. - Enhanced `workInstructionController` to include id generation for work items and details, preventing NULL values during insertion. - Implemented case-insensitive search functionality across various services, improving data retrieval accuracy. - Added sorting functionality in the item inspection page, allowing users to sort by different columns with visual indicators for sort direction. This refactor aims to improve data integrity and user experience across the production and inspection workflows.
This commit is contained in:
@@ -415,13 +415,6 @@ export class AdminService {
|
||||
let queryParams: any[] = [userLang];
|
||||
let paramIndex = 2;
|
||||
|
||||
// [임시 비활성화] 메뉴 권한 그룹 체크 - 모든 사용자에게 전체 메뉴 표시
|
||||
// TODO: 권한 체크 다시 활성화 필요
|
||||
logger.debug(`getUserMenuList 권한 그룹 체크 스킵 - ${userId}(${userType})`);
|
||||
authFilter = "";
|
||||
unionFilter = "";
|
||||
|
||||
/* [원본 코드 - getUserMenuList 권한 그룹 체크]
|
||||
if (userType === "SUPER_ADMIN") {
|
||||
// SUPER_ADMIN: 권한 그룹 체크 없이 해당 회사의 모든 메뉴 표시
|
||||
logger.info(`✅ 좌측 사이드바 (SUPER_ADMIN): 회사 ${userCompanyCode}의 모든 메뉴 표시`);
|
||||
@@ -481,7 +474,6 @@ export class AdminService {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// 2. 회사별 필터링 조건 생성
|
||||
let companyFilter = "";
|
||||
|
||||
@@ -1421,9 +1421,9 @@ export class TableManagementService {
|
||||
const paramBase = paramIndex + idx * 4;
|
||||
conditions.push(`(
|
||||
${columnName}::text = $${paramBase} OR
|
||||
${columnName}::text LIKE $${paramBase + 1} OR
|
||||
${columnName}::text LIKE $${paramBase + 2} OR
|
||||
${columnName}::text LIKE $${paramBase + 3}
|
||||
${columnName}::text ILIKE $${paramBase + 1} OR
|
||||
${columnName}::text ILIKE $${paramBase + 2} OR
|
||||
${columnName}::text ILIKE $${paramBase + 3}
|
||||
)`);
|
||||
values.push(
|
||||
safeValue,
|
||||
@@ -3466,17 +3466,17 @@ export class TableManagementService {
|
||||
}
|
||||
case "contains":
|
||||
filterConditions.push(
|
||||
`${safeColumn} LIKE '%${String(value).replace(/'/g, "''")}%'`
|
||||
`${safeColumn} ILIKE '%${String(value).replace(/'/g, "''")}%'`
|
||||
);
|
||||
break;
|
||||
case "starts_with":
|
||||
filterConditions.push(
|
||||
`${safeColumn} LIKE '${String(value).replace(/'/g, "''")}%'`
|
||||
`${safeColumn} ILIKE '${String(value).replace(/'/g, "''")}%'`
|
||||
);
|
||||
break;
|
||||
case "ends_with":
|
||||
filterConditions.push(
|
||||
`${safeColumn} LIKE '%${String(value).replace(/'/g, "''")}'`
|
||||
`${safeColumn} ILIKE '%${String(value).replace(/'/g, "''")}'`
|
||||
);
|
||||
break;
|
||||
case "is_null":
|
||||
@@ -3487,7 +3487,7 @@ export class TableManagementService {
|
||||
break;
|
||||
case "not_contains":
|
||||
filterConditions.push(
|
||||
`${safeColumn}::text NOT LIKE '%${String(value).replace(/'/g, "''")}%'`
|
||||
`${safeColumn}::text NOT ILIKE '%${String(value).replace(/'/g, "''")}%'`
|
||||
);
|
||||
break;
|
||||
case "greater_than":
|
||||
@@ -3553,16 +3553,16 @@ export class TableManagementService {
|
||||
conditions.push(`${safeCol}::text != '${String(value).replace(/'/g, "''")}'`);
|
||||
break;
|
||||
case "contains":
|
||||
conditions.push(`${safeCol}::text LIKE '%${String(value).replace(/'/g, "''")}%'`);
|
||||
conditions.push(`${safeCol}::text ILIKE '%${String(value).replace(/'/g, "''")}%'`);
|
||||
break;
|
||||
case "not_contains":
|
||||
conditions.push(`${safeCol}::text NOT LIKE '%${String(value).replace(/'/g, "''")}%'`);
|
||||
conditions.push(`${safeCol}::text NOT ILIKE '%${String(value).replace(/'/g, "''")}%'`);
|
||||
break;
|
||||
case "starts_with":
|
||||
conditions.push(`${safeCol}::text LIKE '${String(value).replace(/'/g, "''")}%'`);
|
||||
conditions.push(`${safeCol}::text ILIKE '${String(value).replace(/'/g, "''")}%'`);
|
||||
break;
|
||||
case "ends_with":
|
||||
conditions.push(`${safeCol}::text LIKE '%${String(value).replace(/'/g, "''")}'`);
|
||||
conditions.push(`${safeCol}::text ILIKE '%${String(value).replace(/'/g, "''")}'`);
|
||||
break;
|
||||
case "greater_than":
|
||||
conditions.push(`(${safeCol})::numeric > ${parseFloat(String(value))}`);
|
||||
|
||||
@@ -39,13 +39,13 @@ export async function getWorkHistories(filters?: WorkHistoryFilters): Promise<Wo
|
||||
}
|
||||
|
||||
if (filters?.vehicle_number) {
|
||||
query += ` AND vehicle_number LIKE $${paramIndex}`;
|
||||
query += ` AND vehicle_number ILIKE $${paramIndex}`;
|
||||
params.push(`%${filters.vehicle_number}%`);
|
||||
paramIndex++;
|
||||
}
|
||||
|
||||
if (filters?.driver_name) {
|
||||
query += ` AND driver_name LIKE $${paramIndex}`;
|
||||
query += ` AND driver_name ILIKE $${paramIndex}`;
|
||||
params.push(`%${filters.driver_name}%`);
|
||||
paramIndex++;
|
||||
}
|
||||
@@ -64,10 +64,10 @@ export async function getWorkHistories(filters?: WorkHistoryFilters): Promise<Wo
|
||||
|
||||
if (filters?.search) {
|
||||
query += ` AND (
|
||||
work_number LIKE $${paramIndex} OR
|
||||
vehicle_number LIKE $${paramIndex} OR
|
||||
driver_name LIKE $${paramIndex} OR
|
||||
cargo_name LIKE $${paramIndex}
|
||||
work_number ILIKE $${paramIndex} OR
|
||||
vehicle_number ILIKE $${paramIndex} OR
|
||||
driver_name ILIKE $${paramIndex} OR
|
||||
cargo_name ILIKE $${paramIndex}
|
||||
)`;
|
||||
params.push(`%${filters.search}%`);
|
||||
paramIndex++;
|
||||
|
||||
Reference in New Issue
Block a user