확인전 커밋
This commit is contained in:
@@ -901,6 +901,23 @@ public class QualityService extends BaseService{
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 엑셀 다운로드용 원본 데이터 조회
|
||||
*/
|
||||
public List getSemiProductInspectionListForExcel(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductInspectionListForExcel", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 상세 조회
|
||||
*/
|
||||
@@ -918,6 +935,259 @@ public class QualityService extends BaseService{
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 상세 조회 (팝업용 - 양품/불량 데이터 분리)
|
||||
*/
|
||||
public Map getSemiProductInspectionDetail(Map paramMap){
|
||||
Map resultMap = new HashMap();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
String inspectionGroupId = CommonUtils.checkNull(paramMap.get("INSPECTION_GROUP_ID"));
|
||||
String objid = CommonUtils.checkNull(paramMap.get("OBJID"));
|
||||
|
||||
Map searchMap = new HashMap();
|
||||
// INSPECTION_GROUP_ID가 있으면 우선 사용
|
||||
if(!inspectionGroupId.equals("")) {
|
||||
searchMap.put("INSPECTION_GROUP_ID", inspectionGroupId);
|
||||
} else if(!objid.equals("")) {
|
||||
// OBJID로 해당 행의 INSPECTION_GROUP_ID 조회
|
||||
Map infoMap = sqlSession.selectOne("quality.getSemiProductInspectionInfo", paramMap);
|
||||
if(infoMap != null && infoMap.get("inspection_group_id") != null) {
|
||||
searchMap.put("INSPECTION_GROUP_ID", CommonUtils.checkNull(infoMap.get("inspection_group_id")));
|
||||
} else if(infoMap != null && infoMap.get("INSPECTION_GROUP_ID") != null) {
|
||||
searchMap.put("INSPECTION_GROUP_ID", CommonUtils.checkNull(infoMap.get("INSPECTION_GROUP_ID")));
|
||||
} else {
|
||||
// 그룹 ID가 없으면 OBJID로 단건 조회
|
||||
searchMap.put("OBJID", objid);
|
||||
}
|
||||
}
|
||||
|
||||
// 양품 데이터 (DATA_TYPE = 'GOOD')
|
||||
searchMap.put("DATA_TYPE", "GOOD");
|
||||
List leftData = sqlSession.selectList("quality.getSemiProductInspectionByType", searchMap);
|
||||
resultMap.put("leftData", leftData);
|
||||
|
||||
// 불량 데이터 (DATA_TYPE = 'DEFECT')
|
||||
searchMap.put("DATA_TYPE", "DEFECT");
|
||||
List rightData = sqlSession.selectList("quality.getSemiProductInspectionByType", searchMap);
|
||||
resultMap.put("rightData", rightData);
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(sqlSession != null) sqlSession.close();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 저장 (새로운 팝업 형식)
|
||||
*/
|
||||
public Map saveSemiProductInspection(HttpServletRequest request, Map paramMap){
|
||||
Map resultMap = new HashMap();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
|
||||
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
|
||||
String writer = CommonUtils.checkNull(person.getUserId());
|
||||
|
||||
// JSON 데이터 파싱
|
||||
String leftDataStr = CommonUtils.checkNull(paramMap.get("leftData"));
|
||||
String rightDataStr = CommonUtils.checkNull(paramMap.get("rightData"));
|
||||
|
||||
org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser();
|
||||
|
||||
// 검사 그룹 ID 생성 (이번 저장 건을 묶는 용도)
|
||||
String inspectionGroupId = CommonUtils.createObjId();
|
||||
|
||||
// 양품 정보 (leftData) 저장
|
||||
if(leftDataStr != null && !leftDataStr.equals("") && !leftDataStr.equals("[]")){
|
||||
org.json.simple.JSONArray leftArr = (org.json.simple.JSONArray) parser.parse(leftDataStr);
|
||||
for(int i = 0; i < leftArr.size(); i++){
|
||||
org.json.simple.JSONObject item = (org.json.simple.JSONObject) leftArr.get(i);
|
||||
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("OBJID", CommonUtils.createObjId());
|
||||
sqlParamMap.put("MODEL_NAME", CommonUtils.checkNull(item.get("MODEL_NAME")));
|
||||
sqlParamMap.put("PRODUCT_TYPE", CommonUtils.checkNull(item.get("PRODUCT_TYPE")));
|
||||
sqlParamMap.put("WORK_ORDER_NO", CommonUtils.checkNull(item.get("WORK_ORDER_NO")));
|
||||
sqlParamMap.put("PART_NO", CommonUtils.checkNull(item.get("PART_NO")));
|
||||
sqlParamMap.put("PART_NAME", CommonUtils.checkNull(item.get("PART_NAME")));
|
||||
sqlParamMap.put("RECEIPT_QTY", CommonUtils.checkNull(item.get("RECEIPT_QTY"), "0"));
|
||||
sqlParamMap.put("GOOD_QTY", CommonUtils.checkNull(item.get("GOOD_QTY"), "0"));
|
||||
sqlParamMap.put("WRITER", writer);
|
||||
sqlParamMap.put("DATA_TYPE", "GOOD");
|
||||
sqlParamMap.put("INSPECTION_GROUP_ID", inspectionGroupId);
|
||||
|
||||
// 불량 정보 컬럼은 빈값으로
|
||||
sqlParamMap.put("DEFECT_QTY", "0");
|
||||
sqlParamMap.put("DEFECT_TYPE", "");
|
||||
sqlParamMap.put("DEFECT_CAUSE", "");
|
||||
sqlParamMap.put("RESPONSIBLE_DEPT", "");
|
||||
sqlParamMap.put("PROCESS_STATUS", "");
|
||||
sqlParamMap.put("INSPECTION_DATE", "");
|
||||
sqlParamMap.put("INSPECTOR", "");
|
||||
sqlParamMap.put("DISPOSITION_TYPE", "");
|
||||
sqlParamMap.put("REMARK", "");
|
||||
|
||||
sqlSession.insert("quality.insertSemiProductInspectionData", sqlParamMap);
|
||||
}
|
||||
}
|
||||
|
||||
// 양품 데이터에서 공통 정보 추출 (불량 데이터 연결용)
|
||||
String commonWorkOrderNo = "";
|
||||
String commonModelName = "";
|
||||
String commonProductType = "";
|
||||
String commonPartNo = "";
|
||||
String commonPartName = "";
|
||||
if(leftDataStr != null && !leftDataStr.equals("") && !leftDataStr.equals("[]")){
|
||||
org.json.simple.JSONArray leftArrForWo = (org.json.simple.JSONArray) parser.parse(leftDataStr);
|
||||
if(leftArrForWo.size() > 0){
|
||||
org.json.simple.JSONObject firstItem = (org.json.simple.JSONObject) leftArrForWo.get(0);
|
||||
commonWorkOrderNo = CommonUtils.checkNull(firstItem.get("WORK_ORDER_NO"));
|
||||
commonModelName = CommonUtils.checkNull(firstItem.get("MODEL_NAME"));
|
||||
commonProductType = CommonUtils.checkNull(firstItem.get("PRODUCT_TYPE"));
|
||||
commonPartNo = CommonUtils.checkNull(firstItem.get("PART_NO"));
|
||||
commonPartName = CommonUtils.checkNull(firstItem.get("PART_NAME"));
|
||||
}
|
||||
}
|
||||
|
||||
// 불량 정보 (rightData) 저장
|
||||
if(rightDataStr != null && !rightDataStr.equals("") && !rightDataStr.equals("[]")){
|
||||
org.json.simple.JSONArray rightArr = (org.json.simple.JSONArray) parser.parse(rightDataStr);
|
||||
for(int i = 0; i < rightArr.size(); i++){
|
||||
org.json.simple.JSONObject item = (org.json.simple.JSONObject) rightArr.get(i);
|
||||
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("OBJID", CommonUtils.createObjId());
|
||||
sqlParamMap.put("DEFECT_QTY", CommonUtils.checkNull(item.get("DEFECT_QTY"), "0"));
|
||||
sqlParamMap.put("DEFECT_TYPE", CommonUtils.checkNull(item.get("DEFECT_TYPE")));
|
||||
sqlParamMap.put("DEFECT_CAUSE", CommonUtils.checkNull(item.get("DEFECT_CAUSE")));
|
||||
sqlParamMap.put("RESPONSIBLE_DEPT", CommonUtils.checkNull(item.get("RESPONSIBLE_DEPT")));
|
||||
sqlParamMap.put("PROCESS_STATUS", CommonUtils.checkNull(item.get("PROCESS_STATUS")));
|
||||
sqlParamMap.put("INSPECTION_DATE", CommonUtils.checkNull(item.get("INSPECTION_DATE")));
|
||||
sqlParamMap.put("INSPECTOR", CommonUtils.checkNull(item.get("INSPECTOR")));
|
||||
sqlParamMap.put("DISPOSITION_TYPE", CommonUtils.checkNull(item.get("DISPOSITION_TYPE")));
|
||||
sqlParamMap.put("REMARK", CommonUtils.checkNull(item.get("REMARK")));
|
||||
sqlParamMap.put("WRITER", writer);
|
||||
sqlParamMap.put("DATA_TYPE", "DEFECT");
|
||||
sqlParamMap.put("INSPECTION_GROUP_ID", inspectionGroupId);
|
||||
|
||||
// 양품 데이터와 연결 (공통 정보 복사)
|
||||
sqlParamMap.put("WORK_ORDER_NO", commonWorkOrderNo);
|
||||
sqlParamMap.put("MODEL_NAME", commonModelName);
|
||||
sqlParamMap.put("PRODUCT_TYPE", commonProductType);
|
||||
sqlParamMap.put("PART_NO", commonPartNo);
|
||||
sqlParamMap.put("PART_NAME", commonPartName);
|
||||
sqlParamMap.put("RECEIPT_QTY", "0");
|
||||
sqlParamMap.put("GOOD_QTY", "0");
|
||||
|
||||
sqlSession.insert("quality.insertSemiProductInspectionData", sqlParamMap);
|
||||
}
|
||||
}
|
||||
|
||||
sqlSession.commit();
|
||||
resultMap.put("result", true);
|
||||
resultMap.put("msg", "저장되었습니다.");
|
||||
}catch(Exception e){
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "저장 중 오류가 발생했습니다: " + e.getMessage());
|
||||
if(sqlSession != null) sqlSession.rollback();
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(sqlSession != null) sqlSession.close();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 품명(모델명) 드롭박스 목록
|
||||
*/
|
||||
public List getSemiProductModelNameList(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductModelNameList", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 부품품번 드롭박스 목록
|
||||
*/
|
||||
public List getSemiProductPartNoList(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductPartNoList", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 부품명 드롭박스 목록
|
||||
*/
|
||||
public List getSemiProductPartNameList(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductPartNameList", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 검사일 드롭박스 목록
|
||||
*/
|
||||
public List getSemiProductInspectionDateList(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductInspectionDateList", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 반제품검사 검사자 드롭박스 목록
|
||||
*/
|
||||
public List getSemiProductWriterList(Map paramMap){
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("quality.getSemiProductWriterList", paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// 고객 CS 관리
|
||||
// =====================================================
|
||||
|
||||
Reference in New Issue
Block a user