제작수량 오류 등 수정
This commit is contained in:
@@ -1128,7 +1128,7 @@ public class ProductionPlanningService {
|
||||
mbomPrefix = "M-" + cleanPartNo + "-" + dateStr;
|
||||
} else if("MBOM".equals(sourceBomType)) {
|
||||
// M-BOM 기준: 기존 M-BOM 품번에서 날짜/순번 부분 제거 후 새 날짜 추가
|
||||
// 예: M-000AN014000-251124-01 → M-000AN014000 → M-000AN014000-251124
|
||||
// 예: M-000AN014000-251124-01 → M-000AN014000 → M-000AN014000-251126-01
|
||||
|
||||
String basePart = baseBomPartNo;
|
||||
|
||||
@@ -1138,9 +1138,10 @@ public class ProductionPlanningService {
|
||||
basePart = "M-" + basePart.substring(4);
|
||||
}
|
||||
|
||||
// 마지막 두 개의 "-XX" 부분 제거 (날짜-순번)
|
||||
// 여러 번 중복된 경우를 대비해 반복 제거
|
||||
for(int i = 0; i < 2; i++) {
|
||||
// 마지막의 모든 날짜-순번 패턴 제거 (중복 복사 대응)
|
||||
// 예: M-000AN014000-251124-01-251125-01 → M-000AN014000
|
||||
// 날짜(6자리) 또는 순번(2자리)가 나오지 않을 때까지 반복
|
||||
while(true) {
|
||||
int lastDashIndex = basePart.lastIndexOf("-");
|
||||
if(lastDashIndex > 0) {
|
||||
String suffix = basePart.substring(lastDashIndex + 1);
|
||||
@@ -1150,6 +1151,8 @@ public class ProductionPlanningService {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1536,4 +1539,85 @@ public class ProductionPlanningService {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* MBOM_HEADER 테이블에 해당 OBJID가 존재하는지 확인
|
||||
* @param objId
|
||||
* @return
|
||||
*/
|
||||
public boolean isMbomHeader(String objId) {
|
||||
SqlSession sqlSession = null;
|
||||
boolean result = false;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("objid", objId);
|
||||
|
||||
System.out.println("========== isMbomHeader 체크 시작 ==========");
|
||||
System.out.println("objId: [" + objId + "]");
|
||||
System.out.println("objId length: " + (objId != null ? objId.length() : "null"));
|
||||
|
||||
Integer count = sqlSession.selectOne("productionplanning.checkMbomHeaderExists", paramMap);
|
||||
result = (count != null && count > 0);
|
||||
|
||||
System.out.println("count: " + count);
|
||||
System.out.println("isMbomHeader result: " + result);
|
||||
System.out.println("========== isMbomHeader 체크 종료 ==========");
|
||||
} catch(Exception e) {
|
||||
System.out.println("isMbomHeader 에러 발생:");
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 트리 조회 (MBOM_DETAIL 테이블)
|
||||
* @param mbomHeaderObjid
|
||||
* @return
|
||||
*/
|
||||
public List<Map> getSavedMbomTreeList(String mbomHeaderObjid) {
|
||||
SqlSession sqlSession = null;
|
||||
List<Map> resultList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("mbomHeaderObjid", mbomHeaderObjid);
|
||||
|
||||
resultList = sqlSession.selectList("productionplanning.getSavedMbomTreeList", paramMap);
|
||||
|
||||
// 대문자 변환 (JSP에서 사용하기 위해)
|
||||
resultList = CommonUtils.keyChangeUpperList(resultList);
|
||||
|
||||
// MAX_LEVEL 계산
|
||||
int maxLevel = 0;
|
||||
for(Map item : resultList) {
|
||||
Integer level = (Integer) item.get("LEVEL");
|
||||
if(level != null && level > maxLevel) {
|
||||
maxLevel = level;
|
||||
}
|
||||
}
|
||||
|
||||
// 모든 항목에 MAX_LEVEL 추가
|
||||
for(Map item : resultList) {
|
||||
item.put("MAX_LEVEL", maxLevel);
|
||||
}
|
||||
|
||||
System.out.println("getSavedMbomTreeList - mbomHeaderObjid: " + mbomHeaderObjid + ", count: " + resultList.size() + ", maxLevel: " + maxLevel);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user