123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695 |
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let viewObj = {} : 상세화면 Object *
- * let stockCddObj = {} : 재고실사 Object *
- *******************************************************/
- /*화면 변수*/
- const STOCKMNG02010_GRID_ID = '#ITP_STOCKMNG02010_jqGrid';
- const STOCKMNG02010_GRID_LIST = '#ITP_STOCKMNG02010_jqGrid_list';
- const STOCKMNG02010_GRID_PAGER = '#ITP_STOCKMNG02010_jqGridPager';
- const STOCKMNG02010_GRID_EMPTY = '#ITP_STOCKMNG02010_jqGridEmpty';
- const STOCKMNG02010_VIEW_GRID_ID = '#ITP_STOCKMNG02010_VIEW_jqGrid';
- const STOCKMNG02010_VIEW_GRID_LIST = '#ITP_STOCKMNG02010_VIEW_jqGrid_list';
- const STOCKMNG02010_VIEW_GRID_PAGER = '#ITP_STOCKMNG02010_VIEW_jqGridPager';
- const STOCKMNG02010_VIEW_GRID_EMPTY = '#ITP_STOCKMNG02010_VIEW_jqGridEmpty';
- const STOCKMNG02010_DETAIL_GRID_ID = '#ITP_STOCKMNG02010_DETAIL_jqGrid';
- const STOCKMNG02010_DETAIL_GRID_LIST = '#ITP_STOCKMNG02010_DETAIL_jqGrid_list';
- const STOCKMNG02010_DETAIL_GRID_PAGER = '#ITP_STOCKMNG02010_DETAIL_jqGridPager';
- const STOCKMNG02010_DETAIL_GRID_EMPTY = '#ITP_STOCKMNG02010_DETAIL_jqGridEmpty';
- let ITP_FORM_STOCKMNG02010_DETAIL_IS_DUPLICATE = false;
- let ITP_FORM_STOCKMNG02010_DETAIL_IS_WRITING = false;
- let STOCKMNG02010_DETAIL_GRID_LAST_ROW_ID;
- /* 공통코드 리스트 */
- // let ITP_COMMON_CD_STCK_DVSN = fn_make_common_cd_list(CODE_LIST, 'STCK_DVSN', true);
- // let ITP_COMMON_CD_LOC_ST_CD = fn_make_common_cd_list(CODE_LIST, 'LOC_ST_CD', true);
- /*API URL*/
- let WHS_MNG_INFO_WHS = '/api/whs/mng/info-whs';
- let WHS_MNG_ADD_WHS = '/api/whs/mng/add-whs';
- let WHS_MNG_MIDIFY_WHS = '/api/whs/mng/modify-whs';
- let WHS_MNG_REMOVE_WHS = '/api/whs/mng/remove-whs';
- let STOCK_CDD_DETAIL_GRID_LIST = '/api/stock/cdd/detail-grid-list';
- let WHS_MNG_DETAIL_GRID_LIST = '/api/whs/mng/detail-grid-list';
- let WHS_MNG_LOCATION_GRID_LIST = '/api/whs/mng/location-grid-list';
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'BRAND_ID', name: 'brandId',
- label: "브랜드ID",
- width: '0', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'STORE_ID', name: 'storeId',
- label: "매장ID",
- width: '0', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'STORE_NM', name: 'storeNm',
- label: "매장명",
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_ID', name: 'whsId',
- label: "창고번호",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: "창고명",
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'LOCATION_NM', name: 'locationNm',
- label: "Location",
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CDD_MGR_NM', name: 'cddMgrNm',
- label: "실사담당자",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CDD_DT', name: 'cddDt',
- label: "실사일자",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CDD_TM', name: 'cddTm',
- label: "실사시각",
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'CDD_DVSN_NM', name: 'cddDvsnNm',
- label: "실사구분",
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ],
- view: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'LOCATION', name: 'location',
- label: "로케이션",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'LOCATION_NM', name: 'locationNm',
- label: "로케이션명",
- width: '12', fixed: false, align: 'center',
- sortable: true, editable: false, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'STCK_DVSN_NM', name: 'stckDvsnNm',
- label: "관리등록",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text'
- },
- {
- index: 'LOC_ST_NM', name: 'locStNm',
- label: "상태",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text'
- }
- ],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: "브랜드",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'WHS_ID', name: 'whsId',
- label: "창고번호",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: "창고명",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'LOCATION_NM', name: 'locationNm',
- label: "Location",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: "품목번호",
- width: '12', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: "품목명",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'UNIT', name: 'unit',
- label: "단위",
- width: '8', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'STCK_QTY', name: 'stckQty',
- label: "현재고수량",
- width: '8', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: false}
- },
- {
- index: 'CDD_QTY', name: 'cddQty',
- label: "실사수량",
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: true, edittype: 'text',
- editrules: {required: true}
- }
- ]
- };
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- },
- ui: {
- init: function () {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('STOCKMNG02010');
-
- // 브랜드ID 지정
- var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_info'));
- $('#ITP_FORM_STOCKMNG02010_SEARCH_BRAND_ID').val(data.brandId);
-
- pageObj.fnWhsList(function() {
- pageObj.fnLocationList();
- }); // 창고리스트
-
- // 공통코드 표시
- // fn_make_select(CODE_LIST, 'WHS_DVSN', 'ITP_FORM_STOCKMNG02010_WHS_DVSN');
- // 조회일자 지정
- var now = new Date();
- $('#ITP_TAB_STOCKMNG02010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_STOCKMNG02010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setMonth(now.getMonth() - 1)));
- $('#ITP_FORM_STOCKMNG02010_SEARCH_TO_DT').datepicker('setDate', new Date());
- $('#ITP_FORM_STOCKMNG02010_DETAIL_CDD_DT').val(itp_fn_date_format(new Date(), 2));
-
- },
- grid: function() {
- itp_fn_jqgrid_resize(STOCKMNG02010_GRID_ID, STOCKMNG02010_GRID_LIST, 'lg');
- listObj.empty.init();
- itp_fn_fire_window_resize();
- },
- ready: function() {
- listObj.init();
- }
- },
- event: {
- init: function () {
- this.button();
- this.change();
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_STOCKMNG02010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_STOCKMNG02010_STOCK_CDD' : listObj.button.fnStockCdd(); break; // 재고실사 버튼
- case 'ITP_BTN_STOCKMNG02010_CANCELLIST' : stockCddObj.button.cancel(); break; // 취소/목록 버튼
- // case 'ITP_BTN_STOCKMNG02010_DELETE' : break; // 삭제 버튼
- case 'ITP_BTN_STOCKMNG02010_SAVE' : stockCddObj.button.save(); break; // 저장 버튼
- // case 'ITP_BTN_STOCKMNG02010_DETAIL_ADDROW' : locInfoObj.button.addRow(); break; // 상세:추가버튼
- // case 'ITP_BTN_STOCKMNG02010_DETAIL_DELROW' : locInfoObj.button.delRow(); break; // 상세:삭제버튼
- }
- });
- });
- $('body').on('click', function(e) {
- var gridId = STOCKMNG02010_DETAIL_GRID_ID.replace('#', '');
- var rids = $(STOCKMNG02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
- itp_fn_grid_reset_selection(e, last_row_id, gridId, 'STOCKMNG02010_DETAIL');
- });
- },
- change: function () {
- // 창고 변경
- $('#ITP_FORM_STOCKMNG02010_SEARCH_WHS_ID').on('change', function() {
- pageObj.fnLocationList(function() {
- listObj.button.search(); // 조회
- }); // 로케이션 리스트
- });
- $('#ITP_FORM_STOCKMNG02010_SEARCH_LOCATION').on('change', function() {
- listObj.button.search(); // 조회
- });
-
- }
- },
- switchScreen: function(mode) {
- if(mode == 'LIST') { // 목록
- $('#ITP_BTN_STOCKMNG02010_MODIFY').hide();
- $('#ITP_BTN_STOCKMNG02010_CANCELLIST').hide();
- $('#ITP_BTN_STOCKMNG02010_DELETE').hide();
- $('#ITP_BTN_STOCKMNG02010_SAVE').hide();
-
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_SRH');
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_STOCK_CDD');
- $('#ITP_AJAX_STOCKMNG02010_LIST_CONTAINER').show();
- $('#ITP_AJAX_STOCKMNG02010_DETAIL_CONTAINER').hide();
- $('#ITP_AJAX_STOCKMNG02010_VIEW_CONTAINER').hide();
- } else if(mode == 'ADD') { // 재고실사
- ITP_FORM_STOCKMNG02010_DETAIL_IS_DUPLICATE = true;
- $('#ITP_BTN_STOCKMNG02010_SRH').hide();
- $('#ITP_BTN_STOCKMNG02010_MODIFY').hide();
- $('#ITP_BTN_STOCKMNG02010_STOCK_CDD').hide();
- $('#ITP_BTN_STOCKMNG02010_DELETE').hide();
-
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_CANCELLIST');
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_SAVE');
- $('#ITP_AJAX_STOCKMNG02010_LIST_CONTAINER').hide();
- $('#ITP_AJAX_STOCKMNG02010_DETAIL_CONTAINER').show();
- $('#ITP_AJAX_STOCKMNG02010_VIEW_CONTAINER').hide();
-
- $('#ITP_FORM_STOCKMNG02010_DETAIL_BRAND_ID').val($('#ITP_FORM_STOCKMNG02010_SEARCH_BRAND_ID').val());
- $('#ITP_FORM_STOCKMNG02010_DETAIL_STORE_ID').val($('#ITP_FORM_STOCKMNG02010_SEARCH_STORE_ID').val());
- $('#ITP_FORM_STOCKMNG02010_DETAIL_WHS_ID').val($('#ITP_FORM_STOCKMNG02010_SEARCH_WHS_ID').val());
- $('#ITP_FORM_STOCKMNG02010_DETAIL_LOCATION').val($('#ITP_FORM_STOCKMNG02010_SEARCH_LOCATION').val());
-
- } else if(mode == 'VIEW') { // 보기
- $('#ITP_BTN_STOCKMNG02010_SRH').hide();
- $('#ITP_BTN_STOCKMNG02010_STOCK_CDD').hide();
- $('#ITP_BTN_STOCKMNG02010_DELETE').hide();
- $('#ITP_BTN_STOCKMNG02010_SAVE').hide();
-
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_MODIFY');
- fn_show_btn_auth('#ITP_BTN_STOCKMNG02010_CANCELLIST');
- $('#ITP_AJAX_STOCKMNG02010_LIST_CONTAINER').hide();
- $('#ITP_AJAX_STOCKMNG02010_DETAIL_CONTAINER').hide();
- $('#ITP_AJAX_STOCKMNG02010_VIEW_CONTAINER').show();
- }
- },
- fnWhsList: function(fnCall) {
- const brandIdVal = $('#ITP_FORM_STOCKMNG02010_SEARCH_BRAND_ID').val();
- const param = {sbrandId: brandIdVal, pagingYn: false};
-
- fn_ajax_call(WHS_MNG_DETAIL_GRID_LIST, JSON.stringify(param), function(result) {
-
- fn_make_select_whs(result.gridRows, 'ITP_FORM_STOCKMNG02010_SEARCH_WHS_ID');
- fn_make_select_whs(result.gridRows, 'ITP_FORM_STOCKMNG02010_DETAIL_WHS_ID');
-
- if (fnCall !== undefined || typeof fnCall !== 'undefined') fnCall();
-
- }, 'POST');
- },
- fnLocationList: function(fnCall) {
- const brandIdVal = $('#ITP_FORM_STOCKMNG02010_SEARCH_BRAND_ID').val();
- const whsIdVal = $('#ITP_FORM_STOCKMNG02010_SEARCH_WHS_ID').val();
- const param = {brandId: brandIdVal, whsId: whsIdVal, pagingYn: false};
-
- fn_ajax_call(WHS_MNG_LOCATION_GRID_LIST, JSON.stringify(param), function(result) {
-
- fn_make_select_location(result.gridRows, 'ITP_FORM_STOCKMNG02010_SEARCH_LOCATION');
- fn_make_select_location(result.gridRows, 'ITP_FORM_STOCKMNG02010_DETAIL_LOCATION');
-
- if (fnCall !== undefined || typeof fnCall !== 'undefined') fnCall();
-
- }, 'POST');
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_STOCKMNG02010_search: false,
- button: {
- search: function() {
- listObj.itp_STOCKMNG02010_search = true;
- let param = $('#ITP_FORM_STOCKMNG02010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(STOCKMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- fnStockCdd: function() {
- pageObj.switchScreen('ADD');
- itp_fn_form_clear_validate(null, '#ITP_FORM_STOCKMNG02010_DETAIL');
- stockCddObj.init();
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(STOCKMNG02010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_STOCKMNG02010_param.gridSize = $.jgrid.defaults.rowNum;
- $(STOCKMNG02010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_STOCKMNG02010_param)}).trigger('reloadGrid');
- });
- },
- itp_STOCKMNG02010_param: {},
- push: function() {
- let param = $('#ITP_FORM_STOCKMNG02010_SEARCH').serializeObject();
- listObj.itp_STOCKMNG02010_param = param;
- },
- back: function() {
- $('#ITP_FORM_STOCKMNG02010_DEVI_TP_CD').val(this.itp_STOCKMNG02010_param.deviTpCd);
- $('#ITP_FORM_STOCKMNG02010_ORDER_YN').val(this.itp_STOCKMNG02010_param.orderYn);
- $('#ITP_FORM_STOCKMNG02010_ADT_AUTH_CD').val(this.itp_STOCKMNG02010_param.adtAuthCd);
- $('#ITP_FORM_STOCKMNG02010_EMAIL_RCV_YN').val(this.itp_STOCKMNG02010_param.emailRcvYn);
- $('#ITP_FORM_STOCKMNG02010_MEMB_EXIT_DT').val(this.itp_STOCKMNG02010_param.membExitDt);
- $('#ITP_FORM_STOCKMNG02010_FROM_DT').val(this.itp_STOCKMNG02010_param.fromDt);
- $('#ITP_FORM_STOCKMNG02010_TO_DT').val(this.itp_STOCKMNG02010_param.toDt);
- $('#ITP_FORM_STOCKMNG02010_KEYWORD').val(this.itp_STOCKMNG02010_param.keyword);
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- var data = JSON.parse(sessionStorage.getItem('itp_manage_brand_info'));
- $('#ITP_FORM_STOCKMNG02010_SEARCH_BRAND_ID').val(data.brandId);
-
- let param = $('#ITP_FORM_STOCKMNG02010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- var option = {
- gridId: STOCKMNG02010_GRID_ID,
- colModel: gridColModel.list,
- param: JSON.stringify(param),
- url: DOMAIN + STOCK_CDD_DETAIL_GRID_LIST,
- pager: STOCKMNG02010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm == 'whsNm') {
- const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
- const whsIdVal = $(this).jqGrid('getCell', rowId, 'whsId');
-
- const key = {brandId: brandIdVal, whsId: whsIdVal, viewCd: 'R'};
- var param = $.param(key);
- viewObj.init(param);
- }
- },
- loadComplete: function(data) {
- console.log(data);
- itp_fn_grid_load_complete(data, STOCKMNG02010_GRID_ID, true, 'number', 'STOCKMNG02010', listObj.itp_STOCKMNG02010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(STOCKMNG02010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(STOCKMNG02010_GRID_ID).jqGrid('setCell', rowId, 'whsNm', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(STOCKMNG02010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STOCKMNG02010_GRID_ID).jqGrid('clearGridData', true);
- $(STOCKMNG02010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STOCKMNG02010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STOCKMNG02010_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STOCKMNG02010_GRID_ID);
- }
- }
- };
- /*상세화면 Object*/
- let viewObj = {
- init: function (param) {
- this.load(param);
- },
- load: function(param) {
- fn_ajax_call(WHS_MNG_INFO_WHS, param, this.callback, 'GET');
- },
- callback: function (result) {
- // console.log(result);
- pageObj.switchScreen('VIEW');
- $('#ITP_FORM_STOCKMNG02010_VIEW #ITP_FORM_STOCKMNG02010_VIEW_BRAND_ID').val(result.brandId);
- $('#ITP_FORM_STOCKMNG02010_VIEW #ITP_FORM_STOCKMNG02010_VIEW_STORE_ID').val(result.storeId);
- $('#ITP_FORM_STOCKMNG02010_VIEW #ITP_FORM_STOCKMNG02010_VIEW_WHS_ID').val(result.whsId);
-
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnStCd').text(result.whsStNm);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnWhsId').text(result.whsId);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnWhsNm').text(result.whsNm);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnTelNo').text(result.mgrTelNo);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnMgrNm').text(result.mgrNm);
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnSpplyNm').text(result.storeNm ? result.storeNm : '');
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnRegDtm').text(result.sysRegDttm);
- if(result.zipNo) {
- $('#ITP_FORM_STOCKMNG02010_VIEW .fnAddress').text('('+result.zipNo+') ' + result.addr1 + ' ' + result.addr2);
- }
- // 권한정보 리스트 조회
- viewObj.grid.init();
- },
- grid: {
- init: function() {
- this.unload();
- this.load();
- },
- load : function() {
- let param = $('#ITP_FORM_STOCKMNG02010_VIEW').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.pagingYn = false; // 페이징안함
- var option = {
- gridId: STOCKMNG02010_VIEW_GRID_ID,
- colModel: gridColModel.view,
- param: JSON.stringify(param),
- url: DOMAIN + WHS_MNG_LOCATION_GRID_LIST,
- pager: STOCKMNG02010_VIEW_GRID_PAGER,
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, STOCKMNG02010_VIEW_GRID_ID, true, undefined, 'STOCKMNG02010_VIEW');
- },
- onPaging: function(action) {
- var pagingFn = {
- callBack: function(args) {
- $(args).trigger('reloadGrid');
- }
- };
- if (itp_fn_check_grid_is_writing(STOCKMNG02010_VIEW_GRID_ID)) {
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, STOCKMNG02010_VIEW_GRID_ID);
- return 'stop';
- } else {
- itp_fn_grid_paging(STOCKMNG02010_VIEW_GRID_ID, action, param);
- }
- },
- onSortCol: function(index, columnIndex, sortOrder) {
- var sortingFn = {
- callBack: function(args) {
- $(args).trigger('reloadGrid');
- }
- };
- if (itp_fn_check_grid_is_writing(STOCKMNG02010_VIEW_GRID_ID)) {
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, STOCKMNG02010_VIEW_GRID_ID);
- return 'stop';
- } else {
- itp_fn_grid_sorting(STOCKMNG02010_VIEW_GRID_ID, index, sortOrder);
- }
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STOCKMNG02010_VIEW_GRID_ID).jqGrid('clearGridData', true);
- $(STOCKMNG02010_VIEW_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STOCKMNG02010_VIEW_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STOCKMNG02010_VIEW_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STOCKMNG02010_VIEW_GRID_ID);
- }
- }
- };
- /*재고실사 Object*/
- let stockCddObj = {
- init: function () {
- this.unload();
- this.load();
- },
- button: {
- cancel: function() {
- listObj.grid.search();
- },
- save: function() {
- var detailViewCd = $('#ITP_FORM_STOCKMNG02010_DETAIL_VIEW_CD').val();
- const formId = '#ITP_FORM_STOCKMNG02010_DETAIL';
- itp_fn_form_clear_validate(null, formId);
-
- var vali_whsStatCd = itp_fn_form_validate(formId, formId + '_WHS_ST_CD', ['empty'], undefined); // 상태
- var vali_whsNm = itp_fn_form_validate(formId, formId + '_WHS_NM', ['empty'], undefined);
-
- if (vali_whsStatCd && vali_whsNm) {
- let gridInsertData = [];
- let gridUpdateData = [];
- let gridDeleteData = [];
- const rowData = $(STOCKMNG02010_DETAIL_GRID_ID).getRowData();
- // const keyValue = $(formId + '_WHS_ID').val();
- $.each(rowData, function(key, value) {
- if (value.viewCd != 'R') {
- // value.whsId = keyValue;
- if (value.viewCd == 'C') {
- gridInsertData.push(value);
- } else if (value.viewCd == 'U') {
- gridUpdateData.push(value);
- } else if (value.viewCd == 'D') {
- gridDeleteData.push(value);
- }
- }
- });
- let param = $(formId).serializeObject();
- param.gridInsertData = gridInsertData;
- param.gridUpdateData = gridUpdateData;
- param.gridDeleteData = gridDeleteData;
- //console.log(JSON.stringify(param));
- var searhFn = function() {
- ITP_FORM_STOCKMNG02010_DETAIL_IS_WRITING = false;
- listObj.grid.search();
- };
- fn_ajax_call(detailViewCd == 'C' ? WHS_MNG_ADD_WHS : WHS_MNG_MIDIFY_WHS, JSON.stringify(param), searhFn, 'POST');
- }
- }
- },
- load: function () {
- let param = $('#ITP_FORM_STOCKMNG02010_DETAIL').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.pagingYn = false; // 페이지안함
- var option = {
- gridId: STOCKMNG02010_DETAIL_GRID_ID,
- colModel: gridColModel.detail,
- param: JSON.stringify(param),
- url: DOMAIN + WHS_MNG_LOCATION_GRID_LIST,
- pager: STOCKMNG02010_DETAIL_GRID_PAGER,
- multiselect: true,
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, STOCKMNG02010_DETAIL_GRID_ID, true, undefined, 'STOCKMNG02010_DETAIL');
- },
- onPaging: function(action) {
- var pagingFn = {
- callBack: function(args) {
- $(args).trigger('reloadGrid');
- }
- };
- if (itp_fn_check_grid_is_writing(STOCKMNG02010_DETAIL_GRID_ID)) {
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, STOCKMNG02010_DETAIL_GRID_ID);
- return 'stop';
- } else {
- itp_fn_grid_paging(STOCKMNG02010_DETAIL_GRID_ID, action, param);
- }
- },
- onSortCol: function(index, columnIndex, sortOrder) {
- var sortingFn = {
- callBack: function(args) {
- $(args).trigger('reloadGrid');
- }
- };
- if (itp_fn_check_grid_is_writing(STOCKMNG02010_DETAIL_GRID_ID)) {
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, STOCKMNG02010_DETAIL_GRID_ID);
- return 'stop';
- } else {
- itp_fn_grid_sorting(STOCKMNG02010_DETAIL_GRID_ID, index, sortOrder);
- }
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(STOCKMNG02010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
- $(STOCKMNG02010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(STOCKMNG02010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(STOCKMNG02010_DETAIL_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(STOCKMNG02010_DETAIL_GRID_ID);
- }
- };
|