123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744 |
- require(['config'], function() {
- require([], function($) {
- pageObj.init();
- });
- });
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let modifyObj = {} : 수정화면 Object *
-
- *******************************************************/
- /*화면 변수*/
- const INOUTMNG01010_GRID_ID = '#ITP_INOUTMNG01010_jqGrid';
- const INOUTMNG01010_GRID_LIST = '#ITP_INOUTMNG01010_jqGrid_list';
- const INOUTMNG01010_GRID_PAGER = '#ITP_INOUTMNG01010_jqGridPager';
- const INOUTMNG01010_GRID_EMPTY = '#ITP_INOUTMNG01010_jqGridEmpty';
- const INOUTMNG01010_DETAIL_GRID_ID = '#ITP_INOUTMNG01010_DETAIL_jqGrid';
- const INOUTMNG01010_DETAIL_GRID_LIST = '#ITP_INOUTMNG01010_DETAIL_jqGrid_list';
- const INOUTMNG01010_DETAIL_GRID_PAGER = '#ITP_INOUTMNG01010_DETAIL_jqGridPager';
- const INOUTMNG01010_DETAIL_GRID_EMPTY = '#ITP_INOUTMNG01010_DETAIL_jqGridEmpty';
- //let ITP_FORM_INOUTMNG01010_DETAIL_IS_WRITING = false;
- let INOUTMNG01010_GRID_LAST_ROW_ID;
- /*API URL*/
- let API_DETAIL_GRID_LIST = '/api/pomng/inoutmng/target-grid-list'; // 목록
- let API_DETAIL_SAVE = '/api/pomng/inoutmng/save-inst-shmt'; // 출하지시
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'BRAND_ID', name: 'brandId',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드아이디
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드명
- width: '10', fixed: false, align: 'left',
- minwidth: 100,
- sortable: false, hidden: false
- },
- {
- index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
- label: ITP_MSG_LOCALE.label.pchPodrUnqNo, //구매발주번호
- width: '10', fixed: false, align: 'center',
- minwidth: 140,
- sortable: false, hidden: false
- },
- {
- index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
- label: ITP_MSG_LOCALE.label.pchPodrDtlNo, //구매발주항번
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, //품목아이디
- width: '10', fixed: false, align: 'center',
- minwidth: 140,
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '10', fixed: false, align: 'left',
- minwidth: 100,
- sortable: false, hidden: false
- },
- {
- index: 'WHS_ID', name: 'whsId',
- label: ITP_MSG_LOCALE.label.whsId, //납품창고아이디
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: ITP_MSG_LOCALE.label.whsNm, //납품창고명
- width: '15', fixed: false, align: 'left',
- minwidth: 220,
- sortable: false, hidden: false
- },
- {
- index: 'LOCATION', name: 'location',
- label: ITP_MSG_LOCALE.label.location, //납품LOCATION
- width: '15', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, //단가
- width: '6', fixed: false, align: 'right',
- minwidth: 80,
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'PODR_QTY', name: 'podrQty',
- label: ITP_MSG_LOCALE.label.podrQty, //발주수량
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'SHMT_QTY', name: 'shmtQty',
- label: ITP_MSG_LOCALE.label.shmtQty, //출고수량
- width: '10', fixed: false, align: 'right',
- sortable: true, editable: false, edittype: 'text',
- hidden: true
- },
- {
- index: 'STCK_QTY', name: 'stckQty',
- label: ITP_MSG_LOCALE.label.stckQty, //현 재고
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'EXPRY_YN', name: 'expryYn',
- label: ITP_MSG_LOCALE.label.expryYn, //유통기한여부
- width: '10', fixed: false, align: 'center',
- minwidth: 100,
- sortable: false, hidden: false
- },
- {
- index: 'EXPRY_PERIOD', name: 'expryPeriod',
- label: ITP_MSG_LOCALE.label.expryPeriod, //유통기한기간
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'EXPRY_DATE', name: 'expryDate',
- label: ITP_MSG_LOCALE.label.expryDate, //유통일자
- width: '20', fixed: false, align: 'center',
- sortable: false, hidden: true,
- editable: false, sorttype: "date",
- editoptions: { dataInit: function(e) { $(e).datepicker(ITP_DATE_LANGUAGE); } }
- },
- {
- index: 'PODR_AMT', name: 'podrAmt',
- label: ITP_MSG_LOCALE.label.podrAmt, //발주금액
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'DLV_REQ_DT', name: 'dlvReqDt',
- label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
- width: '10', fixed: false, align: 'center',
- minwidth: 100,
- sortable: false, hidden: false
- },
- {
- index: 'SHMT_WHS_ID', name: 'shmtWhsId',
- label: ITP_MSG_LOCALE.label.shmtWhsId, //출고창고아이디
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: true
- },
- {
- index: 'SHMT_LOCATION', name: 'shmtLocation',
- label: ITP_MSG_LOCALE.label.shmtLocation, //출고LOCATION
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'SHMT_WHS_NM', name: 'shmtWhsNm',
- label: ITP_MSG_LOCALE.label.shmtWhsNm, //출고창고명
- width: '10', fixed: false, align: 'left',
- minwidth: 220,
- sortable: false, hidden: false
- }
- ],
- detail: [
- {
- index: 'BRAND_ID', name: 'brandId',
- label: ITP_MSG_LOCALE.label.brandId, //브랜드아이디
- width: '13', 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: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
- label: ITP_MSG_LOCALE.label.pchPodrUnqNo, //구매발주번호
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
- label: ITP_MSG_LOCALE.label.pchPodrDtlNo, //구매발주항번
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, //품목아이디
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, //품목명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false
- },
- {
- index: 'WHS_ID', name: 'whsId',
- label: ITP_MSG_LOCALE.label.whsId, //납품창고아이디
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: ITP_MSG_LOCALE.label.whsNm, //납품창고명
- width: '15', fixed: false, align: 'left',
- sortable: false, hidden: false
- },
- {
- index: 'LOCATION', name: 'location',
- label: ITP_MSG_LOCALE.label.location, //납품LOCATION
- width: '15', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, //단가
- width: '6', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'PODR_QTY', name: 'podrQty',
- label: ITP_MSG_LOCALE.label.podrQty, //발주수량
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'SHMT_QTY', name: 'shmtQty',
- label: ITP_MSG_LOCALE.label.shmtQty, //출고수량
- width: '10', fixed: false, align: 'right',
- sortable: true, editable: true, edittype: 'text',
- editrules: { required: true, number: true },
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'STCK_QTY', name: 'stckQty',
- label: ITP_MSG_LOCALE.label.stckQty, //현 재고
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'EXPRY_YN', name: 'expryYn',
- label: ITP_MSG_LOCALE.label.expryYn, //유통기한여부
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'EXPRY_PERIOD', name: 'expryPeriod',
- label: ITP_MSG_LOCALE.label.expryPeriod, //유통기한기간
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'EXPRY_DATE', name: 'expryDate',
- label: ITP_MSG_LOCALE.label.expryDate, //유통일자
- width: '20', fixed: false, align: 'center',
- sortable: false, hidden: false,
- editable: true, sorttype: "date",
- editoptions: { dataInit: function(e) { $(e).datepicker(ITP_DATE_LANGUAGE); } }
- },
- {
- index: 'PODR_AMT', name: 'podrAmt',
- label: ITP_MSG_LOCALE.label.podrAmt, //발주금액
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: { defaultValue: '', thousandsSeparator: ',' }
- },
- {
- index: 'DLV_REQ_DT', name: 'dlvReqDt',
- label: ITP_MSG_LOCALE.label.dlvReqDt, //납품요청일
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'SHMT_WHS_ID', name: 'shmtWhsId',
- label: ITP_MSG_LOCALE.label.shmtWhsId, //출고창고아이디
- width: '10', fixed: false, align: 'right',
- sortable: false, hidden: true
- },
- {
- index: 'SHMT_LOCATION', name: 'shmtLocation',
- label: ITP_MSG_LOCALE.label.shmtLocation, //출고LOCATION
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'SHMT_WHS_NM', name: 'shmtWhsNm',
- label: ITP_MSG_LOCALE.label.shmtWhsNm, //출고창고명
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- this.action();
- },
- ui: {
- init: function () {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('INOUTMNG01010');
- // 공통코드 표시
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
- // 조회일자 지정
- var now = new Date();
- $('#ITP_TAB_INOUTMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_FROM_DT').datepicker('setDate', new Date(now.setDate(now.getDate())));
- $('#ITP_FORM_INOUTMNG01010_SEARCH_TO_DT').datepicker('setDate', new Date(now.setDate(now.getDate() + 30)));
- },
- grid: function() {
- itp_fn_jqgrid_resize(INOUTMNG01010_GRID_ID, INOUTMNG01010_GRID_LIST, 'lg');
- //listObj.empty.init();
- itp_fn_fire_window_resize();
- },
- ready: function() {
- listObj.init();
- }
- },
- action: function () {
- var _this = this;
- // 출하창고 조회 버튼 클릭
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SHMT_WHS_NM').on('click', function() {
- _this.popup('S');
- });
- // 출하창고 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_INOUTMNG01010_DELETE_SHMT_WHS_NM').on('click', function() {
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMT_WHS_NM').val('');
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMTWHS_ID').val('');
- });
- // 납품장소 조회 버튼 클릭
- $('#ITP_FORM_INOUTMNG01010_SEARCH_WHS_NM').on('click', function() {
- _this.popup('W');
- });
- // 납품장소 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_INOUTMNG01010_DELETE_WHS_NM').on('click', function() {
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_NM').val('');
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_ID').val('');
- });
- },
- popup: function (arg) {
- var popFn;
- // 팝업
- if (arg == "S") {
- popFn = this.callback.shmtwhs;
- } else {
- popFn = this.callback.whs;
- }
- var whsDvsn = "";
- if (arg == "S") {
- whsDvsn = "W01";
- } else {
- whsDvsn = "W02";
- }
- const key = { brandId: fn_make_user_info.get('brandId'), storeId: fn_make_user_info.get('storeId'), whsDvsn: whsDvsn };
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key, 'S');
-
-
- },
- callback: {
- shmtwhs: function(rowDataPop) {
- if (rowDataPop) {
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMT_WHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMTWHS_ID').val(rowDataPop.whsId);
- }
- },
- whs: function(rowDataPop) {
- if (rowDataPop) {
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_ID').val(rowDataPop.whsId);
- }
- }
- },
- event: {
- init: function () {
- this.button();
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_INOUTMNG01010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_INOUTMNG01010_OUC' : listObj.button.shmtcreat(); break; // 출하생성 버튼
- case 'ITP_BTN_INOUTMNG01010_OUT' : modifyObj.button.save(); break; // 출하지시 버튼
- case 'ITP_BTN_INOUTMNG01010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
- case 'ITP_BTN_INOUTMNG01010_EXCEL' : listObj.excelDown(); break; // 엑셀다운로드
- }
- });
- });
-
- $('body').on('click', function(e) {
-
- var gridId = (INOUTMNG01010_DETAIL_GRID_ID).replace('#', '');
- var rids = $(INOUTMNG01010_DETAIL_GRID_ID).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
-
- itp_fn_grid_reset_selection(e, last_row_id, gridId, 'INOUTMNG01010_DETAIL');
- });
- }
- },
- switchScreen: function(mode) {
- $('.itp_det_head').find('button[id^="ITP_BTN_INOUTMNG01010_"]').each(function(i) {
- $(this).hide();
- });
- $('#ITP_TAB_INOUTMNG01010').find('div[id$="_CONTAINER"]').each(function(i) {
- $(this).hide();
- });
- if(mode == 'LIST') { // 목록
- $('#ITP_AJAX_INOUTMNG01010_LIST_CONTAINER').show();
- $('#ITP_FORM_INOUTMNG01010_DELETE_SHMT_WHS_NM').show();
- $('#ITP_FORM_INOUTMNG01010_DELETE_WHS_NM').show();
- fn_show_btn_auth_array(['#ITP_BTN_INOUTMNG01010_SRH', '#ITP_BTN_INOUTMNG01010_OUC']);
- $('#ITP_FORM_INOUTMNG01010_DETAIL_SBRAND_ID').val(fn_make_user_info.get('brandId'));
-
- $('#ITP_BTN_INOUTMNG01010_EXCEL').show();
- } else if(mode == 'DETAIL') { // 출하지시 상세
- $('#ITP_AJAX_INOUTMNG01010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_INOUTMNG01010_OUT', '#ITP_BTN_INOUTMNG01010_CANCELLIST']);
- $('#ITP_FORM_INOUTMNG01010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
-
- //pageObj.grid.init(param);
- }
- },
- grid: {
- init: function(param) {
- this.gridId = INOUTMNG01010_DETAIL_GRID_ID;
- this.gridList = INOUTMNG01010_DETAIL_GRID_LIST;
- this.gridEmpty = INOUTMNG01010_DETAIL_GRID_EMPTY;
- var now = new Date();
- $('#ITP_TAB_INOUTMNG01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_INOUTMNG01010_DETAIL_DLV_SCH_DT').datepicker('setDate', new Date(param.dlvSchDt));
- $('#ITP_FORM_INOUTMNG01010_DETAIL .fnBrandNm').text(param.brandNm);
-
- this.gridRows = param.recordData;
- this.unload();
- this.load(param.recordData);
-
- },
- gridId: '',
- button: {},
- gridList: '',
- gridEmpty: '',
- gridRows: '',
- load: function(gridRows) {
-
- var _this = this;
- var option = {
- gridId: _this.gridId,
- colModel: gridColModel.detail,
- data: gridRows,
- loadComplete: function(data) {
- $(INOUTMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
- data.records === 0 ? _this.clearData(mode) : $(INOUTMNG01010_DETAIL_GRID_EMPTY).hide();
-
- },
- onCellSelect: function(rowid, cellIdx, cellValue) {
- INOUTMNG01010_GRID_LAST_ROW_ID = itp_fn_set_data_editable(rowid, cellIdx, INOUTMNG01010_GRID_LAST_ROW_ID, _this.gridId, ['pchReqDtlNo']);
- }
- };
- itp_fn_grid_make_local(option);
- },
- clearData : function(mode) {
- $(INOUTMNG01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
- $(INOUTMNG01010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(INOUTMNG01010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(INOUTMNG01010_DETAIL_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(this.gridId);
- }
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_INOUTMNG01010_search: false,
- button: {
- search: function() {
- listObj.itp_INOUTMNG01010_search = true;
- let param = $('#ITP_FORM_INOUTMNG01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(INOUTMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- shmtcreat: function() {
- //선택되어진 row 값 전송할예정
- let gridUpdateData = [];
- const rowKey = $(INOUTMNG01010_GRID_ID).getGridParam('selrow');
- if (!rowKey) {
- return;
- }
- var selectedIds = $(INOUTMNG01010_GRID_ID).getGridParam('selarrrow');
-
- var brandNm = "";
- var maxDlvSchDt = "";
-
- for (var i=selectedIds.length-1; i>=0; i--) {
- var rowData = $(INOUTMNG01010_GRID_ID).jqGrid('getRowData', selectedIds[i]);
-
- gridUpdateData.push(rowData);
- if (rowData.dlvReqDt > maxDlvSchDt) {
- maxDlvSchDt = rowData.dlvReqDt;
- }
- sbrandNm =rowData.brandNm;
- }
-
- let param = {brandNm: sbrandNm, dlvSchDt: maxDlvSchDt };
- param.recordData = gridUpdateData;
- pageObj.switchScreen('DETAIL');
- itp_fn_form_clear_validate(null, '#ITP_FORM_INOUTMNG01010_DETAIL');
- pageObj.grid.init(param);
- }
- },
- empty: {
- init: function() {
- /*
- var _this = this;
- this.push();
- $(INOUTMNG01010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_INOUTMNG01010_param.gridSize = $.jgrid.defaults.rowNum;
- $(INOUTMNG01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_INOUTMNG01010_param)}).trigger('reloadGrid');
- });
- */
- },
- itp_INOUTMNG01010_param: {},
- push: function() {
- /*
- let param = $('#ITP_FORM_INOUTMNG01010_SEARCH').serializeObject();
- listObj.itp_INOUTMNG01010_param = param;
- */
- },
- back: function() {
- /*
- $('#ITP_FORM_INOUTMNG01010_SEARCH_FROM_DT').val(this.itp_INOUTMNG01010_param.fromDt);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_TO_DT').val(this.itp_INOUTMNG01010_param.toDt);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMTWHS_ID').val(this.itp_INOUTMNG01010_param.sshmtWhsId);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SSHMT_WHS_NM').val(this.itp_INOUTMNG01010_param.sshmtWhsNm);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_NM').val(this.itp_INOUTMNG01010_param.swhsNm);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_SWHS_ID').val(this.itp_INOUTMNG01010_param.swhsId);
- $('#ITP_FORM_INOUTMNG01010_SEARCH_ITEM_NM').val(this.itp_INOUTMNG01010_param.sItemNm);
- */
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- listObj.empty.push();
- itp_fn_jqgrid_resize(INOUTMNG01010_GRID_ID, INOUTMNG01010_GRID_LIST, 'lg');
- itp_fn_fire_window_resize();
- this.search();
-
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_INOUTMNG01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
-
- var option = {
- multiselect: true,
- autowidth: true,
- gridId: INOUTMNG01010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_DETAIL_GRID_LIST,
- pager: INOUTMNG01010_GRID_PAGER,
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, INOUTMNG01010_GRID_ID, true, 'number', 'INOUTMNG01010', listObj.itp_INOUTMNG01010_search, listObj.empty, true, data.gridRecords, true);
- },
- onPaging: function(action) {
- itp_fn_grid_paging(INOUTMNG01010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- button: {
- },
- unload : function() {
- $.jgrid.gridUnload(INOUTMNG01010_GRID_ID);
- },
- clearData : function() {
- $(INOUTMNG01010_GRID_ID).jqGrid('clearGridData', true);
- $(INOUTMNG01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(INOUTMNG01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(INOUTMNG01010_GRID_EMPTY).show();
- }
- },
- excelDown: function() {
- var param = {
- 'url': API_DETAIL_GRID_LIST,
- 'param': $('#ITP_FORM_INOUTMNG01010_SEARCH').serializeObject(),
- 'gridColumns': $(INOUTMNG01010_GRID_ID).jqGrid('getGridParam', 'colModel'),
- 'fileName': '출하지시대상정보.xlsx',
- 'sheetName': '출하지시대상리스트'
- };
- itp_fn_remote_to_excel(param);
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function (param) {
- this.load(param);
- },
- button: {
- modify: function (param) {
- itp_fn_form_clear_validate(null, '#ITP_FORM_INOUTMNG01010_DETAIL');
- //const selectVal = $('#ITP_FORM_INOUTMNG01010_VIEW_STORE_ID').val();
- //const key = {brandId:fn_make_user_info.get('brandId'), storeId: selectVal, viewCd: 'R'};
- //var param = $.param(key);
- //modifyObj.load(param);
- },
- cancel: function() {
- document.getElementById('ITP_FORM_INOUTMNG01010_DETAIL').reset();
- listObj.grid.search();
- },
- save: function() {
- $('body').trigger('click');
- const formId = ('#ITP_FORM_INOUTMNG01010_DETAIL');
- itp_fn_form_clear_validate(null, formId);
- if (itp_fn_form_event.isValid(formId)) {
-
- var modalFn = {
- callBack: () => {
- itp_fn_form_event.removeChar('#ITP_FORM_INOUTMNG01010_DETAIL');
- var chkQtyYn = "N";
- let gridInsertData = [];
- const rowData = $(INOUTMNG01010_DETAIL_GRID_ID).getRowData();
-
- $.each(rowData, function(key, value) {
-
- if (value.shmtQty == '' || parseInt(value.shmtQty) < 1 ) {
- alert("출고수량을 입력해주세요!");
- chkQtyYn = "Y";
- return false;
- }
-
- if (parseInt(value.stckQty) < parseInt(value.shmtQty)) {
- alert("출고지시할 수량이 부족합니다.");
- chkQtyYn = "Y";
- return false;
- }
-
-
- if (parseInt(value.podrQty) < parseInt(value.shmtQty) ) {
- alert("출고수량이 발주수량보다 클수 없습니다!");
- chkQtyYn = "Y";
- return false;
- }
-
- gridInsertData.push(value);
- });
-
- if (chkQtyYn == "Y") return;
-
- let param = $(formId).serializeObject();
- param.viewCd = "C";
- param.gridInsertData = gridInsertData;
- console.log(JSON.stringify(param));
- var searhFn = function () {
- //ITP_FORM_INOUTMNG01010_DETAIL_IS_WRITING = false;
- pageObj.grid.clearData();
- modifyObj.button.cancel();
- }
- fn_ajax_call(API_DETAIL_SAVE, JSON.stringify(param), searhFn, 'POST');
- }
- };
- itp_fn_modal_confirm('출하지시 하시겠습니까?', modalFn);
- }
- }
- },
-
- load: function(param) {
- //console.log(param);
- //pageObj.grid.load("DETAIL",param);
- }
- };
|