auto commit
This commit is contained in:
@@ -9,10 +9,12 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.pms.common.service.BaseService;
|
||||
import com.pms.common.utils.CommonUtils;
|
||||
import com.pms.common.utils.Constants;
|
||||
@@ -934,13 +936,140 @@ public class ProductionPlanningController extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 팝업
|
||||
* M-BOM 조회 팝업 (읽기 전용)
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomViewPopup.do")
|
||||
public String mBomViewPopup(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
return "/productionplanning/mBomViewPopup";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 복사 팝업 메인 (frameset)
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomFormPopup.do")
|
||||
public String mBomFormPopup(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
||||
System.out.println("========== mBomFormPopup ==========");
|
||||
System.out.println("objId: " + objId);
|
||||
|
||||
// PROJECT_MGMT 정보 조회
|
||||
if(!"".equals(objId)) {
|
||||
paramMap.put("objId", objId);
|
||||
Map<String, Object> projectInfo = commonService.selectOne("productionplanning.getProjectMgmtDetail", request, paramMap);
|
||||
System.out.println("projectInfo: " + projectInfo);
|
||||
|
||||
if(projectInfo != null && !projectInfo.isEmpty()) {
|
||||
request.setAttribute("info", projectInfo);
|
||||
} else {
|
||||
System.out.println("projectInfo is null or empty!");
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/productionplanning/mBomPopupHeaderFs";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 상단 헤더
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomHeaderPopup.do")
|
||||
public String mBomHeaderPopup(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
try {
|
||||
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
||||
if(!"".equals(objId)) {
|
||||
paramMap.put("objId", objId);
|
||||
Map<String, Object> projectInfo = commonService.selectOne("productionplanning.getProjectMgmtDetail", request, paramMap);
|
||||
request.setAttribute("info", projectInfo);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/productionplanning/mBomHeaderPopup";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 중앙 버튼 영역
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomCenterBtnPopup.do")
|
||||
public String mBomCenterBtnPopup(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
return "/productionplanning/mBomCenterBtnPopup";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 중앙 버튼 영역
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomPopupCenter.do")
|
||||
public String mBomPopupCenter(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
return "/productionplanning/mBomPopupCenter";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 오른쪽 E-BOM 목록
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomPopupRight.do")
|
||||
public String mBomPopupRight(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
return "/productionplanning/mBomPopupRight";
|
||||
}
|
||||
|
||||
/**
|
||||
* E-BOM 목록 조회 (AJAX)
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/getEbomList.do")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getEbomList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
List<Map<String, Object>> list = commonService.selectList("productionplanning.getEbomList", request, paramMap);
|
||||
result.put("list", list);
|
||||
result.put("result", true);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
result.put("result", false);
|
||||
result.put("list", new ArrayList<>());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 하단 frameset
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomBottomPopupFS.do")
|
||||
public String mBomBottomPopupFS(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
return "/productionplanning/mBomPopupFs";
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 조회 팝업 왼쪽 트리
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/productionplanning/mBomPopupLeft.do")
|
||||
public String mBomPopupLeft(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
||||
|
||||
@@ -948,10 +1077,27 @@ public class ProductionPlanningController extends BaseService {
|
||||
if(!"".equals(objId)) {
|
||||
paramMap.put("objId", objId);
|
||||
Map<String, Object> projectInfo = commonService.selectOne("productionplanning.getProjectMgmtDetail", request, paramMap);
|
||||
request.setAttribute("info", projectInfo);
|
||||
|
||||
// 할당된 E-BOM 정보 조회
|
||||
if(projectInfo != null) {
|
||||
// 1. 먼저 저장된 M-BOM 데이터가 있는지 확인
|
||||
List<Map<String, Object>> mbomDetailList = commonService.selectList("productionplanning.getMbomDetailByProject", request, paramMap);
|
||||
|
||||
if(mbomDetailList != null && !mbomDetailList.isEmpty()) {
|
||||
// 저장된 M-BOM 데이터가 있으면 이를 표시
|
||||
int maxLevel = 1;
|
||||
for(Map<String, Object> item : mbomDetailList) {
|
||||
Integer level = (Integer) item.get("LEVEL");
|
||||
if(level != null && level > maxLevel) {
|
||||
maxLevel = level;
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("MAXLEV", maxLevel);
|
||||
request.setAttribute("bomTreeListJson", gson.toJson(mbomDetailList));
|
||||
return "/productionplanning/mBomPopupLeft";
|
||||
}
|
||||
|
||||
// 저장된 M-BOM이 없으면 할당된 E-BOM 정보 조회
|
||||
String bomReportObjid = CommonUtils.checkNull(projectInfo.get("BOM_REPORT_OBJID"));
|
||||
if(!"".equals(bomReportObjid)) {
|
||||
Map<String, Object> ebomParam = new HashMap<>();
|
||||
@@ -964,14 +1110,31 @@ public class ProductionPlanningController extends BaseService {
|
||||
|
||||
// BOM 트리 데이터 조회 (레벨 정보 포함)
|
||||
List<Map<String, Object>> bomTreeList = commonService.selectList("partMng.getBOMTreeList", request, ebomParam);
|
||||
request.setAttribute("bomTreeList", bomTreeList);
|
||||
|
||||
if(bomTreeList != null && !bomTreeList.isEmpty()) {
|
||||
// MAX LEVEL 계산
|
||||
int maxLevel = 1;
|
||||
for(Map<String, Object> item : bomTreeList) {
|
||||
Integer level = (Integer) item.get("LEVEL");
|
||||
if(level != null && level > maxLevel) {
|
||||
maxLevel = level;
|
||||
}
|
||||
}
|
||||
request.setAttribute("MAXLEV", maxLevel);
|
||||
request.setAttribute("bomTreeListJson", gson.toJson(bomTreeList));
|
||||
return "/productionplanning/mBomPopupLeft";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "/productionplanning/mBomFormPopup";
|
||||
|
||||
// 데이터가 없을 때 빈 배열 설정
|
||||
request.setAttribute("MAXLEV", 1);
|
||||
request.setAttribute("bomTreeListJson", "[]");
|
||||
return "/productionplanning/mBomPopupLeft";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1011,4 +1174,67 @@ public class ProductionPlanningController extends BaseService {
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 목록 조회 (검색 조건 포함)
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/productionplanning/getMbomList.do")
|
||||
public Map<String, Object> getMbomList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 검색 조건에 맞는 M-BOM 목록 조회
|
||||
List<Map<String, Object>> list = commonService.selectList("productionplanning.getMbomList", request, paramMap);
|
||||
result.put("list", list);
|
||||
result.put("result", true);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
result.put("result", false);
|
||||
result.put("list", new ArrayList<>());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 저장
|
||||
* @param request
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping("/productionplanning/saveMbom.do")
|
||||
public Map<String, Object> saveMbom(HttpServletRequest request, @RequestBody Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
try {
|
||||
// M-BOM 데이터 저장 로직
|
||||
List<Map<String, Object>> mbomData = (List<Map<String, Object>>) paramMap.get("mbomData");
|
||||
String partNo = CommonUtils.checkNull(paramMap.get("partNo"));
|
||||
String partName = CommonUtils.checkNull(paramMap.get("partName"));
|
||||
|
||||
if(mbomData == null || mbomData.isEmpty()) {
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "저장할 데이터가 없습니다.");
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// M-BOM 저장 서비스 호출
|
||||
int saveResult = productionPlanningService.saveMbom(request, mbomData, partNo, partName);
|
||||
|
||||
if(saveResult > 0) {
|
||||
resultMap.put("result", "success");
|
||||
resultMap.put("message", "M-BOM이 저장되었습니다.");
|
||||
} else {
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "저장에 실패했습니다.");
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
resultMap.put("result", "fail");
|
||||
resultMap.put("message", "오류가 발생했습니다: " + e.getMessage());
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user