V2025111901 #76

Merged
hjjeong merged 2 commits from V2025111901 into main 2025-11-25 09:32:34 +00:00
9 changed files with 161 additions and 39 deletions
Showing only changes of commit 884dc44dd1 - Show all commits

View File

@@ -717,11 +717,11 @@ function fn_excel() {
<tr>
<td class="input_title"><label for="COPY_PART_NO">품번</label></td>
<td>
<input type="text" id="COPY_PART_NO" name="COPY_PART_NO" style="width: 100%;">
<input type="text" id="COPY_PART_NO" name="COPY_PART_NO" style="width: 100%;" readonly>
</td>
<td class="input_title"><label for="COPY_PART_NAME">품명</label></td>
<td>
<input type="text" id="COPY_PART_NAME" name="COPY_PART_NAME" style="width: 100%;">
<input type="text" id="COPY_PART_NAME" name="COPY_PART_NAME" style="width: 100%;" readonly>
</td>
<td></td>
<td style="text-align: center;">

View File

@@ -58,6 +58,7 @@ $(function(){
// 저장된 M-BOM 품번 조회 및 표시
var projectObjId = "${info.OBJID}";
$.ajax({
url: "/productionplanning/getLatestMbomByProjectId.do",
type: "POST",
@@ -68,7 +69,29 @@ $(function(){
if(response && response.MBOM_NO) {
console.log("저장된 M-BOM 발견:", response);
$("#search_mbom_part_no").val(response.MBOM_NO);
$("#search_save_date").val(response.REGDATE);
// 날짜 형식 변환 (타임스탬프 또는 문자열 -> YYYY-MM-DD)
var regDate = response.REGDATE;
if(regDate) {
var dateStr = "";
// 타임스탬프(숫자)인 경우
if(typeof regDate === 'number') {
var date = new Date(regDate);
var year = date.getFullYear();
var month = String(date.getMonth() + 1).padStart(2, '0');
var day = String(date.getDate()).padStart(2, '0');
dateStr = year + '-' + month + '-' + day;
}
// 문자열인 경우 (YYYY-MM-DD HH:mm:ss 형식)
else if(typeof regDate === 'string') {
dateStr = regDate.split(' ')[0];
}
$("#search_save_date").val(dateStr);
} else {
$("#search_save_date").val("");
}
} else {
console.log("저장된 M-BOM 없음");
$("#search_mbom_part_no").val("");
@@ -126,7 +149,7 @@ $(function(){
// 닫기 버튼 클릭
$("#btnClose").click(function(){
window.close();
fn_closeWindow();
});
// 일괄 적용 버튼 클릭
@@ -306,7 +329,7 @@ function fn_saveMbom() {
}
// 현재 창 닫기
window.close();
fn_closeWindow();
} else {
alert("M-BOM 저장에 실패했습니다: " + (data.message || ""));
}
@@ -792,30 +815,30 @@ function compareItemFields(before, after) {
<tr>
<td><label for="search_part_no">품번</label></td>
<td>
<input type="text" name="search_part_no" id="search_part_no" value="">
<input type="text" name="search_part_no" id="search_part_no" style="width: 300px;" value="" readonly>
</td>
<td class="label"><label for="search_part_name">품명</label></td>
<td>
<input type="text" name="search_part_name" id="search_part_name" value="">
<input type="text" name="search_part_name" id="search_part_name" style="width: 300px;" value="" readonly>
</td>
</tr>
<tr>
<td><label for="search_mbom_part_no">M-BOM 품번</label></td>
<td>
<input type="text" name="search_mbom_part_no" id="search_mbom_part_no" value="">
<input type="text" name="search_mbom_part_no" id="search_mbom_part_no" style="width: 300px;" value="" readonly>
</td>
<td class="label"><label for="search_save_date">저장일</label></td>
<td>
<input type="date" name="search_save_date" id="search_save_date" value="">
<input type="text" name="search_save_date" id="search_save_date" style="width: 300px;" value="" readonly>
</td>
<td style="width: 40px;"></td>
<td >
<input type="button" value="이력보기" class="plm_btns" id="btnHistory">
<input type="button" value="저장" class="plm_btns" id="btnSave">
<input type="button" value="닫기" class="plm_btns" id="btnClose">
</td>
<td>
<input type="button" value="이력보기" class="plm_btns" id="btnHistory">
<input type="button" value="저장" class="plm_btns" id="btnSave">
<input type="button" value="닫기" class="plm_btns" id="btnClose">
</td>
</tr>
<tr>
<td><label for="bulk_processing_deadline">가공납기 일괄</label></td>
@@ -827,7 +850,7 @@ function compareItemFields(before, after) {
<td>
<input type="date" name="bulk_grinding_deadline" id="bulk_grinding_deadline" value="">
</td>
<td style="width: 40px;"></td>
<td>
<input type="button" value="일괄 적용" class="plm_btns" id="btnApplyBulkDeadline">
</td>
@@ -1087,6 +1110,27 @@ function fn_mbomChangePart() {
function generateTempId() {
return -Math.floor(Math.random() * 1000000000);
}
// 창 닫기 함수 (프레임 구조 고려)
function fn_closeWindow() {
try {
// 최상위 창(frameset)을 닫기
if(window.top && window.top.opener) {
// 팝업으로 열린 경우
window.top.close();
} else if(window.parent && window.parent !== window) {
// 프레임 내부인 경우 최상위 창 닫기 시도
window.top.close();
} else {
// 일반 창인 경우
window.close();
}
} catch(e) {
console.error("창 닫기 오류:", e);
// 오류 발생 시 강제로 닫기 시도
window.top.close();
}
}
</script>
</body>

View File

@@ -373,12 +373,12 @@ function fn_changeRelatePartInfo(objId,rightObjId,leftObjId,leftPartNoQty,leftPa
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objId" id="objId" value="${param.objId}" />
<div id="structurePopupBtnW" style="padding-top:20px;">
<div id="structurePopupBtnW" style="padding-top:300px;">
<input type="button" value="변경" class="plm_btns" id="moveChange">
<br>
<input type="button" value="<<" class="plm_btns" id="moveLeft" style="margin-left:0px;">
<input type="button" value="<<" class="plm_btns" id="moveLeft" style="margin-left:4px;">
<br>
<input type="button" value=">>" class="plm_btns" id="moveRight" style="margin-left:0px;">
<input type="button" value=">>" class="plm_btns" id="moveRight" style="margin-left:4px;">
</div>
</form>
</body>

View File

@@ -613,7 +613,7 @@ function fn_initGrid() {
// Tabulator 생성
_tabulGrid = new Tabulator("#mBomTableWrap", {
layout: "fitData",
height: "calc(100vh - 150px)",
height: "calc(100vh - 70px)",
columns: columns,
data: bomTreeData,
rowFormatter: function(row) {

View File

@@ -10,26 +10,27 @@
<style>
body, html {
margin: 0;
padding: 10px;
/* padding: 10px; */
height: 100%;
overflow: hidden;
}
#plmSearchZon {
/* #plmSearchZon {
margin-bottom: 10px;
}
} */
#plmSearchZon table {
width: 100%;
table-layout: auto !important;
}
#plmSearchZon td {
/* #plmSearchZon td {
padding: 2px 5px;
}
} */
#plmSearchZon td.label,
#plmSearchZon td:first-child {
text-align: right;
padding-right: 5px;
}
#ebomTable {
height: 540px;
height: 600px !important;
}
</style>
<link href="/css/tabulator/tabulator.min.css" rel="stylesheet">
@@ -43,23 +44,23 @@ body, html {
<tr>
<td><label for="search_part_no">품번</label></td>
<td>
<input type="text" name="search_part_no" id="search_part_no" value="">
<input type="text" name="search_part_no" id="search_part_no" style="width: 100%;" value="">
</td>
<td class="label"><label for="search_part_name">품명</label></td>
<td>
<input type="text" name="search_part_name" id="search_part_name" value="">
<input type="text" name="search_part_name" id="search_part_name" style="width: 98%;"value="">
</td>
</tr>
<tr>
<td><label for="search_material">재료</label></td>
<td>
<input type="text" name="search_material" id="search_material" value="">
<input type="text" name="search_material" id="search_material" style="width: 100%;" value="">
</td>
<td class="label"><label for="search_supplier">공급업체</label></td>
<td class="label"><label for="search_supplier">메이커</label></td>
<td>
<input type="text" name="search_supplier" id="search_supplier" value="">
<input type="text" name="search_supplier" id="search_supplier" style="width: 98%;" value="">
</td>
<td>
@@ -84,7 +85,7 @@ body, html {
<option value="200">200</option>
<option value="1000">1000</option>
</select>
<div class="table_Status" style="font-size: 12px;">
<div class="table_Status" style="font-size: 12px; margin-right: 10px;">
<b id="bTableStatus">0</b> 건
</div>
</div>
@@ -126,7 +127,7 @@ function initEbomTable() {
{title: "품번", field: "PART_NO", widthGrow: 1.5, vertAlign:"middle"},
{title: "품명", field: "PART_NAME", widthGrow: 2, vertAlign:"middle"},
{title: "재료", field: "MATERIAL", widthGrow: 1.2, vertAlign:"middle"},
{title: "공급업체", field: "SUPPLIER", widthGrow: 1.5, vertAlign:"middle"}
{title: "메이커", field: "MAKER", widthGrow: 1.5, vertAlign:"middle"}
],
placeholder: "검색 결과가 없습니다."
});
@@ -198,15 +199,32 @@ function updatePagination() {
$("#bTableStatus").text(allData.length);
// 페이지 버튼 생성
// 페이지 버튼 생성 (10개씩만 표시)
var pagingHtml = '';
for(var i = 1; i <= totalPages; i++) {
var pageGroupSize = 10; // 한 번에 표시할 페이지 수
var currentGroup = Math.ceil(currentPage / pageGroupSize);
var startPage = (currentGroup - 1) * pageGroupSize + 1;
var endPage = Math.min(startPage + pageGroupSize - 1, totalPages);
// 이전 그룹 버튼
if(startPage > 1) {
pagingHtml += '<input type="button" name="mailPaging" class="paging" onclick="javascript:fnc_goPage(' + (startPage - 1) + ');" value="&lt;">';
}
// 페이지 번호 버튼
for(var i = startPage; i <= endPage; i++) {
if(i === currentPage) {
pagingHtml += '<input type="button" name="mailPaging" class="paging selected" value="' + i + '">';
} else {
pagingHtml += '<input type="button" name="mailPaging" class="paging" onclick="javascript:fnc_goPage(' + i + ');" value="' + i + '">';
}
}
// 다음 그룹 버튼
if(endPage < totalPages) {
pagingHtml += '<input type="button" name="mailPaging" class="paging" onclick="javascript:fnc_goPage(' + (endPage + 1) + ');" value="&gt;">';
}
$("#pagingButtons").html(pagingHtml);
}

View File

@@ -941,7 +941,7 @@ public class PartMngController {
}
Map code_map = new HashMap();
code_map.put("rev", commonService.bizMakeOptionList("", "", "common.getRevNoselect"));
//code_map.put("rev", commonService.bizMakeOptionList("", "", "common.getRevNoselect"));
code_map.put("product_code", commonService.bizMakeOptionList("", "", "common.getProductNoselect"));
// E-BOM 목록 (기존 getActiveBomList 사용)

View File

@@ -2533,7 +2533,7 @@ SELECT option_objid::VARCHAR AS CODE
<select id="getRevNoselect" parameterType="map" resultType="map">
SELECT
T.OBJID::varchar AS CODE
,COALESCE(T.REVISION, T.REV, '1.0') AS NAME
,COALESCE(T.REVISION, '1.0') AS NAME
,T1.PRODUCT_CODE AS CODE_CD
,'' AS STATUS
,T.spec_name AS ID
@@ -2541,7 +2541,7 @@ SELECT option_objid::VARCHAR AS CODE
FROM PART_BOM_REPORT T,PRODUCT_MGMT T1
WHERE T.PRODUCT_MGMT_OBJID = T1.OBJID
AND T1.OBJID = #{code}::numeric
ORDER BY COALESCE(T.REVISION, T.REV, '1.0')
ORDER BY COALESCE(T.REVISION, '1.0')
</select>

View File

@@ -3493,6 +3493,30 @@
LIMIT 1
</select>
<!-- 프로젝트의 활성 M-BOM 목록 조회 -->
<select id="getActiveMbomsByProjectId" parameterType="map" resultType="com.pms.common.UpperKeyMap">
SELECT * FROM MBOM_HEADER
WHERE PROJECT_OBJID = #{projectObjId}
AND (STATUS = 'Y' OR STATUS = 'ACTIVE')
ORDER BY REGDATE DESC
</select>
<!-- M-BOM HEADER 비활성화 -->
<update id="inactivateMbomHeader" parameterType="map">
UPDATE MBOM_HEADER
SET STATUS = 'INACTIVE',
EDIT_DATE = NOW()
WHERE OBJID = #{mbomHeaderObjid}
</update>
<!-- M-BOM DETAIL 비활성화 -->
<update id="inactivateMbomDetail" parameterType="map">
UPDATE MBOM_DETAIL
SET STATUS = 'INACTIVE',
EDIT_DATE = NOW()
WHERE MBOM_HEADER_OBJID = #{mbomHeaderObjid}
</update>
<!-- MBOM_HEADER 삽입 -->
<insert id="insertMbomHeader" parameterType="map">
INSERT INTO MBOM_HEADER (

View File

@@ -1016,9 +1016,45 @@ public class ProductionPlanningService {
boolean result = false;
try {
sqlSession = SqlMapConfig.getInstance().getSqlSession();
sqlSession = SqlMapConfig.getInstance().getSqlSession(false); // 수동 커밋
String projectObjId = CommonUtils.checkNull(paramMap.get("projectObjId"));
// 1. 기존 M-BOM 데이터 비활성화 (새로운 BOM 할당 시 초기화)
if(!"".equals(projectObjId)) {
// 해당 프로젝트의 기존 활성 M-BOM HEADER 조회
Map<String, Object> queryParam = new HashMap<>();
queryParam.put("projectObjId", projectObjId);
List<Map<String, Object>> existingMboms = sqlSession.selectList("productionplanning.getActiveMbomsByProjectId", queryParam);
if(existingMboms != null && !existingMboms.isEmpty()) {
System.out.println("========== 기존 M-BOM 비활성화 ==========");
System.out.println("Project OBJID: " + projectObjId);
System.out.println("비활성화할 M-BOM 개수: " + existingMboms.size());
for(Map<String, Object> mbom : existingMboms) {
String mbomHeaderObjid = CommonUtils.checkNull(mbom.get("OBJID"));
if(!"".equals(mbomHeaderObjid)) {
Map<String, Object> inactivateParam = new HashMap<>();
inactivateParam.put("mbomHeaderObjid", mbomHeaderObjid);
// M-BOM DETAIL 비활성화
sqlSession.update("productionplanning.inactivateMbomDetail", inactivateParam);
// M-BOM HEADER 비활성화
sqlSession.update("productionplanning.inactivateMbomHeader", inactivateParam);
System.out.println("M-BOM 비활성화 완료: " + mbomHeaderObjid);
}
}
}
}
// 2. PROJECT_MGMT 업데이트 (새로운 BOM 할당 정보)
int updateCount = sqlSession.update("productionplanning.saveBomAssignment", paramMap);
result = (updateCount > 0);
sqlSession.commit();
} catch(Exception e) {
if(sqlSession != null) {