기업사용자 입력시스템-기본물성시험 -999입력 처리 '-'입력 처리로 변경

jiyoo
유지인 2026-04-06 09:28:22 +09:00
parent ce4175e783
commit 425ca5d02e
4 changed files with 125 additions and 41 deletions

View File

@ -6477,25 +6477,25 @@ public class ManageExcelUploadProc03Controller {
List<HashMap<String, Object>> list = new ArrayList<HashMap<String,Object>>();
int excelWpLength = excelWp.getLength();
for(int i=1; i < excelWpLength; i++) {
if(!StringUtil.containsCharOnly(excelWp.get("col0",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col0",i).trim(),"0123456789.-")){
resultMsg = String.format(fmtMsg, i + "번째 심도(from)는 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col1",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col1",i).trim(),"0123456789.-")){
resultMsg += String.format(fmtMsg, i + "번째 심도(to)는 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col4",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col4",i).trim(),"0123456789.-")){
resultMsg = String.format(fmtMsg, i + "번째 함수비(%)는 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col5",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col5",i).trim(),"0123456789.-")){
resultMsg += String.format(fmtMsg, i + "번째 비중은 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col6",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col6",i).trim(),"0123456789.-")){
resultMsg = String.format(fmtMsg, i + "번째 액성한계(%)는 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col7",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col7",i).trim(),"0123456789.-")){
resultMsg += String.format(fmtMsg, i + "번째 소성지수는 실수만 입력이 가능합니다.");
}
if(!StringUtil.containsCharOnly(excelWp.get("col9",i).trim(),"0123456789.")){
if(!StringUtil.containsCharOnly(excelWp.get("col9",i).trim(),"0123456789.-")){
resultMsg += String.format(fmtMsg, i + "번째 단위중량(KN/㎥)은 실수만 입력이 가능합니다.");
}

View File

@ -164,17 +164,17 @@ function fn_save(rUrl){
}else if(keys[k] == "sampleDepthTo"){
change_data += "<" + keys[k] + ">" + row.sampleDepthTo + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleLl"){
change_data += "<" + keys[k] + ">" + row.sampleLl + "</" + keys[k] + ">\r\n";
change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleLl) + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleDesc"){
change_data += "<" + keys[k] + ">" + row.sampleDesc + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleWc"){
change_data += "<" + keys[k] + ">" + row.sampleWc + "</" + keys[k] + ">\r\n";
change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleWc) + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "datetime"){
change_data += "<" + keys[k] + ">" + row.datetime + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleGs"){
change_data += "<" + keys[k] + ">" + row.sampleGs + "</" + keys[k] + ">\r\n";
change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleGs) + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "samplePi"){
change_data += "<" + keys[k] + ">" + row.samplePi + "</" + keys[k] + ">\r\n";
change_data += "<" + keys[k] + ">" + getNoDataValue(row.samplePi) + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleNumber"){
change_data += "<" + keys[k] + ">" + row.sampleNumber + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleShape"){
@ -184,7 +184,7 @@ function fn_save(rUrl){
}else if(keys[k] == "projectCode"){
change_data += "<" + keys[k] + ">" + row.projectCode + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleRd"){
change_data += "<" + keys[k] + ">" + row.sampleRd + "</" + keys[k] + ">\r\n";
change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleRd) + "</" + keys[k] + ">\r\n";
}else if(keys[k] == "sampleDepthFrom"){
change_data += "<" + keys[k] + ">" + row.sampleDepthFrom + "</" + keys[k] + ">\r\n";
}
@ -373,12 +373,12 @@ function fn_add(){
"sampleDepthTo" : "0",
"sampleSamplingMethod" : "",
"sampleShape" : "",
"sampleWc" : "0",
"sampleGs" : "0",
"sampleLl" : "0",
"samplePi" : "0",
"sampleWc" : "-",
"sampleGs" : "-",
"sampleLl" : "-",
"samplePi" : "-",
"sampleDesc" : "-",
"sampleRd" : "0",
"sampleRd" : "-",
"sampleUscs" : "",
"sampleCode" : "",
};
@ -759,7 +759,8 @@ function fn_grid_refresh(){
var nullTypeString = 'test';
if( gridData.length == 1 && gridData[0].sampleNumber == '-999' ) {
gridData = undefined;
// gridData = undefined;
gridData = '-';
// table-top-control 클래스를 가진 첫 번째 요소 찾기
var tableTopControlElement = document.getElementsByClassName('table-top-control')[0];
@ -800,12 +801,12 @@ function fn_grid_refresh(){
sampleDepthTo: { type: "number" },
sampleSamplingMethod: { type: "string" },
sampleShape: { type: "string" },
sampleWc: { type: "number",},
sampleGs: { type: "number" },
sampleLl: { type: "number" },
samplePi: { type: "number" },
sampleWc: { type: "number", defaultValue: "-"},
sampleGs: { type: "number", defaultValue: "-"},
sampleLl: { type: "number", defaultValue: "-" },
samplePi: { type: "number", defaultValue: "-" },
sampleDesc: { type: "string" },
sampleRd: { type: "number" },
sampleRd: { type: "number", defaultValue: "-" },
sampleUscs: { type: "string" },
sampleCode: { type: "string", editable: false },
}
@ -857,44 +858,46 @@ function fn_grid_refresh(){
editor: comboEditor2,
template: "#=getTeacherName2((sampleShape == null) ? ' ' : sampleShape)#",
},
{ field: "sampleGs", title: "함수비(%)<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />-999 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
{ field: "sampleGs",
title: "함수비(%)<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />- 입력</div>",
editor: chooseEditor,
width:100,
attributes: { style:"text-align: right" },
format:"{0:n2}",
template: function (dataItem) {
if (dataItem.sampleGs == null)
dataItem._set("sampleGs", "0");
else
return dataItem.sampleGs;
if (dataItem.sampleGs == null || dataItem.sampleGs == -999) return "-";
return kendo.toString(dataItem.sampleGs, "n2");
}
},
{ field: "sampleWc", title: "비중<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />-999 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
{ field: "sampleWc", title: "비중<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />- 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
template: function (dataItem) {
if (dataItem.sampleWc == null)
dataItem._set("sampleWc", "0");
if (dataItem.sampleWc == null || dataItem.sampleWc == -999)
return "-";
else
return dataItem.sampleWc;
}
},
{ field: "sampleLl", title: "액성한계(%)<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />-999 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
{ field: "sampleLl", title: "액성한계(%)<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />- 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
template: function (dataItem) {
if (dataItem.sampleLl == null)
dataItem._set("sampleLl", "0");
if (dataItem.sampleLl == null || dataItem.sampleLl == -999)
return "-";
else
return dataItem.sampleLl;
}
},
{ field: "samplePi", title: "소성지수<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />-999 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
{ field: "samplePi", title: "소성지수<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />- 입력</div>", editor: chooseEditor, width:100, attributes: { style:"text-align: right" },
template: function (dataItem) {
if (dataItem.samplePi == null)
dataItem._set("samplePi", "0");
if (dataItem.samplePi == null || dataItem.samplePi == -999)
return "-";
else
return dataItem.samplePi;
}
},
{ field: "sampleDesc", title: "비고", width:100, attributes: { style:"text-align: left" }, template: "<div class='td-data'>#= (sampleDesc == null) ? '0' : sampleDesc #</div>" },
{ field: "sampleRd", title: "단위중량(${sampleUnit})<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />-999 입력</div>", editor: chooseEditor, width:140, attributes: { style:"text-align: right" },
{ field: "sampleRd", title: "단위중량(${sampleUnit})<div style='margin-top: 8px; color: red; font-weight: 200;'>값 없을 시<br />- 입력</div>", editor: chooseEditor, width:140, attributes: { style:"text-align: right" },
template: function (dataItem) {
if (dataItem.sampleRd == null)
dataItem._set("sampleRd", "0");
if (dataItem.sampleRd == null || dataItem.sampleRd == -999)
return "-";
else
return dataItem.sampleRd;
}
@ -1060,7 +1063,8 @@ function fn_grid_refresh(){
switch (options.model.COLUMN) {
default:
numericEditor(container, options);
// numericEditor(container, options);
numericEditor2(container, options);
break;
}
}

View File

@ -46,6 +46,61 @@ function numericEditor(container, options, isHyphenAllowed = false) {
}
function numericEditor2(container, options, isHyphenAllowed = false) {
var input = kendoJQuery('<input type="test" name="' + options.field + '" class="k-textbox" style="width:100%; text-align:right;" />');
input.appendTo(container)
.val(options.model[options.field])
// 1. 입력 제한 (숫자 + 하이픈)
.on("input", function () {
let val = this.value;
// 허용: "-", "-숫자", "숫자", "소수"
if (!/^[-]?\d*\.?\d*$/.test(val)) {
this.value = val.slice(0, -1);
}
})
// 2. ↑ ↓ 키로 값 증가/감소
.on("keydown", function (e) {
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
e.preventDefault();
let val = this.value.trim();
// "-" 단독이면 0 기준 시작
if (val === "-" || val === "") {
val = 0;
}
let num = parseFloat(val);
if (isNaN(num)) num = 0;
if (e.key === "ArrowUp") {
num += 1;
} else {
num -= 1;
}
this.value = num;
}
})
// 3. blur 시 모델 반영
.on("blur", function () {
let val = this.value.trim();
if (val === "-") {
options.model.set(options.field, null);
} else {
let num = parseFloat(val);
options.model.set(options.field, isNaN(num) ? null : num);
}
});
}
//입력 type number로 변경 그러나 hyphen 입력 허용
function numericEditorAllowHyphen(container, options, isHyphenAllowed = false) {
kendoJQuery('<input type="text" name="' + options.field + '"/>')

View File

@ -2077,4 +2077,29 @@ function projNmDuplChkResult( projectNameInput, projectCode) {
}
});
return result;
}
/**
* 기업사용자 입력시스템 > 기본물성시험정보 -999 처리
* 없음 처리는 '-' 입력으로 한다.
* @caller /views/web/input/sampleInfo.jsp
* @param val
* @returns
*/
function getNoDataValue(val) {
return (val === null || val === undefined || val === "" || val === "-") ? -999 : val;
}
/**
* 기업사용자 입력시스템 > 기본물성시험정보 -999 처리
* 없음 처리는 '-' 입력으로 한다.
* @param val
* @returns
*/
function setNoDataValue(val) {
if (val == -999) {
return '-';
}
return val;
}