From ed862562da18cdc4c414e824c92c00fe91873b2e Mon Sep 17 00:00:00 2001 From: sychoi Date: Thu, 2 May 2024 08:42:51 +0900 Subject: [PATCH] init --- .../sts_order_prod/popComponent/isDefHst.php | 4 +- .../popComponent/sts_order_pop_util.inc.php | 61 +++++ .../sts_order_prod/reg_prod_result.ajax.php | 63 ++++- .../site/sts_order_prod/reg_prod_result.js | 230 +++++++++++++++++- .../site/sts_order_prod/reg_prod_result.php | 2 +- .../sts_order_prod/sts_order_pop_util.inc.php | 61 +++++ 6 files changed, 410 insertions(+), 11 deletions(-) create mode 100644 home_dir/www/ksvc/site/sts_order_prod/popComponent/sts_order_pop_util.inc.php create mode 100644 home_dir/www/ksvc/site/sts_order_prod/sts_order_pop_util.inc.php diff --git a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isDefHst.php b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isDefHst.php index 69b4c2f..803803d 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/popComponent/isDefHst.php +++ b/home_dir/www/ksvc/site/sts_order_prod/popComponent/isDefHst.php @@ -8,8 +8,8 @@
- - + +
diff --git a/home_dir/www/ksvc/site/sts_order_prod/popComponent/sts_order_pop_util.inc.php b/home_dir/www/ksvc/site/sts_order_prod/popComponent/sts_order_pop_util.inc.php new file mode 100644 index 0000000..a811e5e --- /dev/null +++ b/home_dir/www/ksvc/site/sts_order_prod/popComponent/sts_order_pop_util.inc.php @@ -0,0 +1,61 @@ + + + + + + + + \ No newline at end of file diff --git a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php index 5491b93..53d873e 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php +++ b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.ajax.php @@ -16,7 +16,7 @@ if( !_notAuth("R") ){/************ 권한체크*/ // 가동 vs 비가동 case "getWokerInfo": - $sql = "USP_P_REG_PROD_RESULT_S10"; + $sql = "USP_P_REG_PROD_POP_S10"; $params = array( 'WO_NO' => $_REQUEST["WO_NO"] ?: "", @@ -117,7 +117,68 @@ if( !_notAuth("R") ){/************ 권한체크*/ $retval['mesg'] = $_REQUEST['RS_MSG']; } break; + case 'getRoutingList': + $sql = "USP_B_ROUTING_S10"; + $params = Array( + "ITEM_CD" => $_REQUEST['ITEM_CD']?:"", + ); + $rst = $baseObj->DB->exec($sql,$params); + $rows = array(); + if( $rst ){ + while( $row = $baseObj->DB->fetch_array($rst) ){ + $rows[] = $row; + }; + + $retval['code'] = true; + $retval['data'] = $rows; +// print_r($retval['data']); + $retval['mesg'] = '정상 동작 되었습니다.'; + }else{ + $retval['code'] = false; + } + break; + case 'getDrawList': + $sql = "USP_B_ITEM_DRAW_S10"; + $params = Array( + "ITEM_CD" => $_REQUEST['ITEM_CD'], + ); + $rst = $baseObj->DB->exec($sql,$params); + + $rows = array(); + if( $rst ){ + while( $row = $baseObj->DB->fetch_array($rst) ){ + $rows[] = $row; + }; + + $retval['code'] = true; + $retval['data'] = $rows; + $retval['mesg'] = '정상 동작 되었습니다.'; + }else{ + $retval['code'] = false; + } + break; + case 'getDefHst': + $sql = "USP_P_REG_PROD_DEF_HST_S10"; + $params = Array( + "ITEM_CD" => $_REQUEST['ITEM_CD'], + "OP_CD" => $_REQUEST['OP_CD'] + ); + $rst = $baseObj->DB->exec($sql,$params); + + $rows = array(); + if( $rst ){ + while( $row = $baseObj->DB->fetch_array($rst) ){ + $rows[] = $row; + }; + + $retval['code'] = true; + $retval['data'] = $rows; + $retval['mesg'] = '정상 동작 되었습니다.'; + }else{ + $retval['code'] = false; + } + break; } } diff --git a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js index 5d20c56..19a52b6 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js +++ b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.js @@ -1,3 +1,8 @@ + + + + + class SimpleTable { constructor(fields, getmode, putmode, formData){ // ajax @@ -202,9 +207,9 @@ class FieldPop { tableField : { isDefHst : [ { field: "DEF_NO", formatter:"rownum", title: "순번", width: 50}, - { field: "DEF_FACLT_CD", title: "설비", width: '23%'}, - { field: "DEF_CD", title: "불량원인", width: '23%'}, - { field: "DEF_QTY", title: "불량수량", width: '23%'}, + // { field: "OP_CD", title: "", width: '23%'}, + { field: "DEF_NM", title: "불량원인", width: '23%'}, + { field: "DEF_TOT", title: "불량수량", width: '23%'}, { field: "DEF_PRICE", title: "불량단가", width: '23%'}, @@ -212,8 +217,8 @@ class FieldPop { isWorker : [ { field: "", formatter:"rownum", title: "순번", width: 50}, { field: "", title: "실적 등록 시간", minWidth: 150, width:'26%'}, - { field: "", title: "오더 번호", minWidth: 150, width:'25%'}, - { field: "", title: "실적 수량", minWidth: 100, width:'20%', + { field: "WO_NO", title: "오더 번호", minWidth: 150, width:'25%'}, + { field: "PRD_QTY", title: "실적 수량", minWidth: 100, width:'20%', bottomCalc: "sum", bottomCalcFormatter:"money", bottomCalcFormatterParams:{ decimal:".", precision:0 } @@ -341,7 +346,7 @@ class FieldPop { // 클릭시 컴포넌트 생성 및 삭제로 페이지 레이아웃 변경 showComponent(com, tab) { this.activeTab = tab; - + Object.keys(this.isComponent).map((key)=>{ this.isComponent[key] = com == key ? true : false; }); @@ -377,6 +382,17 @@ class FieldPop { }); + break; + case 'isDefHst': + this.getMode = 'getDefHst'; + this.putMode = ''; + + this.callTable(com,{ + ITEM_CD : this.formData.ITEM_CD, + OP_CD : this.formData.OP_CD, + }); + + break; default: this.callTable(com); @@ -387,7 +403,75 @@ class FieldPop { }, + getFileUrl(DRAW_NO, SID, FILE_ID, FILE_NM,down){ + let urlStr = '/include/getFile.php'+"?gubun=draw&nid=" + + DRAW_NO + + "&sid="+ SID + + "&file_id="+ FILE_ID+ + "&name="+FILE_NM + if(down == true){ + location.href = urlStr; + } + return urlStr; + }, + popDrawSTD(text){ + const item_cd = document.getElementById("ITEM_CD").value; + if(text === '작업표준서 조회'){ + // const wo_no = document.getElementById("WO_NO").value; + vnLoad("", "./sts_order_pop_util.inc.php", "", (loadHtml) => { + this.modal = kuls_modal(loadHtml); + + const draw_std = new Tb_draw_std_class("#sub_table", item_cd); + draw_std.init(); + }); + }else{ + let _this = this; + // let talert = window.setTimeout(()=> { this.tbList.alert("Loading ...") }, 1000); + + ajax_json({ + url: './reg_prod_result.ajax.php', + data: { mode : "getDrawList", ITEM_CD : item_cd}, + success: (data) => { + console.log(data.data[0]); + const drawData = data.data[0] + // _this.getFileUrl( + // drawData.DRAW_NO, + // drawData.SID, + // drawData.FILE_ID, + // drawData.FILE_NM, + // true + // ); + + pop_filedown( + _this.getFileUrl( + drawData.DRAW_NO, + drawData.SID, + drawData.FILE_ID, + drawData.FILE_NM, + ), drawData.FILE_NM.split(".").pop() + ); + }, + error: (req, status, err) => { + kuls_alert(err.message); + }, + complete: () => { + // window.clearTimeout(talert); + // this.getMainList(); + // this.tbList.clearAlert(); + // this.setFilter(); + }, + }); + + + + + + + } + + + }, // 클릭시 탭메뉴 활성화 isChangeTab(com) { Object.keys(this.isTab).map( (key) => { @@ -410,4 +494,136 @@ class FieldPop { } -} \ No newline at end of file +} + + +class Tb_draw_std_class { + constructor(container,item_cd) { + this.ajaxUrl = "./reg_prod_result.ajax.php"; + this.container = document.querySelector(container); + + this.item_cd = item_cd; + this.table = this.container.querySelector(".hy-table"); + this.addBtn = this.container.querySelector(".add-btn") || ""; + this.removeBtn = this.container.querySelector(".remove-btn") || ""; + + console.log(this.container); + } + + getMainList(){ + let _this = this; + let talert = window.setTimeout(()=> { this.tbList.alert("Loading ...") }, 1000); + ajax_json({ + url: this.ajaxUrl, + data: { mode: "getRoutingList", ITEM_CD :this.item_cd}, + success: (data) => { + // console.log(data.data); + this.tbList.setData(data.data); + }, + error: (req, status, err) => { + kuls_alert(err.message); + }, + complete: () => { + window.clearTimeout(talert); + // this.tbList.clearAlert(); + // this.setFilter(); + }, + }); + + + } + downloadIcon = function(cell, formatterParams, onRendered){ //plain text value + if(!cell.getRow().getData().FILE_NM){ + // kuls_alert(""); + return ""; + } + return ""; + + }; + previewIcon = function(cell, formatterParams, onRendered){ //plain text value + if(!cell.getRow().getData().FILE_NM){ + // kuls_alert(""); + return ""; + } + // console.log(cell.getRow().getData().FILE_NM); + return ""; + + }; + init(){ + let _this = this; + const fields = [ + + { formatter: "rownum", title: "NO", width: 50 }, + { field: "OP_CD", title: "공정코드", width: 100 }, + { field: "OP_NM", title: "공정명", width: 150 }, + { title: "작업 표준서", cssClass:"width-230", columns:[ + { field: "SID", visible:false}, + { field: "FILE_ID", visible:false}, + { field:"FILE_NM", width:100, formatter: this.previewIcon, cellClick:function(e,cell){ + pop_filedown( + _this.getFileUrl( + cell.getRow().getData().ITEM_CD, + cell.getRow().getData().ROUT_SQNO, + cell.getRow().getData().FILE_NM, + "", + "rout", + // cell.getRow().getData().FILE_NM, + false + ), cell.getRow().getData().FILE_NM.split(".").pop() + ); + } + }, + { field:"DOWNLOAD", width:100, formatter: this.downloadIcon, + cellClick:function(e, cell){ + + _this.getFileUrl( + cell.getRow().getData().ITEM_CD, + cell.getRow().getData().ROUT_SQNO, + cell.getRow().getData().FILE_NM, + "", + "rout", + true + ); + // location.href = '/include/getFile.php'+"?gubun=draw&nid=" + // + cell.getRow().getData().DRAW_NO + // + "&sid="+cell.getRow().getData().SID + // + "&file_id="+cell.getRow().getData().FILE_ID + }}, + // {field:"REGISTER", width:50,editor: _this.fileEditor} + // {field:"REGISTER", width:50,formatter: function(cell,formatterParams){ + // if(cell.getRow().getData().FILE_NM){ + // return ""; + // } + // return _this.uploadButton(cell)} + // }, + // {field:"DELETE", width:50,formatter: function(cell,formatterParams){return _this.deleteButton(cell)}} + + ] + }, + ]; + const commonFieldData = { + headerSort: true, + vertAlign: "middle", + hozAlign: "center", + resizable: "header", //Resize 는 헤더에서만 가능 + headerHozAlign: "center", //헤더 정렬 + headerSortTristate: true, //데이터 정렬 => 정/역/초기화 + }; + this.tbList = new Tabulator(this.table, { + layout: "fitColumns", + data: [], //기본 데이터 + columns: fields, //컬럼 설정 + columnDefaults: commonFieldData, + headerSortElement: "", //정렬 아이콘 + // validationMode: "highlight", + }); + + /* + * @Overview 테이블 만들어지면 데이터 불러오기 + * @Parameter 없음 + */ + this.tbList.on("tableBuilt", () => { + this.getMainList(); + }); + } +} diff --git a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.php b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.php index d396d46..3ae2f54 100644 --- a/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.php +++ b/home_dir/www/ksvc/site/sts_order_prod/reg_prod_result.php @@ -21,7 +21,7 @@ include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php"; -->
- +
diff --git a/home_dir/www/ksvc/site/sts_order_prod/sts_order_pop_util.inc.php b/home_dir/www/ksvc/site/sts_order_prod/sts_order_pop_util.inc.php new file mode 100644 index 0000000..8d121b0 --- /dev/null +++ b/home_dir/www/ksvc/site/sts_order_prod/sts_order_pop_util.inc.php @@ -0,0 +1,61 @@ + + + + + + + + \ No newline at end of file