구매리스트 가공 추가, 품의서 생성도 소재, 가공 분리

This commit is contained in:
2026-01-16 16:04:26 +09:00
parent d64039e283
commit e8d9f273e0
5 changed files with 712 additions and 234 deletions

View File

@@ -1428,25 +1428,37 @@ public class SalesMngController {
String salesRequestMasterObjid = CommonUtils.checkNull(paramMap.get("SALES_REQUEST_MASTER_OBJID"));
// Service의 공통 메서드 사용
// Service의 공통 메서드 사용 (소재/가공 분리)
Map partsInfo = salesMngService.getProposalTargetPartsWithInfo(sqlSession, salesRequestMasterObjid);
List<Map> targetParts = (List<Map>)partsInfo.get("targetParts");
List<Map> excludedParts = (List<Map>)partsInfo.get("excludedParts"); // 공급업체 미입력 품목
if(targetParts != null && !targetParts.isEmpty()) {
// 소재/가공 각각 분리된 데이터
List<Map> materialTargetParts = (List<Map>)partsInfo.get("materialTargetParts");
List<Map> processingTargetParts = (List<Map>)partsInfo.get("processingTargetParts");
List<Map> materialExcludedParts = (List<Map>)partsInfo.get("materialExcludedParts");
List<Map> processingExcludedParts = (List<Map>)partsInfo.get("processingExcludedParts");
// 기존 호환성을 위한 통합 데이터
List<Map> targetParts = (List<Map>)partsInfo.get("targetParts");
List<Map> excludedParts = (List<Map>)partsInfo.get("excludedParts");
boolean hasMaterialParts = materialTargetParts != null && !materialTargetParts.isEmpty();
boolean hasProcessingParts = processingTargetParts != null && !processingTargetParts.isEmpty();
if(hasMaterialParts || hasProcessingParts) {
resultMap.put("resultFlag", "S");
// 소재/가공 분리 데이터
resultMap.put("materialTargetParts", materialTargetParts);
resultMap.put("processingTargetParts", processingTargetParts);
resultMap.put("materialExcludedParts", materialExcludedParts);
resultMap.put("processingExcludedParts", processingExcludedParts);
// 기존 호환성
resultMap.put("data", targetParts);
resultMap.put("excludedParts", excludedParts); // 공급업체 미입력 품목도 함께 반환
resultMap.put("excludedParts", excludedParts);
} else {
// 대상 품목이 없는 경우, 공급업체 미입력 품목이 있는지 확인
if(excludedParts != null && !excludedParts.isEmpty()) {
resultMap.put("resultFlag", "F");
resultMap.put("message", "품의서 생성 대상 품목이 없습니다.\n(단가와 공급업체가 모두 입력된 품목만 가능)");
resultMap.put("excludedParts", excludedParts);
} else {
resultMap.put("resultFlag", "F");
resultMap.put("message", "품의서 생성 대상 품목이 없습니다.\n(단가가 입력되고 품의서가 생성되지 않은 품목만 가능)");
}
resultMap.put("resultFlag", "F");
resultMap.put("message", "품의서 생성 대상 품목이 없습니다.\n(소재단가+공급업체 또는 가공단가+가공업체가 입력되고 품의서가 생성되지 않은 품목만 가능)");
resultMap.put("materialExcludedParts", materialExcludedParts);
resultMap.put("processingExcludedParts", processingExcludedParts);
}
} catch (Exception e) {