봄 복사기능 추가
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
<script type="text/javascript">
|
||||
var grid;
|
||||
$(document).ready(function(){
|
||||
|
||||
$('.select2').select2();
|
||||
// 품번/품명 Select2 AJAX 초기화 (common.js의 새 함수 사용)
|
||||
// initPartSelect2Ajax("#bom_part_no", "#bom_part_name", "#bom_part_objid", {
|
||||
// debug: false // 디버깅 모드 비활성화
|
||||
@@ -173,6 +173,43 @@ $(document).ready(function(){
|
||||
location.href="/template/BOM_REPORT_EXCEL_IMPORT_TEMPLATE.xlsx";
|
||||
});
|
||||
|
||||
// BOM 복사 버튼 클릭
|
||||
$("#btnCopyBom").click(function(){
|
||||
var bomObjid = $("#copy_bom_select").val();
|
||||
//alert(bomObjid);
|
||||
if(!bomObjid || bomObjid == "") {
|
||||
Swal.fire("복사할 BOM을 선택하세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 기존 그리드 데이터 초기화
|
||||
grid.jqGrid('clearGridData');
|
||||
|
||||
// BOM 데이터 조회 및 로드
|
||||
$.ajax({
|
||||
url: "/partMng/getBomDataForCopy.do",
|
||||
type: "POST",
|
||||
data: {"BOM_REPORT_OBJID": bomObjid},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data && data.length > 0){
|
||||
// jqGrid에 데이터 추가
|
||||
for(var i=0; i<data.length; i++){
|
||||
grid.jqGrid('addRowData', i+1, data[i]);
|
||||
}
|
||||
gridFn.opennEdit(); // 수정 가능하도록
|
||||
Swal.fire("BOM 데이터를 불러왔습니다.");
|
||||
} else {
|
||||
Swal.fire("선택한 BOM에 데이터가 없습니다.");
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
Swal.fire('BOM 데이터 조회 중 오류가 발생했습니다.');
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//var unit_cd = $.parseJSON($("#unit_cd").val()); //jqGrid 구분
|
||||
var part_type = $.parseJSON($("#part_type").val()); //jqGrid 구분
|
||||
//var sup_code = $.parseJSON($("#sup_code").val()); //jqGrid 구분
|
||||
@@ -819,67 +856,49 @@ function fn_save(){
|
||||
|
||||
<div style="font-size:10px;float:left;margin:13px 13px 5px 13px">
|
||||
<table class="" style="border:0px solid #dd2a00;">
|
||||
<colgroup>
|
||||
<col width="40px">
|
||||
<col width="180px">
|
||||
|
||||
<col width="100px">
|
||||
<col width="220px">
|
||||
|
||||
<col width="100px">
|
||||
<col width="150px">
|
||||
|
||||
<col width="50px">
|
||||
<col width="150px">
|
||||
|
||||
<col width="40px">
|
||||
<col width="150px">
|
||||
|
||||
<col width="200px">
|
||||
</colgroup>
|
||||
<tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<td style="font-size:12px;width: 70px;"><label for="product_cd">제품구분</label></td>
|
||||
<colgroup>
|
||||
<col width="100px">
|
||||
<col width="180px">
|
||||
<col width="70px">
|
||||
<col width="180px">
|
||||
<col width="70px">
|
||||
<col width="180px">
|
||||
<col width="70px">
|
||||
<col width="150px">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td style="font-size:12px;"><label for="product_cd">제품구분</label></td>
|
||||
<td>
|
||||
<select name="product_cd" id="product_cd" required style="width: 150px;">
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
<select name="product_cd" id="product_cd" required reqTitle="제품구분" style="width: 170px;" class="select2">
|
||||
<option value="">선택</option>
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<!-- <td style="font-size:12px;width: 70px;" class="align_c">
|
||||
<label for="" class="">품번</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="part_no" id="part_no" class="select2-part" style="">
|
||||
<option value="">품번 선택</option>
|
||||
</select>
|
||||
<input type="hidden" name="part_objid" id="part_objid" value=""/>
|
||||
</td>
|
||||
<td style="font-size:12px;width: 70px;" class="align_c">
|
||||
<label for="" class="">품명</label>
|
||||
</td>
|
||||
<td colspan="">
|
||||
<select name="part_name" id="part_name" class="select2-part" style="">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
</td> -->
|
||||
|
||||
<td style="font-size:12px;width: 70px;" class="align_c"><label for="bom_part_no">품번</label></td>
|
||||
<td>
|
||||
<input type="text" name="bom_part_no" id="bom_part_no" required value="${param.bom_part_no}"/>
|
||||
</td>
|
||||
<td style="font-size:12px;width: 70px;" class="align_c"><label for="bom_part_name">품명</label></td>
|
||||
<td>
|
||||
<input type="text" name="bom_part_name" id="bom_part_name" requiredvalue="${param.bom_part_name}"/>
|
||||
</td>
|
||||
|
||||
<td style="font-size:12px;width: 70px;" class="align_c"><label for="version">Version</label></td>
|
||||
<td>
|
||||
<input type="text" name="version" id="version" value="${param.version}"/>
|
||||
</td>
|
||||
<td style="font-size:12px;" class="align_c"><label for="bom_part_no">품번</label></td>
|
||||
<td>
|
||||
<input type="text" name="bom_part_no" id="bom_part_no" required reqTitle="품번" value="${param.bom_part_no}" style="width: 170px;"/>
|
||||
</td>
|
||||
<td style="font-size:12px;" class="align_c"><label for="bom_part_name">품명</label></td>
|
||||
<td>
|
||||
<input type="text" name="bom_part_name" id="bom_part_name" required reqTitle="품명" value="${param.bom_part_name}" style="width: 170px;"/>
|
||||
</td>
|
||||
<td style="font-size:12px;" class="align_c"><label for="version">Version</label></td>
|
||||
<td>
|
||||
<input type="text" name="version" id="version" reqTitle="Version" value="${param.version}" style="width: 140px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size:12px;"><label for="copy_bom_select">E-BOM 복사 대상</label></td>
|
||||
<td colspan="5">
|
||||
<select name="copy_bom_select" id="copy_bom_select" style="width: 600px;" class="select2">
|
||||
<option value="">선택</option>
|
||||
${code_map.bom_list}
|
||||
</select>
|
||||
</td>
|
||||
<td colspan="2" style="text-align:center;">
|
||||
<input type="button" class="plm_btns" value="복사" id="btnCopyBom" style="width: 80px;">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- <td style="font-size:12px;"><label for="street_number">고객사</label></td>
|
||||
<td>
|
||||
|
||||
@@ -1587,6 +1587,9 @@ public class PartMngController {
|
||||
param.put("parentCodeId", "0000062");
|
||||
code_map.put("part_type", commonService.getJqGridSelectBoxJsonData("common.getCodeList2", param, "선택"));
|
||||
code_map.put("sup_code", commonService.getJqGridSelectBoxJsonData("common.getmatersupplyselect", param, "선택"));
|
||||
|
||||
// 활성화된 BOM 목록 전달 (복사용) - bizMakeOptionList 사용
|
||||
code_map.put("bom_list", commonService.bizMakeOptionList("", "", "partMng.getActiveBomList"));
|
||||
|
||||
bomInfo = partMngService.getBOMStructureStandardInfo(request, paramMap);
|
||||
if(bomInfo == null) bomInfo = new HashMap();
|
||||
@@ -1650,6 +1653,21 @@ public class PartMngController {
|
||||
return parsingPartList;
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM 복사를 위한 데이터 조회 (엑셀 파싱 형식과 동일하게 반환)
|
||||
*/
|
||||
@RequestMapping("/partMng/getBomDataForCopy.do")
|
||||
@ResponseBody
|
||||
public ArrayList getBomDataForCopy(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
||||
ArrayList bomDataList = new ArrayList();
|
||||
try{
|
||||
bomDataList = (ArrayList)partMngService.getBomDataForCopy(request, paramMap);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return bomDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* BOM 파트&구조 저장
|
||||
*/
|
||||
|
||||
@@ -2885,6 +2885,48 @@ SELECT T1.LEV, T1.BOM_REPORT_OBJID, T1.ROOT_PART_NO, T1.PATH, T1.LEAF, T2.*
|
||||
|
||||
|
||||
<!-- //bomObjId를 통해 BOM 구조등록 기본정보 조회 -->
|
||||
<!-- 활성화된 BOM 목록 조회 (셀렉트박스용) -->
|
||||
<select id="getActiveBomList" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
OBJID AS CODE,
|
||||
COALESCE(PART_NO, '') || ' - ' || COALESCE(PART_NAME, '') ||
|
||||
CASE WHEN REVISION IS NOT NULL AND REVISION != '' THEN ' (Rev.' || REVISION || ')' ELSE '' END AS NAME
|
||||
FROM PART_BOM_REPORT
|
||||
WHERE STATUS = 'Y'
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
<!-- BOM 복사를 위한 파트 목록 조회 -->
|
||||
<select id="getBomPartListForCopy" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
BPQ.PARENT_PART_NO,
|
||||
PM.PART_NO,
|
||||
PM.PART_NAME,
|
||||
BPQ.QTY,
|
||||
BPQ.ITEM_QTY,
|
||||
PM.MATERIAL,
|
||||
PM.HEAT_TREATMENT_HARDNESS,
|
||||
PM.HEAT_TREATMENT_METHOD,
|
||||
PM.SURFACE_TREATMENT,
|
||||
BPQ.SUPPLIER,
|
||||
PM.PART_TYPE
|
||||
FROM BOM_PART_QTY BPQ
|
||||
LEFT JOIN PART_MNG PM ON BPQ.PART_NO = PM.OBJID::VARCHAR AND PM.IS_LAST = '1'
|
||||
WHERE BPQ.BOM_REPORT_OBJID = #{BOM_REPORT_OBJID}
|
||||
AND (BPQ.STATUS IS NULL OR BPQ.STATUS != 'deleted')
|
||||
ORDER BY BPQ.SEQ
|
||||
</select>
|
||||
|
||||
<!-- OBJID로 파트 정보 조회 -->
|
||||
<select id="getPartInfoByObjid" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
PART_NO,
|
||||
PART_NAME
|
||||
FROM PART_MNG
|
||||
WHERE OBJID = #{OBJID}
|
||||
AND IS_LAST = '1'
|
||||
</select>
|
||||
|
||||
<select id="getBOMStructureStandardInfoByObjId" parameterType="string" resultType="map">
|
||||
SELECT
|
||||
OBJID,
|
||||
|
||||
@@ -3149,7 +3149,76 @@ public class PartMngService extends BaseService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* BOM 복사를 위한 데이터 조회 (엑셀 파싱 형식과 동일하게 반환)
|
||||
*/
|
||||
public ArrayList getBomDataForCopy(HttpServletRequest request, Map paramMap) throws Exception{
|
||||
ArrayList resultList = new ArrayList();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
String bomReportObjid = CommonUtils.checkNull((String)paramMap.get("BOM_REPORT_OBJID"));
|
||||
|
||||
if(StringUtils.isBlank(bomReportObjid)){
|
||||
return resultList;
|
||||
}
|
||||
|
||||
// BOM 구조 데이터 조회 (BOM_PART_QTY 테이블에서 직접 조회)
|
||||
Map sqlParam = new HashMap();
|
||||
sqlParam.put("BOM_REPORT_OBJID", bomReportObjid);
|
||||
System.out.println("BOM_REPORT_OBJID: " + bomReportObjid);
|
||||
List<Map> bomPartList = sqlSession.selectList("partMng.getBomPartListForCopy", sqlParam);
|
||||
System.out.println("bomPartList size: " + bomPartList.size());
|
||||
|
||||
// 엑셀 파싱 형식으로 변환
|
||||
for(Map bomData : bomPartList){
|
||||
// PostgreSQL 소문자 결과를 대문자로 변환
|
||||
bomData = CommonUtils.toUpperCaseMapKey(bomData);
|
||||
|
||||
Map partMap = new HashMap();
|
||||
|
||||
// 모품번 조회 (PARENT_PART_NO가 OBJID이므로 실제 품번을 조회)
|
||||
String parentPartNo = "";
|
||||
if(!StringUtils.isBlank((String)bomData.get("PARENT_PART_NO"))){
|
||||
Map parentParam = new HashMap();
|
||||
parentParam.put("OBJID", bomData.get("PARENT_PART_NO"));
|
||||
Map parentPart = (Map)sqlSession.selectOne("partMng.getPartInfoByObjid", parentParam);
|
||||
if(parentPart != null){
|
||||
// PostgreSQL 소문자 결과를 대문자로 변환
|
||||
parentPart = CommonUtils.toUpperCaseMapKey(parentPart);
|
||||
parentPartNo = CommonUtils.checkNull(parentPart.get("PART_NO"));
|
||||
}
|
||||
}
|
||||
|
||||
partMap.put("PARENT_PART_NO", parentPartNo);
|
||||
partMap.put("PART_NO", CommonUtils.checkNull(bomData.get("PART_NO")));
|
||||
partMap.put("PART_NAME", CommonUtils.checkNull(bomData.get("PART_NAME")));
|
||||
partMap.put("QTY", CommonUtils.checkNull(bomData.get("QTY")));
|
||||
partMap.put("ITEM_QTY", CommonUtils.checkNull(bomData.get("ITEM_QTY")));
|
||||
partMap.put("MATERIAL", CommonUtils.checkNull(bomData.get("MATERIAL")));
|
||||
partMap.put("HEAT_TREATMENT_HARDNESS", CommonUtils.checkNull(bomData.get("HEAT_TREATMENT_HARDNESS")));
|
||||
partMap.put("HEAT_TREATMENT_METHOD", CommonUtils.checkNull(bomData.get("HEAT_TREATMENT_METHOD")));
|
||||
partMap.put("SURFACE_TREATMENT", CommonUtils.checkNull(bomData.get("SURFACE_TREATMENT")));
|
||||
partMap.put("SUPPLIER", CommonUtils.checkNull(bomData.get("SUPPLIER")));
|
||||
partMap.put("PART_TYPE", CommonUtils.checkNull(bomData.get("PART_TYPE")));
|
||||
partMap.put("NOTE", ""); // 복사 시 NOTE는 빈 값
|
||||
|
||||
resultList.add(partMap);
|
||||
}
|
||||
|
||||
} catch(Exception e){
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} finally {
|
||||
if(sqlSession != null){
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 업로드된 Excel File을 통해 데이터를 Parsing 한다.(구조(bom)등록)
|
||||
* @param request
|
||||
|
||||
Reference in New Issue
Block a user