제품구분이 Machine 이외인 경우 동일 품번이 수주되었을 경우 저장되어 있는 M-BOM을 자동으로 가져오기!
This commit is contained in:
@@ -967,6 +967,38 @@ public class ProductionPlanningController extends BaseService {
|
||||
|
||||
if(projectInfo != null && !projectInfo.isEmpty()) {
|
||||
request.setAttribute("info", projectInfo);
|
||||
|
||||
// Machine 이외 제품: 품번 기준 M-BOM 템플릿 조회
|
||||
String productCode = CommonUtils.checkNull(projectInfo.get("PRODUCT_CODE"));
|
||||
String partNo = CommonUtils.checkNull(projectInfo.get("PART_NO"));
|
||||
|
||||
System.out.println("제품구분 코드: " + productCode);
|
||||
System.out.println("품번: " + partNo);
|
||||
|
||||
// Machine(0000928) 이외 제품이고 품번이 있는 경우
|
||||
if(!"0000928".equals(productCode) && !"".equals(partNo)) {
|
||||
Map<String, Object> templateParam = new HashMap<>();
|
||||
templateParam.put("partNo", partNo);
|
||||
|
||||
// 품번 기준 최신 M-BOM 템플릿 조회
|
||||
Map<String, Object> template = commonService.selectOne("productionplanning.getLatestMbomTemplateByPartNo", request, templateParam);
|
||||
|
||||
if(template != null && !template.isEmpty()) {
|
||||
System.out.println("M-BOM 템플릿 발견: " + template.get("TEMPLATE_MBOM_NO"));
|
||||
|
||||
// 템플릿 상세 항목 조회
|
||||
Map<String, Object> detailParam = new HashMap<>();
|
||||
detailParam.put("mbomHeaderObjid", template.get("TEMPLATE_HEADER_OBJID"));
|
||||
List<Map<String, Object>> templateDetails = commonService.selectList("productionplanning.getMbomTemplateDetails", request, detailParam);
|
||||
|
||||
System.out.println("템플릿 상세 항목 수: " + (templateDetails != null ? templateDetails.size() : 0));
|
||||
|
||||
request.setAttribute("mbomTemplate", template);
|
||||
request.setAttribute("mbomTemplateDetails", templateDetails);
|
||||
} else {
|
||||
System.out.println("해당 품번의 M-BOM 템플릿 없음");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("projectInfo is null or empty!");
|
||||
}
|
||||
@@ -1115,8 +1147,29 @@ public class ProductionPlanningController extends BaseService {
|
||||
bomReportObjid = sourceMbomObjId;
|
||||
System.out.println("할당된 M-BOM 사용: " + bomReportObjid);
|
||||
} else {
|
||||
bomReportObjid = CommonUtils.checkNull(projectInfo.get("BOM_REPORT_OBJID"));
|
||||
System.out.println("기존 BOM_REPORT_OBJID 사용: " + bomReportObjid);
|
||||
// 할당된 BOM도 없으면 Machine 이외 제품은 템플릿 확인
|
||||
String productCode = CommonUtils.checkNull(projectInfo.get("PRODUCT_CODE"));
|
||||
String partNo = CommonUtils.checkNull(projectInfo.get("PART_NO"));
|
||||
|
||||
if(!"0000928".equals(productCode) && !"".equals(partNo)) {
|
||||
System.out.println("Machine 이외 제품 - 템플릿 조회 시도");
|
||||
Map<String, Object> templateParam = new HashMap<>();
|
||||
templateParam.put("partNo", partNo);
|
||||
|
||||
Map<String, Object> template = commonService.selectOne("productionplanning.getLatestMbomTemplateByPartNo", request, templateParam);
|
||||
|
||||
if(template != null && !template.isEmpty()) {
|
||||
bomReportObjid = CommonUtils.checkNull(template.get("TEMPLATE_HEADER_OBJID"));
|
||||
isSavedMbom = true; // 템플릿도 MBOM_DETAIL에서 조회
|
||||
System.out.println("템플릿 M-BOM 사용: " + bomReportObjid);
|
||||
} else {
|
||||
bomReportObjid = CommonUtils.checkNull(projectInfo.get("BOM_REPORT_OBJID"));
|
||||
System.out.println("기존 BOM_REPORT_OBJID 사용: " + bomReportObjid);
|
||||
}
|
||||
} else {
|
||||
bomReportObjid = CommonUtils.checkNull(projectInfo.get("BOM_REPORT_OBJID"));
|
||||
System.out.println("기존 BOM_REPORT_OBJID 사용: " + bomReportObjid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1470,13 +1523,15 @@ public class ProductionPlanningController extends BaseService {
|
||||
|
||||
if(assignment == null || assignment.isEmpty()) {
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "M-BOM 기준 정보가 없습니다. BOM 복사 팝업에서 먼저 기준을 설정해주세요.");
|
||||
resultMap.put("message", "프로젝트 정보를 찾을 수 없습니다.");
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
String sourceBomType = CommonUtils.checkNull(assignment.get("SOURCE_BOM_TYPE"));
|
||||
String sourceBomObjId = "";
|
||||
String baseBomPartNo = "";
|
||||
String productCode = CommonUtils.checkNull(assignment.get("PRODUCT_CODE"));
|
||||
String partNo = CommonUtils.checkNull(assignment.get("PART_NO"));
|
||||
|
||||
if("EBOM".equals(sourceBomType)) {
|
||||
sourceBomObjId = CommonUtils.checkNull(assignment.get("SOURCE_EBOM_OBJID"));
|
||||
@@ -1484,12 +1539,18 @@ public class ProductionPlanningController extends BaseService {
|
||||
} else if("MBOM".equals(sourceBomType)) {
|
||||
sourceBomObjId = CommonUtils.checkNull(assignment.get("SOURCE_MBOM_OBJID"));
|
||||
baseBomPartNo = CommonUtils.checkNull(assignment.get("MBOM_NO"));
|
||||
}
|
||||
|
||||
if(sourceBomObjId.isEmpty()) {
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "기준 BOM 정보가 올바르지 않습니다.");
|
||||
return resultMap;
|
||||
} else {
|
||||
// 할당 정보가 없는 경우 - Machine 이외 제품은 템플릿 기반 저장 허용
|
||||
if(!"0000928".equals(productCode) && !"".equals(partNo)) {
|
||||
System.out.println("Machine 이외 제품 - 템플릿 기반 저장 허용");
|
||||
sourceBomType = "TEMPLATE"; // 템플릿 기반 저장 표시
|
||||
baseBomPartNo = partNo;
|
||||
} else {
|
||||
// Machine 제품이거나 품번이 없으면 할당 필요
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "M-BOM 기준 정보가 없습니다. BOM 복사 팝업에서 먼저 기준을 설정해주세요.");
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
// M-BOM 품번 생성 또는 사용
|
||||
|
||||
Reference in New Issue
Block a user