봄 복사기능 추가
This commit is contained in:
@@ -3149,7 +3149,76 @@ public class PartMngService extends BaseService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* BOM 복사를 위한 데이터 조회 (엑셀 파싱 형식과 동일하게 반환)
|
||||
*/
|
||||
public ArrayList getBomDataForCopy(HttpServletRequest request, Map paramMap) throws Exception{
|
||||
ArrayList resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
String bomReportObjid = CommonUtils.checkNull((String)paramMap.get("BOM_REPORT_OBJID"));
|
||||
|
||||
if(StringUtils.isBlank(bomReportObjid)){
|
||||
return resultList;
|
||||
}
|
||||
|
||||
// BOM 구조 데이터 조회 (BOM_PART_QTY 테이블에서 직접 조회)
|
||||
Map sqlParam = new HashMap();
|
||||
sqlParam.put("BOM_REPORT_OBJID", bomReportObjid);
|
||||
System.out.println("BOM_REPORT_OBJID: " + bomReportObjid);
|
||||
List<Map> bomPartList = sqlSession.selectList("partMng.getBomPartListForCopy", sqlParam);
|
||||
System.out.println("bomPartList size: " + bomPartList.size());
|
||||
|
||||
// 엑셀 파싱 형식으로 변환
|
||||
for(Map bomData : bomPartList){
|
||||
// PostgreSQL 소문자 결과를 대문자로 변환
|
||||
bomData = CommonUtils.toUpperCaseMapKey(bomData);
|
||||
|
||||
Map partMap = new HashMap();
|
||||
|
||||
// 모품번 조회 (PARENT_PART_NO가 OBJID이므로 실제 품번을 조회)
|
||||
String parentPartNo = "";
|
||||
if(!StringUtils.isBlank((String)bomData.get("PARENT_PART_NO"))){
|
||||
Map parentParam = new HashMap();
|
||||
parentParam.put("OBJID", bomData.get("PARENT_PART_NO"));
|
||||
Map parentPart = (Map)sqlSession.selectOne("partMng.getPartInfoByObjid", parentParam);
|
||||
if(parentPart != null){
|
||||
// PostgreSQL 소문자 결과를 대문자로 변환
|
||||
parentPart = CommonUtils.toUpperCaseMapKey(parentPart);
|
||||
parentPartNo = CommonUtils.checkNull(parentPart.get("PART_NO"));
|
||||
}
|
||||
}
|
||||
|
||||
partMap.put("PARENT_PART_NO", parentPartNo);
|
||||
partMap.put("PART_NO", CommonUtils.checkNull(bomData.get("PART_NO")));
|
||||
partMap.put("PART_NAME", CommonUtils.checkNull(bomData.get("PART_NAME")));
|
||||
partMap.put("QTY", CommonUtils.checkNull(bomData.get("QTY")));
|
||||
partMap.put("ITEM_QTY", CommonUtils.checkNull(bomData.get("ITEM_QTY")));
|
||||
partMap.put("MATERIAL", CommonUtils.checkNull(bomData.get("MATERIAL")));
|
||||
partMap.put("HEAT_TREATMENT_HARDNESS", CommonUtils.checkNull(bomData.get("HEAT_TREATMENT_HARDNESS")));
|
||||
partMap.put("HEAT_TREATMENT_METHOD", CommonUtils.checkNull(bomData.get("HEAT_TREATMENT_METHOD")));
|
||||
partMap.put("SURFACE_TREATMENT", CommonUtils.checkNull(bomData.get("SURFACE_TREATMENT")));
|
||||
partMap.put("SUPPLIER", CommonUtils.checkNull(bomData.get("SUPPLIER")));
|
||||
partMap.put("PART_TYPE", CommonUtils.checkNull(bomData.get("PART_TYPE")));
|
||||
partMap.put("NOTE", ""); // 복사 시 NOTE는 빈 값
|
||||
|
||||
resultList.add(partMap);
|
||||
}
|
||||
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} finally {
|
||||
if(sqlSession != null){
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 업로드된 Excel File을 통해 데이터를 Parsing 한다.(구조(bom)등록)
|
||||
* @param request
|
||||
|
||||
Reference in New Issue
Block a user