feat(WEB): 작업지시 생성 개별품목 매칭 로직 추가
matchItemToProcess 함수에 개별품목(process_items) 매칭 지원: - 정확한 이름/코드 매칭 - 부분 매칭 지원 (예: "상부 케이스" ↔ "상부 케이스 1219mm") - 3개 공정(스크린/절곡/슬랫)에 14개 품목 정상 분류
This commit is contained in:
@@ -216,6 +216,22 @@ function matchItemToProcess(
|
||||
for (const rule of process.classificationRules) {
|
||||
if (!rule.isActive) continue;
|
||||
|
||||
// 개별품목 규칙 (process_items에서 변환된 규칙)
|
||||
if (rule.registrationType === "individual" && rule.items) {
|
||||
const matched = rule.items.some((item) => {
|
||||
// 1. 정확한 이름 매칭
|
||||
if (item.name === itemName) return true;
|
||||
// 2. 정확한 코드 매칭
|
||||
if (itemCode && item.code === itemCode) return true;
|
||||
// 3. 부분 매칭: 등록된 품목명이 주문 품목명을 포함 (예: "상부 케이스 1219mm" contains "상부 케이스")
|
||||
if (item.name.includes(itemName)) return true;
|
||||
// 4. 역 부분 매칭: 주문 품목명이 등록된 품목명을 포함
|
||||
if (itemName.includes(item.name)) return true;
|
||||
return false;
|
||||
});
|
||||
if (matched) return process;
|
||||
}
|
||||
|
||||
// 패턴 매칭 규칙
|
||||
if (rule.registrationType === "pattern") {
|
||||
let targetValue = "";
|
||||
|
||||
Reference in New Issue
Block a user