봄 구조등록 수정. 봄 복사 개발 전
This commit is contained in:
@@ -1538,37 +1538,55 @@ public class PartMngController {
|
||||
String objid="";
|
||||
try{
|
||||
objid = CommonUtils.createObjId();
|
||||
code_map.put("customer_cd",commonService.bizMakeOptionList("", (String)paramMap.get("customer_cd"),"common.getsupplyselect"));
|
||||
code_map.put("project_name",commonService.bizMakeOptionList("", (String)paramMap.get("project_name"),"common.getProjectNameList"));
|
||||
code_map.put("unit_code",commonService.bizMakeOptionList((String)paramMap.get("unit_code"), (String)paramMap.get("unit_code"),"common.getBomCodeList"));
|
||||
//code_map.put("customer_cd",commonService.bizMakeOptionList("", (String)paramMap.get("customer_cd"),"common.getsupplyselect"));
|
||||
//code_map.put("project_name",commonService.bizMakeOptionList("", (String)paramMap.get("project_name"),"common.getProjectNameList"));
|
||||
//code_map.put("unit_code",commonService.bizMakeOptionList((String)paramMap.get("unit_code"), (String)paramMap.get("unit_code"),"common.getBomCodeList"));
|
||||
|
||||
//제품구분
|
||||
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product_cd")),"common.getCodeselect")); //제품구분
|
||||
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
Map sqlMap = new HashMap();
|
||||
String unitCode = CommonUtils.checkNull(paramMap.get("unit_code"));
|
||||
sqlMap.put("unitCode", unitCode);
|
||||
Map unitInfoMap = (HashMap)sqlSession.selectOne("common.getUnitCodeList", sqlMap);
|
||||
//String unitName = CommonUtils.checkNull(unitInfoMap.get("name")).replaceAll("\u00A0+", " ");
|
||||
String UNIT_NAME = CommonUtils.checkNull(unitInfoMap.get("name"));
|
||||
|
||||
sqlParam.put("customer_cd", CommonUtils.checkNull(paramMap.get("customer_cd")));
|
||||
//sqlParam.put("project_name", CommonUtils.checkNull(paramMap.get("project_name")));
|
||||
sqlParam.put("unit_name_eq", UNIT_NAME);
|
||||
regiestSameContractUnitNameBomList = partMngService.getBOMStandardStructureList(request, sqlParam);
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
// 통합 템플릿으로 변경하면서 unit_code 관련 로직은 사용하지 않음
|
||||
/*
|
||||
// UNIT_NAME 조회 (unit_code가 유효한 경우에만)
|
||||
String UNIT_NAME = "";
|
||||
String unitCode = CommonUtils.checkNull(paramMap.get("unit_code"));
|
||||
if(sqlSession != null && !StringUtils.isBlank(unitCode) && !"undefined".equals(unitCode)){
|
||||
try {
|
||||
Map sqlMap = new HashMap();
|
||||
sqlMap.put("unitCode", unitCode);
|
||||
Map unitInfoMap = (HashMap)sqlSession.selectOne("common.getUnitCodeList", sqlMap);
|
||||
if(unitInfoMap != null){
|
||||
UNIT_NAME = CommonUtils.checkNull(unitInfoMap.get("name"));
|
||||
}
|
||||
} catch(Exception e) {
|
||||
// unit_code 조회 실패시 빈 문자열 사용
|
||||
System.out.println("Failed to get UNIT_NAME for unitCode: " + unitCode);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
sqlParam.put("customer_cd", CommonUtils.checkNull(paramMap.get("customer_cd")));
|
||||
//sqlParam.put("project_name", CommonUtils.checkNull(paramMap.get("project_name")));
|
||||
sqlParam.put("unit_name_eq", UNIT_NAME);
|
||||
regiestSameContractUnitNameBomList = partMngService.getBOMStandardStructureList(request, sqlParam);
|
||||
*/
|
||||
|
||||
// unit_code 없이 BOM 구조 조회
|
||||
sqlParam.put("customer_cd", CommonUtils.checkNull(paramMap.get("customer_cd")));
|
||||
sqlParam.put("unit_name_eq", "");
|
||||
regiestSameContractUnitNameBomList = partMngService.getBOMStandardStructureList(request, sqlParam);
|
||||
|
||||
//paramMap.put("product_code",(String)paramMap.get("product_code"));
|
||||
//info = partMngService.getBOMStructureRev(request,paramMap);
|
||||
bomContractInfo = partMngService.getBOMContractinfo(request,paramMap);
|
||||
|
||||
Map param = new HashMap();
|
||||
//unit
|
||||
param.put("parentCodeId", "0000059");
|
||||
code_map.put("unit_cd", commonService.getJqGridSelectBoxJsonData("common.getCodeList2", param, "선택"));
|
||||
param.put("parentCodeId", "0000062");
|
||||
code_map.put("part_type", commonService.getJqGridSelectBoxJsonData("common.getCodeList2", param, "선택"));
|
||||
code_map.put("sup_code", commonService.getJqGridSelectBoxJsonData("common.getmatersupplyselect", param, "선택"));
|
||||
// part_type 셀렉트박스 데이터 전달
|
||||
Map param = new HashMap();
|
||||
param.put("parentCodeId", "0000062");
|
||||
code_map.put("part_type", commonService.getJqGridSelectBoxJsonData("common.getCodeList2", param, "선택"));
|
||||
code_map.put("sup_code", commonService.getJqGridSelectBoxJsonData("common.getmatersupplyselect", param, "선택"));
|
||||
|
||||
bomInfo = partMngService.getBOMStructureStandardInfo(request, paramMap);
|
||||
if(bomInfo == null) bomInfo = new HashMap();
|
||||
@@ -1586,10 +1604,10 @@ public class PartMngController {
|
||||
}else {
|
||||
//신규등록일 때만 보이게
|
||||
}
|
||||
multiMasterList = commonService.selectList("purchaseOrder.selectPurchaseOrderMasterList", request, paramMap);
|
||||
//multiMasterList = commonService.selectList("purchaseOrder.selectPurchaseOrderMasterList", request, paramMap);
|
||||
|
||||
//동시발주용 정보
|
||||
request.setAttribute("multiMasterList", multiMasterList);
|
||||
//request.setAttribute("multiMasterList", multiMasterList);
|
||||
request.setAttribute("regiestSameContractUnitNameBomList", regiestSameContractUnitNameBomList); //동일 계약에 동일유닛네임으로 저장된 bom list
|
||||
|
||||
request.setAttribute("code_map",code_map);
|
||||
@@ -1597,9 +1615,9 @@ public class PartMngController {
|
||||
request.setAttribute("resultList",resultList);
|
||||
request.setAttribute("info",bomContractInfo);
|
||||
request.setAttribute("objid",objid);
|
||||
request.setAttribute("CUSTOMER_OBJID",(String)paramMap.get("customer_cd"));
|
||||
request.setAttribute("CONTRACT_OBJID",(String)paramMap.get("project_name"));
|
||||
request.setAttribute("UNIT_CODE",(String)paramMap.get("unit_code"));
|
||||
//request.setAttribute("CUSTOMER_OBJID",(String)paramMap.get("customer_cd"));
|
||||
//request.setAttribute("CONTRACT_OBJID",(String)paramMap.get("project_name"));
|
||||
//request.setAttribute("UNIT_CODE",(String)paramMap.get("unit_code"));
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
|
||||
@@ -2975,26 +2975,38 @@ SELECT T1.LEV, T1.BOM_REPORT_OBJID, T1.ROOT_PART_NO, T1.PATH, T1.LEAF, T2.*
|
||||
, STATUS
|
||||
, WRITER
|
||||
, REGDATE
|
||||
,MULTI_YN
|
||||
,MULTI_MASTER_YN
|
||||
,MULTI_BREAK_YN
|
||||
,MULTI_MASTER_OBJID
|
||||
, MULTI_YN
|
||||
, MULTI_MASTER_YN
|
||||
, MULTI_BREAK_YN
|
||||
, MULTI_MASTER_OBJID
|
||||
, PRODUCT_CD
|
||||
, PART_NO
|
||||
, PART_NAME
|
||||
, REVISION
|
||||
) VALUES (
|
||||
#{OBJID}
|
||||
, #{CUSTOMER_OBJID}
|
||||
, #{CONTRACT_OBJID}
|
||||
, #{UNIT_CODE}
|
||||
, 'create'
|
||||
, 'N'
|
||||
, #{WRITER}
|
||||
, NOW()
|
||||
,#{MULTI_YN }
|
||||
,#{MULTI_MASTER_YN }
|
||||
,#{MULTI_BREAK_YN }
|
||||
,#{MULTI_MASTER_OBJID }
|
||||
, #{MULTI_YN}
|
||||
, #{MULTI_MASTER_YN}
|
||||
, #{MULTI_BREAK_YN}
|
||||
, #{MULTI_MASTER_OBJID}
|
||||
, #{PRODUCT_CD}
|
||||
, #{PART_NO}
|
||||
, #{PART_NAME}
|
||||
, #{REVISION}
|
||||
) ON
|
||||
CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
SET WRITER = #{WRITER}
|
||||
SET WRITER = #{WRITER}
|
||||
, PRODUCT_CD = #{PRODUCT_CD}
|
||||
, PART_NO = #{PART_NO}
|
||||
, PART_NAME = #{PART_NAME}
|
||||
, REVISION = #{REVISION}
|
||||
</insert>
|
||||
|
||||
<insert id="createBOMReportStructureStandardInfo_old" parameterType="map">
|
||||
|
||||
@@ -3161,24 +3161,203 @@ public class PartMngService extends BaseService {
|
||||
ArrayList resultList = new ArrayList();
|
||||
ArrayList fileList = commonService.getFileList(paramMap);
|
||||
|
||||
boolean logging = false;
|
||||
String resultColumn = "NOTE";
|
||||
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
|
||||
// 통합 템플릿으로 변경하면서 프로젝트 번호 검증은 선택사항으로 변경
|
||||
String projectNo = "";
|
||||
/*
|
||||
Map<String,Object> projectInfo = (Map)sqlSession.selectOne("project.getProjectMngInfo", paramMap);
|
||||
if(projectInfo != null) {
|
||||
projectNo = (String)projectInfo.get("project_no");
|
||||
System.out.println("projectNo:"+projectNo);
|
||||
}
|
||||
*/
|
||||
|
||||
if(null != fileList && 1 == fileList.size()){
|
||||
HashMap fileMap = (HashMap)fileList.get(0);
|
||||
String realFileName = CommonUtils.checkNull(fileMap.get("REAL_FILE_NAME")); // 원본 파일명
|
||||
|
||||
// 파일명으로 타입 판별
|
||||
String excelType = "SPINDLE"; // 기본값
|
||||
if(realFileName.toUpperCase().contains("EQUIPMENT") || realFileName.toUpperCase().contains("장비")) {
|
||||
excelType = "EQUIPMENT";
|
||||
String path = CommonUtils.checkNull(fileMap.get("FILE_PATH"));
|
||||
String fileName = CommonUtils.checkNull(fileMap.get("SAVED_FILE_NAME"));
|
||||
|
||||
FileInputStream fis = new FileInputStream(path+"\\"+fileName);
|
||||
|
||||
Workbook workBook = null;
|
||||
if (fileName.endsWith(".xls") || fileName.endsWith(".XLS")) {
|
||||
workBook = new HSSFWorkbook(fis);
|
||||
} else if (fileName.endsWith(".xlsx") || fileName.endsWith(".XLSX")) {
|
||||
workBook = new XSSFWorkbook(fis);
|
||||
}
|
||||
Sheet sheet = workBook.getSheetAt(0);
|
||||
|
||||
DataFormatter formatter = new DataFormatter();
|
||||
int rows = sheet.getPhysicalNumberOfRows();
|
||||
System.out.println("rows:"+rows);
|
||||
|
||||
// 모든 자품번 수집 (첫 번째 열 '상태'는 건너뜀)
|
||||
Set<String> allPartNumbers = new HashSet<>();
|
||||
for (int rowIndex = 1; rowIndex < rows; rowIndex++) { // 2번째 행(index 1)부터 시작 (헤더 1줄 건너뜀)
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
if (row != null) {
|
||||
String partNo = getCellValue(row, 2, formatter, new AtomicInteger(0)).trim(); // 품번 컬럼 (2번째 열)
|
||||
if (!StringUtils.isBlank(partNo)) {
|
||||
allPartNumbers.add(partNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 타입에 따라 다른 파싱 로직 실행
|
||||
if("EQUIPMENT".equals(excelType)) {
|
||||
resultList = parsingEquipmentExcelFile(request, paramMap);
|
||||
int emptyRowCnt = 0;
|
||||
AtomicInteger emptyColCnt = new AtomicInteger(0);
|
||||
Map partNoUniqueMap = new HashMap();
|
||||
|
||||
for(int rowIndex= 1 ; rowIndex < rows ; rowIndex++){ // 2번째 행(index 1)부터 시작 (헤더 1줄 건너뜀)
|
||||
Row row = sheet.getRow(rowIndex);
|
||||
if(null != row){
|
||||
emptyColCnt.set(0);
|
||||
Map partMap = new HashMap();
|
||||
int columnIndex = 1; // 첫 번째 열(상태)은 건너뛰고 1부터 시작
|
||||
|
||||
// 통합 엑셀 컬럼 매핑 (첫 번째 열 '상태'는 건너뜀)
|
||||
// 1: 모품번(PARENT_PART_NO), 2: 품번(PART_NO), 3: 품명(PART_NAME)
|
||||
// 4: 수량(QTY), 5: 항목수량(ITEM_QTY), 6: 재료(MATERIAL)
|
||||
// 7: 열처리경도(HEAT_TREATMENT_HARDNESS), 8: 열처리방법(HEAT_TREATMENT_METHOD), 9: 표면처리(SURFACE_TREATMENT)
|
||||
// 10: 공급업체(SUPPLIER), 11: 범주이름(PART_TYPE)
|
||||
|
||||
String parentPartNo = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 모품번
|
||||
String partNo = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 품번
|
||||
String partName = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 품명
|
||||
String qty = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 수량
|
||||
String itemQty = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 항목수량
|
||||
String material = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 재료
|
||||
String heatHardness = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 열처리경도
|
||||
String heatMethod = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 열처리방법
|
||||
String surfaceTreatment = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 표면처리
|
||||
String supplier = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 공급업체
|
||||
String partType = getCellValue(row, columnIndex++, formatter, emptyColCnt).trim(); // 범주이름
|
||||
|
||||
// 빈 행 체크
|
||||
if(StringUtils.isBlank(partNo) && StringUtils.isBlank(partName)){
|
||||
emptyRowCnt++;
|
||||
if(emptyRowCnt > 3) break;
|
||||
continue;
|
||||
}
|
||||
emptyRowCnt = 0;
|
||||
|
||||
// 유효성 검사
|
||||
String noteMsg = "";
|
||||
|
||||
// 모품번 체크
|
||||
if(StringUtils.isBlank(parentPartNo) && rowIndex > 1) { // 첫 번째 데이터 행(rowIndex = 1)은 체크하지 않음
|
||||
noteMsg += "필수입력 - 모품번;";
|
||||
} else if(!StringUtils.isBlank(parentPartNo) && !allPartNumbers.contains(parentPartNo.trim())) {
|
||||
noteMsg += "모품번이 자품번 목록에 없습니다: " + parentPartNo + ";";
|
||||
}
|
||||
|
||||
// 품번 체크
|
||||
if (StringUtils.isBlank(partNo)) {
|
||||
noteMsg += "필수입력 - 품번;";
|
||||
} else {
|
||||
resultList = parsingSpindleExcelFile(request, paramMap);
|
||||
if (partNoUniqueMap.containsKey(partNo)) {
|
||||
noteMsg += "품번 중복: " + partNo + ";";
|
||||
}
|
||||
|
||||
// 프로젝트번호 검증은 선택사항으로 변경 (필요시 주석 해제)
|
||||
/*
|
||||
if (rowIndex == 1 && !StringUtils.isBlank(projectNo) && !partNo.trim().equals(projectNo)) {
|
||||
noteMsg += "1레벨 품번에 프로젝트번호가 없습니다: " + partNo + ";";
|
||||
}
|
||||
*/
|
||||
|
||||
partNoUniqueMap.put(partNo, "");
|
||||
}
|
||||
|
||||
// 품명 체크
|
||||
if(StringUtils.isBlank(partName)){
|
||||
noteMsg += "필수입력 - 품명;";
|
||||
}
|
||||
|
||||
// 수량 체크
|
||||
if (StringUtils.isBlank(qty)) {
|
||||
noteMsg += "필수입력 - 수량;";
|
||||
} else {
|
||||
try {
|
||||
double qtyValue = Double.parseDouble(qty);
|
||||
if (qtyValue <= 0) {
|
||||
noteMsg += "수량은 0보다 커야 합니다: " + qty + ";";
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
noteMsg += "수량은 숫자여야 합니다: " + qty + ";";
|
||||
}
|
||||
}
|
||||
|
||||
// PART_TYPE 코드 조회
|
||||
String partTypeCode = "";
|
||||
if(!StringUtils.isBlank(partType) && rowIndex > 2) { // 첫 번째, 두 번째 데이터 행(rowIndex 1,2)은 체크하지 않음
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partType);
|
||||
String partNoForCheck = CommonUtils.checkNull(partNo);
|
||||
sqlParamMap.put("partNo", partNoForCheck);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
|
||||
// 구매품표준인 경우 존재 여부 체크
|
||||
if(partType.equals("구매품표준")){
|
||||
List<Map<String,Object>> partList = sqlSession.selectList("partMng.existPartNoCheck", sqlParamMap);
|
||||
if(null == partList || partList.isEmpty()){
|
||||
noteMsg += "품번에 해당하는 구매품표준이 없습니다:" + partNoForCheck + ";";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
noteMsg += "부품유형 확인:" + partType + ";";
|
||||
}
|
||||
} else if(!StringUtils.isBlank(partType) && rowIndex <= 2) {
|
||||
// 초기 행에서는 코드만 조회
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partType);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
}
|
||||
}
|
||||
|
||||
// Map에 데이터 저장
|
||||
partMap.put("PARENT_PART_NO", parentPartNo);
|
||||
partMap.put("PART_NO", partNo);
|
||||
partMap.put("PART_NAME", partName);
|
||||
partMap.put("QTY", qty);
|
||||
partMap.put("ITEM_QTY", itemQty);
|
||||
partMap.put("MATERIAL", material);
|
||||
partMap.put("HEAT_TREATMENT_HARDNESS", heatHardness);
|
||||
partMap.put("HEAT_TREATMENT_METHOD", heatMethod);
|
||||
partMap.put("SURFACE_TREATMENT", surfaceTreatment);
|
||||
partMap.put("SUPPLIER", supplier);
|
||||
partMap.put("PART_TYPE", partTypeCode);
|
||||
partMap.put("NOTE", noteMsg);
|
||||
|
||||
if(logging) logger.info("partMap:"+partMap);
|
||||
|
||||
if(emptyColCnt.intValue() < 9) { // 모두 공백 아니면 담기
|
||||
resultList.add(partMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
sqlSession.commit();
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
|
||||
if(logging) {
|
||||
for (Object object : resultList) {
|
||||
logger.info("resultList object:"+object);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@@ -3744,49 +3923,63 @@ public class PartMngService extends BaseService {
|
||||
}
|
||||
String masterObjid = objid;
|
||||
|
||||
String unitCode = CommonUtils.checkNull(paramMap.get("UNIT_CODE"));
|
||||
String contracObjid = CommonUtils.checkNull(paramMap.get("CONTRACT_OBJID"));
|
||||
// BOM부터 만들고 프로젝트에 연결하도록 변경 - 프로젝트 유닛 정보 조회 주석처리
|
||||
/*
|
||||
String unitCode = CommonUtils.checkNull(paramMap.get("UNIT_CODE"));
|
||||
String contracObjid = CommonUtils.checkNull(paramMap.get("CONTRACT_OBJID"));
|
||||
|
||||
sqlMap.put("OBJID", contracObjid);
|
||||
Map<String,Object> projectInfo = (Map)sqlSession.selectOne("project.getProjectMngInfo", sqlMap);
|
||||
String projectNo = (String)projectInfo.get("project_no");
|
||||
String masterProjectNo = projectNo;
|
||||
|
||||
sqlMap.put("unitCode", unitCode);
|
||||
Map unitInfoMap = (HashMap)sqlSession.selectOne("common.getUnitCodeList", sqlMap);
|
||||
String unitName = CommonUtils.checkNull(unitInfoMap.get("name")).replaceAll("\u00A0+", " ");
|
||||
String UNIT_NAME = CommonUtils.checkNull(unitInfoMap.get("name"));
|
||||
|
||||
byte[] utf8Bytes = unitName.getBytes("UTF-8");
|
||||
String utf8unitName = new String(utf8Bytes, "UTF-8");
|
||||
|
||||
String filepath = Constants.FILE_STORAGE+"\\PART_DATA\\";
|
||||
String filepathFull = filepath+projectNo+File.separator+unitName+File.separator;
|
||||
*/
|
||||
|
||||
sqlMap.put("OBJID", contracObjid);
|
||||
Map<String,Object> projectInfo = (Map)sqlSession.selectOne("project.getProjectMngInfo", sqlMap);
|
||||
String projectNo = (String)projectInfo.get("project_no");
|
||||
String masterProjectNo = projectNo;
|
||||
|
||||
sqlMap.put("unitCode", unitCode);
|
||||
Map unitInfoMap = (HashMap)sqlSession.selectOne("common.getUnitCodeList", sqlMap);
|
||||
String unitName = CommonUtils.checkNull(unitInfoMap.get("name")).replaceAll("\u00A0+", " ");
|
||||
String UNIT_NAME = CommonUtils.checkNull(unitInfoMap.get("name"));
|
||||
|
||||
byte[] utf8Bytes = unitName.getBytes("UTF-8");
|
||||
String utf8unitName = new String(utf8Bytes, "UTF-8");
|
||||
|
||||
String filepath = Constants.FILE_STORAGE+"\\PART_DATA\\";
|
||||
String filepathFull = filepath+projectNo+File.separator+unitName+File.separator;
|
||||
|
||||
boolean isMaster = true;
|
||||
// BOM부터 만들고 프로젝트에 연결하도록 변경 - 멀티 프로젝트 처리 주석처리
|
||||
/*
|
||||
boolean isMaster = true;
|
||||
boolean isMulti = false;
|
||||
for(int j=1; j<11; j++){
|
||||
for(int j=1; j<11; j++){
|
||||
String APPLICATION_PROJECT_NO = CommonUtils.nullToEmpty((String)paramMap.get("APPLICATION_PROJECT_NO"+j)); //프로젝트 objid
|
||||
if(!CommonUtils.isBlank(APPLICATION_PROJECT_NO)) {
|
||||
isMulti = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//BOM REPORT OBJID
|
||||
sqlMap.clear();
|
||||
sqlMap.put("OBJID", objid);
|
||||
sqlMap.put("MULTI_YN", isMulti ? "Y" : "N");
|
||||
sqlMap.put("MULTI_MASTER_YN", isMulti ? "Y" : "N");
|
||||
sqlMap.put("MULTI_YN", "N"); // 멀티 프로젝트 기능 비활성화
|
||||
sqlMap.put("MULTI_MASTER_YN", "N");
|
||||
//sqlMap.put("MULTI_MASTER_OBJID", masterObjid);
|
||||
sqlMap.put("CUSTOMER_OBJID", CommonUtils.checkNull((String)paramMap.get("CUSTOMER_OBJID")));
|
||||
sqlMap.put("CONTRACT_OBJID", CommonUtils.checkNull((String)paramMap.get("CONTRACT_OBJID")));
|
||||
sqlMap.put("UNIT_CODE", CommonUtils.checkNull((String)paramMap.get("UNIT_CODE")));
|
||||
sqlMap.put("WRITER", CommonUtils.checkNull((String)paramMap.get("CONNECTUSERID")));
|
||||
//bom report 저장
|
||||
|
||||
// 제품구분, 품번, 품명, 버전 추가
|
||||
sqlMap.put("PRODUCT_CD", CommonUtils.checkNull((String)paramMap.get("product_cd")));
|
||||
sqlMap.put("PART_NO", CommonUtils.checkNull((String)paramMap.get("bom_part_no")));
|
||||
sqlMap.put("PART_NAME", CommonUtils.checkNull((String)paramMap.get("bom_part_name")));
|
||||
sqlMap.put("REVISION", CommonUtils.checkNull((String)paramMap.get("version")));
|
||||
|
||||
//bom report 저장
|
||||
System.out.println("sqlMap ---->"+sqlMap);
|
||||
sqlSession.insert("partMng.createBOMReportStructureStandardInfo", sqlMap);
|
||||
|
||||
// BOM 데이터 저장 (프로젝트 연결 없이)
|
||||
/*
|
||||
String newPartNo1Surffix = "";
|
||||
String masterPartNo1 = "";
|
||||
String UNIT_CODE2 = "";
|
||||
@@ -3822,12 +4015,12 @@ public class PartMngService extends BaseService {
|
||||
UNIT_CODE2 = CommonUtils.checkNull((String)unitInfoMap.get("code"));
|
||||
|
||||
utf8Bytes = unitName.getBytes("UTF-8");
|
||||
utf8unitName = new String(utf8Bytes, "UTF-8");
|
||||
filepath = Constants.FILE_STORAGE+"\\PART_DATA\\";
|
||||
filepathFull = filepath+projectNo+File.separator+unitName+File.separator;
|
||||
utf8unitName = new String(utf8Bytes, "UTF-8");
|
||||
filepath = Constants.FILE_STORAGE+"\\PART_DATA\\";
|
||||
filepathFull = filepath+projectNo+File.separator+unitName+File.separator;
|
||||
|
||||
//BOM REPORT OBJID
|
||||
objid = CommonUtils.createObjId(); //키 새로 생성
|
||||
objid = CommonUtils.createObjId(); //키 새로 생성
|
||||
sqlMap.clear();
|
||||
sqlMap.put("OBJID", objid);
|
||||
sqlMap.put("MULTI_YN", "Y");
|
||||
@@ -3845,107 +4038,75 @@ public class PartMngService extends BaseService {
|
||||
//엑셀 등록
|
||||
//sqlSession.insert("partMng.relateexcelPartInfo", sqlMap);
|
||||
}
|
||||
*/
|
||||
|
||||
Map insertMap = new HashMap();
|
||||
Map resultMap = new HashMap();
|
||||
Map partobjMap = new HashMap();
|
||||
String newPartNo1 = "";
|
||||
//bom qty/part insert
|
||||
|
||||
//bom qty/part insert (프로젝트 연결 없이 직접 저장)
|
||||
for(int i=0; i<gridDataList.size(); i++){
|
||||
Map orgMap = gridDataList.get(i);
|
||||
insertMap.clear();
|
||||
//resultMap.clear();
|
||||
//partobjMap.clear();
|
||||
//insertMap.putAll(orgMap);
|
||||
CommonUtils.copyMap(insertMap, orgMap, true, false);
|
||||
|
||||
String part_no = ""; //part_objid
|
||||
String parent_part_no = "";
|
||||
|
||||
String PART_NO = CommonUtils.checkNull((String)insertMap.get("PART_NO")); //part_no
|
||||
String PARENT_PART_NO = CommonUtils.checkNull((String)insertMap.get("PARENT_PART_NO")); //PARENT_PART_NO
|
||||
if(i == 0){ //1레벨은 part_no를 해당 project no로 변경
|
||||
if(isMaster){
|
||||
//RSA1-176-200-001
|
||||
if(PART_NO.lastIndexOf("-") > -1){
|
||||
newPartNo1Surffix = PART_NO.substring(PART_NO.lastIndexOf("-"));
|
||||
}
|
||||
masterPartNo1 = PART_NO;
|
||||
}else {
|
||||
PART_NO = projectNo; // + newPartNo1Surffix;
|
||||
newPartNo1 = PART_NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String part_no = "";
|
||||
String PART_NO = CommonUtils.checkNull((String)insertMap.get("PART_NO"));
|
||||
String PARENT_PART_NO = CommonUtils.checkNull((String)insertMap.get("PARENT_PART_NO"));
|
||||
|
||||
/*
|
||||
if(!isMaster && i == 0) { //PART_NO.equals(masterProjectNo)
|
||||
insertMap.put("PART_NO", projectNo); //1레벨은 part_no를 해당 project no로 변경
|
||||
}
|
||||
*/
|
||||
|
||||
insertMap.put("OBJID", CommonUtils.createObjId());
|
||||
insertMap.put("BOM_REPORT_OBJID", objid);
|
||||
//insertMap.put("OBJID", CommonUtils.createObjId());
|
||||
// if(i == 1 && !isMaster){//sub BOM들은 1레벨 part_no가 바뀌어서 변경
|
||||
// insertMap.put("PARENT_PART_NO", CommonUtils.checkNull(newPartNo1));
|
||||
// }else {
|
||||
// }
|
||||
if(isMaster){
|
||||
insertMap.put("PARENT_PART_NO", PARENT_PART_NO); //PARENT_PART_NOT_NO
|
||||
}else {
|
||||
insertMap.put("PARENT_PART_NO", PARENT_PART_NO.equals(masterPartNo1) ? newPartNo1 : PARENT_PART_NO); //sub BOM들은 1레벨 part_no가 바뀌어서 변경
|
||||
}
|
||||
insertMap.put("PART_NO", PART_NO);
|
||||
insertMap.put("PART_NAME", CommonUtils.checkNull((String)insertMap.get("PART_NAME")));
|
||||
//insertMap.put("PART_NAME", java.util.regex.Matcher.quoteReplacement(CommonUtils.checkNull((String)insertMap.get("PART_NAME"))));
|
||||
insertMap.put("QTY", CommonUtils.checkNull((String)insertMap.get("QTY")));
|
||||
insertMap.put("UNIT", CommonUtils.checkNull((String)insertMap.get("UNIT")));
|
||||
insertMap.put("SPEC", CommonUtils.checkNull((String)insertMap.get("SPEC")));
|
||||
insertMap.put("MATERIAL", CommonUtils.checkNull((String)insertMap.get("MATERIAL")));
|
||||
insertMap.put("THICKNESS", CommonUtils.checkNull((String)insertMap.get("THICKNESS")));
|
||||
insertMap.put("WIDTH", CommonUtils.checkNull((String)insertMap.get("WIDTH")));
|
||||
insertMap.put("HEIGHT", CommonUtils.checkNull((String)insertMap.get("HEIGHT")));
|
||||
insertMap.put("OUT_DIAMETER", CommonUtils.checkNull((String)insertMap.get("OUT_DIAMETER")));
|
||||
insertMap.put("IN_DIAMETER", CommonUtils.checkNull((String)insertMap.get("IN_DIAMETER")));
|
||||
insertMap.put("LENGTH", CommonUtils.checkNull((String)insertMap.get("LENGTH")));
|
||||
insertMap.put("PART_TYPE", CommonUtils.checkNull((String)insertMap.get("PART_TYPE")));
|
||||
insertMap.put("REMARK", CommonUtils.checkNull((String)insertMap.get("REMARK")));
|
||||
insertMap.put("SUPPLY_CODE", CommonUtils.checkNull((String)insertMap.get("SUP_CODE")));
|
||||
insertMap.put("MAKER", CommonUtils.checkNull((String)insertMap.get("MAKER")));
|
||||
insertMap.put("POST_PROCESSING", CommonUtils.checkNull((String)insertMap.get("POST_PROCESSING")));
|
||||
|
||||
insertMap.put("CONTRACT_OBJID", CommonUtils.checkNull((String)paramMap.get("CONTRACT_OBJID")));
|
||||
insertMap.put("PRODUCT_MGMT_OBJID", CommonUtils.checkNull((String)paramMap.get("product_mgmt_objid")));
|
||||
insertMap.put("CONNECTUSERID", CommonUtils.checkNull((String)paramMap.get("CONNECTUSERID")));
|
||||
|
||||
partobjMap.put("PART_NO", PART_NO);
|
||||
resultMap = (HashMap)sqlSession.selectOne("partMng.getPartObjid", partobjMap); //part_no로 is_last = 1 건 조회
|
||||
if(null!=resultMap){
|
||||
part_no = CommonUtils.checkNull((String)resultMap.get("part_objid"));
|
||||
}else{
|
||||
part_no = CommonUtils.createObjId();
|
||||
//PART저장
|
||||
insertMap.put("PART_OBJID", part_no);
|
||||
sqlSession.insert("partMng.insertpartInfo", insertMap);
|
||||
insertMap.put("OBJID", CommonUtils.createObjId());
|
||||
insertMap.put("BOM_REPORT_OBJID", objid);
|
||||
insertMap.put("PARENT_PART_NO", PARENT_PART_NO);
|
||||
insertMap.put("PART_NO", PART_NO);
|
||||
insertMap.put("PART_NAME", CommonUtils.checkNull((String)insertMap.get("PART_NAME")));
|
||||
insertMap.put("QTY", CommonUtils.checkNull((String)insertMap.get("QTY")));
|
||||
insertMap.put("UNIT", CommonUtils.checkNull((String)insertMap.get("UNIT")));
|
||||
insertMap.put("SPEC", CommonUtils.checkNull((String)insertMap.get("SPEC")));
|
||||
insertMap.put("MATERIAL", CommonUtils.checkNull((String)insertMap.get("MATERIAL")));
|
||||
insertMap.put("THICKNESS", CommonUtils.checkNull((String)insertMap.get("THICKNESS")));
|
||||
insertMap.put("WIDTH", CommonUtils.checkNull((String)insertMap.get("WIDTH")));
|
||||
insertMap.put("HEIGHT", CommonUtils.checkNull((String)insertMap.get("HEIGHT")));
|
||||
insertMap.put("OUT_DIAMETER", CommonUtils.checkNull((String)insertMap.get("OUT_DIAMETER")));
|
||||
insertMap.put("IN_DIAMETER", CommonUtils.checkNull((String)insertMap.get("IN_DIAMETER")));
|
||||
insertMap.put("LENGTH", CommonUtils.checkNull((String)insertMap.get("LENGTH")));
|
||||
insertMap.put("PART_TYPE", CommonUtils.checkNull((String)insertMap.get("PART_TYPE")));
|
||||
insertMap.put("REMARK", CommonUtils.checkNull((String)insertMap.get("REMARK")));
|
||||
insertMap.put("SUPPLY_CODE", CommonUtils.checkNull((String)insertMap.get("SUP_CODE")));
|
||||
insertMap.put("MAKER", CommonUtils.checkNull((String)insertMap.get("MAKER")));
|
||||
insertMap.put("POST_PROCESSING", CommonUtils.checkNull((String)insertMap.get("POST_PROCESSING")));
|
||||
|
||||
insertMap.put("CONTRACT_OBJID", CommonUtils.checkNull((String)paramMap.get("CONTRACT_OBJID")));
|
||||
insertMap.put("PRODUCT_MGMT_OBJID", CommonUtils.checkNull((String)paramMap.get("product_mgmt_objid")));
|
||||
insertMap.put("CONNECTUSERID", CommonUtils.checkNull((String)paramMap.get("CONNECTUSERID")));
|
||||
|
||||
Map fileMap = new HashMap();
|
||||
fileMap.put("FILE_PATH",filepathFull);
|
||||
fileMap.put("WRITER",(String)paramMap.get("CONNECTUSERID"));
|
||||
partobjMap.put("PART_NO", PART_NO);
|
||||
resultMap = (HashMap)sqlSession.selectOne("partMng.getPartObjid", partobjMap); //part_no로 is_last = 1 건 조회
|
||||
if(null!=resultMap){
|
||||
part_no = CommonUtils.checkNull((String)resultMap.get("part_objid"));
|
||||
}else{
|
||||
part_no = CommonUtils.createObjId();
|
||||
//PART저장
|
||||
insertMap.put("PART_OBJID", part_no);
|
||||
sqlSession.insert("partMng.insertpartInfo", insertMap);
|
||||
|
||||
// 파일 저장 부분 주석처리 (프로젝트 경로 정보 없음)
|
||||
/*
|
||||
Map fileMap = new HashMap();
|
||||
fileMap.put("FILE_PATH",filepathFull);
|
||||
fileMap.put("WRITER",(String)paramMap.get("CONNECTUSERID"));
|
||||
|
||||
//첨부저장 PDF 저장
|
||||
//sqlSession.insert("part.insertpartfileInfo", fileMap);
|
||||
|
||||
//dwg
|
||||
fileMap.put("OBJID", CommonUtils.createObjId());
|
||||
fileMap.put("TARGET_OBJID", part_no);
|
||||
fileMap.put("SAVED_FILE_NAME", CommonUtils.checkNull((String)insertMap.get("PART_NO")+".dwg"));
|
||||
fileMap.put("REAL_FILE_NAME",CommonUtils.checkNull((String)insertMap.get("PART_NO")+".dwg"));
|
||||
fileMap.put("DOC_TYPE" ,"2D_DRAWING_CAD");
|
||||
fileMap.put("DOC_TYPE_NAME","2D(Drawing) CAD 첨부파일");
|
||||
fileMap.put("FILE_SIZE","167941");
|
||||
fileMap.put("FILE_EXT","DWG");
|
||||
//첨부저장 PDF 저장
|
||||
//sqlSession.insert("part.insertpartfileInfo", fileMap);
|
||||
|
||||
//dwg
|
||||
fileMap.put("OBJID", CommonUtils.createObjId());
|
||||
fileMap.put("TARGET_OBJID", part_no);
|
||||
fileMap.put("SAVED_FILE_NAME", CommonUtils.checkNull((String)insertMap.get("PART_NO")+".dwg"));
|
||||
fileMap.put("REAL_FILE_NAME",CommonUtils.checkNull((String)insertMap.get("PART_NO")+".dwg"));
|
||||
fileMap.put("DOC_TYPE" ,"2D_DRAWING_CAD");
|
||||
fileMap.put("DOC_TYPE_NAME","2D(Drawing) CAD 첨부파일");
|
||||
fileMap.put("FILE_SIZE","167941");
|
||||
fileMap.put("FILE_EXT","DWG");
|
||||
|
||||
System.out.println("fileMap --->"+ fileMap);
|
||||
System.out.println(filepathFull+CommonUtils.checkNull((String)insertMap.get("PART_NO")+".dwg"));
|
||||
@@ -3976,8 +4137,10 @@ public class PartMngService extends BaseService {
|
||||
//첨부저장이 존재 할때만 DWG 저장
|
||||
sqlSession.insert("part.insertpartfileInfo", fileMap);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
String parent_part_no = "";
|
||||
partobjMap.put("PART_NO", CommonUtils.checkNull((String)insertMap.get("PARENT_PART_NO")));
|
||||
resultMap = (HashMap)sqlSession.selectOne("partMng.getPartObjid", partobjMap);
|
||||
if(null!=resultMap){
|
||||
@@ -4001,14 +4164,6 @@ public class PartMngService extends BaseService {
|
||||
|
||||
System.out.println(" insertMap--->"+insertMap);
|
||||
|
||||
/* #{BOM_REPORT_OBJID},
|
||||
#{OBJID},
|
||||
#{PARENT_OBJID},
|
||||
#{CHILD_OBJID},
|
||||
#{PARENT_PART_NO},
|
||||
#{PART_NO},
|
||||
#{QTY}::INTEGER,*/
|
||||
|
||||
//BOM저장
|
||||
//BOM에 구조 추가할경우 상태값 변경
|
||||
if(!"".equals(bomobjid)){
|
||||
@@ -4020,8 +4175,6 @@ public class PartMngService extends BaseService {
|
||||
|
||||
sqlSession.insert("partMng.relatePartInfo", insertMap);
|
||||
}//end of gridDataList
|
||||
}//end of APPLICATION_PROJECT_NO
|
||||
}//end of j<11
|
||||
|
||||
sqlSession.commit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user