품질관리_공정검사관리
This commit is contained in:
@@ -792,6 +792,94 @@ public class QualityService extends BaseService{
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 공정검사 저장 (마스터 + 디테일)
|
||||
*/
|
||||
public Map saveProcessInspection(HttpServletRequest request, Map paramMap){
|
||||
Map resultMap = new HashMap();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
PersonBean person = (PersonBean) request.getSession().getAttribute(Constants.PERSON_BEAN);
|
||||
String writer = person != null ? person.getUserId() : "";
|
||||
|
||||
String masterObjId = CommonUtils.checkNull(paramMap.get("MASTER_OBJID"));
|
||||
String inspectionDate = CommonUtils.checkNull(paramMap.get("INSPECTION_DATE"));
|
||||
String inspectorId = CommonUtils.checkNull(paramMap.get("INSPECTOR_ID"));
|
||||
String masterRemark = CommonUtils.checkNull(paramMap.get("MASTER_REMARK"));
|
||||
String dataListJson = CommonUtils.checkNull(paramMap.get("dataList"));
|
||||
|
||||
// 마스터 저장
|
||||
Map<String, Object> masterParamMap = new HashMap<String, Object>();
|
||||
masterParamMap.put("INSPECTION_DATE", inspectionDate);
|
||||
masterParamMap.put("INSPECTOR_ID", inspectorId);
|
||||
masterParamMap.put("REMARK", masterRemark);
|
||||
masterParamMap.put("WRITER", writer);
|
||||
|
||||
if(masterObjId.isEmpty()){
|
||||
// 신규 등록
|
||||
masterObjId = CommonUtils.checkNull(CommonUtils.createObjId());
|
||||
masterParamMap.put("OBJID", masterObjId);
|
||||
sqlSession.insert("quality.insertProcessInspectionMaster", masterParamMap);
|
||||
} else {
|
||||
// 수정
|
||||
masterParamMap.put("OBJID", masterObjId);
|
||||
sqlSession.update("quality.updateProcessInspectionMaster", masterParamMap);
|
||||
// 기존 디테일 삭제 후 재등록
|
||||
Map<String, Object> deleteParamMap = new HashMap<String, Object>();
|
||||
deleteParamMap.put("MASTER_OBJID", masterObjId);
|
||||
sqlSession.delete("quality.deleteProcessInspectionDetailByMaster", deleteParamMap);
|
||||
}
|
||||
|
||||
// 디테일 저장
|
||||
if(dataListJson != null && !dataListJson.isEmpty()){
|
||||
com.google.gson.Gson gson = new com.google.gson.Gson();
|
||||
java.lang.reflect.Type listType = new com.google.gson.reflect.TypeToken<List<Map<String, Object>>>(){}.getType();
|
||||
List<Map<String, Object>> dataList = gson.fromJson(dataListJson, listType);
|
||||
|
||||
for(Map<String, Object> rowData : dataList){
|
||||
Map<String, Object> sqlParamMap = new HashMap<String, Object>();
|
||||
|
||||
String detailObjId = CommonUtils.checkNull(CommonUtils.createObjId());
|
||||
|
||||
sqlParamMap.put("OBJID", detailObjId);
|
||||
sqlParamMap.put("MASTER_OBJID", masterObjId);
|
||||
sqlParamMap.put("PROCESS_CD", CommonUtils.checkNull(rowData.get("PROCESS_CD")));
|
||||
sqlParamMap.put("PROJECT_OBJID", CommonUtils.checkNull(rowData.get("PROJECT_OBJID")));
|
||||
sqlParamMap.put("PART_OBJID", CommonUtils.checkNull(rowData.get("PART_OBJID")));
|
||||
sqlParamMap.put("PART_NO", CommonUtils.checkNull(rowData.get("PART_NO")));
|
||||
sqlParamMap.put("PART_NAME", CommonUtils.checkNull(rowData.get("PART_NAME")));
|
||||
sqlParamMap.put("INSPECTION_QTY", CommonUtils.checkNull(rowData.get("INSPECTION_QTY")));
|
||||
sqlParamMap.put("DEFECT_QTY", CommonUtils.checkNull(rowData.get("DEFECT_QTY")));
|
||||
sqlParamMap.put("WORK_ENV_STATUS", CommonUtils.checkNull(rowData.get("WORK_ENV_STATUS")));
|
||||
sqlParamMap.put("MEASURING_DEVICE", CommonUtils.checkNull(rowData.get("MEASURING_DEVICE")));
|
||||
sqlParamMap.put("DEPT_CD", CommonUtils.checkNull(rowData.get("DEPT_CD")));
|
||||
sqlParamMap.put("USER_ID", CommonUtils.checkNull(rowData.get("USER_ID")));
|
||||
sqlParamMap.put("REMARK", CommonUtils.checkNull(rowData.get("REMARK")));
|
||||
sqlParamMap.put("ACTION_STATUS", CommonUtils.checkNull(rowData.get("ACTION_STATUS")));
|
||||
sqlParamMap.put("INSPECTION_RESULT", CommonUtils.checkNull(rowData.get("INSPECTION_RESULT")));
|
||||
sqlParamMap.put("WRITER", writer);
|
||||
|
||||
sqlSession.insert("quality.saveProcessInspectionDetail", sqlParamMap);
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("RESULT", "SUCCESS");
|
||||
resultMap.put("MASTER_OBJID", masterObjId);
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
resultMap.put("RESULT", "FAIL");
|
||||
resultMap.put("MESSAGE", e.getMessage());
|
||||
}finally{
|
||||
if(sqlSession != null) sqlSession.close();
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
// 반제품검사 관리
|
||||
// =====================================================
|
||||
|
||||
Reference in New Issue
Block a user