mbom컬럼 변경, 구매리스트로 넘길 때 제작수량 0인것 제외 등..

This commit is contained in:
2026-01-15 17:23:37 +09:00
parent 1371733a37
commit 4a6d3a90ae
6 changed files with 94 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
<%String objId = com.pms.common.utils.CommonUtils.checkNull(request.getParameter("objId"));%>
<frameset cols="60%, 100px, 40%" border="0" noresize>
<frameset cols="70%, 80px, 30%" border="0" noresize>
<frame src="/productionplanning/mBomPopupLeft.do?objId=<%=objId%>" name="leftFrame">
<frame src="/productionplanning/mBomPopupCenter.do?objId=<%=objId%>" name="centerFrame">
<frame src="/productionplanning/mBomPopupRight.do?objId=<%=objId%>" name="rightFrame">

View File

@@ -372,7 +372,7 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'center',
width: 60,
width: 50,
title: 'PDF',
field: 'CU03_CNT',
visible: true,
@@ -416,7 +416,7 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 150,
width: 100,
title: '메이커',
field: 'MAKER',
visible: true
@@ -424,7 +424,7 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'left',
width: 100,
width: 70,
title: '범주이름',
field: 'PART_TYPE_TITLE',
visible: true
@@ -470,9 +470,9 @@ function fn_initGrid() {
headerHozAlign: 'center',
hozAlign: 'left',
width: 100,
title: '소재',
title: '소재재질',
field: 'RAW_MATERIAL',
titleFormatter: function() { return '<span class="editable-header">소재</span>'; },
titleFormatter: function() { return '<span class="editable-header">소재재질</span>'; },
editor: function(cell, onRendered, success, cancel, editorParams) {
// 소재 목록을 Select2용 형태로 변환
var options = materialList.map(function(m) { return {id: m, text: m}; });
@@ -499,9 +499,9 @@ function fn_initGrid() {
headerHozAlign: 'center',
hozAlign: 'left',
width: 100,
title: '사이즈',
title: '규격',
field: 'SIZE',
titleFormatter: function() { return '<span class="editable-header">사이즈</span>'; },
titleFormatter: function() { return '<span class="editable-header">규격</span>'; },
editor: function(cell, onRendered, success, cancel, editorParams) {
// 선택된 소재에 따라 동적으로 사이즈 목록 로드
var data = cell.getRow().getData();
@@ -578,14 +578,15 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'right',
width: 100,
width: 90,
title: '소재소요량',
field: 'REQUIRED_QTY',
titleFormatter: function() { return '<span class="editable-header">소재소요량</span>'; },
editor: 'number',
editorParams: {
min: 0,
step: 0.01 // 소수 가능
step: 0.01,
selectContents: true // 편집 시 기존 값 전체 선택
},
editable: function(cell) {
return cell.getRow().getData().SUPPLY_TYPE === '사급';
@@ -600,7 +601,7 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'right',
width: 120,
width: 90,
title: '소재발주수량',
field: 'ORDER_QTY',
editor: false,
@@ -628,20 +629,22 @@ function fn_initGrid() {
{
headerHozAlign: 'center',
hozAlign: 'right',
width: 100,
width: 80,
title: '제작수량',
field: 'PRODUCTION_QTY',
titleFormatter: function() { return '<span class="editable-header">제작수량</span>'; },
editor: 'number',
editorParams: {
min: 0,
step: 1
step: 1,
selectContents: true // 편집 시 기존 값 전체 선택
},
formatter: function(cell) {
// 저장된 값이 있으면 그대로 사용, 없으면 항목수량 × 수주수량으로 계산
var value = cell.getValue();
if(value === undefined || value === null || value === '' || value === 0) {
// 0은 유효한 값이므로 제외 (undefined, null, '' 만 기본값 계산)
if(value === undefined || value === null || value === '') {
var data = cell.getRow().getData();
var itemQty = parseFloat(data.ITEM_QTY) || 0;
value = itemQty * projectQuantity;
@@ -681,6 +684,18 @@ function fn_initGrid() {
return value;
}
},
{
headerHozAlign: 'center',
hozAlign: 'right',
width: 100,
title: '가공단가',
field: 'PROCESSING_UNIT_PRICE',
editor: false, // 구매쪽에서 입력
formatter: function(cell) {
var value = cell.getValue();
return value ? Number(value).toLocaleString() : '-';
}
},
/* 주석처리: 가공납기, 연삭납기 컬럼
{
headerHozAlign: 'center',
@@ -736,30 +751,30 @@ function fn_initGrid() {
headerHozAlign: 'center',
hozAlign: 'right',
width: 100,
title: '단가',
title: '소재단가',
field: 'UNIT_PRICE',
editor: false, // 구매쪽에서 입력
formatter: function(cell) {
var value = cell.getValue();
return value ? Number(value).toLocaleString() : '-';
}
},
{
headerHozAlign: 'center',
hozAlign: 'right',
width: 100,
title: '금액',
field: 'TOTAL_PRICE',
editor: false,
formatter: function(cell) {
// 항목수량 × 단가
var data = cell.getRow().getData();
var itemQty = parseFloat(data.ITEM_QTY) || 0;
var unitPrice = parseFloat(data.UNIT_PRICE) || 0;
var totalPrice = itemQty * unitPrice;
return totalPrice > 0 ? totalPrice.toLocaleString() : '-';
}
}
// {
// headerHozAlign: 'center',
// hozAlign: 'right',
// width: 100,
// title: '금액',
// field: 'TOTAL_PRICE',
// editor: false,
// formatter: function(cell) {
// // 항목수량 × 단가
// var data = cell.getRow().getData();
// var itemQty = parseFloat(data.ITEM_QTY) || 0;
// var unitPrice = parseFloat(data.UNIT_PRICE) || 0;
// var totalPrice = itemQty * unitPrice;
// return totalPrice > 0 ? totalPrice.toLocaleString() : '-';
// }
// }
]
});
@@ -1103,7 +1118,8 @@ function getMbomTreeData() {
// 구매 정보
vendor: row.VENDOR || row.VENDOR_PM, // 공급업체 코드/OBJID (기존 값 유지)
unitPrice: toNumber(row.UNIT_PRICE),
unitPrice: toNumber(row.UNIT_PRICE), // 소재단가
processingUnitPrice: toNumber(row.PROCESSING_UNIT_PRICE), // 가공단가
// totalPrice 계산: 항목수량 × 단가
totalPrice: (function() {
var itemQty = parseFloat(row.ITEM_QTY) || 0;
@@ -1130,19 +1146,35 @@ function getMbomTreeData() {
return mbomData;
}
// 엑셀 다운로드 (CSV 형식)
function fn_excel() {
if(!_tabulGrid) {
Swal.fire('데이터가 없습니다.');
return;
}
// 파일명 생성 (현재 날짜 포함)
var today = new Date();
var dateStr = today.getFullYear() + '_' +
String(today.getMonth() + 1).padStart(2, '0') + '_' +
String(today.getDate()).padStart(2, '0') + '_' +
String(today.getHours()).padStart(2, '0') + '_' +
String(today.getMinutes()).padStart(2, '0');
var fileName = 'M-BOM_' + dateStr + '.csv';
// Tabulator 내장 다운로드 기능 사용 (CSV)
_tabulGrid.download("csv", fileName, {
delimiter: ",",
bom: true // 한글 깨짐 방지 (UTF-8 BOM)
});
}
</script>
</head>
<body>
<!-- <div id="mBomName">
<c:choose>
<c:when test="${not empty ebomInfo}">
E-BOM: ${ebomInfo.PART_NO} - ${ebomInfo.PART_NAME}
</c:when>
<c:otherwise>
할당된 E-BOM이 없습니다.
</c:otherwise>
</c:choose>
</div> -->
<div>
<input type="button" value="Excel Download" class="plm_btns" id="btnExcel" style="float:right; margin-right: 5px; margin-bottom: 5px;" onclick="fn_excel();">
</div>
<div id="mBomTableWrap"></div>
</body>
</html>

View File

@@ -51,8 +51,11 @@ body, html {
<td>
<input type="text" name="search_part_name" id="search_part_name" style="width: 98%;"value="">
</td>
<td>
<input type="button" value="조회" class="plm_btns" id="btnSearch">
</td>
</tr>
<tr>
<!-- <tr>
<td><label for="search_material">재료</label></td>
<td>
<input type="text" name="search_material" id="search_material" style="width: 100%;" value="">
@@ -63,10 +66,8 @@ body, html {
<input type="text" name="search_supplier" id="search_supplier" style="width: 98%;" value="">
</td>
<td>
<input type="button" value="조회" class="plm_btns" id="btnSearch">
</td>
</tr>
</tr> -->
</table>
</div>
@@ -126,8 +127,8 @@ function initEbomTable() {
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", vertAlign:"middle", headerSort:false, width: 40},
{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: "MAKER", widthGrow: 1.5, vertAlign:"middle"}
//{title: "재료", field: "MATERIAL", widthGrow: 1.2, vertAlign:"middle"},
//{title: "메이커", field: "MAKER", widthGrow: 1.5, vertAlign:"middle"}
],
placeholder: "검색 결과가 없습니다."
});

View File

@@ -670,7 +670,7 @@ function fn_executeCreateProposal(salesRequestObjid, targetParts) {
</h2>
<div class="btnArea">
<input type="button" value="조회" class="plm_btns" id="btnSearch">
<input type="button" value="구매요청서작성" class="plm_btns" id="btnOrderReg">
<!-- <input type="button" value="구매요청서작성" class="plm_btns" id="btnOrderReg"> -->
<input type="button" value="품의서생성" class="plm_btns" id="btnReg">
</div>
</div>

View File

@@ -3294,6 +3294,7 @@
0 AS PO_QTY,
'' AS VENDOR,
0 AS UNIT_PRICE,
0 AS PROCESSING_UNIT_PRICE,
0 AS TOTAL_PRICE,
1 AS LEVEL
FROM
@@ -3374,6 +3375,7 @@
0 AS PO_QTY,
'' AS VENDOR,
0 AS UNIT_PRICE,
0 AS PROCESSING_UNIT_PRICE,
0 AS TOTAL_PRICE,
1 AS LEVEL
FROM
@@ -3850,7 +3852,7 @@
PROCESSING_VENDOR, PROCESSING_DEADLINE, GRINDING_DEADLINE,
REQUIRED_QTY, ORDER_QTY, PRODUCTION_QTY, STOCK_QTY, SHORTAGE_QTY,
NET_QTY, PO_QTY,
VENDOR, UNIT_PRICE, TOTAL_PRICE, CURRENCY, LEAD_TIME, MIN_ORDER_QTY,
VENDOR, UNIT_PRICE, PROCESSING_UNIT_PRICE, TOTAL_PRICE, CURRENCY, LEAD_TIME, MIN_ORDER_QTY,
<if test="proposalDate != null">
PROPOSAL_DATE,
</if>
@@ -3863,7 +3865,7 @@
#{processingVendor}, #{processingDeadline}, #{grindingDeadline},
#{requiredQty}, #{orderQty}, #{productionQty}, #{stockQty}, #{shortageQty},
#{netQty}, #{poQty},
#{vendor}, #{unitPrice}, #{totalPrice}, #{currency}, #{leadTime}, #{minOrderQty},
#{vendor}, #{unitPrice}, #{processingUnitPrice}, #{totalPrice}, #{currency}, #{leadTime}, #{minOrderQty},
<if test="proposalDate != null">
#{proposalDate},
</if>
@@ -4049,6 +4051,7 @@
MD.PO_QTY,
MD.VENDOR,
MD.UNIT_PRICE,
MD.PROCESSING_UNIT_PRICE,
MD.TOTAL_PRICE,
MD.CURRENCY,
MD.LEAD_TIME,
@@ -4102,6 +4105,7 @@
SHORTAGE_QTY,
VENDOR,
UNIT_PRICE,
PROCESSING_UNIT_PRICE,
TOTAL_PRICE,
CURRENCY,
LEAD_TIME,
@@ -4146,6 +4150,7 @@
A.SHORTAGE_QTY,
A.VENDOR,
A.UNIT_PRICE,
A.PROCESSING_UNIT_PRICE,
A.TOTAL_PRICE,
A.CURRENCY,
A.LEAD_TIME,
@@ -4198,6 +4203,7 @@
B.SHORTAGE_QTY,
B.VENDOR,
B.UNIT_PRICE,
B.PROCESSING_UNIT_PRICE,
B.TOTAL_PRICE,
B.CURRENCY,
B.LEAD_TIME,
@@ -4250,6 +4256,7 @@
V.VENDOR,
(SELECT CLIENT_NM FROM CLIENT_MNG WHERE OBJID::VARCHAR = V.VENDOR) AS VENDOR_NAME,
V.UNIT_PRICE,
V.PROCESSING_UNIT_PRICE,
V.TOTAL_PRICE,
V.CURRENCY,
V.LEAD_TIME,
@@ -4412,6 +4419,7 @@
NULL AS SHORTAGE_QTY,
NULL AS VENDOR,
NULL AS UNIT_PRICE,
NULL AS PROCESSING_UNIT_PRICE,
NULL AS TOTAL_PRICE,
NULL AS CURRENCY,
NULL AS LEAD_TIME,

View File

@@ -3356,6 +3356,7 @@ SELECT
FROM VIEW_BOM V
LEFT JOIN PART_MNG P ON P.OBJID::VARCHAR = V.PART_OBJID::VARCHAR
WHERE 1=1
AND COALESCE(V.PRODUCTION_QTY, 0) > 0 -- 제작수량이 0인 항목 제외
ORDER BY V.PATH2
</select>