Merge origin/main - 생산실적 날짜별 기능 병합
This commit is contained in:
@@ -2125,4 +2125,118 @@ public class ProductionPlanningService {
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생산실적 날짜별 조회
|
||||
*/
|
||||
public List getProdResultListByDate(Map<String, Object> paramMap) {
|
||||
List resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultList = sqlSession.selectList("productionplanning.getProdResultListByDate", paramMap);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 생산실적 날짜별 저장
|
||||
* - 기존 데이터 전체 삭제 후 새로 입력
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean saveProdResultByDate(Map<String, Object> paramMap) {
|
||||
boolean result = false;
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
String projectObjid = CommonUtils.nullToEmpty((String)paramMap.get("projectObjid"));
|
||||
String userId = CommonUtils.nullToEmpty((String)paramMap.get("userId"));
|
||||
String userName = CommonUtils.nullToEmpty((String)paramMap.get("userName"));
|
||||
List<Map<String, Object>> resultList = (List<Map<String, Object>>)paramMap.get("resultList");
|
||||
|
||||
// 기존 데이터 전체 삭제
|
||||
Map<String, Object> deleteParam = new HashMap<String, Object>();
|
||||
deleteParam.put("projectObjid", projectObjid);
|
||||
sqlSession.delete("productionplanning.deleteProdResultByProject", deleteParam);
|
||||
|
||||
// 새로 입력 (행별로 ROW_SEQ 부여)
|
||||
if(resultList != null && resultList.size() > 0) {
|
||||
int rowSeq = 1; // 행 순번
|
||||
for(Map<String, Object> row : resultList) {
|
||||
String resultDate = CommonUtils.nullToEmpty((String)row.get("RESULT_DATE"));
|
||||
if("".equals(resultDate)) continue;
|
||||
|
||||
int assemblyQty = getIntValue(row.get("ASSEMBLY_QTY"));
|
||||
int inspectionQty = getIntValue(row.get("INSPECTION_QTY"));
|
||||
int shipWaitQty = getIntValue(row.get("SHIP_WAIT_QTY"));
|
||||
String remark = CommonUtils.nullToEmpty((String)row.get("REMARK"));
|
||||
|
||||
// 완조립 수량 입력 (0이어도 입력)
|
||||
Map<String, Object> insertParam = new HashMap<String, Object>();
|
||||
insertParam.put("OBJID", CommonUtils.createObjId());
|
||||
insertParam.put("PROJECT_OBJID", projectObjid);
|
||||
insertParam.put("RESULT_TYPE", "ASSEMBLY");
|
||||
insertParam.put("RESULT_DATE", resultDate);
|
||||
insertParam.put("RESULT_QTY", assemblyQty);
|
||||
insertParam.put("ROW_SEQ", rowSeq);
|
||||
insertParam.put("WORKER_NAME", userName);
|
||||
insertParam.put("REMARK", remark);
|
||||
insertParam.put("userId", userId);
|
||||
sqlSession.insert("productionplanning.insertProdResult", insertParam);
|
||||
|
||||
// 검사 수량 입력 (0이어도 입력)
|
||||
insertParam = new HashMap<String, Object>();
|
||||
insertParam.put("OBJID", CommonUtils.createObjId());
|
||||
insertParam.put("PROJECT_OBJID", projectObjid);
|
||||
insertParam.put("RESULT_TYPE", "INSPECTION");
|
||||
insertParam.put("RESULT_DATE", resultDate);
|
||||
insertParam.put("RESULT_QTY", inspectionQty);
|
||||
insertParam.put("ROW_SEQ", rowSeq);
|
||||
insertParam.put("WORKER_NAME", userName);
|
||||
insertParam.put("REMARK", remark);
|
||||
insertParam.put("userId", userId);
|
||||
sqlSession.insert("productionplanning.insertProdResult", insertParam);
|
||||
|
||||
// 출하대기 수량 입력 (0이어도 입력)
|
||||
insertParam = new HashMap<String, Object>();
|
||||
insertParam.put("OBJID", CommonUtils.createObjId());
|
||||
insertParam.put("PROJECT_OBJID", projectObjid);
|
||||
insertParam.put("RESULT_TYPE", "SHIP_WAIT");
|
||||
insertParam.put("RESULT_DATE", resultDate);
|
||||
insertParam.put("RESULT_QTY", shipWaitQty);
|
||||
insertParam.put("ROW_SEQ", rowSeq);
|
||||
insertParam.put("WORKER_NAME", userName);
|
||||
insertParam.put("REMARK", remark);
|
||||
insertParam.put("userId", userId);
|
||||
sqlSession.insert("productionplanning.insertProdResult", insertParam);
|
||||
|
||||
rowSeq++; // 다음 행
|
||||
}
|
||||
}
|
||||
|
||||
sqlSession.commit();
|
||||
result = true;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
if(sqlSession != null) {
|
||||
sqlSession.rollback();
|
||||
}
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user