CommMatlCodeList.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  3. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  4. <%@ page import="kr.co.hsnc.common.util.*"%>
  5. <%@ page import="kr.co.hsnc.common.sql.*" %>
  6. <%@ include file="/jsp/work/taglib.jsp" %>
  7. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  8. <%
  9. ctx.init(request, response);
  10. ValueObject user = ctx.getUser();
  11. String USER_ID = user.get("USER_ID");
  12. HandlerStorage storage = ctx.getHandlerStorage();
  13. ValueObject params = storage.getParams();
  14. String sect_id = (String) storage.getObject("sect_id");
  15. String level = (String) storage.getObject("level");
  16. String code = (String) storage.getObject("code");
  17. String kind_big = (String) params.get("kind_big");
  18. String kind_mid = (String) params.get("kind_mid");
  19. String kind_small = (String) params.get("kind_small");
  20. //중점관리여부
  21. String stock_flag_yn = (String) storage.getObject("selectStockText");
  22. String stock_flag_yn_code = (String) storage.getObject("selectStockValue");
  23. stock_flag_yn = stock_flag_yn.substring(0, stock_flag_yn.lastIndexOf("|"));
  24. stock_flag_yn_code = stock_flag_yn_code.substring(0, stock_flag_yn_code.lastIndexOf("|"));
  25. //사용여부
  26. String is_use_yn = "사용|미사용";
  27. String is_use_yn_code = "Y|N";
  28. //입고계획여부
  29. String stock_plan_flag_yn = "사용|미사용";
  30. String stock_plan_flag_yn_code = "Y|N";
  31. //단위
  32. String selectText = (String) storage.getObject("selectText");
  33. String selectValue = (String) storage.getObject("selectValue");
  34. //price_flag
  35. String price_flg_yn = "예|아니오";
  36. String price_flg_yn_code = "Y|N";
  37. String pay_div_yn = "납품정산|계획분할";
  38. String pay_div_yn_code = "1|2";
  39. %>
  40. <script type="text/javascript">
  41. <!--
  42. /*예약함수*/
  43. var sheet1 = new ibsheetObject();
  44. var sheet1Row;
  45. var sheet1PageNo = 1;
  46. var pageLastRowIndex = 1;
  47. var validationResult = false;
  48. var filterShow = false;
  49. $(function(){
  50. $.gridInit = function(sheetName)
  51. {
  52. var init_sheet = {};
  53. init_sheet.Cfg = {SearchMode:2, Page:30, MergeSheet:msHeaderOnly};
  54. init_sheet.Cols = [
  55. {Header:"Status", Type:"Status", SaveName:"STATUS", Width:0, Align:"Center", Hidden:"True"},
  56. {Header:"삭제", Type:"DelCheck", SaveName:"DEL_CHECK", Width:50, Align:"Center", Hidden:"True"},
  57. {Header:"No.", Type:"Seq", SaveName:"NO", Width:30, Align:"Center"},
  58. {Header:"자재코드", Type:"Text", SaveName:"MATERIAL_CD", Width:60, Align:"Center", KeyField:"True",InsertEdit:"False", UpdateEdit:"False"},
  59. {Header:"자재명", Type:"Text", SaveName:"MATERIAL_NAME", Width:150, Align:"Left", KeyField:"True"},
  60. {Header:"규격", Type:"Text", SaveName:"MATERIAL_SPEC", Width:150, Align:"Left", KeyField:"True"},
  61. {Header:"단위", Type:"Combo", SaveName:"UNIT_KIND", Width:40, Align:"Left", ComboText:"<%=selectText%>", ComboCode:"<%=selectValue%>", KeyField:"True"},
  62. {Header:"leadTime", Type:"Text", SaveName:"LEAD_TIME", Width:60, Align:"Center", KeyField:"True"},
  63. {Header:"중점관리여부", Type:"Combo", SaveName:"STOCK_FLAG", Width:80, Align:"Center", ComboText:"<%=stock_flag_yn%>", ComboCode:"<%=stock_flag_yn_code%>", KeyField:"True"},
  64. {Header:"사용여부", Type:"Combo", SaveName:"IS_USE", Width:60, Align:"Center", ComboText:"<%=is_use_yn%>", ComboCode:"<%=is_use_yn_code%>", KeyField:"True"},
  65. {Header:"입고계획여부", Type:"Combo", SaveName:"STOCK_PLAN_FLAG", Width:80, Align:"Center", ComboText:"<%=stock_plan_flag_yn%>", ComboCode:"<%=stock_plan_flag_yn_code%>", KeyField:"True"},
  66. {Header:"가입고여부", Type:"Combo", SaveName:"PRICE_FLG", Width:70, Align:"Center", ComboText:"<%=price_flg_yn%>", ComboCode:"<%=price_flg_yn_code%>", KeyField:"True"},
  67. {Header:"지급구분", Type:"Combo", SaveName:"PAY_DIV", Width:70, Align:"Center", ComboText:"<%=pay_div_yn%>", ComboCode:"<%=pay_div_yn_code%>", KeyField:"True"}
  68. ];
  69. init_sheet.HeaderMode = {Sort:1};
  70. IBS_InitSheet(sheetName, init_sheet);
  71. sheetName.SetDataAutoTrim(0);
  72. sheetName.SetEditable(true);
  73. sheetName.SetDataLinkMouse("MATERIAL_NAME");
  74. // sheetName.SetColFontColor("CORP_KOR", "#0000ff");
  75. sheetName.FitColWidth();
  76. }
  77. $(document).on("keyup", "input:text", function(e) {
  78. if (e.keyCode == 13)
  79. {
  80. $.searchList();
  81. }
  82. });
  83. $.searchList = function()
  84. {
  85. $("#fevent").val("GET_CODE_LIST");
  86. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/CommMatlCodeList_data.screen";
  87. Modular.view.IBSheet7.doSearch(sheet1, url, $("#form1"), 30, "");
  88. }
  89. $("#btn_search").click(function(){
  90. $.searchList();
  91. });
  92. $("#btn_save").click(function(){
  93. $("#fevent").val("SAVE_CODE_LIST");
  94. var url = Modular.model.PageContext.CONTEXT_ROOT + "/common/CommMatlCodeList_process.screen";
  95. var result = Modular.view.IBSheet7.doSave(sheet1, url, $("#form1"), false);
  96. });
  97. $("#btn_add").click(function(){
  98. var level = "<%=level%>";
  99. var kind_small = "<%=kind_small%>";
  100. var material_cd = "";
  101. var material_cd1 = "";
  102. var seq = "";
  103. if(level == "3")
  104. {
  105. if (sheet1.SearchRows() == 0 && (sheet1.RowCount("I") == 0))
  106. {
  107. sheet1.SetDataAutoTrim(0);
  108. var rowIndex = sheet1.DataInsert(-1);
  109. sheet1.SetCellValue(rowIndex, "MATERIAL_CD", kind_small + leadingZeros("001",3));
  110. }
  111. else
  112. {
  113. sheet1.SetDataAutoTrim(0);
  114. var rowIndex = sheet1.DataInsert(-1);
  115. //2020.01.10 코드가 9자리 10자리가 같이 사용되면서 문자타입으로 최대값 비교가 안되는 문제 발생하여 수정
  116. //material_cd = sheet1.GetCellValue(rowIndex -1, "MATERIAL_CD");
  117. material_cd = sheet1.GetCellValue(1, "MATERIAL_CD");
  118. for (var i = 2; i <= sheet1.RowCount(); i++){
  119. if(Number(material_cd) < Number(sheet1.GetCellValue(i, "MATERIAL_CD"))){
  120. material_cd = sheet1.GetCellValue(i, "MATERIAL_CD");
  121. }
  122. }
  123. material_cd1 = material_cd.substring(0, material_cd.length -3);
  124. seq = Number(material_cd.substring(material_cd.length -3, material_cd.length)) + 1;
  125. sheet1.SetCellValue(rowIndex, "MATERIAL_CD", material_cd1 + leadingZeros(seq,3));
  126. }
  127. sheet1.SetCellValue(rowIndex, "LEAD_TIME", "1");
  128. sheet1.SetCellValue(rowIndex, "PRICE_FLG", "N");
  129. }else{
  130. alert("소분류를 선택하세요.");
  131. }
  132. });
  133. $("#btn_category_reg").click(function(){
  134. var level = "<%=level%>";
  135. var kind_big = "<%=kind_big%>";
  136. var kind_mid = "<%=kind_mid%>";
  137. var kind_small = "<%=kind_small%>";
  138. if(level == "3")
  139. {
  140. alert("더이상 하위 카테고리를 등록할 수 없습니다.");
  141. return;
  142. }else{
  143. var win_id = "_categoryReg";
  144. var url = "/common/MatlCategoryAddPopup.screen?cate_gubun=L&level="+level+"&kind_big="+kind_big+"&kind_mid="+kind_mid+"&kind_small="+kind_small+"&pop_win_id="+win_id;
  145. fLayerPop(win_id, url, 550, 100, '', '', 'NO');
  146. }
  147. });
  148. $("#btn_category_del").click(function(){
  149. var level = "<%=level%>";
  150. var kind_big = "<%=kind_big%>";
  151. var kind_mid = "<%=kind_mid%>";
  152. var kind_small = "<%=kind_small%>";
  153. var f = document.form1;
  154. if(level != "")
  155. {
  156. if (confirm("삭제 하시겠습니까?") )
  157. {
  158. submitXmlRequest( "/common/CommMatlCodeDelete_form.screen", "DELETE_CODE_LIST", f, "ROWSET" ); //xmlhttp.js
  159. }
  160. }
  161. else
  162. {
  163. alert("분류코드가 선택되지 않았습니다.");
  164. return;
  165. }
  166. });
  167. $("#btn_excel").click(function(){
  168. var params = {FileName:"공통자재코드.xls",SheetName:"공통자재코드",Merge:1,SheetDesign:1, HiddenColumn:1 };
  169. sheet1.Down2Excel (params);
  170. });
  171. $("#btn_treeList").click(function(){
  172. var win_id = "_treeList";
  173. var url = "/common/CommMatlCodeTreeList.screen?pop_win_id="+win_id;
  174. fLayerPop(win_id, url, 620, 470, '', '', 'NO');
  175. });
  176. $("#btn_reset").click(function(){
  177. $("input:text").val("");
  178. });
  179. });
  180. $(document).ready(function(){
  181. $.gridInit(sheet1);
  182. $.searchList();
  183. autoResize();
  184. });
  185. function autoResize(){
  186. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  187. var iframeHeight= document.body.scrollHeight - t1_height;
  188. var iframeWidth= document.body.scrollWidth;
  189. sheet1.SetSheetHeight(iframeHeight);
  190. }
  191. function leadingZeros(n, digits) {
  192. var zero = '';
  193. n = n.toString();
  194. if (n.length < digits) {
  195. for (var i = 0; i < digits - n.length; i++)
  196. zero += '0';
  197. }
  198. return zero + n;
  199. }
  200. function sheet1_OnSearchEnd(code, message)
  201. {
  202. sheet1.FitColWidth();
  203. }
  204. function sheet1_OnSaveEnd(code, msg)
  205. {
  206. var event = $("#fevent").val();
  207. var f = document.form1;
  208. document.form1.isSubmit = false;
  209. try {
  210. if(event == "SAVE_CODE_LIST")
  211. {
  212. if(code >= "0")
  213. {
  214. alert("저장되었습니다.");
  215. $.searchList();
  216. }
  217. else
  218. {
  219. }
  220. }
  221. }
  222. catch(errorObject) {
  223. showErrorDlg("doResult()", errorObject);
  224. }
  225. }
  226. function doResult(resultObj) {
  227. try {
  228. if( resultObj.getRequestEvent() == "DELETE_CODE_LIST" ) {
  229. if( resultObj.getSuccess() ) {
  230. alert("삭제되었습니다.");
  231. parent.tree.location.reload(true);
  232. }
  233. else {
  234. alert(resultObj);
  235. }
  236. document.form1.isSubmit = false;
  237. }
  238. }
  239. catch(errorObject) {
  240. showErrorDlg("doResult()", errorObject);
  241. }
  242. }
  243. //-->
  244. </script>
  245. <modular:search id="form1">
  246. <modular:key id="fevent" />
  247. </modular:search>
  248. <form id="form1" name="form1" method="post" modular:type="search">
  249. <input type="hidden" name="fevent" id="fevent" value="">
  250. <input type="hidden" name="USER_ID" value="<%=USER_ID%>"/>
  251. <input type="hidden" name="sect_id" value = "<%=sect_id %>" />
  252. <input type="hidden" name="level" value = "<%=level %>" />
  253. <input type="hidden" name="code" value = "<%=code %>" />
  254. <input type="hidden" name="kind_big" value = "<%=kind_big %>" />
  255. <input type="hidden" name="kind_mid" value = "<%=kind_mid %>" />
  256. <input type="hidden" name="kind_small" value = "<%=kind_small %>" />
  257. <div align="left" id="title">
  258. <ul>
  259. <li>공통자재코드</li>
  260. </ul>
  261. </div>
  262. <table border="0" cellspacing="0" cellpadding="0" width="98%" id="search-table">
  263. <!-- 검색조건 영역 : 시작 -->
  264. <tr>
  265. <td height="1">
  266. <table cellspacing="1" cellpadding="0" class="search-form-table">
  267. <col width="10%">
  268. <col width="30%">
  269. <col width="60%">
  270. <tr height="25">
  271. <!-- 검색조건 타이틀 1 -->
  272. <th>
  273. 자재코드/명
  274. </th>
  275. <td>
  276. <input type='text' name="pgm_name2" class="input" style="width:90%" />
  277. </td>
  278. <td rowspan="2" class="search_button" align="center">
  279. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_search">검색</a></span>
  280. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_add">추가</a></span>
  281. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_save">저장</a></span>
  282. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_category_reg">분류코드</a></span>
  283. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_category_del">분류코드 삭제</a></span>
  284. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_reset">초기화</a></span>
  285. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_excel">엑셀다운</a></span>
  286. <span class="btnSearch center"><a href="javascript:void(0);" id="btn_treeList">양식다운</a></span>
  287. </td>
  288. </tr>
  289. </table>
  290. </td>
  291. </tr>
  292. <!-- 검색조건 영역 : 종료 -->
  293. <!-- 검색조건 영역, 테이터 영역 구분 여백 : 시작 -->
  294. <tr>
  295. <td height="1">
  296. </td>
  297. </tr>
  298. <!-- 검색조건 영역, 테이터 영역 구분 여백 : 종료 -->
  299. </table>
  300. <div id="sheet1_div" style="padding-top:5px; width:98%; height: 400px">
  301. <script>createIBSheet("sheet1","100%", "400px");</script>
  302. </div>
  303. </form>