suppdlgSearchMaterialCd.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <%--
  2. - FileName : matlcodeselectallpopup.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.07.23
  5. - Copyright : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
  6. - All rights reserved.
  7. - Description: 자재선택 팝업
  8. --%>
  9. <%@ page contentType="text/html; charset=utf-8" %>
  10. <%@ page import="kr.co.hsnc.common.sql.RowSet" %>
  11. <%@ page import="kr.co.hsnc.common.sql.RowSetImpl" %>
  12. <%@ page import="kr.co.hsnc.common.util.ValueObject" %>
  13. <%@ page import="kr.co.udapsoft.common.*" %>
  14. <%@ page import="kr.co.udapsoft.common.code.CommCodeManager" %>
  15. <%@ page import="com.udapsoft.waf.system.*" %>
  16. <%@ page import="com.udapsoft.waf.common.*" %>
  17. <%@ page import="com.udapsoft.waf.common.ui.HTMLMaker" %>
  18. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  19. <%@ page import="com.udapsoft.waf.common.ui.InitCombo" %>
  20. <%@ page import="com.udapsoft.waf.common.ui.InputText" %>
  21. <%@ include file="/jsp/work/taglib.jsp" %>
  22. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  23. <%
  24. ctx.init(request, response);
  25. HandlerStorage storage = ctx.getHandlerStorage();
  26. ValueObject params = storage.getParams();
  27. String fevent = storage.getEvent();
  28. RowSet materialKindCodeLv1 = storage.getRowSet("materialKindCodeLv1");
  29. RowSet materialKindCodeLv2 = new RowSetImpl();
  30. RowSet materialKindCodeLv3 = new RowSetImpl();
  31. InitCombo ic = new InitCombo();
  32. ic.makeComboData(CommCodeManager.getCodeList("STOCK_FLAG"), "CODE", "CODE_NAME_KOR");
  33. String stockFCD = ic.getCode();
  34. String stockFNM = ic.getCodeName();
  35. %>
  36. <SCRIPT language="JavaScript">
  37. /*예약함수*/
  38. var sheet1;
  39. var sheet1Row;
  40. var sheet1PageNo = 1;
  41. var pageLastRowIndex = 1;
  42. var validationResult = false;
  43. var filterShow = false;
  44. function _onReady(){
  45. gridInit(sheet1);
  46. jQuery("#btnSearch").click(function() {
  47. var f= document.form1;
  48. if(f.material_Kind_Code_Lv1.value == "" && f.material_Kind_Code_Lv2.value == "" && f.material_Kind_Code_Lv3.value == "") {
  49. if(f.search_material_cd.value == "" && f.search_material_name.value == "" ) {
  50. alert("자재코드나 자재명칭을 입력하시거나 \n 또는 자재분류를 선택해 주세요.");
  51. return;
  52. }
  53. }
  54. //var deadflg_value = $(':radio[name="deadflg"]:checked').val();
  55. jQuery("#fevent").val("GET_MATL_CODE_LIST");
  56. var url = Modular.model.PageContext.CONTEXT_ROOT + "/lib/dlgSearchMaterialCd_sheet.screen";
  57. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  58. });
  59. jQuery("#btnClose").click(function() {
  60. setTimeout(function(){
  61. parent.doSearchMaterialCodeClose(null);
  62. },100);
  63. });
  64. jQuery("#btnChoice").click(function() {
  65. if(sheet1.RowCount() < 1) {
  66. alert("검색을 먼저 해주세요.");
  67. return;
  68. }
  69. var temp = "N";
  70. var material_cd = new Array; // 자재코드
  71. var material_name = new Array; // 자재명
  72. var material_spec = new Array;
  73. var unit_kind = new Array; // 단위코드
  74. var unit_kind_name = new Array; // 단위명
  75. var stock_flag = new Array; // 중요자재여부
  76. var stock_plan_flag= new Array; // 입고계획여부
  77. if( sheet1.LastRow() >= 1 ){
  78. var idx = 0;
  79. for(var i=1; i <= sheet1.LastRow(); i++){
  80. var tmpArray = sheet1.GetCellValue(i,"chk");
  81. if(tmpArray=="1"){
  82. temp = "Y";
  83. material_cd[idx] = sheet1.GetCellValue(i,"material_cd");
  84. material_name[idx] = sheet1.GetCellValue(i,"material_name");
  85. material_spec[idx] = sheet1.GetCellValue(i,"material_spec");
  86. unit_kind[idx] = sheet1.GetCellValue(i,"unit_kind");
  87. unit_kind_name[idx] = sheet1.GetCellValue(i,"unit_kind_name");
  88. stock_flag[idx] = sheet1.GetCellValue(i,"stock_flag");
  89. stock_plan_flag[idx] = sheet1.GetCellValue(i,"stock_plan_flag");
  90. idx++;
  91. }
  92. }
  93. if(idx > 1) {
  94. alert("자재를 하나만 선택해 주세요.");
  95. return;
  96. }
  97. if(temp == "N") {
  98. alert("자재를 선택해 주세요.");
  99. return;
  100. }
  101. }
  102. var returnValue = new Array(material_cd, material_name, material_spec, unit_kind, unit_kind_name, stock_flag, stock_plan_flag);
  103. setTimeout(function(){
  104. parent.doSearchMaterialCodeClose(returnValue);
  105. },100);
  106. });
  107. doChangeMaterialKind();
  108. }
  109. function gridInit(sheetName){
  110. var init_sheet = {};
  111. init_sheet.Cfg = {SearchMode:2, Page:30};
  112. init_sheet.Cols = [
  113. {Header:'선택', Type:"CheckBox", SaveName:"chk", Width:70, Align:"Center", Hidden:"True"},
  114. {Header:'자재코드', Type:"Text", SaveName:"material_cd", Width:100, Align:"Center", Edit:"false"},
  115. {Header:'대분류', Type:"Text", SaveName:"kind_big", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  116. {Header:'중분류', Type:"Text", SaveName:"kind_mid", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  117. {Header:'소분류', Type:"Text", SaveName:"kind_small", Width:0, Align:"Center", Edit:"false", Hidden:"True"},
  118. {Header:'자재명', Type:"Text", SaveName:"material_name", Width:300, Align:"Left", Edit:"false"},
  119. {Header:'규격', Type:"Text", SaveName:"material_spec", Width:150, Align:"Left", Edit:"false"},
  120. {Header:'UNIT_KIND', Type:"Text", SaveName:"unit_kind", Width:0, Align:"Left", Edit:"false", Hidden:"True"},
  121. {Header:'단위', Type:"Text", SaveName:"unit_kind_name", Width:80, Align:"Center", Edit:"false"},
  122. {Header:'사용여부', Type:"Text", SaveName:"is_use", Width:0, Align:"Left", Edit:"false", Hidden:"True"},
  123. {Header:'중요자재여부', Type:"Combo", SaveName:"stock_flag", Width:90, Align:"Center", Edit:"false", ComboText:"즉시출고|재고관리", ComboCode:"1|2"},
  124. {Header:'입고계획여부', Type:"Combo", SaveName:"stock_plan_flag", Width:90, Align:"Center", Edit:"false", ComboText:"사용|미사용", ComboCode:"Y|N"}
  125. ];
  126. init_sheet.HeaderMode = {Sort:1};
  127. IBS_InitSheet(sheetName, init_sheet);
  128. sheetName.SetDataAutoTrim(0);
  129. setGridSize();
  130. }
  131. function sheet1_OnSearchEnd(code, message) {
  132. setGridSize();
  133. }
  134. function setGridSize() {
  135. sheet1.FitColWidth();
  136. }
  137. function doResult(resultObj) {
  138. var f = document.form1;
  139. document.form1.isSubmit = false;
  140. try {
  141. if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV2" ) {
  142. if ( resultObj.getSuccess() == true ) {
  143. var vo = resultObj.getValueObject();
  144. injectSelect(vo, document.form1.material_Kind_Code_Lv2,"materialgroupname","materialgroup");
  145. document.form1.isSubmit = false;
  146. //doChangeMaterialKind2();
  147. if(f.material_Kind_Code_Lv1.value == "") {
  148. while(document.form1.material_Kind_Code_Lv2.options.length > 1) {
  149. document.form1.material_Kind_Code_Lv2.remove(1);
  150. }
  151. }
  152. // 소분류 select box clear
  153. while(document.form1.material_Kind_Code_Lv3.options.length > 1) {
  154. document.form1.material_Kind_Code_Lv3.remove(1);
  155. }
  156. } else {
  157. dlgErrorMsg(resultObj);
  158. }
  159. } else if ( resultObj.getRequestEvent() == "GET_MATL_KIND_CODE_LV3" ) {
  160. if ( resultObj.getSuccess() == true ) {
  161. var vo = resultObj.getValueObject();
  162. injectSelect(vo, document.form1.material_Kind_Code_Lv3,"materialgroupname","materialgroup");
  163. if(f.material_Kind_Code_Lv2.value == "") {
  164. while(document.form1.material_Kind_Code_Lv3.options.length > 1) {
  165. document.form1.material_Kind_Code_Lv3.remove(1);
  166. }
  167. }
  168. document.form1.isSubmit = false;
  169. } else {
  170. dlgErrorMsg(resultObj);
  171. }
  172. }
  173. } catch (errorObject) {
  174. dlgErrorDetailAlert("doResult()", errorObject);
  175. }
  176. }
  177. function doClose() {
  178. returnvalue = null;
  179. parent.doSearchMaterialCodeClose(null);
  180. }
  181. // 자재분류 첫번째 SELECT BOX onChange 이벤트
  182. function doChangeMaterialKind() {
  183. document.form1.materiallevel.value = "2";
  184. document.form1.materialgroup.value = document.form1.material_Kind_Code_Lv1.value;
  185. submitXmlRequest("/lib/dlgSearchMaterialCd_form.screen", "GET_MATL_KIND_CODE_LV2", document.form1, "VALUEOBJECT");
  186. }
  187. // 자재분류 두번째 SELECT BOX onChange 이벤트
  188. function doChangeMaterialKind2() {
  189. document.form1.materiallevel.value = "3";
  190. document.form1.materialgroup.value = document.form1.material_Kind_Code_Lv2.value;
  191. submitXmlRequest("/lib/dlgSearchMaterialCd_form.screen", "GET_MATL_KIND_CODE_LV3", document.form1, "VALUEOBJECT");
  192. }
  193. function injectSelect(vo, selectObj, code, value){
  194. var Code = vo.get(code);
  195. var Value = vo.get(value);
  196. var arrCd = Code.split('|');
  197. var arrValue = Value.split('|');
  198. while(selectObj.options.length){
  199. selectObj.remove(0);
  200. }
  201. var newOpt;
  202. newOpt = document.createElement('option');
  203. newOpt.text = "-- 전체 --";
  204. newOpt.value = "";
  205. selectObj.options.add(newOpt);
  206. if (arrCd == '') {
  207. selectObj.length = 1;
  208. } else {
  209. for(var i = 0; i < arrCd.length; i++){
  210. newOpt = document.createElement('option');
  211. newOpt.text = arrValue[i] + " : " + arrCd[i];
  212. newOpt.value = arrValue[i];
  213. selectObj.options.add(newOpt);
  214. }
  215. }
  216. }
  217. function prcKeyPress(){
  218. if( event.keyCode == 13 )
  219. {
  220. jQuery("#btnSearch").click();
  221. }
  222. }
  223. function sheet1_OnDblClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  224. var material_cd = sheet1.GetCellValue(Row,"material_cd");
  225. var material_name = sheet1.GetCellValue(Row,"material_name");
  226. var material_spec = sheet1.GetCellValue(Row,"material_spec");
  227. var unit_kind = sheet1.GetCellValue(Row,"unit_kind");
  228. var unit_kind_name = sheet1.GetCellValue(Row,"unit_kind_name");
  229. var stock_flag = sheet1.GetCellValue(Row,"stock_flag");
  230. var stock_plan_flag = sheet1.GetCellValue(Row,"stock_plan_flag");
  231. var returnValue = new Array(material_cd, material_name, material_spec, unit_kind, unit_kind_name, stock_flag, stock_plan_flag);
  232. setTimeout(function(){
  233. parent.doSearchMaterialCodeClose(returnValue);
  234. },100);
  235. }
  236. </script>
  237. <modular:search id="form1">
  238. <modular:key id="fevent" />
  239. </modular:search>
  240. <form id="form1" name="form1" method="post" modular:type="search">
  241. <input type="text" name="fevent" style="display:none;">
  242. <input type="hidden" id="materialgroup" name="materialgroup" value="">
  243. <input type="hidden" id="materiallevel" name="materiallevel" value="">
  244. <!-- 검색조건 시작 -->
  245. <table id="search-table" class="search-form-table">
  246. <colgroup>
  247. <col width="100" />
  248. <col width="200" />
  249. <col width="100" />
  250. <col width="*" />
  251. <col width="200" />
  252. </colgroup>
  253. <tr>
  254. <th>자재분류</th>
  255. <td colspan="3">
  256. <%= HTMLMaker.getSelectTag(materialKindCodeLv1, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv1", "style='width:30%;height=18;' onChange='javascript:doChangeMaterialKind();'", "<OPTION value=''>-- 전체 --</OPTION>", "", 0) %>
  257. <%= HTMLMaker.getSelectTag(materialKindCodeLv2, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv2", "style='width:30%;height=18;' onChange='javascript:doChangeMaterialKind2();'", "<OPTION value=''>-- 전체 --</OPTION>", "", 0) %>
  258. <%= HTMLMaker.getSelectTag(materialKindCodeLv3, "materialgroup", "materialgroupname" , "material_Kind_Code_Lv3", "style='width:30%;height=18;'", "<OPTION value=''>-- 전체 --</OPTION>", "", 0) %>
  259. </td>
  260. <td class="button" rowspan="2">
  261. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  262. <!-- <span class="btnSearch center"><a href="javascript:void(0);" id="btnChoice">선택</a></span> -->
  263. <span class="btnSearch center"><a href="javascript:void(0);" id="btnClose">닫기</a></span>
  264. </td>
  265. </tr>
  266. <tr>
  267. <th>자재코드</th>
  268. <td>
  269. <%= InputText.get("search_material_cd", "", 90, 255, "class=input byteChk, perSize, left", "", "onkeyup=\"prcKeyPress();\"") %>
  270. </td>
  271. <th>자재명칭</th>
  272. <td>
  273. <%= InputText.get("search_material_name", "", 91, 255, "class=input byteChk, perSize, left", "", "onkeyup=\"prcKeyPress();\"") %>
  274. </td>
  275. </tr>
  276. </table>
  277. <!-- 검색조건 종료 -->
  278. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 320px; overflow: auto;">
  279. <script>createIBSheet('sheet1','100%', '320px');</script>
  280. </div>
  281. </form>